:root {
  color-scheme: light;
  --cream: #fbf7f0;
  --paper: #fffdf8;
  --surface: #ffffff;
  --surface-muted: #f5efe6;
  --ink: #2e2a26;
  --muted: #6b6157;
  --mint: #4fb7ab;
  --mint-deep: #28776f;
  --mint-soft: #d9f0ec;
  --coral: #ffa585;
  --coral-deep: #a94f3b;
  --coral-soft: #ffe6dc;
  --gold: #f4b860;
  --gold-deep: #7c561d;
  --gold-soft: #ffefd5;
  --line: #e8e0d5;
  --on-dark: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
}

:root[data-site-theme="dark"] {
  color-scheme: dark;
  --cream: #101714;
  --paper: #151e1b;
  --surface: #1b2723;
  --surface-muted: #24312c;
  --ink: #f7f1e8;
  --muted: #c3b9ad;
  --mint: #69d0c2;
  --mint-deep: #85e0d4;
  --mint-soft: #1a3b36;
  --coral: #ff9b7e;
  --coral-deep: #ffb199;
  --coral-soft: #482c27;
  --gold: #f3bd62;
  --gold-deep: #f6cc80;
  --gold-soft: #3e311e;
  --line: #33423d;
  --on-dark: #15201d;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 14%, color-mix(in srgb, var(--mint) 14%, transparent), transparent 26%),
    radial-gradient(circle at 90% 34%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 27%),
    var(--cream);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(color-mix(in srgb, var(--mint) 16%, transparent) .8px, transparent .8px);
  background-size: 18px 18px;
  content: "";
  pointer-events: none;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.skip-link {
  position: fixed;
  left: 18px;
  top: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-dark);
  font-weight: 850;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 180ms ease;
}

.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--mint) 68%, transparent);
  outline-offset: 4px;
}

.practice-header {
  width: min(1120px, calc(100% - 40px));
  min-height: 76px;
  margin: 14px auto 0;
  padding: 8px 10px 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid color-mix(in srgb, var(--surface) 72%, var(--line));
  border-radius: 25px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  box-shadow: 0 14px 38px rgba(46, 42, 38, .08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.practice-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.practice-brand img { width: 48px; height: 48px; border-radius: 14px; }
.practice-brand span { display: grid; line-height: 1.1; }
.practice-brand strong { font-size: 17px; font-weight: 950; }
.practice-brand small { margin-top: 4px; color: var(--mint-deep); font-size: 11px; font-weight: 850; letter-spacing: .08em; }

.practice-home-link {
  min-height: 48px;
  padding: 10px 17px;
  display: inline-flex;
  align-items: center;
  border-radius: 16px;
  background: var(--surface-muted);
  color: var(--mint-deep);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.practice-home-link:hover { background: var(--mint-soft); }

.practice-eyebrow {
  margin: 0 0 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mint-deep);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
}

.practice-eyebrow span { color: var(--gold); }

.lobby-main,
.trace-main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.lobby-main { padding: clamp(58px, 7vw, 92px) 0 78px; }

.lobby-intro,
.trace-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 36px;
}

.lobby-intro h1,
.trace-heading h1 {
  margin: 0;
  font-size: clamp(46px, 6vw, 76px);
  font-weight: 950;
  letter-spacing: -.055em;
  line-height: 1.08;
}

.lobby-intro > div:first-child > p:last-child,
.trace-heading > div:first-child > p:last-child {
  margin: 17px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 650;
}

.lobby-sticker {
  width: 142px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 42% 58% 47% 53% / 53% 43% 57% 47%;
  background: var(--gold);
  color: #3b2b12;
  transform: rotate(4deg);
}

.lobby-sticker strong { font-size: 46px; line-height: 1; }
.lobby-sticker span { font-size: 12px; font-weight: 900; line-height: 1.3; }

.room-path {
  position: relative;
  margin: clamp(48px, 7vw, 76px) 0 0;
  padding: clamp(28px, 4vw, 48px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(32px, 5vw, 64px);
  border-radius: 48px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  list-style: none;
}

.room-path::before {
  position: absolute;
  left: 50%;
  top: 48px;
  bottom: 48px;
  width: 1px;
  background: var(--line);
  content: "";
}

.room-stop { min-width: 0; }

.room-art {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 42% 58% 44% 56% / 50% 42% 58% 50%;
  background: var(--mint-soft);
  text-decoration: none;
}

.room-stop-gold .room-art {
  border-radius: 57% 43% 54% 46% / 43% 52% 48% 57%;
  background: var(--gold-soft);
}

.room-art img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 260ms ease;
}

.room-art:hover img { transform: scale(1.025); }

.room-art span {
  position: absolute;
  right: 9%;
  bottom: 8%;
  padding: 8px 13px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  color: var(--mint-deep);
  font-size: 12px;
  font-weight: 950;
  transform: rotate(-3deg);
}

.room-stop-gold .room-art span { color: var(--gold-deep); transform: rotate(3deg); }

.room-copy { padding: 26px 6px 4px; }
.room-number { margin: 0 0 8px; color: var(--mint-deep); font-size: 11px; font-weight: 950; letter-spacing: .14em; }
.room-stop-gold .room-number { color: var(--gold-deep); }

.room-copy h2 {
  margin: 0;
  font-size: clamp(31px, 3.6vw, 44px);
  font-weight: 950;
  letter-spacing: -.04em;
  line-height: 1.18;
}

.room-copy > p:not(.room-number) { margin: 13px 0 0; color: var(--muted); font-weight: 650; }

.room-copy ul {
  margin: 19px 0 22px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.room-copy li {
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint-deep);
  font-size: 12px;
  font-weight: 850;
}

.room-stop-gold .room-copy li { background: var(--gold-soft); color: var(--gold-deep); }

.room-enter {
  min-height: 52px;
  padding: 12px 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 17px;
  background: var(--mint-deep);
  color: var(--on-dark);
  font-weight: 900;
  text-decoration: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.room-enter-gold { background: var(--gold); color: #3b2b12; }
.room-enter:hover { opacity: .86; transform: translateY(-2px); }

.lobby-note {
  width: fit-content;
  margin: 28px auto 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint-deep);
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}

.lobby-note span { margin-right: 6px; }

.trace-main { padding: clamp(46px, 6vw, 76px) 0 68px; }

.trace-progress {
  min-width: 128px;
  padding: 15px 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 29px;
  background: var(--mint-soft);
  color: var(--mint-deep);
}

.trace-progress strong { font-size: 34px; line-height: 1; }
.trace-progress span { font-size: 11px; font-weight: 900; line-height: 1.3; }

.trace-layout {
  margin-top: clamp(36px, 5vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, .72fr);
  align-items: start;
  gap: clamp(24px, 4vw, 44px);
}

.trace-board-panel,
.symbol-shelf {
  min-width: 0;
  padding: clamp(20px, 3vw, 32px);
  border-radius: 38px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
}

.trace-board-heading,
.symbol-shelf-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.trace-board-heading > div { display: flex; align-items: center; gap: 11px; }
.trace-board-heading > div > span { color: var(--muted); font-size: 12px; font-weight: 850; }
.trace-board-heading strong { color: var(--mint-deep); font-size: 42px; line-height: 1; }
.trace-board-heading > p { margin: 0; padding: 6px 11px; border-radius: 999px; background: var(--mint-soft); color: var(--mint-deep); font-size: 12px; font-weight: 900; }

.trace-board-wrap { position: relative; }

.trace-board {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 32px;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.board-paper { fill: var(--surface); }
.board-grid { stroke: color-mix(in srgb, var(--coral) 42%, transparent); stroke-width: 4; fill-opacity: .32; }
.board-grid-line { stroke: color-mix(in srgb, var(--coral) 26%, transparent); stroke-width: 3; }
.board-midline { fill: none; stroke: color-mix(in srgb, var(--coral) 38%, transparent); stroke-width: 3; stroke-dasharray: 14 17; }

.symbol-watermark {
  fill: color-mix(in srgb, var(--mint) 7%, transparent);
  font-family: "PingFang TC", "Noto Sans TC", sans-serif;
  font-size: 590px;
  font-weight: 900;
  pointer-events: none;
}

.guide-stroke {
  fill: none;
  stroke: color-mix(in srgb, var(--mint) 33%, transparent);
  stroke-width: 54;
  stroke-linecap: round;
  stroke-linejoin: round;
  marker-end: url(#stroke-arrow);
  pointer-events: none;
}

.stroke-arrow-head { fill: color-mix(in srgb, var(--mint) 64%, transparent); }

.stroke-start { fill: var(--mint-deep); stroke: var(--surface); stroke-width: 7; pointer-events: none; }
.stroke-number { fill: var(--on-dark); font-size: 28px; font-weight: 950; pointer-events: none; }

.user-stroke {
  fill: none;
  stroke: var(--coral-deep);
  stroke-width: 38;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.trace-board-status {
  min-height: 32px;
  margin: 10px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.trace-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: auto auto minmax(150px, 1fr);
  gap: 9px;
}

.trace-action {
  min-height: 52px;
  padding: 11px 15px;
  border: 0;
  border-radius: 17px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.trace-action-ghost { background: var(--surface-muted); color: var(--mint-deep); }
.trace-action-next { background: var(--gold); color: #3b2b12; }
.trace-action:hover { opacity: .84; }
.trace-action:disabled { cursor: wait; opacity: .58; }

.symbol-shelf { background: color-mix(in srgb, var(--mint-soft) 54%, var(--paper)); }
.symbol-shelf-heading strong { font-size: 18px; font-weight: 950; }
.symbol-shelf-heading small { margin-top: 2px; display: block; color: var(--muted); font-size: 11px; font-weight: 750; }
.symbol-shelf-heading > span { padding: 6px 10px; border-radius: 999px; background: var(--surface); color: var(--mint-deep); font-size: 11px; font-weight: 900; }

.trace-symbol-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.trace-symbol-choice {
  position: relative;
  min-height: 58px;
  border: 0;
  border-radius: 17px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  color: var(--mint-deep);
  cursor: pointer;
  font-size: 28px;
  font-weight: 950;
}

.trace-symbol-choice:hover { background: var(--surface); }
.trace-symbol-choice.is-selected { background: var(--mint-deep); color: var(--on-dark); }
.trace-symbol-choice.is-practiced::after {
  position: absolute;
  right: 4px;
  top: 2px;
  color: var(--gold);
  content: "★";
  font-size: 10px;
}

.shelf-tip { margin: 18px 0 0; color: var(--muted); font-size: 12px; font-weight: 750; text-align: center; }
.shelf-tip span { color: var(--gold-deep); }

.practice-footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 4px 38px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.practice-footer p { max-width: 650px; margin: 0; }
.practice-footer nav { display: flex; flex-wrap: wrap; justify-content: end; gap: 16px; }
.practice-footer a { min-height: 48px; display: inline-flex; align-items: center; color: var(--mint-deep); font-weight: 850; }

@media (max-width: 860px) {
  .room-path { gap: 40px; }
  .room-path::before { display: none; }
  .trace-layout { grid-template-columns: minmax(0, 1fr); }
  .trace-symbol-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .trace-symbol-choice { min-height: 52px; }
}

@media (max-width: 680px) {
  .practice-header,
  .lobby-main,
  .trace-main,
  .practice-footer { width: min(100% - 24px, 620px); }

  .practice-header { min-height: 68px; margin-top: 6px; border-radius: 21px; }
  .practice-brand img { width: 42px; height: 42px; border-radius: 12px; }
  .practice-brand strong { font-size: 15px; }
  .practice-home-link { min-height: 48px; padding-inline: 13px; font-size: 12px; }
  .lobby-main, .trace-main { padding-top: 44px; }
  .lobby-intro, .trace-heading { align-items: center; }
  .lobby-intro h1, .trace-heading h1 { font-size: clamp(40px, 12vw, 56px); }
  .lobby-sticker { width: 102px; }
  .lobby-sticker strong { font-size: 34px; }
  .lobby-sticker span { font-size: 10px; }
  .room-path { grid-template-columns: minmax(0, 1fr); padding: 24px; border-radius: 34px; }
  .room-stop + .room-stop { padding-top: 36px; border-top: 1px solid var(--line); }
  .room-art img { aspect-ratio: 4 / 3; }
  .trace-progress { min-width: 95px; padding: 12px 13px; }
  .trace-progress strong { font-size: 28px; }
  .trace-board-panel, .symbol-shelf { padding: 18px 14px; border-radius: 28px; }
  .trace-board { border-radius: 24px; }
  .trace-symbol-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
  .trace-symbol-choice { min-height: 50px; border-radius: 15px; font-size: 25px; }
  .trace-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trace-action-next { grid-column: 1 / -1; }
  .practice-footer { flex-direction: column; }
  .practice-footer nav { justify-content: start; }
}

@media (max-width: 420px) {
  .practice-brand small { display: none; }
  .lobby-intro, .trace-heading { align-items: start; }
  .lobby-sticker { width: 84px; }
  .lobby-sticker strong { font-size: 29px; }
  .lobby-sticker span { display: none; }
  .trace-progress { min-width: 78px; }
  .room-path { padding: 20px 17px; }
  .room-copy { padding-inline: 2px; }
  .room-enter { width: 100%; }
  .trace-board-heading strong { font-size: 36px; }
  .trace-symbol-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .trace-symbol-choice { min-height: 49px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
