/*
 * 文件路径：radical-game/style.css
 * 功能说明：定义偏旁侦探在桌面与手机上的独立视觉样式和答题状态。
 * 更新时间：2026-10-01（北京时间），补充音效开关在桌面和手机上的状态与布局。
 * 历史更新：2026-10-01，首次实现字卡、四选一、结算及图鉴布局。
 * 历史更新：2026-10-01，首次创建。
 */

:root {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #1a332f;
  background: #f8f6ec;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  --ink: #1a332f;
  --muted: #62716c;
  --green: #197969;
  --green-dark: #105c50;
  --line: #dfe7dc;
  --paper: #fffdf7;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible { outline: 3px solid #f4ab36; outline-offset: 4px; }

.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 95% 16%, #e9f3e5 0, #e9f3e500 26rem),
    radial-gradient(circle at 6% 88%, #fbebd7 0, #fbebd700 24rem),
    #f8f6ec;
}

.site-header, main, .site-footer { width: min(1120px, calc(100% - 56px)); margin-inline: auto; }
.site-header { min-height: 100px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 20px; font-weight: 800; letter-spacing: .03em; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 13px; color: #fffdf7; background: var(--green); font-size: 22px; font-family: KaiTi, STKaiti, serif; box-shadow: 0 5px 13px #19796934; }
.header-actions { display: flex; align-items: center; gap: 22px; }
.sound-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 37px; padding: 4px 10px; border: 1px solid #c8ded0; border-radius: 11px; background: #f2faf1; color: var(--green-dark); font-size: 13px; font-weight: 700; white-space: nowrap; }
.sound-toggle:hover { background: #e7f4e6; }
.sound-toggle[aria-pressed="false"] { border-color: #dde2d8; background: #f4f5ef; color: #69776d; }
.sound-toggle:disabled { opacity: .65; }
.sound-icon { font-size: 18px; line-height: 1; }
.header-link { border: 0; padding: 10px 0; background: transparent; color: var(--green-dark); font-size: 14px; font-weight: 700; }
.header-link:hover { text-decoration: underline; text-underline-offset: 5px; }
.header-link span { margin-left: 4px; }
main { flex: 1; display: grid; align-items: center; padding-block: 30px 60px; }

.start-screen { display: grid; grid-template-columns: 1.08fr .92fr; align-items: center; gap: min(9vw, 112px); min-height: 600px; }
.intro-copy { position: relative; z-index: 1; padding-bottom: 18px; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; color: var(--green); font-size: 13px; font-weight: 800; letter-spacing: .1em; }
.eyebrow-dot { width: 8px; height: 8px; border-radius: 50%; background: #e7a740; box-shadow: 0 0 0 5px #fbeed3; }
h1, h2, p { margin-top: 0; }
.start-screen h1 { margin: 24px 0 23px; font-size: clamp(38px, 4.3vw, 61px); line-height: 1.32; letter-spacing: -.035em; font-weight: 900; }
.start-screen h1 em { color: var(--green); font-style: normal; }
.intro-text { max-width: 475px; color: var(--muted); font-size: 17px; line-height: 1.9; }
.intro-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 18px 21px; margin-top: 34px; }
.small-note { color: #87918b; font-size: 13px; }
.primary-button, .secondary-button { min-height: 52px; border-radius: 16px; padding: 0 25px; font-weight: 800; transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease; }
.primary-button { border: 2px solid var(--green); color: white; background: var(--green); box-shadow: 0 9px 18px #19796925; }
.primary-button:hover { background: var(--green-dark); border-color: var(--green-dark); box-shadow: 0 12px 22px #19796930; transform: translateY(-2px); }
.primary-button span { margin-left: 20px; }
.secondary-button { border: 2px solid #c9ddd2; color: var(--green-dark); background: #f6fcf7; }
.secondary-button:hover { background: #eaf6ed; transform: translateY(-2px); }

.preview-card { position: relative; min-height: 475px; border: 2px solid #1a332f; border-radius: 27px; padding: 28px; background: #fffdf6; box-shadow: 15px 18px 0 #e4eee5, 20px 23px 0 #1a332f; transform: rotate(2deg); }
.preview-card::before { content: ""; position: absolute; top: 55px; right: -29px; width: 56px; height: 17px; border-radius: 0 8px 8px 0; background: #f2b74e; transform: rotate(10deg); z-index: -1; }
.preview-top, .question-card-top { display: flex; justify-content: space-between; color: #76817a; font-size: 13px; font-weight: 700; letter-spacing: .06em; }
.preview-radical { margin: 30px auto 8px; width: 170px; height: 170px; display: grid; place-items: center; border-radius: 40px; background: #e9f3e7; color: var(--green-dark); font-family: KaiTi, STKaiti, serif; font-size: 112px; line-height: 1; }
.preview-examples { text-align: center; font-family: KaiTi, STKaiti, serif; color: #2b3c36; font-size: 31px; }
.preview-examples span { padding-inline: 14px; color: #aab4a9; font-family: inherit; }
.preview-answer { display: flex; align-items: center; gap: 13px; margin-top: 39px; padding: 16px 20px; border: 2px solid #b8ddc7; border-radius: 14px; background: #edfaed; font-size: 19px; font-weight: 800; }
.answer-tick { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #25865e; color: white; font-size: 17px; }
.card-spark { position: absolute; color: #e7ac4b; }
.spark-one { left: -27px; top: 96px; font-size: 38px; }
.spark-two { right: -34px; bottom: 67px; font-size: 49px; }

.game-screen { width: 100%; }
.round-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.round-heading h1 { margin: 8px 0 0; font-size: clamp(32px, 3.4vw, 44px); letter-spacing: -.025em; }
.round-count { display: flex; align-items: baseline; gap: 7px; color: #86938c; white-space: nowrap; }
.round-count strong { color: var(--green); font-size: 40px; line-height: 1; }
.round-count span { font-size: 19px; font-weight: 700; }
#round-progress { display: block; width: 100%; height: 10px; margin-bottom: 26px; border: 0; border-radius: 20px; background: #dde8dc; overflow: hidden; }
#round-progress::-webkit-progress-bar { background: #dde8dc; border-radius: 20px; }
#round-progress::-webkit-progress-value { background: var(--green); border-radius: 20px; }
#round-progress::-moz-progress-bar { background: var(--green); border-radius: 20px; }
.play-layout { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(360px, 1fr); align-items: stretch; gap: 30px; }
.question-card { min-height: 480px; padding: 26px; border: 2px solid #d9e4d8; border-radius: 28px; background: var(--paper); box-shadow: 0 16px 32px #354b2811; display: flex; flex-direction: column; }
.card-index { color: var(--green); }
.question-radical { flex: 1; display: grid; place-items: center; padding: 20px; font-family: KaiTi, STKaiti, serif; font-size: clamp(108px, 12vw, 160px); color: var(--ink); line-height: 1.2; }
.example-area { border-top: 1px dashed #c9d8cd; padding-top: 21px; }
.example-caption { color: #77857b; font-size: 13px; font-weight: 700; }
.example-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.example-word { display: grid; place-items: center; min-width: 55px; height: 55px; padding-inline: 12px; border-radius: 12px; background: #eef6e9; color: var(--green-dark); font-family: KaiTi, STKaiti, serif; font-size: 29px; }
.answer-area { display: flex; flex-direction: column; min-width: 0; }
.answer-prompt { margin: 12px 0 20px; color: #63746b; font-size: 17px; font-weight: 700; }
.answer-options { display: grid; gap: 13px; }
.option-button { width: 100%; min-height: 75px; display: flex; align-items: center; gap: 18px; padding: 12px 20px; border: 2px solid #dce6d9; border-radius: 16px; background: #fffef9; color: var(--ink); text-align: left; box-shadow: 0 4px 0 #dce6d9; transition: transform .14s ease, border-color .14s ease, background-color .14s ease; }
.option-button:not(:disabled):hover { border-color: #7fbba2; background: #f4fbf2; transform: translateY(-2px); }
.option-number { flex: none; display: grid; place-items: center; width: 35px; height: 35px; border-radius: 10px; background: #eef3ec; color: var(--green-dark); font-size: 15px; font-weight: 800; }
.option-label { flex: 1; font-size: 20px; font-weight: 800; }
.option-symbol { font-size: 22px; font-weight: 900; }
.option-button.is-correct { border-color: #258665; background: #e9f8eb; box-shadow: 0 4px 0 #bbdec3; }
.option-button.is-correct .option-symbol { color: #258665; }
.option-button.is-incorrect { border-color: #d78677; background: #fff1ed; box-shadow: 0 4px 0 #eed2cb; }
.option-button.is-incorrect .option-symbol { color: #be604e; }
.keyboard-note { margin: 20px 0 0; color: #98a29a; font-size: 12px; }
.answer-feedback { margin-top: 20px; padding: 16px 18px; border-radius: 14px; font-size: 15px; line-height: 1.6; font-weight: 700; }
.answer-feedback[data-result="correct"] { background: #e7f5e9; color: #196347; }
.answer-feedback[data-result="incorrect"] { background: #fff1e9; color: #9b5345; }
.next-button { align-self: flex-end; margin-top: 18px; }

.result-screen { width: min(720px, 100%); margin-inline: auto; padding: 40px 32px 46px; border: 2px solid #e0e9da; border-radius: 28px; background: var(--paper); box-shadow: 0 16px 40px #273d2112; text-align: center; }
.result-icon { width: 74px; height: 74px; display: grid; place-items: center; margin: 0 auto 24px; border-radius: 24px; background: #fcedc5; color: #b77919; font-size: 42px; }
.result-screen h1 { margin: 12px 0 4px; font-size: clamp(29px, 4vw, 39px); }
.result-score { display: flex; align-items: baseline; justify-content: center; gap: 6px; margin: 12px 0 8px; color: var(--green); }
.result-score strong { font-size: 70px; line-height: 1.2; }
.result-score span { font-size: 18px; font-weight: 800; }
.result-message { color: var(--muted); line-height: 1.7; }
.mistake-panel { margin: 28px 0 30px; text-align: left; }
.mistake-panel h2 { margin-bottom: 13px; font-size: 17px; }
.mistake-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-height: 270px; overflow: auto; }
.mini-card { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 11px; border: 1px solid #e2eadf; border-radius: 13px; background: #fffef9; }
.mini-radical { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; background: #eaf5e9; color: var(--green-dark); font-family: KaiTi, STKaiti, serif; font-size: 32px; }
.mini-card strong, .mini-card small { display: block; }
.mini-card strong { font-size: 15px; }
.mini-card small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.site-footer { display: flex; justify-content: space-between; gap: 20px; padding-block: 25px 30px; border-top: 1px solid #e5e9dd; color: #8d978c; font-size: 12px; }
.gallery-dialog { width: min(860px, calc(100% - 28px)); max-height: min(84vh, 900px); padding: 0; border: 0; border-radius: 25px; color: var(--ink); background: var(--paper); box-shadow: 0 25px 70px #102f2c55; }
.gallery-dialog::backdrop { background: #17382e95; backdrop-filter: blur(3px); }
.gallery-content { padding: 27px; }
.gallery-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.gallery-header h2 { margin: 6px 0 0; font-size: 28px; }
.dialog-close { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 12px; background: #f6f8f3; color: var(--ink); font-size: 28px; line-height: 1; }
.dialog-close:hover { background: #eaf5ea; }
.gallery-desc { margin: 12px 0 22px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.gallery-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.gallery-grid .mini-card { gap: 9px; padding: 8px; }
.gallery-grid .mini-radical { width: 42px; height: 42px; font-size: 28px; }

@media (max-width: 860px) {
  .start-screen { grid-template-columns: 1fr .8fr; gap: 36px; min-height: 500px; }
  .start-screen h1 { font-size: clamp(35px, 5vw, 48px); }
  .preview-card { min-height: 415px; padding: 20px; }
  .preview-radical { width: 140px; height: 140px; font-size: 90px; }
  .preview-answer { margin-top: 31px; }
  .play-layout { grid-template-columns: .8fr 1fr; gap: 20px; }
  .question-card { min-height: 455px; }
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .site-header, main, .site-footer { width: min(100% - 34px, 520px); }
  .site-header { min-height: 73px; }
  .brand { font-size: 17px; }
  .brand-mark { width: 35px; height: 35px; font-size: 20px; }
  .header-actions { gap: 8px; }
  .sound-toggle { width: 36px; height: 36px; min-height: 36px; justify-content: center; padding: 0; }
  .sound-label { display: none; }
  .header-link { font-size: 12px; }
  main { padding-block: 26px 48px; align-items: start; }
  .start-screen { grid-template-columns: 1fr; gap: 44px; min-height: auto; }
  .start-screen h1 { margin: 17px 0; font-size: clamp(34px, 8vw, 45px); }
  .intro-text { font-size: 15px; }
  .intro-actions { margin-top: 25px; }
  .preview-card { width: min(340px, calc(100% - 28px)); min-height: 360px; margin: 0 auto; padding: 20px; box-shadow: 10px 12px 0 #e4eee5, 14px 16px 0 #1a332f; }
  .preview-radical { width: 124px; height: 124px; margin-top: 18px; font-size: 80px; }
  .preview-examples { font-size: 26px; }
  .preview-answer { margin-top: 21px; }
  .round-heading { margin-bottom: 15px; }
  .round-heading h1 { font-size: 29px; }
  .round-count strong { font-size: 30px; }
  .round-count span { font-size: 14px; }
  #round-progress { margin-bottom: 18px; }
  .play-layout { grid-template-columns: 1fr; gap: 17px; }
  .question-card { min-height: 238px; padding: 18px; border-radius: 22px; }
  .question-radical { font-size: 82px; padding: 10px; }
  .example-area { padding-top: 10px; }
  .example-list { margin-top: 7px; }
  .example-word { min-width: 43px; height: 43px; font-size: 23px; }
  .answer-prompt { margin: 0 0 13px; font-size: 15px; }
  .answer-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .option-button { min-height: 67px; gap: 9px; padding: 8px 10px; border-radius: 13px; }
  .option-number { width: 26px; height: 26px; border-radius: 8px; font-size: 12px; }
  .option-label { font-size: 16px; }
  .option-symbol { font-size: 17px; }
  .keyboard-note { margin-top: 13px; }
  .answer-feedback { margin-top: 13px; font-size: 14px; }
  .next-button { width: 100%; margin-top: 12px; }
  .result-screen { padding: 30px 16px 34px; }
  .mistake-list { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; gap: 6px; }
  .gallery-content { padding: 18px; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 370px) {
  .answer-options { grid-template-columns: 1fr; }
  .option-button { min-height: 57px; }
  .gallery-grid { grid-template-columns: 1fr; }
}

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