/*
 * Handy Live Console — styles. Everything is scoped under `.hc` so the
 * console can be embedded into an existing site without leaking styles.
 * Dark, high-contrast, large touch targets (min 44px, primary 64px+).
 */
.hc {
  /* Surfaces */
  --hc-bg: #0a0b0d;
  --hc-surface: #121418;
  --hc-surface-2: #181b20;
  --hc-surface-3: #20242a;
  --hc-border: #2a2f37;
  --hc-border-strong: #3a414b;
  /* Text */
  --hc-text: #eef1f4;
  --hc-muted: #a3abb6;
  --hc-faint: #6b7380;
  /* Signal colors — each has exactly one meaning */
  --hc-accent: #8fa3ff;        /* selection / focus / waveform */
  --hc-accent-ink: #0b1030;
  --hc-go: #3ddc84;            /* moving / connected / acknowledged */
  --hc-go-ink: #04210f;
  --hc-stop: #ff4d4f;          /* stop / error / recording */
  --hc-warn: #ffb547;          /* reconnecting / pending */
  --hc-wave: var(--hc-accent);
  --hc-wave-fill: rgba(143, 163, 255, 0.13);
  --hc-grid: rgba(255, 255, 255, 0.07);

  --hc-radius: 12px;
  --hc-radius-sm: 8px;
  --hc-font: 'Geist', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --hc-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --hc-text-xs: 0.75rem;
  --hc-text-sm: 0.875rem;
  --hc-text-base: 1rem;
  --hc-text-lg: 1.25rem;

  color-scheme: dark;
  background: var(--hc-bg);
  color: var(--hc-text);
  font-family: var(--hc-font);
  font-size: var(--hc-text-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
.hc *, .hc *::before, .hc *::after { box-sizing: border-box; }
.hc svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hc :where(button, input, select) { font: inherit; color: inherit; }
.hc :where(button) { cursor: pointer; }
.hc :focus-visible { outline: 3px solid var(--hc-accent); outline-offset: 2px; }
.hc [hidden] { display: none !important; }
.hc h2 { font-size: var(--hc-text-sm); font-weight: 600; letter-spacing: 0.01em; margin: 0; }
.hc kbd {
  font-family: var(--hc-mono); font-size: 0.6875rem; line-height: 1; padding: 3px 5px;
  border-radius: 4px; border: 1px solid currentColor; opacity: 0.55; font-weight: 500;
}
.hc .hc-muted { color: var(--hc-muted); font-size: var(--hc-text-sm); }
.hc .hc-hint { color: var(--hc-faint); font-size: var(--hc-text-xs); }
.hc .hc-help { color: var(--hc-muted); font-size: var(--hc-text-sm); margin: 0; }
.hc .hc-help a { color: var(--hc-accent); }
.hc .hc-warn { color: var(--hc-warn); }
.hc .hc-spacer { flex: 1; }
.hc .hc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hc-move { display: inline-flex; align-items: center; gap: 4px; }
.hc-move[hidden] { display: none; }
.hc-move .hc-btn { min-width: 40px; justify-content: center; font-size: 16px; }
.hc-move__pos { font-family: var(--hc-mono, ui-monospace, monospace); font-size: var(--hc-text-xs); color: var(--hc-muted); min-width: 72px; text-align: center; }

/* ---------------------------------------------------------------- Header */
.hc-home { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 14px 0 10px; border-radius: 999px; background: linear-gradient(135deg, #ff4f7b, #ff6b5e); color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; flex: none; }
.hc-home:hover { filter: brightness(1.08); }
.hc-home:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.hc-top {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--hc-border);
  background: var(--hc-surface); position: sticky; top: 0; z-index: 20;
}
.hc-brand { display: flex; flex-direction: column; line-height: 1.1; margin-right: 8px; }
.hc-brand__name { font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.01em; }
.hc-brand__sub { font-size: var(--hc-text-xs); color: var(--hc-faint); }
.hc-conn {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 14px 6px 12px;
  border-radius: 999px; border: 1px solid var(--hc-border-strong); background: var(--hc-surface-2); text-align: left;
}
.hc-conn:hover { background: var(--hc-surface-3); }
.hc-conn__text { display: flex; flex-direction: column; line-height: 1.15; }
.hc-conn__text strong { font-size: var(--hc-text-sm); }
.hc-conn__text small { font-size: var(--hc-text-xs); color: var(--hc-muted); max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--hc-faint); flex: none; }
.hc-dot[data-s='connected'] { background: var(--hc-go); box-shadow: 0 0 0 4px rgba(61, 220, 132, 0.18); }
.hc-dot[data-s='connecting'], .hc-dot[data-s='reconnecting'] { background: var(--hc-warn); animation: hc-blink 1s steps(2, start) infinite; }
.hc-dot[data-s='error'] { background: var(--hc-stop); }
@keyframes hc-blink { to { opacity: 0.25; } }
.hc-top__meta { font-family: var(--hc-mono); font-size: var(--hc-text-xs); color: var(--hc-faint); margin-left: auto; }
.hc-estop {
  display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 20px;
  border: 0; border-radius: var(--hc-radius); background: var(--hc-stop); color: #fff;
  font-weight: 800; letter-spacing: 0.08em; font-size: 1rem;
}
.hc-estop:hover { filter: brightness(1.08); }
.hc-estop:active { transform: translateY(1px); }
.hc-estop svg { width: 22px; height: 22px; }

/* ---------------------------------------------------------------- Layout */
.hc-main {
  flex: 1; display: grid; gap: 16px; padding: 16px;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr);
  align-items: start;
}
.hc-stage, .hc-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.hc-card {
  background: var(--hc-surface); border: 1px solid var(--hc-border); border-radius: var(--hc-radius);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.hc-card__head { display: flex; align-items: center; gap: 10px; }
.hc-card__head--sub { margin-top: 6px; }
.hc-readout { margin-left: auto; font-family: var(--hc-mono); font-size: var(--hc-text-lg); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Video */
.hc-video {
  position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--hc-radius);
  border: 1px solid var(--hc-border); overflow: hidden;
}
.hc-video video { width: 100%; height: 100%; object-fit: cover; display: none; }
.hc-video.is-on video { display: block; }
.hc-video.is-mirror video { transform: scaleX(-1); }
.hc-video.is-screen video { object-fit: contain; transform: none; background: #000; }
.hc-video.is-screen [data-ref="mirrorWrap"] { display: none; }
.hc-video__start { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.hc-video__tip { font-size: var(--hc-text-xs); color: var(--hc-faint); max-width: 42ch; }
.hc-video__bar .hc-btn svg { width: 16px; height: 16px; }
.hc-video__empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 24px; color: var(--hc-muted);
  background: radial-gradient(ellipse at center, #151820 0%, #07080a 75%);
}
.hc-video__empty > svg { width: 36px; height: 36px; color: var(--hc-faint); }
.hc-video__empty p { margin: 0; font-size: var(--hc-text-sm); max-width: 38ch; }
.hc-video__empty strong { color: var(--hc-text); }
.hc-video__err { color: var(--hc-stop); font-size: var(--hc-text-xs); min-height: 1em; }
.hc-video.is-on .hc-video__empty { display: none; }
.hc-video__hud { position: absolute; top: 12px; left: 12px; display: flex; gap: 8px; align-items: center; }
.hc-tally {
  font-family: var(--hc-mono); font-weight: 700; font-size: var(--hc-text-xs); letter-spacing: 0.08em;
  padding: 6px 10px; border-radius: 6px; background: rgba(0, 0, 0, 0.7); border: 1px solid var(--hc-border-strong);
}
.hc-tally[data-s='on'] { background: var(--hc-go); color: var(--hc-go-ink); border-color: transparent; }
.hc-tally[data-s='pause'] { background: var(--hc-warn); color: #2a1800; border-color: transparent; }
.hc-tally[data-s='off'] { color: var(--hc-warn); }
.hc-hud__src { font-size: var(--hc-text-xs); padding: 6px 10px; border-radius: 6px; background: rgba(0, 0, 0, 0.65); font-weight: 500; }
.hc-video__pos {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%); height: 58%;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 8px 10px;
  border-radius: 10px; background: rgba(0, 0, 0, 0.65); border: 1px solid var(--hc-border-strong);
}
.hc-video__pos span { font-family: var(--hc-mono); font-size: 0.625rem; font-weight: 700; letter-spacing: 0.08em; color: var(--hc-muted); }
.hc-video__rail { position: relative; flex: 1; width: 14px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); }
.hc-video__band { position: absolute; left: 0; right: 0; background: rgba(143, 163, 255, 0.4); border-radius: 4px; }
.hc-video__mark { position: absolute; left: -4px; right: -4px; height: 6px; margin-bottom: -3px; border-radius: 3px; background: var(--hc-go); box-shadow: 0 0 0 2px #000; }
.hc-video__bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  opacity: 0; transition: opacity 0.15s;
}
.hc-video.is-on .hc-video__bar { opacity: 1; }
.hc-video:not(.is-on) .hc-video__bar { pointer-events: none; }
.hc-video__bar select { max-width: 50%; }

/* ---------------------------------------------------------------- Controls */
.hc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--hc-radius-sm);
  border: 1px solid var(--hc-border-strong); background: var(--hc-surface-2);
  font-size: var(--hc-text-sm); font-weight: 600; white-space: nowrap;
}
.hc-btn:hover:not(:disabled) { background: var(--hc-surface-3); }
.hc-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.hc-btn--primary { background: var(--hc-accent); color: var(--hc-accent-ink); border-color: transparent; }
.hc-btn--primary:hover:not(:disabled) { background: #a9b8ff; }
.hc-btn--ghost { background: transparent; border-color: transparent; }
.hc-btn--ghost:hover:not(:disabled) { background: var(--hc-surface-2); }
.hc-btn--danger-ghost { color: #ff8a8b; }
.hc-btn--sm { min-height: 40px; padding: 0 12px; }
.hc-btn--icon { width: 44px; padding: 0; }
.hc-btn--xs { width: 32px; min-height: 32px; }
.hc-btn--xs svg { width: 16px; height: 16px; }
.hc-btn--step { width: 52px; min-height: 52px; flex: none; }
.hc select, .hc input:not([type='checkbox']):not([type='radio']):not([type='range']) {
  min-height: 44px; padding: 0 12px; border-radius: var(--hc-radius-sm);
  border: 1px solid var(--hc-border-strong); background: var(--hc-bg); color: var(--hc-text); min-width: 0;
}
.hc select:focus, .hc input:focus { border-color: var(--hc-accent); outline: none; }
.hc-field { display: flex; flex-direction: column; gap: 6px; font-size: var(--hc-text-xs); color: var(--hc-muted); font-weight: 500; }
.hc-field--grow { flex: 1; min-width: 160px; }
.hc-check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--hc-text-sm); min-height: 44px; cursor: pointer; }
.hc-adv > summary { cursor: pointer; font-size: var(--hc-text-sm); color: var(--hc-muted); min-height: 44px; display: flex; align-items: center; list-style: none; }
.hc-adv > summary::-webkit-details-marker { display: none; }
.hc-adv > summary::before { content: "▸"; margin-right: 8px; transition: transform .15s; }
.hc-adv[open] > summary::before { transform: rotate(90deg); }
.hc-adv > summary[hidden] { display: none; }
.hc-adv > summary:not([hidden]) + .hc-field { margin-bottom: 8px; }
.hc-check input { width: 18px; height: 18px; accent-color: var(--hc-accent); }

/* Switch */
.hc-switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: var(--hc-text-sm); }
.hc-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hc-switch__ui { width: 42px; height: 24px; border-radius: 12px; background: var(--hc-surface-3); border: 1px solid var(--hc-border-strong); position: relative; flex: none; transition: background 0.15s; }
.hc-switch__ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--hc-muted); transition: transform 0.15s, background 0.15s; }
.hc-switch input:checked + .hc-switch__ui { background: var(--hc-accent); border-color: transparent; }
.hc-switch input:checked + .hc-switch__ui::after { transform: translateX(18px); background: var(--hc-accent-ink); }
.hc-switch input:focus-visible + .hc-switch__ui { outline: 3px solid var(--hc-accent); outline-offset: 2px; }

/* Range control */
.hc-ctlrow { display: flex; align-items: center; gap: 12px; }
.hc-ctlrow > div { flex: 1; }
.hc-ctlrow--solo { padding: 0 6px; }
.hc-range { position: relative; height: 56px; touch-action: none; cursor: pointer; user-select: none; }
.hc-range__track { position: absolute; left: 0; right: 0; top: 50%; height: 12px; margin-top: -6px; border-radius: 6px; background: var(--hc-surface-3); }
.hc-range__fill { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: var(--hc-accent); }
.hc-range__thumb {
  position: absolute; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%;
  background: var(--hc-text); border: 4px solid var(--hc-bg); box-shadow: 0 0 0 1px var(--hc-border-strong), 0 2px 8px rgba(0, 0, 0, 0.5);
}
.hc-range__thumb:focus-visible { outline: 3px solid var(--hc-accent); outline-offset: 2px; }
.hc-range.is-dragging .hc-range__thumb:focus::after, .hc-range__thumb:focus-visible::after {
  content: attr(data-label); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  font-family: var(--hc-mono); font-size: var(--hc-text-xs); background: var(--hc-text); color: var(--hc-bg);
  padding: 3px 6px; border-radius: 4px; white-space: nowrap; font-weight: 600;
}

/* ---------------------------------------------------------------- Transport */
.hc-transport { flex-direction: row; gap: 16px; align-items: stretch; }
.hc-transport__btns { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hc-transport__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hc-big {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 64px; border-radius: var(--hc-radius); border: 1px solid var(--hc-border-strong);
  background: var(--hc-surface-2); font-weight: 700; font-size: 1rem; padding: 0 16px;
}
.hc-big kbd { position: absolute; right: 10px; top: 8px; }
.hc-big:hover:not(:disabled) { background: var(--hc-surface-3); }
.hc-big:disabled { opacity: 0.5; cursor: not-allowed; }
.hc-big:active:not(:disabled) { transform: translateY(1px); }
.hc-big--go { min-height: 96px; font-size: 1.375rem; letter-spacing: 0.01em; background: var(--hc-go); color: var(--hc-go-ink); border-color: transparent; }
.hc-big--go:hover:not(:disabled) { background: #5ae69a; }
.hc-big--go svg { width: 30px; height: 30px; }
.hc-big--go[data-mode='stop'] { background: var(--hc-stop); color: #fff; }
.hc-big--go[data-mode='connect'] { background: var(--hc-surface-3); color: var(--hc-text); border: 1px dashed var(--hc-border-strong); }
.hc-big--go[data-mode='connect']:hover { background: #2a2f37; }
.hc-big--go[data-mode='connect'] kbd { display: none; }
.hc-big--go[data-mode='stop']:hover:not(:disabled) { background: #ff6668; }
.hc-big.is-acked { animation: hc-ack 0.5s ease-out; }
@keyframes hc-ack { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.8); } 100% { box-shadow: 0 0 0 10px rgba(61, 220, 132, 0); } }
.hc-estop.is-acked { animation: hc-ack-red 0.5s ease-out; }
@keyframes hc-ack-red { 0% { box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.9); } 100% { box-shadow: 0 0 0 10px rgba(255, 77, 79, 0); } }
.hc-ack {
  display: flex; align-items: center; gap: 8px; font-size: var(--hc-text-xs); color: var(--hc-muted);
  font-family: var(--hc-mono); min-height: 28px; padding: 4px 10px; border-radius: 6px; background: var(--hc-bg);
  overflow: hidden; white-space: nowrap;
}
.hc-ack span:last-child { overflow: hidden; text-overflow: ellipsis; }
.hc-ack__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hc-faint); flex: none; }
.hc-ack[data-state='sent'] .hc-ack__dot { background: var(--hc-warn); }
.hc-ack[data-state='ack'] .hc-ack__dot { background: var(--hc-go); }
.hc-ack[data-state='error'] { color: #ff9b9c; }
.hc-ack[data-state='error'] .hc-ack__dot { background: var(--hc-stop); }

/* Position meter (vertical) */
.hc-meter { display: grid; grid-template-columns: auto 44px; grid-template-rows: 1fr auto; gap: 6px 8px; min-height: 230px; }
.hc-meter__scale { display: flex; flex-direction: column; justify-content: space-between; font-family: var(--hc-mono); font-size: 0.6875rem; color: var(--hc-faint); text-align: right; }
.hc-meter__track { position: relative; border-radius: 10px; background: var(--hc-bg); border: 1px solid var(--hc-border); }
.hc-meter__band { position: absolute; left: 4px; right: 4px; border-radius: 6px; background: rgba(143, 163, 255, 0.22); border: 1px dashed rgba(143, 163, 255, 0.55); }
.hc-meter__idle { position: absolute; left: -6px; width: 8px; height: 2px; background: var(--hc-warn); margin-bottom: -1px; }
.hc-meter__mark { position: absolute; left: -4px; right: -4px; height: 10px; margin-bottom: -5px; border-radius: 5px; background: var(--hc-go); box-shadow: 0 0 0 2px var(--hc-surface); }
.hc-meter__ghost { position: absolute; left: 6px; right: 6px; height: 4px; margin-bottom: -2px; border-radius: 2px; background: var(--hc-text); opacity: 0.55; }
.hc-meter__val { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.hc-meter__val strong { font-family: var(--hc-mono); font-size: var(--hc-text-lg); font-variant-numeric: tabular-nums; }
.hc-meter__val small { font-size: 0.6875rem; color: var(--hc-faint); text-transform: uppercase; letter-spacing: 0.06em; }

/* Pattern-mode: dim speed (it only applies in manual) */
.hc.is-pattern [data-ref='speedRange'] { opacity: 0.55; }

/* ---------------------------------------------------------------- Presets */
.hc-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.hc-preset {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  min-height: 92px; padding: 10px 12px; border-radius: var(--hc-radius); border: 2px solid var(--hc-border);
  background: var(--hc-surface-2); overflow: hidden;
}
.hc-preset:hover { border-color: var(--hc-border-strong); background: var(--hc-surface-3); }
.hc-preset kbd { position: absolute; top: 8px; right: 8px; }
.hc-preset__name { font-weight: 650; font-size: var(--hc-text-sm); padding-right: 22px; line-height: 1.2; }
.hc-preset__spark { width: 100%; height: 28px; display: block; margin-top: auto; }
.hc-preset__meta { font-size: 0.6875rem; color: var(--hc-faint); font-family: var(--hc-mono); }
.hc-preset.is-armed { border-color: var(--hc-accent); }
.hc-preset.is-live { border-color: var(--hc-go); background: #0f2219; }
.hc-preset.is-live::before {
  content: 'LIVE'; position: absolute; bottom: 8px; right: 8px; font-family: var(--hc-mono); font-size: 0.625rem; font-weight: 700;
  background: var(--hc-go); color: var(--hc-go-ink); padding: 2px 5px; border-radius: 3px; letter-spacing: 0.06em;
}
.hc-preset.is-live .hc-preset__spark { --hc-wave: var(--hc-go); --hc-wave-fill: rgba(61, 220, 132, 0.15); }

/* ---------------------------------------------------------------- Waveform */
.hc-wave { width: 100%; height: 96px; display: block; border-radius: var(--hc-radius-sm); background: var(--hc-bg); }
.hc-wave--edit { height: 170px; touch-action: none; cursor: crosshair; }
.hc-now__empty { margin: 0; color: var(--hc-muted); font-size: var(--hc-text-sm); }

/* ---------------------------------------------------------------- Tabs */
.hc-tabs { display: flex; gap: 4px; align-items: center; border-bottom: 1px solid var(--hc-border); margin: -4px -4px 0; padding: 0 4px; flex-wrap: wrap; }
.hc-tabs [role='tab'] {
  min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--hc-muted); font-weight: 600;
  font-size: var(--hc-text-sm); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.hc-tabs [role='tab'][aria-selected='true'] { color: var(--hc-text); border-bottom-color: var(--hc-accent); }

/* ---------------------------------------------------------------- Editor */
.hc-editor, .hc-rec, .hc-settings { display: flex; flex-direction: column; gap: 12px; }
.hc-editor__top, .hc-editor__actions, .hc-editor__io { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.hc-editor__io { border-top: 1px solid var(--hc-border); padding-top: 10px; gap: 4px; }
.hc-steps { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow: auto; }
.hc-steps__head, .hc-step {
  display: grid; grid-template-columns: 28px minmax(150px, 1.6fr) 104px minmax(96px, 1fr) 62px 104px; gap: 8px; align-items: center;
}
.hc-steps__head { font-size: 0.6875rem; color: var(--hc-faint); text-transform: uppercase; letter-spacing: 0.05em; padding: 0 8px; }
.hc-step { padding: 6px 8px; border-radius: var(--hc-radius-sm); background: var(--hc-surface-2); border: 1px solid transparent; }
.hc-step.is-sel { border-color: var(--hc-accent); }
.hc-step__n { font-family: var(--hc-mono); color: var(--hc-faint); font-size: var(--hc-text-xs); text-align: center; }
.hc-step__pos, .hc-step__dur { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hc-step__pos input[type='range'] { flex: 1; min-width: 60px; accent-color: var(--hc-accent); height: 28px; }
.hc-step input[type='number'] { width: 62px; min-height: 40px !important; padding: 0 6px !important; font-family: var(--hc-mono); font-size: var(--hc-text-sm); }
.hc-step__dur input[type='number'] { width: 72px; }
.hc-step em { font-style: normal; color: var(--hc-faint); font-size: var(--hc-text-xs); }
.hc-step select { min-height: 40px !important; font-size: var(--hc-text-sm); padding: 0 6px !important; width: 100%; }
.hc-step__spd { font-family: var(--hc-mono); font-size: var(--hc-text-xs); color: var(--hc-muted); }
.hc-step__act { display: flex; justify-content: flex-end; }

/* ---------------------------------------------------------------- Recorder */
.hc-rec__body { display: grid; grid-template-columns: 1fr 220px; gap: 16px; }
.hc-pad {
  width: 100%; height: 280px; border-radius: var(--hc-radius); background: var(--hc-bg); border: 1px dashed var(--hc-border-strong);
  touch-action: none; cursor: ns-resize; display: block;
}
.hc-rec__side { display: flex; flex-direction: column; gap: 10px; }
.hc-big--rec { min-height: 72px; }
.hc-big--rec svg { color: var(--hc-stop); }
.hc-big--rec.is-on { background: var(--hc-stop); color: #fff; border-color: transparent; }
.hc-big--rec.is-on svg { color: #fff; animation: hc-blink 1s steps(2, start) infinite; }
.hc-rec__time { font-family: var(--hc-mono); font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Log */
.hc-log { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; font-size: var(--hc-text-sm); }
.hc-log__row { display: grid; grid-template-columns: 74px 70px 1fr; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--hc-border); align-items: baseline; }
.hc-log__row time { font-family: var(--hc-mono); font-size: var(--hc-text-xs); color: var(--hc-faint); }
.hc-log__row b { font-size: var(--hc-text-xs); font-weight: 600; color: var(--hc-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.hc-log__row--preset b { color: var(--hc-accent); }
.hc-log__row--start b { color: var(--hc-go); }
.hc-log__row--stop b, .hc-log__row--error b { color: var(--hc-stop); }
.hc-log__row--connect b { color: var(--hc-text); }
.hc-log--cmd .hc-log__row b { font-family: var(--hc-mono); text-transform: none; }
.hc-cmd--ack b { color: var(--hc-go) !important; }
.hc-cmd--sent b { color: var(--hc-warn) !important; }
.hc-cmd--error b { color: var(--hc-stop) !important; }
.hc-log__empty { color: var(--hc-faint); font-size: var(--hc-text-sm); padding: 10px 4px; list-style: none; margin: 0; }
.hc-usage table { width: 100%; border-collapse: collapse; font-size: var(--hc-text-sm); }
.hc-usage th { text-align: left; font-size: var(--hc-text-xs); color: var(--hc-faint); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--hc-border); }
.hc-usage td { padding: 8px 4px; border-bottom: 1px solid var(--hc-border); font-variant-numeric: tabular-nums; }
.hc-usage td:not(:first-child) { font-family: var(--hc-mono); }

/* ---------------------------------------------------------------- Dialog */
.hc-dialog {
  border: 1px solid var(--hc-border-strong); border-radius: 16px; background: var(--hc-surface); color: var(--hc-text);
  padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.hc-dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
.hc-dialog__body { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.hc-dialog__head { display: flex; align-items: center; justify-content: space-between; }
.hc-dialog__head h2 { font-size: var(--hc-text-lg); }
.hc-dialog__actions { display: flex; gap: 10px; align-items: center; }
.hc-dialog__err { color: #ff8a8b; font-size: var(--hc-text-sm); margin: 0; min-height: 0; }
.hc-dialog__err:empty { display: none; }
[data-ref='handyFields'] { display: flex; flex-direction: column; gap: 12px; }
.hc-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 10px; background: var(--hc-bg); }
.hc-seg label { position: relative; }
.hc-seg input { position: absolute; opacity: 0; }
.hc-seg span { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 8px; font-weight: 600; font-size: var(--hc-text-sm); color: var(--hc-muted); cursor: pointer; }
.hc-seg input:checked + span { background: var(--hc-surface-3); color: var(--hc-text); }
.hc-seg input:focus-visible + span { outline: 3px solid var(--hc-accent); }
.hc-keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; font-size: var(--hc-text-sm); }
.hc-keys dt { white-space: nowrap; }
.hc-keys dd { margin: 0; color: var(--hc-muted); }
.hc-keys kbd { opacity: 0.9; font-size: var(--hc-text-xs); padding: 4px 7px; }

/* ---------------------------------------------------------------- Toasts */
.hc-toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; max-width: min(420px, calc(100vw - 32px)); }
.hc-toast {
  padding: 12px 14px; border-radius: 10px; background: var(--hc-surface-3); border: 1px solid var(--hc-border-strong);
  border-left: 4px solid var(--hc-accent); font-size: var(--hc-text-sm); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s, transform 0.3s;
}
.hc-toast--ok { border-left-color: var(--hc-go); }
.hc-toast--warn { border-left-color: var(--hc-warn); }
.hc-toast--error { border-left-color: var(--hc-stop); }
.hc-toast.is-out { opacity: 0; transform: translateY(6px); }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1100px) {
  .hc-steps__head { display: none; }
  .hc-step { grid-template-columns: 24px 1fr 1fr; grid-template-areas: 'n pos pos' 'n dur ease' 'n spd act'; row-gap: 6px; }
  .hc-step__n { grid-area: n; } .hc-step__pos { grid-area: pos; } .hc-step__dur { grid-area: dur; }
  .hc-step select { grid-area: ease; } .hc-step__spd { grid-area: spd; } .hc-step__act { grid-area: act; }
}
@media (max-width: 900px) {
  .hc-main { grid-template-columns: 1fr; padding: 12px; gap: 12px; }
  .hc-stage { position: static; }
  /* Controls first on narrow screens; camera follows */
  .hc-panel { order: -1; }
  .hc-logcard { order: 3; }
  .hc-pagebar { order: -2; }
  .hc:not([data-view="home"]) .hc-panel { order: 1; } /* game first, controls after */
}
@media (max-width: 560px) {
  .hc-top { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .hc-brand { display: none; }
  .hc-conn { flex: 1; min-width: 0; }
  .hc-home { min-height: 44px; padding: 0 12px 0 8px; }
  .hc-conn { order: 9; flex: 1 1 100%; }
  .hc-home { margin-right: auto; }
  .hc-conn__text { min-width: 0; overflow: hidden; }
  .hc-conn__text strong, .hc-conn__text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hc-top__meta, [data-ref='kbdBtn'] { display: none; }
  .hc-estop { padding: 0 14px; }
  .hc-estop kbd { display: none; }
  .hc-transport { flex-direction: row; }
  .hc-meter { min-height: 200px; grid-template-columns: auto 36px; }
  .hc-big kbd { display: none; }
  .hc-rec__body { grid-template-columns: 1fr; }
  .hc-pad { height: 220px; }
  .hc-presets { grid-template-columns: repeat(2, 1fr); }
  .hc-card { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .hc *, .hc *::before, .hc *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------------- Programs (ramp + cycles) */
.hc-prog__panel { display: flex; flex-direction: column; gap: 12px; }
.hc-prog__status { font-family: var(--hc-mono); font-size: var(--hc-text-xs); color: var(--hc-go); font-weight: 600; }
.hc-seg--3 { grid-template-columns: repeat(3, 1fr); }
.hc-seg--2 { grid-template-columns: repeat(2, 1fr); }
.hc-st-live { justify-content: center; gap: 12px; margin-top: 8px; }
.hc-st-live .hc-btn { flex: 1; }
.hc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hc-chips button {
  min-height: 44px; min-width: 64px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--hc-border-strong);
  background: var(--hc-surface-2); font-weight: 600; font-size: var(--hc-text-sm); color: var(--hc-text);
}
.hc-chips button:hover { background: var(--hc-surface-3); }
.hc-chips button[aria-pressed='true'] { background: var(--hc-accent); color: var(--hc-accent-ink); border-color: transparent; }
.hc-chips__custom { display: inline-flex; align-items: center; gap: 6px; }
.hc-chips__custom input { width: 96px; border-radius: 999px !important; font-family: var(--hc-mono); }
.hc-chips__custom em { font-style: normal; color: var(--hc-faint); font-size: var(--hc-text-xs); }
.hc-levels { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.hc-levels button {
  min-height: 52px; border-radius: var(--hc-radius-sm); border: 1px solid var(--hc-border-strong);
  background: var(--hc-surface-2); font-family: var(--hc-mono); font-weight: 700; font-size: 1.0625rem; color: var(--hc-text);
}
.hc-levels button:hover { background: var(--hc-surface-3); }
.hc-levels button[aria-pressed='true'] { background: var(--hc-accent); color: var(--hc-accent-ink); border-color: transparent; }
.hc-prog__run { display: flex; flex-direction: column; gap: 10px; }
.hc-big--prog { min-height: 64px; background: var(--hc-go); color: var(--hc-go-ink); border-color: transparent; font-size: 1.0625rem; }
.hc-big--prog:hover:not(:disabled) { background: #5ae69a; }
.hc-big--prog[data-on='true'] { background: var(--hc-stop); color: #fff; }
.hc-big--prog[data-on='true']:hover:not(:disabled) { background: #ff6668; }
.hc-progress { display: flex; flex-direction: column; gap: 6px; }
.hc-progress__bar { height: 12px; border-radius: 6px; background: var(--hc-surface-3); overflow: hidden; }
.hc-progress__bar > div { height: 100%; width: 0; background: var(--hc-go); border-radius: 6px; transition: width 0.2s linear; }
.hc-progress span { font-family: var(--hc-mono); font-size: var(--hc-text-sm); color: var(--hc-muted); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .hc-levels { grid-template-columns: repeat(5, 1fr); }
  .hc-seg--3 span { font-size: var(--hc-text-xs); }
}

/* Log toolbar: keep on one row */
.hc-logcard .hc-tabs { flex-wrap: nowrap; }
.hc-logcard .hc-tabs [role='tab'] { padding: 0 10px; white-space: nowrap; }
.hc-logcard .hc-tabs .hc-btn { padding: 0 8px; flex: none; }
@media (max-width: 1280px) and (min-width: 901px), (max-width: 480px) { .hc-hide-md { display: none; } }
@media (max-width: 400px) { .hc-logcard .hc-tabs [role='tab'] { padding: 0 6px; font-size: var(--hc-text-xs); } }
@media (max-width: 480px) {
  .hc-logcard .hc-tabs { gap: 0; }
  .hc-logcard .hc-tabs [role='tab'] { padding: 0 7px; font-size: var(--hc-text-xs); }
  .hc-logcard .hc-tabs .hc-btn { padding: 0 6px; min-width: 0; }
}

/* ---------------------------------------------------------------- Background art */
.hc { position: relative; isolation: isolate; }
.hc-bgart { display: none; }
.hc.has-bgart .hc-bgart {
  display: block; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: none;
}
/* Dark wash over the art so text and controls keep full contrast. */
.hc.has-bgart .hc-bgart::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(10, 11, 13, calc(var(--hc-bg-dim, 0.7) * 0.75)) 0%, rgba(10, 11, 13, var(--hc-bg-dim, 0.7)) 55%, rgba(10, 11, 13, calc(var(--hc-bg-dim, 0.7) + 0.1)) 100%);
}
.hc.has-bgart { background: #050506; }
.hc.has-bgart .hc-card { background: rgba(18, 20, 24, 0.88); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.hc.has-bgart .hc-top { background: rgba(18, 20, 24, 0.9); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
@media (min-width: 901px) {
  /* On wide screens, sit the portrait on the left, behind the camera column. */
  .hc.has-bgart .hc-bgart { background-position: left 30% center; background-size: auto 115%; background-color: #0b0405; }
}

/* Arrange mode (reorder / manage presets) */
.hc-arrange-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border: 1px dashed var(--hc-border-strong); border-radius: 12px; font-size: var(--hc-text-sm); color: var(--hc-muted); }
.hc-arrange-bar[hidden] { display: none; }
.hc-presets.is-arranging .hc-preset--arr { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; padding-bottom: 8px; }
.hc-presets.is-arranging .hc-preset--arr:hover { background: var(--hc-surface-2, inherit); }
.hc-preset--arr.is-dragging { cursor: grabbing; opacity: .85; border-color: var(--hc-accent); box-shadow: 0 8px 24px rgba(0,0,0,.45); transform: scale(1.03); z-index: 2; }
.hc-preset__grip { position: absolute; top: 8px; left: 8px; color: var(--hc-faint); font-size: 14px; line-height: 1; }
.hc-preset--arr .hc-preset__name { padding-left: 16px; }
.hc-preset__tools { display: flex; gap: 4px; margin-top: 6px; }
.hc-preset__tools button { flex: 1; min-height: 34px; border-radius: 8px; border: 1px solid var(--hc-border); background: transparent; color: var(--hc-text); font: inherit; font-size: var(--hc-text-xs); cursor: pointer; padding: 0 4px; }
.hc-preset__tools button:hover:not(:disabled) { border-color: var(--hc-border-strong); background: var(--hc-surface-3); }
.hc-preset__tools button:disabled { opacity: .35; cursor: default; }
.hc-preset__tools button.is-danger { color: var(--hc-stop, #ff6b6b); }
.hc-preset__tools button:focus-visible { outline: 2px solid var(--hc-accent); outline-offset: 1px; }

/* Randomizer */
.hc-levels--11 { grid-template-columns: repeat(11, 1fr); }
.hc-levels--11 [data-lvl="0"] { font-size: var(--hc-text-xs); }
.hc-roll { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 108px; border: 1px solid var(--hc-border); border-radius: 14px; background: var(--hc-surface-2, rgba(255,255,255,.02)); padding: 12px; text-align: center; }
.hc-roll__big { font-family: var(--hc-mono); font-size: 2.75rem; font-weight: 700; line-height: 1; color: var(--hc-text); font-variant-numeric: tabular-nums; }
.hc-roll__big.is-landed { color: var(--hc-accent); animation: hc-pop .25s ease-out; }
.hc-roll__sub { font-size: var(--hc-text-sm); color: var(--hc-muted); }
@keyframes hc-pop { from { transform: scale(1.25); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .hc-roll__big.is-landed, .hc-die__face.is-landed { animation: none; } }
.hc-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hc-muted { font-style: normal; color: var(--hc-faint); font-weight: 400; }
.hc-numpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.hc-numpick button { position: relative; min-height: 44px; border-radius: 10px; border: 1px solid var(--hc-border); background: var(--hc-surface-2, transparent); color: var(--hc-text); font: inherit; font-family: var(--hc-mono); font-weight: 600; cursor: pointer; }
.hc-numpick button:hover { background: var(--hc-surface-3); }
.hc-numpick button[aria-pressed='true'] { background: var(--hc-accent); color: var(--hc-accent-ink); border-color: transparent; }
.hc-numpick button i { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--hc-surface-3); color: var(--hc-text); font-style: normal; font-size: 12px; line-height: 18px; border: 1px solid var(--hc-border-strong); }
.hc-counter { display: flex; align-items: center; justify-content: center; gap: 14px; font-family: var(--hc-mono); font-size: var(--hc-text-sm); }
.hc-counter.is-complete span { color: var(--hc-go); font-weight: 700; }
.hc-dice { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.hc-die { border: 1px solid var(--hc-border); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--hc-surface-2, transparent); min-width: 0; }
.hc-die__head { display: flex; gap: 6px; align-items: center; }
.hc-die__name { flex: 1; min-width: 0; font-weight: 650; }
.hc-die__face { display: flex; align-items: center; justify-content: center; min-height: 72px; padding: 8px; border-radius: 12px; border: 2px solid var(--hc-border-strong); font-size: 1.25rem; font-weight: 700; text-align: center; overflow-wrap: anywhere; background: var(--hc-surface-3); }
.hc-die__face.is-landed { border-color: var(--hc-accent); color: var(--hc-accent); animation: hc-pop .25s ease-out; }
.hc-die__faces { display: flex; flex-wrap: wrap; gap: 6px; }
.hc-face { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border-radius: 999px; border: 1px solid var(--hc-border); font-size: var(--hc-text-xs); max-width: 100%; overflow-wrap: anywhere; }
.hc-face button { border: 0; background: transparent; color: var(--hc-faint); cursor: pointer; font-size: 14px; width: 22px; height: 22px; border-radius: 50%; }
.hc-face button:hover { color: var(--hc-text); background: var(--hc-surface-3); }
.hc-die__add { display: flex; gap: 6px; }
.hc-die__add input { flex: 1; min-width: 0; }
.hc-rand .hc-prog__panel { display: flex; flex-direction: column; gap: 14px; }
.hc-rand .hc-prog__panel[hidden] { display: none; }

/* Ramp time fields (min + sec) */
.hc-timefield { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.hc-timefield__label { flex: 1 1 110px; font-size: var(--hc-text-sm); color: var(--hc-text); font-weight: 500; }
.hc-timefield label { display: inline-flex; align-items: center; gap: 6px; }
.hc-timefield input { width: 72px; text-align: center; font-family: var(--hc-mono); }
.hc-timefield em { font-style: normal; font-size: var(--hc-text-xs); color: var(--hc-muted); }
[data-ref="rampSplit"] .hc-timefield { padding: 6px 0; border-top: 1px solid var(--hc-border); }
[data-ref="rampSplit"] .hc-timefield:first-of-type { border-top: 0; }

/* Cleanup: builder dialog, tool tabs, compact rhythms */
.hc-dialog--wide { width: min(1040px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; }
.hc-dialog--wide .hc-build--dlg { border: 0; background: transparent; padding: 4px 20px 20px; backdrop-filter: none; -webkit-backdrop-filter: none; }
.hc-dialog__closebar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; padding: 10px 12px 0; height: 0; overflow: visible; }
.hc-dialog--wide .hc-build--dlg > .hc-tabs { padding-right: 48px; }
.hc-prog > .hc-tabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
.hc-prog > .hc-tabs::-webkit-scrollbar { display: none; }
.hc-prog > .hc-tabs [role=tab] { white-space: nowrap; flex-shrink: 0; }
.hc-presets__more { align-self: center; }
.hc-presets { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; }
@media (max-width: 560px) {
  [data-ref="presetHint"] { display: none; }
  .hc-video:not(.is-on) { aspect-ratio: auto; min-height: 250px; }
  .hc-video:not(.is-on) .hc-video__empty { padding: 48px 16px 16px; }
  .hc-video__tip { display: none; }
  .hc-prog > .hc-tabs [role=tab] { padding-left: 9px; padding-right: 9px; }
}
/* Rhythm category filter */
.hc-pfilter { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 10px; }
.hc-pfilter::-webkit-scrollbar { display: none; }
.hc-pfilter button {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--hc-border-strong); background: var(--hc-surface-2); color: var(--hc-text);
  font-weight: 600; font-size: var(--hc-text-sm); cursor: pointer;
}
.hc-pfilter button:hover { background: var(--hc-surface-3); }
.hc-pfilter button small { font-size: var(--hc-text-xs); color: var(--hc-faint); font-weight: 600; }
.hc-pfilter button[aria-pressed='true'] { background: var(--hc-accent); color: var(--hc-accent-ink); border-color: transparent; }
.hc-pfilter button[aria-pressed='true'] small { color: inherit; opacity: .7; }
.hc-pfilter__rnd { margin-left: auto; }
.hc-pfilter__rnd svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hc-pfilter[hidden] { display: none; }
/* Dice: ideas picker, kits, active faces */
.hc-dice__new select { min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--hc-border-strong); background: var(--hc-surface-2); color: var(--hc-text); font-weight: 600; }
.hc-face.is-act::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--hc-accent); margin-right: 5px; flex: none; }
.hc-die__tools { display: flex; align-items: center; gap: 6px; }
.hc-die__count { font-size: var(--hc-text-xs); color: var(--hc-faint); }
.hc-ideas { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; padding: 8px; border-radius: 10px; background: var(--hc-surface-3); overscroll-behavior: contain; }
.hc-ideas__group { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.hc-ideas__title { width: 100%; font-size: var(--hc-text-xs); color: var(--hc-muted); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.hc-idea { min-height: 32px; padding: 0 10px; border-radius: 999px; border: 1px dashed var(--hc-border-strong); background: transparent; color: var(--hc-text); font-size: var(--hc-text-xs); cursor: pointer; }
.hc-idea:hover { background: var(--hc-surface-2); }
.hc-idea[aria-pressed='true'] { border-style: solid; border-color: var(--hc-accent); color: var(--hc-accent); }
.hc-idea[aria-pressed='true']::before { content: '✓ '; }
.hc-ideas { max-height: none; }
.hc-ideas__tabs { display: flex; flex-wrap: wrap; gap: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--hc-border); }
.hc-ideas__tabs button { min-height: 30px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: var(--hc-muted); font-size: var(--hc-text-xs); font-weight: 650; cursor: pointer; }
.hc-ideas__tabs button:hover { color: var(--hc-text); }
.hc-ideas__tabs button[aria-selected='true'] { background: var(--hc-surface-2); color: var(--hc-text); }
.hc-ideas__group .hc-ideas__title { display: none; }
.hc-ideas__group { max-height: 220px; overflow-y: auto; }
.hc .hc-levels.hc-feel { grid-template-columns: repeat(3, 1fr); }
/* Challenge */
.hc-chal__count { display: flex; flex-direction: column; gap: 10px; }
.hc-chal__input {
  flex: 1; min-width: 0; height: 56px; text-align: center; font: 700 28px/1 var(--hc-mono, ui-monospace, monospace);
  border-radius: 12px; border: 1px solid var(--hc-border-strong); background: var(--hc-surface-2); color: var(--hc-text);
  -moz-appearance: textfield;
}
.hc-chal__input::-webkit-outer-spin-button, .hc-chal__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hc-chal__input:focus { outline: 2px solid var(--hc-accent); outline-offset: 1px; }
.hc-chal__quick button { min-height: 36px; padding: 0 12px; }
.hc-chips button[aria-pressed='true'] { background: var(--hc-accent); color: var(--hc-accent-ink); border-color: transparent; }
.hc .hc-levels.hc-chal__opts { grid-template-columns: repeat(5, 1fr); }
.hc .hc-levels.hc-chal__opts--4 { grid-template-columns: repeat(4, 1fr); }
.hc-chal__opts button { font-size: var(--hc-text-sm); padding: 0 4px; }
.hc-chal__live { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; background: var(--hc-surface-2); border: 1px solid var(--hc-border); }
.hc-chal__live[hidden] { display: none; }
.hc-chal__big { font: 700 44px/1 var(--hc-mono, ui-monospace, monospace); text-align: center; font-variant-numeric: tabular-nums; }
.hc-chal__big small { font-size: 22px; color: var(--hc-muted); }
.hc-chal__stats { text-align: center; color: var(--hc-muted); font-size: var(--hc-text-sm); }
.hc-chal__live .hc-progress__bar { height: 8px; }
.hc-chal__run { display: flex; gap: 8px; }
.hc-chal__run .hc-big { flex: 1; }
.hc-chal__pause { min-width: 110px; min-height: 56px; }
@media (max-width: 560px) { .hc .hc-levels.hc-chal__opts { grid-template-columns: repeat(3, 1fr); } .hc .hc-levels.hc-chal__opts--4 { grid-template-columns: repeat(4, 1fr); } }
/* Challenge randomizers */
.hc-chal__rand { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--hc-border); }
.hc-chal__rand [data-cpanel] { display: flex; flex-direction: column; gap: 12px; }
.hc-chal__rand [data-cpanel][hidden] { display: none; }
.hc-subtabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--hc-surface-2); }
.hc-subtabs button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--hc-muted); font-weight: 650; font-size: var(--hc-text-sm); cursor: pointer; }
.hc-subtabs button[aria-selected='true'] { background: var(--hc-surface-3); color: var(--hc-text); }
.hc-wheel { position: relative; display: flex; justify-content: center; padding-top: 10px; }
.hc-wheel canvas { display: block; border-radius: 50%; cursor: pointer; max-width: 100%; box-shadow: 0 0 0 4px var(--hc-surface-3), 0 10px 30px rgba(0,0,0,.4); }
.hc-wheel__ptr { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 0; height: 0; z-index: 1;
  border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 24px solid #fff; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.hc-roll--wheel .hc-roll__big { font-size: 26px; }
.hc-chal__auto { flex-wrap: wrap; gap: 8px; align-items: center; }
.hc-num { display: inline-flex; flex-direction: column; gap: 4px; }
.hc-num input { width: 96px; min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--hc-border-strong); background: var(--hc-surface-2); color: var(--hc-text); font: 600 var(--hc-text-sm) var(--hc-mono, ui-monospace, monospace); }
.hc-chal__auto .hc-num span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hc-chal__auto .hc-num input { width: 80px; }
.hc-chal__rand .hc-inline { flex-wrap: wrap; }
.hc-wheel__ideas summary { cursor: pointer; font-weight: 650; font-size: var(--hc-text-sm); color: var(--hc-muted); min-height: 32px; display: flex; align-items: center; }
.hc-wheel__ideas .hc-ideas__title { display: block; }
.hc-wheel__ideas .hc-ideas__group { max-height: none; }
.hc-rng__hist .hc-face { padding-right: 10px; }
@media (max-width: 560px) { .hc-num input { width: 76px; } }

/* ---------------------------------------------------------------- Pages */
/* Each element tagged data-show="view …" only appears on those pages. */
.hc[data-view="home"] [data-show]:not([data-show~="home"]),
.hc[data-view="wheel"] [data-show]:not([data-show~="wheel"]),
.hc[data-view="dice"] [data-show]:not([data-show~="dice"]),
.hc[data-view="strokes"] [data-show]:not([data-show~="strokes"]),
.hc[data-view="ladder"] [data-show]:not([data-show~="ladder"]),
.hc[data-view="edging"] [data-show]:not([data-show~="edging"]),
.hc[data-view="redlight"] [data-show]:not([data-show~="redlight"]),
.hc[data-view="cards"] [data-show]:not([data-show~="cards"]) { display: none !important; }
.hc-gamehost { display: contents; }
a.hc-brand__name { color: inherit; text-decoration: none; }

.hc-pagebar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hc-pagebar__back { text-decoration: none; min-height: 44px; }
.hc-pagebar__links { display: flex; flex-wrap: wrap; gap: 6px; }
.hc-pagebar__links a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--hc-border); background: rgba(18, 20, 24, 0.85);
  color: var(--hc-muted); text-decoration: none; font-weight: 600; font-size: var(--hc-text-sm); }
.hc-pagebar__links a:hover { color: var(--hc-text); border-color: var(--hc-border-strong); }
.hc-pagebar__links a[aria-current="page"] { background: var(--hc-accent); color: var(--hc-accent-ink); border-color: transparent; }

/* Games hub on the basic controller */
.hc-hub__wheel { position: relative; display: flex; align-items: flex-end; gap: 12px; min-height: 150px; padding: 16px; border-radius: 12px; overflow: hidden;
  text-decoration: none; color: #fff; border: 1px solid rgba(255, 77, 79, 0.5);
  background: linear-gradient(90deg, rgba(5, 5, 6, 0.85) 0%, rgba(5, 5, 6, 0.35) 55%, rgba(5, 5, 6, 0.05) 100%); background-color: #14090b; }
.hc-hub__wheel:hover { border-color: #ff4d4f; box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.35); }
.hc-hub__art { display: none; }
.hc-hub__txt { display: flex; flex-direction: column; gap: 4px; max-width: 62%; }
.hc-hub__txt strong { font-size: 1.5rem; letter-spacing: -0.01em; text-shadow: 0 2px 8px rgba(0,0,0,.7); }
.hc-hub__txt small { color: #e9e3e3; font-size: var(--hc-text-sm); text-shadow: 0 1px 6px rgba(0,0,0,.9); }
.hc-hub__go { margin-left: auto; align-self: flex-end; padding: 10px 16px; border-radius: 999px; background: #ff4d4f; color: #1a0203; font-weight: 750; white-space: nowrap; }
.hc-hub__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.hc-hub__grid a { display: flex; flex-direction: column; gap: 4px; min-height: 76px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--hc-border);
  background: var(--hc-surface-2); color: var(--hc-text); text-decoration: none; }
.hc-hub__grid a:hover { border-color: var(--hc-accent); }
.hc-hub__grid strong { font-size: var(--hc-text-md, 1rem); }
.hc-hub__grid small { color: var(--hc-muted); font-size: var(--hc-text-xs); line-height: 1.35; }

.hc-rhythms__toggle { width: 100%; justify-content: center; }
.hc-rhythms__body { display: flex; flex-direction: column; gap: 12px; }
.hc-rhythms__body[hidden] { display: none; }
.hc-chal__wheellink { margin-left: auto; align-self: center; font-size: var(--hc-text-sm); color: var(--hc-accent); }

/* ---------------------------------------------------------------- Games */
.hc-game { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.hc-game__hero { gap: 14px; }
.hc-aw__title { margin: 0; font-size: 1.6rem; letter-spacing: -0.01em; }
.hc-gclock { --tone: var(--hc-muted); display: grid; gap: 4px; padding: 16px 18px; border-radius: 14px; border: 2px solid var(--tone);
  background: rgba(8, 9, 11, 0.82); text-align: center; transition: border-color .2s, background-color .2s; }
.hc-gclock[data-tone="go"] { --tone: var(--hc-go); }
.hc-gclock[data-tone="lead"] { --tone: var(--hc-warn); }
.hc-gclock[data-tone="rest"] { --tone: #5fd4ff; }
.hc-gclock[data-tone="stop"] { --tone: var(--hc-stop); background: rgba(60, 6, 8, 0.85); }
.hc-gclock[data-tone="edge"] { --tone: #c38bff; }
.hc-gclock[data-tone="spin"] { --tone: var(--hc-accent); }
.hc-gclock__label { font-weight: 750; font-size: var(--hc-text-lg, 1.15rem); color: var(--tone); text-transform: none; letter-spacing: 0.01em; }
.hc-gclock__time { font-family: var(--hc-mono); font-size: clamp(3.5rem, 9vw, 6rem); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: var(--hc-text); }
.hc-gclock__sub { min-height: 1.3em; color: var(--hc-muted); font-size: var(--hc-text-sm); }
.hc-gclock__bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 6px; }
.hc-gclock__bar div { height: 100%; width: 0; background: var(--tone); }
.hc-grun { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.hc-grun:not(:has(> :nth-child(3))) { grid-template-columns: 2fr 1fr; }
.hc-grun .hc-big { min-height: 64px; }
.hc-grun .hc-big.is-on { background: var(--hc-stop); color: #fff; }
.hc-grun__btn { min-height: 64px; justify-content: center; font-weight: 700; }
.hc-grun__close { background: #c38bff; color: #1b0830; border-color: transparent; }
.hc-gstats { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: var(--hc-text-sm); color: var(--hc-muted); }
.hc-gstats b { color: var(--hc-text); font-family: var(--hc-mono); }
.hc-ghist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; font-size: var(--hc-text-sm); }
.hc-ghist li { padding: 4px 0; border-bottom: 1px solid var(--hc-border); }
.hc-game .hc-counter { justify-content: flex-start; flex-wrap: nowrap; }
.hc-game .hc-counter .hc-die__faces { flex: 1; min-width: 0; }

/* Alice's Wheel — the art is the star: shown through the wheel and behind the page. */
.hc-aw { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, 1fr); gap: 20px; align-items: center; padding: 18px; border-radius: 16px;
  border: 1px solid rgba(255, 77, 79, 0.35); background: rgba(5, 5, 6, 0.35); }
.hc-aw__wheelwrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hc-aw__wheel { position: relative; width: min(100%, 560px); aspect-ratio: 1; border-radius: 50%; padding: 0; }
.hc-aw__art { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 50% 45%, #1c1012 0%, #0d0708 100%);
  box-shadow: 0 0 0 6px #111, 0 0 0 8px rgba(255, 77, 79, 0.8), 0 18px 50px rgba(0,0,0,.6); }
.hc-aw__wheel canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; cursor: pointer; will-change: transform; }
.hc-aw__ptr { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); width: 0; height: 0; z-index: 2;
  border-left: 18px solid transparent; border-right: 18px solid transparent; border-top: 34px solid #ff4d4f; filter: drop-shadow(0 3px 4px rgba(0,0,0,.7)); }
.hc-aw__hub { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: #111; border: 3px solid #ff4d4f; pointer-events: none; }
.hc-aw__side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hc-aw .hc-roll { background: rgba(8, 9, 11, 0.8); border-radius: 12px; padding: 10px 16px; min-width: 60%; }
.hc-aw .hc-roll__big { font-family: inherit; font-size: 1.4rem; text-align: center; }
.hc-slices { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.hc-slice { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; border-radius: 10px; border: 1px solid var(--hc-border); background: var(--hc-surface-2); min-height: 44px; }
.hc-slice.is-act { border-color: rgba(143, 163, 255, 0.45); }
.hc-slice__t { flex: 1; min-width: 0; font-size: var(--hc-text-sm); overflow-wrap: anywhere; }
.hc-slice select, .hc-die__add select { min-height: 36px; border-radius: 8px; border: 1px solid var(--hc-border); background: var(--hc-bg); color: var(--hc-text); font: inherit; font-size: var(--hc-text-xs); padding: 0 6px; }
.hc-slice__x { width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--hc-faint); font-size: 18px; cursor: pointer; }
.hc-slice__x:hover { color: var(--hc-stop); background: var(--hc-surface-3); }

/* Wheel page: Alice full-bleed behind everything, lighter wash than elsewhere. */
.hc[data-view="wheel"] .hc-bgart, .hc.has-bgart .hc-bgart { display: none !important; }
.hc[data-view="wheel"] .hc-bgart::after { content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 40%, rgba(10, 11, 13, 0.15) 0%, rgba(10, 11, 13, 0.55) 60%, rgba(10, 11, 13, 0.78) 100%); }
.hc[data-view="wheel"] { background: #050506; }
/* Game pages: the game gets the whole page. Device controls sit underneath. */
.hc[data-view="wheel"] .hc-main, .hc[data-view="ladder"] .hc-main, .hc[data-view="edging"] .hc-main, .hc[data-view="redlight"] .hc-main, .hc[data-view="cards"] .hc-main {
  grid-template-columns: minmax(0, 1fr); width: 100%; max-width: 1320px; margin: 0 auto; }
.hc:is([data-view="wheel"], [data-view="ladder"], [data-view="edging"], [data-view="redlight"], [data-view="cards"]) .hc-panel {
  order: 2; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.hc:is([data-view="wheel"], [data-view="ladder"], [data-view="edging"], [data-view="redlight"], [data-view="cards"]) .hc-stage { order: 1; position: static; }
.hc:is([data-view="wheel"], [data-view="ladder"], [data-view="edging"], [data-view="redlight"], [data-view="cards"]) .hc-pagebar { order: 0; }
.hc:is([data-view="wheel"], [data-view="ladder"], [data-view="edging"], [data-view="redlight"], [data-view="cards"]) .hc-game > .hc-card { max-width: none; }
@media (min-width: 1101px) { .hc[data-view="wheel"] .hc-aw { grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr); } .hc[data-view="wheel"] .hc-aw__wheel { width: min(100%, 640px); } }
.hc[data-view="wheel"] .hc-card { background: rgba(18, 20, 24, 0.82); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.hc[data-view="wheel"] .hc-top { background: rgba(18, 20, 24, 0.85); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

@media (max-width: 1200px) { .hc-aw { grid-template-columns: 1fr; } .hc-aw__wheel { width: min(100%, 520px); } }
@media (max-width: 560px) {
  .hc-grun { grid-template-columns: 1fr 1fr; } .hc-grun .hc-big { grid-column: 1 / -1; }
  .hc-hub__txt { max-width: 100%; } .hc-hub__wheel { flex-wrap: wrap; min-height: 180px; }
  .hc-aw { padding: 10px; }
}

/* ---------------------------------------------------------------- Wheel slice picker */
.hc-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.hc-pickg { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 12px; background: var(--hc-surface-3); }
.hc-pickg__head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 2px 2px; }
.hc-pickg__head h3 { font-size: var(--hc-text-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--hc-muted); margin: 0; }
.hc-pickg__n { font-size: var(--hc-text-xs); color: var(--hc-muted); }
.hc-pick { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 6px 6px 10px; border-radius: 10px; border: 1px solid transparent; background: var(--hc-surface-2); }
.hc-pick.is-on { border-color: color-mix(in srgb, var(--hc-accent) 55%, transparent); background: color-mix(in srgb, var(--hc-accent) 12%, var(--hc-surface-2)); }
.hc-pick__txt { display: flex; flex-direction: column; min-width: 0; }
.hc-pick__t { font-weight: 650; font-size: var(--hc-text-sm); }
.hc-pick__d { font-size: var(--hc-text-xs); color: var(--hc-muted); }
.hc-pick select { min-height: 36px; font-size: var(--hc-text-xs); max-width: 86px; }
.hc-pick:not(.is-on) select { opacity: .45; }
.hc-pick__step { display: flex; align-items: center; gap: 2px; }
.hc-pick__step button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--hc-border-strong); background: var(--hc-surface); color: var(--hc-text); font-size: 1.25rem; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.hc-pick__step button:hover:not(:disabled) { background: var(--hc-surface-3); }
.hc-pick__step button:disabled { opacity: .3; cursor: default; }
.hc-pick__step [data-pu] { border-color: var(--hc-accent); color: var(--hc-accent); }
.hc-pick__n { min-width: 26px; text-align: center; font-family: var(--hc-mono); font-weight: 700; font-variant-numeric: tabular-nums; }
.hc-pick:not(.is-on) .hc-pick__n { color: var(--hc-muted); }
.hc-aw__setupbtn { width: 100%; margin-top: 8px; }

/* ---------------------------------------------------------------- Game setup */
.hc-setup { width: min(560px, calc(100vw - 24px)); }
.hc-setup h3 { font-size: var(--hc-text-md, 1rem); margin: 4px 0 8px; }
.hc-setup__step { display: flex; flex-direction: column; gap: 6px; min-height: 210px; }
.hc-setup__dots { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; }
.hc-setup__dots li { flex: 1; height: 4px; border-radius: 4px; background: var(--hc-surface-3); }
.hc-setup__dots li.is-on { background: var(--hc-accent); }
.hc-setup__wheels { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hc-setup__wheel { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; text-align: left; padding: 12px; min-height: 74px; border-radius: 12px; border: 1px solid var(--hc-border-strong); background: var(--hc-surface-2); color: var(--hc-text); cursor: pointer; }
.hc-setup__wheel span { font-size: var(--hc-text-xs); color: var(--hc-muted); }
.hc-setup__wheel[aria-pressed='true'] { border-color: var(--hc-accent); background: color-mix(in srgb, var(--hc-accent) 16%, var(--hc-surface-2)); }
.hc-setup__sum { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.hc-setup__conn { margin: 4px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hc-setup__conn .hc-ok { color: #3ddc84; font-weight: 650; }
@media (max-width: 560px) { .hc-picks { grid-template-columns: 1fr; } .hc-pick { gap: 6px; } .hc-pick select { max-width: 72px; padding-inline: 4px; } .hc-pick__step button { width: 38px; } .hc-setup__wheels { grid-template-columns: 1fr; } }

/* Wheel page: wheel + clock fill the first screen */
.hc[data-view="wheel"] .hc-aw { min-height: calc(100dvh - 150px); align-items: center; }
@media (min-width: 1101px) { .hc[data-view="wheel"] .hc-aw__wheel { width: min(100%, calc(100dvh - 250px), 760px); } }
.hc-aw__hist { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.35); }
.hc-aw__hist h2 { font-size: var(--hc-text-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--hc-muted); margin: 0 0 6px; }
.hc-aw__hist .hc-ghist { max-height: 160px; }

/* Ladder, edge trainer, red light: clock on the left, settings on the right */
@media (min-width: 1101px) {
  .hc:is([data-view="ladder"], [data-view="edging"], [data-view="redlight"], [data-view="cards"]) .hc-game:not([hidden]) {
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); align-items: start; }
  .hc:is([data-view="ladder"], [data-view="edging"], [data-view="redlight"], [data-view="cards"]) .hc-game > .hc-game__hero { grid-row: 1 / span 6; position: sticky; top: 80px; min-height: calc(100dvh - 170px); justify-content: center; }
  .hc:is([data-view="ladder"], [data-view="edging"], [data-view="redlight"], [data-view="cards"]) .hc-game__hero .hc-gclock__time { font-size: clamp(5rem, 11vw, 10rem); }
}
@media (min-width: 1101px) { .hc[data-view="wheel"] .hc-aw .hc-gclock__time { font-size: clamp(5rem, 7vw, 8rem); } }

.hc-aw__total { align-self: stretch; text-align: center; padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--hc-border); font-size: var(--hc-text-sm); color: var(--hc-muted); }
.hc-aw__total b { font-family: var(--hc-mono); font-size: 1.6rem; color: var(--hc-text); margin-left: 6px; vertical-align: -2px; font-variant-numeric: tabular-nums; }
.hc-aw__total.is-low b { color: #ffb547; }
/* phones: keep Store, hide the player button and keyboard-shortcuts button to make room */
@media (max-width: 560px) { .hc-top__store:not(.hc-top__shop), .hc-top [data-ref="kbdBtn"] { display: none; } .hc-top__shop { padding: 0 10px; } }

/* ---------- game pages: Watch a video + Funscript player ---------- */
.hc-gametools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; margin: 12px 0;
  background: var(--hc-surface); border: 1px solid var(--hc-border); border-radius: var(--hc-radius); }
.hc-gametools svg { width: 18px; height: 18px; }
.hc .hc-gametools a, .hc .hc-gametools a span { text-decoration: none; }
.hc-gametools small { flex: 1 1 220px; font-size: var(--hc-text-xs); line-height: 1.4; }
.hc-gametools .hc-btn[aria-pressed="true"] { border-color: var(--hc-accent); color: var(--hc-accent); }
.hc-linkbtn { background: none; border: 0; padding: 0; color: var(--hc-accent); font: inherit; text-decoration: underline; cursor: pointer; }

.hc-watch { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: 520px; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column; background: var(--hc-surface); border: 1px solid var(--hc-border-strong);
  border-radius: var(--hc-radius); box-shadow: 0 18px 50px rgba(0,0,0,.6); overflow: hidden; }
.hc-watch[hidden] { display: none; }
.hc-watch[data-size="0"] { width: 360px; }
.hc-watch[data-size="2"] { width: 760px; }
.hc-watch__bar { display: flex; align-items: center; gap: 2px; padding: 4px 4px 4px 12px; cursor: grab; user-select: none; touch-action: none;
  background: var(--hc-surface-2); border-bottom: 1px solid var(--hc-border); }
.hc-watch.is-drag .hc-watch__bar { cursor: grabbing; }
.hc-watch__bar .hc-btn--sm { min-height: 34px; padding: 0 9px; }
.hc-watch__title { font-size: var(--hc-text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hc-watch__pick { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.hc-watch__pick[hidden] { display: none; }
.hc-watch__pick .hc-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.hc-watch__pick label.hc-btn { cursor: pointer; }
.hc-watch__pick .hc-help { margin: 0; font-size: var(--hc-text-xs); color: var(--hc-muted); line-height: 1.4; }
.hc-watch__recent { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--hc-text-xs); }
.hc-watch__screen { position: relative; aspect-ratio: 16 / 9; background: #000; }
.hc-watch__screen[hidden] { display: none; }
.hc-watch__screen iframe, .hc-watch__screen video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.hc-watch.is-drag .hc-watch__screen::after { content: ""; position: absolute; inset: 0; } /* keep the drag when passing over the video */
.hc-watch__note { padding: 8px 12px; font-size: var(--hc-text-xs); color: var(--hc-muted); border-top: 1px solid var(--hc-border); }
.hc-watch__note[hidden] { display: none; }
.hc-watch.is-min .hc-watch__body { display: none; }
.hc-watch.is-min { width: 300px; }
@media (max-width: 700px) {
  .hc-watch, .hc-watch[data-size] { left: 8px; right: 8px; bottom: 8px; width: auto; max-width: none; }
  .hc-watch__bar { cursor: default; }
  .hc-watch[data-size="0"] .hc-watch__screen { aspect-ratio: 21 / 9; }
  .hc-watch.is-min { left: auto; width: 220px; }
  .hc-gametools .hc-btn { flex: 1 1 auto; }
}

/* Game pages: every game + the funscript player as its own button */
.hc-pagebar__links a { text-decoration: none; font-weight: 600; font-size: var(--hc-text-sm); color: var(--hc-text); }
.hc-pagebar__links a.hc-pagebar__fs { border-color: var(--hc-accent); color: var(--hc-accent); }
@media (max-width: 560px) {
  .hc-pagebar { gap: 8px; }
  .hc-pagebar__links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .hc-pagebar__links a { justify-content: center; padding: 0 8px; }
}
.hc-pagebar__links a.hc-pagebar__store { color: var(--hc-muted); border-style: dashed; }
.hc[data-view="home"] .hc-pagebar { grid-column: 1 / -1; }

/* ---------------------------------------------------------------- game setup */
.hc-gsetup { display: grid; gap: 10px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--hc-border); background: rgba(143, 163, 255, 0.06); }
.hc-gsetup__eyebrow { font-size: var(--hc-text-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hc-accent); }
.hc-gsetup__desc { margin: 0; line-height: 1.55; color: var(--hc-text); }
.hc-gsetup__go { min-height: 60px; }
.hc-gsetup__hint { margin: 0; font-size: var(--hc-text-xs); color: var(--hc-muted); line-height: 1.4; }
.hc[data-view="dice"] .hc-gsetup, .hc[data-view="strokes"] .hc-gsetup { margin-bottom: 14px; }
.hc:not(.is-playing) [data-setup-hide] { display: none !important; }

/* ---------------------------------------------------------------- game screen */
html.hc-noscroll, html.hc-noscroll body { overflow: hidden; }
.hc-play { display: contents; } /* children are fixed; no stacking context so the docked video can sit between them */
.hc.is-playing { --top: 52px; --bot: 76px; }
.hc-play__top { position: fixed; left: 0; right: 0; top: 0; height: var(--top); z-index: 1003; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: rgba(10, 11, 13, 0.92); border-bottom: 1px solid var(--hc-border); }
.hc-play__title { font-size: var(--hc-text-md, 1rem); white-space: nowrap; }
.hc-play__status { color: var(--hc-muted); font-size: var(--hc-text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hc-play__status b { color: var(--hc-text); }
.hc-play__estop { min-height: 38px; padding: 0 14px; }
.hc-play__stage { position: fixed; left: 0; right: 0; top: var(--top); bottom: var(--bot); z-index: 1000; display: grid; place-items: center; background: #000; }
.hc-play__novideo { text-align: center; color: var(--hc-muted); display: grid; gap: 12px; justify-items: center; padding: 20px; }
.hc-play__novideo strong { color: var(--hc-text); font-size: 1.1rem; }
.hc-play__bar { position: fixed; left: 0; right: 0; bottom: 0; min-height: var(--bot); z-index: 1003; display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: rgba(10, 11, 13, 0.94); border-top: 1px solid var(--hc-border); }
.hc-play__barin { display: flex; gap: 8px; flex: 1; min-width: 0; }
.hc-play__barin > * { flex: 1; min-height: 56px !important; max-width: 260px; }
.hc-play__barin .hc-big { font-size: 1rem; }
.hc-play__exit { flex: none; min-height: 56px; }

/* Focus panel: wheel / timer / dice / count. Small in the corner; zooms to the middle. */
.hc-play__focus { position: fixed; left: 0; top: 0; z-index: 1002; transform-origin: 0 0; opacity: 0; display: grid; gap: 10px; justify-items: center;
  padding: 12px; border-radius: 18px; background: rgba(10, 11, 13, 0.72); border: 1px solid rgba(255,255,255,0.12); box-shadow: 0 12px 40px rgba(0,0,0,.5); backdrop-filter: blur(6px); }
.hc-play__focus.is-ready { opacity: 1; transition: transform .5s cubic-bezier(.2,.8,.2,1), opacity .2s, background .3s; }
.hc-play__focus[data-state="big"] { background: rgba(10, 11, 13, 0.82); }
.hc-play__focusin { display: grid; gap: 10px; justify-items: center; width: 100%; }
.hc-play__focus[data-kind="clock"], .hc-play__focus[data-kind="count"] { width: 440px; }
.hc-play__focus[data-kind="wheel"] { width: 420px; }
.hc-play__focus[data-kind="dice"] { width: min(760px, 94vw); }
.hc-play__focus .hc-gclock { width: 100%; background: rgba(0,0,0,.35); }
.hc-play__focus .hc-gclock__time { font-size: 4.6rem; }
.hc-play__focus[data-kind="wheel"] .hc-gclock { padding: 10px 14px; }
.hc-play__focus[data-kind="wheel"] .hc-gclock__time { font-size: 2.6rem; }
.hc-play__focus .hc-aw__wheelwrap { width: 100%; }
.hc-play__focus .hc-aw__wheel { width: 100%; }
.hc-play__focus .hc-roll--wheel { width: 100%; min-height: 64px; }
.hc-play__focus .hc-chal__live { width: 100%; }
.hc-play__focus .hc-dice { width: 100%; }
.hc-play__focus .hc-die__faces, .hc-play__focus .hc-die__add, .hc-play__focus .hc-die__tools, .hc-play__focus .hc-ideas, .hc-play__focus [data-ddel] { display: none !important; }
.hc-play__focus .hc-die__name { pointer-events: none; background: transparent; border-color: transparent; }
.hc-play__ok { justify-self: center; }
.hc-play__over { position: fixed; left: 0; right: 0; bottom: calc(var(--bot) + 16px); z-index: 1004; display: flex; justify-content: center; pointer-events: none; }
body:has(.hc-play__over:not([hidden])) .hc-watch__note { visibility: hidden; }
.hc-play__overcard { pointer-events: auto; display: grid; gap: 8px; justify-items: center; text-align: center; padding: 16px 20px; border-radius: 16px;
  background: rgba(18, 20, 24, 0.96); border: 1px solid var(--hc-border); box-shadow: 0 12px 40px rgba(0,0,0,.6); max-width: min(520px, 92vw); }
.hc-play__overcard h2 { margin: 0; font-size: 1.25rem; }
.hc-play__overcard p { margin: 0; }

/* The video window docked into the game screen */
.hc-watch.is-docked { position: fixed; left: 0; right: 0; top: var(--top, 52px); bottom: var(--bot, 76px); width: auto !important; max-width: none;
  z-index: 1001; border-radius: 0; border: 0; display: flex; flex-direction: column; background: #000; transition: filter .4s; }
.hc-watch.is-docked .hc-watch__bar { display: none; }
.hc-watch.is-docked .hc-watch__body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.hc-watch.is-docked .hc-watch__screen { flex: 1; aspect-ratio: auto; min-height: 0; }
.hc-watch.is-docked .hc-watch__pick { max-width: 560px; width: 100%; margin: auto; background: var(--hc-surface); border-radius: 14px; border: 1px solid var(--hc-border); }
.hc-watch.is-docked .hc-watch__note { background: rgba(0,0,0,.6); }
.hc-watch.is-docked.is-ducked { filter: brightness(.45) saturate(.8); }

@media (max-width: 700px) {
  .hc.is-playing { --top: 48px; --bot: 70px; }
  .hc-play__title { font-size: .95rem; }
  .hc-play__status { display: none; }
  .hc-play__top .hc-btn--sm { padding: 0 8px; }
  .hc-play__barin > * { min-height: 50px !important; padding: 0 8px; font-size: .9rem; }
  .hc-play__exit { min-height: 50px; padding: 0 10px; font-size: .85rem; }
}

.hc-play__barin .hc-big.is-on, .hc-play__barin .hc-big[data-on="true"] { background: var(--hc-stop); color: #fff; }
.hc-play__focus:not(:has(.hc-play__focusin > :not([hidden]))) { display: none; }
/* top bar never pushes STOP off a phone screen */
.hc-play__title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hc-play__top > button, .hc-play__top > .hc-btn { flex: none; }
.hc-play__top, .hc-play__bar { background: #0a0b0d; }
@media (max-width: 700px) {
  .hc-play__top { gap: 6px; padding: 0 8px; }
  .hc-play__top .hc-btn--sm { font-size: .8rem; min-height: 34px; }
  .hc-play__estop { padding: 0 10px; }
}

/* ---------------------------------------------------------------- Cards */
.hc-cards { display: grid; gap: 10px; justify-items: center; width: 100%; }
.hc-pcard { position: relative; width: 168px; aspect-ratio: 5 / 7; border-radius: 14px; background: #f7f4ee; color: #16171a;
  box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 0 0 1px rgba(0,0,0,.08); display: grid; place-items: center; font-family: Georgia, 'Times New Roman', serif; }
.hc-pcard[data-red="true"] { color: #c8102e; }
.hc-pcard[data-back="true"] { background: repeating-linear-gradient(45deg, #2b3a8f 0 8px, #3a4bb0 8px 16px); color: transparent; box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 0 0 6px #f7f4ee; }
.hc-pcard[data-joker="true"] { background: linear-gradient(160deg, #fff6d8, #f3d7ff); color: #6b2fb3; }
.hc-pcard__c { position: absolute; display: grid; justify-items: center; line-height: 1; font-weight: 700; font-size: 1.35rem; }
.hc-pcard__c small { font-size: 1.15rem; }
.hc-pcard__c--tl { top: 10px; left: 12px; }
.hc-pcard__c--br { bottom: 10px; right: 12px; transform: rotate(180deg); }
.hc-pcard__mid { font-size: 4.6rem; line-height: 1; }
.hc-pcard[data-joker="true"] .hc-pcard__mid { font-size: 1.5rem; font-weight: 700; letter-spacing: .08em; }
.hc-pcard.is-flip { animation: hc-flip .55s cubic-bezier(.2,.8,.2,1); }
@keyframes hc-flip { 0% { transform: rotateY(90deg) scale(.9); } 100% { transform: rotateY(0) scale(1); } }
@media (prefers-reduced-motion: reduce) { .hc-pcard.is-flip { animation: none; } }
.hc-cards__act { font-size: 1.15rem; font-weight: 700; text-align: center; min-height: 1.4em; }
.hc-cards__left { color: var(--hc-muted); font-size: var(--hc-text-sm); }
.hc-cards__key { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: var(--hc-text-sm); margin: 0; }
.hc-cards__key dt { font-weight: 700; white-space: nowrap; }
.hc-cards__key dd { margin: 0; color: var(--hc-muted); }
.hc-cards__key .r { color: #ff5a6e; }
.hc-play__focus[data-kind="cards"] { width: 380px; }
.hc-play__focus .hc-cards .hc-gclock { padding: 10px 14px; }
.hc-play__focus[data-kind="cards"] .hc-gclock__time { font-size: 2.6rem; }

/* ---- Simple controller (hc-pad.js) on the home page ---- */
.hp { --hp-accent: #8fa3ff; --hp-bg: #121317; --hp-bg2: #1b1d23; --hp-line: #2a2d36; font-family: Geist, system-ui, sans-serif; }
.hc-simple:empty { display: none; }
.hc[data-simple="0"] .hc-simple { display: none; }
.hc[data-simple="1"][data-view="home"] :is(.hc-now, .hc-prog, .hc-logcard, .hc-panel > .hc-card) { display: none; }
.hc-fulltoggle { align-self: flex-start; }
.hc-video:fullscreen, .hc-video:-webkit-full-screen { width: 100vw; height: 100vh; max-height: none; border-radius: 0; aspect-ratio: auto; background: #000; }
.hc-video:fullscreen video { width: 100%; height: 100%; object-fit: contain; }
.hc-video:fullscreen .hc-video__bar { opacity: 1; pointer-events: auto; }
