.study-game { --accent: #b32759; --accent-soft: #fce2ed; font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif; font-weight: 500; line-height: 1.6; }
.study-game[data-subject="english"] { --accent: #304fdb; --accent-soft: #e5ebff; }
#app.study-app { width: min(100%, 1080px); height: 100dvh; max-height: none; top: 0; overflow-y: auto; overflow-x: hidden; scrollbar-color: var(--accent) var(--paper); scrollbar-width: thin; overscroll-behavior-y: contain; }
.study-screen[hidden], .study-passage[hidden], .study-game [hidden] { display: none !important; }
.study-screen { padding: 0 clamp(14px, 3vw, 28px); }
.study-game :is(button, select, input, summary, a) { touch-action: manipulation; }
.study-game button, .study-game button *, .study-length label, .study-length label * { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.study-game :is(button, a, select, input, summary):focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.study-game h1[tabindex="-1"]:focus { outline: none; }
.study-game ::selection { color: #fff; background: var(--accent); }
.study-game p, .study-question { margin-block: 0; }
.study-game button { min-height: 48px; border: 2px solid var(--ink); border-radius: 14px; font-weight: 800; transition: transform .12s ease-out, background .12s ease-out; }
.study-game button:disabled { cursor: default; }
.study-topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
.study-back { min-height: 44px; display: flex; align-items: center; font-size: 14px; font-weight: 700; }
.study-game a { color: var(--ink); text-underline-offset: 4px; }
.study-sound { flex: none; display: grid; place-items: center; width: 48px; padding: 10px; background: #fff; }
.study-sound svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.study-sound .sound-off, .study-sound[aria-pressed="true"] .sound-waves { display: none; }
.study-sound[aria-pressed="true"] .sound-off { display: block; }
.study-home-content { min-height: calc(100dvh - 210px); display: grid; grid-template-columns: 1fr 1.15fr; align-items: center; gap: clamp(24px, 5vw, 64px); padding-block: 28px; }
.study-intro { text-align: center; }
.study-intro h1 { margin: 0 0 14px; font-family: var(--chunky); font-size: clamp(42px, 5vw, 66px); font-weight: 900; line-height: 1.2; color: var(--accent); letter-spacing: .01em; }
.study-intro > p { font-size: 18px; }
.study-title-mascot { height: 174px; margin: 10px auto 0; }
#study-actor { width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.study-intro .study-bank-note { font-size: 14px; }
.study-settings { min-width: 0; }
.study-selects { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.study-selects label { min-width: 0; display: grid; gap: 5px; font-size: 15px; font-weight: 800; }
.study-selects select { width: 100%; min-width: 0; min-height: 50px; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-size: 16px; }
.study-length { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 0; margin: 20px 0 6px; border: 0; }
.study-length legend { margin-bottom: 2px; font-size: 15px; font-weight: 800; }
.study-length label { display: flex; align-items: center; min-height: 44px; gap: 8px; cursor: pointer; font-size: 15px; }
.study-length input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.study-pool { min-height: 26px; margin-bottom: 12px !important; font-size: 14px; }
.study-primary { background: var(--accent); color: #fff; padding: 12px 18px; box-shadow: 0 4px 0 var(--ink); font-size: 21px; }
.study-secondary { background: #fff; padding: 9px 14px; font-size: 15px; }
.study-settings > button { width: 100%; margin-bottom: 12px; }
.study-secondary:disabled { border-color: #8b7b9b; color: #665475; background: #f5edf3; }
.study-how, .study-record, .study-storage { font-size: 14px; }
.study-settings .study-how { margin-top: 14px; }
.study-storage { margin-top: 10px !important; color: #863041; }
.study-credit { padding: 18px 20px calc(14px + env(safe-area-inset-bottom)); text-align: center; font-size: 12px; line-height: 1.6; }
.study-credit a { display: inline-flex; min-height: 44px; align-items: center; }
.study-hud { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; min-height: 76px; padding: calc(10px + env(safe-area-inset-top)) 0 10px; background: var(--paper); border-bottom: 2px solid var(--ink); }
.study-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; align-items: center; font-size: 14px; font-variant-numeric: tabular-nums; }
.study-progress > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.study-progress strong { white-space: nowrap; }
.study-progress progress { grid-column: 1 / -1; width: 100%; height: 9px; border: 0; border-radius: 8px; accent-color: var(--accent); overflow: hidden; background: var(--accent-soft); }
.study-progress progress::-webkit-progress-bar { background: var(--accent-soft); }
.study-progress progress::-webkit-progress-value { background: var(--accent); }
.study-progress progress::-moz-progress-bar { background: var(--accent); }
.study-energy { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 92px; }
.study-energy > div:first-child { display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 14px; font-variant-numeric: tabular-nums; }
.study-energy b { color: var(--accent); font-size: 20px; margin-left: 4px; }
.study-energy small { font-size: 12px; }
.study-stage { margin-bottom: 18px; border-bottom: 1px solid #a597a0; padding-bottom: 8px; }
.study-stage-copy { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 800; }
.study-stage-track { height: 8px; margin-block: 6px; background: #e2d9e4; border-radius: 8px; overflow: hidden; }
#stage-fill { height: 100%; background: var(--accent); transform-origin: left; transition: transform .3s ease-out, background .3s ease-out; }
.study-game[data-stage="2"] #stage-fill { background: #b32759; }
.study-game[data-stage="3"] #stage-fill { background: #126447; }
#reward-feedback { min-height: 24px; font-size: 13px; font-weight: 800; color: #126447; }
.study-goals { margin: 10px 0 20px; padding: 16px 20px; background: #fff5d5; border: 2px solid var(--ink); border-radius: 16px; }
.study-goals h2, .study-collection h2 { margin: 0 0 8px; font-size: 18px; }
.study-goals ul { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 0; margin: 0; list-style: none; font-size: 15px; }
#quest-record, .study-collection > p { font-size: 13px; margin-top: 8px; }
.is-earned { color: #126447; font-weight: 800; }
.study-collection { margin-bottom: 10px; padding-bottom: 16px; border-bottom: 2px solid var(--ink); }
.study-collection summary { display: list-item; min-height: 48px; padding-block: 10px; font-weight: 800; cursor: pointer; }
#learning-stars { padding-block: 8px 16px; font-size: 14px; }
#reward-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 20px; padding: 0; margin: 12px 0 18px; list-style: none; font-size: 13px; }
.study-look { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.study-growth { color: #126447; font-size: 15px; font-weight: 800; }
.study-quiet *, .study-quiet *::before, .study-quiet *::after { animation: none !important; transition: none !important; }
.study-play-mascot { flex: none; width: 100px; height: 84px; }
.study-question-layout { padding: 0 0 16px; }
.study-question-layout.has-passage { display: grid; grid-template-columns: 1fr 1.05fr; align-items: start; gap: 28px; }
.study-passage { min-width: 0; padding: 16px 18px; background: var(--accent-soft); border-radius: 16px; }
.study-passage summary { cursor: pointer; min-height: 44px; font-size: 13px; }
.study-passage summary strong { display: block; font-size: 18px; font-weight: 800; overflow-wrap: anywhere; }
.study-passage p { max-width: 70ch; margin-top: 12px; font-size: 18px; line-height: 1.75; white-space: pre-line; user-select: text; -webkit-user-select: text; overflow-wrap: anywhere; }
.study-question-panel { min-width: 0; }
.study-question { margin: 8px 0 22px; font-size: clamp(22px, 2.7vw, 28px); font-weight: 800; line-height: 1.65; white-space: pre-line; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.study-question:lang(en) { font-size: clamp(21px, 2.3vw, 26px); line-height: 1.55; }
.study-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.has-passage .study-choices, .study-choices.long-choices { grid-template-columns: 1fr; }
.study-option { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 10px; min-width: 0; min-height: 66px !important; padding: 12px 14px; background: #fff; box-shadow: 0 3px 0 var(--ink); text-align: left; font-size: 18px; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.study-option:nth-child(4n+1) { background: #fce7f0; }
.study-option:nth-child(4n+2) { background: #e6edff; }
.study-option:nth-child(4n+3) { background: #fff5cd; }
.study-option:nth-child(4n) { background: #e2f8ee; }
.study-option-key { display: grid; place-items: center; width: 28px; height: 28px; font-family: var(--chunky); font-size: 16px; }
.study-option.is-wrong { background: #eee5f7; color: #684080; border-style: dashed; box-shadow: none; }
.study-option.is-correct { background: #bdf3d9; border-color: #126447; }
.study-feedback { min-height: 28px; margin: 14px 0 4px !important; font-size: 15px; color: #763579; font-weight: 800; }
.study-feedback.good { color: #126447; }
.study-keyboard { font-size: 12px; }
.study-result { width: min(100%, 680px); min-height: calc(100dvh - 135px); margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: calc(24px + env(safe-area-inset-top)); text-align: center; gap: 12px; }
.study-result h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.3; margin: 0; }
.study-rank { color: var(--accent); font-family: var(--chunky); font-size: 100px; line-height: 1.15; text-shadow: 0 4px var(--ink); }
.study-stats { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); margin: 14px 0; padding-block: 16px; border-block: 2px solid var(--ink); gap: 12px; font-variant-numeric: tabular-nums; }
.study-stats dt { font-size: 13px; }
.study-stats dd { margin: 4px 0 0; font-size: 24px; font-weight: 900; }
.study-result-actions { width: min(100%, 440px); display: flex; flex-wrap: wrap; gap: 12px; }
.study-result-actions .study-primary { flex: 1 0 100%; }
.study-result-actions .study-secondary { flex: 1; }
.study-loading { padding: 24px; line-height: 2; }
@media (hover: hover) { .study-game button:hover:not(:disabled) { transform: translateY(-2px); } .study-secondary:hover:not(:disabled) { background: var(--accent-soft); } }
.study-game button:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
@media (max-width: 760px) {
  #app.study-app { width: min(100%, 620px); }
  .study-home-content { min-height: 0; grid-template-columns: 1fr; gap: 16px; padding: 20px 0 6px; }
  .study-intro h1 { font-size: 46px; margin-bottom: 10px; }
  .study-intro > p { font-size: 16px; }
  .study-title-mascot { height: 92px; margin-top: 0; }
  .study-intro .study-bank-note { font-size: 13px; }
  .study-settings { width: min(100%, 460px); margin-inline: auto; }
  .study-question-layout.has-passage { grid-template-columns: 1fr; gap: 20px; }
  .study-hud { gap: 10px; }
  .study-progress { grid-template-columns: 1fr; text-align: center; font-size: 12px; }
  .study-progress progress { grid-column: 1; }
  .study-energy > div:first-child { gap: 4px 14px; }
  .study-question { margin-bottom: 18px; }
  .study-stats { grid-template-columns: repeat(2, 1fr); }
  #reward-list { grid-template-columns: 1fr; }
  .study-goals { padding: 14px; }
  .study-goals ul { display: grid; gap: 6px; }
}
@media (max-width: 420px) {
  .study-selects { grid-template-columns: 1fr; gap: 10px; }
  .study-length { gap: 4px 14px; margin-top: 14px; }
  .study-length label { font-size: 14px; }
  .study-option { min-height: 58px !important; padding: 10px; gap: 6px; font-size: 17px; }
  .study-energy { min-height: 82px; }
  .study-play-mascot { width: 76px; height: 72px; }
  .study-energy > div:first-child { gap: 3px 12px; font-size: 13px; }
  .study-energy b { font-size: 17px; }
  .study-question { font-size: 21px; }
  .study-passage { padding: 14px; }
}
@media (max-height: 500px) and (min-width: 761px) { .study-home-content { padding-block: 20px; } .study-title-mascot { height: 100px; } }
@media (prefers-reduced-motion: reduce) { .study-game *, .study-game *::before, .study-game *::after { animation: none !important; transition: none !important; } }
