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

:root {
  --ink: #182328;
  --muted: #66747a;
  --paper: #f4f0e8;
  --panel: #fffdf8;
  --line: #d8d2c5;
  --red: #d94a3d;
  --red-deep: #a92f2a;
  --teal: #167c78;
  --gold: #e1a33d;
  --shadow: 0 18px 50px rgba(24, 35, 40, .11);
}

* { box-sizing: border-box; }
html, body, .question-list { scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar, .question-list::-webkit-scrollbar { display: none; }
body { max-width: 100%; margin: 0; overflow-x: hidden; color: var(--ink); background: var(--paper); font-family: 'Noto Sans TC', sans-serif; }
body:has(.home-view) { background: linear-gradient(rgba(244, 240, 232, .42), rgba(244, 240, 232, .42)), url('../assets/background/p1.jpg') center / cover fixed; }
html:has(.home-view), body:has(.home-view) { overflow: hidden; }
body:has(.home-view) .site-footer { position: fixed; inset: auto 0 0; background: rgba(244, 240, 232, .9); backdrop-filter: blur(10px); z-index: 3; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(22, 124, 120, .35); outline-offset: 3px; }

body::before { content: ''; position: fixed; inset: 0; pointer-events: none; opacity: .28; background-image: radial-gradient(#c8c0b0 .7px, transparent .7px); background-size: 13px 13px; }
.site-header { height: 76px; display: flex; align-items: center; padding: 0 clamp(20px, 5vw, 72px); border-bottom: 1px solid var(--line); background: rgba(244, 240, 232, .88); backdrop-filter: blur(12px); position: relative; z-index: 2; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; color: white; background: var(--red); font: 500 12px 'DM Mono', monospace; transform: rotate(-8deg); }
.brand-logo { display: block; width: 42px; height: 42px; object-fit: contain; }
.brand strong, .brand small { display: block; line-height: 1.1; }
.brand strong { font-size: 15px; letter-spacing: .08em; }
.brand small { margin-top: 4px; color: var(--muted); font: 10px 'DM Mono', monospace; letter-spacing: .08em; }
.header-tools { display: flex; align-items: center; gap: 14px; }
.status-chip { color: var(--teal); font: 11px 'DM Mono', monospace; letter-spacing: .04em; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); color: var(--ink); background: var(--panel); font-size: 22px; }

.app-shell { width: min(1120px, calc(100% - 40px)); min-height: calc(100vh - 137px); margin: 0 auto; padding: clamp(34px, 6vw, 72px) 0 80px; position: relative; z-index: 1; }
.view { animation: rise .45s ease both; }
.view.no-enter-animation { animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.eyebrow { margin: 0 0 14px; color: var(--red-deep); font: 500 12px 'DM Mono', monospace; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 650px; margin-bottom: 22px; font-size: clamp(38px, 6vw, 76px); line-height: .98; letter-spacing: -.045em; }
h2 { font-size: clamp(26px, 4vw, 42px); line-height: 1.08; letter-spacing: -.03em; }
.lede { max-width: 560px; color: var(--muted); line-height: 1.8; }
.section-label { margin: 0 0 14px; color: var(--muted); font: 11px 'DM Mono', monospace; letter-spacing: .08em; text-transform: uppercase; }

.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(30px, 8vw, 110px); align-items: end; margin-bottom: 60px; }
.hero-art { min-height: 315px; padding: 26px; display: flex; align-items: flex-end; position: relative; overflow: hidden; background: var(--ink); color: white; box-shadow: var(--shadow); }
.hero-art::before { content: ''; position: absolute; width: 330px; height: 330px; right: -80px; top: -65px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; box-shadow: 0 0 0 30px rgba(255,255,255,.04), 0 0 0 60px rgba(255,255,255,.04); }
.hero-art::after { content: '01'; position: absolute; right: 26px; bottom: 20px; color: var(--gold); font: 76px 'DM Mono', monospace; opacity: .8; }
.hero-art p { max-width: 220px; margin: 0; position: relative; z-index: 1; font-weight: 700; line-height: 1.5; }
.button-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.primary-button, .secondary-button { min-height: 48px; padding: 0 22px; border: 1px solid var(--ink); font-weight: 700; }
.primary-button { color: white; background: var(--red); border-color: var(--red); }
.primary-button:hover { background: var(--red-deep); }
.secondary-button { color: var(--ink); background: transparent; }
.secondary-button:hover { background: var(--panel); }

.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mode-card { min-height: 180px; padding: 22px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); background: var(--panel); text-align: left; transition: transform .2s, border-color .2s; }
.mode-card:hover { transform: translateY(-4px); border-color: var(--red); }
.mode-card b { font-size: 18px; }
.mode-card span { color: var(--muted); font-size: 13px; line-height: 1.6; }
.mode-number { color: var(--red); font: 12px 'DM Mono', monospace; }

.panel { padding: clamp(22px, 4vw, 40px); border: 1px solid var(--line); background: rgba(255,253,248,.88); box-shadow: var(--shadow); }
.panel-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 28px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.field label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 700; }
select, input[type='number'] { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--line); color: var(--ink); background: var(--paper); }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.check-item { display: flex; gap: 8px; align-items: center; padding: 11px 12px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); font-size: 13px; }
.check-item:has(input:checked) { color: var(--ink); border-color: var(--teal); background: #e7f2ef; }
.question-list { display: grid; gap: 8px; }
.specific-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; margin-bottom: 18px; }
.specific-filter-button { width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); color: var(--muted); background: rgba(255, 253, 248, .9); box-shadow: 0 2px 0 rgba(24, 35, 40, .08); font-size: 13px; white-space: nowrap; transition: color .2s, background .2s, border-color .2s, box-shadow .2s; }
.specific-filter-button:hover { color: var(--ink); border-color: var(--teal); background: var(--panel); }
.specific-filter-button.is-active { color: white; border-color: var(--ink); background: var(--ink); box-shadow: 0 3px 0 var(--gold); }
.question-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.question-row:hover { border-color: var(--teal); background: #e7f2ef; transform: translateX(3px); }
.question-row small { color: var(--muted); }
.question-row .played { color: var(--teal); font-size: 12px; }

.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 26px; }
.progress-track { height: 6px; margin-top: 12px; background: var(--line); }
.progress-bar { height: 100%; background: var(--red); transition: width .3s ease; }
.prompt-panel { margin-bottom: 18px; }
.prompt-panel h2 { margin-bottom: 12px; }
.question-id { display: block; margin-bottom: 8px; color: var(--red); font: 12px 'DM Mono', monospace; letter-spacing: .08em; }
.question-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.favorite-button { padding: 0 4px; border: 0; color: var(--muted); background: transparent; font-size: 28px; line-height: 1; }
.favorite-button:hover, .favorite-button.is-favorite { color: var(--gold); }
.prompt-tag { display: inline-block; padding: 5px 8px; color: var(--teal); background: #e7f2ef; font: 11px 'DM Mono', monospace; }
.audio-player { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 20px 0; padding: 18px; border: 1px solid var(--line); background: var(--paper); }
.audio-status { margin: 0; color: var(--muted); font-size: 14px; font-weight: 700; }
.audio-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.audio-controls .primary-button, .audio-controls .secondary-button { min-height: 40px; padding-inline: 16px; }
.audio-controls .primary-button:disabled { cursor: wait; opacity: .42; }
.visual-placeholder { min-height: 145px; display: grid; place-items: center; margin: 20px 0; color: white; background: linear-gradient(135deg, var(--ink) 0 48%, var(--red) 48% 70%, var(--gold) 70%); font: 18px 'DM Mono', monospace; letter-spacing: .08em; }
.question-visual { margin: 20px 0; border: 1px solid var(--line); background: var(--paper); }
.question-visual img { width: 100%; max-height: 430px; display: block; object-fit: contain; }
.question-visual figcaption { padding: 8px 12px; color: var(--muted); font: 10px 'DM Mono', monospace; letter-spacing: .05em; }
.question-visual.media-error { min-height: 145px; display: grid; place-items: center; color: var(--red-deep); background: #fbe4df; }
.question-visual.media-error img { display: none; }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.option { min-height: 64px; padding: 15px 18px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); background: var(--panel); text-align: left; color: var(--ink); }
.option:hover:not(:disabled) { border-color: var(--teal); transform: translateX(3px); }
.option-index { display: grid; place-items: center; flex: 0 0 28px; height: 28px; color: white; background: var(--ink); font: 12px 'DM Mono', monospace; }
.option.correct { border-color: var(--teal); background: #dff1ed; }
.option.wrong { border-color: var(--red); background: #fbe4df; }
.option:disabled { cursor: default; }
.feedback { min-height: 26px; margin: 18px 0 0; font-weight: 700; }
.feedback.good { color: var(--teal); }
.feedback.bad { color: var(--red-deep); }

.result-score { display: flex; align-items: baseline; gap: 10px; margin: 20px 0 35px; }
.result-score strong { color: var(--red); font: 900 clamp(70px, 12vw, 130px) 'DM Mono', monospace; line-height: .8; }
.result-score span { color: var(--muted); }
.stat-strip { display: grid; grid-template-columns: repeat(2, 1fr); margin: 30px 0; border-block: 1px solid var(--line); }
.stat { padding: 18px 0; }
.stat + .stat { padding-left: 20px; border-left: 1px solid var(--line); }
.stat strong, .stat small { display: block; }
.stat strong { font: 24px 'DM Mono', monospace; }
.stat small { margin-top: 5px; color: var(--muted); }
.result-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.result-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 13px 14px; border: 1px solid var(--line); background: var(--paper); }
.result-number { min-width: 0; color: var(--red); font: 12px 'DM Mono', monospace; overflow-wrap: anywhere; }
.result-question strong, .result-question small { display: block; }
.result-question strong { line-height: 1.5; }
.result-question small { margin-top: 3px; color: var(--muted); }
.result-status { font: 22px 'DM Mono', monospace; }
.result-status.good { color: var(--teal); }
.result-status.bad { color: var(--red-deep); }
.result-status.skipped { color: var(--muted); }
.empty { padding: 25px; color: var(--muted); border: 1px dashed var(--line); }
.confirmation-dialog { width: min(440px, calc(100% - 40px)); padding: clamp(24px, 5vw, 36px); border: 1px solid var(--line); color: var(--ink); background: var(--panel); box-shadow: var(--shadow); }
.confirmation-dialog::backdrop { background: rgba(24, 35, 40, .52); backdrop-filter: blur(3px); }
.confirmation-dialog__marker { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 20px; color: white; background: var(--red); font: 500 22px 'DM Mono', monospace; transform: rotate(-8deg); }
.confirmation-dialog h2 { margin-bottom: 14px; font-size: clamp(27px, 6vw, 36px); }
.confirmation-dialog p:not(.eyebrow) { margin-bottom: 0; color: var(--muted); line-height: 1.7; }
.confirmation-dialog__actions { justify-content: flex-end; margin-top: 30px; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px clamp(20px, 5vw, 72px); color: var(--muted); font: 10px 'DM Mono', monospace; letter-spacing: .04em; border-top: 1px solid var(--line); position: relative; z-index: 1; }
.copyright-notice { flex: 1; text-align: center; font: inherit; }
.footer-actions { display: inline-flex; align-items: center; gap: 14px; }
.footer-report { padding: 0; border: 0; color: var(--muted); background: transparent; font: inherit; text-decoration: underline; text-underline-offset: 3px; }
.footer-report:hover { color: var(--red-deep); }
.footer-reset { display: none; padding: 0; border: 0; color: var(--muted); background: transparent; font: inherit; text-decoration: underline; text-underline-offset: 3px; }
body:has(.home-view) .footer-reset { display: inline; }
.footer-reset:hover { color: var(--red-deep); }

.home-view { min-height: calc(100vh - 217px); display: flex; align-items: center; justify-content: center; }
.home-content { width: min(100%, 760px); min-width: 0; text-align: center; }
.home-content .eyebrow { margin-bottom: 20px; }
.home-title-row { width: 100%; display: flex; align-items: center; justify-content: center; gap: clamp(10px, 2vw, 24px); overflow: visible; white-space: nowrap; }
.home-content h1 { flex: 0 0 auto; max-width: none; margin: 0; font-size: clamp(42px, 7vw, 76px); letter-spacing: .03em; white-space: nowrap; }
.home-subtitle { margin: 14px 0 24px; color: var(--muted); font: 11px 'DM Mono', monospace; letter-spacing: .14em; }
.home-intro { max-width: 430px; margin: 18px auto 0; padding: 13px 18px; border: 1px solid rgba(255,255,255,.9); color: var(--ink); background: rgba(255,253,248,.92); box-shadow: 0 5px 16px rgba(35, 31, 28, .16); font-size: 14px; font-weight: 700; line-height: 1.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-menu { display: grid; gap: 10px; margin-top: 34px; }
.home-menu-item { width: 100%; min-height: 76px; display: grid; grid-template-columns: 1fr 26px; align-items: center; gap: 14px; padding: 12px 20px; border: 2px solid rgba(255,255,255,.92); color: var(--ink); background: rgba(255, 253, 248, .94); box-shadow: 0 5px 16px rgba(35, 31, 28, .18); text-align: left; transition: color .2s, background .2s, transform .2s, border-color .2s, box-shadow .2s; }
.home-menu-item:hover { transform: translateX(6px); border-color: var(--red); color: white; background: var(--red); box-shadow: 0 7px 18px rgba(127, 30, 34, .3); }
.home-menu-item b, .home-menu-item small { display: block; }
.home-menu-item b { font-size: 18px; }
.home-menu-item small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.home-menu-item:hover small { color: rgba(255,255,255,.82); }
.menu-arrow { font-size: 20px; text-align: right; }
.home-decor { width: 150px; height: 180px; flex: 0 0 150px; position: relative; padding: 0; border: 0; color: inherit; background: transparent; cursor: pointer; transform: none; opacity: .92; }
.home-decor img { width: 100%; height: 100%; display: block; object-fit: contain; }
.home-decor:hover { opacity: 1; }
.home-decor-right { transform: none; }
.decor-face { width: 106px; height: 106px; display: flex; justify-content: center; align-items: center; gap: 25px; position: absolute; left: 8px; top: 30px; border: 3px solid var(--ink); border-radius: 48% 52% 45% 55%; background: #f6c6a8; box-shadow: 7px 9px 0 var(--gold); }
.decor-face i { width: 8px; height: 13px; display: block; border-radius: 50%; background: var(--ink); }
.decor-face b { position: absolute; left: 43px; top: 58px; font-size: 19px; font-weight: 500; }
.decor-ear { width: 35px; height: 58px; position: absolute; top: 0; border: 3px solid var(--ink); border-radius: 70% 30% 60% 40%; background: var(--red); }
.decor-ear-left { left: 12px; transform: rotate(-18deg); }
.decor-ear-right { right: 10px; transform: scaleX(-1) rotate(-18deg); }
.decor-ribbon { position: absolute; right: -10px; bottom: 0; padding: 5px 8px; color: white; background: var(--teal); font: 11px 'DM Mono', monospace; transform: rotate(-7deg); }
.decor-star { position: absolute; top: 0; right: 5px; color: var(--gold); font-size: 30px; }
.decor-tail { width: 32px; height: 95px; position: absolute; top: 24px; left: 1px; border: 12px solid var(--teal); border-right: 0; border-bottom: 0; border-radius: 80% 0 0 0; transform: rotate(-25deg); }

@media (max-width: 760px) { .hero, .mode-grid, .form-grid { grid-template-columns: 1fr; } .hero { gap: 28px; margin-bottom: 38px; } .hero-art { min-height: 210px; } .options-grid, .check-grid { grid-template-columns: 1fr; } .panel-heading, .quiz-top { align-items: flex-start; flex-direction: column; } .audio-player { align-items: flex-start; flex-direction: column; } .stat-strip { grid-template-columns: 1fr 1fr; } .site-footer { align-items: flex-start; flex-wrap: wrap; } h1 { font-size: clamp(42px, 14vw, 68px); } .home-view { min-height: auto; padding: 22px 0 40px; } .home-title-row { justify-content: center; gap: 8px; } .home-content h1 { font-size: clamp(20px, 8vw, 52px); } .home-decor { width: clamp(48px, 17vw, 96px); height: clamp(72px, 22vw, 120px); flex: 0 0 clamp(48px, 17vw, 96px); } .home-intro { max-width: 290px; } }
