:root {
  color-scheme: light;
  --ink: #241b3a;
  --muted: #756b8c;
  --violet: #7c5cff;
  --violet-soft: #e7e1ff;
  --amber: #ffb020;
  font-family: "PingFang HK", "PingFang TC", "Heiti TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #e9e3ff, transparent 22rem),
    radial-gradient(circle at bottom right, #fff2d6, transparent 20rem),
    linear-gradient(160deg, #f8f6ff, #fdf3ff);
}
.wrap { width: min(560px, calc(100% - 24px)); margin: 0 auto; padding: 12px 0 40px; min-height: 100dvh; display: flex; flex-direction: column; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px 12px; }
.crumb { color: var(--muted); text-decoration: none; font-weight: 800; font-size: 14px; }
.crumb:hover { color: var(--violet); }
.treasure { font-weight: 900; font-size: 16px; background: #fff; border: 1px solid var(--violet-soft); border-radius: 999px; padding: 6px 14px; box-shadow: 0 6px 18px rgba(124,92,255,.15); }

.panel { background: rgba(255,255,255,.88); border: 1px solid rgba(36,27,58,.08); border-radius: 26px; box-shadow: 0 20px 60px rgba(60,40,120,.12); padding: 24px; }

.button {
  appearance: none; border: 1px solid rgba(36,27,58,.12); border-radius: 16px;
  padding: 12px 18px; font: inherit; font-weight: 800; cursor: pointer;
  background: #fff; color: var(--ink); transition: transform .15s ease, box-shadow .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(36,27,58,.14); }
.button.primary { background: var(--violet); border-color: transparent; color: #fff; box-shadow: 0 14px 30px rgba(124,92,255,.34); }
.button.big { font-size: 20px; padding: 16px 30px; border-radius: 20px; }
.button.ghost { background: rgba(255,255,255,.7); }
.button.subtle { background: transparent; border-color: transparent; color: var(--muted); text-decoration: underline; }

/* start / done */
.start, .done { text-align: center; }
.hero-emoji, .trophy { font-size: 64px; line-height: 1; }
.start h1 { margin: 12px 0 8px; font-size: clamp(30px, 8vw, 44px); letter-spacing: 2px; }
.lede { color: #5a4e70; font-size: 17px; line-height: 1.7; margin: 0 auto 20px; max-width: 30em; }
.pick-label { font-weight: 800; font-size: 16px; margin: 6px 0 12px; }
.fineprint { color: var(--muted); font-size: 13px; margin-top: 16px; }

/* setting picker */
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.setting-card.wide { grid-column: 1 / -1; }
.setting-card {
  appearance: none; cursor: pointer; text-align: center; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: #fff; border: 2px solid var(--violet-soft); border-radius: 20px;
  padding: 20px 12px; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.setting-card:hover, .setting-card.sel { transform: translateY(-2px); border-color: var(--violet); box-shadow: 0 14px 34px rgba(124,92,255,.22); }
.setting-emoji { font-size: 40px; line-height: 1; }
.setting-name { font-weight: 900; font-size: 18px; }
.setting-desc { color: var(--muted); font-size: 13px; }

/* game */
.game { display: flex; flex-direction: column; gap: 14px; }
.steps { text-align: center; font-weight: 800; color: var(--muted); font-size: 14px; letter-spacing: 1px; }
.picture-wrap { position: relative; border-radius: 20px; overflow: hidden; background: #fff; aspect-ratio: 4 / 3; box-shadow: inset 0 0 0 1px rgba(36,27,58,.06); }
.picture-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pass-flash { position: absolute; inset: 0; display: grid; place-content: center; font-size: 120px; color: #3ec96a; background: rgba(255,255,255,.55); text-shadow: 0 6px 24px rgba(0,0,0,.2); animation: pop .9s ease-out; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 30% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }

.scene { text-align: center; font-size: clamp(20px, 5.5vw, 26px); font-weight: 800; line-height: 1.6; letter-spacing: 1px; margin: 2px 0; }
.read-hint { text-align: center; color: var(--muted); font-size: 14px; font-weight: 700; margin: 2px 0; }

.options { display: flex; flex-direction: column; gap: 10px; }
.option-card {
  appearance: none; text-align: left; font: inherit; cursor: default;
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 2px solid var(--violet-soft); border-radius: 18px;
  padding: 14px 16px; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.option-card .option-tag {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-content: center; font-weight: 900; font-size: 18px;
  background: var(--violet-soft); color: var(--violet);
}
.option-card .option-text { font-weight: 800; font-size: clamp(17px, 4.6vw, 21px); line-height: 1.5; }
.option-card.chosen { border-color: #3ec96a; box-shadow: 0 12px 30px rgba(62,201,106,.25); transform: scale(1.02); }
.option-card.chosen .option-tag { background: #e5f9ec; color: #1c7a42; }

.coach-row { display: flex; justify-content: center; min-height: 28px; }
.coach-pill { background: #f1eeff; color: #4b3a86; border: 1px solid rgba(75,58,134,.18); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 14px; max-width: 100%; }
.coach-pill.you { background: #fff0f5; color: #9a3b63; border-color: rgba(255,111,156,.3); }
.coach-pill.win { background: #e5f9ec; color: #1c7a42; border-color: rgba(62,201,106,.4); }

.controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.tip { text-align: center; color: var(--muted); font-size: 14px; margin: 2px 0 0; }
/* finish button sits well below the hint so it can't be tapped by accident */
.end-row { display: flex; justify-content: center; margin-top: 22px; }

/* transition */
.transition { text-align: center; }
.book-spin { font-size: 64px; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
.transition h2 { margin: 14px 0 8px; font-size: 28px; letter-spacing: 2px; }
.transition-line { color: var(--muted); font-size: 15px; }
.dots { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--violet); opacity: .3; animation: blink 1.2s ease-in-out infinite; }
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }

/* done */
.done h2 { margin: 8px 0; font-size: 34px; }
.ending { font-size: 19px; line-height: 1.7; margin: 6px auto 16px; max-width: 30em; }
.retelling-wrap { text-align: left; background: #f6f3ff; border: 1px solid var(--violet-soft); border-radius: 18px; padding: 16px 18px; margin: 0 0 18px; }
.retelling-label { font-weight: 800; margin: 0 0 8px; }
.retelling { font-size: 16px; line-height: 1.8; margin: 0; color: #3d3357; }
.reward-line { font-size: 20px; margin: 4px 0; }
.reward-line strong { color: var(--violet); font-size: 26px; }
.reward-total { color: var(--muted); margin: 2px 0 20px; }
.back { display: inline-block; margin-top: 16px; color: var(--muted); text-decoration: none; font-weight: 800; }
.back:hover { color: var(--violet); }

@media (max-width: 480px) {
  .panel { padding: 18px; border-radius: 22px; }
}
