:root {
  --ink: #17231f;
  --muted: #68756f;
  --green: #176247;
  --green-dark: #103d30;
  --mint: #dff0e8;
  --cream: #f7f5ee;
  --paper: #fffefb;
  --line: #dedfd8;
  --yellow: #f3e6a9;
  --blue: #dbe9f2;
  --shadow: 0 14px 40px rgba(31, 54, 44, .09);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #f1f5ef 0, var(--cream) 420px);
  font-family: "Segoe UI", "Noto Sans KR", system-ui, sans-serif;
  line-height: 1.55;
}
button, select { font: inherit; }
.shell { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }
.topbar { background: rgba(255,255,255,.86); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.topbar-inner { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-weight: 800; font-size: 18px; }
.brand small { color: var(--muted); font-weight: 600; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: white; background: var(--green); font-family: Georgia, serif; font-size: 24px; }
.button { border: 0; border-radius: 14px; padding: 11px 17px; cursor: pointer; font-weight: 750; transition: transform .15s, filter .15s; }
.button:hover { filter: brightness(.96); }
.button:active { transform: translateY(1px); }
.button-quiet { background: #edf0eb; color: var(--green-dark); }
.button-primary { color: white; background: var(--green); box-shadow: 0 10px 24px rgba(23,98,71,.25); }
.button-large { width: min(520px, 100%); padding: 17px 24px; font-size: 18px; }
.button:disabled { cursor: not-allowed; background: #9ca7a1; box-shadow: none; }
.welcome { padding: 54px 0 27px; }
.welcome h1 { margin: 3px 0 8px; max-width: 700px; font: 700 clamp(34px, 6vw, 56px)/1.08 Georgia, "Times New Roman", serif; }
.welcome > p:last-child { color: var(--muted); font-size: 17px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.hero-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.card { padding: 27px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.card-heading { display: flex; align-items: flex-start; gap: 16px; }
.card h2 { margin: 0; font-size: clamp(21px, 3vw, 29px); line-height: 1.25; }
.icon-circle { display: grid; place-items: center; flex: 0 0 54px; height: 54px; border-radius: 18px; background: var(--mint); color: var(--green); font-size: 11px; font-weight: 900; }
.topic { min-height: 26px; margin: 22px 0; color: #415149; }
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); }
.status { padding: 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 750; }
.status-unlearned { color: #6c581a; background: var(--yellow); }
.status-learning { color: #24536a; background: var(--blue); }
.status-completed { color: var(--green); background: var(--mint); }
.unit-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 22px 0; }
.unit { display: flex; flex-direction: column; align-items: center; padding: 15px; border-radius: 18px; color: white; background: var(--green-dark); }
.unit span { font-size: 10px; letter-spacing: .12em; opacity: .7; }
.unit strong { font: 700 32px Georgia, serif; }
.small-text, .empty-help { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.start-form { padding: 27px 0; text-align: center; }
.start-form p { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.today-actions form { margin: 0; }
.study-mode-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(720px, 100%); margin: 0 auto; }
.study-mode-buttons .button { width: 100%; }
.study-mode-buttons small { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; }
.reroll-button { margin-top: 12px; border: 1px solid var(--line); color: var(--green-dark); background: var(--paper); }
.random-scope { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 28px; }
.source-library { margin: 28px 0; }
.new-book-notice { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin: 22px 0; padding: 20px; border: 1px solid #b8d4c4; border-radius: 18px; background: var(--mint); }
.new-book-notice h2,.new-book-notice p { margin: 4px 0; }
.new-book-notice > div:last-child { display: flex; gap: 8px; }
.new-book-notice form { margin: 0; }
.source-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.source-grid a { display: grid; gap: 5px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--paper); text-decoration: none; }
.source-grid span { color: var(--muted); font-size: 12px; }
.source-summary { margin-top: 18px; }
.source-progress { margin: 20px 0; }
.source-progress > div { height: 10px; margin-top: 8px; overflow: hidden; border-radius: 99px; background: #e3e7e2; }
.source-progress i { display: block; height: 100%; background: var(--green); }
.source-tools,.material-edit-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.source-materials { margin-top: 32px; }
.source-material { display: grid; grid-template-columns: 42px 1fr; gap: 12px; margin: 11px 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.source-material.excluded { opacity: .58; }
.material-index { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: white; background: var(--green); font-weight: 800; }
.source-material-title { display: flex; justify-content: space-between; gap: 15px; }
.source-material-title h3 { margin: 0; }
.source-material-title span { color: var(--muted); font-size: 12px; }
.material-edit { margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; }
.material-edit summary { cursor: pointer; font-weight: 750; }
.material-edit form { margin-top: 10px; }
.material-edit label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.material-edit input { min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.stat-card { padding: 20px; border: 1px solid var(--line); border-radius: 19px; background: rgba(255,255,255,.75); }
.stat-card span { display: block; color: var(--muted); font-size: 13px; }
.stat-card strong { font: 700 35px Georgia, serif; }
.stat-card small { margin-left: 4px; color: var(--muted); }
.stat-card.review { background: #fff9df; }
.stat-card.completed { background: #e9f5ef; }
.library { margin-bottom: 70px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 15px; }
.section-heading h2 { margin: 0; font-size: 26px; }
.section-heading > span { color: var(--muted); font-size: 14px; }
.document-list { display: grid; gap: 10px; }
.document-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.material-actions { display: flex; align-items: center; gap: 10px; }
.material-open { min-width: 104px; color: white; background: var(--green); text-align: center; text-decoration: none; }
.material-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.material-filters a { padding: 8px 13px; border-radius: 999px; color: var(--muted); background: #e9ece7; text-decoration: none; font-size: 13px; font-weight: 750; }
.material-filters a.active { color: white; background: var(--green); }
.ai-status-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 42px; padding: 21px 24px; border: 1px solid var(--line); border-radius: 20px; background: white; }
.ai-status-card h2, .ai-status-card p { margin: 2px 0; }
.ai-status-card small { color: var(--muted); }
.ai-status-card.status-connected { border-color: #7fb79c; background: #edf8f2; }
.ai-status-card.status-invalid_key, .ai-status-card.status-quota, .ai-status-card.status-network, .ai-status-card.status-temporary_error { border-color: #d3a097; background: #fff4f1; }
.recent-learning { margin-bottom: 42px; }
.recent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.recent-grid a { display: grid; gap: 7px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: white; text-decoration: none; }
.recent-grid span { color: var(--green); font-size: 12px; font-weight: 750; }
.document-info { display: flex; align-items: center; min-width: 0; gap: 15px; }
.document-info h3 { overflow-wrap: anywhere; margin: 0 0 4px; font-size: 17px; }
.document-info p { margin: 0; color: var(--muted); font-size: 13px; }
.pdf-badge { flex: 0 0 auto; padding: 9px 7px; border-radius: 8px; color: white; background: #b85349; font-size: 10px; font-weight: 850; }
.status-form { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.status-form label { color: var(--muted); font-size: 12px; }
.status-form select { min-width: 100px; padding: 9px 30px 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); }
.warning { color: #a24a32 !important; }
.empty-state { padding: 50px 25px; border: 1px dashed #b9c1bb; border-radius: 22px; text-align: center; background: rgba(255,255,255,.5); }
.empty-state h3 { margin: 10px 0 4px; }
.empty-state p { color: var(--muted); }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; margin: auto; border-radius: 50%; background: var(--mint); color: var(--green); font-size: 28px; }
.notice { margin-top: 20px; padding: 13px 16px; border-radius: 13px; background: var(--mint); color: var(--green-dark); }
.notice.scanning { background: #e7f0f5; color: #28536a; }
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.error-card { width: min(520px, 100%); text-align: center; }
.error-card h1 { margin: 8px 0; font-size: 30px; }
.error-card p:not(.eyebrow) { margin-bottom: 28px; color: var(--muted); }
.error-card a { display: inline-block; text-decoration: none; }
.error-symbol { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 18px; border-radius: 50%; color: white; background: #b85349; font: 700 34px Georgia, serif; }
footer { padding: 22px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 13px; background: rgba(255,255,255,.55); }

@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 600px); }
  .topbar-inner { min-height: 64px; }
  .brand { font-size: 16px; }
  .brand small { display: none; }
  .button-quiet { padding: 9px 11px; font-size: 13px; }
  .welcome { padding: 37px 0 22px; }
  .hero-grid { grid-template-columns: 1fr; }
  .card { padding: 21px; border-radius: 20px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 44px; }
  .source-grid { grid-template-columns: 1fr; }
  .new-book-notice,.new-book-notice > div:last-child { align-items: stretch; flex-direction: column; }
  .source-material-title { flex-direction: column; gap: 4px; }
  .stat-card { padding: 16px; }
  .document-row { align-items: stretch; flex-direction: column; }
  .material-actions { align-items: stretch; flex-direction: column; }
  .material-open { width: 100%; }
  .ai-status-card { align-items: stretch; flex-direction: column; }
  .recent-grid { grid-template-columns: 1fr; }
  .status-form { justify-content: space-between; }
  .status-form select { flex: 1; max-width: 180px; }
}

@media (max-width: 380px) {
  .brand-mark { width: 34px; height: 34px; }
  .topbar-inner { gap: 8px; }
  .icon-circle { display: none; }
}

/* Focused study session */
.study-body { background: #f4f2e9; }
.study-shell { width: min(940px, calc(100% - 36px)); margin-inline: auto; }
.study-header { position: sticky; z-index: 10; top: 0; padding: 15px 0 12px; border-bottom: 1px solid var(--line); background: rgba(255,254,251,.94); backdrop-filter: blur(14px); }
.study-header-row { display: flex; justify-content: space-between; margin-bottom: 11px; color: var(--muted); font-size: 12px; font-weight: 750; }
.study-elapsed { color: #64736c; font-variant-numeric: tabular-nums; font-weight: 650; }
.back-link { color: var(--green); text-decoration: none; }
.study-progress { height: 7px; overflow: hidden; border-radius: 10px; background: #e4e5de; }
.study-progress i { display: block; height: 100%; border-radius: inherit; background: var(--green); transition: width .35s; }
.step-track { display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; color: #9aa39e; font-size: 10px; }
.step-track .done { color: var(--green); }
.step-track .active { color: var(--ink); font-weight: 850; }
.simple-track span { flex: 1; text-align: center; }
.simple-track .active { padding: 4px 8px; border-radius: 99px; color: white; background: var(--green); }
.compact-flow-track span { text-align: center; }
.compact-flow-track .active { color: var(--green-dark); }
.study-main { padding: 42px 0 80px; }
.completed-study-tools { display: flex; flex-wrap: wrap; gap: 9px; padding-top: 18px; }
.completed-study-tools form { margin: 0; }
.stage-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; padding-top: 12px; }
.stage-picker a { padding: 9px; border-radius: 10px; color: var(--muted); background: #e8ebe6; text-align: center; text-decoration: none; font-size: 12px; font-weight: 750; }
.stage-picker a.active { color: white; background: var(--green); }
.practice-banner { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 13px 16px; border-radius: 13px; color: #604d14; background: #fff0ba; }
.readonly-answer { color: #39443f; background: #f0f1ed; }
.lesson-card { padding: clamp(24px, 5vw, 52px); border: 1px solid var(--line); border-radius: 28px; background: var(--paper); box-shadow: var(--shadow); }
.lesson-card > h1 { margin: 4px 0 9px; font: 700 clamp(29px, 5vw, 43px)/1.13 Georgia, serif; }
.lesson-topic, .lesson-intro { margin: 0 0 28px; color: var(--muted); }
.broadcast-meta { margin: 5px 0 8px; color: var(--green-dark); font-size: clamp(18px,2.4vw,25px); font-weight: 900; letter-spacing: .025em; }
.material-source-meta { margin: 5px 0; color: var(--muted); font-size: 13px; font-weight: 750; }
.reading-broadcast-meta { margin: 8px 0 4px; font-size: clamp(22px,4vw,32px); }
.ebs-radio-guide { margin: 20px 0 25px; padding: 16px 18px; border-left: 4px solid var(--green); border-radius: 12px; color: #294c3e; background: var(--mint); font-weight: 700; line-height: 1.6; }
.article-text { margin: 32px 0; color: #26362f; font: 400 clamp(18px, 2.4vw, 22px)/1.9 Georgia, serif; white-space: pre-line; }
.article-reading { max-width: 760px; margin: 34px auto; white-space: normal; }
.article-reading p { margin: 0 0 1.65em; font-size: clamp(18px, 2vw, 21px); line-height: 1.82; }
.article-reading p:last-child { margin-bottom: 0; }
.translation-toggle { max-width: 760px; margin: 24px auto; border: 1px solid #d8e2dc; border-radius: 14px; background: #f8faf8; }
.translation-toggle summary { cursor: pointer; padding: 15px 18px; color: #38614e; font-weight: 700; }
.korean-translation { padding: 0 18px 18px; color: #46534d; font-size: 16px; line-height: 1.8; }
.library-reanalysis { margin: -4px 0 18px; }
.dialogue-reading { display: grid; gap: 25px; margin: 34px 0; }
.dialogue-turn { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 24px; align-items: start; }
.dialogue-speaker { padding-top: 5px; color: var(--green); font-size: 15px; font-weight: 850; line-height: 1.5; }
.dialogue-text { margin: 0; color: #26362f; font: 400 clamp(18px, 2.4vw, 22px)/1.85 Georgia, serif; }
.reading-checklist { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; }
.reading-checklist p { margin: 0; padding: 9px 12px; border-radius: 99px; color: var(--green-dark); background: var(--mint); font-size: 13px; font-weight: 700; }
.optional-learning { margin-top: 16px; padding: 13px 15px; border: 1px dashed #bdc9c1; border-radius: 13px; background: #fafbf8; }
.optional-learning summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 750; }
.read-button { width: 100%; margin-top: 8px; }
.read-button.reading-now { color: #24536a; background: var(--blue); }
.gentle-guide { color: var(--muted); text-align: center; font-size: 13px; }
.lesson-next { display: block; width: min(420px, 100%); margin: 34px auto 0; padding: 16px 20px; font-size: 17px; }
.step-actions { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 30px; }
.step-actions .lesson-next { width: min(360px, 70%); margin: 0; }
.enough-button { display: block; margin: 14px auto 0; border: 0; color: var(--green-dark); background: transparent; text-decoration: underline; }
.grammar-more, .report-details { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.grammar-more summary, .report-details summary, .feedback-details summary { cursor: pointer; color: var(--green-dark); font-weight: 800; }
.question-block { margin: 24px 0; }
.question-block label { display: block; margin-bottom: 10px; color: #26362f; font: 700 20px/1.45 Georgia, serif; }
.question-block label span { display: block; margin-bottom: 5px; color: var(--green); font: 800 11px/1.2 "Segoe UI", sans-serif; letter-spacing: .1em; }
textarea { width: 100%; resize: vertical; padding: 15px; border: 1px solid #cfd3cc; border-radius: 14px; outline: none; color: var(--ink); background: #fff; font: 16px/1.6 "Segoe UI", sans-serif; }
textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,98,71,.12); }
.grammar-lessons { display: grid; gap: 22px; }
.grammar-lesson { padding: 26px; border-radius: 20px; background: #f4f6f1; }
.grammar-title { display: flex; align-items: baseline; gap: 12px; }
.grammar-title span { color: var(--green); font-size: 12px; font-weight: 850; }
.grammar-title h2 { margin: 0; font: 700 29px Georgia, serif; }
.concept { display: grid; gap: 5px; margin: 18px 0; padding: 15px; border-left: 4px solid var(--green); background: white; }
.concept strong, .grammar-lesson h3 { color: var(--green-dark); font-size: 13px; }
.grammar-columns { display: grid; grid-template-columns: 1fr 1.5fr; gap: 25px; }
.grammar-lesson ul { margin: 8px 0; padding-left: 20px; }
.grammar-lesson li { margin: 7px 0; }
.grammar-lesson code { color: var(--green-dark); font-family: inherit; font-weight: 750; }
.mistakes { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.grammar-question { padding: 18px; border-radius: 17px; background: #f3f6f1; }
.expression-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.expression-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #faf9f4; }
.expression-card h2 { margin: 4px 0; font: 700 25px Georgia, serif; }
.expression-number { color: var(--green); font-size: 10px; font-weight: 850; letter-spacing: .1em; }
.expression-meaning { margin: 4px 0 15px; color: var(--green-dark); font-weight: 750; }
.expression-example { min-height: 48px; color: var(--muted); font-style: italic; }
.expression-card label { display: block; margin: 16px 0 7px; font-size: 13px; font-weight: 750; }
.no-review, .complete-step { text-align: center; }
.no-review { margin: 35px 0; padding: 35px; border-radius: 20px; background: var(--mint); }
.no-review > span { font-size: 36px; color: var(--green); }
.no-review h2 { margin: 8px 0; }
.no-review p { color: var(--muted); }
.review-list p { display: flex; justify-content: space-between; padding: 13px; border-bottom: 1px solid var(--line); }
.personal-review-list { display: grid; gap: 18px; margin: 28px 0; }
.personal-review-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #faf9f4; text-align: left; }
.review-intro, .review-cue { color: var(--muted); font-size: 13px; }
.past-mistake { padding: 13px; border-radius: 11px; color: #813b34; background: #fbe9e5; font: 600 17px/1.55 Georgia,serif; }
.review-korean { font-weight: 800; }
.correct-review { color: #176044; font: 700 17px/1.55 Georgia,serif; }
.optional-more { display: block; width: fit-content; margin: 14px auto; }
.complete-icon { display: grid; place-items: center; width: 75px; height: 75px; margin: 0 auto 20px; border-radius: 50%; color: white; background: var(--green); font-size: 37px; }
.complete-summary { width: min(600px, 100%); margin: 30px auto; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; text-align: left; }
.complete-summary p { display: flex; justify-content: space-between; gap: 20px; margin: 0; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.complete-summary p:last-child { border: 0; }
.complete-summary span { color: var(--muted); }

@media (max-width: 700px) {
  .dialogue-reading { gap: 27px; }
  .dialogue-turn { grid-template-columns: 1fr; gap: 5px; }
  .dialogue-speaker { padding-top: 0; font-size: 14px; }
  .study-shell { width: min(100% - 24px, 600px); }
  .study-header { position: static; }
  .step-track { overflow-x: auto; justify-content: flex-start; padding-bottom: 2px; }
  .step-track span { flex: 0 0 auto; }
  .study-main { padding-top: 18px; }
  .completed-study-tools { display: grid; grid-template-columns: 1fr 1fr; }
  .completed-study-tools .button { width: 100%; text-align: center; }
  .stage-picker { grid-template-columns: repeat(2, 1fr); }
  .practice-banner { flex-direction: column; }
  .lesson-card { padding: 23px 18px; border-radius: 21px; }
  .article-text { line-height: 1.75; }
  .article-reading { max-width: 100%; }
  .article-reading p { font-size: clamp(17px, 4.7vw, 19px); line-height: 1.76; margin-bottom: 1.45em; }
  .grammar-columns, .expression-grid { grid-template-columns: 1fr; }
  .grammar-lesson { padding: 19px 15px; }
  .complete-summary p { flex-direction: column; gap: 3px; }
}

/* v0.3 recording and AI feedback */
.ai-setup-notice { margin: 0 0 20px; background: #fff3c9; color: #624f17; }
.privacy-note { color: var(--muted); font-size: 13px; }
.reading-recorder { margin: 32px 0 12px; padding: 22px; border-radius: 20px; background: #f2f6f3; }
.reading-recorder h2 { margin-top: 0; }
.answer-tools { margin: 9px 0 25px; }
.input-mode-row { display: flex; gap: 8px; margin-bottom: 10px; }
.mode-button { min-height: 44px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: white; font-weight: 700; cursor: pointer; }
.mode-button.active { border-color: var(--green); color: var(--green); background: var(--mint); }
.recorder-panel { padding: 16px; border: 1px solid #ced9d3; border-radius: 15px; background: #f7faf8; }
.answer-tools.is-recording .recorder-panel { border-color: #c9584c; background: #fff3f0; }
.recorder-status { min-height: 24px; color: #42544b; }
.recording-timer { display: block; margin: 8px 0; color: #bd4338; font-size: 24px; font-variant-numeric: tabular-nums; }
.recorder-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.record-button, .small-control { min-height: 46px; border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; font-weight: 800; }
.record-button { color: white; background: #b9453c; }
.small-control { color: var(--ink); background: #e5e9e5; }
.recording-playback { width: 100%; margin-top: 13px; }
.answer-action-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.feedback-button { min-height: 46px; color: white; background: var(--green); }
.feedback-button:disabled { cursor: wait; opacity: .7; }
.save-state { color: var(--muted); font-size: 12px; }
.feedback-panel { margin-top: 18px; padding: clamp(16px, 4vw, 26px); border: 1px solid #bfd4c8; border-radius: 20px; background: #f4faf6; }
.feedback-panel > h3 { margin-top: 0; font: 700 25px Georgia, serif; }
.compact-feedback-status { display: inline-block; padding: 6px 10px; border-radius: 99px; color: #155e41; background: #dff2e7; font-weight: 850; }
.compact-feedback-status.grammar_error { color: #843d35; background: #f7e1dc; }
.compact-feedback-status.unnatural { color: #6b5114; background: #fff0bf; }
.compact-natural { margin: 15px 0 8px; padding: 15px; border-radius: 13px; background: white; }
.compact-natural h4 { margin: 0 0 5px; color: var(--green); font-size: 12px; }
.compact-natural p, .compact-core { margin: 0; }
.compact-core { line-height: 1.65; }
.feedback-summary { display: grid; gap: 8px; margin: 15px 0; }
.feedback-summary p { display: grid; grid-template-columns: 95px 1fr; gap: 10px; margin: 0; padding: 12px; border-radius: 11px; background: white; }
.feedback-summary span { color: var(--muted); font-size: 12px; font-weight: 750; }
.feedback-summary strong { font-weight: 600; }
.feedback-summary .natural-row { background: #eaf5ed; }
.optional-retry { font-size: 13px; }
.feedback-details { margin-top: 16px; }
.feedback-details summary { padding: 11px 0; }
.compact-report { display: grid; gap: 9px; }
.compact-report p { display: grid; gap: 4px; margin: 0; padding: 13px; border-radius: 12px; background: white; }
.compact-report span { color: var(--muted); font-size: 12px; }
.follow-up-question { margin-top: 18px; padding: 18px; border-radius: 15px; background: #edf4ef; }
.feedback-section { padding: 13px 0; border-top: 1px solid #d9e4dd; }
.feedback-section h4 { margin: 0 0 6px; color: var(--green-dark); font-size: 13px; }
.feedback-section p, .feedback-section ul { margin: 0; }
.feedback-section.good { color: #175d40; }
.feedback-section.needs-work { color: #843d35; }
.feedback-message { padding: 14px; border-radius: 12px; }
.feedback-message.error { color: #7b322c; background: #fbe5e1; }
.feedback-message.setup { color: #604d14; background: #fff0ba; }
.feedback-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 17px; }
.delete-answer { border: 0; color: #9a463e; background: transparent; cursor: pointer; }
.grammar-practice { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.today-review-summary, .answer-comparisons { margin: 25px 0; text-align: left; }
.weakness-card { margin: 9px 0; padding: 15px; border-left: 4px solid #c06c43; border-radius: 10px; background: #fff5ed; }
.weakness-card span { color: #994b2f; font-size: 11px; font-weight: 800; }
.weakness-card p { margin: 4px 0 0; }
.answer-comparisons article { margin: 13px 0; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.answer-comparisons article p { display: grid; grid-template-columns: 90px 1fr; gap: 10px; margin: 8px 0; }
.answer-comparisons article span { color: var(--muted); font-size: 12px; font-weight: 750; }
.hidden { display: none !important; }

/* AI settings */
.settings-body { min-height: 100vh; background: #f4f2e9; }
.settings-shell { width: min(720px, calc(100% - 32px)); margin: 42px auto 80px; }
.settings-card { padding: clamp(24px, 6vw, 48px); border: 1px solid var(--line); border-radius: 26px; background: var(--paper); box-shadow: var(--shadow); }
.settings-card h1 { margin: 5px 0 8px; font: 700 clamp(30px, 5vw, 42px)/1.15 Georgia, serif; }
.settings-intro { margin-bottom: 25px; color: var(--muted); }
.connection-result { margin: 20px 0 28px; padding: 18px; border-radius: 15px; background: #f0f1ed; }
.connection-result.status-connected { color: #165c3e; background: #e6f4eb; }
.connection-result.status-invalid_key, .connection-result.status-invalid_model,
.connection-result.status-quota, .connection-result.status-network,
.connection-result.status-temporary_error { color: #7b322c; background: #fbe8e3; }
.connection-result strong { font-size: 19px; }
.connection-result p { margin: 6px 0; }
.connection-result small { color: var(--muted); }
.ai-settings-form { display: grid; gap: 9px; }
.ai-settings-form label { margin-top: 10px; color: var(--green-dark); font-weight: 800; }
.ai-settings-form input { width: 100%; min-height: 52px; padding: 12px 14px; border: 1px solid #c9d0ca; border-radius: 12px; outline: none; background: white; font: 16px "Segoe UI", sans-serif; }
.ai-settings-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,98,71,.12); }
.field-help, .test-note { margin: 0 0 7px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.settings-submit { width: 100%; min-height: 54px; margin-top: 15px; font-size: 17px; }
.test-note { text-align: center; }
.plus-notice { margin-top: 25px; padding: 17px 19px; border-left: 4px solid #bb7b35; border-radius: 12px; color: #674719; background: #fff2d8; }
.plus-notice p { margin: 5px 0 0; }
.settings-options { display: grid; gap: 9px; margin: 18px 0 8px; padding: 0; border: 0; }
.settings-options legend { margin-bottom: 8px; color: var(--green-dark); font-weight: 800; }
.option-card { display: flex; align-items: center; gap: 12px; margin: 0 !important; padding: 14px; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; }
.option-card:has(input:checked) { border-color: var(--green); background: var(--mint); }
.option-card input { width: 20px; min-height: 20px; }
.option-card span { display: grid; gap: 3px; }
.option-card small { color: var(--muted); font-weight: 500; }
.ai-settings-form select { min-height: 52px; padding: 10px 13px; border: 1px solid #c9d0ca; border-radius: 12px; background: white; font-size: 16px; }
.ai-budget-card { margin: 16px 0 35px; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); }
.budget-heading { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.budget-heading h2 { margin: 4px 0; }
.budget-heading > span { padding: 7px 10px; border-radius: 99px; color: var(--green-dark); background: var(--mint); font-weight: 750; }
.budget-progress { height: 12px; margin: 14px 0 10px; overflow: hidden; border-radius: 99px; background: #e5e8e3; }
.budget-progress i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.budget-warning { border-color: #d59a50; background: #fff9ed; }
.budget-warning .budget-progress i { background: #c4782f; }
.ai-budget-card > p { color: var(--muted); font-size: 13px; }
.daily-report, .master-section { margin-top: 30px; padding: 24px; border-radius: 20px; text-align: left; background: #f4f6f1; }
.daily-report h2, .master-section h2 { margin-top: 0; font: 700 28px Georgia, serif; }
.report-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
.report-grid p { display: grid; gap: 4px; margin: 0; padding: 14px; border-radius: 12px; background: white; }
.report-grid span { color: var(--muted); font-size: 12px; }
.master-card { margin-top: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.master-card > span { color: var(--green); font-size: 11px; font-weight: 850; }
.master-card h3 { margin: 8px 0; font: 700 23px/1.4 Georgia, serif; }
.master-card > p { margin: 5px 0; color: var(--green-dark); }
.master-card > small { color: var(--muted); }
.master-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 15px 0; }
.master-answer { margin-top: 10px; }
.session-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin: -18px 0 32px; }
.session-stats article { display: flex; justify-content: space-between; padding: 15px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.review-actions { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; padding: 22px; border-radius: 20px; background: #edf3ee; }
.review-actions h2,.review-actions p { margin: 4px 0; }
.random-review-button { min-height: 54px; }
.learning-state-note { color: var(--green) !important; font-size: 12px; font-weight: 800; }
.material-detail { width: min(850px,calc(100% - 32px)); }
.detail-main-action { display: block; width: 100%; margin: 22px 0 8px; padding: 16px; text-align: center; font-size: 17px; }
.relearn-menu { margin: 16px 0; border: 1px solid var(--line); border-radius: 14px; }
.relearn-menu summary { padding: 15px; cursor: pointer; font-weight: 800; }
.relearn-menu > div { display: grid; gap: 8px; padding: 0 15px 15px; }
.relearn-menu a,.relearn-menu button { display: block; width: 100%; padding: 13px; border: 0; border-radius: 10px; color: var(--green-dark); background: var(--mint); text-align: left; text-decoration: none; font-weight: 750; cursor: pointer; }
.detail-weakness { margin: 25px 0; padding: 18px; border-radius: 15px; background: #fff5ed; }
.detail-weakness h2 { margin-top: 0; font-size: 19px; }
.detail-weakness p { margin: 7px 0; }
.history-section { margin-top: 30px; }
.history-list { display: grid; gap: 10px; }
.history-list a { display: grid; grid-template-columns: 1fr auto; gap: 4px 15px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); text-decoration: none; }
.history-list span,.history-list small { color: var(--muted); }
.history-list small { grid-column: 1/-1; }
.relearn-choices { display: grid; gap: 13px; margin-top: 25px; }
.relearn-choice { display: flex; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; cursor: pointer; }
.relearn-choice:has(input:checked) { border-color: var(--green); background: var(--mint); }
.relearn-choice input { width: 20px; }
.relearn-choice span { display: grid; gap: 5px; }
.relearn-choice em { width: fit-content; padding: 3px 7px; border-radius: 99px; color: white; background: var(--green); font-size: 11px; font-style: normal; }
.relearn-choice small { color: var(--muted); }
.article-review { margin: 25px 0; padding: 15px; border: 1px solid var(--line); border-radius: 13px; }
.article-review summary { cursor: pointer; font-weight: 800; }
.growth-dates { display: flex; justify-content: center; gap: 20px; margin: 25px 0; font-size: 18px; }
.growth-table p { display: grid; grid-template-columns: 1.5fr 1fr auto 1fr; gap: 10px; align-items: center; margin: 0; padding: 13px; border-bottom: 1px solid var(--line); }
.growth-table span { color: var(--muted); }
.growth-comment { margin-top: 25px; padding: 18px; border-radius: 14px; background: var(--mint); }
.random-card { text-align: center; }
.random-card h2 { font: 700 28px Georgia,serif; }
.random-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0; }
.random-meta p { display: grid; gap: 5px; padding: 14px; border-radius: 12px; background: #f2f4ef; }
.random-meta span { color: var(--muted); font-size: 12px; }
.auth-shell { max-width: 560px; }
.auth-brand { margin-bottom: 28px; color: var(--ink); }
.auth-help { margin-top: 14px; text-align: center; }
.auth-back { display: block; margin-top: 18px; text-align: center; }
.mobile-access-card { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin: 16px 0 35px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); }
.mobile-access-card h2 { margin: 5px 0; }
.mobile-url { display: block; overflow-wrap: anywhere; color: var(--green); font-size: clamp(15px,2.5vw,20px); font-weight: 800; }
.mobile-access-actions { display: grid; flex: 0 0 150px; gap: 8px; }
.mobile-access-actions img { width: 150px; height: 150px; padding: 7px; border: 1px solid var(--line); border-radius: 13px; background: white; }

@media (max-width: 700px) {
  .study-header-row { flex-wrap: wrap; gap: 6px 12px; }
  .study-elapsed { order: 3; width: 100%; text-align: center; }
  .settings-shell { width: min(100% - 20px, 720px); margin-top: 18px; }
  .settings-card { border-radius: 20px; }
  .budget-heading { align-items: flex-start; flex-direction: column; }
  .report-grid { grid-template-columns: 1fr; }
  .master-actions .button { flex: 1 1 42%; min-height: 50px; }
  .session-stats { grid-template-columns: 1fr; }
  .review-actions { align-items: stretch; flex-direction: column; }
  .random-review-button { width: 100%; text-align: center; }
  .growth-table p { grid-template-columns: 1fr 1fr auto 1fr; font-size: 13px; }
  .growth-table span { grid-column: 1/-1; }
  .random-meta { grid-template-columns: 1fr; }
  .mobile-access-card { align-items: stretch; flex-direction: column; }
  .mobile-access-actions { width: 100%; grid-template-columns: 120px 1fr; align-items: center; }
  .mobile-access-actions img { width: 120px; height: 120px; }
  .input-mode-row, .answer-action-row { align-items: stretch; flex-direction: column; }
  .mode-button, .feedback-button { width: 100%; }
  .recorder-controls > button { flex: 1 1 42%; }
  .feedback-actions > .button { width: 100%; }
  .answer-comparisons article p { grid-template-columns: 1fr; gap: 2px; }
  .feedback-summary p { grid-template-columns: 1fr; gap: 3px; }
  .lesson-next { position: sticky; bottom: 10px; z-index: 5; }
  .study-mode-buttons { grid-template-columns: 1fr; }
  .step-actions { align-items: stretch; flex-direction: column-reverse; }
  .step-actions .lesson-next, .step-actions .button { width: 100%; }
}
