@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,500;9..144,600&display=swap');

:root {
    color-scheme: light;
    --ink: #1d302b;
    --muted: #72807b;
    --line: #e4e9e4;
    --paper: #f7f8f4;
    --white: #fff;
    --forest: #153c35;
    --leaf: #d6f06a;
    --coral: #e8795d;
    --soft-green: #edf3e8;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'DM Sans', 'Avenir Next', sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; }
.app-main { width: 100%; }

.topbar {
    height: 72px;
    padding: 0 max(5vw, 24px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 700; letter-spacing: 0; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; background: var(--forest); color: var(--leaf); font-family: 'Fraunces', Georgia, serif; font-size: 19px; }
.brand-period, .title-period { color: var(--coral); }
.topbar-nav { display: flex; gap: 34px; height: 100%; align-items: center; }
.nav-link { height: 100%; display: inline-flex; align-items: center; position: relative; color: var(--muted); font-size: 13px; font-weight: 600; }
.nav-link.active { color: var(--forest); }
.nav-link.active::after { content: ''; position: absolute; height: 3px; left: 0; right: 0; bottom: -1px; background: var(--coral); }
.topbar-profile { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.connection-dot, .session-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #81aa62; }
.profile-initials { width: 32px; height: 32px; margin-left: 8px; display: grid; place-items: center; border: 1px solid #d9e1d9; border-radius: 50%; color: var(--forest); font-size: 12px; font-weight: 700; }

.workspace { width: min(1160px, calc(100% - 48px)); margin: 0 auto; padding: 46px 0 70px; }
.auth-workspace { width: min(100% - 32px, 460px); min-height: calc(100vh - 128px); margin: 0 auto; display: grid; place-items: center; padding: 32px 0; }
.auth-panel { width: 100%; padding: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); box-shadow: 0 20px 45px rgb(26 61 53 / 8%); }
.auth-form { display: grid; gap: 9px; margin-top: 24px; }
.auth-form label { color: var(--forest); font-size: 12px; font-weight: 700; }
.auth-form .check-button { width: 100%; margin-top: 8px; }
.auth-actions { display: grid; gap: 13px; margin-top: 18px; justify-items: start; }
.google-button { width: 100%; height: 46px; border: 1px solid #d5ddd7; border-radius: 5px; background: var(--white); color: var(--forest); font-size: 12px; font-weight: 700; }
.google-button:hover { background: #f5f8f4; }
.google-button:disabled { cursor: not-allowed; opacity: .45; }
.password-policy { margin: 1px 0 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.settings-label { display: block; margin: 24px 0 9px; color: var(--forest); font-size: 12px; font-weight: 700; }
.welcome-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 9px; display: flex; align-items: center; gap: 9px; color: #698078; font-size: 10px; font-weight: 700; letter-spacing: 0; }
.eyebrow-line { width: 20px; height: 2px; background: var(--coral); }
.level-tag { padding: 3px 7px; border-radius: 4px; background: var(--soft-green); color: var(--forest); font-size: 9px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-family: 'Fraunces', Georgia, serif; font-size: 42px; font-weight: 500; line-height: 1.14; letter-spacing: 0; }
.welcome-copy { margin: 0; color: var(--muted); font-size: 14px; }
.daily-stats { display: flex; align-items: center; gap: 20px; padding-bottom: 4px; }
.stat-item { display: flex; flex-direction: column; gap: 2px; }
.stat-number { color: var(--forest); font-family: 'Fraunces', Georgia, serif; font-size: 24px; line-height: 1; }
.stat-label { color: var(--muted); font-size: 10px; }
.stat-divider { height: 31px; width: 1px; background: var(--line); }

.study-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: stretch; }
.study-panel, .side-panel > section { border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.study-panel { min-height: 435px; padding: 20px 24px 0; display: flex; flex-direction: column; }
.panel-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mode-switch { padding: 3px; display: inline-flex; gap: 2px; border: 1px solid var(--line); border-radius: 6px; background: #f7f8f5; }
.mode-option { min-height: 32px; padding: 0 13px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; }
.mode-option.selected { background: var(--forest); color: var(--white); }
.session-label { display: flex; align-items: center; gap: 7px; color: #82908a; font-size: 9px; font-weight: 700; }
.session-dot { width: 6px; height: 6px; background: var(--coral); }
.progress-track, .goal-track { overflow: hidden; background: #edf0eb; }
.progress-track { height: 3px; margin-top: 20px; }
.progress-track span, .goal-track span { height: 100%; display: block; background: var(--coral); transition: width 220ms ease; }
.question-area { min-height: 194px; padding: 37px 0 22px; text-align: center; }
.question-kicker { margin-bottom: 13px; color: #87938d; font-size: 9px; font-weight: 700; }
.prompt-line { display: flex; align-items: baseline; justify-content: center; gap: 11px; }
.prompt-word { margin-bottom: 8px; color: var(--forest); font-family: 'Fraunces', Georgia, serif; font-size: 37px; font-weight: 500; line-height: 1.2; }
.prompt-divider, .prompt-context { color: #a7b1ab; font-family: 'Fraunces', Georgia, serif; font-size: 23px; }
.question-hint { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.question-hint em { color: var(--forest); font-family: 'Fraunces', Georgia, serif; }
.answer-form { display: flex; gap: 9px; width: min(440px, 100%); margin: 0 auto; }
.answer-input { min-width: 0; height: 46px; flex: 1; padding: 0 14px; border: 1px solid #dfe5df; border-radius: 5px; outline: 0; color: var(--ink); background: #fcfdfa; font-size: 13px; transition: border-color 150ms, box-shadow 150ms; }
.answer-input::placeholder { color: #9ca7a1; }
.answer-input:focus { border-color: #73927e; box-shadow: 0 0 0 3px #e9f0e7; }
.answer-input:disabled { color: var(--muted); background: #f7f8f5; }
.check-button, .next-button { height: 46px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; border: 0; border-radius: 5px; background: var(--forest); color: var(--white); font-size: 12px; font-weight: 600; transition: background 150ms; }
.check-button:hover, .next-button:hover { background: #21554a; }
.check-button:disabled { cursor: not-allowed; opacity: .45; }
.keyboard-note { margin: 10px 0 0; color: #9ba6a0; text-align: center; font-size: 10px; }
kbd { padding: 2px 5px; border: 1px solid #dce2dc; border-radius: 3px; background: #f8f9f6; color: #67746e; font-family: inherit; font-size: 9px; }
.answer-feedback { width: min(440px, 100%); min-height: 59px; margin: 0 auto; padding: 8px 10px 8px 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid; border-radius: 5px; }
.feedback-correct { border-color: #d4e6c9; background: #f1f7eb; }
.feedback-incorrect { border-color: #f1d5cc; background: #fff4ef; }
.answer-feedback > div { display: flex; flex-direction: column; gap: 1px; }
.feedback-title { color: #687b67; font-size: 10px; }
.feedback-answer { color: var(--forest); font-family: 'Fraunces', Georgia, serif; font-size: 18px; }
.next-button { height: 36px; padding: 0 12px; font-size: 11px; }
.card-footer { min-height: 45px; margin-top: auto; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #edf0eb; color: #849089; font-size: 10px; }
.card-category { padding: 4px 8px; border-radius: 4px; background: var(--soft-green); color: #587063; }
.card-count { font-size: 9px; font-weight: 700; }
.card-count span { color: #a1aaa4; font-weight: 500; }

.side-panel { display: grid; grid-template-rows: 1fr 1.18fr; gap: 16px; }
.side-panel > section { padding: 17px 18px; }
.daily-goal { background: var(--forest) !important; color: var(--white); border-color: var(--forest) !important; }
.side-heading { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 12px; font-weight: 700; }
.daily-goal .side-heading { color: var(--white); }
.side-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 5px; font-size: 16px; }
.goal-icon { background: #315c4f; color: var(--leaf); }
.list-icon { background: #f1f4ef; color: var(--forest); font-size: 18px; }
.goal-number { margin: 17px 0 0; color: var(--leaf); font-family: 'Fraunces', Georgia, serif; font-size: 31px; line-height: 1; }
.goal-number span { color: #a9c0b2; font-family: 'DM Sans', sans-serif; font-size: 12px; }
.goal-copy { margin: 5px 0 13px; color: #b3c5bb; font-size: 10px; }
.goal-track { height: 4px; border-radius: 5px; background: #335e52; }
.goal-track span { border-radius: 5px; background: var(--leaf); }
.goal-footnote { margin-top: 9px; display: block; color: #a8beb2; font-family: 'Fraunces', Georgia, serif; font-size: 11px; font-style: italic; }
.up-next .side-heading h2 { margin: 0; font-size: 12px; }
.up-next-list { margin: 12px 0 8px; padding: 0; list-style: none; }
.up-next-list li { min-width: 0; display: grid; grid-template-columns: 7px 1fr auto; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f0f2ef; }
.word-bullet { width: 5px; height: 5px; align-self: center; border-radius: 50%; background: var(--coral); }
.up-next-french { color: var(--forest); font-family: 'Fraunces', Georgia, serif; font-size: 13px; }
.up-next-spanish { max-width: 115px; overflow: hidden; color: #89948e; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.library-link { display: flex; justify-content: space-between; color: #496e5d; font-size: 10px; font-weight: 600; }

.library-section { margin-top: 55px; scroll-margin-top: 28px; }
.library-heading { margin-bottom: 16px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.library-heading .eyebrow { margin-bottom: 6px; }
.library-heading h2 { margin: 0; font-family: 'Fraunces', Georgia, serif; font-size: 28px; font-weight: 500; }
.library-count { padding-bottom: 4px; color: var(--muted); font-size: 11px; }
.library-count span { padding: 0 4px; color: var(--coral); }
.word-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 7px; background: var(--white); }
.word-table { width: 100%; border-collapse: collapse; text-align: left; }
.word-table th { height: 39px; padding: 0 17px; border-bottom: 1px solid var(--line); color: #8a9690; font-size: 9px; font-weight: 700; }
.word-table td { height: 47px; padding: 0 17px; border-bottom: 1px solid #eff1ee; color: #697771; font-size: 11px; }
.word-table tbody tr:last-child td { border-bottom: 0; }
.table-french { color: var(--forest) !important; font-family: 'Fraunces', Georgia, serif; font-size: 15px !important; }
.part-tag, .cefr-tag { padding: 3px 7px; border-radius: 4px; background: #f1f4ef; color: #67786f; font-size: 9px; }
.cefr-tag { background: #fff2e8; color: #ae654a; font-weight: 700; }
.status-message, .error-message { padding: 26px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--muted); }
.error-message { border-color: #efd6cc; color: #864d3b; }
.text-button { padding: 0; border: 0; background: none; color: var(--forest); font-size: 12px; font-weight: 700; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

#blazor-error-ui { display: none; }

@media (max-width: 760px) {
    .topbar { height: 62px; padding: 0 20px; }
    .topbar-nav { gap: 18px; }
    .nav-link { font-size: 11px; }
    .topbar-profile > span:not(.profile-initials):not(.connection-dot) { display: none; }
    .profile-initials { margin-left: 1px; }
    .workspace { width: min(100% - 32px, 560px); padding: 32px 0 48px; }
    .welcome-row { align-items: flex-start; flex-direction: column; gap: 17px; margin-bottom: 21px; }
    h1 { font-size: 35px; }
    .daily-stats { gap: 15px; }
    .study-grid { grid-template-columns: 1fr; gap: 12px; }
    .study-panel { min-height: 420px; padding: 15px 16px 0; }
    .side-panel { grid-template-columns: 1fr 1.15fr; grid-template-rows: auto; gap: 10px; }
    .side-panel > section { padding: 14px 12px; }
    .goal-number { margin-top: 14px; }
    .up-next-list li { grid-template-columns: 6px 1fr; }
    .up-next-spanish { display: none; }
    .library-section { margin-top: 39px; }
    .word-table th, .word-table td { padding: 0 11px; }
}

@media (max-width: 420px) {
    .brand { gap: 7px; font-size: 18px; }
    .brand-mark { width: 28px; height: 28px; }
    .topbar-nav { gap: 12px; }
    .workspace { width: calc(100% - 24px); }
    .study-panel { min-height: 410px; }
    .session-label { font-size: 8px; }
    .mode-option { padding: 0 9px; font-size: 10px; }
    .prompt-word { font-size: 31px; }
    .check-button { padding: 0 12px; gap: 7px; }
    .side-panel { grid-template-columns: 1fr; }
    .daily-goal { min-height: 178px; }
    .up-next-list li { grid-template-columns: 7px 1fr auto; }
    .up-next-spanish { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}