@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    --bg-a: #0a151f;
    --bg-b: #123040;
    --bg-c: #1a494a;
    --surface: rgba(10, 25, 33, 0.74);
    --surface-strong: rgba(8, 22, 29, 0.86);
    --border: rgba(204, 241, 255, 0.2);
    --text: #ecf8ff;
    --muted: rgba(236, 248, 255, 0.72);
    --accent: #58d0bd;
    --accent-2: #f0bb56;
    --ok: #48d28f;
    --warn: #f08a66;
    --meter-bg: rgba(7, 22, 30, 0.95);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 22px;
    color: var(--text);
    font-family: "Space Grotesk", "Avenir Next", sans-serif;
    background: linear-gradient(140deg, var(--bg-a), var(--bg-b) 50%, var(--bg-c));
    line-height: 1.55;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: -30%;
    background:
        radial-gradient(48% 45% at 18% 20%, rgba(88, 208, 189, 0.21), transparent 66%),
        radial-gradient(42% 38% at 82% 22%, rgba(240, 187, 86, 0.16), transparent 70%),
        radial-gradient(46% 40% at 45% 80%, rgba(109, 190, 255, 0.14), transparent 72%);
    pointer-events: none;
    z-index: 0;
}

.app-shell {
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.top-bar,
.hero,
.deck-meta,
.stats-grid,
.meter-wrap,
.panel,
.completion-state {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    backdrop-filter: blur(8px);
}

.top-bar,
.hero,
.deck-meta,
.stats-grid,
.meter-wrap,
.quiz-stage {
    margin-bottom: 14px;
}

.top-bar {
    padding: 12px 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(88, 208, 189, 0.42);
    color: var(--text);
    text-decoration: none;
    background: rgba(9, 28, 37, 0.72);
}

.nav-link-muted {
    border-color: rgba(204, 241, 255, 0.24);
}

.hero {
    padding: 22px;
}

.hero h1 {
    margin: 0 0 6px;
    letter-spacing: 0.4px;
}

.hero-copy {
    margin: 0 0 14px;
    color: var(--muted);
    max-width: 820px;
}

.status {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tab-bar-sub {
    margin-top: 10px;
}

.tab-button {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(204, 241, 255, 0.23);
    background: rgba(8, 24, 31, 0.9);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease;
}

.tab-button:hover {
    transform: translateY(-1px);
}

.tab-button.is-active {
    border-color: rgba(88, 208, 189, 0.75);
    background: linear-gradient(135deg, rgba(88, 208, 189, 0.22), rgba(240, 187, 86, 0.2));
}

.deck-meta {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.eyebrow {
    margin: 0 0 3px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.45px;
    text-transform: uppercase;
}

.deck-meta h2 {
    margin: 0 0 5px;
}

.deck-description {
    margin: 0;
    color: var(--muted);
}

.stats-grid {
    padding: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

.stat-card {
    margin: 0;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(204, 241, 255, 0.15);
    background: rgba(8, 25, 34, 0.84);
}

.stat-label {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.35px;
}

.stat-value {
    margin: 4px 0 0;
    font-size: 28px;
    line-height: 1.1;
    color: var(--accent);
    font-weight: 700;
}

.meter-wrap {
    padding: 14px;
}

.meter-label {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 13px;
}

.meter {
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--meter-bg);
    border: 1px solid rgba(204, 241, 255, 0.18);
}

.meter-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    transition: width 240ms ease;
}

.quiz-stage {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 12px;
}

.panel {
    padding: 18px;
}

.card-position {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-family: "IBM Plex Mono", monospace;
}

.card-question {
    margin: 8px 0 12px;
    white-space: pre-line;
}

.recall-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
}

.recall-input {
    width: 100%;
    min-height: 120px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(88, 208, 189, 0.4);
    background: rgba(7, 21, 29, 0.88);
    color: var(--text);
    font: inherit;
    resize: vertical;
}

.recall-input:focus {
    outline: none;
    border-color: rgba(88, 208, 189, 0.82);
    box-shadow: 0 0 0 3px rgba(88, 208, 189, 0.2);
}

.actions {
    margin-top: 10px;
}

button {
    min-height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid rgba(240, 187, 86, 0.5);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #082028;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease;
}

button:hover {
    transform: translateY(-1px);
}

.button-subtle {
    border-color: rgba(204, 241, 255, 0.26);
    background: rgba(8, 24, 31, 0.95);
    color: var(--text);
}

.hint {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.hint code {
    font-family: "IBM Plex Mono", monospace;
    color: var(--text);
}

.answer-card h4 {
    margin: 0 0 10px;
}

.answer-list {
    margin: 0;
    padding-left: 18px;
}

.answer-list li {
    margin-bottom: 6px;
}

.answer-note {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.rating-row {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.completion-state {
    padding: 18px;
}

.completion-state h3 {
    margin: 0 0 8px;
    color: var(--ok);
}

.completion-state p {
    margin: 0 0 10px;
    color: var(--muted);
}

.hidden {
    display: none !important;
}

@media (max-width: 720px) {
    body {
        padding: 14px;
    }

    .hero,
    .deck-meta,
    .panel {
        padding: 16px;
    }

    .stat-value {
        font-size: 24px;
    }
}
