:root {
  color-scheme: light;
  --ink: #1c2028;
  --ink-soft: #3b414b;
  --muted: #777d86;
  --muted-light: #9ca2aa;
  --line: #e9e7e2;
  --background: #f7f6f3;
  --accent: #d8843b;
  --accent-deep: #af6125;
  --accent-soft: #fff2e5;
  --teal: #2d9b88;
  --teal-deep: #1d7466;
  --teal-soft: #eaf8f5;
  --danger: #d65f56;
  --danger-deep: #b3463f;
  --danger-soft: #fdecea;
  --gold: #c79b38;
  --shadow-lg: 0 24px 70px rgba(38, 34, 29, 0.11);
  --shadow-sm: 0 5px 16px rgba(38, 34, 29, 0.07);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --font-sans: "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--background); -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  padding: max(20px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 6%, rgba(216, 132, 59, 0.1), transparent 27rem),
    radial-gradient(circle at 94% 17%, rgba(45, 155, 136, 0.09), transparent 26rem),
    radial-gradient(circle at 72% 100%, rgba(199, 155, 56, 0.07), transparent 26rem),
    linear-gradient(180deg, #fbfaf7 0%, #f5f6f3 100%);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before { position: fixed; inset: 0; z-index: -2; content: ""; pointer-events: none; opacity: 0.24; background-image: linear-gradient(rgba(79, 91, 122, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(79, 91, 122, 0.06) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(to bottom, black, transparent 82%); }
button { font: inherit; }
button, .hanoi-board { -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid rgba(216, 132, 59, 0.28); outline-offset: 3px; }
[hidden] { display: none !important; }

.page-glow { position: fixed; z-index: -1; width: 360px; height: 360px; border-radius: 50%; pointer-events: none; filter: blur(18px); }
.page-glow--one { top: -170px; left: 44%; background: rgba(216, 132, 59, 0.06); }
.page-glow--two { right: -180px; bottom: -150px; background: rgba(45, 155, 136, 0.06); }
.app-shell { width: min(100%, 1180px); margin: 0 auto; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 7px); grid-template-rows: repeat(2, 7px); gap: 4px; width: 42px; height: 42px; place-content: center; border: 1px solid rgba(216, 132, 59, 0.14); border-radius: 13px; background: rgba(255, 255, 255, 0.78); box-shadow: var(--shadow-sm); }
.brand-mark i { display: block; border-radius: 3px; background: var(--accent); }
.brand-mark i:nth-child(2) { background: var(--teal); }
.brand-mark i:nth-child(3) { background: var(--gold); }
.brand-mark i:nth-child(4) { background: #7e67c9; }
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-copy strong { font-size: 0.95rem; letter-spacing: 0.03em; }
.brand-copy small { color: var(--muted-light); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.17em; }

.best-chip { display: flex; align-items: center; gap: 7px; min-height: 42px; padding: 8px 14px; border: 1px solid rgba(22, 32, 51, 0.07); border-radius: 999px; background: rgba(255, 255, 255, 0.72); color: var(--muted); font-size: 0.75rem; box-shadow: 0 6px 20px rgba(31, 42, 68, 0.04); backdrop-filter: blur(12px); }
.best-chip__icon { color: var(--accent); font-size: 1rem; }
.best-chip strong { color: var(--ink); font-family: var(--font-mono); font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.best-chip small { color: var(--muted-light); font-size: 0.61rem; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin: 52px 0 28px; }
.hero-main { max-width: 810px; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; margin: 0 0 15px; color: var(--accent-deep); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.09em; }
.eyebrow > span { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 5px rgba(45, 155, 136, 0.1); }
.hero h1 { display: flex; margin: 0; align-items: baseline; flex-wrap: wrap; gap: 0.12em 0.18em; font-size: clamp(2.5rem, 5.5vw, 4.2rem); font-weight: 800; letter-spacing: -0.06em; line-height: 1; }
.title-en { color: var(--accent); letter-spacing: -0.07em; }
.title-cn { color: var(--ink); }
.hero-copy { max-width: 680px; margin: 18px 0 0; color: var(--muted); font-size: 0.96rem; line-height: 1.8; }
.hero-note { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; padding-bottom: 3px; }
.hero-note > span { color: var(--muted-light); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; }
.focus-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.focus-tags span { padding: 7px 11px; border: 1px solid rgba(22, 32, 51, 0.06); border-radius: 999px; background: rgba(255, 255, 255, 0.66); color: var(--ink-soft); font-size: 0.72rem; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.play-card, .guide-card { border: 1px solid rgba(22, 32, 51, 0.065); background: rgba(255, 255, 255, 0.9); box-shadow: var(--shadow-lg); backdrop-filter: blur(18px); }
.play-card { min-width: 0; padding: 18px; border-radius: var(--radius-xl); }
.play-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 42px; margin: 0 2px 13px; }
.live-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.78rem; font-weight: 650; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #b9c0cd; box-shadow: 0 0 0 4px rgba(185, 192, 205, 0.14); transition: background-color 180ms ease, box-shadow 180ms ease; }
.status-dot.is-active { background: var(--teal); box-shadow: 0 0 0 4px rgba(45, 155, 136, 0.12); }
.status-dot.is-paused { background: #dfa02f; box-shadow: 0 0 0 4px rgba(223, 160, 47, 0.13); }
.status-dot.is-complete { background: var(--accent); box-shadow: 0 0 0 4px rgba(216, 132, 59, 0.12); }
.toolbar-actions { display: flex; gap: 7px; }

.ghost-button { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink-soft); font-size: 0.72rem; font-weight: 650; cursor: pointer; transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 160ms ease; }
.ghost-button:hover:not(:disabled) { border-color: #d4cec5; background: #fbfaf8; }
.ghost-button:active:not(:disabled) { transform: translateY(1px); }
.ghost-button:disabled { color: #bbb9b5; cursor: not-allowed; }

.session-strip { padding: 10px 12px 11px; border: 1px solid rgba(22, 32, 51, 0.055); border-radius: 14px; background: #faf9f7; }
.session-meta { display: flex; align-items: center; gap: 13px; margin-bottom: 9px; color: var(--muted); font-size: 0.67rem; }
.session-label { margin-right: auto; color: var(--ink-soft); font-weight: 700; }
.session-meta strong { color: var(--ink); font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.goal-track { height: 5px; overflow: hidden; border-radius: 999px; background: #eae7e1; }
.goal-track > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--gold), var(--teal)); transition: width 220ms ease; }

.hanoi-frame { position: relative; min-height: clamp(410px, 46vh, 470px); margin-top: 12px; overflow: hidden; border: 1px solid rgba(22, 32, 51, 0.06); border-radius: var(--radius-lg); background: radial-gradient(circle at 12% 15%, rgba(216, 132, 59, 0.06), transparent 31%), radial-gradient(circle at 88% 85%, rgba(45, 155, 136, 0.06), transparent 31%), #fcfbf9; isolation: isolate; }
.hanoi-frame::before, .hanoi-frame::after { position: absolute; border: 1px solid rgba(216, 132, 59, 0.065); border-radius: 50%; content: ""; pointer-events: none; }
.hanoi-frame::before { top: -110px; right: -75px; width: 255px; height: 255px; }
.hanoi-frame::after { bottom: -125px; left: -85px; width: 275px; height: 275px; }
.hanoi-stage { position: relative; z-index: 1; display: flex; min-height: clamp(410px, 46vh, 470px); padding: 17px 20px 18px; align-items: center; flex-direction: column; transition: filter 220ms ease, transform 220ms ease; }
.hanoi-stage.is-obscured { filter: blur(9px); transform: scale(1.01); }
.stimulus-topline { display: flex; width: 100%; align-items: center; justify-content: space-between; color: var(--muted-light); font-size: 0.65rem; letter-spacing: 0.05em; }
.stimulus-topline strong { color: var(--accent-deep); font-family: var(--font-mono); }

.hanoi-board { position: relative; display: grid; width: 100%; max-width: 690px; min-height: 300px; margin: 11px auto 5px; padding: 10px 8px 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; border-radius: 22px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(244, 239, 230, 0.7)); }
.peg-column { position: relative; min-width: 0; padding: 0; overflow: visible; border: 1px solid transparent; border-radius: 17px; background: transparent; cursor: pointer; touch-action: manipulation; transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease; }
.peg-column:hover:not(:disabled) { border-color: rgba(216, 132, 59, 0.17); background: rgba(255, 245, 234, 0.5); }
.peg-column.is-selected { border-color: rgba(216, 132, 59, 0.35); background: rgba(255, 238, 221, 0.68); box-shadow: inset 0 0 0 2px rgba(216, 132, 59, 0.055); }
.peg-column.is-invalid { animation: peg-shake 300ms ease; }
.peg-column:disabled { cursor: default; }
.peg-label { position: absolute; top: 9px; left: 50%; z-index: 5; display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid rgba(22, 32, 51, 0.06); border-radius: 10px; background: rgba(255, 255, 255, 0.84); color: var(--muted); font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700; transform: translateX(-50%); box-shadow: 0 3px 9px rgba(31, 42, 68, 0.05); }
.peg-rod { position: absolute; bottom: 29px; left: 50%; z-index: 1; width: 10px; height: 235px; border-radius: 999px 999px 4px 4px; background: linear-gradient(90deg, #8b684b, #b58c69 55%, #79573e); box-shadow: inset -2px 0 2px rgba(255, 255, 255, 0.18), 2px 0 5px rgba(69, 48, 32, 0.14); transform: translateX(-50%); }
.peg-base { position: absolute; right: 5%; bottom: 15px; left: 5%; z-index: 2; height: 17px; border-radius: 999px; background: linear-gradient(180deg, #b28a67, #805d43); box-shadow: 0 6px 12px rgba(63, 43, 28, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.disk-stack { position: absolute; right: 4%; bottom: 30px; left: 4%; z-index: 3; display: flex; align-items: center; flex-direction: column-reverse; pointer-events: none; }
.disk { position: relative; display: grid; height: clamp(25px, 3.8vh, 34px); margin-top: 3px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 999px; color: rgba(255, 255, 255, 0.93); font-family: var(--font-mono); font-size: 0.63rem; font-weight: 700; box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.18), 0 4px 8px rgba(50, 39, 26, 0.14); }
.disk--1 { background: linear-gradient(180deg, #ee8f52, #ce6e34); }
.disk--2 { background: linear-gradient(180deg, #e3b34f, #bd8a2b); }
.disk--3 { background: linear-gradient(180deg, #4bb4a2, #268977); }
.disk--4 { background: linear-gradient(180deg, #7095df, #5074c0); }
.disk--5 { background: linear-gradient(180deg, #a17add, #7a57b7); }
.disk.is-lifted { transform: translateY(-13px); box-shadow: 0 12px 20px rgba(50, 39, 26, 0.25), inset 0 2px 3px rgba(255, 255, 255, 0.18); }
.disk.is-dropping { animation: disk-drop 220ms cubic-bezier(0.2, 0.82, 0.28, 1); }
.hanoi-board.is-solved .peg-column[data-peg="C"] { border-color: rgba(45, 155, 136, 0.25); background: rgba(234, 248, 245, 0.58); }

.interaction-hint { min-height: 18px; color: var(--muted-light); font-size: 0.66rem; text-align: center; }
.feedback { min-height: 27px; margin-top: 3px; padding: 5px 12px; border-radius: 999px; color: var(--muted-light); font-size: 0.71rem; font-weight: 650; line-height: 1.5; text-align: center; }
.feedback.is-correct { background: var(--teal-soft); color: var(--teal-deep); }
.feedback.is-wrong { background: var(--danger-soft); color: var(--danger-deep); }

.stimulus-overlay { position: absolute; inset: 0; z-index: 5; display: grid; padding: 16px; place-items: center; background: rgba(249, 248, 245, 0.58); backdrop-filter: blur(8px); }
.overlay-content { display: flex; width: min(100%, 500px); padding: 18px 21px; align-items: center; flex-direction: column; border: 1px solid rgba(255, 255, 255, 0.87); border-radius: 20px; background: rgba(255, 255, 255, 0.94); text-align: center; box-shadow: 0 22px 55px rgba(31, 42, 68, 0.13); animation: overlay-in 260ms ease both; }
.overlay-kicker, .section-kicker { color: var(--accent-deep); font-size: 0.61rem; font-weight: 750; letter-spacing: 0.13em; }
.overlay-content h2 { margin: 8px 0 5px; font-size: clamp(1.22rem, 2.7vw, 1.55rem); letter-spacing: -0.035em; }
.overlay-content p { max-width: 415px; margin: 0; color: var(--muted); font-size: 0.76rem; line-height: 1.6; }

.disk-picker { display: grid; width: min(100%, 390px); margin: 11px 0 9px; padding: 4px; grid-template-columns: repeat(3, 1fr); gap: 5px; border: 1px solid var(--line); border-radius: 14px; background: #f8f7f4; }
.disk-option { display: flex; min-height: 48px; padding: 5px 8px; align-items: center; justify-content: center; flex-direction: column; gap: 1px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 120ms ease; }
.disk-option strong { font-family: var(--font-mono); font-size: 0.75rem; }
.disk-option small { color: var(--muted-light); font-size: 0.56rem; }
.disk-option:hover { background: rgba(255, 255, 255, 0.78); }
.disk-option:active { transform: scale(0.97); }
.disk-option.is-selected { border-color: rgba(216, 132, 59, 0.16); background: #fff; color: var(--accent-deep); box-shadow: 0 4px 12px rgba(174, 99, 40, 0.08); }
.disk-option.is-selected small { color: var(--accent); }

.example-row { display: flex; min-height: 54px; margin-bottom: 10px; padding: 7px 10px; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--line); border-radius: 13px; background: #faf9f7; }
.example-small, .example-large { display: grid; height: 20px; place-items: center; border-radius: 999px; color: #fff; font-family: var(--font-mono); font-size: 0.55rem; font-weight: 700; }
.example-small { width: 45px; background: var(--accent); }
.example-large { width: 68px; background: var(--teal); }
.example-vs { color: var(--danger); font-size: 0.62rem; font-weight: 700; }
.example-copy { color: var(--muted); font-size: 0.6rem; }
.primary-button { display: inline-flex; min-height: 45px; padding: 0 25px; align-items: center; justify-content: center; border: 0; border-radius: 13px; background: linear-gradient(135deg, #df8d45, #c36a29); color: #fff; font-size: 0.82rem; font-weight: 700; box-shadow: 0 10px 24px rgba(195, 106, 41, 0.25); cursor: pointer; transition: box-shadow 160ms ease, transform 160ms ease, filter 160ms ease; }
.primary-button:hover { filter: brightness(1.04); box-shadow: 0 12px 28px rgba(195, 106, 41, 0.31); }
.primary-button:active { transform: translateY(1px) scale(0.99); }
.overlay-hint { margin-top: 8px; color: var(--muted-light); font-size: 0.61rem; }

.side-column { display: flex; flex-direction: column; gap: 20px; }
.stats-card { position: relative; overflow: hidden; padding: 24px; border-radius: var(--radius-xl); background: radial-gradient(circle at 100% 0%, rgba(216, 132, 59, 0.45), transparent 57%), linear-gradient(145deg, #29241f, #3e352c); color: #fff; box-shadow: 0 24px 60px rgba(31, 42, 68, 0.2); }
.stats-card::after { position: absolute; right: -45px; bottom: -70px; width: 170px; height: 170px; border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 50%; content: ""; }
.primary-stat, .stat-grid, .best-line { position: relative; z-index: 1; }
.primary-stat { display: flex; flex-direction: column; }
.stat-label { color: rgba(255, 255, 255, 0.58); font-size: 0.68rem; font-weight: 650; letter-spacing: 0.08em; }
.timer { margin-top: 4px; color: #fff; font-family: var(--font-mono); font-size: clamp(2.5rem, 5vw, 3.25rem); font-weight: 600; letter-spacing: -0.07em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-note { color: rgba(255, 255, 255, 0.46); font-size: 0.68rem; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 22px; }
.mini-stat { display: flex; min-width: 0; padding: 12px 11px; flex-direction: column; gap: 5px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 13px; background: rgba(255, 255, 255, 0.055); }
.mini-stat span { color: rgba(255, 255, 255, 0.5); font-size: 0.61rem; }
.mini-stat strong { color: #fff; font-family: var(--font-mono); font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.best-line { display: flex; margin-top: 13px; padding-top: 13px; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid rgba(255, 255, 255, 0.09); color: rgba(255, 255, 255, 0.48); font-size: 0.65rem; }
.best-line strong { color: rgba(255, 255, 255, 0.84); font-size: 0.67rem; font-weight: 600; }
.best-line b { color: #fff; font-family: var(--font-mono); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

.guide-card { padding: 23px; border-radius: var(--radius-xl); }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.card-heading h2 { margin: 5px 0 0; font-size: 1.18rem; letter-spacing: -0.025em; }
.guide-icon { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(216, 132, 59, 0.1); border-radius: 13px; background: var(--accent-soft); color: var(--accent-deep); font-family: var(--font-mono); font-size: 0.9rem; font-weight: 800; }
.steps { display: flex; margin: 22px 0; padding: 0; flex-direction: column; gap: 14px; list-style: none; }
.steps li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; }
.steps li > span { padding-top: 2px; color: var(--accent-deep); font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700; }
.steps p { margin: 0; color: var(--muted); font-size: 0.76rem; line-height: 1.62; }
.tip-box { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 13px 14px; border-radius: 14px; background: #f7f5f1; }
.tip-box > span { color: var(--teal); font-size: 0.8rem; }
.tip-box p { margin: 0; color: var(--muted); font-size: 0.7rem; line-height: 1.6; }

.page-footer { display: flex; margin-top: 22px; padding: 0 4px; justify-content: space-between; gap: 16px; color: var(--muted-light); font-size: 0.65rem; }
.result-dialog { width: min(calc(100% - 32px), 440px); max-height: calc(100svh - 32px); padding: 30px; overflow-y: auto; border: 1px solid rgba(255, 255, 255, 0.85); border-radius: 26px; background: #fff; color: var(--ink); box-shadow: 0 30px 90px rgba(19, 27, 46, 0.3); }
.result-dialog::backdrop { background: rgba(21, 29, 46, 0.48); backdrop-filter: blur(5px); }
.result-dialog[open] { animation: dialog-in 240ms ease both; }
.dialog-close { position: absolute; top: 16px; right: 16px; display: grid; width: 34px; height: 34px; padding: 0; place-items: center; border: 0; border-radius: 50%; background: #f4f6fa; color: var(--muted); font-size: 1.2rem; cursor: pointer; }
.result-dialog h2 { margin: 8px 0 6px; font-size: 1.78rem; letter-spacing: -0.045em; }
.result-copy { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.6; }
.result-tags { display: flex; margin-bottom: 11px; align-items: center; gap: 8px; flex-wrap: wrap; }
.record-badge { display: inline-flex; padding: 6px 10px; border-radius: 999px; background: var(--teal-soft); color: var(--teal-deep); font-size: 0.64rem; font-weight: 750; letter-spacing: 0.04em; }
.result-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 24px 0 13px; }
.result-grid > div { display: flex; min-width: 0; padding: 14px 8px; align-items: center; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 14px; background: #faf9f7; }
.result-grid span { color: var(--muted); font-size: 0.63rem; }
.result-grid strong { color: var(--ink); font-family: var(--font-mono); font-size: 1rem; font-variant-numeric: tabular-nums; }
.result-best-line { display: flex; margin-bottom: 20px; padding: 12px 14px; align-items: center; justify-content: space-between; gap: 12px; border-radius: 13px; background: var(--accent-soft); color: var(--accent-deep); font-size: 0.7rem; }
.result-best-line strong { font-size: 0.7rem; }
.result-best-line b { font-family: var(--font-mono); font-size: 0.86rem; }
.result-primary { width: 100%; }
.text-button { display: block; margin: 10px auto 0; padding: 8px 12px; border: 0; background: transparent; color: var(--muted); font-size: 0.76rem; cursor: pointer; }
.text-button:hover { color: var(--ink); }

@keyframes disk-drop { 0% { opacity: 0.75; transform: translateY(-18px) scale(1.05); } 70% { transform: translateY(2px) scale(0.99); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes peg-shake { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-5px); } 62% { transform: translateX(5px); } 82% { transform: translateX(-2px); } }
@keyframes overlay-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (min-width: 941px) and (max-height: 1050px) {
  body { padding-top: 14px; }
  .hero { margin: 24px 0 18px; align-items: center; }
  .eyebrow { margin-bottom: 10px; }
  .hero h1 { font-size: clamp(2.35rem, 4.2vw, 3.5rem); }
  .hero-copy { margin-top: 10px; font-size: 0.86rem; }
  .play-card { padding: 14px; }
  .play-toolbar { margin-bottom: 10px; }
  .hanoi-frame, .hanoi-stage { min-height: 390px; }
  .hanoi-board { min-height: 280px; }
}

@media (min-width: 941px) and (max-height: 800px) {
  .hero { margin: 12px 0 10px; }
  .eyebrow { margin-bottom: 8px; }
  .hero h1 { font-size: 2.65rem; }
  .hero-copy { display: none; }
  .play-card { padding: 12px; }
  .play-toolbar { margin-bottom: 8px; }
  .hanoi-frame, .hanoi-stage { min-height: 370px; }
  .hanoi-board { min-height: 260px; }
  .peg-rod { height: 210px; }
}

@media (max-width: 940px) {
  .hero { align-items: flex-start; margin-top: 38px; }
  .workspace { grid-template-columns: 1fr; }
  .side-column { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
}

@media (max-width: 680px) {
  body { padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
  .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
  .best-chip { min-height: 38px; padding: 7px 11px; }
  .best-chip > span:not(.best-chip__icon), .best-chip small { display: none; }
  .hero { display: block; margin: 32px 0 21px; }
  .hero h1 { font-size: clamp(2.25rem, 10.3vw, 3.25rem); }
  .hero-copy { margin-top: 13px; font-size: 0.86rem; }
  .hero-note { display: none; }
  .play-card { padding: 12px; border-radius: 22px; }
  .play-toolbar { margin: 1px 2px 10px; align-items: flex-start; }
  .toolbar-actions { gap: 5px; }
  .ghost-button { min-height: 36px; padding: 0 8px; font-size: 0.68rem; }
  .session-strip { padding: 9px 10px 10px; }
  .session-meta { gap: 8px; font-size: 0.58rem; flex-wrap: wrap; row-gap: 5px; }
  .session-label { display: none; }
  .hanoi-frame, .hanoi-stage { min-height: 390px; }
  .hanoi-frame { margin-top: 10px; border-radius: 17px; }
  .hanoi-stage { padding: 13px 9px 14px; }
  .hanoi-board { min-height: 290px; padding: 8px 4px 0; gap: 6px; border-radius: 18px; }
  .peg-rod { width: 8px; height: 220px; }
  .peg-base { right: 2%; left: 2%; }
  .disk-stack { right: 1%; left: 1%; }
  .disk { height: 27px; font-size: 0.56rem; }
  .peg-label { width: 27px; height: 27px; font-size: 0.62rem; }
  .stimulus-overlay { padding: 10px; }
  .overlay-content { padding: 15px 13px; border-radius: 17px; }
  .overlay-content h2 { font-size: 1.18rem; }
  .overlay-content p { font-size: 0.71rem; }
  .disk-picker { margin: 9px 0 7px; }
  .disk-option { min-height: 43px; padding: 4px 5px; }
  .example-row { min-height: 48px; margin-bottom: 9px; gap: 6px; }
  .example-copy { font-size: 0.54rem; }
  .side-column { display: flex; }
  .stats-card { padding: 21px; border-radius: 22px; }
  .timer { font-size: 2.55rem; }
  .guide-card { padding: 21px; border-radius: 22px; }
  .page-footer { align-items: flex-start; flex-direction: column; gap: 4px; }
  .result-dialog { padding: 25px 20px 22px; border-radius: 22px; }
  .result-grid { gap: 6px; }
  .result-grid > div { padding: 12px 6px; }
  .result-grid strong { font-size: 0.86rem; }
}

@media (max-width: 370px) {
  .brand-copy small { display: none; }
  .session-meta { font-size: 0.54rem; }
  .hanoi-board { gap: 3px; }
  .disk { height: 24px; }
  .peg-rod { height: 200px; }
  .example-copy { display: none; }
}

@media (orientation: landscape) and (max-height: 620px) and (max-width: 940px) {
  body { padding-top: 12px; }
  .hero { margin: 16px 0 12px; }
  .hero h1 { font-size: 2.2rem; }
  .hero-copy { display: none; }
  .eyebrow { margin-bottom: 8px; }
  .workspace { grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr); gap: 14px; }
  .side-column { display: flex; }
  .play-card { padding: 10px; }
  .hanoi-frame, .hanoi-stage { min-height: 340px; }
  .hanoi-board { min-height: 240px; }
  .peg-rod { height: 185px; }
  .stats-card, .guide-card { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
