/* «Как играть» (static/common/js/howto.js): the button, the steps dialog, the demos and the TV panel.
   Every game keeps its own look: the colours come from [data-game] / [data-howto] below. */

/* ── The button ─────────────────────────────────────── */
.htp-open {
  --ob-bg: rgba(255, 255, 255, .07);
  --ob-line: rgba(255, 255, 255, .25);
  --ob-text: inherit;
  --ob-icon: #fff;
  --ob-icon-text: #111;
  display: inline-flex;
  align-items: center;
  gap: .45em;
  min-height: 36px;
  padding: .25em .9em .25em .3em;
  border: 1px solid var(--ob-line);
  border-radius: 999px;
  background: var(--ob-bg);
  color: var(--ob-text);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s, border-color .2s, transform .15s;
}
.htp-open:hover { border-color: var(--ob-icon); }
.htp-open:active { transform: scale(.96); }
.htp-open:focus-visible { outline: 2px solid var(--ob-icon); outline-offset: 2px; }
.htp-open-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55em;
  height: 1.55em;
  border-radius: 50%;
  background: var(--ob-icon);
  color: var(--ob-icon-text);
  font-weight: 800;
  font-size: .95em;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.htp-open[data-howto="fantasium"] { --ob-bg: rgba(252, 211, 77, .08); --ob-line: rgba(252, 211, 77, .4); --ob-text: #fde68a; --ob-icon: #fcd34d; --ob-icon-text: #0a2622; }
.htp-open[data-howto="quiz"] { --ob-bg: rgba(167, 139, 250, .1); --ob-line: rgba(167, 139, 250, .5); --ob-text: #ddd6fe; --ob-icon: #a78bfa; --ob-icon-text: #140f3d; }
.htp-open[data-howto="mafia"] { --ob-bg: rgba(255, 255, 255, .6); --ob-line: #c4a96c; --ob-text: #6a3414; --ob-icon: #c05030; --ob-icon-text: #fff8ee; font-family: 'Cinzel', serif; font-size: .82rem; letter-spacing: .02em; }
body.night-mode .htp-open[data-howto="mafia"] { --ob-bg: rgba(255, 255, 255, .08); --ob-line: rgba(240, 185, 58, .5); --ob-text: #f0d48a; --ob-icon: #f0b93a; --ob-icon-text: #1a2840; }
.htp-open[data-howto="dungeon"] { --ob-bg: rgba(212, 160, 23, .08); --ob-line: rgba(212, 160, 23, .45); --ob-text: #f0c040; --ob-icon: #d4a017; --ob-icon-text: #1a1206; font-family: 'Cinzel', serif; font-size: .82rem; }

/* A first-time visitor: three soft pulses, once (howto.js remembers it). */
.htp-open--hint { animation: htp-hint 1.8s ease-in-out .8s 3; }
@keyframes htp-hint {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ob-icon) 28%, transparent), 0 0 18px color-mix(in srgb, var(--ob-icon) 45%, transparent); }
}

/* Where the button sits on the start pages: next to the way back to the hub. */
.htp-toprow { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; }
.htp-toprow .htp-open { margin-left: auto; }
.lobby-howto { display: flex; justify-content: center; margin-top: .7rem; }

/* ── Themes ─────────────────────────────────────────── */
.htp, .htp-tv {
  --htp-bg: linear-gradient(180deg, #1c1f2b, #11131b);
  --htp-text: #f2f2f5;
  --htp-muted: rgba(242, 242, 245, .66);
  --htp-line: rgba(255, 255, 255, .12);
  --htp-line-strong: rgba(255, 255, 255, .28);
  --htp-accent: #fcd34d;
  --htp-accent2: #6ee7b7;
  --htp-accent-text: #111;
  --htp-btn: #4f46e5;
  --htp-btn-text: #fff;
  --htp-stage: #0d0f16;
  --htp-surface: rgba(255, 255, 255, .07);
  --htp-tv-bg: rgba(0, 0, 0, .38);
  --htp-phone: #12141b;
  --htp-head-font: inherit;
}
[data-game="fantasium"] {
  --htp-bg: linear-gradient(180deg, #10453c 0%, #0a2622 55%, #061714 100%);
  --htp-text: #ecfdf5;
  --htp-muted: rgba(236, 253, 245, .7);
  --htp-accent: #fcd34d;
  --htp-accent2: #6ee7b7;
  --htp-accent-text: #0a2622;
  --htp-btn: linear-gradient(135deg, #059669, #0d9488);
  --htp-stage: radial-gradient(120% 90% at 20% 0%, #13594e 0%, #0a2622 60%, #051311 100%);
  --htp-phone: #0b2b26;
}
[data-game="quiz"] {
  --htp-bg: linear-gradient(180deg, #251b63 0%, #140f3d 55%, #0b0a24 100%);
  --htp-text: #f0f0f0;
  --htp-muted: rgba(255, 255, 255, .64);
  --htp-accent: #fbbf24;
  --htp-accent2: #86efac;
  --htp-accent-text: #140f3d;
  --htp-btn: linear-gradient(135deg, #7c3aed, #6366f1);
  --htp-stage: radial-gradient(120% 95% at 50% 0%, #3d2394 0%, #17104a 55%, #0a0a1a 100%);
  --htp-phone: #120e38;
}
[data-game="mafia"] {
  --htp-bg: linear-gradient(180deg, #faf6ee 0%, #f2ead9 100%);
  --htp-text: #2a1e0a;
  --htp-muted: #6e5c3e;
  --htp-line: #dccfb4;
  --htp-line-strong: #c4a96c;
  --htp-accent: #c05030;
  --htp-accent2: #4e6e28;
  --htp-accent-text: #fff8ee;
  --htp-btn: linear-gradient(180deg, #c8593a, #a03820);
  --htp-btn-text: #fff8ee;
  --htp-stage: linear-gradient(180deg, #e3f0f5 0%, #f5f0e8 70%);
  --htp-surface: rgba(255, 255, 255, .6);
  --htp-tv-bg: #1a2840;
  --htp-phone: #f5f0e8;
  --htp-head-font: 'Cinzel', Georgia, serif;
}
[data-game="dungeon"] {
  --htp-bg: linear-gradient(180deg, #22223c 0%, #14141f 60%, #0e0e18 100%);
  --htp-text: #e8e0d0;
  --htp-muted: #b3a98f;
  --htp-line: rgba(212, 160, 23, .22);
  --htp-line-strong: rgba(212, 160, 23, .5);
  --htp-accent: #f0c040;
  --htp-accent2: #7ee2a8;
  --htp-accent-text: #1a1206;
  --htp-btn: linear-gradient(180deg, #e2b234, #a8790c);
  --htp-btn-text: #1a1206;
  --htp-stage: radial-gradient(120% 95% at 50% 0%, #2c2648 0%, #16162a 65%, #0e0e18 100%);
  --htp-phone: #16162a;
  --htp-head-font: 'Cinzel', Georgia, serif;
}

/* ── The dialog: a bottom sheet on a phone, a dialog in the middle of a wide screen ── */
html.htp-locked, html.htp-locked body { overflow: hidden; }
.htp[hidden] { display: none; }
.htp {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3000;
  color: var(--htp-text);
  font-size: 16px;
  line-height: 1.4;
  text-align: left;
}
.htp *, .htp *::before, .htp *::after { box-sizing: border-box; }
.htp h2, .htp h3, .htp p { margin: 0; padding: 0; }
.htp button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.htp button:focus-visible { outline: 2px solid var(--htp-accent); outline-offset: 2px; }
.htp-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(4, 6, 12, .58);
  opacity: 0;
  transition: opacity .25s;
}
.htp.is-open .htp-backdrop { opacity: 1; }
.htp-dialog {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: calc(100% - 12px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px 0 0;
  background: var(--htp-bg);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .45);
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.2, .8, .2, 1);
  outline: none;
}
.htp.is-open .htp-dialog { transform: none; }
.htp-grip { width: 42px; height: 4px; margin: 6px auto 2px; border-radius: 2px; background: var(--htp-line-strong); }
.htp-head { display: flex; align-items: center; gap: 10px; padding: 4px 0 10px; }
.htp-title { flex: 1; font-family: var(--htp-head-font); font-size: 1rem; font-weight: 700; letter-spacing: .01em; color: var(--htp-muted); }
.htp-x {
  flex: none;
  width: 40px;
  height: 40px;
  margin-right: -6px;
  border-radius: 50%;
  font-size: 1.05rem !important;
  color: var(--htp-muted) !important;
  transition: background .2s;
}
.htp-x:hover { background: var(--htp-surface) !important; }

.htp-viewport { overflow: hidden; touch-action: pan-y; }
.htp-track { display: flex; transition: transform .38s cubic-bezier(.2, .8, .2, 1); will-change: transform; }
.htp-track.is-still, .htp-track.is-dragging { transition: none; }
.htp-slide { flex: 0 0 100%; min-width: 0; }
.htp-stage {
  position: relative;
  width: 100%;
  max-width: max(220px, calc((100vh - 270px) * 1.5));
  margin: 0 auto;
  overflow: hidden;
  border-radius: 16px;
  background: var(--htp-stage);
  box-shadow: inset 0 0 0 1px var(--htp-line);
  -webkit-user-select: none;
  user-select: none;
}
.htp-stage::before { content: ''; display: block; padding-top: 66.6667%; }
.htp-art { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.htp-copy { display: flex; gap: 12px; align-items: flex-start; padding: 14px 2px 0; }
.htp-num {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--htp-accent);
  color: var(--htp-accent-text);
  font-weight: 800;
  font-size: .95rem;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.htp-words { min-width: 0; }
.htp-step-title { font-family: var(--htp-head-font); font-size: 1.15rem; font-weight: 800; line-height: 1.25; color: var(--htp-text); }
.htp-step-text { margin-top: 3px; font-size: .98rem; line-height: 1.4; color: var(--htp-muted); }

.htp-foot { display: flex; align-items: center; gap: 10px; padding-top: 16px; }
.htp-prev {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--htp-line-strong) !important;
  font-size: 1.5rem !important;
  line-height: 1;
  padding-bottom: 3px !important;
  transition: opacity .2s;
}
.htp-prev:disabled { opacity: .3; cursor: default; }
.htp-dots { flex: 1; display: flex; justify-content: center; align-items: center; gap: 2px; }
.htp-dot { width: 18px; height: 28px; position: relative; padding: 0 !important; }
.htp-dot::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 4px;
  background: var(--htp-line-strong);
  transition: width .25s, margin .25s, background .25s;
}
.htp-dot.is-on::before { width: 18px; margin-left: -9px; background: var(--htp-accent); }
.htp-next {
  flex: none;
  min-width: 118px;
  height: 46px;
  padding: 0 20px !important;
  border-radius: 999px;
  background: var(--htp-btn) !important;
  color: var(--htp-btn-text) !important;
  font-weight: 800 !important;
  font-size: 1rem !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  transition: transform .15s, filter .2s;
}
.htp-next:active { transform: scale(.96); }
.htp-next:hover { filter: brightness(1.08); }
.htp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 640px) and (min-height: 540px) {
  .htp-dialog {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: min(560px, calc(100vw - 48px));
    max-height: calc(100% - 48px);
    padding: 10px 24px 22px;
    border-radius: 22px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
    transform: translate(-50%, -47%) scale(.97);
    opacity: 0;
    transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .22s;
  }
  .htp.is-open .htp-dialog { transform: translate(-50%, -50%); opacity: 1; }
  .htp-grip { display: none; }
  .htp-head { padding-top: 8px; }
}

/* ── Demos: a 360×240 stage, scaled to fit by howto.js ── */
.htp-demo {
  position: absolute;
  top: 0;
  left: 0;
  width: 360px;
  height: 240px;
  transform-origin: 0 0;
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--htp-text);
  font-family: inherit;
  overflow: hidden;
}
.htp-demo *, .htp-demo *::before, .htp-demo *::after { box-sizing: border-box; }
.htp-av { display: inline-block; flex: none; width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }
.htp-av-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--htp-accent);
  color: var(--htp-accent-text);
  font-weight: 800;
  font-size: 10px;
}
.htp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--htp-btn);
  color: var(--htp-btn-text);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  transition: transform .15s, opacity .25s, filter .2s, background .25s;
}
.htp-btn.is-press { transform: scale(.94); filter: brightness(1.2); }
.htp-btn.is-off { opacity: .42; }
.htp-btn.is-ghost { background: transparent; border: 1px solid var(--htp-line-strong); color: var(--htp-text); }
.htp-btn.is-done { background: transparent; border: 1px solid var(--htp-accent2); color: var(--htp-accent2); }

.htp-finger {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: transform .55s cubic-bezier(.3, .7, .3, 1), opacity .25s;
}
.htp-finger.is-on { opacity: 1; }
.htp-finger::before, .htp-finger::after {
  content: '';
  position: absolute;
  left: -14px;
  top: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.htp-finger::before {
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .22), 0 4px 12px rgba(0, 0, 0, .4);
}
.htp-finger::after { border: 2px solid rgba(255, 255, 255, .95); opacity: 0; }
.htp-finger.is-tap::before { animation: htp-press .35s ease-out; }
.htp-finger.is-tap::after { animation: htp-ripple .55s ease-out; }
@keyframes htp-press { 0% { transform: scale(1); } 40% { transform: scale(.72); } 100% { transform: scale(1); } }
@keyframes htp-ripple { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(2.1); opacity: 0; } }

/* join: a TV with the QR and the code, a phone that types the code */
.htp-j-tv { position: absolute; left: 12px; top: 18px; width: 214px; }
.htp-j-screen {
  height: 152px;
  display: flex;
  flex-direction: column;
  padding: 8px 10px 7px;
  border: 4px solid #1b1d24;
  border-radius: 10px;
  background: var(--htp-tv-bg);
  color: #f2f2f5;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .3);
}
.htp-j-stand { display: block; width: 64px; height: 9px; margin: 0 auto; border-radius: 0 0 5px 5px; background: #1b1d24; }
.htp-j-title { text-align: center; font-size: 11.5px; font-weight: 800; letter-spacing: .02em; }
.htp-j-mid { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 6px; }
.htp-j-qr { width: 66px; height: 66px; border-radius: 5px; overflow: hidden; background: #fff; }
.htp-j-qr svg { display: block; width: 100%; height: 100%; }
.htp-j-codebox { text-align: center; }
.htp-j-codelabel { font-size: 9px; opacity: .7; }
.htp-j-code { font-size: 26px; font-weight: 900; letter-spacing: 3px; color: var(--htp-accent); }
[data-game="mafia"] .htp-j-code { color: #f0b93a; }
.htp-j-seats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: auto; }
.htp-j-seat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 20px;
  padding: 0 7px 0 2px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .13);
  font-size: 9.5px;
  font-weight: 700;
  transition: transform .35s cubic-bezier(.3, 1.5, .5, 1), opacity .3s;
}
.htp-j-seat.is-out { opacity: 0; transform: scale(.3); }
.htp-j-seat .htp-av { width: 16px; height: 16px; }
.htp-j-phone {
  position: absolute;
  right: 14px;
  top: 10px;
  width: 112px;
  height: 222px;
  border: 4px solid #15161c;
  border-radius: 20px;
  background: var(--htp-phone);
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
}
.htp-j-pscreen { position: relative; height: 100%; padding: 30px 9px 10px; }
.htp-j-form { transition: opacity .3s; }
.htp-j-pscreen.is-joined .htp-j-form { opacity: 0; }
.htp-j-label { font-size: 10px; color: var(--htp-muted); margin-bottom: 4px; }
.htp-j-input {
  height: 34px;
  border: 1px solid var(--htp-line-strong);
  border-radius: 8px;
  background: var(--htp-surface);
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 4px;
  line-height: 32px;
  transition: border-color .2s, box-shadow .2s;
}
.htp-j-input.is-empty::before { content: '····'; color: var(--htp-muted); letter-spacing: 6px; }
.htp-j-input.is-focus { border-color: var(--htp-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--htp-accent) 30%, transparent); }
.htp-j-btn { margin-top: 10px; height: 32px; padding: 0 6px; font-size: 11.5px; }
.htp-j-joined {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transform: scale(.85);
  transition: opacity .35s, transform .35s;
}
.htp-j-pscreen.is-joined .htp-j-joined { opacity: 1; transform: none; }
.htp-j-joined .htp-av { width: 48px; height: 48px; font-size: 20px; box-shadow: 0 0 0 3px var(--htp-accent); }
.htp-j-ok { font-size: 12.5px; font-weight: 800; color: var(--htp-accent2); }

/* cards: a hand or the table, one card is chosen */
.htp-c-clue { text-align: center; font-size: 15px; font-weight: 800; font-style: italic; color: var(--htp-accent); }
.htp-c-label { margin: 3px 0 7px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--htp-muted); text-align: center; }
.htp-c-row { display: flex; justify-content: center; gap: 6px; margin-top: 4px; }
.htp-c-row.n4 { gap: 10px; }
.htp-c-card { position: relative; width: 50px; flex: none; transition: transform .3s cubic-bezier(.3, 1.4, .5, 1), opacity .45s; }
.htp-c-row.n4 .htp-c-card { width: 76px; }
/* A hand of cards is held as a fan; the chosen one rises out of it. */
.htp-c-row.is-hand { gap: 0; margin-top: 12px; }
.htp-c-row.is-hand .htp-c-card {
  width: 60px;
  margin-left: -8px;
  transform-origin: 50% 130%;
  transform: rotate(calc(var(--fan) * 4deg)) translateY(calc(var(--fan) * var(--fan) * 1.5px));
}
.htp-c-row.is-hand .htp-c-card:first-child { margin-left: 0; }
.htp-c-row.is-hand .htp-c-face { height: 90px; }
.htp-c-row.is-hand .htp-c-card.is-picked { z-index: 2; transform: translateY(-9px) scale(1.08); }
.htp-c-row.is-hand .htp-c-card.is-gone { transform: translateY(-80px) scale(.5); }
.htp-c-face {
  display: block;
  height: 75px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 0 1.5px rgba(252, 211, 77, .45), 0 3px 8px rgba(0, 0, 0, .35);
  transition: box-shadow .25s;
}
.htp-c-row.n4 .htp-c-face { height: 114px; }
.htp-c-row.n4 .htp-c-card.is-picked { transform: translateY(-3px) scale(1.05); }
.htp-c-row.is-square { margin-top: 8px; }
.htp-c-row.is-square .htp-c-card { width: 76px; }
.htp-c-row.is-square .htp-c-face { height: 76px; border-radius: 50%; box-shadow: 0 3px 10px rgba(0, 0, 0, .4); background: rgba(0, 0, 0, .25); }
.htp-c-face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.htp-c-row.is-square .htp-c-face img { object-fit: contain; }
.htp-c-card.is-picked { transform: translateY(-7px) scale(1.07); }
.htp-c-card.is-picked .htp-c-face { box-shadow: 0 0 0 2.5px var(--htp-accent), 0 8px 18px rgba(0, 0, 0, .45); }
.htp-c-card.is-gone { transform: translateY(-70px) scale(.5); opacity: 0; }
.htp-c-card.is-voted::after {
  content: '✓';
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--htp-accent);
  color: var(--htp-accent-text);
  font-size: 12px;
  font-weight: 900;
}
.htp-c-card.is-mine .htp-c-face { opacity: .55; }
.htp-c-mine {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .65);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
}
.htp-c-num {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
.htp-c-cap { display: block; margin-top: 6px; text-align: center; font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.htp-c-bar { position: relative; height: 34px; margin-top: auto; }
.htp-c-btn, .htp-c-done { position: absolute; top: 0; right: 0; bottom: 0; left: 0; transition: opacity .3s, transform .3s; }
.htp-c-btn { opacity: 0; transform: translateY(10px); }
.htp-c-bar.is-ask .htp-c-btn { opacity: 1; transform: none; }
.htp-c-bar.is-done .htp-c-btn { opacity: 0; }
.htp-c-done { display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: var(--htp-accent2); opacity: 0; }
.htp-c-bar.is-done .htp-c-done { opacity: 1; }

/* pills: the categories of the Quiz */
.htp-demo-pills { padding: 12px 14px; }
.htp-p-label { margin-bottom: 8px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--htp-muted); }
.htp-p-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.htp-p-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px 0 4px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 16px;
  background: rgba(255, 255, 255, .05);
  color: rgba(255, 255, 255, .62);
  font-size: 12px;
  font-weight: 600;
  transition: background .25s, border-color .25s, color .25s, box-shadow .25s;
}
.htp-p-pill img { width: 24px; height: 24px; object-fit: contain; }
.htp-p-pill.is-on { background: rgba(124, 58, 237, .4); border-color: #a78bfa; color: #fff; box-shadow: 0 0 14px rgba(167, 139, 250, .35); }
.htp-p-theme {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding: 7px 10px;
  border: 1px dashed rgba(255, 255, 255, .25);
  border-radius: 10px;
  font-size: 11.5px;
}
.htp-p-themelabel { font-weight: 800; }
.htp-p-themeval { color: var(--htp-muted); }
.htp-p-btn { margin-top: auto; }

/* role: the secret role card of the Mafia */
.htp-demo-role { align-items: center; padding-top: 12px; }
.htp-r-card { width: 128px; height: 166px; flex: none; perspective: 700px; }
.htp-r-inner { position: relative; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.4, .2, .2, 1); transform-style: preserve-3d; }
.htp-r-card.is-flipped .htp-r-inner { transform: rotateY(180deg); }
.htp-r-back, .htp-r-front {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid #d4952a;
  border-radius: 12px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 0 8px 22px rgba(42, 30, 10, .3);
}
.htp-r-back { background: radial-gradient(circle at 50% 40%, #2a3a5c, #0e1828); }
.htp-r-emblem { width: 84px; height: 84px; object-fit: contain; }
.htp-r-tap { margin-top: 8px; font-family: 'Cinzel', Georgia, serif; font-size: 11px; font-weight: 700; color: #f0b93a; letter-spacing: .06em; }
.htp-r-front { transform: rotateY(180deg); background: linear-gradient(180deg, #fbf8f1, #ede5d4); padding: 6px; text-align: center; }
.htp-r-portrait { width: 78px; height: 78px; object-fit: contain; }
.htp-r-name { margin-top: 2px; font-family: 'Cinzel', Georgia, serif; font-size: 14px; font-weight: 800; color: #2a1e0a; }
.htp-r-what { font-size: 10.5px; line-height: 1.2; color: #6e5c3e; }
.htp-r-team { margin-top: 4px; padding: 1px 7px; border-radius: 8px; font-size: 9.5px; font-weight: 800; color: #fff; }
.htp-r-team.is-mafia { background: #8a1c1c; }
.htp-r-team.is-town { background: #2878a8; }
.htp-r-roles { display: flex; gap: 7px; margin-top: 10px; }
.htp-r-mini { width: 26px; height: 26px; border-radius: 50%; object-fit: contain; opacity: .35; filter: grayscale(.6); transition: opacity .3s, filter .3s, transform .3s; }
.htp-r-mini.is-on { opacity: 1; filter: none; transform: scale(1.15); }
.htp-r-hush { margin-top: 5px; font-size: 11px; font-style: italic; color: var(--htp-muted); }

/* players: the Mafia's player cards at night and at the vote */
.htp-demo-players.is-night { background: linear-gradient(180deg, #1f2f4d, #0e1828); color: #e8eef8; --htp-muted: rgba(232, 238, 248, .68); }
.htp-m-tablet { padding: 6px 8px; border: 1px solid var(--htp-line); border-radius: 10px; background: rgba(255, 255, 255, .55); text-align: center; }
.is-night .htp-m-tablet { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); }
.htp-m-q { font-family: 'Cinzel', Georgia, serif; font-size: 13px; font-weight: 800; }
.htp-m-status { min-height: 15px; font-size: 11px; color: var(--htp-muted); }
.htp-m-status b { color: var(--htp-accent); }
.is-night .htp-m-status b { color: #f0b93a; }
.htp-m-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.htp-m-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 33px;
  padding: 0 9px;
  border: 1.5px solid #d8ccb4;
  border-radius: 9px;
  background: #f3ecdd;
  font-size: 12.5px;
  font-weight: 700;
  transition: transform .2s, border-color .2s, box-shadow .2s, opacity .3s;
}
.is-night .htp-m-card { background: #24314f; border-color: rgba(255, 255, 255, .12); }
.htp-m-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.htp-m-you { padding: 1px 5px; border-radius: 6px; background: rgba(0, 0, 0, .08); font-size: 9px; font-weight: 700; color: var(--htp-muted); }
.is-night .htp-m-you { background: rgba(255, 255, 255, .1); }
.htp-m-card.is-me { opacity: .6; }
.htp-m-card.is-picked { transform: scale(1.04); border-color: #c05030; box-shadow: 0 0 0 2px rgba(192, 80, 48, .3); }
.is-night .htp-m-card.is-picked { border-color: #f0b93a; box-shadow: 0 0 0 2px rgba(240, 185, 58, .3); }
.htp-m-seal {
  position: absolute;
  top: -7px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #9c2a1c;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  opacity: 0;
  transform: scale(.4);
  transition: opacity .2s, transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.htp-m-card.is-picked .htp-m-seal { opacity: 1; transform: none; }
.htp-m-card.is-sealed .htp-m-seal::after { content: '✓'; }
.htp-m-grid.is-locked .htp-m-card:not(.is-picked) { opacity: .45; }
.is-day .htp-m-seal { display: none; }
.htp-m-shards { display: inline-flex; align-items: center; gap: 2px; }
.htp-m-shards i { display: inline-block; width: 6px; height: 15px; border-radius: 1px; background: #a03820; transform: skewX(-12deg); animation: htp-pop .3s ease-out; }
.htp-m-shards b { margin-left: 3px; font-size: 13px; font-weight: 900; color: #a03820; }
.htp-m-bar { display: flex; flex-direction: column; gap: 4px; margin-top: auto; }
.htp-m-tally { text-align: center; font-size: 10.5px; color: var(--htp-muted); }
.htp-m-btn { height: 33px; font-family: 'Cinzel', Georgia, serif; }
.is-night .htp-m-btn.is-done { color: #9fd38a; border-color: #9fd38a; }
.htp-m-verdict {
  position: absolute;
  left: 50%;
  top: 46%;
  padding: 10px 18px;
  border-radius: 12px;
  background: #8a1c1c;
  color: #fff8ee;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 10px 28px rgba(42, 30, 10, .45);
  opacity: 0;
  transform: translate(-50%, -50%) scale(.8);
  transition: opacity .3s, transform .35s cubic-bezier(.3, 1.5, .5, 1);
}
.htp-m-verdict.is-on { opacity: 1; transform: translate(-50%, -50%); }
@keyframes htp-pop { 0% { transform: skewX(-12deg) scale(.2); } 100% { transform: skewX(-12deg) scale(1); } }

/* answers: a Quiz question with four options */
.htp-a-head { display: flex; align-items: center; justify-content: space-between; }
.htp-a-cat { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; color: #c4b5fd; }
.htp-a-cat img { width: 22px; height: 22px; object-fit: contain; }
.htp-a-num { min-width: 26px; text-align: right; font-size: 18px; font-weight: 900; color: #fbbf24; }
.htp-a-track { height: 5px; margin: 5px 0 8px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.htp-a-fill { width: 100%; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #34d399, #fbbf24); }
.htp-a-fill.is-running { width: 0; transition: width 7.8s linear; }
.htp-a-fill.is-frozen { width: 70%; transition: none; }
.htp-a-q { min-height: 36px; margin-bottom: 8px; text-align: center; font-size: 14px; font-weight: 800; line-height: 1.25; }
.htp-a-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.htp-a-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 9px;
  border: 2px solid transparent;
  border-radius: 11px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  transition: transform .2s, opacity .25s, border-color .2s, box-shadow .2s;
}
.htp-a-opt0 { background: rgba(231, 76, 60, .75); }
.htp-a-opt1 { background: rgba(52, 152, 219, .75); }
.htp-a-opt2 { background: rgba(243, 156, 18, .75); }
.htp-a-opt3 { background: rgba(46, 204, 113, .75); }
.htp-a-letter { font-size: 12px; font-weight: 900; opacity: .75; }
.htp-a-opt.is-picked { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .25), 0 0 16px rgba(255, 255, 255, .3); transform: scale(1.03); }
.htp-a-opt.is-right { border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .4), 0 0 18px rgba(34, 197, 94, .45); opacity: 1; }
.htp-a-opt.is-right .htp-a-mark::after { content: '✓'; position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 15px; font-weight: 900; }
.htp-a-opt.is-wrong { opacity: .5; border-color: #ef4444; }
.htp-a-opt.is-dim { opacity: .35; }
.htp-a-status { min-height: 15px; margin-top: 10px; padding-right: 80px; font-size: 11px; color: var(--htp-muted); }
.htp-a-pts {
  position: absolute;
  right: 14px;
  bottom: 8px;
  font-size: 24px;
  font-weight: 900;
  color: #fbbf24;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .5), 0 0 16px rgba(251, 191, 36, .5);
  opacity: 0;
  transform: translateY(14px) scale(.7);
  transition: opacity .3s, transform .45s cubic-bezier(.3, 1.5, .5, 1);
}
.htp-a-pts.is-on { opacity: 1; transform: none; }

/* formats: true or false, and guess the number */
.htp-demo-formats { flex-direction: row; gap: 10px; padding: 12px; }
.htp-f-panel {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
}
.htp-f-tag { align-self: flex-start; margin-bottom: 6px; padding: 2px 6px; border-radius: 6px; background: rgba(124, 58, 237, .3); color: #ddd6fe; font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.htp-f-q { font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.htp-f-row { display: flex; gap: 6px; margin-top: auto; }
.htp-f-tf {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border: 2px solid transparent;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  transition: border-color .2s, box-shadow .2s, background .25s;
}
.htp-f-tf.is-yes { background: rgba(46, 204, 113, .55); }
.htp-f-tf.is-no { background: rgba(231, 76, 60, .55); }
.htp-f-tf.is-picked { border-color: #fff; }
.htp-f-tf.is-right { border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .4), 0 0 16px rgba(34, 197, 94, .45); }
.htp-f-tf.is-right::after { content: ' ✓'; white-space: pre; }
.htp-f-input {
  height: 34px;
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 8px;
  background: rgba(0, 0, 0, .25);
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 3px;
  line-height: 32px;
  transition: border-color .2s;
}
.htp-f-input.is-empty::before { content: '…'; color: var(--htp-muted); }
.htp-f-input.is-focus { border-color: #a78bfa; }
.htp-f-send { height: 30px; margin-top: 6px; font-size: 12px; }
.htp-f-near {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(22, 163, 74, .3);
  color: #86efac;
  font-size: 10px;
  font-weight: 800;
  opacity: 0;
  transform: scale(.6);
  transition: opacity .25s, transform .3s cubic-bezier(.3, 1.6, .5, 1);
}
.htp-f-near.is-on { opacity: 1; transform: none; }

/* score: who moves how far after a round of Fantasium */
.htp-demo-score { padding: 12px 14px; }
.htp-s-title { margin-bottom: 8px; text-align: center; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--htp-muted); }
.htp-s-list { display: flex; flex-direction: column; gap: 6px; }
.htp-s-row { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px 0 6px; border-radius: 11px; background: rgba(255, 255, 255, .07); }
.htp-s-row:first-child { box-shadow: inset 0 0 0 1px rgba(252, 211, 77, .4); }
.htp-s-row .htp-av { width: 29px; height: 29px; }
.htp-s-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.htp-s-who b { font-size: 12.5px; }
.htp-s-who span { font-size: 10.5px; color: var(--htp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.htp-s-pts { font-size: 18px; font-weight: 900; color: var(--htp-accent); opacity: 0; transform: scale(.3); transition: opacity .25s, transform .35s cubic-bezier(.3, 1.7, .5, 1); }
.htp-s-row.is-zero .htp-s-pts { color: var(--htp-muted); }
.htp-s-row.is-on .htp-s-pts { opacity: 1; transform: none; }

/* stakes: the action cards of Dungeon Quest */
.htp-demo-stakes { gap: 7px; }
.htp-k-title { font-family: 'Cinzel', Georgia, serif; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #f0c040; }
.htp-k-card {
  padding: 7px 9px;
  border: 1px solid rgba(212, 160, 23, .25);
  border-left: 3px solid #d4a017;
  border-radius: 10px;
  background: #1a1a2e;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.htp-k-card.tier-safe { border-left-color: #5fb8a2; }
.htp-k-card.tier-risky { border-left-color: #e0533f; }
.htp-k-card.is-picked { border-color: #f0c040; box-shadow: 0 0 0 2px rgba(240, 192, 64, .45), 0 6px 18px rgba(212, 160, 23, .2); transform: scale(1.02); }
.htp-k-top { display: flex; align-items: center; gap: 7px; }
.htp-k-icon { font-size: 18px; }
.htp-k-text { flex: 1; font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.htp-k-chance { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.htp-k-chance b { font-size: 15px; }
.htp-k-chance small { font-size: 8.5px; color: var(--htp-muted); }
.htp-k-chance.is-good b { color: #7ee2a8; }
.htp-k-chance.is-mid b { color: #f0c040; }
.htp-k-chance.is-low b { color: #ff9187; }
.htp-k-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.htp-k-meta span { padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, .06); font-size: 9.5px; font-weight: 700; }
.htp-k-meta .is-gain { background: rgba(39, 174, 96, .16); color: #7ee2a8; }
.htp-k-meta .is-loss { background: rgba(192, 57, 43, .18); color: #ff9187; }
.htp-k-btn { margin-top: auto; }

/* dice: the d20 of Dungeon Quest */
.htp-demo-dice { align-items: center; padding-top: 12px; }
.htp-d-title { font-family: 'Cinzel', Georgia, serif; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #f0c040; }
.htp-d-die { position: relative; width: 112px; height: 112px; margin-top: 8px; }
.htp-d-die svg { display: block; width: 100%; height: 100%; overflow: visible; }
.htp-d-body { fill: #2a2440; stroke: #f0c040; stroke-width: 2.5; stroke-linejoin: round; transition: fill .3s, stroke .3s; }
.htp-d-face { fill: rgba(240, 192, 64, .12); }
.htp-d-edge { fill: none; stroke: rgba(240, 192, 64, .45); stroke-width: 1.4; stroke-linejoin: round; }
.htp-d-num { position: absolute; left: 0; right: 0; top: 47%; transform: translateY(-50%); text-align: center; font-family: 'Cinzel', Georgia, serif; font-size: 27px; font-weight: 900; color: #f6ecd2; }
.htp-d-die.is-rolling svg { animation: htp-spin .55s linear infinite; }
.htp-d-die.is-ok .htp-d-body { stroke: #7ee2a8; }
.htp-d-die.is-crit .htp-d-body { fill: #4a3a12; stroke: #ffd060; }
.htp-d-die.is-crit svg { filter: drop-shadow(0 0 12px rgba(255, 208, 96, .6)); }
.htp-d-die.is-fail .htp-d-body { stroke: #ff9187; fill: #3a1c22; }
@keyframes htp-spin { to { transform: rotate(360deg); } }
.htp-d-chip { margin-top: 8px; padding: 4px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 800; opacity: 0; transform: scale(.7); transition: opacity .25s, transform .35s cubic-bezier(.3, 1.6, .5, 1); }
.htp-d-chip.is-on { opacity: 1; transform: none; }
.htp-d-chip.is-ok { background: rgba(39, 174, 96, .2); color: #7ee2a8; }
.htp-d-chip.is-crit { background: rgba(240, 192, 64, .22); color: #ffd060; }
.htp-d-chip.is-fail { background: rgba(192, 57, 43, .24); color: #ff9187; }
.htp-d-legend { position: absolute; left: 0; right: 0; bottom: 9px; display: flex; justify-content: center; gap: 14px; font-size: 10.5px; font-weight: 700; }
.htp-d-legend .is-crit { color: #ffd060; }
.htp-d-legend .is-fail { color: #ff9187; }

/* ── TV: the steps turn by themselves in the lobby ───── */
.htp-tv[hidden] { display: none; }
.htp-tv {
  position: fixed;
  right: 2.2vw;
  bottom: 2.6vh;
  z-index: 40;
  width: 23vw;
  padding: 1.2vh 1vw 1.4vh;
  border: 1px solid var(--htp-line);
  border-radius: 1.6vh;
  background: var(--htp-bg);
  color: var(--htp-text);
  box-shadow: 0 1vh 4vh rgba(0, 0, 0, .45);
  pointer-events: none;
}
.htp-tv-head { margin-bottom: .8vh; font-family: var(--htp-head-font); font-size: 1.7vh; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--htp-muted); }
.htp-tv-slides { position: relative; }
.htp-tv-slide { display: none; }
.htp-tv-slide.is-on { display: block; animation: htp-fade .6s ease-out; }
.htp-tv .htp-stage { max-width: none; border-radius: 1.2vh; }
.htp-tv-copy { padding-top: 1vh; }
.htp-tv-title { font-family: var(--htp-head-font); font-size: 2.1vh; font-weight: 800; line-height: 1.25; }
.htp-tv-text { margin-top: .4vh; font-size: 1.75vh; line-height: 1.35; color: var(--htp-muted); }
.htp-tv-dots { display: flex; justify-content: center; gap: .6vh; margin-top: 1vh; }
.htp-tv-dots i { width: .8vh; height: .8vh; border-radius: .4vh; background: var(--htp-line-strong); transition: width .3s, background .3s; }
.htp-tv-dots i.is-on { width: 2vh; background: var(--htp-accent); }
@keyframes htp-fade { from { opacity: 0; } to { opacity: 1; } }

/* ── Reduced motion: no sliding, no pulses (the demos show their last frame) ── */
@media (prefers-reduced-motion: reduce) {
  .htp-dialog, .htp-backdrop, .htp-track, .htp-r-inner { transition: none !important; }
  .htp-open--hint, .htp-tv-slide.is-on { animation: none; }
}
