/* Family Quest — Dim Campfire Console Design System
 * Shadowless night-indigo surfaces, 1px structural borders, warm ember-amber cues.
 * Zero gradients on CTAs, zero emojis (inline SVG only), WCAG AA contrast,
 * committed tactile press/hover states, prefers-reduced-motion safe.
 */

:root {
  --bg: #0F0F23;
  --surface-recessed: #14142C;
  --surface: #1A1A36;
  --surface-raised: #222246;
  --surface-hover: #292954;

  --border: #2C2C54;
  --border-strong: #43437A;

  --fg: #F4F1EA;
  --fg-muted: #B0AFCE;
  --fg-dim: #8483AC;

  --accent: #F97316;
  --accent-hover: #FB923C;
  --accent-ink: #0F0F23;
  --accent-tint: #2B1C19;
  --accent-border: #C25914;

  --heart: #F43F5E;
  --heart-empty: #373761;
  --success: #34D399;
  --success-tint: #132A2A;
  --warning: #F59E0B;
  --warning-tint: #2C2314;
  --danger: #FB7185;
  --danger-tint: #2E1722;

  --focus-ring: #FB923C;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --duration-fast: 110ms;
  --duration-med: 200ms;
  --duration-slow: 280ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
}

a {
  color: var(--fg);
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ic {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.ic-lg {
  width: 24px;
  height: 24px;
}

.ic-sm {
  width: 14px;
  height: 14px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Committed tactile baseline (hover moves, press compresses) */
.btn,
.cue-pad,
.tab-btn,
.d20-btn,
.nudge-btn,
.pin-key,
.icon-btn {
  transition:
    transform var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    opacity var(--duration-fast) var(--ease-out);
}

@media (hover: hover) {
  .btn:not(:disabled):hover,
  .cue-pad:not(:disabled):hover,
  .d20-btn:not(:disabled):hover,
  .nudge-btn:not(:disabled):hover,
  .pin-key:not(:disabled):hover,
  .icon-btn:not(:disabled):hover {
    transform: translateY(-1px);
  }
}

.btn:not(:disabled):active,
.cue-pad:not(:disabled):active,
.d20-btn:not(:disabled):active,
.nudge-btn:not(:disabled):active,
.pin-key:not(:disabled):active,
.icon-btn:not(:disabled):active,
.is-pressed {
  transform: scale(0.97);
}

/* Shared button primitives */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--fg);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--fg-dim);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  background: var(--danger-tint);
  border-color: #7F2940;
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #3D1C2C;
  border-color: var(--danger);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--fg-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border-strong);
}

.btn-sm {
  min-height: 44px;
  padding: 8px 12px;
  font-size: 0.875rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-muted);
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-raised);
  color: var(--fg);
  border-color: var(--border-strong);
}

/* Structural cards & panels (strictly shadowless) */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  min-width: 0;
}

.panel-recessed {
  background: var(--surface-recessed);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  min-width: 0;
}

/* Top console header bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-recessed);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 2px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--fg);
  min-width: 0;
}

.brand-mark > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark .brand-ember {
  color: var(--accent);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  border-bottom: 2px solid transparent;
  transition: color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}

.nav-link:hover {
  color: var(--fg);
}

.nav-link.is-active {
  color: var(--accent);
  font-weight: 700;
  border-bottom-color: var(--accent);
}

/* Status badges & pills */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-dim);
  flex-shrink: 0;
}

.status-dot.is-live {
  background: var(--success);
}

.status-dot.is-cued {
  background: var(--accent);
}

.status-dot.is-speaking {
  background: #60A5FA;
}

.status-dot.is-warn {
  background: var(--warning);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-recessed);
  font-size: 0.8125rem;
  color: var(--fg-muted);
  white-space: nowrap;
}

.badge-warn {
  background: var(--warning-tint);
  border-color: #785513;
  color: var(--warning);
}

.badge-accent {
  background: var(--accent-tint);
  border-color: var(--accent-border);
  color: var(--accent-hover);
}

.badge-success {
  background: var(--success-tint);
  border-color: #1F6E58;
  color: var(--success);
}

/* Toast banner (smooth enter/exit, no snap) */
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(14px);
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  max-width: min(92vw, 440px);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--fg);
  font-size: 0.875rem;
  font-weight: 500;
  transition: opacity var(--duration-med) var(--ease-out), transform var(--duration-med) var(--ease-out);
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.is-error {
  background: var(--danger-tint);
  border-color: #7F2940;
  color: #FECDD3;
}

.toast.is-warn {
  background: var(--warning-tint);
  border-color: #785513;
  color: #FDE68A;
}

/* =========================================================
 * LIVE PHONE CO-PILOT REMOTE (/)
 * Mobile-first 390x844, thumb-zone ergonomics, >= 56px pads
 * ========================================================= */

.remote-shell {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding: 12px 12px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.campaign-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.campaign-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.campaign-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  font-weight: 600;
}

.campaign-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-recessed);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  flex-shrink: 0;
}

.timer-pill.is-wrap {
  background: var(--warning-tint);
  border-color: #9A6700;
  color: var(--warning);
}

/* Compact Hero HUD Strip */
.hero-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.hero-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.hero-pill.is-cued {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.hero-pill-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.hero-pill-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-pill-type {
  font-size: 0.72rem;
  color: var(--fg-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hearts-row {
  display: flex;
  align-items: center;
  gap: 3px;
}

.heart-ic {
  width: 15px;
  height: 15px;
}

.heart-ic.is-full {
  color: var(--heart);
  fill: var(--heart);
}

.heart-ic.is-empty {
  color: var(--heart-empty);
  fill: none;
}

.dizzy-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--warning);
  margin-left: 4px;
}

.backpack-line {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Session bar & state */
.session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.session-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg-muted);
  min-width: 0;
}

/* Live Transcript Ticker */
.transcript-box {
  background: var(--surface-recessed);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  min-height: 92px;
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.transcript-empty {
  color: var(--fg-dim);
  font-size: 0.85rem;
  margin: auto 0;
}

.tx-line {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--fg);
  animation: fadeSlideIn var(--duration-med) var(--ease-out);
}

.tx-line.is-user {
  color: #FED7AA;
}

.tx-line.is-event {
  color: var(--success);
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.tx-role {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
  margin-right: 6px;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Primary Thumb Zone — Cue Pads (>= 56px, asymmetric lead pad) */
.thumb-deck {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cue-pad {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  min-height: 76px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  text-align: left;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.cue-pad-primary {
  min-height: 92px;
  background: var(--surface-raised);
  border-color: #4D4D8C;
}

.cue-pad:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.cue-pad.is-active {
  background: var(--accent-tint);
  border: 2px solid var(--accent);
  padding: 13px 15px;
}

.cue-pad-top {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.cue-pad-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
}

.cue-pad-title > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cue-pad.is-active .cue-pad-title {
  color: #FFEDD5;
}

.cue-pad-sub {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.cue-pad.is-active .cue-pad-sub {
  color: var(--accent-hover);
}

.cue-pill-state {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-recessed);
  color: var(--fg-dim);
}

.cue-pad.is-active .cue-pill-state {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* Signature Product Moment: Live Voice Level Meter Strip inside cue deck */
.meter-track {
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--surface-recessed);
  overflow: hidden;
  border: 1px solid var(--border);
}

.meter-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 80ms linear;
}

.hero-pads-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.hero-pads-grid .cue-pad {
  min-height: 76px;
  padding: 12px;
}

.hero-pads-grid .cue-pad.is-active {
  padding: 11px;
}

.hero-pads-grid .cue-pad-title {
  font-size: 0.94rem;
  gap: 6px;
}

.hero-pads-grid .cue-pill-state {
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  padding: 2px 6px;
}

.deck-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  min-width: 0;
}

.stop-dm-btn {
  min-height: 56px;
  font-size: 0.95rem;
  font-weight: 700;
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  background: var(--surface-recessed);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.mode-opt {
  min-height: 48px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}

.mode-opt.is-selected {
  background: var(--surface-raised);
  border-color: var(--border-strong);
  color: var(--fg);
}

/* Collapsible Backstage Drawer (smooth reveal, never snaps) */
.drawer-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.drawer-toggle {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
  font-size: 0.9375rem;
}

.drawer-toggle:hover {
  background: var(--surface-raised);
}

.drawer-chevron {
  transition: transform var(--duration-med) var(--ease-out);
}

.drawer-wrap.is-open .drawer-chevron {
  transform: rotate(180deg);
}

.drawer-body {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows var(--duration-slow) var(--ease-out), opacity var(--duration-med) var(--ease-out);
}

.drawer-wrap.is-open .drawer-body {
  grid-template-rows: 1fr;
  opacity: 1;
}

.drawer-inner {
  overflow: hidden;
}

.drawer-content {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-heading {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  margin: 0 0 8px;
}

/* 1-20 d20 Roll Override Grid */
.d20-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.d20-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.d20-btn {
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-recessed);
  color: var(--fg);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
}

.d20-btn:hover:not(:disabled) {
  background: var(--surface-raised);
  border-color: var(--accent);
}

.d20-btn.is-nat20 {
  border-color: var(--accent-border);
  color: var(--accent-hover);
  background: var(--accent-tint);
}

.d20-btn.is-low {
  color: var(--fg-muted);
}

/* Silent Producer Nudges (4 nudges, 2x2 grid) */
.nudge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.nudge-btn {
  min-height: 48px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-recessed);
  color: var(--fg);
  font-size: 0.84rem;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nudge-btn:hover:not(:disabled) {
  background: var(--surface-raised);
  border-color: var(--border-strong);
}

/* Manual Heart / Item Adjusters */
.adjuster-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-recessed);
}

.adjuster-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.adjuster-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-quick-form {
  display: flex;
  gap: 6px;
}

.item-quick-form .field-input {
  flex: 1;
  min-width: 0;
}

/* Toggle Switch Rows */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-recessed);
  min-height: 52px;
  cursor: pointer;
}

.toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.toggle-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
}

.toggle-desc {
  font-size: 0.76rem;
  color: var(--fg-dim);
}

.toggle-input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

/* Form fields (always paired with visible <label>) */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
}

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-recessed);
  color: var(--fg);
  font-size: 0.92rem;
}

.field-textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.45;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.field-input:focus-visible,
.field-select:focus-visible,
.field-textarea:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

/* =========================================================
 * PIN LOGIN SCREEN (/login)
 * ========================================================= */

.login-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

.login-card {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.login-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-sub {
  margin: 0;
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.pin-dots {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-recessed);
  justify-content: center;
}

.pin-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
  transition: background-color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}

.pin-dot.is-filled {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.1);
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pin-key {
  min-height: 56px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-key:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.pin-key-action {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.form-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #7F2940;
  background: var(--danger-tint);
  color: #FECDD3;
  font-size: 0.875rem;
}

/* =========================================================
 * PHASE 1 AUDIO SPIKE HARNESS (/spike)
 * ========================================================= */

.spike-shell {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 14px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.spike-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  font-weight: 600;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
}

.metric-value.is-good {
  color: var(--success);
}

.metric-value.is-warn {
  color: var(--warning);
}

.diag-log {
  background: var(--surface-recessed);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--fg-muted);
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* =========================================================
 * PARENT CPANEL (/admin)
 * ========================================================= */

.admin-shell {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.admin-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.admin-sub {
  margin: 4px 0 0;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* Tabs: weight + color + 2px bottom border (ANTI-SLOP Tier 1 compliant) */
.tabs-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-bar::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--fg-muted);
  font-size: 0.92rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--fg);
}

.tab-btn.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel {
  display: none;
  animation: fadeSlideIn var(--duration-med) var(--ease-out);
}

.tab-panel.is-active {
  display: block;
}

.admin-grid-asym {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.heroes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 820px) {
  .admin-grid-asym,
  .heroes-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 520px) {
  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.traits-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.trait-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-recessed);
}

.trait-chip.is-super {
  border-color: var(--accent-border);
  background: var(--accent-tint);
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-card {
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-recessed);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list-card.is-pinned {
  border-left: 3px solid var(--accent);
}

.list-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.spend-bar-track {
  width: 100%;
  height: 10px;
  border-radius: 5px;
  background: var(--surface-recessed);
  border: 1px solid var(--border);
  overflow: hidden;
}

.spend-bar-fill {
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
  transition: transform var(--duration-slow) var(--ease-out);
}

.spend-bar-fill.is-high {
  background: var(--warning);
}

.spend-bar-fill.is-capped {
  background: var(--danger);
}

.scan-dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--surface-recessed);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scan-preview {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.session-transcript {
  margin-top: 8px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--fg-muted);
  white-space: pre-wrap;
  max-height: 240px;
  overflow-y: auto;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

/* Reduced motion safety */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .btn:hover,
  .btn:active,
  .cue-pad:hover,
  .cue-pad:active,
  .d20-btn:hover,
  .d20-btn:active,
  .nudge-btn:hover,
  .nudge-btn:active,
  .pin-key:hover,
  .pin-key:active {
    transform: none !important;
  }
}
