:root {
    color-scheme: light;
    --ink: #1f2522;
    --muted: #66706b;
    --line: #d9ddd7;
    --paper: #fffdf8;
    --wash: #f2f5ef;
    --green: #2f6f5e;
    --green-dark: #214f43;
    --red: #8c3f46;
    --gold: #c08b2c;
    --blue: #315f8f;
    --shadow: 0 18px 50px rgba(31, 37, 34, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-text-size-adjust: 100%;
}

a {
    color: inherit;
}

main {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 18px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    font-weight: 800;
    text-decoration: none;
    color: var(--green-dark);
}

.nav {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.95rem;
}

.nav a,
.link-button {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    text-decoration: none;
}

.nav-cta {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--ink) !important;
}

.hero {
    min-height: calc(100vh - 86px);
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.72fr);
    align-items: center;
    gap: 42px;
    padding-bottom: 46px;
}

.eyebrow {
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 12px;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

.hero h1 {
    max-width: 740px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3rem, 9vw, 6.9rem);
    line-height: 0.92;
    margin-bottom: 24px;
}

.lead {
    max-width: 620px;
    color: var(--muted);
    font-size: 1.18rem;
    line-height: 1.7;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.button {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid transparent;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
}

.button.primary {
    background: var(--green);
    color: white;
}

.button.secondary {
    background: white;
    border-color: var(--line);
    color: var(--green-dark);
}

.button.full {
    width: 100%;
}

.hero-panel,
.panel,
.auth-card,
.study-card,
.features article,
.metrics article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    box-shadow: var(--shadow);
}

.hero-panel {
    padding: 28px;
}

.hero-panel span,
.card-meta span {
    color: var(--blue);
    font-size: 0.85rem;
    font-weight: 800;
}

.hero-panel strong {
    display: block;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.2rem;
    line-height: 1.05;
    margin: 22px 0;
}

.hero-panel p,
.muted {
    color: var(--muted);
}

.features,
.metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 0 0 48px;
}

.features article,
.metrics article {
    padding: 22px;
}

.features h2,
.panel h2,
.answer h2 {
    font-size: 1rem;
    margin-bottom: 10px;
}

.features p,
.panel p {
    color: var(--muted);
    line-height: 1.55;
    margin-bottom: 0;
}

.auth-shell,
.study-shell,
.empty-state {
    min-height: calc(100vh - 86px);
    display: grid;
    place-items: center;
    padding: 34px 0 58px;
}

.auth-card {
    width: min(460px, 100%);
    padding: 28px;
}

.auth-card h1,
.dashboard-head h1,
.empty-state h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.4rem;
    line-height: 1;
    margin-bottom: 12px;
}

label {
    display: grid;
    gap: 7px;
    margin: 16px 0;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
}

input:focus {
    border-color: var(--green);
    outline: 3px solid rgba(47, 111, 94, 0.14);
}

.error,
.error-block {
    color: var(--red);
    font-weight: 700;
}

.center {
    text-align: center;
}

.messages {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.message {
    border-radius: 8px;
    padding: 12px 14px;
    background: var(--wash);
}

.dashboard-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    padding: 42px 0 26px;
}

.metrics article span {
    display: block;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.metrics article p {
    color: var(--muted);
    margin: 0;
}

.content-grid {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 16px;
    padding-bottom: 48px;
}

.panel {
    padding: 24px;
}

.big-number {
    color: var(--green-dark) !important;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.8rem;
    font-weight: 800;
}

.review-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.review-list li {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.review-list span {
    color: var(--blue);
    font-size: 0.82rem;
    font-weight: 800;
}

.study-card {
    width: min(760px, 100%);
    padding: 30px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 28px;
}

.prompt-label {
    color: var(--muted);
    line-height: 1.6;
}

.listen-first {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--wash);
    padding: 26px;
    margin-bottom: 22px;
    text-align: center;
}

.play-button {
    -webkit-appearance: none;
    appearance: none;
    width: min(260px, 100%);
    min-height: 88px;
    border: 1px solid var(--green);
    border-radius: 8px;
    background: white;
    color: var(--green-dark);
    cursor: pointer;
    display: inline-grid;
    gap: 8px;
    place-items: center;
    padding: 16px;
    font: inherit;
    touch-action: manipulation;
}

.play-button:hover,
.small-play:hover {
    border-color: var(--gold);
}

.play-button.is-playing,
.small-play.is-playing {
    outline: 3px solid rgba(47, 111, 94, 0.16);
}

.play-icon {
    align-items: center;
    border: 2px solid currentColor;
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 800;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.audio-help {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 14px auto 0;
    max-width: 460px;
}

.audio-help.compact {
    margin: 6px 0 0;
    max-width: 540px;
}

.phrase-head {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.small-play {
    -webkit-appearance: none;
    appearance: none;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: white;
    color: var(--green-dark);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    touch-action: manipulation;
}

.study-card h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.8rem, 4.8vw, 3.2rem);
    line-height: 1.12;
    margin-bottom: 22px;
}

.translation {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfaf5;
    padding: 16px 18px;
    margin-bottom: 14px;
}

.translation span {
    display: block;
    color: var(--green-dark);
    font-size: 0.82rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.translation p {
    font-size: 1.15rem;
    line-height: 1.5;
    margin-bottom: 0;
}

.answer {
    border-left: 4px solid var(--gold);
    background: var(--wash);
    padding: 18px 20px;
    margin-bottom: 22px;
}

.answer p {
    line-height: 1.65;
    margin-bottom: 0;
}

.grade-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.grade-grid button {
    -webkit-appearance: none;
    appearance: none;
    min-height: 84px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    color: var(--ink);
    font: inherit;
    padding: 12px;
    text-align: left;
    touch-action: manipulation;
}

.grade-grid button:hover {
    border-color: var(--green);
}

.grade-grid strong,
.grade-grid span {
    display: block;
}

.grade-grid span {
    color: var(--muted);
    font-size: 0.82rem;
    margin-top: 6px;
}

.empty-state {
    text-align: center;
}

@media (max-width: 820px) {
    .hero,
    .features,
    .metrics,
    .content-grid {
        grid-template-columns: 1fr;
    }

    .grade-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero {
        min-height: auto;
        padding-top: 34px;
    }

    .dashboard-head,
    .topbar,
    .card-meta,
    .phrase-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav {
        flex-wrap: wrap;
    }
}

@media (max-width: 560px) {
    main,
    .topbar,
    .messages {
        width: min(100% - 20px, 1120px);
    }

    .topbar {
        padding: 12px 0;
        gap: 10px;
    }

    .brand {
        font-size: 1rem;
    }

    .nav {
        width: 100%;
        gap: 8px;
    }

    .nav a,
    .link-button {
        min-height: 38px;
        padding: 8px 0;
    }

    .nav-cta {
        padding: 8px 10px;
    }

    .hero {
        gap: 22px;
        padding-bottom: 28px;
    }

    .hero h1 {
        font-size: clamp(2.4rem, 15vw, 3.8rem);
        line-height: 0.98;
        margin-bottom: 18px;
    }

    .lead {
        font-size: 1rem;
        line-height: 1.55;
    }

    .hero-panel,
    .panel,
    .auth-card,
    .study-card,
    .features article,
    .metrics article {
        box-shadow: 0 10px 28px rgba(31, 37, 34, 0.08);
    }

    .hero-panel,
    .auth-card,
    .study-card,
    .panel {
        padding: 18px;
    }

    .hero-panel strong {
        font-size: 1.65rem;
    }

    .actions,
    .button {
        width: 100%;
    }

    .auth-shell,
    .study-shell,
    .empty-state {
        align-items: start;
        min-height: auto;
        padding: 18px 0 36px;
    }

    .dashboard-head {
        padding: 24px 0 18px;
    }

    .auth-card h1,
    .dashboard-head h1,
    .empty-state h1 {
        font-size: 2rem;
    }

    .metrics {
        gap: 10px;
        padding-bottom: 28px;
    }

    .metrics article span,
    .big-number {
        font-size: 2rem;
    }

    .content-grid {
        padding-bottom: 32px;
    }

    .study-card {
        padding: 18px;
    }

    .card-meta {
        gap: 8px;
        margin-bottom: 18px;
    }

    .listen-first {
        padding: 18px;
        margin-bottom: 18px;
    }

    .play-button {
        width: 100%;
        min-height: 78px;
    }

    .phrase-head {
        gap: 10px;
    }

    .small-play {
        width: 100%;
        justify-content: center;
    }

    .study-card h1 {
        font-size: clamp(1.55rem, 9vw, 2.45rem);
        line-height: 1.15;
        overflow-wrap: anywhere;
    }

    .translation,
    .answer {
        padding: 14px;
    }

    .translation p {
        font-size: 1.03rem;
    }

    .grade-grid {
        grid-template-columns: 1fr;
    }

    .grade-grid button {
        min-height: 68px;
    }
}
