/* Tower of Hanoi: the board is a canvas filling the stage; the HUD, the caption line, the tool bar and the panels are
   HTML over it (game.js keeps the pegs between them) */
.th { display: flex; flex-direction: column; color: #dfe9ff; --th-hud: 54px; --th-cap: 40px; --th-bar: 64px; --th-accent: #55d6ff; --th-warm: #ffd166; --th-hot: #ff6b81; }
.th-stage { position: relative; width: 100%; height: min(82vh, 720px); min-height: 320px; background: #03050c; overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: none; outline: none; }
@media (max-width: 600px) { .th-stage { height: auto; aspect-ratio: 3 / 4.5; max-height: 86vh; min-height: 0; } }
@media (orientation: landscape) and (max-height: 520px) { .th-stage { height: 92vh; aspect-ratio: auto; max-height: none; min-height: 280px; } }
#th-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* the pegs as buttons, for the keyboard and for screen readers: invisible until one has the focus */
.th-pegs { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.th-peg { position: absolute; margin: 0; padding: 0; border: 2px solid transparent; border-radius: 16px; background: none; color: transparent; font-size: 0; pointer-events: none; outline: none; }
.th-peg:focus-visible { border-color: rgba(85,214,255,0.75); box-shadow: 0 0 0 3px rgba(85,214,255,0.16), inset 0 0 26px rgba(85,214,255,0.08); }

/* HUD: mode and size, moves against the fewest possible, time, best, and the icons */
.th-hud { position: absolute; left: 0; right: 0; top: 0; height: var(--th-hud); display: flex; align-items: center; gap: 14px; padding: 0 8px 0 10px; z-index: 3; pointer-events: none; }
.th-row { display: flex; align-items: center; gap: 6px; flex: none; pointer-events: none; min-width: 0; }
.th-row > * { pointer-events: auto; }
.th-row-b { gap: 16px; }
.th-mode { flex: none; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; position: relative; min-width: 0; height: 44px; padding: 2px 28px 2px 11px; border-radius: 12px;
  border: 1px solid #1c2b4a; background: rgba(11,19,40,0.8); color: #fff; cursor: pointer; font: inherit; line-height: 1.05; touch-action: manipulation; text-align: left; transition: border-color .15s; }
.th-mode-k { font-size: 10px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--th-accent); white-space: nowrap; }
.th-mode-n { font-size: 17px; font-weight: 900; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; margin-top: 2px; }
.th-dd { position: absolute; right: 7px; top: 50%; width: 16px; height: 16px; margin-top: -8px; fill: none; stroke: #8aa3c4; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .th-mode:hover { border-color: var(--th-accent); } }
.th-mode:focus-visible, .th-step-b:focus-visible, .th-tool:focus-visible, .th-btn:focus-visible, .th-dbtn:focus-visible { outline: 2px solid var(--th-accent); outline-offset: 2px; }
.th-step { display: flex; flex: none; border-radius: 12px; border: 1px solid #1c2b4a; background: rgba(11,19,40,0.8); overflow: hidden; }
.th-step[hidden] { display: none; }
.th-step-b { display: grid; place-items: center; width: 40px; height: 42px; padding: 0; border: 0; background: none; color: #bfe0ff; cursor: pointer; touch-action: manipulation; transition: color .15s, background .15s, opacity .15s; }
.th-step-b + .th-step-b { border-left: 1px solid #1c2b4a; }
.th-step-b svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.th-step-b:disabled { opacity: 0.3; cursor: default; }
@media (hover: hover) { .th-step-b:hover:not(:disabled) { color: #fff; background: rgba(85,214,255,0.12); } }
.th-stat { display: flex; flex-direction: column; line-height: 1.05; flex: none; }
.th-k { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #8aa3c4; }
.th-stat b { font-size: 21px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.th-moves b { display: inline-block; transition: transform .16s cubic-bezier(.3,1.6,.5,1), color .16s; transform-origin: left center; }
.th-moves b.pop { transform: scale(1.14); color: #b8f6ff; }
.th-moves b.over #th-mv { color: #ffb38a; }
.th-moves small { font-size: 12.5px; font-weight: 700; color: #8aa3c4; margin-left: 4px; letter-spacing: 0; }
.th-time b { font-size: 17px; margin-top: 3px; color: #dfe9ff; }
.th-best b { font-size: 15px; margin-top: 4px; color: #ffd166; }
.th-best[hidden] { display: none; }
.th-sp { flex: 1 1 auto; }
.th-tool { position: relative; display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid #1c2b4a; background: rgba(11,19,40,0.8);
  color: #bfe0ff; cursor: pointer; touch-action: manipulation; padding: 0; transition: border-color .15s, color .15s, opacity .15s; }
.th-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.th-tool .spk { fill: currentColor; stroke: none; }
@media (hover: hover) { .th-tool:hover:not(:disabled) { border-color: var(--th-accent); color: #fff; } }
.th-tool[aria-pressed="true"]#th-daily { color: #04121a; background: var(--th-accent); border-color: var(--th-accent); }
#th-sound .off { display: none; } #th-sound[aria-pressed="true"] { color: #6f84a3; } #th-sound[aria-pressed="true"] .on { display: none; } #th-sound[aria-pressed="true"] .off { display: inline; }
.th-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--th-hot); box-shadow: 0 0 8px var(--th-hot); }
.th-dot[hidden] { display: none; }

/* narrow stages: the HUD stands in two rows, mode and icons over the numbers */
.th-narrow { --th-hud: 100px; --th-cap: 44px; }
.th-narrow .th-hud { flex-wrap: wrap; align-content: flex-start; gap: 6px 8px; padding: 7px 8px 0; }
.th-narrow .th-row-a { order: 1; }
.th-narrow .th-sp { display: none; }
.th-narrow .th-row-a { flex: 1 1 0; }
.th-narrow .th-row-c { gap: 5px; }
.th-narrow .th-mode { flex: 0 1 auto; padding: 2px 25px 2px 10px; overflow: hidden; }
.th-narrow .th-mode-k { letter-spacing: 0.1em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.th-narrow .th-mode-n { font-size: 16px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.th-narrow .th-dd { right: 6px; }
.th-tight .th-mode { padding: 2px 10px; }
.th-tight .th-dd { display: none; }
.th-tight .th-mode-k { letter-spacing: 0.07em; }
.th-tight .th-mode-n { font-size: 15.5px; }
.th-tiny .th-step { position: absolute; right: 8px; top: 55px; }
.th-tiny .th-best { display: none; }
.th-narrow .th-row-c { order: 3; }
.th-narrow .th-row-b { order: 4; flex: 1 0 100%; gap: 20px; padding-left: 4px; height: 40px; }
.th-narrow .th-stat b { font-size: 19px; }
.th-narrow .th-time b { font-size: 16px; }
.th-narrow .th-best b { font-size: 14.5px; }
.th-short .th-best { display: none; }

/* the caption line under the HUD: the goal, a hint, what the demo is doing, why a move is not allowed */
.th-coach { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--th-hud) + 2px); z-index: 3; width: max-content; max-width: min(calc(100% - 16px), 620px); min-height: 30px; padding: 6px 14px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; font-size: 13.5px; line-height: 1.3; color: #9fb6d6; border: 1px solid transparent; pointer-events: none; transition: border-color .18s, background .18s, color .18s; }
.th-coach b { color: #dfe9ff; font-weight: 800; white-space: nowrap; }
.th-coach b:empty { display: none; }
.th-coach.hint { color: #ffe9b8; background: rgba(8,13,30,0.9); border-color: rgba(255,209,102,0.6); box-shadow: 0 8px 26px rgba(0,0,0,.4), 0 0 18px rgba(255,209,102,.14); }
.th-coach.hint b { color: #ffd166; }
.th-coach.demo { color: #dfe9ff; background: rgba(8,13,30,0.9); border-color: rgba(85,214,255,0.45); box-shadow: 0 8px 26px rgba(0,0,0,.4), 0 0 18px rgba(85,214,255,.12); }
.th-coach.demo b { color: var(--th-accent); }
.th-coach.warn { color: #ffd3da; background: rgba(40,8,18,0.9); border-color: rgba(255,107,129,0.6); animation: th-nudge .28s ease-out; }
.th-coach.warn b { color: #ff8fa0; }
.th-coach.good { color: #d5ffe9; background: rgba(6,30,24,0.9); border-color: rgba(61,255,181,0.5); }
.th-coach.good b { color: #3dffb5; }
.th-coach-close { display: none; }
.th-narrow .th-coach { font-size: 12.5px; padding: 5px 12px; border-radius: 14px; width: calc(100% - 16px); }
@keyframes th-nudge { 0% { transform: translateX(calc(-50% - 6px)); } 35% { transform: translateX(calc(-50% + 5px)); } 70% { transform: translateX(calc(-50% - 2px)); } 100% { transform: translateX(-50%); } }

/* the tool bar */
.th-bar { position: absolute; left: 50%; transform: translateX(-50%); bottom: 8px; height: calc(var(--th-bar) - 12px); z-index: 3; display: flex; gap: 6px; padding: 0 6px; width: min(calc(100% - 4px), 600px); }
.th-bar[hidden], .th-demo[hidden] { display: none; }
.th-btn { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 14px; border: 1px solid #1c2b4a;
  background: rgba(11,19,40,0.86); color: #cfe3ff; font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; cursor: pointer; touch-action: manipulation; padding: 0 2px;
  transition: border-color .15s, color .15s, opacity .15s, background .15s, transform .08s; }
.th-btn[hidden] { display: none; }
.th-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.th-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (hover: hover) { .th-btn:hover:not(:disabled) { border-color: var(--th-accent); color: #fff; } }
.th-btn:active:not(:disabled) { transform: translateY(1px); }
.th-btn:disabled { opacity: 0.36; cursor: default; }
.th-btn.off { opacity: 0.5; }
.th-hint { color: #ffe3a3; }
@media (hover: hover) { .th-hint:hover:not(:disabled) { border-color: #ffd166; } }
.th-hint.live { border-color: rgba(255,209,102,0.7); box-shadow: 0 0 16px rgba(255,209,102,.18); }
.th-count { position: absolute; top: 4px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #ffd166; color: #1a1200; font-size: 11px; font-weight: 900; line-height: 17px; font-style: normal; text-align: center; font-variant-numeric: tabular-nums; }
.th-count.none { background: #24375e; color: #8aa3c4; }
.th-count[hidden] { display: none; }

/* the demo's controls stand where the tools were */
.th-demo { position: absolute; left: 50%; transform: translateX(-50%); bottom: 8px; height: calc(var(--th-bar) - 12px); z-index: 3; display: flex; align-items: stretch; gap: 6px; padding: 0 6px; width: min(calc(100% - 4px), 460px); }
.th-demo-ctl { display: contents; }
.th-dbtn { flex: 1 1 0; min-width: 44px; display: grid; place-items: center; border-radius: 14px; border: 1px solid rgba(85,214,255,0.4); background: rgba(11,19,40,0.9); color: #dff6ff; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; touch-action: manipulation; padding: 0 8px; transition: border-color .15s, background .15s, transform .08s; }
.th-dbtn svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.th-dbtn .pl { display: none; } .th-dbtn.paused .pl { display: inline; } .th-dbtn.paused .pa { display: none; }
.th-dbtn:disabled { opacity: .4; cursor: default; }
@media (hover: hover) { .th-dbtn:hover:not(:disabled) { border-color: var(--th-accent); } }
.th-dbtn:active:not(:disabled) { transform: translateY(1px); }
.th-dstop { flex: 1.6 1 0; background: linear-gradient(135deg, #3dffb5, #55d6ff); color: #03141c; border-color: transparent; }

/* landscape phones and short stages: the tools stand in a column on the right */
.th-side .th-bar, .th-side .th-demo { left: auto; right: 8px; top: calc(var(--th-hud) + 2px); bottom: 8px; transform: none; height: auto; width: 60px; flex-direction: column; padding: 0; }
.th-side .th-btn span { display: none; }
.th-side .th-btn { min-height: 0; }
.th-side .th-dbtn { padding: 0 2px; font-size: 12.5px; }
.th-side .th-coach { max-width: min(calc(100% - 150px), 620px); left: calc(50% - 34px); }

/* panels */
.th-overlay[hidden] { display: none; }
.th-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 6; overflow: auto; overscroll-behavior: contain; touch-action: pan-y;
  background: radial-gradient(ellipse at center, rgba(3,6,16,0.5), rgba(3,5,12,0.86)); animation: th-fade .18s ease-out; }
.th-overlay.clear { background: radial-gradient(ellipse at center, rgba(3,6,16,0.12), rgba(3,5,12,0.62)); }
.th-panel { position: relative; width: min(100%, 430px); margin: auto; padding: 20px 18px 18px; border: 1px solid #1c2b4a; border-radius: 18px; text-align: left; outline: none; user-select: text; -webkit-user-select: text;
  background: rgba(8,13,30,0.95); box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(85,214,255,0.06) inset; animation: th-in .26s cubic-bezier(.2,.9,.25,1.1); }
.th-panel.wide { width: min(100%, 540px); }
@keyframes th-in { from { opacity: 0; transform: scale(.95) translateY(8px); } }
@keyframes th-fade { from { opacity: 0; } }
.th-panel h2 { margin: 0 36px 12px 0; font-size: 20px; font-weight: 900; color: #fff; letter-spacing: 0.01em; text-transform: none; line-height: 1.25; }
.th-panel h3 { margin: 14px 0 8px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: #8aa3c4; }
.th-panel p, .th-panel li { font-size: 13.5px; line-height: 1.5; color: #b9c9e4; }
.th-panel p { margin: 0 0 8px; }
.th-panel ul, .th-panel ol { margin: 0 0 8px; padding-left: 20px; }
.th-panel li { margin-bottom: 3px; }
.th-panel li b, .th-panel p b { color: #fff; }
.th-panel kbd { display: inline-block; min-width: 1.4em; padding: 0 5px; border-radius: 5px; border: 1px solid #2a3c62; background: #0b1328; color: #fff; font: 700 12px/1.6 system-ui, sans-serif; text-align: center; }
.th-x { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 0; background: rgba(255,255,255,.07); color: #cfe0ff; cursor: pointer; padding: 0; }
.th-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
@media (hover: hover) { .th-x:hover { background: rgba(255,255,255,.14); color: #fff; } }
.th-x:focus-visible { outline: 2px solid var(--th-accent); outline-offset: 2px; }
.th-fine { font-size: 12px !important; color: #6f84a3 !important; margin: 8px 0 0 !important; }
.th-center { text-align: center; }
.th-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.th-row2 { display: flex; gap: 8px; } .th-row2 > * { flex: 1 1 0; min-width: 0; }
.th-b { font: inherit; font-weight: 700; font-size: 14.5px; padding: 10px 12px; min-height: 46px; border-radius: 12px; cursor: pointer; touch-action: manipulation; text-decoration: none;
  border: 1px solid #1c2b4a; background: #0b1328; color: #dfe9ff; transition: background .15s, border-color .15s, transform .1s, filter .15s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
@media (hover: hover) { .th-b:hover:not(:disabled) { border-color: var(--th-accent); } }
.th-b:active { transform: translateY(1px); }
.th-b:disabled { opacity: .45; cursor: default; }
.th-b:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.th-b svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.th-b-primary { background: linear-gradient(135deg, #3dffb5, #55d6ff); color: #03141c; border-color: transparent; font-size: 16px; font-weight: 800; box-shadow: 0 6px 24px rgba(85,214,255,0.3); }
@media (hover: hover) { .th-b-primary:hover:not(:disabled) { border-color: transparent; filter: brightness(1.08); } }
.th-link { display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 0; padding: 6px 2px; border: 0; background: none; color: var(--th-accent); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.th-link:focus-visible { outline: 2px solid var(--th-accent); outline-offset: 2px; }

/* the modes panel: four ways to play, the sizes of the one picked, and the daily */
.th-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.th-mcard { min-width: 0; }
.th-mcard { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 14px; border: 1px solid #1c2b4a; background: #050a18; color: #dfe9ff; font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; transition: border-color .15s, box-shadow .15s; min-height: 58px; }
.th-mcard svg { width: 38px; height: 30px; flex: none; }
.th-mcard span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.th-mcard b { font-size: 14.5px; color: #fff; white-space: nowrap; }
.th-mcard small { font-size: 11.5px; color: #8aa3c4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-mcard[aria-checked="true"] { border-color: var(--th-accent); box-shadow: inset 0 0 0 1px var(--th-accent), 0 0 18px rgba(85,214,255,0.2); }
@media (hover: hover) { .th-mcard:hover { border-color: var(--th-accent); } }
.th-mcard:focus-visible, .th-size:focus-visible, .th-card:focus-visible, .th-day:focus-visible, .th-theme:focus-visible, .th-switch:focus-visible, .th-tab:focus-visible { outline: 2px solid var(--th-accent); outline-offset: 2px; }
.th-mdesc { margin: 10px 0 8px !important; min-height: 40px; }
.th-sizes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.th-size { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 2px 6px; min-height: 58px; border-radius: 12px; border: 1px solid #1c2b4a; background: #050a18; color: #dfe9ff; font: inherit; cursor: pointer; touch-action: manipulation; transition: border-color .15s, box-shadow .15s; }
.th-size b { font-size: 18px; font-weight: 900; color: #fff; line-height: 1.1; font-variant-numeric: tabular-nums; }
.th-size em { font-style: normal; font-size: 10.5px; font-weight: 700; color: #6f84a3; white-space: nowrap; font-variant-numeric: tabular-nums; }
.th-size.cur { border-color: var(--th-accent); box-shadow: inset 0 0 0 1px var(--th-accent); }
@media (hover: hover) { .th-size:hover { border-color: var(--th-accent); } }
.th-st { display: inline-flex; gap: 1px; line-height: 1; }
.th-st i { width: 9px; height: 9px; background: #1c2b4a; clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 76%, 20% 100%, 30% 60%, 0 38%, 38% 35%); }
.th-st i.on { background: #ffd166; }
.th-tier { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #04121a; background: var(--tc, #8aa3c4); vertical-align: 1px; }
.th-card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 14px; border: 1px solid #1c2b4a; background: #050a18; color: #dfe9ff; font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; transition: border-color .15s; min-height: 56px; }
@media (hover: hover) { .th-card:hover { border-color: var(--th-accent); } }
.th-card-ic { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 11px; background: rgba(85,214,255,0.12); color: var(--th-accent); box-shadow: inset 0 0 0 1px rgba(85,214,255,0.35); }
.th-card-ic.hot { background: rgba(255,107,129,0.14); color: var(--th-hot); box-shadow: inset 0 0 0 1px rgba(255,107,129,0.4); }
.th-card-ic.warm { background: rgba(255,209,102,0.12); color: var(--th-warm); box-shadow: inset 0 0 0 1px rgba(255,209,102,0.4); }
.th-card-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.th-card-t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.th-card-t b { font-size: 15px; color: #fff; }
.th-card-t small { font-size: 12.5px; color: #8aa3c4; }
.th-card-t > [data-rg-daily] { align-self: flex-start; color: #8aa3c4; font-size: 12.5px; }
.th-card-s { font-size: 12px; font-weight: 800; color: #8aa3c4; white-space: nowrap; }
.th-card-s.ok { color: #3dffb5; }
.th-list { display: flex; flex-direction: column; gap: 8px; }

/* the daily panel: today, the streak and the last seven days */
.th-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-top: 6px; }
.th-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 6px; min-height: 64px; border-radius: 11px; border: 1px solid #1c2b4a; background: #050a18; color: #dfe9ff; font: inherit; cursor: pointer; touch-action: manipulation; }
.th-day small { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #6f84a3; }
.th-day b { font-size: 16px; font-weight: 900; color: #fff; line-height: 1.05; }
.th-day em { font-style: normal; font-size: 10px; font-weight: 700; color: #8aa3c4; white-space: nowrap; }
.th-day.today { border-color: var(--th-hot); box-shadow: inset 0 0 0 1px rgba(255,107,129,0.5); }
.th-day.done { background: rgba(61,255,181,0.07); }
@media (hover: hover) { .th-day:hover { border-color: var(--th-accent); } }
.th-dbest { margin: 8px 0 0 !important; min-height: 1.2em; color: #8aa3c4 !important; font-size: 12.5px !important; text-align: center; }

/* the result panel */
.th-panel .th-big { margin: 0 0 2px; font-size: 30px; font-weight: 900; line-height: 1.05; text-align: center; color: #fff; letter-spacing: 0.02em; text-shadow: 0 0 22px rgba(255,209,102,0.5); }
.th-panel .th-sub { margin: 0 0 10px !important; text-align: center; color: #8aa3c4 !important; font-size: 13px !important; }
.th-stars { display: flex; justify-content: center; gap: 6px; margin: 6px 0 8px; }
.th-stars svg { width: 38px; height: 38px; }
.th-stars .s-on { fill: #ffd166; filter: drop-shadow(0 0 8px rgba(255,209,102,.75)); animation: th-star .42s cubic-bezier(.2,1.5,.4,1) backwards; }
.th-stars .s-on:nth-child(2) { animation-delay: .22s; } .th-stars .s-on:nth-child(3) { animation-delay: .44s; }
.th-stars .s-off { fill: #1c2b4a; }
@keyframes th-star { from { transform: scale(0.2) rotate(-40deg); opacity: 0; } }
.th-tag { display: block; width: max-content; max-width: 100%; margin: 2px auto 8px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase;
  color: #1a1200; background: linear-gradient(90deg, #ffd166, #fff1b8, #ffd166); background-size: 200% 100%; animation: th-shine 1.6s linear infinite; box-shadow: 0 0 22px rgba(255,209,102,0.55); }
@keyframes th-shine { to { background-position: -200% 0; } }
.th-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 4px; }
.th-stats.three { grid-template-columns: repeat(3, 1fr); }
.th-stats div { padding: 8px 4px; border-radius: 10px; background: #050a18; border: 1px solid #16223d; text-align: center; min-width: 0; }
.th-stats span { display: block; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: #6f84a3; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-stats b { display: block; margin-top: 2px; font-size: 17px; color: #dfe9ff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.th-stats .gold b { color: #ffd166; } .th-stats .hot b { color: #ff8fab; } .th-stats .ok b { color: #3dffb5; }
.th-won { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; padding: 8px 10px; border-radius: 12px; background: rgba(255,209,102,0.08); border: 1px solid rgba(255,209,102,0.35); }
.th-won svg { width: 28px; height: 28px; flex: none; }
.th-won span { display: flex; flex-direction: column; min-width: 0; }
.th-won b { font-size: 13.5px; color: #ffe3a3; }
.th-won small { font-size: 12px; color: #b9c9e4; }

/* menu: themes and switches */
.th-themes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.th-theme { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 2px 6px; border-radius: 12px; border: 1px solid #1c2b4a; background: #050a18; color: #b9c9e4; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; touch-action: manipulation; min-height: 58px; }
.th-theme svg { width: 44px; height: 26px; }
.th-theme[aria-checked="true"] { border-color: var(--th-accent); box-shadow: inset 0 0 0 1px var(--th-accent); color: #fff; }
.th-tog { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 2px; }
.th-tog span { font-size: 14px; color: #dfe9ff; }
.th-tog small { display: block; font-size: 12px; color: #6f84a3; }
.th-switch { position: relative; width: 50px; height: 30px; flex: none; border-radius: 999px; border: 1px solid #24375e; background: #0b1328; cursor: pointer; padding: 0; transition: background .15s, border-color .15s; touch-action: manipulation; }
.th-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #6f84a3; transition: transform .15s, background .15s; }
.th-switch[aria-checked="true"] { background: rgba(85,214,255,0.25); border-color: var(--th-accent); }
.th-switch[aria-checked="true"]::after { transform: translateX(20px); background: var(--th-accent); }

/* how to play, and the trick */
.th-fig { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0 10px; }
.th-fig figure { margin: 0; padding: 6px 4px 5px; border-radius: 10px; background: #050a18; border: 1px solid #16223d; text-align: center; }
.th-fig svg { width: 100%; height: auto; display: block; }
.th-fig figcaption { margin-top: 3px; font-size: 11.5px; line-height: 1.3; color: #b9c9e4; }
.th-fig figcaption b { color: var(--th-accent); }
.th-keys { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0 0 8px; font-size: 13px; color: #b9c9e4; align-items: baseline; }
.th-keys dt { white-space: nowrap; } .th-keys dd { margin: 0; }
.th-tabs { display: flex; gap: 6px; margin: 0 0 10px; flex-wrap: wrap; }
.th-tab { flex: 1 1 auto; padding: 8px 10px; min-height: 40px; border-radius: 10px; border: 1px solid #1c2b4a; background: #050a18; color: #b9c9e4; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.th-tab[aria-selected="true"] { border-color: var(--th-accent); color: #fff; box-shadow: inset 0 0 0 1px var(--th-accent); }

/* records and medals */
.th-rec { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.th-rec th { padding: 4px 6px; font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #6f84a3; text-align: left; }
.th-rec td { padding: 5px 6px; color: #dfe9ff; border-top: 1px solid #16223d; white-space: nowrap; }
.th-rec td.dim { color: #4f6386; }
.th-rec td b { color: #fff; }
.th-medals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.th-medal { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 11px; background: #050a18; border: 1px solid #16223d; opacity: 0.55; min-width: 0; }
.th-medal.on { opacity: 1; border-color: rgba(255,209,102,0.4); background: rgba(255,209,102,0.06); }
.th-medal svg { width: 26px; height: 26px; flex: none; }
.th-medal span { display: flex; flex-direction: column; min-width: 0; }
.th-medal b { font-size: 12.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-medal small { font-size: 11px; line-height: 1.3; color: #8aa3c4; }

.th-toast[hidden] { display: none; }
.th-toast { position: absolute; left: 50%; bottom: calc(var(--th-bar) + 10px); transform: translateX(-50%); z-index: 7; padding: 8px 14px; border-radius: 999px; background: #dfe9ff; color: #04060f; font-size: 13px; font-weight: 800; animation: th-in .2s ease-out; pointer-events: none; white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; box-shadow: 0 8px 26px rgba(0,0,0,.5); }
.th-side .th-toast { bottom: 14px; }
.th-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.th-help { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 14px; }
.th-help .hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .th-help .hint-kb { display: none; } .th-help .hint-touch { display: inline; } }
.stage .th-help { padding: 10px 14px 12px; }

@media (max-width: 420px) {
  .th-row2 { gap: 6px; } .th-row2 .th-b { font-size: 13px; padding-left: 4px; padding-right: 4px; white-space: nowrap; }
  .th-panel { padding: 18px 14px 14px; }
  .th-sizes { gap: 5px; }
  .th-btn { font-size: 10.5px; }
  .th-bar { gap: 4px; padding: 0 4px; }
  .th-medals { grid-template-columns: 1fr; }
  .th-mcard { padding: 8px 8px; gap: 8px; }
  .th-mcard svg { width: 32px; height: 26px; }
  .th-mcard small { white-space: normal; line-height: 1.25; }
  .th-week { gap: 4px; } .th-day em { font-size: 9px; letter-spacing: -0.01em; }
}

/* full screen: the stage takes all the room there is */
.stage.is-immersive .stage-body > .th { min-height: 0; flex: 1 1 auto; }
.stage.is-immersive .th-stage { flex: 1 1 auto; height: auto; aspect-ratio: auto; max-height: none; min-height: 0; }
.stage.is-immersive .th-help { display: none; }
@media (prefers-reduced-motion: reduce) {
  .th-panel, .th-toast, .th-overlay, .th-coach.warn, .th-tag, .th-stars .s-on { animation: none; }
  .th-moves b, .th-switch::after { transition: none; }
}
@media (max-width: 350px) {
  .th-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .th-themes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
