@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Noto+Sans+TC:wght@400;500;600;700;800&display=swap');

:root {
  --night: #14243e;
  --paper: #fffdf8;
  --ink: #18283f;
  --muted: #647187;
  --gold: #ffd17a;
  --teal: #27836f;
  --line: #dce2e7;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: #f7f5ef;
  background: radial-gradient(circle at 18% 8%, #284767, transparent 36%), linear-gradient(145deg, #14243e, #112139);
  font: 16px/1.6 'DM Sans', 'Noto Sans TC', system-ui, sans-serif;
}
button, a { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }
.sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.sky i { position: absolute; width: 3px; height: 3px; background: #fff8d9; border-radius: 50%; opacity: .5; }
.sky i:nth-child(1) { top: 17%; left: 12%; }
.sky i:nth-child(2) { top: 34%; left: 49%; }
.sky i:nth-child(3) { top: 13%; right: 15%; }
.sky i:nth-child(4) { top: 67%; right: 13%; }
.sky i:nth-child(5) { top: 82%; left: 28%; }
.sky i:nth-child(6) { top: 51%; right: 27%; }
.shell { max-width: 1100px; min-height: 100vh; margin: auto; padding: 0 28px; display: flex; flex-direction: column; }
.site-header { height: 78px; flex: none; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #ffffff26; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 21px; font-weight: 800; letter-spacing: .02em; }
.brand-icon { width: 35px; height: 35px; display: grid; place-items: center; background: var(--gold); color: var(--night); border-radius: 10px; font-size: 23px; }
.sound { border: 1px solid #ffffff42; color: #e3e9f4; background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.sound[aria-pressed=true] { border-color: var(--gold); color: var(--gold); }
#app { flex: 1; }
.screen { animation: appear .22s ease both; }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.eyebrow { margin: 0 0 10px; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .1em; }

/* Start */
.start-screen { max-width: 1010px; margin: 0 auto; padding: 42px 0 34px; }
.home-intro h1 { margin: 0 0 30px; font-size: clamp(50px, 6vw, 76px); line-height: 1.1; letter-spacing: -.055em; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 16px; }
.daily-card { min-height: 332px; width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 0; position: relative; overflow: hidden; padding: 25px 28px 23px; border: 2px solid transparent; border-radius: 22px; background: var(--paper); color: var(--ink); text-align: left; box-shadow: 0 18px 45px #08172b66; transition: transform .16s, border-color .16s; }
.daily-card:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--gold); }
.daily-card-art { position: absolute !important; z-index: 0 !important; right: -18px; top: 45px; width: 185px; height: 215px; display: grid; place-items: center; border: 11px solid #dfad70; border-radius: 100px 100px 10px 10px; color: #dba15c; font: 120px/1 Georgia, serif; opacity: .13; transform: rotate(-7deg); pointer-events: none; }
.daily-card > span { position: relative; z-index: 1; }
.daily-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.daily-card-top strong { font-size: 27px; line-height: 1.2; }
.daily-card-top > span { color: #967248; font-size: 24px; }
.daily-preview-word { display: block; margin-top: 31px; color: #234466; font: 700 clamp(32px, 3.4vw, 44px)/1.15 Georgia, serif; overflow-wrap: anywhere; }
.daily-preview-sentence { display: block; max-width: 450px; margin: 9px 0 24px; color: #4f5d6e; font: 20px/1.45 Georgia, serif; }
.daily-card-action { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 14px; border-top: 1px solid #dce2e5; color: #1f6557; font-size: 16px; font-weight: 800; }
.daily-card-action span { font-size: 21px; }
.mode-stack { display: grid; grid-template-rows: repeat(3, 1fr); gap: 12px; }
.mode-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; position: relative; min-height: 102px; padding: 12px 25px; border: 1px solid #ffffff4a; border-radius: 20px; background: #ffffff10; color: #fff; text-align: left; transition: background .16s, transform .16s; }
.mode-card:hover:not(:disabled) { background: #ffffff21; transform: translateY(-2px); }
.mode-card > span:first-child { font-size: 23px; font-weight: 800; line-height: 1.25; }
.mode-card strong { margin-top: 9px; color: var(--gold); font-size: 23px; line-height: 1; }
.mode-arrow { position: absolute; right: 22px; top: 17px; color: #f3dfbd; font-size: 23px; }
.primary-button, .secondary-button { min-height: 52px; border-radius: 12px; padding: 12px 18px; font-weight: 800; transition: background .15s, transform .15s, border-color .15s; }
.primary-button { color: var(--ink); background: var(--gold); border: 1px solid var(--gold); }
.primary-button:hover:not(:disabled) { background: #ffe0a4; transform: translateY(-2px); }
.secondary-button { color: #f5f5ef; background: #ffffff12; border: 1px solid #ffffff50; }
.secondary-button:hover:not(:disabled) { background: #ffffff22; border-color: #ffffffb0; }
.load-error { color: #ffd8d1; margin: 14px 0 0; font-size: 14px; }
.home-stats { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid #ffffff20; margin-top: 25px; padding: 17px 0 0; color: #c0cce0; font-size: 14px; }
.home-stats b { color: #fff; }
.home-stats button { color: var(--gold); background: transparent; border: 0; padding: 4px 0; font-weight: 700; }
.home-stats button b { color: inherit; }

/* Question */
.game-screen { max-width: 780px; margin: 0 auto; padding: 20px 0 64px; }
.hud { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 19px; }
.back-button { border: 0; background: transparent; color: #bdcbe0; padding: 7px 0; }
.back-button:hover { color: var(--gold); }
.hud-stats { display: flex; gap: 18px; color: #bdcbe0; font-size: 13px; }
.hud-stats b { color: #fff; font-size: 16px; }
.level-line h2 { margin: 0; font-size: 26px; line-height: 1.2; }
.level-line .eyebrow { margin-bottom: 2px; }
.progress-track { display: flex; gap: 7px; margin: 17px 0 21px; }
.progress-track span { flex: 1; height: 5px; border-radius: 5px; background: #4c607a; }
.progress-track .done { background: #55bba5; }
.progress-track .current { background: var(--gold); }
.game-card { padding: 30px 34px; background: var(--paper); color: var(--ink); border-radius: 20px; box-shadow: 0 16px 44px #08162d66; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 20px; }
.phase-pill, .rate-pill { font-size: 12px; font-weight: 800; }
.phase-pill { color: #2b786a; background: #e5f3ee; border-radius: 999px; padding: 5px 11px; }
.rate-pill { color: #8b653a; }
.game-card h3 { font-size: clamp(22px, 2.8vw, 29px); line-height: 1.4; margin: 0 0 19px; }
.sentence { margin: 0 0 23px; padding: 17px 20px; background: #f0f3f2; border-left: 4px solid #55ad98; border-radius: 0 10px 10px 0; font: 24px/1.55 Georgia, 'Times New Roman', serif; }
.highlight { color: #176f61; font-weight: 800; background: #d8f1e7; padding: 0 3px; border-radius: 4px; }
.blank { display: inline-block; min-width: 60px; color: #a4652c; font-weight: 800; text-align: center; border-bottom: 2px dotted #c88a4f; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice { min-height: 61px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); text-align: left; font-weight: 700; overflow-wrap: anywhere; }
.choice:hover:not(:disabled) { border-color: #dca45e; background: #fffaf1; }
.choice .letter { flex: none; width: 27px; height: 27px; display: grid; place-items: center; background: #eaf0f1; color: #54717c; border-radius: 7px; font-size: 12px; }
.choice.correct { background: #e1f5e9; border-color: #4dad86; color: #155a44; opacity: 1; }
.choice.wrong { background: #fee9e5; border-color: #d96a66; color: #8b3837; opacity: 1; }
.choice.removed { opacity: .25; }
.tool-row { margin-top: 14px; }
.tool-button { border: 0; background: transparent; color: #8c653b; padding: 5px 0; font-size: 13px; font-weight: 800; }
.tool-button small { font-size: 12px; font-weight: 500; margin-left: 3px; }

/* Explanation */
.answer-status { margin: -4px 0 8px; color: #667386; font-size: 13px; font-weight: 700; }
.word-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 13px; }
.word-row .learning-word { margin: 0 0 14px; color: #223d64; font: 700 46px/1.2 Georgia, serif; }
.pronounce-button { border: 1px solid #b8dbd2; background: #eaf5f0; color: #287664; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 800; }
.pronounce-button:hover:not(:disabled) { background: #dcf0e8; }
.meaning-primary { background: #fff1d9; border-radius: 11px; padding: 12px 16px; margin-bottom: 14px; }
.meaning-primary small { display: block; color: #80684a; font-size: 11px; margin-bottom: 3px; }
.meaning-primary strong { font-size: 20px; line-height: 1.4; }
.familiar { margin: -3px 0 17px; color: #69778c; font-size: 13px; }
.learning-example { padding: 13px 17px; background: #f1f4f3; border-left: 4px solid #58af9c; border-radius: 0 10px 10px 0; }
.learning-example p { margin: 2px 0; font: 18px/1.55 Georgia, serif; }
.example-audio-button { margin: 9px 0 3px; }
.learning-example .translation { margin-top: 7px; color: #56657a; font: 14px/1.6 'DM Sans', 'Noto Sans TC', sans-serif; }
.why, .more-why p { margin: 13px 0 0; color: #34455d; font-size: 14px; line-height: 1.7; }
.more-why { margin: 13px 0 0; color: #48617b; font-size: 13px; }
.more-why summary { cursor: pointer; width: fit-content; font-weight: 700; }
.source-link { display: inline-block; margin-top: 13px; color: #8d6035; font-size: 12px; }
.continue-button { display: block; margin: 23px 0 0 auto; }
.review-feedback { margin-top: 16px; padding: 12px 15px; border-radius: 10px; font-size: 14px; line-height: 1.65; }
.review-feedback.good { background: #e0f3e8; color: #205d49; }
.review-feedback.bad { background: #fff0e6; color: #884630; }

/* Result */
.result-screen { max-width: 650px; margin: 0 auto; padding: 55px 0 70px; text-align: center; }
.result-screen h2 { margin: 0; font-size: 38px; }
.result-screen > p { margin: 7px 0 20px; color: #bdccde; }
.result-score { color: var(--gold); display: flex; justify-content: center; align-items: baseline; gap: 4px; line-height: 1; }
.result-score strong { font-size: 70px; letter-spacing: -.05em; }
.result-score span { font-weight: 800; }
.result-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 24px 0; }
.result-stats div { padding: 12px; border: 1px solid #ffffff30; border-radius: 10px; background: #ffffff0d; }
.result-stats b { display: block; color: #fff; font-size: 21px; }
.result-stats span { color: #b6c5d9; font-size: 12px; }
.loot-list { margin: 23px 0; padding: 18px 22px; background: var(--paper); color: var(--ink); border-radius: 15px; text-align: left; }
.loot-list h3 { margin: 0 0 7px; font-size: 15px; }
.loot-item { display: grid; grid-template-columns: 105px minmax(0, 1fr) auto; gap: 10px; align-items: center; border-top: 1px solid #e6e9e9; padding: 10px 0; font-size: 14px; }
.loot-item span:first-child { font: 700 18px Georgia, serif; overflow-wrap: anywhere; }
.loot-item small { color: #5a697d; }
.loot-item .mastered { color: #237458; font-weight: 800; }
.loot-item .revisit { color: #976033; font-weight: 800; }
.result-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.site-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 7px 22px; padding: 22px 0 28px; border-top: 1px solid #ffffff22; color: #a9bbd0; font-size: 12px; }
.site-footer a { color: #e6c990; text-underline-offset: 3px; }

@media (max-width: 720px) {
  .start-screen { padding: 32px 0 34px; }
  .home-intro h1 { font-size: 56px; margin-bottom: 24px; }
  .home-grid { grid-template-columns: 1fr; gap: 12px; }
  .daily-card { min-height: 280px; }
  .mode-stack { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: 1fr; gap: 12px; }
  .mode-card { min-height: 118px; }
  .site-footer { display: block; }
  .site-footer span { display: block; }
  .site-footer span + span { margin-top: 5px; }
}
@media (max-width: 600px) {
  .shell { padding: 0 17px; }
  .site-header { height: 66px; }
  .brand { font-size: 18px; }
  .brand-icon { width: 31px; height: 31px; font-size: 21px; }
  .sound { font-size: 12px; }
  .start-screen { padding-top: 28px; }
  .home-intro h1 { font-size: clamp(42px, 11vw, 53px); margin-bottom: 22px; }
  .daily-card { min-height: 255px; padding: 20px; }
  .daily-card-top strong { font-size: 24px; }
  .daily-preview-word { margin-top: 23px; font-size: 33px; }
  .daily-preview-sentence { font-size: 18px; }
  .mode-card { min-height: 104px; padding: 13px; border-radius: 15px; }
  .mode-card > span:first-child { font-size: 19px; }
  .mode-card strong { font-size: 17px; margin-top: 8px; }
  .mode-arrow { right: 13px; top: 10px; font-size: 18px; }
  .game-screen { padding-top: 14px; }
  .hud { margin-bottom: 16px; }
  .level-line h2 { font-size: 23px; }
  .progress-track { margin: 15px 0 18px; }
  .game-card { min-height: 0; padding: 21px 18px; border-radius: 15px; }
  .game-card h3 { font-size: 22px; }
  .sentence { padding: 13px 14px; font-size: 20px; }
  .choices { grid-template-columns: 1fr; gap: 8px; }
  .choice { min-height: 53px; padding: 8px 12px; }
  .word-row .learning-word { font-size: 39px; }
  .loot-item { grid-template-columns: minmax(70px, .8fr) minmax(0, 1.2fr); }
  .loot-item span:last-child { grid-column: 2; }
  .result-screen { padding-top: 40px; }
  .result-screen h2 { font-size: 33px; }
  .result-score strong { font-size: 59px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
