/* Hangman: the sky and the picture are one canvas filling the stage; the HUD, the word, the keyboard, the coach line,
   the result card and the panels are HTML over it. On wide screens the word and keyboard sit in a column on the right. */
.hm { display: flex; flex-direction: column; color: #e9e8ff; --hm-hud: 54px; --hm-col: min(48%, 560px); --hm-accent: #55d6ff; --hm-mint: #5ff2c4; --hm-pink: #ff7ab6; --hm-gold: #ffd166;
  --hm-line: #262a5e; --hm-glass: rgba(12,10,38,0.82); --hm-kh: 50px; --hm-wh: 96px; }
.hm-stage { position: relative; width: 100%; height: min(86vh, 800px); min-height: 520px; background: #08081f; overflow: hidden; outline: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (max-width: 600px) { .hm-stage { height: auto; aspect-ratio: 9 / 16.5; max-height: 88vh; min-height: 0; } }
#hm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }

/* HUD */
.hm-hud { position: absolute; left: 0; right: 0; top: 0; height: var(--hm-hud); display: flex; align-items: center; gap: 14px; padding: 0 8px 0 10px; z-index: 3; pointer-events: none; }
.hm-hud > * { pointer-events: auto; }
.hm-pz { flex: 0 1 auto; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; position: relative; height: 44px; padding: 2px 26px 2px 10px; border-radius: 12px;
  border: 1px solid var(--hm-line); background: var(--hm-glass); color: #fff; cursor: pointer; font: inherit; line-height: 1.05; touch-action: manipulation; text-align: left; transition: border-color .15s; max-width: 48vw; min-width: 104px; }
.hm-pz-k { font-size: 10px; font-weight: 800; letter-spacing: 0.15em; text-transform: uppercase; color: #a9a3e6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hm-pz-n { font-size: 17px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hm-pz-dd { position: absolute; right: 6px; top: 50%; width: 16px; height: 16px; margin-top: -8px; fill: none; stroke: #a9a3e6; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .hm-pz:hover { border-color: var(--hm-accent); } }
.hm-pz:focus-visible { outline: 2px solid var(--hm-accent); outline-offset: 2px; }
.hm-stat { display: flex; flex-direction: column; line-height: 1.05; flex: none; }
.hm-k { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #a9a3e6; white-space: nowrap; }
.hm-stat b { font-size: 21px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-block; transform-origin: left center; transition: color .2s; }
.hm-stat small { font-size: 12.5px; font-weight: 700; color: #a9a3e6; margin-left: 3px; }
.hm-misses b.pop { animation: hm-bump .3s cubic-bezier(.3,1.6,.5,1); }
.hm-misses.warn b { color: #ffb0cf; }
.hm-sp { flex: 1 1 auto; }
.hm-tool { position: relative; display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid var(--hm-line); background: var(--hm-glass);
  color: #d0d2ff; cursor: pointer; touch-action: manipulation; padding: 0; transition: border-color .15s, color .15s; }
.hm-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hm-tool .spk { fill: currentColor; stroke: none; }
@media (hover: hover) { .hm-tool:hover { border-color: var(--hm-accent); color: #fff; } }
.hm-tool:focus-visible { outline: 2px solid var(--hm-accent); outline-offset: 2px; }
#hm-sound .off { display: none; } #hm-sound[aria-pressed="true"] { color: #6d6fa8; } #hm-sound[aria-pressed="true"] .on { display: none; } #hm-sound[aria-pressed="true"] .off { display: inline; }
.hm-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--hm-pink); box-shadow: 0 0 8px var(--hm-pink); }
.hm-dot[hidden] { display: none; }

/* the coach line: a first tip or a hint */
.hm-coach[hidden] { display: none; }
.hm-coach { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--hm-hud) + 4px); z-index: 4; width: min(calc(100% - 20px), 520px); padding: 8px 34px 8px 12px; border-radius: 12px;
  background: rgba(12,10,38,0.92); border: 1px solid rgba(167,123,255,0.5); box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 13.5px; line-height: 1.38; color: #e9e8ff; animation: hm-drop .22s ease-out; }
.hm-side .hm-coach { left: calc((100% - var(--hm-col)) / 2); width: min(calc(100% - var(--hm-col) - 24px), 460px); }
@keyframes hm-drop { from { opacity: 0; transform: translate(-50%, -6px); } }
.hm-coach b { color: #c9b2ff; font-weight: 800; margin-right: 6px; }
.hm-coach.hint { border-color: rgba(255,209,102,0.6); } .hm-coach.hint b { color: var(--hm-gold); }
.hm-coach.tip { border-color: rgba(85,214,255,0.55); } .hm-coach.tip b { color: var(--hm-accent); }
.hm-coach small { display: block; color: #a9a3e6; font-size: 12px; margin-top: 2px; }
.hm-coach-close { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: #a9a3e6; font-size: 19px; line-height: 1; cursor: pointer; }
@media (hover: hover) { .hm-coach-close:hover { color: #fff; background: rgba(255,255,255,.08); } }

/* the word and the keyboard */
.hm-play { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 8px calc(9px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(10,8,34,0) 0, rgba(10,8,34,.62) 22px, rgba(9,7,30,.9) 60px, rgba(8,7,26,.95)); }
.hm-side .hm-play { left: auto; top: var(--hm-hud); width: var(--hm-col); justify-content: center; gap: 12px; padding: 14px 18px 18px 28px;
  background: linear-gradient(90deg, rgba(9,7,30,0) 0, rgba(9,7,30,.45) 60px, rgba(9,7,30,.72) 140px, rgba(9,7,30,.82)); }
.hm-clue { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; max-width: 100%; min-height: 24px; }
.hm-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; background: rgba(85,214,255,0.12); border: 1px solid rgba(85,214,255,0.4);
  font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #cdf3ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70vw; }
.hm-chip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; }
.hm-len { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: #a9a3e6; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hm-word { --s: 36px; --g: 5px; --sp: 20px; width: 100%; height: var(--hm-wh); display: flex; flex-wrap: wrap; align-content: center; justify-content: center; column-gap: var(--sp); row-gap: calc(var(--s) * .32); }
.hm-w { display: inline-flex; gap: var(--g); }
.hm-t { position: relative; flex: none; width: var(--s); height: calc(var(--s) * 1.18); display: grid; place-items: center; border-radius: calc(var(--s) * .16);
  background: rgba(255,255,255,.055); box-shadow: inset 0 calc(var(--s) * -0.08) 0 #7c74d8; transition: background .25s, box-shadow .25s; }
.hm-t b { font-size: calc(var(--s) * .66); font-weight: 900; color: #fff; line-height: 1; font-variant-numeric: tabular-nums; }
.hm-t.on { background: rgba(95,242,196,.14); box-shadow: inset 0 calc(var(--s) * -0.08) 0 var(--hm-mint), 0 0 14px rgba(95,242,196,.14); }
.hm-t.hint { background: rgba(255,209,102,.16); box-shadow: inset 0 calc(var(--s) * -0.08) 0 var(--hm-gold); } .hm-t.hint b { color: #ffe6a8; }
.hm-t.miss { background: rgba(255,122,182,.15); box-shadow: inset 0 calc(var(--s) * -0.08) 0 var(--hm-pink); } .hm-t.miss b { color: #ffc0dc; }
.hm-t.mark { width: calc(var(--s) * .48); background: none; box-shadow: none; } .hm-t.mark b { color: #c9c5f5; }
.hm-t.pop { animation: hm-bump .45s ease-out both; }
.hm-t.pop b { animation: hm-in .42s cubic-bezier(.3,1.5,.5,1) both; animation-delay: inherit; }
.hm-cheer .hm-t:not(.mark) { animation: hm-wave .7s ease-in-out both; animation-delay: calc(var(--i, 0) * 55ms + 150ms); }
@keyframes hm-bump { 40% { transform: scale(1.14); } }
@keyframes hm-in { from { opacity: 0; transform: translateY(-35%) scale(.5); } }
@keyframes hm-wave { 35% { transform: translateY(-22%); } 70% { transform: translateY(4%); } }
.hm-keys { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 560px; }
.hm-row { display: flex; gap: 5px; justify-content: center; }
.hm-key { position: relative; flex: 1 1 0; min-width: 0; max-width: 52px; height: var(--hm-kh); padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 10px;
  border: 1px solid #2c3172; background: linear-gradient(180deg, #232966, #161a4a); color: #fff; font: 800 clamp(14px, calc(var(--hm-kh) * .37), 21px)/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer; touch-action: manipulation; box-shadow: 0 2px 0 #0a0b26; transition: background .2s, color .2s, border-color .2s, transform .07s, opacity .2s; }
.hm-key svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .hm-key:hover:not([aria-disabled="true"]) { border-color: var(--hm-accent); } }
.hm-key:active:not([aria-disabled="true"]), .hm-key.down { transform: translateY(2px); box-shadow: none; }
.hm-key:focus-visible { outline: 2px solid #fff; outline-offset: 1px; z-index: 1; }
.hm-key.ok { background: linear-gradient(180deg, #7dffd6, #2fc196); color: #04281e; border-color: transparent; box-shadow: 0 2px 0 #12664f; }
.hm-key.no { background: #0c0d29; color: #4b4f82; border-color: #181b45; box-shadow: none; }
.hm-key.no::after { content: ""; position: absolute; left: 26%; right: 26%; top: 50%; height: 2px; border-radius: 1px; background: #4b4f82; transform: rotate(-24deg); }
.hm-key.hint { background: linear-gradient(180deg, #ffe7a0, #ffc23d); color: #2a1800; border-color: transparent; box-shadow: 0 2px 0 #9a6b12; }
.hm-key.flash { animation: hm-glow .9s ease-out; }
.hm-key.shake { animation: hm-shake .32s ease-in-out; }
@keyframes hm-glow { 0%, 60% { box-shadow: 0 0 0 3px rgba(255,209,102,.8), 0 0 20px rgba(255,209,102,.6); } }
@keyframes hm-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.hm-wide { flex: 1.55 1 0; max-width: 80px; font-size: clamp(12px, calc(var(--hm-kh) * .29), 15px); letter-spacing: 0.02em; }
.hm-k-hint { color: #ffe3a3; border-color: rgba(255,209,102,.45); }
.hm-k-solve { color: #bdf0ff; border-color: rgba(85,214,255,.45); }
.hm-wide.off { opacity: .38; }
.hm-badge { position: absolute; top: 3px; right: 4px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--hm-gold); color: #2a1800; font: 900 10px/15px system-ui, sans-serif; font-style: normal; }
.hm-badge[hidden] { display: none; }
.hm-over .hm-key:not(.hm-wide) { cursor: default; }
.hm-over .hm-key:not(.ok):not(.no):not(.hint):not(.hm-wide) { opacity: .5; }

/* the result card: over the keyboard, so the picture stays in view; the word and keys behind it fade out so their
   edges never peek out around the card (the card shows the answer) */
.hm-card[hidden] { display: none; }
.hm-play > * { transition: opacity .3s; }
.hm-carded .hm-play > * { opacity: 0; pointer-events: none; }
.hm-card { --cx: -50%; position: absolute; left: 50%; bottom: 8px; transform: translateX(var(--cx)); z-index: 4; width: min(calc(100% - 16px), 460px); padding: 12px 12px 10px; border-radius: 18px;
  background: rgba(11,9,36,0.95); border: 1px solid rgba(167,123,255,0.4); box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 40px rgba(85,214,255,.12); animation: hm-up .35s cubic-bezier(.2,.9,.25,1.1);
  max-height: calc(100% - var(--hm-hud) - 20px); overflow: auto; overscroll-behavior: contain; }
.hm-side .hm-card { --cx: 0px; left: auto; right: max(12px, calc((var(--hm-col) - 460px) / 2)); width: min(calc(var(--hm-col) - 28px), 460px); bottom: max(12px, calc((100% - var(--hm-hud)) / 2 - 170px)); }
@keyframes hm-up { from { opacity: 0; transform: translate(var(--cx), 24px); } }
.hm-card-top { display: flex; align-items: center; gap: 12px; }
.hm-card-top > div { flex: 1 1 auto; min-width: 0; }
.hm-card h2 { margin: 0; font-size: 20px; font-weight: 900; color: #fff; letter-spacing: 0.01em; text-transform: none; line-height: 1.15; text-shadow: 0 0 22px rgba(167,123,255,.5); }
.hm-card p { margin: 3px 0 0; font-size: 13px; color: #a9a3e6; line-height: 1.4; }
.hm-medal { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font-size: 23px; background: radial-gradient(circle at 35% 30%, rgba(255,209,102,.4), rgba(255,209,102,.06) 70%); box-shadow: inset 0 0 0 1px rgba(255,209,102,.45); }
.hm-medal.loss { background: radial-gradient(circle at 35% 30%, rgba(255,122,182,.38), rgba(255,122,182,.06) 70%); box-shadow: inset 0 0 0 1px rgba(255,122,182,.45); }
.hm-answer { display: flex; flex-direction: column; align-items: center; gap: 1px; margin: 8px 0 0 !important; padding: 6px 10px; border-radius: 12px; background: rgba(95,242,196,.08); border: 1px solid rgba(95,242,196,.3); text-align: center; }
.hm-answer span { font-size: 20px; font-weight: 900; letter-spacing: 0.12em; color: #fff; word-break: break-word; }
.hm-answer small { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #a9a3e6; }
.hm-answer.loss { background: rgba(255,122,182,.08); border-color: rgba(255,122,182,.32); } .hm-answer.loss span { color: #ffd0e4; }
.hm-card .hm-stats { margin: 8px 0 0; }
.hm-card .hm-stats div { padding: 5px 4px; }
.hm-card .hm-stats b { font-size: 16px; }
.hm-card-act { display: flex; gap: 6px; margin-top: 10px; }
.hm-card-act .hm-b-primary { flex: 2.1 1 0; min-width: 0; padding: 8px 8px; gap: 6px; font-size: 15px; }
.hm-b-ic { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; min-height: 46px; padding: 4px 4px; font-size: 11px; }
.hm-b-ic svg { width: 18px; height: 18px; }

/* panels */
.hm-overlay[hidden] { display: none; }
.hm-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 6; overflow: auto;
  background: radial-gradient(ellipse at center, rgba(6,5,22,0.55), rgba(4,3,14,0.88)); animation: hm-fade .18s ease-out; }
.hm-panel { position: relative; width: min(100%, 440px); margin: auto; padding: 20px 18px 18px; border: 1px solid var(--hm-line); border-radius: 18px; text-align: left; outline: none;
  background: rgba(11,9,36,0.96); box-shadow: 0 20px 60px rgba(0,0,0,0.55); animation: hm-pin .26s cubic-bezier(.2,.9,.25,1.1); }
.hm-panel.wide { width: min(100%, 600px); }
@keyframes hm-pin { from { opacity: 0; transform: scale(.95) translateY(8px); } }
@keyframes hm-fade { from { opacity: 0; } }
.hm-panel h2 { margin: 0 38px 12px 0; font-size: 20px; font-weight: 900; color: #fff; letter-spacing: 0.01em; text-transform: none; line-height: 1.25; }
.hm-panel h3 { margin: 14px 0 8px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: #a9a3e6; }
.hm-panel p, .hm-panel li { font-size: 13.5px; line-height: 1.5; color: #c4c2ee; }
.hm-panel p { margin: 0 0 8px; }
.hm-panel kbd { display: inline-block; min-width: 1.4em; padding: 0 5px; border-radius: 5px; border: 1px solid #343a7c; background: #0e0f2e; color: #fff; font: 700 12px/1.6 system-ui, sans-serif; text-align: center; }
.hm-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 0; background: rgba(255,255,255,.07); color: #d6d6ff; cursor: pointer; padding: 0; z-index: 2; }
.hm-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
@media (hover: hover) { .hm-x:hover { background: rgba(255,255,255,.14); color: #fff; } }
.hm-x:focus-visible { outline: 2px solid var(--hm-accent); outline-offset: 2px; }
.hm-fine { font-size: 12px !important; color: #7d7fb4 !important; margin: 8px 0 0 !important; }
.hm-center { text-align: center; }
.hm-center h2 { margin-right: 0; }

.hm-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.hm-row2 { display: flex; gap: 8px; } .hm-row2 > * { flex: 1 1 0; min-width: 0; }
.hm-b { font: inherit; font-weight: 700; font-size: 14.5px; padding: 10px 14px; min-height: 46px; border-radius: 12px; cursor: pointer; touch-action: manipulation; text-decoration: none;
  border: 1px solid var(--hm-line); background: #11123a; color: #e9e8ff; transition: background .15s, border-color .15s, transform .1s, filter .15s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
@media (hover: hover) { .hm-b:hover:not(:disabled) { border-color: var(--hm-accent); } }
.hm-b:active:not(:disabled) { transform: translateY(1px); }
.hm-b:disabled { opacity: .45; cursor: default; }
.hm-b:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.hm-b svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hm-b span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-b-primary { background: linear-gradient(135deg, #ffd166, #ffb347); color: #2a1600; border-color: transparent; font-size: 16px; font-weight: 800; box-shadow: 0 6px 22px rgba(255,190,90,0.3); }
@media (hover: hover) { .hm-b-primary:hover:not(:disabled) { border-color: transparent; filter: brightness(1.07); } }
.hm-b-warm { border-color: rgba(255,122,182,.55); color: #ffd0e4; }
.hm-b-sm { min-height: 40px; padding: 6px 10px; font-size: 13px; }

/* the hub: words or phrases, difficulty, categories, other modes */
.hm-two { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.hm-two .hm-seg { flex: 1 1 200px; }
.hm-segnote { flex: 1 1 200px; margin: 0 !important; }
.hm-seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #0a0a26; border: 1px solid var(--hm-line); }
.hm-seg button { flex: 1 1 0; min-width: 0; min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: #a9a3e6; font: 700 13px system-ui, -apple-system, sans-serif; cursor: pointer; white-space: nowrap; padding: 0 6px; }
.hm-seg button[aria-checked="true"] { background: #1d1c55; color: #fff; box-shadow: inset 0 0 0 1px rgba(167,123,255,.55); }
.hm-seg button:focus-visible { outline: 2px solid var(--hm-accent); outline-offset: 1px; }
.hm-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.hm-cat { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 70px; padding: 8px 4px 6px; border-radius: 13px; border: 1px solid #1d1f4f; background: #0a0a26;
  color: #e9e8ff; font: inherit; cursor: pointer; touch-action: manipulation; text-align: center; transition: border-color .15s, background .15s; }
.hm-cat i { font-style: normal; font-size: 22px; line-height: 1.1; }
.hm-cat b { font-size: 12px; font-weight: 800; line-height: 1.2; }
.hm-cat small { font-size: 10.5px; color: #7d7fb4; font-weight: 700; }
.hm-cat[aria-checked="true"] { border-color: var(--hm-accent); background: radial-gradient(120% 120% at 50% 0%, rgba(85,214,255,.2), transparent 70%), #0d0f30; box-shadow: 0 0 16px rgba(85,214,255,.2); }
@media (hover: hover) { .hm-cat:hover { border-color: rgba(85,214,255,.6); } }
.hm-cat:focus-visible { outline: 2px solid var(--hm-accent); outline-offset: 2px; }
.hm-hubs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.hm-hubc { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 92px; padding: 12px 12px 10px; border-radius: 15px; border: 1px solid var(--hm-line);
  background: radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--hc) 22%, transparent), transparent 60%), #0a0a26; color: #e9e8ff; font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; transition: border-color .15s; overflow: hidden; }
.hm-hubc svg { width: 26px; height: 26px; fill: none; stroke: var(--hc); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 2px; }
.hm-hubc b { font-size: 15px; color: #fff; } .hm-hubc small { font-size: 12px; color: #a9a3e6; line-height: 1.35; }
.hm-hubc em { position: absolute; top: 10px; right: 12px; font-style: normal; font-size: 11.5px; font-weight: 800; color: var(--hc); font-variant-numeric: tabular-nums; }
@media (hover: hover) { .hm-hubc:hover { border-color: var(--hc); } }
.hm-hubc:focus-visible { outline: 2px solid var(--hc); outline-offset: 2px; }

/* stats */
.hm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 4px; }
.hm-stats.three { grid-template-columns: repeat(3, 1fr); }
.hm-stats div { padding: 8px 4px; border-radius: 10px; background: #0a0a26; border: 1px solid #1b1d4a; text-align: center; min-width: 0; }
.hm-stats span { display: block; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: #7d7fb4; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-stats b { display: block; margin-top: 2px; font-size: 17px; color: #e9e8ff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hm-stats .gold b { color: var(--hm-gold); } .hm-stats .hot b { color: #ffb0cf; } .hm-stats .ok b { color: #7dffd6; }
.hm-dist { display: flex; flex-direction: column; gap: 4px; }
.hm-bar { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: #a9a3e6; font-variant-numeric: tabular-nums; }
.hm-bar i { display: block; width: var(--w); min-width: 22px; height: 20px; border-radius: 6px; background: linear-gradient(90deg, #2fc196, #7dffd6); text-align: right; font-style: normal; }
.hm-bar i.z { background: #1b1d4a; }
.hm-bar i b { display: inline-block; padding: 0 6px; line-height: 20px; color: #04281e; font-size: 11.5px; }
.hm-bar i.z b { color: #7d7fb4; }
.hm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hm-table th, .hm-table td { padding: 6px 4px; text-align: right; border-bottom: 1px solid #1b1d4a; font-variant-numeric: tabular-nums; }
.hm-table th:first-child, .hm-table td:first-child { text-align: left; }
.hm-table thead th { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #7d7fb4; }
.hm-table tbody th { color: #fff; font-weight: 700; }
.hm-table td { color: #d6d6ff; }

/* calendar */
.hm-cal-head { display: flex; align-items: center; gap: 8px; margin: 12px 0 6px; }
.hm-cal-head b { flex: 1 1 auto; text-align: center; color: #fff; font-size: 15px; }
.hm-step { width: 42px; height: 42px; flex: none; display: grid; place-items: center; padding: 0; border-radius: 10px; border: 1px solid #2c3172; background: #11123a; color: #e9e8ff; cursor: pointer; }
.hm-step svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hm-step:disabled { opacity: .35; cursor: default; }
.hm-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.hm-cal-w { text-align: center; font-size: 10.5px; font-weight: 800; color: #7d7fb4; padding: 2px 0; }
.hm-cal-d { position: relative; aspect-ratio: 1; display: grid; place-items: center; border-radius: 9px; border: 1px solid #1b1d4a; background: #0a0a26; color: #d6d6ff; font: 700 13px system-ui, sans-serif; cursor: pointer; padding: 0; }
.hm-cal-d.off { opacity: .28; cursor: default; }
.hm-cal-d.won { background: rgba(95,242,196,0.13); border-color: rgba(95,242,196,0.55); color: #7dffd6; }
.hm-cal-d.lost { background: rgba(255,122,182,0.12); border-color: rgba(255,122,182,0.5); color: #ffb0cf; }
.hm-cal-d.half { border-style: dashed; border-color: rgba(255,209,102,0.6); color: var(--hm-gold); }
.hm-cal-d.today { box-shadow: 0 0 0 2px var(--hm-accent), 0 0 14px rgba(85,214,255,.4); }
.hm-cal-pad { aspect-ratio: 1; }
@media (hover: hover) { .hm-cal-d:not(.off):hover { border-color: var(--hm-accent); } }
.hm-cal-d:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.hm-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hm-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-left: 6px; border: 1px solid; }
.hm-legend i:first-child { margin-left: 0; }
.hm-legend .won { background: rgba(95,242,196,0.2); border-color: var(--hm-mint); } .hm-legend .lost { background: rgba(255,122,182,0.2); border-color: var(--hm-pink); } .hm-legend .half { border-style: dashed; border-color: var(--hm-gold); }

/* settings, tabs, help */
.hm-sets { margin-top: 6px; }
.hm-set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #1b1d4a; cursor: pointer; position: relative; }
.hm-set span { display: flex; flex-direction: column; gap: 2px; } .hm-set b { font-size: 14px; color: #fff; } .hm-set small { font-size: 12px; color: #a9a3e6; }
.hm-set input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hm-sw { position: relative; width: 46px; height: 27px; flex: none; border-radius: 14px; border: 1px solid #2c3172; background: #11123a; transition: background .15s, border-color .15s; }
.hm-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #6d6fa8; transition: transform .15s, background .15s; }
.hm-set input:checked + .hm-sw { background: #123f37; border-color: var(--hm-mint); }
.hm-set input:checked + .hm-sw::after { transform: translateX(19px); background: var(--hm-mint); box-shadow: 0 0 10px rgba(95,242,196,.6); }
.hm-set input:focus-visible + .hm-sw { outline: 2px solid var(--hm-accent); outline-offset: 2px; }
.hm-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 13px; background: #0a0a26; border: 1px solid var(--hm-line); margin: 0 0 12px; }
.hm-tab { font: inherit; font-size: 13.5px; font-weight: 700; color: #a9a3e6; background: transparent; border: 0; border-radius: 9px; min-height: 38px; cursor: pointer; }
.hm-tab[aria-selected="true"] { background: #1d1c55; color: #fff; box-shadow: inset 0 0 0 1px rgba(167,123,255,0.55); }
.hm-tab:focus-visible { outline: 2px solid var(--hm-accent); outline-offset: 1px; }
.hm-howto { display: grid; grid-template-columns: 112px 1fr; gap: 10px 12px; align-items: center; margin: 2px 0 8px; }
.hm-howto p { margin: 0; }
.hm-demo { display: flex; gap: 3px; justify-content: center; font-size: 26px; --s: 15px; --hm-kh: 30px; }
.hm-demo .hm-t b { font-size: 10px; }
.hm-demo.keys .hm-key { flex: none; width: 28px; height: 30px; font-size: 13px; cursor: default; }

/* two players and forms */
.hm-names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 10px; }
.hm-names label, .hm-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #a9a3e6; }
.hm-field small { text-transform: none; letter-spacing: 0; font-weight: 600; color: #7d7fb4; font-size: 11.5px; }
.hm-names input, .hm-field input { width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 11px; border: 1px solid #2c3172; background: #07071f; color: #fff; font: 700 16px system-ui, -apple-system, sans-serif; letter-spacing: 0.02em; text-transform: none; }
.hm-names input:focus, .hm-field input:focus { outline: none; border-color: var(--hm-accent); box-shadow: 0 0 0 3px rgba(85,214,255,.2); }
.hm-form { display: flex; flex-direction: column; gap: 10px; }
.hm-pw { position: relative; display: block; }
.hm-pw input { padding-right: 48px; letter-spacing: 0.14em; }
.hm-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; border-radius: 9px; background: transparent; color: #a9a3e6; cursor: pointer; display: grid; place-items: center; }
.hm-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hm-eye:focus-visible { outline: 2px solid var(--hm-accent); }
.hm-err { min-height: 1.2em; margin: 0 !important; color: #ffb0cf !important; font-size: 13px !important; font-weight: 700; }
.hm-score { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 4px 0 6px; padding: 10px; border-radius: 14px; background: #0a0a26; border: 1px solid #1b1d4a; }
.hm-score div { display: flex; flex-direction: column; align-items: center; min-width: 0; flex: 1 1 0; }
.hm-score b { font-size: 30px; font-weight: 900; color: #fff; font-variant-numeric: tabular-nums; line-height: 1.05; }
.hm-score span { font-size: 12px; font-weight: 700; color: #a9a3e6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hm-score i { font-style: normal; color: #4b4f82; font-size: 24px; font-weight: 900; }
.hm-score.sm { margin-top: 8px; padding: 6px; } .hm-score.sm b { font-size: 22px; }
.hm-hand { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; margin-bottom: 8px; background: radial-gradient(circle at 35% 30%, rgba(85,214,255,.35), rgba(85,214,255,.05) 70%); color: var(--hm-accent); }
.hm-hand svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hm-pattern { margin: 4px 0 10px !important; padding: 10px; border-radius: 11px; background: #07071f; border: 1px solid #1b1d4a; text-align: center; font: 800 18px/1.5 ui-monospace, Menlo, monospace !important; color: #fff !important; letter-spacing: 0.04em; white-space: pre-wrap; word-break: break-word; }

.hm-toast[hidden] { display: none; }
.hm-toast { position: absolute; left: 50%; top: calc(var(--hm-hud) + 66px); transform: translateX(-50%); z-index: 7; padding: 8px 14px; border-radius: 999px; background: #efeeff; color: #120f3a; font-size: 13px; font-weight: 800;
  animation: hm-drop .2s ease-out; pointer-events: none; white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.hm-side .hm-toast { left: calc((100% - var(--hm-col)) / 2); }
.hm-sheet .hm-toast { left: 50%; top: auto; bottom: 14px; animation-name: hm-fade; }
.hm-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

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

/* short wide screens (a phone on its side): a wider word-and-keys column so the keys stay big enough to tap; the
   picture needs less width there because its height is what limits it */
@media (max-height: 500px) {
  .hm { --hm-col: min(60%, 560px); }
  .hm-side .hm-play { padding-left: 20px; padding-right: 12px; }
}

/* narrow phones */
@media (max-width: 460px) {
  .hm-hud { gap: 9px; padding-left: 8px; padding-right: 6px; }
  .hm-pz { padding-right: 22px; padding-left: 8px; min-width: 96px; }
  .hm-pz-n { font-size: 15.5px; }
  .hm-stat b { font-size: 19px; }
  .hm-tool { width: 36px; height: 36px; border-radius: 11px; }
  .hm-row { gap: 4px; } .hm-keys { gap: 5px; }
  .hm-key { border-radius: 8px; }
  .hm-panel { padding: 18px 14px 14px; }
  .hm-stats b { font-size: 15px; }
  .hm-howto { grid-template-columns: 88px 1fr; }
  .hm-hubs { grid-template-columns: 1fr; }
  .hm-hubc { min-height: 0; }
  .hm-cats { grid-template-columns: repeat(3, 1fr); }
}
.hm-narrow-only { display: none; }
@media (max-width: 400px) {
  .hm-streak { display: none; }
  .hm-hud { gap: 7px; }
  .hm-pz { padding-left: 7px; padding-right: 20px; }
  .hm-pz-n { font-size: 15px; }
  .hm-pz-k { letter-spacing: 0.07em; }
  .hm-wide-only { display: none; } .hm-narrow-only { display: inline; }
  .hm-card-act .hm-b-primary { font-size: 14px; }
}
@media (max-width: 350px) { #hm-sound { display: none; } }

/* full screen: the sky takes every pixel */
.stage.is-immersive .stage-body > .hm { min-height: 0; flex: 1 1 auto; }
.stage.is-immersive .hm-stage { flex: 1 1 auto; height: auto; aspect-ratio: auto; max-height: none; min-height: 0; }
.stage.is-immersive .hm-help { display: none; }
@media (prefers-reduced-motion: reduce) {
  .hm-panel, .hm-toast, .hm-coach, .hm-overlay, .hm-card, .hm-t.pop, .hm-t.pop b, .hm-cheer .hm-t, .hm-key.flash, .hm-key.shake, .hm-misses b.pop { animation: none !important; }
}
.hm-calm .hm-panel, .hm-calm .hm-toast, .hm-calm .hm-coach, .hm-calm .hm-overlay, .hm-calm .hm-card, .hm-calm .hm-t.pop, .hm-calm .hm-t.pop b, .hm-calm .hm-cheer .hm-t, .hm-calm .hm-key.shake { animation: none !important; }
