/* How to Play (howto.js): a player with chapters. The stage is a 640x360 scene scaled to fit (--k); everything on it
   uses the current world's colours, so the animations look like the game you're playing. */

.howto-card { width: min(1080px, 100vw); }
.ht-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; padding: 16px 20px 20px; overflow: auto; }
.ht-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }

/* ---- the stage ---- */
.ht-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 16px;
    border: 1.5px solid var(--line);
    background: radial-gradient(120% 90% at 20% 10%, color-mix(in srgb, var(--accent) 12%, var(--surface-solid)), color-mix(in srgb, var(--accent-2) 8%, var(--surface-2)));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
    cursor: pointer;
    user-select: none;
    isolation: isolate;
}
.ht-stage:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 3px; }
.ht-world { position: absolute; left: 0; top: 0; width: 640px; height: 360px; transform: scale(var(--k, 1)); transform-origin: 0 0; font-family: var(--font-body); color: var(--ink); }
.ht-world > * { position: absolute; }
.ht-stage.paused .ht-world * { animation-play-state: paused !important; }
.ht-bigplay { position: absolute; inset: 0; margin: auto; z-index: 30; width: 74px; height: 74px; display: grid; place-items: center; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--ink) 72%, transparent); color: var(--surface-solid); cursor: pointer; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); transition: transform .2s; }
.ht-bigplay:hover { transform: scale(1.06); }
.ht-bigplay svg { width: 34px; height: 34px; fill: currentColor; margin-left: 4px; }

/* ---- the controls under it ---- */
.ht-bar { display: flex; align-items: center; gap: 8px; }
.ht-ctl { flex-shrink: 0; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1.5px solid var(--line); border-radius: 50%; background: var(--surface-2); color: var(--ink); cursor: pointer; transition: background .2s, transform .2s; }
.ht-ctl:hover { background: var(--hover); transform: translateY(-1px); }
.ht-ctl svg { width: 16px; height: 16px; fill: currentColor; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ht-play { width: 42px; height: 42px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ht-play:hover { background: var(--accent); }
.ht-play svg { width: 18px; height: 18px; }
.ht-segs { flex: 1; display: flex; gap: 4px; min-width: 0; }
.ht-seg { flex: 1; height: 16px; padding: 5px 0; border: 0; background: none; cursor: pointer; }
.ht-seg::before { content: ""; display: block; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 14%, transparent); }
.ht-seg i { display: block; height: 6px; margin-top: -6px; width: 0; border-radius: 3px; background: var(--accent); }
.ht-seg.done i { width: 100% !important; }
.ht-count { flex-shrink: 0; min-width: 3.4em; text-align: right; color: var(--muted); font: 800 .82rem var(--font-body); font-variant-numeric: tabular-nums; }
/* on a small screen the stage is too small for its own subtitles: they show here, under it, instead */
.ht-cap { display: none; min-height: 1.4em; margin: -2px 0 0; color: var(--ink); font: 800 .95rem/1.35 var(--font-body); text-align: center; }
.ht-main.small .ht-cap { display: block; }
.ht-main.small .ht-sub { display: none; }
.ht-now h3 { margin: 2px 0 4px; font: 800 1.15rem/1.2 var(--font-body); }
.ht-now p { margin: 0; color: color-mix(in srgb, var(--ink) 82%, var(--muted)); font-size: .93rem; line-height: 1.5; }

/* ---- the chapter list ---- */
.ht-side { min-height: 0; }
.ht-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ht-ch { position: relative; width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; overflow: hidden; border: 1.5px solid transparent; border-radius: 12px; background: none; color: var(--ink); font: 700 .92rem var(--font-body); text-align: left; cursor: pointer; transition: background .2s; }
.ht-ch:hover { background: var(--hover); }
.ht-ch.on { background: color-mix(in srgb, var(--accent) 12%, var(--surface-solid)); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.ht-chn { flex-shrink: 0; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--muted); font: 800 .78rem var(--font-body); }
.ht-ch.on .ht-chn { background: var(--accent); color: var(--accent-ink); }
.ht-chbar { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--accent); }
.ht-ch:not(.on) .ht-chbar { display: none; }

@media (max-width: 820px) {
    .ht-body { grid-template-columns: 1fr; padding: 0 14px 18px; }
    /* the player stays at the top while the chapters scroll under it */
    .ht-main { position: sticky; top: 0; z-index: 2; padding: 12px 0 10px; background: var(--surface-solid); box-shadow: 0 10px 12px -10px rgba(0, 0, 0, .18); }
    .ht-now p { font-size: .86rem; }
    .ht-list { display: grid; grid-template-columns: 1fr 1fr; }
    .ht-ch { padding: 8px 10px; font-size: .86rem; }
}
@media (max-width: 420px) { .ht-list { grid-template-columns: 1fr; } }

/* ================================ the pieces on the stage ================================ */
.ht-sub {
    left: 50%; bottom: 12px; z-index: 20;
    max-width: 560px; padding: 7px 16px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ink) 84%, transparent);
    color: var(--surface-solid);
    font: 800 15px/1.3 var(--font-body);
    text-align: center;
    white-space: nowrap;
    transform: translateX(-50%);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
    opacity: 0;
}
.ht-sub.in { animation: ht-sub-in .35s ease-out forwards; }
@keyframes ht-sub-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
.sub-side .ht-sub { left: 300px; right: 24px; bottom: auto; top: 140px; max-width: none; white-space: normal; border-radius: 16px; padding: 12px 16px; font-size: 18px; transform: none; text-align: left; }
.sub-side .ht-sub.in { animation-name: ht-side-in; }
@keyframes ht-side-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.ht-pop { animation: ht-pop .4s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes ht-pop { from { transform: scale(.6); opacity: 0; } }
.ht-flash { animation: ht-flash .6s ease-out; }
@keyframes ht-flash { 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 55%, transparent); transform: scale(1.04); } }
.ht-shake { animation: ht-shake .45s; }
@keyframes ht-shake { 20% { transform: translateX(-6px) rotate(-2deg); } 40% { transform: translateX(6px) rotate(2deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
.ht-flip { animation: ht-flip .45s ease; }
@keyframes ht-flip { 50% { transform: perspective(400px) rotateY(90deg); } }
.ht-tap { animation: ht-tap .3s ease-out; }
@keyframes ht-tap { 40% { background: var(--sel); transform: scale(.9); } }
.ht-fade { animation: ht-fade .45s ease-out; }
@keyframes ht-fade { from { opacity: .2; } }
.ht-slide { animation: ht-slide .55s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes ht-slide { from { transform: translateX(-40px); opacity: 0; } }

/* the pointer, the finger and a click */
.ht-cursor { z-index: 25; width: 26px; height: 26px; margin: -3px 0 0 -6px; opacity: 0; transition: opacity .25s; pointer-events: none; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35)); }
.ht-cursor.on { opacity: 1; }
.ht-cursor svg { width: 100%; height: 100%; fill: #fff; stroke: #1d1d24; stroke-width: 1.6; stroke-linejoin: round; transition: transform .12s; transform-origin: 20% 10%; }
.ht-cursor.press svg { transform: scale(.82); }
.ht-finger { z-index: 25; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: rgba(255, 255, 255, .55); border: 2px solid rgba(30, 30, 40, .55); box-shadow: 0 4px 10px rgba(0, 0, 0, .25); opacity: 0; transition: opacity .25s, transform .12s; pointer-events: none; }
.ht-finger.on { opacity: 1; }
.ht-finger.press { transform: scale(.8); }
.ht-ripple { z-index: 24; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; border: 3px solid var(--accent); box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent); animation: ht-ripple .5s ease-out forwards; pointer-events: none; }
.ht-ripple::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid #fff; opacity: .8; animation: ht-ripple .5s ease-out .08s both; }
@keyframes ht-ripple { to { transform: scale(5); opacity: 0; } }

/* keys lighting up */
.ht-keys { right: 16px; bottom: 54px; z-index: 21; display: flex; gap: 6px; }
.ht-key { min-width: 38px; height: 38px; padding: 0 10px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-solid); color: var(--ink); border: 1.5px solid var(--line); border-bottom-width: 4px; font: 900 17px var(--font-body); box-shadow: 0 6px 14px rgba(0, 0, 0, .18); animation: ht-key .3s cubic-bezier(.2, 1.6, .4, 1); }
.ht-key.wide { font-size: 14px; }
.ht-key.out { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
/* it rises, gets pressed down (glowing in the accent colour) and springs back */
@keyframes ht-key { 0% { transform: translateY(10px) scale(.7); opacity: 0; } 45% { transform: translateY(0); } 65% { transform: translateY(3px); border-bottom-width: 1.5px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent), 0 0 16px color-mix(in srgb, var(--accent) 50%, transparent); background: color-mix(in srgb, var(--accent) 14%, var(--surface-solid)); } }

.ht-float { z-index: 22; font: 900 18px var(--font-body); color: var(--accent); transform: translate(-50%, -50%); animation: ht-float 1.3s cubic-bezier(.2, 1.4, .4, 1) forwards; pointer-events: none; text-shadow: 0 0 8px currentColor, 0 2px 0 var(--surface-solid); }
.ht-float.bad { color: var(--wrong); }
@keyframes ht-float { from { opacity: 0; } 15% { opacity: 1; } to { opacity: 0; translate: 0 -34px; } }
.ht-dot { z-index: 22; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c), 0 0 12px var(--c); animation: ht-dot .8s cubic-bezier(.15, .8, .3, 1) forwards; pointer-events: none; }
.ht-dot.spark { width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 0; box-shadow: none; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); filter: drop-shadow(0 0 4px var(--c)); }
@keyframes ht-dot { 0% { transform: scale(0) rotate(0); } 25% { transform: translate(calc(var(--dx) * .55), calc(var(--dy) * .55)) scale(var(--s, 1)) rotate(var(--r, 0deg)); opacity: 1; } to { transform: translate(var(--dx), calc(var(--dy) + 10px)) scale(.2) rotate(calc(var(--r, 0deg) * 2)); opacity: 0; } }
.ht-flash-dot { z-index: 21; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; background: radial-gradient(circle, #fff 0%, var(--c) 30%, transparent 70%); animation: ht-flash-dot .45s ease-out forwards; pointer-events: none; mix-blend-mode: screen; }
@keyframes ht-flash-dot { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.ht-banner { left: 0; right: 0; top: 130px; z-index: 23; text-align: center; font: 700 calc(54px * var(--head-scale)) var(--font-head); color: var(--accent); text-shadow: 0 4px 0 var(--surface-solid), 0 8px 24px rgba(0, 0, 0, .25); animation: ht-banner .5s cubic-bezier(.2, 1.6, .4, 1); }
.ht-banner.good { color: var(--good); }
.ht-banner.out { opacity: 0; transition: opacity .3s; }
/* a sweep of light runs across the words */
.ht-banner { background: linear-gradient(105deg, currentColor 40%, #fff 50%, currentColor 60%) 0 0 / 300% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: ht-banner .5s cubic-bezier(.2, 1.6, .4, 1), ht-sheen 1.2s ease-out .25s both; filter: drop-shadow(0 4px 0 var(--surface-solid)) drop-shadow(0 8px 14px rgba(0, 0, 0, .25)); text-shadow: none; }
@keyframes ht-sheen { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes ht-banner { from { transform: scale(.4); opacity: 0; } }
.ht-stamp { z-index: 6; padding: 8px 16px; border: 3px solid var(--good); border-radius: 10px; background: var(--surface-solid); color: var(--good); font: 900 18px var(--font-body); transform: translate(-50%, -50%) rotate(-8deg); box-shadow: 0 8px 20px rgba(0, 0, 0, .2); white-space: nowrap; }
/* it slams down: big and tilted, then hard onto the board with a little bounce */
.ht-stamp.ht-pop { animation: ht-stamp .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes ht-stamp { 0% { transform: translate(-50%, -50%) rotate(-20deg) scale(2.2); opacity: 0; } 55% { transform: translate(-50%, -50%) rotate(-8deg) scale(.92); opacity: 1; } }
.ht-tag { padding: 7px 14px; border-radius: 999px; background: var(--surface-solid); border: 1.5px solid var(--line); font: 800 14px var(--font-body); white-space: nowrap; box-shadow: var(--shadow); }
.ht-tag.good { border-color: var(--good); color: var(--good); }

/* the board: the game's own .board and .cell, sized for the stage */
.ht-world .board.ht-board { aspect-ratio: auto; padding: 2px; gap: 2px; }
.ht-world .board.ht-board .cell { font-size: calc(var(--hc) * .6); cursor: inherit; }
.ht-world .board.ht-board .cell .num { top: 2px; left: 3px; font-size: calc(var(--hc) * .22); }
.ht-world .board.ht-board .cell.selected::after { font-size: calc(var(--hc) * .3); }
.ht-world .board.ht-board .cell.locked::before, .ht-world .board.ht-board .cell.revealed::before { width: calc(var(--hc) * .3); height: calc(var(--hc) * .3); top: 2px; right: 2px; }
.ht-world .board.ht-board .cell .hit-mark::after { width: 14px; height: 14px; top: -5px; right: -5px; font-size: 9px; }
.ht-board.ht-out { transition: transform .5s ease-in, opacity .5s; transform: translateX(-80px) scale(.8); opacity: 0; }
.ht-board.ht-in { animation: ht-board-in .6s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes ht-board-in { from { transform: translateX(80px) scale(.85); opacity: 0; } }
.ht-board.ht-glow { box-shadow: 0 0 0 4px var(--accent), 0 0 30px color-mix(in srgb, var(--accent) 60%, transparent); }
.ht-blot { position: absolute; inset: 12%; z-index: 5; border-radius: 47% 53% 42% 58%; background: radial-gradient(circle at 35% 30%, #4a4458, #15121c 70%); box-shadow: 0 2px 6px rgba(0, 0, 0, .4); transition: transform .25s, opacity .25s; }
.ht-blot.gone { transform: scale(0); opacity: 0; }

.ht-cluebar { height: 38px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 10px; background: var(--surface-solid); border: 1.5px solid var(--line); font: 700 14px var(--font-body); box-shadow: var(--shadow); overflow: hidden; white-space: nowrap; }
.ht-cluebar b { padding: 2px 8px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-size: 13px; }
.ht-cluebar b:empty { display: none; }
.ht-clues { padding: 8px 14px 10px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow); }
.ht-clues h4 { margin: 2px 0 3px; font: 700 calc(19px * var(--head-scale)) var(--font-head); }
.ht-clues ol { list-style: none; margin: 0 0 4px; padding: 0; }
.ht-clues li { display: flex; gap: 8px; padding: 3px 8px; border-radius: 7px; font: 600 13.5px/1.25 var(--font-body); transition: background .2s; }
.ht-clues li b { min-width: 14px; text-align: right; font-weight: 900; }
.ht-clues li.on { background: var(--word); }
.ht-clues li.done span { text-decoration: line-through; opacity: .55; }

/* Check and Reveal */
.ht-helpers { display: flex; flex-direction: column; gap: 8px; }
.ht-hrow { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--line); }
.ht-hlabel { width: 56px; font: 800 13px var(--font-body); color: var(--muted); }
.ht-hbtn { flex: 1; padding: 7px 6px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); font: 800 13px var(--font-body); pointer-events: none; }
.ht-penalty { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: 12px; background: var(--surface-solid); border: 1.5px solid var(--line); }
.ht-penalty small { color: var(--muted); font: 800 13px var(--font-body); }
.ht-penalty b { font: 900 20px var(--font-body); color: var(--wrong); }
.ht-ask { display: flex; flex-direction: column; gap: 3px; padding: 10px 14px; border-radius: 12px; background: var(--surface-solid); border: 1.5px solid var(--line); box-shadow: 0 10px 26px rgba(0, 0, 0, .22); }
.ht-ask b { font: 800 14px var(--font-body); }
.ht-ask small { color: var(--muted); font: 600 12.5px var(--font-body); }

/* the phone */
.ht-phone { padding: 10px; border-radius: 28px; background: #1d1d24; box-shadow: 0 16px 34px rgba(0, 0, 0, .35); }
.ht-phone::before { content: ""; position: absolute; inset: 8px; border-radius: 21px; background: var(--bg); }
.ht-phone > * { position: relative; }
.ht-pbar { display: flex; align-items: center; gap: 4px; height: 36px; margin: 8px 6px 0; padding: 0 4px; border-radius: 9px; background: var(--surface-solid); border: 1px solid var(--line); }
.ht-parrow { width: 22px; text-align: center; font: 900 18px var(--font-body); color: var(--accent); border-radius: 6px; }
.ht-pclue { flex: 1; min-width: 0; font: 700 10.5px/1.2 var(--font-body); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ht-phone .ht-board { position: absolute; }
.ht-pkeys { position: absolute; left: 10px; right: 10px; bottom: 16px; display: flex; flex-direction: column; gap: 4px; }
.ht-prow { display: flex; justify-content: center; gap: 2px; }
.ht-pkey { width: 15px; height: 24px; display: grid; place-items: center; border-radius: 4px; background: var(--surface-solid); color: var(--ink); font: 800 9px var(--font-body); box-shadow: 0 1px 0 var(--line); }
.ht-pkey.wide { width: 22px; font-size: 11px; background: var(--hover); }

/* daily chips, a clock, the streak */
.ht-chips { display: flex; gap: 10px; }
.ht-chip { position: relative; flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 14px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.ht-chip b { font: 700 calc(21px * var(--head-scale)) var(--font-head); }
.ht-chip small { color: var(--muted); font: 800 12px var(--font-body); }
.ht-chip.challenge { border-color: #e8b33a; }
.ht-chip.boss { padding-left: 58px; }
.ht-chip.boss .ht-boss { position: absolute; left: 4px; top: 50%; width: 50px; height: 50px; transform: translateY(-50%); }
.ht-chip.done { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--surface-2)); }
.ht-chip.done small { color: var(--good); }
.ht-clock { padding: 8px 14px; border-radius: 10px; background: var(--ink); color: var(--surface-solid); font: 900 20px var(--font-body); font-variant-numeric: tabular-nums; }
.ht-streak { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 999px; background: var(--surface-solid); border: 2px solid var(--fire-2); box-shadow: var(--shadow); }
.ht-streak b { font: 900 30px var(--font-body); }
.ht-streak small { color: var(--muted); font: 800 14px var(--font-body); }
.ht-flame { font-size: 28px; }

/* points */
.ht-tiers { display: flex; gap: 10px; }
.ht-tier { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 2px solid var(--line); transition: border-color .3s, background .3s; }
.ht-tier small { color: var(--muted); font: 800 12px var(--font-body); }
.ht-tier b { font: 900 22px var(--font-body); }
.ht-tier.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface-2)); }
.ht-score { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border-radius: 16px; background: var(--surface-solid); border: 1.5px solid var(--line); box-shadow: 0 12px 30px rgba(0, 0, 0, .18); }
.ht-srow { display: flex; justify-content: space-between; padding: 5px 4px; font: 700 15px var(--font-body); border-radius: 8px; transition: opacity .3s; }
.ht-srow b { font-variant-numeric: tabular-nums; }
.ht-srow.total { margin-top: 4px; padding-top: 9px; border-top: 1.5px solid var(--line); font-size: 18px; }
.ht-srow.check b { color: var(--wrong); }
.ht-score.small .ht-srow { padding: 3px 4px; font-size: 13.5px; }

/* leaderboard */
.ht-lb { display: flex; flex-direction: column; gap: 5px; }
.ht-lbrow { display: grid; grid-template-columns: 2em 1fr auto; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 10px; background: var(--surface-solid); border: 1.5px solid var(--line); font: 700 14px var(--font-body); transition: opacity .4s, transform .4s; }
.ht-lbrow i { font-style: normal; font-weight: 900; color: var(--muted); text-align: right; }
.ht-lbrow.me { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface-solid)); }
.ht-lbrow.gone { opacity: 0; transform: translateY(10px); }
.ht-lbform { display: flex; gap: 8px; align-items: center; }
.ht-input { flex: 1; height: 38px; display: flex; align-items: center; padding: 0 14px; border-radius: 999px; background: var(--surface-solid); border: 1.5px solid var(--line); font: 700 15px var(--font-body); }
.ht-input:empty::before { content: attr(data-ph); color: var(--muted); font-weight: 600; }
.ht-input.small { flex: 0 0 52px; justify-content: center; }
.ht-input.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.ht-post, .ht-btn { height: 38px; padding: 0 18px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--ink); font: 800 14px var(--font-body); pointer-events: none; }
.ht-post, .ht-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* the campaign map */
.ht-map { background: linear-gradient(160deg, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 60%); }
.ht-path { position: absolute; inset: 0; width: 100%; height: 100%; }
.ht-path path { fill: none; stroke: color-mix(in srgb, var(--ink) 30%, transparent); stroke-width: 5; stroke-dasharray: 2 12; stroke-linecap: round; }
.ht-node { width: 44px; height: 44px; margin: -22px 0 0 -22px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-solid); border: 3px solid var(--line); font: 900 17px var(--font-body); box-shadow: var(--shadow); transition: border-color .3s, background .3s; }
.ht-node.done { border-color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--surface-solid)); }
.ht-node.boss { width: 76px; height: 76px; margin: -38px 0 0 -38px; padding: 4px; border-color: var(--accent); }
.ht-node.boss .ht-boss { position: static; width: 100%; height: 100%; }
.ht-token { margin: -23px 0 0 -23px; z-index: 3; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .3)); }
.ht-skill { transform: translateX(-50%); padding: 2px 9px; border-radius: 999px; background: var(--surface-solid); border: 1.5px solid var(--line); font: 800 11.5px var(--font-body); white-space: nowrap; }
.ht-stars { transform: translateX(-50%); color: #f2b417; font-size: 18px; letter-spacing: 1px; text-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.ht-coins { padding: 6px 12px; border-radius: 999px; background: var(--surface-solid); border: 1.5px solid var(--line); font: 900 15px var(--font-body); }

/* worlds */
.ht-tools { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); }
.ht-tool { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font: 900 15px var(--font-body); }
.ht-preview { overflow: hidden; border-radius: 14px; border: 2px solid var(--line); background: var(--surface-2); box-shadow: 0 14px 30px rgba(0, 0, 0, .25); transition: opacity .4s; }
.ht-preview canvas { display: block; width: 100%; height: 100%; }
.ht-pname { position: absolute; left: 10px; bottom: 10px; padding: 5px 12px; border-radius: 999px; background: var(--surface-solid); font: 800 14px var(--font-body); }
.ht-mode { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1.5px solid var(--line); }
.ht-mode span { padding: 4px 14px; border-radius: 999px; color: var(--muted); font: 800 13px var(--font-body); transition: background .3s, color .3s; }
.ht-mode span.on { background: var(--accent); color: var(--accent-ink); }

/* boss fights: the race bar, the warning box, the boss's panel and board, abilities */
.ht-race { height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border-radius: 14px; background: var(--surface-solid); border: 1.5px solid var(--line); box-shadow: var(--shadow); transition: box-shadow .3s; }
.ht-rside { display: flex; align-items: center; gap: 6px; }
.ht-rside .ht-face { position: static; }
.ht-rside .ht-boss { position: static; width: 36px; height: 36px; }
.ht-rpct { min-width: 38px; font: 900 15px var(--font-body); font-variant-numeric: tabular-nums; }
.ht-rtrack { position: relative; flex: 1; height: 16px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: visible; }
.ht-rfill { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.ht-rfill.me { left: 0; background: var(--good); }
.ht-rfill.boss { right: 0; background: var(--boss, var(--wrong)); }
.ht-rlead { position: absolute; left: 50%; top: 20px; transform: translateX(-50%); padding: 0 8px; border-radius: 999px; background: var(--surface-solid); color: var(--muted); font: 800 10.5px var(--font-body); white-space: nowrap; }
.ht-race.danger { box-shadow: 0 0 0 3px var(--wrong), 0 0 24px color-mix(in srgb, var(--wrong) 50%, transparent); }
.ht-race.rage .ht-rside.boss .ht-boss { filter: drop-shadow(0 0 6px #ff3b30) saturate(1.4); animation: ht-shake .5s 2; }
.ht-warn { z-index: 8; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 14px 8px; overflow: hidden; border-radius: 12px; background: #23202b; color: #fff; text-align: center; box-shadow: 0 8px 20px rgba(0, 0, 0, .3); }
.ht-warn[hidden] { display: none; }
.ht-warn b { font: 900 14px var(--font-body); }
.ht-warn small { opacity: .85; font: 700 11.5px var(--font-body); }
.ht-warn i { position: absolute; left: 0; bottom: 0; height: 3px; background: #ff6b5e; }
.ht-warn[data-tone="good"] { background: #1f6b3d; }
.ht-warn[data-tone="mine"] { background: color-mix(in srgb, var(--accent) 80%, #000); }
.ht-warn[data-tone="close"], .ht-warn[data-tone="rage"] { background: #a01f2e; }
.ht-bpanel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: 16px; background: color-mix(in srgb, var(--boss, var(--accent)) 10%, var(--surface-solid)); border: 1.5px solid var(--line); box-shadow: var(--shadow); }
.ht-boss { line-height: 0; }
.ht-boss svg { width: 100%; height: 100%; }
.ht-boss.big { position: static; width: 120px; height: 120px; transition: filter .4s; }
.ht-boss.frozen { filter: hue-rotate(160deg) saturate(.6) brightness(1.15) drop-shadow(0 0 10px #8fd8ff); }
.ht-boss.ko { opacity: .5; transform: rotate(-12deg); transition: opacity .4s, transform .4s; }
.ht-boss.ht-mid { width: 90px; height: 90px; }
.ht-freeze { padding: 3px 12px; border-radius: 999px; background: #2a7fc0; color: #fff; font: 900 13px var(--font-body); }
.ht-bboard { display: grid; grid-template-columns: repeat(var(--n), var(--bc)); gap: 2px; padding: 2px; border-radius: 5px; background: var(--grid); }
.ht-bcell { width: var(--bc); height: var(--bc); border-radius: 2px; background: var(--cell); transition: background .25s; }
.ht-bcell.on { background: color-mix(in srgb, var(--boss, var(--wrong)) 75%, var(--cell)); }
.ht-bcell.block { background: var(--block); }
.ht-phases { display: flex; gap: 8px; padding: 4px 10px; border-radius: 999px; background: var(--surface-solid); border: 1.5px solid var(--line); }
.ht-phases i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); transition: background .3s; }
.ht-phases i.on { background: var(--accent); }
.ht-target::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .85); animation: ht-spin 2.4s linear infinite; }
@keyframes ht-spin { to { transform: rotate(1turn); } }
.ht-target { z-index: 15; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: radial-gradient(circle, #fff 0 18%, #e2283c 19% 38%, #fff 39% 58%, #e2283c 59% 78%, #fff 79%); box-shadow: 0 0 0 3px #fff, 0 8px 18px rgba(0, 0, 0, .35); animation: ht-pulse 0.8s ease-in-out infinite alternate; }
.ht-tcount { position: absolute; left: 50%; top: 100%; margin-top: 6px; transform: translateX(-50%); padding: 1px 8px; border-radius: 999px; background: #23202b; color: #fff; font: 900 11px var(--font-body); white-space: nowrap; }
@keyframes ht-pulse { to { transform: scale(1.1); } }
.ht-proj { z-index: 16; font-size: 30px; line-height: 1; transform: translate(-50%, -50%); filter: drop-shadow(0 0 8px rgba(255, 255, 255, .9)) drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); pointer-events: none; }
.ht-close::after { content: ""; position: absolute; inset: 0; z-index: 12; pointer-events: none; box-shadow: inset 0 0 0 6px rgba(226, 40, 60, .85), inset 0 0 60px rgba(226, 40, 60, .55); animation: ht-beat 0.9s ease-in-out infinite alternate; }
@keyframes ht-beat { from { opacity: .45; } to { opacity: 1; } }
.ht-abil { display: flex; flex-direction: column; gap: 6px; }
.ht-abil.row { flex-direction: row; }
.ht-acard { position: relative; flex: 1; display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--surface-solid); border: 2px solid color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: var(--shadow); }
.ht-aic { grid-row: span 2; font-size: 26px; text-align: center; }
.ht-acard b { font: 800 13px/1.15 var(--font-body); }
.ht-acard small { color: var(--muted); font: 700 11px var(--font-body); }
.ht-abil.row .ht-acard { grid-template-columns: 1fr; text-align: center; justify-items: center; padding: 12px 8px; }
.ht-abil.row .ht-aic { grid-row: auto; font-size: 32px; }

/* attempts, the lose card, Give Up, items */
.ht-attempt { display: flex; flex-direction: column; align-items: center; padding: 8px; border-radius: 12px; background: var(--surface-solid); border: 2px solid var(--good); }
.ht-attempt.lost { border-color: var(--wrong); }
.ht-attempt b { font: 900 15px var(--font-body); }
.ht-attempt small { color: var(--muted); font: 700 12px var(--font-body); }
.ht-losecard, .ht-starcard { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 18px 18px; border-radius: 18px; background: var(--surface-solid); border: 1.5px solid var(--line); box-shadow: 0 14px 34px rgba(0, 0, 0, .22); }
.ht-losecard .ht-boss, .ht-starcard .ht-boss { position: static; width: 110px; height: 110px; }
.ht-losecard small, .ht-starcard small { color: var(--muted); font: 800 12px var(--font-body); }
.ht-losecard b, .ht-starcard b { font: 700 calc(26px * var(--head-scale)) var(--font-head); text-align: center; }
.ht-btns { display: flex; gap: 8px; margin-top: 8px; }
.ht-meter { position: relative; width: 100%; height: 14px; margin: 6px 0 2px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 10%, transparent); }
.ht-mfill { height: 100%; width: 0; border-radius: 999px; background: var(--boss, var(--wrong)); }
.ht-mline { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: .4; }
.ht-mline.a { left: 60%; } .ht-mline.b { left: 85%; }
.ht-bigstars { color: #f2b417; font-size: 34px; letter-spacing: 4px; text-shadow: 0 2px 0 rgba(0, 0, 0, .2); }
.ht-giveup { padding: 7px 0; border-radius: 10px; border: 1.5px solid #f0a4ae; background: var(--surface-solid); color: #a3283a; font: 800 13px var(--font-body); text-align: center; }
.ht-items { display: flex; gap: 8px; padding: 8px 10px; border-radius: 14px; background: var(--surface-solid); border: 1.5px solid var(--line); box-shadow: var(--shadow); }
.ht-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 4px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); pointer-events: none; }
.ht-item span { font-size: 20px; line-height: 1.1; }
.ht-item small { font: 800 10.5px var(--font-body); white-space: nowrap; }
.ht-face { display: block; }

/* reduce motion: the stage's own animations are user-started, but the loops (pulses, beats) stay still */
@media (prefers-reduced-motion: reduce) {
    .ht-target, .ht-close::after { animation: none; }
}

/* the sound menu */
.ht-sound { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px; border-radius: 16px; background: var(--surface-solid); border: 1.5px solid var(--line); box-shadow: 0 16px 34px rgba(0, 0, 0, .25); transition: opacity .3s; }
.ht-srow2 { display: flex; align-items: center; gap: 9px; font: 700 13px var(--font-body); }
.ht-switch { position: relative; width: 32px; height: 18px; border-radius: 999px; background: var(--surface-2); border: 1.5px solid var(--line); transition: background .2s; }
.ht-switch::after { content: ""; position: absolute; top: 1.5px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); transition: transform .25s, background .2s; }
.ht-switch.on { background: var(--accent); border-color: var(--accent); }
.ht-switch.on::after { transform: translateX(13px); background: var(--accent-ink); }
.ht-slider { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; font: 700 13px var(--font-body); }
.ht-slider b { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ht-track { grid-column: 1 / -1; position: relative; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 15%, transparent); }
.ht-tfill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }
.ht-knob { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.ht-shead { padding-top: 6px; border-top: 1.5px solid var(--line); color: var(--muted); font: 800 11px var(--font-body); }
