@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;
  --page: #f6f5f1;
  --paper: #fffefa;
  --paper-strong: #ffffff;
  --ink: #232528;
  --ink-soft: #5d6064;
  --muted: #868984;
  --line: #e7e5df;
  --line-dark: #d8d6ce;
  --violet: #5945d6;
  --violet-deep: #4531bd;
  --violet-soft: #eeebff;
  --lime: #d8ed71;
  --lime-deep: #61720d;
  --orange: #e57b52;
  --orange-soft: #fff0e8;
  --green: #31745d;
  --green-soft: #eaf6ef;
  --red: #a64139;
  --red-soft: #fff0ed;
  --shadow: 0 14px 38px rgba(36, 35, 30, .055), 0 2px 7px rgba(36, 35, 30, .035);
  --radius-xl: 25px;
  --radius-lg: 18px;
  --radius-md: 13px;
  font-family: 'DM Sans', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 0; scroll-behavior: smooth; }
body { margin: 0; min-width: 0; min-height: 100vh; overflow-x: hidden; background: var(--page); color: var(--ink); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #8f82ef; outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .55; }
svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); max-width: 1600px; min-height: 100vh; margin: 0 auto; background: var(--page); }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; min-height: 720px; padding: 27px 16px 16px; border-right: 1px solid var(--line); background: #fbfaf7; }
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; color: var(--ink); text-decoration: none; }
.brand-mark { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 3px; width: 31px; height: 31px; border-radius: 11px; background: var(--violet); transform: rotate(-4deg); }
.brand-mark span { width: 3px; border-radius: 3px; background: white; transform: rotate(4deg); }
.brand-mark span:nth-child(1) { height: 10px; opacity: .72; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 13px; opacity: .85; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: -.065em; }
.level-chip { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; margin: 28px 0 16px 5px; color: #737570; font-size: 9px; font-weight: 700; letter-spacing: .105em; }
.level-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime-deep); box-shadow: 0 0 0 3px #eef3d8; }
.side-nav { display: grid; gap: 4px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 12px; min-height: 45px; padding: 0 12px; border: 0; border-radius: 11px; background: transparent; color: #646660; text-align: left; cursor: pointer; transition: background .18s ease, color .18s ease; }
.nav-link:hover { background: #f1f0ea; color: var(--ink); }
.nav-link svg { width: 18px; height: 18px; }
.nav-link span:nth-child(2) { font-size: 12.5px; font-weight: 600; }
.nav-link.is-active { background: var(--violet-soft); color: var(--violet-deep); }
.nav-link.is-active::before { position: absolute; top: 11px; bottom: 11px; left: -16px; width: 3px; border-radius: 0 3px 3px 0; background: var(--violet); content: ''; }
.nav-count { display: inline-grid; place-items: center; min-width: 21px; height: 21px; margin-left: auto; border: 1px solid var(--line); border-radius: 7px; color: #797b75; font-size: 10px; font-weight: 600; }
.sidebar-divider { height: 1px; margin: 20px 3px 20px; background: var(--line); }
.side-section-label, .section-eyebrow { color: #8a8b84; font-size: 9px; font-weight: 700; letter-spacing: .13em; }
.side-section-label { padding: 0 10px 10px; }
.deck-link { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 53px; padding: 7px 9px; border: 0; border-radius: 11px; background: transparent; text-align: left; cursor: pointer; }
.deck-link:hover { background: #f1f0ea; }
.deck-link.is-current { background: #f0eefb; }
.deck-bullet { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 4px; }
.deck-bullet--violet { background: var(--violet); }
.deck-bullet--lime { background: #bad536; }
.deck-bullet--orange { background: #e59470; }
.deck-link-copy { display: grid; gap: 3px; min-width: 0; }
.deck-link-copy strong { overflow: hidden; color: #3c3e3a; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.deck-link-copy small { color: #858780; font-size: 10px; }
.deck-current-dot { width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: var(--violet); }
.deck-link--locked { cursor: default; }
.deck-link--locked:hover { background: transparent; }
.lock-icon { width: 14px; height: 14px; margin-left: auto; color: #a1a29d; }
.sidebar-bottom { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px 6px 5px; border-top: 1px solid var(--line); }
.profile-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border: 1px solid #ddd9ff; border-radius: 12px; background: #efedff; color: var(--violet-deep); font-size: 10px; font-weight: 700; }
.sidebar-bottom > div:nth-child(2) { display: grid; gap: 3px; }
.sidebar-bottom strong { font-size: 10.5px; font-weight: 600; }
.sidebar-bottom small { color: #898b84; font-size: 10px; }
.more-button { display: grid; place-items: center; width: 34px; height: 34px; margin-left: auto; border: 0; border-radius: 9px; background: transparent; color: #747671; cursor: pointer; }
.more-button:hover { background: #eeede7; }
.more-button svg { width: 18px; height: 18px; }

.main-area { min-width: 0; padding: 0 38px 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 70px; border-bottom: 1px solid var(--line); }
.breadcrumbs { display: flex; align-items: center; gap: 10px; color: #969791; font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.breadcrumbs strong { color: #5e605b; font-size: 9px; }
.crumb-separator { color: #c5c4bd; }
.topbar-right { display: flex; align-items: center; gap: 8px; color: #898b85; font-size: 10px; }
.status-pip { width: 6px; height: 6px; border-radius: 50%; background: #75a68a; box-shadow: 0 0 0 3px #e6f0e8; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 26px; max-width: 1320px; margin: 0 auto; padding: 37px 0 22px; }
.study-column { min-width: 0; }
.topic-heading { margin-bottom: 30px; }
.topic-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.topic-kicker { color: var(--violet); font-size: 9px; font-weight: 700; letter-spacing: .14em; }
.topic-level { display: inline-grid; place-items: center; min-width: 28px; height: 20px; padding: 0 6px; border: 1px solid #e5e0ff; border-radius: 6px; background: #f2f0ff; color: #6153c6; font-size: 9px; font-weight: 700; }
h1, h2, h3, p { margin-top: 0; }
.topic-heading h1 { margin: 0; color: #202124; font-family: Fraunces, Georgia, serif; font-size: clamp(32px, 3.2vw, 46px); font-weight: 500; letter-spacing: -.045em; line-height: 1.06; }
.topic-description { margin: 11px 0 17px; color: #71736e; font-size: 13px; line-height: 1.55; }
.topic-facts { display: flex; align-items: center; gap: 11px; color: #81837d; font-size: 10px; }
.topic-facts b { color: #41433f; font-weight: 700; }
.fact-divider { width: 3px; height: 3px; border-radius: 50%; background: #b5b6b0; }
.activity-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.activity-heading h2 { margin: 5px 0 0; font-size: 17px; font-weight: 600; letter-spacing: -.035em; }
.activity-count { margin-bottom: 2px; color: #8b8d86; font-size: 10px; white-space: nowrap; }
.activity-count span { color: #565851; font-weight: 700; }
.mode-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 13px; }
.mode-tab { display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 63px; padding: 9px; border: 1px solid #e6e4de; border-radius: 13px; background: #fbfaf7; text-align: left; cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.mode-tab:hover { border-color: #d4d0ef; transform: translateY(-1px); }
.mode-tab.is-selected { border-color: #bcb3f3; background: #f5f2ff; box-shadow: inset 0 0 0 1px #e5e1ff; }
.mode-icon { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; }
.mode-icon svg { width: 18px; height: 18px; }
.mode-icon--cards { background: #eae6ff; color: #5945d6; }
.mode-icon--choice { background: #fff0e8; color: #bb5939; }
.mode-icon--type { background: #edf1d5; color: #626e28; }
.mode-icon--match { background: #e8eff2; color: #536c78; }
.mode-icon--games { background: #f2e8fb; color: #8845b5; }
.mode-copy { display: grid; gap: 4px; min-width: 0; }
.mode-copy strong { overflow: hidden; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.mode-copy small { overflow: hidden; color: #898b86; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.activity-panel { min-width: 0; border: 1px solid #e8e6df; border-radius: var(--radius-xl); background: var(--paper); box-shadow: var(--shadow); }
.activity-panel[hidden] { display: none; }
.panel-toolbar { display: flex; align-items: center; gap: 13px; min-height: 51px; padding: 0 21px; border-bottom: 1px solid #efeee9; }
.panel-step { display: flex; align-items: center; gap: 8px; color: #a0a19b; font-size: 8px; font-weight: 700; letter-spacing: .12em; white-space: nowrap; }
.step-number { color: #494a45; font-size: 11px; letter-spacing: 0; }
.panel-progress { overflow: hidden; flex: 1; height: 4px; border-radius: 4px; background: #efeee9; }
.panel-progress span { display: block; width: 16.7%; height: 100%; border-radius: inherit; background: var(--violet); transition: width .25s ease; }
.shuffle-button { display: grid; place-items: center; flex: 0 0 auto; width: 31px; height: 31px; border: 0; border-radius: 9px; background: transparent; color: #777972; cursor: pointer; }
.shuffle-button:hover { background: #f1f0eb; color: var(--violet); }
.shuffle-button svg { width: 17px; height: 17px; }
.flashcard { display: grid; grid-template-columns: minmax(205px, .78fr) minmax(0, 1.22fr); gap: 0; padding: 17px; }
.card-photo, .exercise-photo { position: relative; overflow: hidden; border-radius: 15px; background-image: url('./assets/transit-contact-sheet.png'); background-repeat: no-repeat; background-size: 300% auto; background-color: #e6e2d5; }
.card-photo { min-height: 334px; aspect-ratio: .82; }
.photo--platform { --tile-x: 0%; --tile-y: 10%; }
.photo--crowded { --tile-x: 50%; --tile-y: 10%; }
.photo--luggage { --tile-x: 100%; --tile-y: 10%; }
.photo--delay { --tile-x: 0%; --tile-y: 90%; }
.photo--board { --tile-x: 50%; --tile-y: 90%; }
.photo--route { --tile-x: 100%; --tile-y: 90%; }
.card-photo, .exercise-photo { background-position: var(--tile-x) var(--tile-y); }
.card-photo::after { position: absolute; inset: 45% 0 0; background: linear-gradient(180deg, transparent, rgba(14, 17, 20, .56)); content: ''; pointer-events: none; }
.photo-tag { position: absolute; z-index: 1; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 24px); padding: 7px 9px; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; background: rgba(255,255,255,.88); color: #494b48; font-size: 8px; font-weight: 700; letter-spacing: .08em; backdrop-filter: blur(8px); }
.photo-tag-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); }
.photo-caption { position: absolute; z-index: 1; right: 15px; bottom: 14px; left: 15px; color: white; font-family: Fraunces, Georgia, serif; font-size: 17px; font-weight: 500; line-height: 1.2; }
.card-content { display: flex; flex-direction: column; min-width: 0; padding: 6px 8px 0 23px; }
.word-line { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.word-label, .field-label { display: block; color: #969791; font-size: 8px; font-weight: 700; letter-spacing: .12em; }
.word-line h3 { margin: 4px 0 0; color: #232428; font-family: Fraunces, Georgia, serif; font-size: 36px; font-weight: 500; letter-spacing: -.045em; line-height: 1.03; }
.word-index { padding-bottom: 4px; color: #a1a29b; font-size: 9px; font-weight: 700; letter-spacing: .08em; white-space: nowrap; }
.pronunciation { display: flex; align-items: center; gap: 9px; margin: 10px 0 21px; }
.ipa { color: #747670; font-family: 'DM Sans', sans-serif; font-size: 12px; letter-spacing: .015em; }
.part-of-speech { padding: 4px 7px; border: 1px solid #eceae4; border-radius: 6px; color: #8a8b85; font-size: 9px; font-style: italic; }
.definition-block { padding: 0 0 14px; border-bottom: 1px solid #efeee9; }
.definition-block p { margin: 6px 0 0; color: #343633; font-size: 12px; line-height: 1.5; }
.example-block { padding: 13px 0 0; }
.example-block p { margin: 6px 0 0; color: #5f625c; font-family: Fraunces, Georgia, serif; font-size: 14px; line-height: 1.45; }
mark { padding: 0 2px; border-radius: 3px; background: #f0ecff; color: #5140c5; }
.translation-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-height: 40px; margin-top: 6px; }
.translation-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 35px; padding: 0; border: 0; background: transparent; color: #696b65; font-size: 10px; cursor: pointer; }
.translation-toggle:hover { color: var(--violet); }
.eye-icon svg { width: 15px; height: 15px; }
.translation-text { padding: 5px 8px; border-radius: 6px; background: #f4f3ee; color: #343632; font-size: 11px; font-weight: 600; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; padding-top: 7px; }
.review-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 39px; padding: 0 10px; border: 1px solid transparent; border-radius: 10px; font-size: 10px; font-weight: 700; cursor: pointer; transition: transform .16s ease, background .16s ease, border-color .16s ease; }
.review-button:hover { transform: translateY(-1px); }
.review-button svg { width: 15px; height: 15px; }
.review-button--again { border-color: #e7e5df; background: #fff; color: #666862; }
.review-button--again:hover { border-color: #d7d3c9; background: #f8f7f3; }
.review-button--known { background: var(--violet); color: white; }
.review-button--known:hover { background: var(--violet-deep); }
.card-navigation { display: flex; align-items: center; justify-content: center; gap: 12px; height: 37px; color: #a0a19b; font-size: 9px; }
.card-navigation button { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #858780; cursor: pointer; }
.card-navigation button:hover { background: #f1f0eb; color: #3e403b; }
.card-navigation button svg { width: 15px; height: 15px; }
kbd { padding: 1px 4px; border: 1px solid #e1dfd8; border-radius: 4px; background: #faf9f6; color: #7c7e78; font-family: inherit; font-size: 8px; }

.progress-column { display: flex; flex-direction: column; gap: 13px; padding-top: 113px; }
.progress-card, .word-list-card { border: 1px solid #e8e6df; border-radius: 17px; background: var(--paper); box-shadow: 0 7px 24px rgba(36,35,30,.035); }
.progress-card { padding: 17px; }
.progress-card-head { display: flex; align-items: center; justify-content: space-between; }
.progress-spark { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; background: #f0eefc; color: var(--violet); }
.progress-spark svg { width: 15px; height: 15px; }
.progress-big-number { display: flex; align-items: center; gap: 11px; margin: 16px 0 13px; }
.progress-big-number strong { color: #292a2c; font-family: Fraunces, Georgia, serif; font-size: 44px; font-weight: 500; letter-spacing: -.05em; line-height: .9; }
.progress-big-number span { color: #7d7f79; font-size: 10px; line-height: 1.4; }
.progress-track { overflow: hidden; height: 6px; border-radius: 6px; background: #eeede7; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), #8f80ed); transition: width .25s ease; }
.progress-note { margin: 11px 0 0; color: #898b85; font-size: 9.5px; line-height: 1.5; }
.word-list-card { padding: 15px 13px 10px; }
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; }
.list-head h3 { margin: 4px 0 0; font-size: 13px; font-weight: 600; letter-spacing: -.02em; }
.list-total { display: grid; place-items: center; width: 26px; height: 24px; border-radius: 7px; background: #f2f0ed; color: #73756f; font-size: 9px; font-weight: 700; }
.topic-word-list { display: grid; }
.topic-word-item { display: flex; align-items: center; gap: 8px; min-height: 31px; padding: 3px 5px; border-radius: 7px; color: #555752; font-size: 10px; }
.topic-word-item:hover { background: #f7f6f2; }
.topic-word-item button { overflow: hidden; flex: 1; padding: 4px 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.word-status { display: grid; place-items: center; flex: 0 0 auto; width: 16px; height: 16px; border: 1px solid #e3e1da; border-radius: 5px; color: transparent; }
.word-status svg { width: 10px; height: 10px; }
.topic-word-item.is-known .word-status { border-color: #c7e3d1; background: var(--green-soft); color: var(--green); }
.topic-word-item.is-repeat .word-status { border-color: #f0c3b2; background: var(--orange-soft); color: #c2633f; }
.mini-tip { display: flex; gap: 10px; padding: 12px 10px; border: 1px solid #e8e8d8; border-radius: 13px; background: #fbfbea; }
.tip-icon { display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 9px; background: #eff2d5; color: #727c2b; }
.tip-icon svg { width: 16px; height: 16px; }
.mini-tip strong { color: #4c502e; font-size: 9px; font-weight: 700; }
.mini-tip p { margin: 4px 0 0; color: #777960; font-size: 9px; line-height: 1.45; }
.page-footer { display: flex; align-items: center; justify-content: space-between; max-width: 1320px; margin: 0 auto; padding-top: 11px; border-top: 1px solid var(--line); color: #9b9c95; font-size: 9px; }
.page-footer i { padding: 0 3px; color: #c0c1bb; font-style: normal; }

.exercise-panel { min-height: 410px; padding: 20px; }
.exercise-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid #efeee9; }
.exercise-type { display: inline-flex; align-items: center; gap: 8px; color: #777972; font-size: 8px; font-weight: 700; letter-spacing: .12em; }
.exercise-type-dot { width: 7px; height: 7px; border-radius: 50%; }
.exercise-type-dot--violet { background: var(--violet); }
.exercise-type-dot--orange { background: var(--orange); }
.exercise-type-dot--lime { background: #aebf38; }
.question-counter { color: #9a9b95; font-size: 9px; font-weight: 700; letter-spacing: .09em; }
.exercise-content { display: grid; grid-template-columns: minmax(180px, .75fr) minmax(0, 1.1fr); gap: 22px; padding: 20px 0 12px; }
.exercise-photo { min-height: 260px; aspect-ratio: .95; border-radius: 13px; }
.exercise-question { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding: 5px 0; }
.exercise-question > p { margin: 8px 0 17px; color: #343632; font-family: Fraunces, Georgia, serif; font-size: 22px; line-height: 1.35; }
.exercise-question > p strong { padding: 0 2px 2px; border-bottom: 2px solid #c9c0ff; color: #7668d8; font-family: 'DM Sans', sans-serif; font-size: .84em; font-weight: 500; letter-spacing: .1em; }
.choice-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.choice-option { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 10px; border: 1px solid #e8e6df; border-radius: 10px; background: white; color: #4c4e49; font-size: 11px; text-align: left; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.choice-option:hover { border-color: #bcb3f3; background: #faf9ff; transform: translateY(-1px); }
.choice-option:disabled { cursor: default; opacity: 1; }
.choice-letter { display: grid; place-items: center; flex: 0 0 auto; width: 21px; height: 21px; border-radius: 6px; background: #f3f2ed; color: #7e807a; font-size: 9px; font-weight: 700; }
.choice-option.is-correct { border-color: #b8dcc6; background: var(--green-soft); color: #2f684f; }
.choice-option.is-correct .choice-letter { background: #d7ecdf; color: #347458; }
.choice-option.is-wrong { border-color: #f0c4b4; background: var(--red-soft); color: #8e4a3c; }
.choice-option.is-wrong .choice-letter { background: #f9ddd4; color: #a65342; }
.answer-feedback { min-height: 25px; color: #6f716b; font-size: 10px; line-height: 1.45; }
.answer-feedback.is-correct { color: #347458; }
.answer-feedback.is-wrong { color: #a65342; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 15px; border: 0; border-radius: 10px; background: var(--violet); color: white; font-size: 10px; font-weight: 700; cursor: pointer; transition: background .18s ease, transform .18s ease; }
.primary-button:hover { background: var(--violet-deep); transform: translateY(-1px); }
.primary-button svg { width: 15px; height: 15px; }
.primary-button[hidden] { display: none; }
.exercise-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 13px; border-top: 1px solid #efeee9; color: #9a9b95; font-size: 9px; }
.text-button { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0; border: 0; background: transparent; color: #6254ca; font-size: 9px; font-weight: 600; cursor: pointer; }
.text-button[hidden] { display: none; }
.text-button:hover { color: #4434b7; text-decoration: underline; text-underline-offset: 3px; }
.text-button svg { width: 13px; height: 13px; }
.type-wrap { max-width: 670px; margin: 0 auto; padding: 39px 16px 31px; }
.type-prompt { margin: 12px 0 14px; color: #292b2c; font-family: Fraunces, Georgia, serif; font-size: clamp(22px, 2.5vw, 30px); line-height: 1.5; }
.blank-line { display: inline-block; min-width: 93px; padding: 0 4px 1px; border-bottom: 2px solid #c7bfff; color: #6a59d0; font-family: 'DM Sans', sans-serif; font-size: .77em; letter-spacing: .12em; text-align: center; }
.type-clue { display: flex; align-items: center; gap: 9px; margin: 15px 0 19px; color: #797b75; font-size: 10px; line-height: 1.5; }
.clue-icon { display: grid; place-items: center; flex: 0 0 auto; width: 27px; height: 27px; border-radius: 8px; background: #f3f1e9; color: #77786e; }
.clue-icon svg { width: 15px; height: 15px; }
.answer-form { display: flex; align-items: stretch; gap: 8px; }
.answer-form input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid #dedcd5; border-radius: 10px; background: #fff; color: #30322f; font-size: 11px; }
.answer-form input::placeholder { color: #aaa9a2; }
.answer-form input[aria-invalid="true"] { border-color: #dcaa9a; background: #fffaf8; }
.type-controls { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.type-controls .text-button { min-height: 33px; }
.match-instruction { margin: 17px 0 15px; color: #747670; font-size: 11px; }
.matching-board { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.match-column { min-width: 0; }
.match-column > .field-label { margin-bottom: 8px; }
.match-items { display: grid; gap: 7px; }
.match-item { display: flex; align-items: center; min-height: 38px; width: 100%; padding: 7px 9px; border: 1px solid #e8e6df; border-radius: 9px; background: #fff; color: #4b4d48; font-size: 10px; line-height: 1.35; text-align: left; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.match-item:hover:not(:disabled) { border-color: #bcb3f3; background: #faf9ff; }
.match-item.is-selected { border-color: #a89de9; background: #f2efff; color: #4b3cb3; }
.match-item.is-matched { border-color: #c8e1d0; background: #f0f7f1; color: #3f7559; cursor: default; }
.match-item.is-error { border-color: #eac4b8; background: #fff5f2; color: #9c5546; }
.reset-match { color: #7f817b; }
.reset-match svg { width: 14px; height: 14px; }

.mobile-header, .mobile-nav { display: none; }
.toast { position: fixed; z-index: 20; right: 22px; bottom: 22px; max-width: min(360px, calc(100vw - 32px)); padding: 12px 15px; border: 1px solid #d8d4f2; border-radius: 12px; background: #302a4a; box-shadow: 0 8px 26px rgba(28,25,47,.18); color: #fff; font-size: 11px; line-height: 1.4; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1180px) {
  .main-area { padding-right: 25px; padding-left: 25px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 235px; gap: 18px; }
  .mode-tabs { gap: 6px; }
  .mode-tab { gap: 7px; padding: 8px 7px; }
  .mode-icon { width: 30px; height: 30px; }
  .mode-copy strong { font-size: 9.5px; }
  .flashcard { grid-template-columns: minmax(180px, .72fr) minmax(0, 1.28fr); padding: 13px; }
  .card-content { padding-left: 17px; }
}

@media (max-width: 930px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main-area { padding: 0 28px 20px; }
  .mobile-header { display: flex; align-items: center; justify-content: space-between; min-height: 58px; }
  .mobile-header .brand-name { font-size: 17px; }
  .mobile-header .brand-mark { width: 28px; height: 28px; }
  .mobile-level { color: #777972; font-size: 8px; font-weight: 700; letter-spacing: .1em; }
  .topbar { min-height: 46px; }
  .workspace { grid-template-columns: minmax(0, 1fr); max-width: 760px; padding-top: 28px; }
  .progress-column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding-top: 0; }
  .mini-tip { grid-column: 1 / -1; }
  .page-footer { max-width: 760px; }
  .mobile-nav { position: fixed; z-index: 10; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px max(14px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); border-top: 1px solid #e6e4de; background: rgba(251,250,247,.94); box-shadow: 0 -6px 18px rgba(32,31,28,.045); backdrop-filter: blur(14px); }
  .mobile-nav-item { display: grid; place-items: center; gap: 3px; min-height: 46px; border: 0; border-radius: 10px; background: transparent; color: #868781; font-size: 9px; cursor: pointer; }
  .mobile-nav-item svg { width: 18px; height: 18px; }
  .mobile-nav-item.is-active { color: var(--violet); font-weight: 700; }
  .page-footer { margin-bottom: 65px; }
}

@media (max-width: 620px) {
  body { background: #f8f7f4; }
  .main-area { padding: 0 15px 16px; }
  .mobile-header { min-height: 54px; }
  .topbar { min-height: 41px; }
  .topbar-right { font-size: 0; }
  .topbar-right .status-pip { margin-right: 2px; }
  .workspace { gap: 17px; padding: 23px 0 19px; }
  .topic-heading { margin-bottom: 24px; }
  .topic-heading h1 { font-size: 35px; }
  .desktop-break { display: none; }
  .topic-description { max-width: 290px; margin-top: 9px; font-size: 12px; }
  .topic-facts { flex-wrap: wrap; gap: 8px; font-size: 9px; }
  .activity-heading { align-items: end; margin-bottom: 10px; }
  .activity-heading h2 { font-size: 15px; }
  .activity-count { font-size: 9px; }
  .mode-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 10px; }
  .mode-tab { min-height: 57px; padding: 7px 9px; border-radius: 11px; }
  .mode-icon { width: 31px; height: 31px; }
  .mode-copy strong { font-size: 10px; }
  .mode-copy small { font-size: 9px; }
  .activity-panel { border-radius: 18px; }
  .panel-toolbar { min-height: 45px; padding: 0 13px; }
  .flashcard { display: flex; flex-direction: column; padding: 10px; }
  .card-photo { width: 100%; min-height: 0; aspect-ratio: 1.45; border-radius: 12px; }
  .photo--platform, .photo--crowded, .photo--luggage { --tile-y: 15%; }
  .photo--delay, .photo--board, .photo--route { --tile-y: 85%; }
  .photo-tag { top: 9px; left: 9px; padding: 6px 8px; font-size: 7px; }
  .photo-caption { right: 12px; bottom: 11px; left: 12px; font-size: 15px; }
  .card-content { padding: 17px 5px 1px; }
  .word-line h3 { font-size: 33px; }
  .pronunciation { margin: 8px 0 16px; }
  .definition-block p { font-size: 12px; }
  .example-block { padding-top: 11px; }
  .example-block p { font-size: 14px; }
  .translation-row { min-height: 37px; margin-top: 5px; }
  .card-actions { padding-top: 5px; }
  .review-button { min-height: 43px; }
  .card-navigation { height: 32px; }
  .exercise-panel { min-height: 0; padding: 13px; }
  .exercise-topline { padding-bottom: 12px; }
  .exercise-content { grid-template-columns: 1fr; gap: 14px; padding: 13px 0 6px; }
  .exercise-photo { min-height: 0; width: 100%; aspect-ratio: 1.65; border-radius: 11px; }
  .photo--platform.exercise-photo, .photo--crowded.exercise-photo, .photo--luggage.exercise-photo { --tile-y: 15%; }
  .photo--delay.exercise-photo, .photo--board.exercise-photo, .photo--route.exercise-photo { --tile-y: 85%; }
  .exercise-question { padding: 0 1px; }
  .exercise-question > p { margin: 6px 0 12px; font-size: 20px; }
  .choice-option { min-height: 44px; font-size: 10px; }
  .exercise-footer { align-items: flex-start; padding-top: 10px; font-size: 8px; }
  .exercise-footer .text-button { max-width: 120px; min-height: 27px; text-align: right; }
  .type-wrap { padding: 26px 1px 22px; }
  .type-prompt { font-size: 23px; }
  .answer-form { flex-direction: column; }
  .answer-form .primary-button { width: 100%; }
  .matching-board { gap: 9px; }
  .match-item { min-height: 43px; padding: 7px; font-size: 9px; }
  .progress-column { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .progress-card { padding: 14px; }
  .progress-big-number { margin: 12px 0; }
  .progress-big-number strong { font-size: 39px; }
  .topic-word-list { grid-template-columns: 1fr 1fr; column-gap: 4px; }
  .topic-word-item { min-height: 33px; font-size: 9px; }
  .mini-tip { padding: 10px; }
  .page-footer { margin: 0 0 65px; font-size: 8px; }
  .toast { right: 12px; bottom: calc(68px + env(safe-area-inset-bottom)); left: 12px; max-width: none; text-align: center; }
}

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

/* Importing personal decks and choosing reference images */
body.modal-open { overflow: hidden; }
.deck-list { display: grid; gap: 3px; }
.add-deck-link { display: inline-flex; align-items: center; gap: 7px; width: 100%; min-height: 37px; margin-top: 5px; padding: 0 8px; border: 1px dashed #dedbd3; border-radius: 9px; background: transparent; color: #696b65; font: inherit; font-size: 10px; text-align: left; cursor: pointer; }
.add-deck-link:hover { border-color: #bcb3f3; background: #faf9ff; color: #5749bd; }
.add-deck-link > span { font-size: 16px; line-height: 1; }
.import-inline { min-height: 28px; padding: 0 9px; border: 1px solid #dedaf5; border-radius: 7px; background: #f7f5ff; color: #5b4dbd; font: inherit; font-size: 9px; font-weight: 700; cursor: pointer; }
.import-inline:hover { border-color: #beb5f1; background: #f0edff; }
.photo-tag { max-width: calc(100% - 24px); }
.photo-tag > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-credit { position: absolute; z-index: 2; bottom: 10px; left: 13px; max-width: 72%; overflow: hidden; padding: 4px 6px; border-radius: 5px; background: rgba(26,27,31,.56); color: rgba(255,255,255,.93); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; text-decoration: underline; text-decoration-color: rgba(255,255,255,.42); text-underline-offset: 2px; }
.photo-credit[hidden] { display: none; }
.photo-caption { right: 13px; bottom: 32px; left: 13px; max-width: calc(100% - 26px); }
.card-photo-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; margin-top: -2px; color: #92938d; font-size: 9px; }
.card-photo-tools .text-button { min-height: 28px; font-size: 9px; }
.photo--user-image { background-image: linear-gradient(135deg, #a9a0ec 0%, #e9ceab 50%, #bac47e 100%); }
.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; overflow: auto; padding: 22px; background: rgba(29,28,35,.44); backdrop-filter: blur(7px); }
.modal-backdrop[hidden] { display: none; }
.app-dialog { width: min(690px, 100%); max-height: min(88vh, 860px); overflow: auto; padding: clamp(18px, 4vw, 30px); border: 1px solid rgba(255,255,255,.75); border-radius: 20px; background: #fbfaf7; box-shadow: 0 24px 80px rgba(25,23,38,.23); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.dialog-heading h2 { margin: 6px 0 0; color: #292a2c; font-family: Fraunces, Georgia, serif; font-size: clamp(24px, 4vw, 32px); font-weight: 500; letter-spacing: -.035em; }
.dialog-close { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border: 1px solid #e6e4de; border-radius: 10px; background: #fff; color: #6f706b; font-size: 23px; line-height: 1; cursor: pointer; }
.dialog-close:hover { border-color: #d7d2ef; color: #5749bd; }
.dialog-intro { max-width: 570px; margin: 10px 0 18px; color: #777972; font-size: 12px; line-height: 1.55; }
.import-fields { display: grid; gap: 6px; margin-bottom: 12px; color: #656760; font-size: 10px; font-weight: 700; }
.import-fields input, .image-search-form input { min-height: 43px; padding: 0 12px; border: 1px solid #dedcd5; border-radius: 10px; outline: none; background: white; color: #30322f; font: inherit; font-size: 12px; }
.import-fields input:focus, .image-search-form input:focus, #word-input:focus { border-color: #a89de9; box-shadow: 0 0 0 3px rgba(118,104,216,.12); }
.import-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 8px 0; }
#word-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap; }
.upload-button { display: inline-flex; align-items: center; justify-content: center; min-height: 35px; padding: 0 12px; border: 1px solid #e1def6; border-radius: 9px; background: #f5f3ff; color: #5547bc; font-size: 10px; font-weight: 700; cursor: pointer; }
.upload-button:hover { border-color: #bcb3f3; background: #eeebff; }
#word-input { display: block; width: 100%; min-height: 180px; resize: vertical; padding: 12px; border: 1px solid #dedcd5; border-radius: 11px; outline: none; background: #fff; color: #3d403c; font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 2; }
.import-help { display: flex; justify-content: space-between; gap: 10px; margin: 8px 1px; color: #898b85; font-size: 9px; line-height: 1.45; }
.import-help b { color: #62645e; }
.import-error { min-height: 18px; color: #a65342; font-size: 10px; }
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 16px; padding-top: 13px; border-top: 1px solid #eceae4; }
.dialog-footer .primary-button, .image-search-form .primary-button { min-height: 40px; font-size: 10px; }
.secondary-button { min-height: 40px; padding: 0 13px; border: 1px solid #e4e1da; border-radius: 10px; background: #fff; color: #696b65; font: inherit; font-size: 10px; font-weight: 700; cursor: pointer; }
.secondary-button:hover { background: #f4f2ed; }
.image-dialog { width: min(850px, 100%); }
.image-search-form { display: flex; gap: 8px; margin: 15px 0 8px; }
.image-search-form input { flex: 1; min-width: 0; }
.image-search-form button { flex: 0 0 auto; }
.image-search-status { min-height: 25px; color: #777972; font-size: 10px; line-height: 1.5; }
.image-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 7px; }
.image-result { display: flex; flex-direction: column; min-width: 0; overflow: hidden; padding: 0; border: 1px solid #e6e4de; border-radius: 12px; background: #fff; color: #4c4e49; text-align: left; cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.image-result:hover, .image-result:focus-visible { border-color: #a89de9; box-shadow: 0 5px 18px rgba(69,60,136,.1); transform: translateY(-2px); }
.image-result img { display: block; width: 100%; aspect-ratio: 1.4; object-fit: cover; background: #efeee9; }
.image-result-copy { display: grid; gap: 4px; width: 100%; padding: 9px; }
.image-result-copy strong { overflow: hidden; color: #454741; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.image-result-copy small { display: -webkit-box; overflow: hidden; color: #92938d; font-size: 8px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.image-search-form button:disabled { opacity: .6; cursor: progress; }
.topics-dialog { width: min(600px, 100%); }
.topics-choice-list { display: grid; gap: 8px; }
.topic-choice-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: 8px; }
.topic-choice { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 62px; padding: 11px 13px; border: 1px solid #e7e5df; border-radius: 12px; background: #fff; color: #4c4e49; text-align: left; cursor: pointer; }
.topic-choice:hover, .topic-choice.is-current { border-color: #c8c1f0; background: #f8f7ff; }
.topic-choice-copy { display: grid; gap: 4px; min-width: 0; }
.topic-choice-copy strong { overflow: hidden; color: #343632; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.topic-choice-copy small { color: #92938d; font-size: 9px; }
.topic-choice-arrow { flex: 0 0 auto; color: #6c5ed0; font-size: 9px; font-weight: 700; }
.topic-delete-button { min-width: 82px; min-height: 48px; align-self: center; padding: 0 12px; border: 1px solid #ecd8d3; border-radius: 10px; background: #fffaf8; color: #a45448; font: inherit; font-size: 10px; font-weight: 700; cursor: pointer; transition: background .16s ease, border-color .16s ease, color .16s ease; }
.topic-delete-button:hover:not(:disabled) { border-color: #d8a39a; background: #fff0ed; color: #913c32; }
.topic-delete-button:disabled { border-color: #e8e6df; background: #f6f5f1; color: #aaa9a2; cursor: not-allowed; }
.topics-delete-help { margin: 10px 1px 0; color: #92938d; font-size: 9px; line-height: 1.45; }
.delete-topic-dialog { width: min(470px, 100%); }
.delete-topic-name { margin: 17px 0 0; color: #343632; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.delete-topic-dialog .dialog-intro { margin: 7px 0 0; }
.danger-button { min-height: 44px; padding: 0 15px; border: 1px solid #a8493e; border-radius: 10px; background: #a8493e; color: #fff; font: inherit; font-size: 10px; font-weight: 700; cursor: pointer; transition: transform .16s ease, background .16s ease; }
.danger-button:hover { background: #90392f; transform: translateY(-1px); }
.danger-button:focus-visible, .topic-delete-button:focus-visible { outline: 3px solid #8f82ef; outline-offset: 3px; }

@media (max-width: 620px) {
  .topic-facts { align-items: center; }
  .import-inline { margin-top: 2px; }
  .modal-backdrop { align-items: end; padding: 8px; }
  .app-dialog { max-height: 91dvh; padding: 18px 15px calc(17px + env(safe-area-inset-bottom)); border-radius: 18px 18px 13px 13px; }
  #word-input { min-height: 145px; }
  .import-help { display: grid; }
  .image-results { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .image-result-copy { padding: 7px; }
  .image-result-copy strong { font-size: 9px; }
  .image-search-form { gap: 6px; }
  .image-search-form input { min-height: 41px; font-size: 11px; }
  .image-search-form .primary-button { padding: 0 10px; }
  .photo-credit { bottom: 9px; left: 10px; max-width: 45%; font-size: 7px; }
  .photo-caption { right: 10px; bottom: 29px; left: 10px; max-width: calc(100% - 20px); font-size: 13px; }
}

/* Active recall, short adaptive sessions, scored tests, and the timed matching game */
.learning-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #efeee9; }
.learning-stats > div { display: grid; gap: 4px; }
.learning-stats span { color: #969791; font-size: 8px; }
.learning-stats strong { color: #474943; font-size: 12px; font-variant-numeric: tabular-nums; }
.practice-panel { min-height: 410px; padding: 20px; }
.practice-panel .exercise-topline { margin: -1px 0 0; }
.practice-intro { display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: center; gap: 28px; min-height: 344px; padding: 26px 35px; }
.practice-intro h3, .test-setup h3, .practice-summary h3 { margin: 0 0 9px; color: #292a2c; font-family: Fraunces, Georgia, serif; font-size: 28px; font-weight: 500; letter-spacing: -.035em; line-height: 1.12; }
.practice-intro p, .test-setup p, .practice-summary p { max-width: 510px; margin: 0; color: #777972; font-size: 12px; line-height: 1.6; }
.practice-orbit { position: relative; display: grid; place-items: center; width: 160px; height: 160px; margin: 0 auto; border: 1px solid #e4defd; border-radius: 50%; background: radial-gradient(circle at 37% 33%, #fff 0 16%, #f2efff 17% 56%, #e7e1ff 57% 100%); box-shadow: inset 0 2px 9px rgba(87,72,184,.08), 0 17px 34px rgba(81,66,177,.1); color: var(--violet); font-family: Fraunces, Georgia, serif; font-size: 43px; transform: rotate(-7deg); }
.practice-orbit i, .practice-orbit b { position: absolute; display: grid; place-items: center; width: 37px; height: 37px; border: 2px solid #fff; border-radius: 13px; box-shadow: 0 5px 13px rgba(56,52,39,.12); font-family: 'DM Sans', sans-serif; font-size: 17px; font-style: normal; }
.practice-orbit i { top: 3px; right: 6px; background: #dff1d9; color: #31745d; transform: rotate(11deg); }
.practice-orbit b { bottom: 8px; left: 3px; background: #ffeadb; color: #bc653e; transform: rotate(-10deg); }
.practice-tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 17px 0 19px; }
.practice-tags span { padding: 6px 8px; border: 1px solid #ebe8df; border-radius: 7px; background: #fff; color: #72746e; font-size: 9px; }
.primary-button, .secondary-button { transition: transform .16s ease, background .16s ease, border-color .16s ease; }
.primary-button:hover:not(:disabled), .secondary-button:hover { transform: translateY(-1px); }
.practice-progress { display: flex; align-items: center; gap: 12px; padding: 15px 0 0; color: #8a8b84; font-size: 9px; }
.practice-progress > span:first-child { min-width: 105px; }
.practice-progress > span:last-child { min-width: 65px; color: #6f706a; text-align: right; }
.practice-progress .panel-progress span { background: linear-gradient(90deg, #8d7cf0, var(--violet)); }
.practice-question { max-width: 720px; margin: 30px auto 8px; padding: 20px 28px 12px; }
.practice-question > p { margin: 10px 0 20px; color: #313330; font-family: Fraunces, Georgia, serif; font-size: clamp(21px, 2.2vw, 28px); line-height: 1.35; }
.practice-question .blank-line { display: inline-block; min-width: 88px; border-bottom: 2px solid #aba0ee; color: var(--violet); font-family: 'DM Sans', sans-serif; font-size: .78em; letter-spacing: .1em; text-align: center; }
.practice-hint { margin: -5px 0 14px; color: #8b8d86; font-size: 11px; line-height: 1.45; }
.practice-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.practice-choice { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 9px 12px; border: 1px solid #e5e3dc; border-radius: 11px; background: #fff; color: #454742; font-size: 11px; font-weight: 600; text-align: left; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.practice-choice:hover:not(:disabled) { border-color: #bbb2ef; background: #faf9ff; transform: translateY(-1px); }
.practice-choice.is-selected { border-color: #8c7ee2; background: #f4f1ff; box-shadow: inset 0 0 0 1px #d8d2fa; }
.practice-choice.is-correct { border-color: #a9d3b6; background: #eff8f1; color: #286249; }
.practice-choice.is-wrong { border-color: #e1b2a9; background: #fff2ef; color: #98463b; }
.practice-choice .choice-letter { display: grid; place-items: center; flex: 0 0 auto; width: 24px; height: 24px; border: 1px solid #e9e7e1; border-radius: 8px; color: #858780; font-size: 9px; }
.practice-binary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.practice-binary .practice-choice { justify-content: center; min-height: 54px; font-size: 12px; }
.practice-input { width: 100%; min-height: 49px; padding: 0 13px; border: 1px solid #dedcd5; border-radius: 10px; outline: none; background: #fff; color: #313330; font: inherit; font-size: 13px; }
.practice-input:focus { border-color: #a89de9; box-shadow: 0 0 0 3px rgba(118,104,216,.12); }
.practice-input.is-correct { border-color: #9bc6aa; background: #f4faf5; }
.practice-input.is-wrong { border-color: #dfaaa0; background: #fff7f5; }
.practice-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 17px; }
.practice-actions .primary-button { min-height: 42px; }
.practice-actions .text-button { margin-right: auto; }
.practice-summary { display: grid; justify-items: center; min-height: 340px; align-content: center; padding: 32px 20px 18px; text-align: center; }
.practice-summary h3 { margin-top: 14px; }
.practice-summary p { text-align: center; }
.summary-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 7px; background: #f0edff; color: #6254c6; font-size: 8px; font-weight: 700; letter-spacing: .1em; }
.summary-stats { display: flex; gap: 36px; margin: 20px 0 7px; }
.summary-stats > div { display: grid; gap: 4px; }
.summary-stats b { color: #343632; font-family: Fraunces, Georgia, serif; font-size: 26px; font-weight: 500; }
.summary-stats span { color: #898b85; font-size: 9px; }
.test-setup { max-width: 760px; margin: 0 auto; padding: 34px 18px 18px; }
.test-setup h3 { font-size: 26px; }
.test-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 24px 0 18px; }
.test-option { position: relative; display: flex; align-items: flex-start; gap: 9px; min-height: 82px; padding: 13px 11px; border: 1px solid #e6e4de; border-radius: 11px; background: #fff; cursor: pointer; }
.test-option:has(input:checked) { border-color: #c8c1f0; background: #f8f7ff; }
.test-option input { flex: 0 0 auto; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--violet); }
.test-option span { display: grid; gap: 5px; }
.test-option b { color: #484a45; font-size: 10px; }
.test-option small { color: #8b8d86; font-size: 9px; line-height: 1.35; }
.test-length { display: flex; align-items: center; justify-content: space-between; max-width: 310px; margin: 0 0 18px; color: #686a64; font-size: 10px; font-weight: 600; }
.test-length select { min-height: 37px; padding: 0 29px 0 10px; border: 1px solid #e1dfd8; border-radius: 8px; background: white; color: #53554f; font: inherit; }
.test-setup > .primary-button { min-height: 43px; }
.test-result-ring { display: grid; align-content: center; justify-items: center; width: 128px; height: 128px; margin: 15px 0 1px; border-radius: 50%; background: conic-gradient(var(--violet) var(--score-angle, 0deg), #eeecf5 0deg); position: relative; }
.test-result-ring::before { position: absolute; inset: 8px; border-radius: 50%; background: var(--paper); content: ''; }
.test-result-ring strong, .test-result-ring span { position: relative; z-index: 1; }
.test-result-ring strong { color: #353632; font-family: Fraunces, Georgia, serif; font-size: 30px; font-weight: 500; }
.test-result-ring span { color: #90918b; font-size: 8px; }
.missed-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; max-width: 610px; margin: 15px 0 4px; }
.missed-list > strong { flex: 0 0 100%; color: #7f817b; font-size: 9px; font-weight: 600; }
.missed-word { min-height: 32px; padding: 0 9px; border: 1px solid #e7e5df; border-radius: 8px; background: #fff; color: #676963; font-size: 9px; cursor: pointer; }
.missed-word:hover { border-color: #bbb2ef; background: #faf9ff; color: #5547bc; }
.match-scoreboard { display: flex; align-items: center; gap: 14px; color: #989a93; font-size: 8px; font-weight: 700; letter-spacing: .1em; }
.match-scoreboard b { margin-left: 4px; color: #494b46; font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.match-scoreboard > span:first-child b { color: #b65f3c; }
.match-round-progress { display: flex; align-items: center; gap: 12px; margin: 16px 0 14px; color: #898b85; font-size: 9px; }
.match-round-progress > span { min-width: 72px; text-align: right; }
.match-round-progress .panel-progress span { width: 0; background: #8fab35; }
.match-result { display: grid; justify-items: center; min-height: 250px; align-content: center; padding: 15px; text-align: center; }
.match-result h3 { margin: 14px 0 6px; color: #292a2c; font-family: Fraunces, Georgia, serif; font-size: 28px; font-weight: 500; }
.match-result p { margin: 0; color: #777972; font-size: 11px; }
.match-result-score { display: grid; gap: 2px; margin: 12px 0 15px; }
.match-result-score b { color: #403e34; font-family: Fraunces, Georgia, serif; font-size: 38px; font-weight: 500; line-height: 1; }
.match-result-score span { color: #858780; font-size: 9px; }
.match-result-score small { margin-top: 4px; color: #9a9b95; font-size: 8px; }
.match-result .primary-button { min-height: 41px; }
.learning-stats strong, .match-scoreboard b, .match-result-score b { font-variant-numeric: tabular-nums; }

@media (max-width: 930px) {
  .practice-intro { grid-template-columns: 145px minmax(0,1fr); gap: 20px; padding: 24px; }
  .practice-orbit { width: 130px; height: 130px; font-size: 36px; }
  .test-option { padding: 10px 8px; }
}
@media (max-width: 620px) {
  .practice-panel { padding: 13px; }
  .practice-intro { grid-template-columns: 1fr; gap: 15px; min-height: 0; padding: 20px 7px 12px; text-align: center; }
  .practice-orbit { width: 108px; height: 108px; font-size: 31px; }
  .practice-orbit i, .practice-orbit b { width: 30px; height: 30px; font-size: 14px; }
  .practice-intro h3, .test-setup h3 { font-size: 23px; }
  .practice-intro p { margin: 0 auto; font-size: 11px; }
  .practice-tags { justify-content: center; margin: 13px 0; }
  .practice-intro .primary-button { margin: 0 auto; }
  .practice-progress { gap: 7px; padding-top: 9px; font-size: 8px; }
  .practice-progress > span:first-child { min-width: 87px; }
  .practice-progress > span:last-child { min-width: 50px; }
  .practice-question { margin: 20px auto 3px; padding: 10px 2px 6px; }
  .practice-question > p { margin: 8px 0 15px; font-size: 22px; }
  .practice-options { grid-template-columns: 1fr; gap: 7px; }
  .practice-choice { min-height: 47px; }
  .practice-actions { align-items: stretch; flex-wrap: wrap; }
  .practice-actions .primary-button { flex: 1 1 100%; justify-content: center; }
  .practice-actions .text-button { min-height: 37px; }
  .test-setup { padding: 22px 1px 6px; }
  .test-options { grid-template-columns: 1fr; gap: 7px; margin: 16px 0; }
  .test-option { align-items: center; min-height: 58px; padding: 9px 10px; }
  .test-option span { grid-template-columns: 1fr; }
  .test-length { max-width: none; }
  .test-setup > .primary-button { width: 100%; justify-content: center; }
  .test-result-ring { width: 112px; height: 112px; }
  .summary-stats { gap: 25px; }
  .match-scoreboard { gap: 9px; font-size: 7px; }
  .match-scoreboard b { font-size: 10px; }
  .match-scoreboard .text-button { font-size: 9px; }
  .match-result { min-height: 220px; }
}

/* Three playful vocabulary games that reuse the active deck */
.games-menu[hidden], .game-play[hidden] { display: none; }
.games-menu { padding: 20px 1px 2px; }
.games-intro { display: grid; grid-template-columns: 122px minmax(0, 1fr); align-items: center; gap: 22px; padding: 2px 17px 20px; }
.games-intro h3 { margin: 5px 0 6px; color: #292a2c; font-family: Fraunces, Georgia, serif; font-size: 25px; font-weight: 500; letter-spacing: -.035em; }
.games-intro p { max-width: 470px; margin: 0; color: #777972; font-size: 12px; line-height: 1.55; }
.games-orbit { position: relative; display: grid; place-items: center; width: 102px; height: 102px; margin: 0 auto; border: 1px solid #e3dcff; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #fff 0 17%, #f2efff 18% 60%, #e8e1ff 61%); box-shadow: inset 0 2px 9px rgba(87,72,184,.08), 0 13px 25px rgba(81,66,177,.09); color: var(--violet); font-family: Fraunces, Georgia, serif; font-size: 23px; transform: rotate(-8deg); }
.games-orbit i, .games-orbit b { position: absolute; display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid white; border-radius: 10px; box-shadow: 0 4px 12px rgba(56,52,39,.13); font-family: 'DM Sans', sans-serif; font-size: 14px; font-style: normal; }
.games-orbit i { top: 1px; right: 0; background: #e2f1d6; color: #5e7e32; transform: rotate(13deg); }
.games-orbit b { bottom: 1px; left: 0; background: #ffeadb; color: #b9603e; transform: rotate(-9deg); }
.game-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.game-card { overflow: hidden; min-width: 0; border: 1px solid #e7e5df; border-radius: 14px; background: #fff; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.game-card:hover { border-color: #d5cff1; box-shadow: 0 9px 24px rgba(45,39,94,.08); transform: translateY(-2px); }
.game-card-art { position: relative; display: grid; place-items: center; height: 100px; overflow: hidden; }
.game-card--blitz .game-card-art { background: radial-gradient(circle at 75% 20%, #fff0b9 0 4%, transparent 5%), linear-gradient(135deg, #5945d6, #9382ed); }
.game-card--letters .game-card-art { background: radial-gradient(circle at 20% 70%, #fff 0 3%, transparent 4%), linear-gradient(135deg, #e7edbf, #c7dc68); }
.game-card--detective .game-card-art { background: radial-gradient(circle at 75% 30%, #f9d7b5 0 4%, transparent 5%), linear-gradient(135deg, #f3c5a5, #e47b52); }
.blitz-bolt { z-index: 1; color: #fff7c5; font-family: Georgia, serif; font-size: 66px; line-height: 1; text-shadow: 0 7px 18px rgba(39,29,112,.22); transform: rotate(9deg); }
.art-orbit { position: absolute; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; }
.art-orbit--one { width: 122px; height: 122px; transform: rotate(28deg) scaleX(.6); }
.art-orbit--two { width: 86px; height: 86px; transform: rotate(-38deg) scaleX(.56); }
.letter-tile { position: absolute; display: grid; place-items: center; width: 34px; height: 38px; border: 1px solid rgba(72,79,33,.1); border-radius: 9px; background: rgba(255,255,255,.93); box-shadow: 0 7px 14px rgba(82,92,35,.13); color: #555c2b; font-size: 17px; font-weight: 700; }
.letter-tile--a { z-index: 1; transform: translate(-26px, 4px) rotate(-12deg); }
.letter-tile--b { transform: translate(14px, -8px) rotate(8deg); }
.letter-tile--c { transform: translate(41px, 12px) rotate(14deg); }
.letter-spark { position: absolute; top: 12px; left: calc(50% - 54px); color: #fff; font-size: 18px; }
.detective-lens { position: relative; display: grid; place-items: center; width: 59px; height: 59px; border: 7px solid rgba(255,255,255,.92); border-radius: 50%; box-shadow: 0 7px 18px rgba(112,54,33,.18); transform: translate(-3px, -4px) rotate(-18deg); }
.detective-lens::after { position: absolute; right: -19px; bottom: -10px; width: 25px; height: 9px; border-radius: 8px; background: #fff; content: ''; }
.detective-lens i { width: 23px; height: 23px; border-radius: 50%; background: rgba(255,255,255,.36); }
.detective-star { position: absolute; top: 15px; left: calc(50% + 31px); display: grid; place-items: center; width: 23px; height: 23px; border-radius: 8px; background: #fff5ed; color: #c86745; font-size: 13px; font-weight: 700; transform: rotate(10deg); }
.detective-dot { position: absolute; right: calc(50% + 42px); bottom: 17px; width: 7px; height: 7px; border-radius: 50%; background: #fff9ee; }
.game-card-copy { display: flex; flex-direction: column; align-items: flex-start; min-height: 222px; padding: 14px 14px 13px; }
.game-tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 6px; background: #f1efff; color: #6d5dc9; font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.game-card h4 { margin: 8px 0 6px; color: #343532; font-family: Fraunces, Georgia, serif; font-size: 17px; font-weight: 500; letter-spacing: -.02em; line-height: 1.1; }
.game-card p { min-height: 60px; margin: 0; color: #74766f; font-size: 13px; line-height: 1.5; }
.game-record { display: flex; align-items: center; justify-content: space-between; width: 100%; margin: auto 0 10px; padding-top: 11px; border-top: 1px solid #f0eee8; color: #858780; font-size: 10px; }
.game-record strong { color: #5c5e58; font-size: 11px; font-weight: 700; }
.game-card .primary-button { min-height: 44px; padding: 0 12px; font-size: 12px; }
.game-card .primary-button span { font-size: 14px; line-height: 1; }
.games-footnote { display: flex; align-items: center; gap: 7px; margin: 14px 0 0; color: #858780; font-size: 12px; line-height: 1.4; }
.games-footnote span { color: #8b7be5; }
.game-play { padding: 15px 0 0; }
.game-play-head { display: flex; align-items: center; justify-content: space-between; min-height: 28px; margin-bottom: 13px; }
.game-back { color: #777972; }
.game-play-head > span { color: #858780; font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.game-score-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.game-score-strip > div { display: grid; gap: 4px; padding: 9px 11px; border: 1px solid #eeece6; border-radius: 10px; background: #fff; }
.game-score-strip small { color: #858780; font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.game-score-strip strong { color: #363833; font-size: 17px; font-variant-numeric: tabular-nums; }
.game-score-strip strong i { color: #777972; font-size: 11px; font-style: normal; font-weight: 500; }
.game-clock-track { height: 4px; margin: 10px 2px 17px; overflow: hidden; border-radius: 5px; background: #f0eee8; }
.game-clock-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d4e86d, #82a833); transition: width .5s linear; }
.game-question-card { padding: 20px; border: 1px solid #e7e2fb; border-radius: 14px; background: linear-gradient(140deg, #f7f5ff, #fffefa 78%); text-align: center; }
.game-question-card .game-tag { margin-bottom: 9px; }
.game-question-card h3, .letters-prompt h3 { margin: 0; color: #343532; font-family: Fraunces, Georgia, serif; font-size: 23px; font-weight: 500; line-height: 1.25; }
.game-question-card p { margin: 8px 0 0; color: #74766f; font-size: 12px; line-height: 1.45; }
.blitz-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 13px; }
.blitz-choice { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 49px; padding: 10px 12px; border: 1px solid #e7e5df; border-radius: 10px; background: #fff; color: #494b45; font-size: 12px; font-weight: 600; text-align: left; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.blitz-choice:hover:not(:disabled) { border-color: #bcb3f3; background: #faf9ff; transform: translateY(-1px); }
.blitz-choice i { color: #aaa9a2; font-size: 13px; font-style: normal; }
.blitz-choice.is-correct { border-color: #b8dcc6; background: var(--green-soft); color: #2f684f; }
.blitz-choice.is-wrong { border-color: #f0c4b4; background: var(--red-soft); color: #8e4a3c; }
.game-live-feedback { min-height: 27px; margin: 10px 0 0; color: #74766f; font-size: 12px; line-height: 1.5; }
.game-live-feedback.is-correct { color: #347458; }
.game-live-feedback.is-wrong { color: #a65342; }
.blitz-answer-form, .detective-answer-form { display: flex; gap: 8px; margin-top: 13px; }
.blitz-answer-form .practice-input, .detective-answer-form .practice-input { min-width: 0; min-height: 44px; font-size: 12px; }
.game-round-label { display: flex; align-items: center; justify-content: space-between; margin: 3px 0 13px; color: #74766f; font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.game-round-label strong { color: #5d5e58; font-size: 11px; letter-spacing: 0; }
.letters-prompt { padding: 15px; border: 1px solid #ebeddb; border-radius: 12px; background: #fbfced; text-align: center; }
.letters-prompt .game-tag { margin-bottom: 7px; background: #eef2d8; color: #6c762e; }
.letters-prompt h3 { font-size: 20px; }
.letter-answer-wrap { margin: 19px 0 11px; }
.letter-answer-wrap > .field-label { margin: 0 0 8px 2px; }
.letter-answer { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 49px; }
.letter-word { display: flex; gap: 4px; }
.letter-slot { display: grid; place-items: center; width: 31px; height: 39px; padding: 0; border: 1px dashed #d8d5ca; border-radius: 8px; background: #faf9f4; color: #464842; font-size: 16px; font-weight: 700; cursor: pointer; }
.letter-slot.is-filled { border-style: solid; border-color: #c7bff1; background: #f4f1ff; color: #5544c5; }
.letter-slot > span { color: #c4c2b8; font-weight: 400; }
.letter-pool { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; min-height: 42px; }
.letter-tile-button { display: grid; place-items: center; width: 37px; height: 40px; border: 1px solid #e5e3dc; border-radius: 9px; background: #fff; box-shadow: 0 2px 4px rgba(36,35,30,.04); color: #454741; font-size: 14px; font-weight: 700; cursor: pointer; transition: transform .13s ease, border-color .13s ease; }
.letter-tile-button:hover { border-color: #bcb3f3; transform: translateY(-2px); }
.letter-pool-empty { padding: 10px; color: #696b64; font-size: 12px; }
.game-action-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.game-action-row .primary-button { min-height: 44px; font-size: 12px; }
.game-action-row .text-button { min-height: 36px; }
.game-points-earned { color: #347458; font-size: 12px; font-weight: 700; }
.game-small-hint { margin: 12px 0 0; color: #74766f; font-size: 12px; line-height: 1.4; }
.detective-layout { display: grid; grid-template-columns: minmax(170px, .75fr) minmax(0, 1.25fr); gap: 17px; align-items: stretch; }
.case-photo { position: relative; display: flex; align-items: flex-end; min-height: 270px; overflow: hidden; padding: 14px; border-radius: 13px; background-image: url('./assets/transit-contact-sheet.png'); background-repeat: no-repeat; background-size: 300% auto; background-color: #eee8dc; }
.case-photo.photo--platform { --tile-x: 0%; --tile-y: 10%; }
.case-photo.photo--crowded { --tile-x: 50%; --tile-y: 10%; }
.case-photo.photo--luggage { --tile-x: 100%; --tile-y: 10%; }
.case-photo.photo--delay { --tile-x: 0%; --tile-y: 90%; }
.case-photo.photo--board { --tile-x: 50%; --tile-y: 90%; }
.case-photo.photo--route { --tile-x: 100%; --tile-y: 90%; }
.case-photo::after { position: absolute; inset: 40% 0 0; background: linear-gradient(180deg, transparent, rgba(16,18,22,.65)); content: ''; pointer-events: none; }
.case-photo-label, .case-photo-stamp { position: absolute; z-index: 1; }
.case-photo-label { right: 12px; bottom: 12px; left: 12px; color: white; font-family: Fraunces, Georgia, serif; font-size: 14px; line-height: 1.25; }
.case-photo-stamp { top: 10px; left: 10px; padding: 6px 8px; border: 1px solid rgba(255,255,255,.38); border-radius: 7px; background: rgba(255,255,255,.84); color: #54554e; font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.case-photo.photo--user-image { background-image: radial-gradient(circle at 25% 25%, #e3dcff, transparent 38%), linear-gradient(145deg, #eee8dc, #ded8cd); background-size: cover; }
.detective-workbench { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding: 5px 0; }
.detective-workbench > h3 { margin: 9px 0 12px; color: #373833; font-family: Fraunces, Georgia, serif; font-size: 19px; font-weight: 500; line-height: 1.2; }
.detective-clues { display: grid; gap: 7px; width: 100%; }
.detective-first-hint { margin: 0; padding: 11px; border: 1px dashed #e5e1d7; border-radius: 9px; color: #74766f; font-size: 12px; line-height: 1.45; }
.detective-clue { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: start; padding: 9px; border: 1px solid #eeeae2; border-radius: 9px; background: #fffefa; animation: clue-in .2s ease both; }
.detective-clue > span { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 7px; background: #f0edff; color: #6b5bc9; font-size: 7px; font-weight: 700; }
.detective-clue p { margin: 2px 0 0; color: #565852; font-size: 12px; line-height: 1.45; }
.detective-controls { width: 100%; margin-top: auto; padding-top: 11px; }
.detective-controls > .secondary-button { min-height: 44px; padding: 0 12px; font-size: 12px; }
.detective-controls > .secondary-button span { margin-left: 4px; color: #8b5c3f; font-size: 10px; }
.detective-controls .detective-answer-form { margin-top: 8px; }
.game-summary { display: grid; justify-items: center; align-content: center; min-height: 355px; padding: 25px 16px; text-align: center; }
.game-trophy { display: grid; place-items: center; width: 60px; height: 60px; margin: 17px 0 9px; border: 1px solid #e4defd; border-radius: 20px; background: linear-gradient(140deg, #f8f6ff, #ebe6ff); box-shadow: 0 7px 17px rgba(81,66,177,.1); color: #7867dc; font-size: 30px; transform: rotate(-6deg); }
.game-summary h3 { margin: 2px 0 7px; color: #292a2c; font-family: Fraunces, Georgia, serif; font-size: 25px; font-weight: 500; }
.game-summary > p { max-width: 430px; margin: 0; color: #696b64; font-size: 12px; line-height: 1.5; }
.game-final-score { display: grid; gap: 2px; margin: 14px 0; }
.game-final-score strong { color: #383a34; font-family: Fraunces, Georgia, serif; font-size: 40px; font-weight: 500; line-height: 1; }
.game-final-score span { color: #74766f; font-size: 10px; }
.game-final-score small { margin-top: 4px; color: #777972; font-size: 10px; }
.game-summary-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.game-summary-actions .primary-button, .game-summary-actions .secondary-button { min-height: 44px; font-size: 12px; }
@keyframes clue-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1120px) and (min-width: 931px) {
  .game-cards { grid-template-columns: 1fr; }
  .game-card { display: grid; grid-template-columns: 130px minmax(0, 1fr); }
  .game-card-art { height: auto; min-height: 100%; }
  .game-card-copy { min-height: 0; }
  .game-card p { min-height: 0; margin-bottom: 10px; }
}
@media (max-width: 620px) {
  .games-panel { padding: 13px; }
  .games-menu { padding-top: 14px; }
  .games-intro { grid-template-columns: 1fr; gap: 12px; padding: 2px 4px 16px; text-align: center; }
  .games-orbit { width: 82px; height: 82px; font-size: 20px; }
  .games-orbit i, .games-orbit b { width: 24px; height: 24px; font-size: 12px; }
  .games-intro h3 { font-size: 23px; }
  .games-intro p { margin: 0 auto; font-size: 12px; }
  .game-cards { grid-template-columns: 1fr; gap: 9px; }
  .game-card { display: grid; grid-template-columns: 94px minmax(0, 1fr); }
  .game-card-art { height: auto; min-height: 100%; }
  .game-card-copy { min-height: 0; padding: 11px 11px 10px; }
  .game-card h4 { margin: 6px 0 4px; font-size: 16px; }
  .game-card p { min-height: 0; margin-bottom: 9px; font-size: 12px; }
  .game-record { margin-bottom: 8px; padding-top: 8px; }
  .game-card .primary-button { min-height: 32px; }
  .games-footnote { align-items: flex-start; font-size: 12px; }
  .game-play { padding-top: 10px; }
  .game-score-strip { gap: 5px; }
  .game-score-strip > div { padding: 8px; }
  .game-score-strip strong { font-size: 15px; }
  .game-question-card { padding: 17px 12px; }
  .game-question-card h3 { font-size: 20px; }
  .blitz-choices { grid-template-columns: 1fr; gap: 7px; }
  .blitz-choice { min-height: 43px; }
  .blitz-answer-form, .detective-answer-form { flex-direction: column; }
  .letter-slot { width: 27px; height: 35px; }
  .letter-pool { gap: 5px; }
  .letter-tile-button { width: 33px; height: 37px; }
  .game-action-row .primary-button { flex: 1; }
  .detective-layout { grid-template-columns: 1fr; gap: 12px; }
  .case-photo { min-height: 185px; aspect-ratio: 1.7; }
  .detective-workbench > h3 { font-size: 18px; }
  .detective-controls { margin-top: 8px; }
  .game-summary { min-height: 310px; }
}

@media (max-width: 620px) {
  .mobile-header .brand { min-height: 44px; }
  .primary-button,
  .secondary-button,
  .upload-button { min-height: 44px; }
  .dialog-close { width: 44px; height: 44px; }
  .dialog-footer .primary-button,
  .dialog-footer .secondary-button { min-height: 44px; }
  .import-inline { min-height: 44px; padding-right: 12px; padding-left: 12px; }
  .shuffle-button { width: 44px; height: 44px; }
  .translation-toggle { min-height: 44px; }
  .text-button { min-height: 44px; padding: 0 7px; }
  .card-photo-tools .text-button { min-height: 44px; }
  .review-button { min-height: 44px; }
  .card-navigation { height: auto; min-height: 44px; gap: 8px; }
  .card-navigation button { width: 44px; height: 44px; }
  .topic-word-item { min-height: 44px; }
  .topic-word-item button { min-height: 44px; }
  .practice-actions .primary-button,
  #learn-start,
  #test-start { min-height: 44px; }
  .test-length select { min-height: 44px; }
  .match-item { min-height: 48px; }
  .game-card .primary-button { min-height: 44px; }
  .game-card p { font-size: 12px; line-height: 1.45; }
  .games-footnote { font-size: 12px; }
  .blitz-choice { min-height: 48px; }
  .letter-slot { width: 44px; height: 44px; }
  .letter-word { min-width: 0; max-width: 100%; flex-wrap: wrap; justify-content: center; }
  .letter-tile-button { width: 44px; height: 44px; }
  .game-small-hint { font-size: 12px; }
  .case-photo { width: 100%; min-width: 0; max-width: 100%; }
  .game-action-row .primary-button,
  .game-action-row .text-button { min-height: 44px; }
  .detective-controls > .secondary-button { min-height: 44px; }
}

/* Private sign-in and cross-device sync */
body.auth-required .app-shell,
body.auth-required .mobile-nav { display: none !important; }
.auth-screen { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; min-height: 100vh; min-height: 100svh; overflow: auto; padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); background: radial-gradient(ellipse at 14% 12%, rgba(216,237,113,.18), transparent 34%), radial-gradient(ellipse at 90% 84%, rgba(114,92,220,.12), transparent 37%), #f6f5f1; }
.auth-glow { position: fixed; z-index: -1; width: 300px; height: 300px; border: 1px solid rgba(89,69,214,.08); border-radius: 50%; pointer-events: none; }
.auth-glow--one { top: -210px; right: 8%; box-shadow: 0 0 0 30px rgba(89,69,214,.025), 0 0 0 62px rgba(89,69,214,.018); }
.auth-glow--two { bottom: -230px; left: 5%; width: 340px; height: 340px; border-color: rgba(151,169,54,.11); box-shadow: 0 0 0 28px rgba(151,169,54,.025), 0 0 0 58px rgba(151,169,54,.018); }
.auth-card { position: relative; width: min(440px, 100%); padding: 37px clamp(23px, 7vw, 43px) 29px; border: 1px solid rgba(227,224,215,.9); border-radius: 23px; background: rgba(255,254,250,.96); box-shadow: 0 22px 70px rgba(37,35,31,.10), 0 2px 8px rgba(37,35,31,.035); }
.auth-brand { margin-bottom: 34px; }
.auth-eyebrow { display: block; margin-bottom: 11px; color: #7465d0; }
.auth-card h1 { margin: 0; color: #262725; font-family: Fraunces, Georgia, serif; font-size: clamp(29px, 7vw, 36px); font-weight: 500; letter-spacing: -.045em; line-height: 1.12; }
.auth-description { margin: 12px 0 26px; color: #73756f; font-size: 13px; line-height: 1.6; }
.auth-label { display: block; margin-bottom: 8px; color: #444640; font-size: 12px; font-weight: 700; }
.auth-input-wrap { position: relative; }
.auth-input-wrap input { width: 100%; min-height: 52px; padding: 0 95px 0 14px; border: 1px solid #dddad2; border-radius: 11px; background: white; color: #2b2c29; font-size: 16px; letter-spacing: .08em; transition: border-color .16s ease, box-shadow .16s ease; }
.auth-input-wrap input:focus { border-color: #9a8ee8; outline: 0; box-shadow: 0 0 0 3px rgba(89,69,214,.11); }
.auth-reveal { position: absolute; top: 4px; right: 4px; min-width: 78px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: #6d61bd; font-size: 11px; font-weight: 700; cursor: pointer; }
.auth-reveal:hover { background: #f4f2ff; }
.auth-submit { display: flex; justify-content: center; gap: 10px; width: 100%; min-height: 50px; margin-top: 14px; border-radius: 11px; font-size: 13px; }
.auth-submit span { font-size: 17px; }
.auth-help { margin: 13px 0 0; color: #82847d; font-size: 11px; line-height: 1.45; text-align: center; }
.auth-status { min-height: 15px; margin: 16px 0 0; color: #92938c; font-size: 10px; text-align: center; }
.auth-error { margin: 9px 0 0; color: #a34339; font-size: 12px; line-height: 1.45; }
.auth-error:not([hidden]) { display: block; }
.logout-button { min-height: 34px; padding: 0 10px; border: 1px solid #e5e2da; border-radius: 9px; background: #fffefa; color: #656760; font-size: 10px; font-weight: 600; cursor: pointer; }
.logout-button:hover { border-color: #d5d0ed; background: #f7f5ff; color: #5546b6; }
#sync-indicator[data-sync-state="saving"] .status-pip { background: #d49a31; box-shadow: 0 0 0 3px #fff3da; }
#sync-indicator[data-sync-state="error"] .status-pip { background: #c35b4c; box-shadow: 0 0 0 3px #fff0ed; }
#sync-indicator[data-sync-state="connecting"] .status-pip { background: #9186dc; box-shadow: 0 0 0 3px #f0edff; }

@media (max-width: 620px) {
  .auth-screen { padding-right: 16px; padding-left: 16px; }
  .auth-card { padding-top: 29px; padding-bottom: 22px; border-radius: 19px; }
  .auth-brand { margin-bottom: 27px; }
  .auth-description { margin-bottom: 22px; font-size: 12px; }
  .logout-button { min-height: 44px; padding: 0 9px; font-size: 10px; }
  #sync-status { display: none; }
}

@media (max-width: 760px) and (min-width: 621px) {
  .flashcard { grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); }
  .card-photo { min-height: 260px; aspect-ratio: auto; }
  .card-content { padding-left: 18px; }
  .word-line h3 { font-size: 31px; }
  .exercise-content { grid-template-columns: minmax(0, .75fr) minmax(0, 1.1fr); gap: 15px; }
  .exercise-photo { min-height: 220px; aspect-ratio: auto; }
}

/* Interactive reading and phrase analysis */
.analysis-page { max-width: 1320px; margin: 0 auto; padding: 35px 0 28px; }
.analysis-heading { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 22px; }
.analysis-heading-copy { max-width: 690px; }
.analysis-heading h1 { margin: 8px 0; color: #292a2c; font-family: Fraunces, Georgia, serif; font-size: clamp(32px, 4vw, 46px); font-weight: 500; letter-spacing: -.045em; line-height: 1.04; }
.analysis-heading p { max-width: 620px; margin: 0; color: #777972; font-size: 12px; line-height: 1.55; }
.analysis-heading-mark { position: relative; display: grid; place-items: center; flex: 0 0 auto; width: 84px; height: 84px; border: 1px solid #dfdaf8; border-radius: 26px; background: linear-gradient(145deg, #faf9ff, #eeeaff); color: #6a5ad0; font-family: Fraunces, Georgia, serif; font-size: 22px; transform: rotate(4deg); }
.analysis-heading-mark span { font-size: 20px; }
.analysis-heading-mark i, .analysis-heading-mark b { position: absolute; display: grid; place-items: center; width: 27px; height: 27px; border: 2px solid #fff; border-radius: 9px; background: #dceca5; color: #53651a; font-family: 'DM Sans', sans-serif; font-size: 14px; font-style: normal; }
.analysis-heading-mark i { top: -7px; right: -7px; }
.analysis-heading-mark b { bottom: -8px; left: -9px; background: #ffe4d3; color: #a85b37; font-size: 11px; }
.analysis-input-card, .analysis-reading-card, .analysis-phrase-card, .analysis-summary-card { border: 1px solid #e6e4de; border-radius: 17px; background: var(--paper-strong); box-shadow: 0 6px 20px rgba(36,35,30,.025); }
.analysis-input-card { padding: 20px; }
.analysis-input-label { display: block; margin-bottom: 9px; color: #797b75; font-size: 9px; font-weight: 700; letter-spacing: .13em; }
#analysis-input { display: block; width: 100%; min-height: 190px; resize: vertical; padding: 15px 16px; border: 1px solid #dedcd5; border-radius: 12px; outline: none; background: #fdfcf9; color: #343633; font: 14px/1.7 'DM Sans', sans-serif; }
#analysis-input::placeholder { color: #a1a29d; }
#analysis-input:focus { border-color: #a89de9; box-shadow: 0 0 0 3px rgba(118,104,216,.12); }
.analysis-input-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; }
.analysis-input-count { color: #858780; font-size: 10px; font-variant-numeric: tabular-nums; }
.analysis-input-count.is-over-limit { color: #a64139; font-weight: 700; }
.analysis-input-actions { display: flex; align-items: center; gap: 10px; }
.analysis-input-actions .primary-button { min-height: 42px; }
.analysis-privacy-note { margin: 9px 1px 0; color: #92938d; font-size: 9px; line-height: 1.5; }
.analysis-results { padding-top: 24px; scroll-margin-top: 16px; }
.analysis-summary-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 18px; }
.analysis-summary-card h2 { margin: 5px 0 0; color: #30312f; font-family: Fraunces, Georgia, serif; font-size: 20px; font-weight: 500; }
.analysis-stats { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.analysis-stats span { padding: 7px 9px; border: 1px solid #eeece6; border-radius: 8px; background: #fbfaf7; color: #777972; font-size: 9px; white-space: nowrap; }
.analysis-stats b { margin-right: 3px; color: #4e42ba; font-size: 11px; }
.analysis-legend { display: flex; flex-wrap: wrap; gap: 9px 17px; padding: 13px 3px; color: #777972; font-size: 9px; }
.analysis-legend span { display: inline-flex; align-items: center; gap: 7px; }
.analysis-legend i { width: 12px; height: 12px; border-radius: 4px; background: #5b4bd1; }
.analysis-legend .legend-phrasal { border: 1px dotted #6c5bd0; background: #f4f1ff; }
.analysis-legend .legend-collocation { border: 1px dotted #cf7940; background: #fff5eb; }
.analysis-legend .legend-sentence { border: 1px dashed #a5a49e; background: #f7f6f1; }
.analysis-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); align-items: start; gap: 15px; }
.analysis-reading-card, .analysis-phrase-card { min-width: 0; padding: 17px; }
.analysis-phrase-card { position: sticky; top: 18px; max-height: calc(100vh - 36px); overflow: auto; }
.analysis-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.analysis-card-heading h3 { margin: 4px 0 0; color: #333531; font-family: Fraunces, Georgia, serif; font-size: 18px; font-weight: 500; }
.analysis-edit-button { min-height: 32px; padding: 0 10px; border: 1px solid #e8e5de; border-radius: 8px; background: #fff; color: #686a64; font: inherit; font-size: 9px; font-weight: 600; cursor: pointer; }
.analysis-edit-button:hover { border-color: #c9c2f1; color: #5849bd; }
.analysis-selection-hint { margin: -3px 0 13px; color: #858780; font-size: 9px; line-height: 1.5; }
.analysis-sentences { display: grid; gap: 10px; }
.analysis-sentence-card { padding: 14px 15px 12px; border: 1px solid #eeece6; border-radius: 13px; background: #fffefa; }
.analysis-sentence-header { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.analysis-sentence-number { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid #e7e3f9; border-radius: 7px; background: #f6f4ff; color: #6052c7; font-size: 8px; font-weight: 700; }
.analysis-sentence-label { color: #9b9c95; font-size: 8px; font-weight: 700; letter-spacing: .1em; }
.analysis-sentence-text { margin: 0; color: #333531; font-family: Fraunces, Georgia, serif; font-size: clamp(16px, 1.6vw, 20px); line-height: 1.75; }
.analysis-token { position: relative; display: inline; margin: 0; padding: 0 1px; border: 0; border-radius: 4px; background: transparent; color: inherit; font: inherit; line-height: inherit; cursor: pointer; }
.analysis-token:hover { background: #f1effb; color: #4e40b6; }
.analysis-token--phrasal { text-decoration: underline dotted #6b5acb; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.analysis-token--collocation { text-decoration: underline dotted #cf7940; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.analysis-token.is-selected { padding: 0 4px; background: #5945d6; color: #fff; box-shadow: 0 0 0 2px rgba(89,69,214,.14); text-decoration: none; }
.analysis-token.is-range-start { padding: 0 4px; border-radius: 4px; background: #fff0d9; color: #955f11; box-shadow: 0 0 0 2px rgba(209,151,63,.16); text-decoration: none; }
.analysis-annotations { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.analysis-annotation { min-height: 27px; padding: 4px 8px; border: 1px dashed #c9c7c0; border-radius: 7px; background: #fbfaf7; color: #777972; font: inherit; font-size: 8px; cursor: pointer; }
.analysis-annotation:hover, .analysis-annotation.is-selected { border-color: #6d5bd0; background: #f3f1ff; color: #5142b2; }
.analysis-annotation--phrasal { border-color: #a69be1; border-style: dotted; background: #f8f6ff; color: #5a4cc0; }
.analysis-annotation--collocation { border-color: #e2b28d; border-style: dotted; background: #fff8f2; color: #a86130; }
.analysis-annotation--phrasal:hover, .analysis-annotation--phrasal.is-selected { border-color: #6956cf; background: #efecff; }
.analysis-annotation--collocation:hover, .analysis-annotation--collocation.is-selected { border-color: #c86e31; background: #fff0e3; color: #8e4d25; }
.analysis-phrase-select { border-color: #c8c0f1; border-style: dashed; background: #f8f6ff; color: #5c50b0; }
.analysis-phrase-select:hover, .analysis-phrase-select.is-active { border-color: #6d5bd0; background: #eeebff; color: #4f40ae; }
.analysis-phrase-total { display: grid; place-items: center; min-width: 26px; height: 26px; border-radius: 8px; background: #f3f1ff; color: #5b4cc0; font-size: 10px; font-weight: 700; }
.analysis-phrase-help { margin: -3px 0 12px; color: #92938d; font-size: 9px; line-height: 1.5; }
.analysis-phrase-list { display: grid; gap: 7px; }
.analysis-phrase-item { display: grid; gap: 4px; width: 100%; min-width: 0; padding: 9px 10px; border: 1px dotted #a69be1; border-radius: 10px; background: #faf9ff; color: #5142b2; text-align: left; cursor: pointer; }
.analysis-phrase-item:hover, .analysis-phrase-item.is-selected { border-color: #6956cf; background: #f0edff; box-shadow: 0 0 0 2px rgba(105,86,207,.08); }
.analysis-phrase-item strong { overflow-wrap: anywhere; font-size: 11px; }
.analysis-phrase-item small { color: #857abf; font-size: 8px; }
.analysis-phrase-item > span { display: -webkit-box; overflow: hidden; color: #83847e; font-family: 'DM Sans', sans-serif; font-size: 8px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.analysis-phrase-item--collocation { border-color: #e2b28d; background: #fffaf5; color: #985629; }
.analysis-phrase-item--collocation:hover, .analysis-phrase-item--collocation.is-selected { border-color: #c86e31; background: #fff1e5; }
.analysis-phrase-item--collocation small { color: #b5764d; }
.analysis-empty-phrases { margin: 0; padding: 12px; border: 1px dashed #e5e2d9; border-radius: 10px; color: #858780; font-size: 10px; line-height: 1.5; }
.analysis-detail-dialog { width: min(570px, 100%); }
.analysis-detail-pronunciation { display: flex; align-items: end; gap: 10px; margin: 16px 0 13px; }
.analysis-detail-pronunciation .analysis-detail-field { flex: 1; }
.analysis-detail-field { display: grid; gap: 6px; min-width: 0; margin-bottom: 13px; color: #777972; font-size: 8px; font-weight: 700; letter-spacing: .1em; }
.analysis-detail-field input, .analysis-detail-field textarea { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid #e1dfd8; border-radius: 9px; outline: none; background: #fff; color: #343633; font: 12px/1.5 'DM Sans', sans-serif; letter-spacing: normal; resize: vertical; }
.analysis-detail-field input:focus, .analysis-detail-field textarea:focus { border-color: #a89de9; box-shadow: 0 0 0 3px rgba(118,104,216,.12); }
.analysis-detail-field textarea { min-height: 57px; }
.audio-button { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; margin-bottom: 13px; border: 1px solid #dcd6f7; border-radius: 12px; background: #f5f2ff; color: #5a4bc0; font-size: 13px; cursor: pointer; }
.audio-button:hover { border-color: #aa9fe8; background: #eeebff; }
.analysis-translation-disclosure { margin: 2px 0 13px; border: 1px solid #ebe9e2; border-radius: 10px; background: #fbfaf7; }
.analysis-translation-disclosure summary { display: flex; align-items: center; gap: 7px; min-height: 43px; padding: 0 11px; color: #686a64; font-size: 10px; cursor: pointer; list-style: none; }
.analysis-translation-disclosure summary::-webkit-details-marker { display: none; }
.analysis-translation-disclosure[open] summary { border-bottom: 1px solid #ebe9e2; color: #5945d6; }
.analysis-translation-disclosure .analysis-detail-field { margin: 0; padding: 11px; }
.analysis-image-preview { display: flex; align-items: center; gap: 10px; min-height: 58px; margin: 12px 0; padding: 7px; border-radius: 10px; background: #f4f2ed; color: #777972; font-size: 9px; }
.analysis-image-preview[hidden] { display: none; }
.analysis-image-preview.is-empty { min-height: 38px; padding: 0 10px; background: transparent; color: #92938d; }
.analysis-image-preview img { width: 64px; height: 48px; border-radius: 7px; object-fit: cover; }
.analysis-detail-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 7px; }
.analysis-detail-actions button { min-height: 42px; }
.analysis-detail-note { min-height: 17px; margin: 9px 1px 0; color: #8a8b84; font-size: 9px; line-height: 1.45; }

@media (max-width: 930px) {
  .analysis-page { max-width: 760px; padding-top: 28px; }
  .analysis-layout { grid-template-columns: minmax(0, 1fr); }
  .analysis-phrase-card { position: static; max-height: none; }
}

@media (max-width: 620px) {
  .analysis-page { padding: 21px 0 18px; }
  .analysis-heading { gap: 10px; margin-bottom: 15px; }
  .analysis-heading h1 { max-width: 280px; font-size: 32px; }
  .analysis-heading p { font-size: 11px; }
  .analysis-heading-mark { width: 58px; height: 58px; border-radius: 19px; font-size: 16px; }
  .analysis-heading-mark span { font-size: 15px; }
  .analysis-heading-mark i, .analysis-heading-mark b { width: 22px; height: 22px; border-radius: 7px; font-size: 11px; }
  .analysis-input-card { padding: 13px; border-radius: 14px; }
  #analysis-input { min-height: 145px; padding: 11px; font-size: 12px; }
  .analysis-input-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
  .analysis-input-actions { width: 100%; justify-content: space-between; gap: 5px; }
  .analysis-input-actions .primary-button { min-height: 40px; padding: 0 11px; font-size: 9px; }
  .analysis-input-actions .text-button { font-size: 9px; }
  .analysis-summary-card { align-items: flex-start; flex-direction: column; padding: 13px; }
  .analysis-stats { justify-content: flex-start; gap: 5px; }
  .analysis-stats span { padding: 6px 7px; font-size: 8px; }
  .analysis-legend { gap: 8px 11px; font-size: 8px; }
  .analysis-reading-card, .analysis-phrase-card { padding: 12px; }
  .analysis-sentence-card { padding: 11px 10px 10px; }
  .analysis-sentence-text { font-size: 16px; line-height: 1.8; }
  .analysis-card-heading h3 { font-size: 16px; }
  .analysis-detail-actions { flex-direction: column-reverse; }
  .analysis-detail-actions button { width: 100%; }
  .analysis-detail-dialog { padding: 17px 14px calc(15px + env(safe-area-inset-bottom)); }
}
