/* fasttrack/3d.css — extracted from 3d.html
 * 3D viewport chrome (loader, glass panels, fixed control rail per HR-6.2,
 * settings/replay overlays, emoji reactions). No game logic — purely the
 * presentation surface for fasttrack-3d.js + fasttrack-game-core.js.
 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0a14;
  color: #fff;
  font-family: 'Orbitron', 'Segoe UI', sans-serif;
  overflow: hidden;
  font-size: clamp(16px, 2.6vw, 19px);
}

button,
input,
select,
textarea,
.glass-panel,
.player-name,
.player-status,
.player-meta {
  font-size: clamp(14px, 2.4vw, 18px);
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  button,
  input,
  select,
  textarea,
  .glass-panel,
  .player-name,
  .player-status,
  .player-meta {
    font-size: 14px !important;
  }
}

#container {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* ══════════════════════════════════════════════
       BOARD LOADING SCREEN — 80s wizard atmosphere
       Fades out on ft3d:ready
       ══════════════════════════════════════════════ */
#ft3d-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  background: #07040f;
  background-image:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(140, 0, 220, 0.28) 0%, transparent 65%),
    radial-gradient(ellipse 60% 35% at 50% 100%, rgba(30, 220, 40, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse 90% 30% at 50% 58%, rgba(0, 200, 255, 0.10) 0%, transparent 60%);
  transition: opacity 0.65s ease;
}

#ft3d-loader.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Three concentric spinning rings */
.ft3d-spinner {
  position: relative;
  width: 120px;
  height: 120px;
}

.ft3d-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  animation: ft3dSpin linear infinite;
}

.ft3d-ring:nth-child(1) {
  border-top-color: #00ffff;
  border-right-color: rgba(0, 255, 255, 0.15);
  width: 120px;
  height: 120px;
  animation-duration: 1.1s;
  box-shadow: 0 0 18px rgba(0, 255, 255, 0.4);
}

.ft3d-ring:nth-child(2) {
  border-top-color: #39ff14;
  border-left-color: rgba(57, 255, 20, 0.15);
  width: 88px;
  height: 88px;
  top: 16px;
  left: 16px;
  animation-duration: 0.8s;
  animation-direction: reverse;
  box-shadow: 0 0 14px rgba(57, 255, 20, 0.35);
}

.ft3d-ring:nth-child(3) {
  border-top-color: #bf00ff;
  border-bottom-color: rgba(191, 0, 255, 0.15);
  width: 56px;
  height: 56px;
  top: 32px;
  left: 32px;
  animation-duration: 0.6s;
  box-shadow: 0 0 12px rgba(191, 0, 255, 0.4);
}

@keyframes ft3dSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Pulsing center dot */
.ft3d-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  top: 55px;
  left: 55px;
  border-radius: 50%;
  background: #00ffff;
  box-shadow: 0 0 16px #00ffff, 0 0 32px rgba(0, 255, 255, 0.5);
  animation: ft3dPulse 1.1s ease-in-out infinite alternate;
}

@keyframes ft3dPulse {
  from {
    transform: scale(0.7);
    opacity: 0.6;
  }

  to {
    transform: scale(1.3);
    opacity: 1.0;
  }
}

/* Label */
#ft3d-loader-label {
  font-family: 'Orbitron', monospace;
  font-size: clamp(11px, 1.8vw, 15px);
  letter-spacing: 0.25em;
  color: rgba(0, 255, 255, 0.85);
  text-shadow: 0 0 12px rgba(0, 255, 255, 0.55);
  animation: ft3dBlink 1.4s ease-in-out infinite alternate;
}

@keyframes ft3dBlink {
  from {
    opacity: 0.55;
  }

  to {
    opacity: 1.00;
  }
}

/* 80s horizon grid at the bottom */
#ft3d-loader-grid {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 38vh;
  background:
    linear-gradient(to bottom, transparent 0%, rgba(140, 0, 220, 0.18) 100%),
    repeating-linear-gradient(90deg, transparent, transparent 59px, rgba(0, 200, 255, 0.12) 60px),
    repeating-linear-gradient(180deg, transparent, transparent 29px, rgba(0, 200, 255, 0.10) 30px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
       3D GLASS PANEL SYSTEM — minimalist, never covers board
       ═══════════════════════════════════════════════════════════════ */

/* ── Shared glass effect ── */
.glass-panel {
  background: rgba(8, 10, 24, 0.55);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 0.5px rgba(0, 180, 255, 0.1);
  transform-style: flat;
  will-change: transform;
  isolation: isolate;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 12px rgba(0, 180, 255, 0.15);
}

/* ── Player strip — top-left corner ── */
#panel-players {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 40;
  border-radius: 14px;
  padding: 10px 14px;
  font-family: 'Rajdhani', 'Segoe UI', sans-serif;
  transform: perspective(800px) rotateY(1.5deg) rotateX(-0.5deg);
  max-width: 220px;
}

#panel-players:hover {
  transform: perspective(800px) rotateY(0deg) rotateX(0deg);
}

#game-status {
  color: #ffe033;
  font-weight: 700;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  text-shadow: 0 0 12px rgba(255, 220, 0, 0.6);
}

#player-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  transition: all 0.3s ease;
  font-size: 1em;
  transform: perspective(600px) rotateY(0.5deg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.player-row:hover {
  transform: perspective(600px) rotateY(0deg) translateX(2px);
  background: rgba(255, 255, 255, 0.04);
}

.player-row.active {
  background: rgba(0, 180, 255, 0.1);
  border-left: 2px solid rgba(0, 180, 255, 0.7);
  transform: perspective(600px) rotateY(0deg) translateX(3px) scale(1.02);
  outline: 2px solid rgba(255, 224, 51, 0.9);
  box-shadow: inset 0 0 16px rgba(0, 180, 255, 0.22), 0 0 14px rgba(255, 224, 51, 0.75), 0 2px 8px rgba(0, 180, 255, 0.2);
  animation: playerTurnPulse 1.15s ease-in-out infinite;
}

@keyframes playerTurnPulse {

  0%,
  100% {
    box-shadow: inset 0 0 16px rgba(0, 180, 255, 0.18), 0 0 8px rgba(255, 224, 51, 0.45), 0 2px 8px rgba(0, 180, 255, 0.18);
  }

  50% {
    box-shadow: inset 0 0 24px rgba(0, 180, 255, 0.28), 0 0 18px rgba(255, 224, 51, 0.95), 0 2px 12px rgba(0, 180, 255, 0.28);
  }
}

.turn-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.68em;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #111;
  background: linear-gradient(135deg, #ffe033, #ffc400);
  box-shadow: 0 0 8px rgba(255, 224, 51, 0.75);
  margin-left: 4px;
  flex-shrink: 0;
}

.player-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
  flex-shrink: 0;
}

.player-name {
  flex: 1;
  font-size: 1em;
  color: #e8eeff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 8px rgba(200, 220, 255, 0.3);
}

.player-pegs {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82em;
  white-space: nowrap;
}

/* ── Action panel — bottom-left ── */
#panel-action {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 55;
  border-radius: 14px;
  padding: 12px 14px;
  font-family: 'Rajdhani', 'Segoe UI', sans-serif;
  transform: perspective(800px) rotateY(1.5deg) rotateX(0.5deg);
  width: 200px;
}

/* Dedicated options panel so move choices never cover the selected card. */
#panel-options {
  position: fixed;
  bottom: 12px;
  left: 226px;
  z-index: 70;
  display: none;
  border-radius: 14px;
  padding: 12px;
  width: min(420px, calc(100vw - 252px));
  max-height: 46vh;
  overflow: hidden;
  font-family: 'Rajdhani', 'Segoe UI', sans-serif;
  transform: perspective(800px) rotateY(0.6deg) rotateX(0.25deg);
}

#panel-options:hover {
  transform: perspective(800px) rotateY(0deg) rotateX(0deg);
}

#panel-action:hover {
  transform: perspective(800px) rotateY(0deg) rotateX(0deg);
}

#card-area {
  text-align: center;
  padding: 8px 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.1));
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 16px rgba(0, 0, 0, 0.3);
  transform: perspective(500px) rotateX(3deg);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#card-area:hover {
  transform: perspective(500px) rotateX(0deg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 215, 0, 0.1);
}

#card-label {
  font-size: 0.75em;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

#current-card {
  font-size: 2.8em;
  margin: 4px 0;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.4), 0 2px 0 rgba(0, 0, 0, 0.3);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6));
  transition: transform 0.2s ease;
}

#current-card:hover {
  transform: scale(1.1) rotateZ(-2deg);
}

#current-card .card-back {
  display: inline-block;
  width: 52px;
  height: 72px;
  border-radius: 6px;
  border: 2.5px solid #c8a84e;
  background: linear-gradient(135deg, #8b0000, #b22222 30%, #8b0000 50%, #b22222 70%, #8b0000);
  box-shadow: inset 0 0 0 3px #1a0a0a, inset 0 0 0 5px #c8a84e,
    inset 0 0 12px rgba(0, 0, 0, 0.6), 0 3px 10px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

#current-card .card-back::before {
  content: '♠♥♦♣';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  letter-spacing: 1px;
  color: #c8a84e;
  opacity: 0.7;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

#current-card .card-back::after {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1.5px solid rgba(200, 168, 78, 0.4);
  border-radius: 3px;
  background: repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(200, 168, 78, 0.08) 3px, rgba(200, 168, 78, 0.08) 6px);
}

#card-info {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85em;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

#draw-btn {
  width: 100%;
  padding: 12px 8px;
  font-size: 1.05em;
  background: linear-gradient(135deg, rgba(0, 180, 255, 0.9), rgba(0, 100, 200, 0.9));
  border: 1.5px solid rgba(0, 200, 255, 0.6);
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  font-weight: bold;
  transition: all 0.25s ease;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  box-shadow: 0 4px 18px rgba(0, 100, 200, 0.45);
  transform: perspective(400px) rotateX(2deg);
  min-height: 44px;
}

#draw-btn:hover:not(:disabled) {
  transform: perspective(400px) rotateX(0deg) scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 180, 255, 0.4);
}

#draw-btn:disabled {
  opacity: 0.3;
  cursor: default;
  transform: none;
}

#move-hints {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 0;
}

@keyframes hintPulse {

  0%,
  100% {
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.45), 0 0 22px rgba(0, 255, 136, 0.2), inset 0 0 10px rgba(0, 255, 136, 0.08);
    border-color: rgba(0, 255, 136, 0.55);
  }

  50% {
    box-shadow: 0 0 22px rgba(0, 255, 136, 0.75), 0 0 40px rgba(0, 255, 136, 0.35), inset 0 0 18px rgba(0, 255, 136, 0.15);
    border-color: rgba(0, 255, 136, 0.9);
  }
}

.hint {
  padding: 11px 14px;
  border-radius: 10px;
  background: rgba(0, 255, 136, 0.14);
  border: 2px solid rgba(0, 255, 136, 0.6);
  font-size: 0.95em;
  color: #e8fff5;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.6);
  letter-spacing: 0.02em;
  line-height: 1.4;
  min-height: 44px;
  display: flex;
  align-items: center;
  animation: hintPulse 1.6s ease-in-out infinite;
}

.hint:hover {
  background: rgba(0, 255, 136, 0.28);
  transform: translateX(5px) scale(1.03);
  box-shadow: 0 0 28px rgba(0, 255, 136, 0.8), 0 4px 20px rgba(0, 255, 136, 0.4), inset 0 0 24px rgba(0, 255, 136, 0.12);
  border-color: #00ff88;
  color: #ffffff;
  text-shadow: 0 0 14px rgba(0, 255, 136, 0.9);
  animation: none;
}

.hint-group {
  background: rgba(64, 146, 255, 0.16);
  border-color: rgba(95, 170, 255, 0.62);
  color: #e2f0ff;
  text-shadow: 0 0 8px rgba(110, 190, 255, 0.55);
}

.hint-group.expanded {
  border-color: rgba(255, 224, 51, 0.9);
  box-shadow: 0 0 22px rgba(255, 224, 51, 0.38);
  color: #fff7cf;
}

.hint-sublist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0 6px 12px;
  padding-left: 8px;
  border-left: 2px solid rgba(90, 178, 255, 0.35);
}

.hint-sub {
  background: rgba(0, 255, 136, 0.09);
  border-color: rgba(0, 255, 136, 0.4);
  font-size: 0.88em;
  min-height: 40px;
  padding: 8px 11px;
}

/* ── Split Selector — interactive 7-card split UI ── */
.split-header {
  font-size: 0.9em;
  color: #ffe566;
  text-align: center;
  padding: 6px 0;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

.split-ratios {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
  padding: 4px 0 6px;
}

.split-ratio-btn {
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(255, 215, 0, 0.12);
  border: 1.5px solid rgba(255, 215, 0, 0.4);
  color: #fff8cc;
  font-size: 0.95em;
  font-weight: 700;
  transition: all 0.2s ease;
  font-family: 'Rajdhani', sans-serif;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
  min-height: 40px;
}

.split-ratio-btn:hover {
  background: rgba(255, 215, 0, 0.2);
  border-color: rgba(255, 215, 0, 0.5);
  transform: scale(1.05);
  box-shadow: 0 2px 10px rgba(255, 215, 0, 0.2);
}

.split-ratio-btn.selected {
  background: rgba(255, 215, 0, 0.25);
  border-color: rgba(255, 215, 0, 0.6);
  color: #ffd700;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.split-ratio-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.split-pairs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 120px;
  overflow: hidden;
}

.split-pair {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(255, 165, 0, 0.10);
  border: 1.5px solid rgba(255, 165, 0, 0.35);
  font-size: 0.92em;
  color: #ffe8b0;
  transition: all 0.2s ease;
  min-height: 42px;
}

.split-pair:hover {
  background: rgba(255, 165, 0, 0.15);
  border-color: rgba(255, 165, 0, 0.35);
  transform: translateX(3px);
  box-shadow: 0 2px 10px rgba(255, 165, 0, 0.15);
}

.split-peg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 4px currentColor;
}

.split-arrow {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.9em;
}

.split-back-btn {
  font-size: 0.82em;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  text-align: center;
  padding: 6px 0;
  transition: color 0.15s;
}

.split-back-btn:hover {
  color: #fff;
}

/* ── Camera controls — bottom-right, tiny ── */
#panel-cam {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 20;
  border-radius: 10px;
  padding: 6px 8px;
  display: flex;
  gap: 3px;
  transform: perspective(800px) rotateY(-1.5deg);
}

#panel-cam:hover {
  transform: perspective(800px) rotateY(0deg);
}

.cam-btn {
  padding: 6px 11px;
  font-size: 0.78em;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Rajdhani', sans-serif;
  min-height: 36px;
}

.cam-btn:hover {
  background: rgba(0, 180, 255, 0.15);
  color: #fff;
}

.cam-btn.active {
  background: rgba(0, 180, 255, 0.25);
  color: #00b4ff;
  border-color: rgba(0, 180, 255, 0.5);
}

/* ── Manifold Metrics — collapsible, bottom-right above cam ── */
#panel-metrics {
  position: fixed;
  bottom: 50px;
  right: 12px;
  z-index: 25;
  border-radius: 10px;
  padding: 0;
  width: 340px;
  max-height: 24px;
  overflow: hidden;
  transition: all 0.35s ease;
  transform: perspective(800px) rotateY(-1deg);
  cursor: pointer;
}

#panel-metrics:hover,
#panel-metrics.expanded {
  max-height: 400px;
  padding-bottom: 8px;
  transform: perspective(800px) rotateY(0deg);
}

#metrics-toggle {
  padding: 4px 10px;
  font-size: 0.6em;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  font-family: 'Rajdhani', sans-serif;
}

#metrics-body {
  padding: 4px 8px;
  font-size: 0.65em;
  font-family: 'Rajdhani', sans-serif;
}

.metric-row {
  display: grid;
  grid-template-columns: 62px 28px 52px 52px 1fr 38px;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.55);
}

.metric-label {
  font-weight: bold;
  color: rgba(255, 255, 255, 0.7);
}

.metric-entries {
  text-align: center;
  color: rgba(0, 180, 255, 0.8);
}

.metric-manifold {
  text-align: right;
  color: rgba(0, 255, 136, 0.7);
  font-size: 0.9em;
}

.metric-json {
  text-align: right;
  color: rgba(255, 170, 0, 0.7);
  font-size: 0.9em;
}

.metric-bar-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.metric-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.metric-pct {
  text-align: right;
  font-weight: bold;
  font-size: 0.9em;
}

.metric-totals {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.6;
}

.metric-totals strong {
  color: rgba(255, 255, 255, 0.85);
}

/* ── Game log — collapsible, top-left ── */
#panel-log {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
  border-radius: 10px;
  padding: 0;
  width: 180px;
  max-height: 24px;
  overflow: hidden;
  transition: all 0.35s ease;
  transform: perspective(800px) rotateY(1deg);
  cursor: pointer;
}

#panel-log:hover,
#panel-log.expanded {
  max-height: 200px;
  padding-bottom: 6px;
  transform: perspective(800px) rotateY(0deg);
}

#log-toggle {
  padding: 4px 10px;
  font-size: 0.6em;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  font-family: 'Rajdhani', sans-serif;
}

#game-log {
  max-height: 160px;
  overflow: hidden;
  padding: 2px 8px;
  font-size: 0.65em;
  color: rgba(255, 255, 255, 0.35);
  font-family: 'Rajdhani', sans-serif;
}

#game-log::-webkit-scrollbar {
  width: 3px;
}

#game-log::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.log-entry {
  padding: 1px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

/* ── Helix viz — subtle, below players ── */
#helix-viz {
  display: flex;
  gap: 2px;
  justify-content: center;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.helix-section {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6px;
  font-weight: bold;
  opacity: 0.6;
}

/* ════════════════════════════════════════════════
       HR-6.2 — FastTrack chrome at desktop sizes:
       fixed top header (player strip) + fixed bottom rail
       (action / hints / camera). 3D canvas insets to fit
       the middle band (see onWindowResize).
       ════════════════════════════════════════════════ */
@media (min-width: 601px) {
  #panel-players {
    top: 0;
    left: 0;
    right: 0;
    max-width: none;
    width: 100%;
    border-radius: 0;
    /* Card now lives at bottom-left and #game-status is hidden, so the
       header strip starts flush at the far left. Right padding still
       reserves space for the music/camera/leave/settings round icons. */
    padding: 6px 200px 6px 12px;
    transform: none;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    box-sizing: border-box;
  }

  #panel-players:hover {
    transform: none;
  }

  #helix-viz {
    display: none;
  }

  #game-status {
    border-bottom: none;
    padding: 0;
    margin: 0;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    max-width: 180px;
  }

  #player-list {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
  }

  .player-row {
    padding: 4px 9px;
    font-size: 0.92em;
    transform: none;
    flex: 0 0 auto;
    min-width: 0;
  }

  .player-row:hover {
    transform: none;
  }

  .player-name {
    max-width: 110px;
  }

  /* Card + draw lives in the TOP-LEFT corner of the header.
         The card image itself acts as the draw button — no separate
         #draw-btn is shown at desktop sizes. */
  #panel-action {
    top: 4px;
    left: 8px;
    bottom: auto;
    right: auto;
    width: auto;
    min-width: 0;
    max-width: 156px;
    border-radius: 8px;
    padding: 2px 6px;
    transform: none;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 60;
  }

  #panel-action:hover {
    transform: none;
  }

  #panel-action #card-area {
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
    border-bottom: none;
    border-radius: 0;
    transform: none;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
  }

  #panel-action #card-area:hover {
    transform: none;
    box-shadow: none;
  }

  #panel-action #card-label {
    display: none;
  }

  #panel-action #current-card {
    font-size: 1.6em;
    margin: 0;
    line-height: 1;
  }

  #panel-action #current-card .card-back {
    width: 28px;
    height: 40px;
    border-width: 2px;
    box-shadow: inset 0 0 0 2px #1a0a0a, inset 0 0 0 3px #c8a84e,
      inset 0 0 8px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.5);
  }

  #panel-action #current-card .card-back::before {
    font-size: 8px;
  }

  #panel-action #card-info {
    font-size: 0.72em;
    line-height: 1.1;
    white-space: nowrap;
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #panel-action #draw-btn {
    display: none;
  }

  /* Camera fills the bottom rail. Move hints are NOT shown as pill
         buttons on desktop — the player picks moves directly on the 3D
         board (see setupBoardPickHandler in fasttrack-3d.js). The hints
         panel is reserved for the 7-split selector only, which has its
         own complex multi-stage UI that doesn't fit pick-on-board. */
  #panel-options {
    left: 12px;
    right: 240px;
    bottom: 0;
    width: auto;
    max-height: 38vh;
    border-radius: 0;
    padding: 6px 12px;
    transform: none;
  }

  #panel-options:hover {
    transform: none;
  }

  /* Hide the regular hint pills — desktop picks moves on the board. */
  #panel-options #move-hints .hint {
    display: none;
  }

  /* Collapse the hints panel entirely when no split selector is
         present (i.e. for non-7 cards there's nothing to render here). */
  #panel-options:not(:has(.split-header)) {
    display: none;
  }

  #panel-cam {
    right: 12px;
    bottom: 0;
    top: auto;
    border-radius: 0;
    transform: none;
  }

  #panel-cam:hover {
    transform: none;
  }

  /* The header strip carries a faint translucent backdrop so player
         text stays readable over the 3D scene. The footer band gets its
         own opaque-ish strip so its controls read clearly without each
         control needing its own card background. */
  #panel-players {
    background: rgba(8, 16, 30, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  }

  #panel-action,
  #panel-options,
  #panel-cam {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    box-shadow: none;
  }

  #ft-footer-bg {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 44px;
    z-index: 10;
    pointer-events: none;
    background: rgba(8, 16, 30, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.25);
  }

  /* Game log lives out of the header strip — collapsed pill in the
         bottom-right corner of the footer, above the camera buttons. */
  #panel-log {
    top: auto;
    left: auto;
    right: 12px;
    bottom: 52px;
    width: 140px;
    max-height: 22px;
    z-index: 60;
  }

  #panel-log.expanded {
    max-height: 220px;
  }
}

/* ═══ MOBILE: top strip + bottom action ═══ */
@media (max-width: 600px) {
  #panel-players {
    top: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    border-radius: 0 0 12px 12px;
    padding: 5px 8px;
    transform: none;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 5px;
    overflow: hidden;
  }

  #panel-players:hover {
    transform: none;
  }

  #game-status {
    border-bottom: none;
    margin: 0;
    padding: 0;
    color: #ffe033;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    max-width: 90px;
    font-size: 0.85em;
  }

  #player-list {
    flex-direction: row;
    gap: 2px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  /* Mobile shows only the current player's chip — name + color swatch.
         Hiding the other players prevents the row from overflowing the
         narrow strip and bleeding into the game-status text. */
  #player-list .player-row {
    display: none;
  }

  #player-list .player-row.active {
    display: flex;
    padding: 3px 7px;
    font-size: 0.9em;
    transform: none !important;
    animation: none;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
  }

  .player-name {
    font-size: 0.9em;
    color: #e8eeff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .player-pegs,
  .turn-chip {
    display: none;
  }

  #helix-viz {
    display: none;
  }

  #panel-action {
    bottom: 0;
    left: 0;
    right: auto;
    width: 148px;
    max-width: 42vw;
    border-radius: 12px 12px 0 0;
    padding: 5px 8px;
    transform: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    z-index: 90;
  }

  #panel-options {
    left: 154px;
    right: 6px;
    bottom: 0;
    width: auto;
    max-height: 32vh;
    border-radius: 12px 12px 0 0;
    padding: 8px;
    transform: none;
    z-index: 85;
  }

  #panel-action:hover {
    transform: none;
  }

  #card-area {
    border-bottom: none;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
  }

  #current-card {
    font-size: 1.9em;
    margin: 0;
  }

  #card-label {
    display: none;
  }

  #card-info {
    display: block;
    font-size: 0.78em;
    line-height: 1.2;
  }

  #draw-btn {
    width: auto;
    padding: 9px 16px;
    font-size: 0.95em;
    flex-shrink: 0;
    transform: none;
    min-height: 42px;
  }

  #draw-btn:hover:not(:disabled) {
    transform: none;
  }

  .hint {
    font-size: 1.05em;
    padding: 12px 14px;
    min-height: 48px;
    color: #d0fff0;
    border-color: rgba(0, 255, 136, 0.55);
  }

  #move-hints {
    flex-direction: row;
    flex-wrap: wrap;
    margin: 0;
    flex: 1;
  }

  #panel-cam {
    top: auto;
    right: 6px;
    bottom: 60px;
  }

  .cam-btn {
    font-size: 0.8em;
    padding: 6px 10px;
  }

  #panel-log {
    width: 160px;
  }

  #log-toggle,
  #metrics-toggle {
    font-size: 0.75em;
  }

  #game-log,
  #metrics-body {
    font-size: 0.8em;
  }
}

/* ── Settings gear button — top-right ── */
#btn-settings {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 50;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(8, 10, 24, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#btn-settings:hover {
  background: rgba(8, 10, 24, 0.8);
  color: #fff;
  transform: rotate(30deg);
}

/* ── Emoji reactions (hidden until opened) ── */
#emoji-ui {
  position: fixed;
  top: 56px;
  right: 12px;
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

#btn-emoji-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(8, 10, 24, 0.72);
  border: 1px solid rgba(80, 220, 255, 0.35);
  color: rgba(190, 240, 255, 0.95);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(12px);
}

#btn-emoji-toggle:hover {
  background: rgba(16, 45, 62, 0.84);
  border-color: rgba(80, 235, 255, 0.65);
  transform: scale(1.06);
}

#emoji-panel {
  width: min(340px, 92vw);
  background: rgba(8, 10, 24, 0.94);
  border: 1px solid rgba(80, 220, 255, 0.28);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));   /* 22 reactions: four across keeps the tray short */
  gap: 8px;
}

#emoji-panel.open {
  display: grid;
}

.emoji-btn {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: #d9f5ff;
  min-height: 50px;
  font-size: 11px;
  font-family: 'Rajdhani', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  line-height: 1.15;
  padding: 6px 4px;
  transition: all 0.15s;
}

.emoji-btn:hover {
  border-color: rgba(80, 220, 255, 0.55);
  background: rgba(42, 127, 157, 0.22);
}

.emoji-glyph {
  font-size: 20px;
  margin-bottom: 3px;
}

#emoji-feed {
  position: fixed;
  left: 12px;
  top: 132px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-width: min(340px, 86vw);
  pointer-events: none;
}

.emoji-toast {
  background: rgba(8, 12, 24, 0.86);
  border: 1px solid rgba(80, 220, 255, 0.36);
  border-radius: 10px;
  padding: 8px 10px;
  color: #eefbff;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.emoji-toast.fade {
  opacity: 0;
  transform: translateY(-4px);
}

.emoji-balloon {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%) scale(0.75);
  z-index: 95;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 180px;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.55));
  animation: emojiBalloonRise 1.1s ease-out forwards;
}

.emoji-balloon-glyph {
  font-size: clamp(120px, 24vw, 200px);   /* bigger (Ken, 2026-11-18); was clamp(88px, 17vw, 148px) */
  line-height: 1;
  text-shadow: 0 0 26px rgba(80, 220, 255, 0.35);
}

.emoji-balloon-sender {
  background: rgba(7, 12, 25, 0.9);
  border: 1px solid rgba(80, 220, 255, 0.42);
  border-radius: 999px;
  padding: 5px 12px;
  color: #eaf8ff;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.emoji-balloon.pop {
  animation: emojiBalloonPop 0.24s ease-in forwards;
}

@keyframes emojiBalloonRise {
  from {
    bottom: 14px;
    opacity: 0;
    transform: translateX(-50%) scale(0.75);
  }

  12% {
    opacity: 1;
  }

  to {
    bottom: 48vh;
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

@keyframes emojiBalloonPop {
  from {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }

  to {
    opacity: 0;
    transform: translateX(-50%) scale(1.34);
  }
}

/* ── Settings overlay ── */
#settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
}

#settings-overlay.open {
  display: flex;
}

#settings-panel {
  background: rgba(8, 10, 24, 0.92);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 28px 32px;
  min-width: 280px;
  max-width: 340px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.7);
  color: #fff;
  font-family: 'Rajdhani', sans-serif;
}

#settings-panel h2 {
  margin: 0 0 20px;
  font-size: 1.2em;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.setting-row label {
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.7);
}

.setting-row input[type="range"] {
  width: 120px;
  accent-color: #00b4ff;
  cursor: pointer;
}

.settings-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 18px 0;
}

#btn-exit-game {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: rgba(220, 50, 50, 0.25);
  border: 1px solid rgba(220, 50, 50, 0.4);
  border-radius: 8px;
  color: #ff6b6b;
  font-size: 0.9em;
  font-family: 'Rajdhani', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

#btn-exit-game:hover {
  background: rgba(220, 50, 50, 0.45);
  color: #fff;
}

#btn-close-settings {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85em;
  font-family: 'Rajdhani', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}

#btn-close-settings:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ── Music toggle — always visible, top-right between Leave and Settings ── */
#btn-music-toggle {
  position: fixed;
  top: 12px;
  right: 100px;
  z-index: 50;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(8, 20, 30, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 180, 255, 0.28);
  color: rgba(160, 220, 255, 0.80);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  user-select: none;
}

#btn-music-toggle:hover {
  background: rgba(0, 80, 120, 0.55);
  color: #fff;
  border-color: rgba(0, 220, 255, 0.6);
  transform: scale(1.06);
}

#btn-music-toggle.muted {
  border-color: rgba(255, 80, 80, 0.35);
  color: rgba(255, 160, 160, 0.7);
}

@media (max-width: 600px) {
  #btn-music-toggle {
    top: 8px;
    right: 90px;
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

/* ── Leave Game button — always visible, top-right next to gear ── */
#btn-leave-game {
  position: fixed;
  top: 12px;
  right: 56px;
  z-index: 50;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(28, 8, 12, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(220, 80, 80, 0.28);
  color: rgba(255, 180, 180, 0.75);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-family: 'Rajdhani', sans-serif;
}

#btn-leave-game:hover {
  background: rgba(180, 30, 40, 0.55);
  color: #fff;
  border-color: rgba(255, 120, 120, 0.6);
  transform: scale(1.06);
}

@media (max-width: 600px) {
  #btn-leave-game {
    top: 8px;
    right: 52px;
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  #emoji-ui {
    top: 78px;
    right: 8px;
  }

  #btn-emoji-toggle {
    display: none;
  }

  #emoji-panel {
    width: min(320px, 92vw);
  }

  #emoji-feed {
    top: 96px;
  }

  #btn-settings {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
}

/* ── Replay / End-of-game overlay ── */
#replay-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#replay-overlay.open {
  display: flex;
}

#replay-panel {
  background: rgba(8, 10, 24, 0.92);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 16px;
  padding: 26px 28px;
  min-width: 260px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.7), 0 0 24px rgba(255, 215, 0, 0.08);
  color: #fff;
  font-family: 'Rajdhani', sans-serif;
  text-align: center;
}

#replay-panel h2 {
  margin: 0 0 6px;
  font-size: 1.3em;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #ffd966;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
}

#replay-winner {
  margin: 0 0 18px;
  font-size: 0.95em;
  color: rgba(255, 255, 255, 0.75);
}

#btn-replay-again,
#btn-replay-leave {
  display: block;
  width: 100%;
  padding: 11px;
  margin-top: 8px;
  border-radius: 8px;
  font-size: 0.95em;
  font-family: 'Rajdhani', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

#btn-replay-again {
  background: rgba(0, 180, 255, 0.22);
  border: 1px solid rgba(0, 180, 255, 0.45);
  color: #9be3ff;
}

#btn-replay-again:hover {
  background: rgba(0, 180, 255, 0.42);
  color: #fff;
}

#btn-replay-leave {
  background: rgba(220, 50, 50, 0.22);
  border: 1px solid rgba(220, 50, 50, 0.4);
  color: #ff8f8f;
}

#btn-replay-leave:hover {
  background: rgba(220, 50, 50, 0.45);
  color: #fff;
}

/* ─── Confirm-move bar (HR-6.2 fixed control rail) ─── */
#ft-confirm-bar {
  position: fixed;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 14px;
  background: rgba(8, 16, 30, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: #f6f9ff;
}

#ft-confirm-bar[hidden] {
  display: none;
}

#ft-confirm-bar #ft-confirm-label {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.92;
}

#ft-confirm-bar button {
  font: inherit;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  color: #f6f9ff;
  transition: background 0.15s ease, transform 0.1s ease;
}

#ft-confirm-bar button:hover {
  background: rgba(255, 255, 255, 0.16);
}

#ft-confirm-bar button:active {
  transform: scale(0.96);
}

#ft-confirm-bar #ft-confirm-ok {
  background: linear-gradient(135deg, #1f9d55 0%, #2bb673 100%);
  border-color: rgba(43, 182, 115, 0.85);
  font-weight: 600;
}

#ft-confirm-bar #ft-confirm-ok:hover {
  background: linear-gradient(135deg, #2bb673 0%, #3ed089 100%);
}

#ft-confirm-bar #ft-confirm-cancel {
  background: rgba(220, 80, 80, 0.18);
  border-color: rgba(220, 80, 80, 0.55);
}

#ft-confirm-bar #ft-confirm-cancel:hover {
  background: rgba(220, 80, 80, 0.32);
}

#ft-confirm-bar #ft-confirm-prev,
#ft-confirm-bar #ft-confirm-next {
  font-size: 16px;
  line-height: 1;
  padding: 5px 12px;
  background: rgba(80, 140, 220, 0.18);
  border-color: rgba(120, 170, 230, 0.55);
}

#ft-confirm-bar #ft-confirm-prev:hover,
#ft-confirm-bar #ft-confirm-next:hover {
  background: rgba(120, 170, 230, 0.32);
}

#ft-confirm-bar button[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  filter: saturate(0.4);
}

@media (max-width: 640px) {
  #ft-confirm-bar {
    font-size: 12px;
    padding: 5px 10px;
    gap: 6px;
  }

  #ft-confirm-bar #ft-confirm-label {
    max-width: 160px;
  }

  #ft-confirm-bar button {
    padding: 6px 10px;
  }
}

/* ─── Instruction banner — anchored to the bottom footer rail (HR-6.2) ─── */
/* All player-facing info lives in the bottom footer; the header is reserved
   for player identity. This banner sits just above #ft-confirm-bar. */
#ft-instruction-banner {
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 250;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 22px;
  background: linear-gradient(135deg, rgba(8, 18, 36, 0.94) 0%, rgba(12, 32, 60, 0.94) 100%);
  border: 2px solid var(--ft-ib-accent, #00c8ff);
  border-radius: 999px;
  box-shadow:
    0 0 24px var(--ft-ib-accent, #00c8ff),
    0 -6px 22px rgba(0, 0, 0, 0.55);
  color: #ffffff;
  font-family: 'Orbitron', 'Inter', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px var(--ft-ib-accent, #00c8ff);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  animation: ft-ib-pulse 1.6s ease-in-out infinite;
}

#ft-instruction-banner[hidden] {
  display: none;
}

#ft-instruction-banner.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#ft-instruction-banner .ft-ib-icon {
  font-size: 22px;
  display: inline-block;
  animation: ft-ib-bounce 1s ease-in-out infinite;
}

#ft-instruction-banner .ft-ib-text {
  white-space: nowrap;
}

@keyframes ft-ib-pulse {

  0%,
  100% {
    box-shadow: 0 0 24px var(--ft-ib-accent, #00c8ff), 0 8px 28px rgba(0, 0, 0, 0.55);
  }

  50% {
    box-shadow: 0 0 38px var(--ft-ib-accent, #00c8ff), 0 8px 28px rgba(0, 0, 0, 0.55);
  }
}

@keyframes ft-ib-bounce {

  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(4px);
  }
}

@media (max-width: 640px) {
  #ft-instruction-banner {
    font-size: 13px;
    padding: 8px 16px;
    gap: 8px;
    bottom: 50px;
  }

  #ft-instruction-banner .ft-ib-icon {
    font-size: 16px;
  }
}

/* Card-area disabled state — mirrors #draw-btn:disabled while a play is
   still resolving (peg hops, cutscenes, redraw window). */
#card-area.disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.45;
  filter: saturate(0.5);
  transition: opacity 0.15s ease, filter 0.15s ease;
}

/* Card-area locked state — the deck is non-interactive (a card is already
   face-up for the active player), but the card stays brightly legible for
   every viewer for the entire duration of the turn. No dim, no desaturate. */
#card-area.locked {
  pointer-events: none;
  cursor: default;
  opacity: 1;
  filter: none;
}

/* ════════════════════════════════════════════════════════════════
   PEG CONTROL BAR — non-text gameplay control (HR-6.2 fixed rail)
   5 peg buttons (per-peg nickname) + Confirm. Replaces the
   text-based instruction banner, confirm bar, and move-hints panel.
   Centered between #panel-action (bottom-left) and #panel-cam
   (bottom-right) so neither is covered.
   ════════════════════════════════════════════════════════════════ */

/* Hide legacy text-based controls — peg bar is the canonical input. */
#ft-confirm-bar,
#ft-instruction-banner,
#panel-options {
  display: none !important;
}

#ft-peg-bar {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 220;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(8, 16, 30, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  font-family: 'Inter', system-ui, sans-serif;
  pointer-events: auto;
  max-width: calc(100vw - 360px);
  /* leave room for panel-action + panel-cam */
}

#ft-peg-buttons {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 6px;
}

#ft-peg-bar .peg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 64px;
  padding: 6px 8px;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: rgba(20, 30, 50, 0.55);
  color: #f6f9ff;
  font: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease,
    border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

#ft-peg-bar .peg-btn .peg-glyph {
  font-size: 22px;
  line-height: 1;
  color: var(--peg-color, #88a);
  text-shadow: 0 0 8px var(--peg-color, transparent);
}

#ft-peg-bar .peg-btn .peg-nickname {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.85;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Active = peg is in play AND has legal moves with the current card. */
#ft-peg-bar .peg-btn.active {
  background: rgba(30, 60, 100, 0.7);
  border-color: var(--peg-color, #6cf);
  box-shadow:
    0 0 12px var(--peg-color, #6cf),
    inset 0 0 8px rgba(255, 255, 255, 0.08);
}

#ft-peg-bar .peg-btn.active:hover {
  transform: translateY(-1px);
  background: rgba(40, 80, 130, 0.8);
}

/* Selected = currently staged peg whose move is previewed on the board. */
#ft-peg-bar .peg-btn.selected {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.35) 0%,
      rgba(255, 165, 0, 0.35) 100%);
  border-color: #ffd54a;
  box-shadow:
    0 0 18px #ffd54a,
    inset 0 0 10px rgba(255, 215, 0, 0.25);
  color: #fffbe6;
}

#ft-peg-bar .peg-btn.selected .peg-glyph {
  text-shadow: 0 0 12px #ffd54a;
}

#ft-peg-bar .peg-btn[disabled],
#ft-peg-bar .peg-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  filter: saturate(0.4);
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(20, 20, 30, 0.4);
  box-shadow: none;
}

#ft-peg-bar .peg-confirm-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid rgba(43, 182, 115, 0.85);
  background: linear-gradient(135deg, #1f9d55 0%, #2bb673 100%);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  margin-left: 4px;
  transition: transform 0.1s ease, background 0.15s ease,
    box-shadow 0.15s ease, opacity 0.15s ease;
}

#ft-peg-bar .peg-confirm-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #2bb673 0%, #3ed089 100%);
  box-shadow: 0 0 16px rgba(62, 208, 137, 0.6);
}

#ft-peg-bar .peg-confirm-btn:active:not(:disabled) {
  transform: scale(0.96);
}

#ft-peg-bar .peg-confirm-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: saturate(0.4);
}

#ft-peg-bar .peg-confirm-check {
  font-size: 16px;
  line-height: 1;
}

@media (max-width: 760px) {

  #ft-peg-buttons {
    flex: 1 1 auto;
    justify-content: space-around;
  }

  #ft-peg-bar .peg-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 4px 4px;
  }

  #ft-peg-bar .peg-btn .peg-glyph {
    font-size: 18px;
  }

  #ft-peg-bar .peg-btn .peg-nickname {
    font-size: 9px;
    max-width: 56px;
  }

  #ft-peg-bar .peg-confirm-btn {
    padding: 8px 12px;
    flex: 0 0 auto;
  }

  #ft-peg-bar .peg-confirm-label {
    display: none;
  }

  /* Card deck sits 5px directly above the docked button tab on phones. */
  #panel-action {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: calc(72px + env(safe-area-inset-bottom, 0) + 5px);
    width: min(260px, calc(100vw - 24px));
    padding: 8px 10px;
  }
}

@media (min-width: 761px) {

  /* user_directive_2026-05-19 — desktop relies on direct hole/peg clicks.
     The bar is mobile-only; hide it (and its help pill) so the board is
     unobstructed. Players click halos to stage; click again to commit. */
  #ft-peg-bar,
  #ft-peg-help {
    display: none !important;
  }
}

/* Legacy mobile breakpoint (kept for backward compat — overridden above). */
@media (max-width: 760px) and (max-height: 0) {
  #ft-peg-bar {
    /* no-op guard */
  }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE FIT — keep the 3D board visible on phones.
   The footer chrome (peg bar, card panel, cam panel) is restacked
   so it never piles vertically on top of itself. Peg bar gets its
   own row at bottom:0; card panel sits just above it as a thin
   chip strip; cam panel becomes a slim icon row above that. The
   board canvas is full-viewport behind everything, so collapsing
   the chrome reveals more board.
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {

  /* Peg bar — own row, full-width, slim. Confirm collapses to ✔ only
     (peg-confirm-label already hidden on small screens above). */
  #ft-peg-bar {
    /* user_directive_2026-05-19 — on phones the bar becomes a full-width
       docked tab panel pinned to the bottom edge. Holes are too small to
       reliably tap, so buttons stay primary input here. */
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    box-sizing: border-box;
    left: 4px;
    right: 4px;
    bottom: 0;
    transform: none;
    width: auto;
    max-width: none;
    padding: 4px 6px;
    gap: 4px;
    border-radius: 14px 14px 0 0;
    justify-content: center;
    z-index: 230;
  }

  #ft-peg-buttons {
    flex: 1 1 auto;
    min-width: 0;
    gap: 4px;
    justify-content: space-between;
  }

  #ft-peg-bar .peg-btn {
    flex: 1 1 0;
    min-width: 0;
    max-width: 64px;
    padding: 4px 2px;
    border-radius: 10px;
    gap: 0;
  }

  #ft-peg-bar .peg-btn .peg-glyph {
    font-size: 16px;
  }

  #ft-peg-bar .peg-btn .peg-nickname {
    font-size: 9px;
    max-width: 60px;
  }

  #ft-peg-bar .peg-confirm-btn {
    flex: 0 0 auto;
    padding: 6px 10px;
    margin-left: 2px;
    border-radius: 999px;
  }

  #ft-peg-bar .peg-confirm-check {
    font-size: 14px;
  }
}

@media (max-width: 600px) {

  /* Card / draw panel — collapse to a thin chip strip just above the
     peg bar so it doesn't eat board real-estate. Keeps draw + card
     readout reachable without dominating the screen. */
  #panel-action {
    bottom: 56px;
    left: 4px;
    right: auto;
    width: auto;
    max-width: 56vw;
    padding: 3px 6px;
    gap: 4px;
    flex-wrap: nowrap;
    z-index: 90;
    background: rgba(8, 16, 30, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 12px;
  }

  #panel-action #card-area {
    transform: scale(0.7);
    transform-origin: left center;
    max-width: 70px;
    padding: 0;
  }

  #panel-action #current-card {
    font-size: 1.3em;
  }

  #panel-action #card-info {
    font-size: 0.7em;
    line-height: 1.1;
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #panel-action #draw-btn {
    padding: 6px 10px;
    font-size: 0.8em;
    min-height: 32px;
  }

  /* Camera panel — slim icon-pill row above the card panel, never
     covered by peg bar or card chip. */
  #panel-cam {
    left: auto;
    right: 4px;
    bottom: 56px;
    top: auto;
    padding: 2px 4px;
    gap: 2px;
    background: rgba(8, 16, 30, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 999px;
    display: flex;
    flex-direction: row;
    z-index: 95;
  }

  #panel-cam .cam-btn {
    font-size: 0.7em;
    padding: 4px 7px;
    min-width: 0;
  }

  /* Game log out of the way — peg bar already owns the bottom strip. */
  #panel-log {
    right: 6px;
    bottom: 100px;
    width: 130px;
    max-height: 20px;
  }

  #panel-log.expanded {
    max-height: 180px;
  }

  /* Footer band must clear the peg bar so it doesn't visually compete. */
  #ft-footer-bg {
    height: 50px;
  }
}

@media (max-width: 420px) {

  /* Very narrow phones — squeeze the peg row further. */
  #ft-peg-bar .peg-btn {
    max-width: 52px;
  }

  #ft-peg-bar .peg-btn .peg-nickname {
    font-size: 8px;
    max-width: 48px;
  }

  #panel-action {
    max-width: 50vw;
  }

  #panel-action #card-area {
    transform: scale(0.6);
    max-width: 56px;
  }

  #panel-action #card-info {
    max-width: 70px;
    font-size: 0.65em;
  }
}

/* ════════════════════════════════════════════════════════════════
   PLAYER STRIP — only show humans + the currently active player.
   Bots are hidden unless it's their turn, so the top-left strip
   doesn't pile up with 5 bot rows. Applies on all viewports.
   ════════════════════════════════════════════════════════════════ */
#player-list .player-row.is-bot:not(.active) {
  display: none !important;
}

/* ════════════════════════════════════════════════════════════════
   TURN LIGHT (user_directive_2026-05-18)
   Every player row carries a small round indicator on the far left.
   ON  — bright amber, pulsing — when it is that player's turn.
   OFF — dim grey, low opacity — for everyone else (including bots).
   Non-active human rows are also globally dimmed so the active row
   pops as the obvious focal point.
   ════════════════════════════════════════════════════════════════ */
#player-list .player-row .turn-light {
  flex: 0 0 auto;
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(180, 190, 210, 0.18);
  border: 1px solid rgba(180, 190, 210, 0.35);
  box-shadow: none;
  transition: background 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
  opacity: 0.55;
}

#player-list .player-row.active .turn-light {
  background: #ffd633;
  border-color: #fff2a8;
  box-shadow:
    0 0 6px rgba(255, 214, 51, 0.95),
    0 0 14px rgba(255, 214, 51, 0.55),
    inset 0 0 4px rgba(255, 255, 255, 0.7);
  opacity: 1;
  animation: turnLightPulse 1.15s ease-in-out infinite;
}

/* user_directive_2026-05-18: bright YELLOW only when it is a HUMAN's turn.
   A bot's active row keeps a subdued blue tint so players can see "bot is
   playing" without the dramatic yellow glow that signals "your move". */
#player-list .player-row.is-bot.active .turn-light {
  background: rgba(120, 170, 230, 0.55);
  border-color: rgba(170, 210, 255, 0.7);
  box-shadow: 0 0 4px rgba(120, 170, 230, 0.55);
  opacity: 0.85;
  animation: none;
}

@keyframes turnLightPulse {

  0%,
  100% {
    box-shadow:
      0 0 5px rgba(255, 214, 51, 0.7),
      0 0 10px rgba(255, 214, 51, 0.4),
      inset 0 0 3px rgba(255, 255, 255, 0.6);
  }

  50% {
    box-shadow:
      0 0 9px rgba(255, 214, 51, 1),
      0 0 18px rgba(255, 214, 51, 0.75),
      inset 0 0 5px rgba(255, 255, 255, 0.85);
  }
}

/* Dim the non-active human rows so the active glow stands out. */
#player-list .player-row.is-human:not(.active) {
  opacity: 0.55;
  filter: saturate(0.7);
}

#player-list .player-row.is-human:not(.active):hover {
  opacity: 0.85;
}


/* ════════════════════════════════════════════════════════════════
   FOOTER TAB-PANEL UNIFICATION
   Camera state buttons + draw card adopt the same pill/tab look as
   the peg buttons. Log panel is removed entirely.
   ════════════════════════════════════════════════════════════════ */

/* Kill log panel everywhere. */
#panel-log {
  display: none !important;
}

/* ── Camera state buttons → peg-style pills ── */
#panel-cam {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch;
  gap: 6px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  backdrop-filter: blur(8px);
}

#panel-cam .cam-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 56px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: rgba(20, 30, 50, 0.55);
  color: #f6f9ff;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease,
    border-color 0.15s ease, box-shadow 0.15s ease;
}

#panel-cam .cam-btn:hover {
  transform: translateY(-1px);
  background: rgba(40, 80, 130, 0.8);
}

#panel-cam .cam-btn.active {
  background: rgba(30, 60, 100, 0.7);
  border-color: #6cf;
  box-shadow: 0 0 12px #6cf, inset 0 0 8px rgba(255, 255, 255, 0.08);
  color: #eaf6ff;
}

/* ── Draw-card panel → peg-style pill ── */
#panel-action {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  backdrop-filter: blur(8px);
}

#panel-action #card-area {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: rgba(20, 30, 50, 0.55);
  color: #f6f9ff;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease,
    border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 0;
  min-width: 0;
  width: auto;
  height: auto;
}

#panel-action #card-area:hover {
  transform: translateY(-1px);
  background: rgba(40, 80, 130, 0.8);
}

#panel-action #card-label {
  display: none;
}

#panel-action #current-card {
  width: 22px;
  height: 30px;
  margin: 0;
  flex: 0 0 auto;
}

#panel-action #current-card .card-back,
#panel-action #current-card .card-face {
  width: 100%;
  height: 100%;
  border-radius: 4px;
}

#panel-action #card-info {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
  padding: 0;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

#panel-action #draw-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(43, 182, 115, 0.85);
  background: linear-gradient(135deg, #1f9d55 0%, #2bb673 100%);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

#panel-action #draw-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 0 14px rgba(43, 182, 115, 0.65);
}

#panel-action #draw-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: saturate(0.4);
}

/* ════════════════════════════════════════════════════════════════
   HAMBURGER MENU (mobile only)
   On small screens the individual top-right buttons (music, gear,
   leave, emoji) collapse into a single ☰ button. Tapping it slides
   open a vertical menu of the same actions. Every panel keeps a
   reserved spot: nothing covers anything else.
   ════════════════════════════════════════════════════════════════ */

#btn-hamburger {
  display: none;
  /* desktop: hidden, individual icons visible */
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 260;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: rgba(20, 30, 50, 0.78);
  color: #f6f9ff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

#btn-hamburger:hover {
  background: rgba(40, 80, 130, 0.85);
}

#hamburger-menu {
  display: none;
  position: fixed;
  top: 56px;
  right: 10px;
  z-index: 259;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  min-width: 160px;
  background: rgba(10, 20, 35, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

#hamburger-menu.open {
  display: flex;
}

#hamburger-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(20, 30, 50, 0.6);
  color: #f6f9ff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

#hamburger-menu button:hover {
  background: rgba(40, 80, 130, 0.8);
}

#hamburger-menu button.hm-danger {
  border-color: rgba(220, 80, 80, 0.6);
  color: #ffd6d6;
}

#hamburger-menu button.hm-danger:hover {
  background: rgba(130, 30, 30, 0.7);
}

#hamburger-menu .hm-icon {
  font-size: 18px;
  min-width: 22px;
  text-align: center;
}

#hamburger-menu .hm-label {
  flex: 1 1 auto;
}

@media (max-width: 760px) {

  /* Show the hamburger; hide the individual top-right icons and the emoji toggle. The emoji container stays, so
     the hamburger's "Emoji" item can still open the tray (2026-11-18: hiding #emoji-ui made it unreachable). */
  #btn-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #btn-music-toggle,
  #btn-leave-game,
  #btn-settings,
  #btn-emoji-toggle {
    display: none !important;
  }

  /* The open tray sits over the card table, not under it. */
  #emoji-ui {
    z-index: 400;
  }

  /* Keep the top-left player strip from colliding with the hamburger. */
  #panel-players {
    max-width: calc(100vw - 64px);
    /* leave room for ☰ */
  }
}

/* ════════════════════════════════════════════════════════════════
   Camera controls inside hamburger (mobile)
   ════════════════════════════════════════════════════════════════ */
#hamburger-menu .hm-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  padding: 4px 6px 2px;
}

#hamburger-menu .hm-cam-row {
  display: flex;
  gap: 4px;
  padding: 2px;
}

#hamburger-menu .hm-cam-btn {
  flex: 1 1 0;
  padding: 8px 4px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(20, 30, 50, 0.6);
  color: #f6f9ff;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

#hamburger-menu .hm-cam-btn.active {
  background: rgba(30, 60, 100, 0.85);
  border-color: #6cf;
  box-shadow: 0 0 10px #6cf, inset 0 0 6px rgba(255, 255, 255, 0.08);
  color: #eaf6ff;
}

/* ── Graphics quality row — mirrors the camera row, warm amber accent ── */
#hamburger-menu .hm-q-row {
  display: flex;
  gap: 4px;
  padding: 2px;
}

#hamburger-menu .hm-q-btn {
  flex: 1 1 0;
  padding: 8px 3px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(40, 30, 20, 0.6);
  color: #f6f9ff;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

#hamburger-menu .hm-q-btn.active {
  background: rgba(110, 70, 20, 0.85);
  border-color: #ffb347;
  box-shadow: 0 0 10px #ffb347, inset 0 0 6px rgba(255, 255, 255, 0.08);
  color: #fff3e0;
}

#hamburger-menu .hm-q-tier {
  font-size: 10px;
  font-weight: 600;
  color: #ffb347;
  opacity: 0.85;
}

#hamburger-menu .hm-divider {
  height: 1px;
  margin: 4px 0;
  background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 760px) {

  /* Hide the on-board cam pill — camera lives in hamburger now. */
  #panel-cam {
    display: none !important;
  }
}

/* ════════════════════════════════════════════════════════════════
   Card panel — larger so the drawn card is easy to read.
   ════════════════════════════════════════════════════════════════ */

#panel-action #current-card {
  width: 44px;
  height: 60px;
}

#panel-action #card-info {
  font-size: 16px;
  max-width: 220px;
}

#panel-action #draw-btn {
  padding: 12px 20px;
  font-size: 15px;
}

@media (max-width: 760px) {
  #panel-action #current-card {
    width: 38px;
    height: 52px;
  }

  #panel-action #card-info {
    font-size: 14px;
    max-width: 160px;
  }

  #panel-action #draw-btn {
    padding: 10px 16px;
    font-size: 14px;
  }
}

@media (max-width: 420px) {
  #panel-action #current-card {
    width: 32px;
    height: 44px;
  }

  #panel-action #card-info {
    font-size: 12px;
    max-width: 110px;
  }

  #panel-action #draw-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* ════════════════════════════════════════════════════════════════
   CARD = DECK = BUTTON. No separate Draw button.
   The card display itself is the click target. We grow it large
   enough that it's unmistakably a deck of cards.
   ════════════════════════════════════════════════════════════════ */

/* Drop the redundant Draw button + the in-panel Break button — Break
   lives in the hamburger menu now. */
#panel-action #draw-btn {
  display: none !important;
}

#panel-action #btn-break {
  display: none !important;
}

/* Pass-turn safety button (user_directive_2026-05-19) — always visible inside
   the action panel so a stuck player can manually end their turn. */
#panel-action #btn-pass-turn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #fff8d8;
  background: linear-gradient(180deg, rgba(140, 60, 80, 0.85), rgba(80, 24, 40, 0.92));
  border: 1.5px solid rgba(255, 154, 122, 0.85);
  border-radius: 10px;
  cursor: pointer;
  letter-spacing: 0.4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45), 0 0 10px rgba(255, 120, 90, 0.25);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

#panel-action #btn-pass-turn:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(170, 75, 95, 0.92), rgba(95, 30, 50, 0.95));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 14px rgba(255, 140, 105, 0.45);
}

#panel-action #btn-pass-turn:active {
  transform: translateY(0);
}

@media (max-width: 760px) {
  #panel-action #btn-pass-turn {
    margin-left: 6px;
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* Make the card big and deck-like. Layered shadow gives a "stack" cue. */
#panel-action #current-card {
  width: 72px;
  height: 100px;
  position: relative;
  box-shadow:
    2px 2px 0 rgba(255, 255, 255, 0.18),
    4px 4px 0 rgba(255, 255, 255, 0.12),
    6px 6px 0 rgba(255, 255, 255, 0.07);
  border-radius: 8px;
}

#panel-action #current-card .card-back,
#panel-action #current-card .card-face {
  border-radius: 8px;
}

#panel-action #card-info {
  font-size: 18px;
  max-width: 260px;
}

/* Hover/active feedback on the card itself — reinforces clickability. */
#panel-action #card-area:not(.disabled):not(.locked):hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 18px rgba(108, 204, 255, 0.6);
  border-color: #6cf;
}

#panel-action #card-area.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#panel-action #card-area.locked {
  cursor: default;
}

@media (max-width: 760px) {
  #panel-action #current-card {
    width: 60px;
    height: 84px;
  }

  #panel-action #card-info {
    font-size: 15px;
    max-width: 180px;
  }
}

@media (max-width: 420px) {
  #panel-action #current-card {
    width: 50px;
    height: 70px;
  }

  #panel-action #card-info {
    font-size: 13px;
    max-width: 120px;
  }
}

/* ════════════════════════════════════════════════════════════════
   Card panel: invisible chrome, slightly larger deck.
   Only the card stack + its info text are visible — no pill,
   no border, no glass background.
   ════════════════════════════════════════════════════════════════ */
#panel-action {
  background: transparent !important;
  border: none !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  gap: 10px;
}

#panel-action #card-area {
  gap: 10px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

#panel-action #card-area:not(.disabled):not(.locked):hover {
  background: transparent !important;
  border: none !important;
  /* Keep the lift + glow on the card itself so it still feels clickable. */
}

/* Bump deck size a touch. */
#panel-action #current-card {
  width: 88px;
  height: 122px;
}

@media (max-width: 760px) {
  #panel-action #current-card {
    width: 72px;
    height: 100px;
  }
}

@media (max-width: 420px) {
  #panel-action #current-card {
    width: 60px;
    height: 84px;
  }
}

/* Drop a soft text-shadow on card-info so it stays legible without a panel. */
#panel-action #card-info {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0 8px rgba(0, 0, 0, 0.6);
}

/* ════════════════════════════════════════════════════════════════
   DRAWN CARD FACE — solid white, big rank + suit, readable on phones.
   The face is rendered by _drawCardCommit() as:
     <div class="card-face red|black" data-suit="…">
       <span class="cf-rank">5</span><span class="cf-suit">♠</span>
     </div>
   The back-of-deck (#current-card .card-back) is unaffected.
   ════════════════════════════════════════════════════════════════ */
#current-card .card-face {
  width: 100%;
  height: 100%;
  background: #ffffff;
  color: #111;
  border: 1.5px solid #c8a84e;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.45),
    inset 0 0 0 2px rgba(255, 255, 255, 0.95);
  font-family: 'Rajdhani', 'Segoe UI', sans-serif;
  font-weight: 800;
  text-shadow: none;
  /* Override the parent #current-card's text-shadow/filter. */
  filter: none;
}

#current-card .card-face.red {
  color: #c41e3a;
}

#current-card .card-face.black {
  color: #111;
}

#current-card .card-face .cf-rank {
  font-size: 38px;
  letter-spacing: -0.02em;
}

#current-card .card-face .cf-suit {
  font-size: 30px;
  margin-top: -4px;
}

/* Mobile: scale rank/suit to fit the smaller deck. */
@media (max-width: 760px) {
  #current-card .card-face .cf-rank {
    font-size: 32px;
  }

  #current-card .card-face .cf-suit {
    font-size: 26px;
  }
}

@media (max-width: 420px) {
  #current-card .card-face .cf-rank {
    font-size: 26px;
  }

  #current-card .card-face .cf-suit {
    font-size: 22px;
  }
}

/* Kill the outer text-shadow/filter when face-up so the white face stays
   crisp (those styles were designed for the older textContent rendering). */
#current-card:has(.card-face) {
  text-shadow: none;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

/* Active-player chip already says whose turn it is in the player row;
   the top-of-panel status line is redundant. */
#panel-players #game-status {
  display: none !important;
}

/* ════════════════════════════════════════════════════════════════
   FULL-WIDTH FOOTER RAIL  (revised)
   The bar holds ONLY the 5 peg buttons, spanning the entire bottom.
   Card-deck floats ABOVE the bar at the left; Confirm floats ABOVE
   the bar at the right.  Nicknames sit beneath each peg glyph.
   All actionable buttons get a gold outline for visibility.
   ════════════════════════════════════════════════════════════════ */
#ft-peg-bar {
  left: 8px !important;
  right: 8px !important;
  bottom: 8px !important;
  transform: none !important;
  max-width: none !important;
  width: auto !important;
  padding: 4px 14px !important;
  border-radius: 18px !important;
  gap: 10px !important;
  overflow: visible !important;
  /* allow confirm to float above */
}

#ft-peg-buttons {
  flex: 1 1 auto !important;
  display: flex !important;
  width: 100%;
  gap: 8px !important;
}

#ft-peg-bar .peg-btn {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  padding: 3px 6px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  border: 2px solid #d4af37 !important;
  border-radius: 10px !important;
  /* gold outline */
  box-shadow: 0 0 0 1px rgba(212, 175, 55, .25), 0 2px 8px rgba(0, 0, 0, .45) !important;
}

#ft-peg-bar .peg-btn .peg-glyph {
  font-size: 18px !important;
  line-height: 1 !important;
  display: block !important;
}

#ft-peg-bar .peg-btn .peg-nickname {
  font-size: 10px !important;
  line-height: 1 !important;
  max-width: none !important;
  display: block !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  width: 100%;
  text-align: center;
  opacity: .95;
}

/* Confirm — same size/shape as peg buttons.
   Disabled: neutral. Enabled ("active"): solid gold w/ dark text. */
#ft-peg-bar .peg-confirm-btn {
  position: absolute !important;
  right: 4px !important;
  bottom: 0 !important;
  top: auto !important;
  margin: 0 !important;
  /* Match peg-btn geometry */
  width: auto !important;
  min-width: 72px !important;
  padding: 3px 6px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  border: 2px solid #d4af37 !important;
  border-radius: 10px !important;
  background: rgba(20, 30, 50, 0.55) !important;
  background-image: none !important;
  color: #f6f9ff !important;
  font: inherit !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em;
  text-shadow: none !important;
  box-shadow: 0 0 0 1px rgba(212, 175, 55, .25), 0 4px 14px rgba(0, 0, 0, .45) !important;
  z-index: 230;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

#ft-peg-bar .peg-confirm-btn .peg-confirm-check {
  font-size: 18px !important;
  line-height: 1 !important;
  display: block !important;
}

#ft-peg-bar .peg-confirm-btn .peg-confirm-label {
  font-size: 10px !important;
  line-height: 1 !important;
  display: block !important;
  text-align: center;
  width: 100%;
  opacity: .95;
}

/* Confirm ENABLED = staged-and-ready. Solid gold w/ near-black text. */
#ft-peg-bar .peg-confirm-btn:not(:disabled) {
  background: #d4af37 !important;
  background-image: linear-gradient(180deg, #f0cc55 0%, #d4af37 55%, #a8862a 100%) !important;
  color: #1a1306 !important;
  border-color: #fff3a8 !important;
  box-shadow: 0 0 0 1px rgba(255, 230, 130, .45), 0 0 14px rgba(212, 175, 55, .65), 0 4px 14px rgba(0, 0, 0, .55) !important;
}

#ft-peg-bar .peg-confirm-btn:not(:disabled) .peg-confirm-check,
#ft-peg-bar .peg-confirm-btn:not(:disabled) .peg-confirm-label {
  color: #1a1306 !important;
  text-shadow: 0 1px 0 rgba(255, 240, 180, .55) !important;
}

#ft-peg-bar .peg-confirm-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background-image: linear-gradient(180deg, #ffe27a 0%, #e6c24a 55%, #b8932f 100%) !important;
}

#ft-peg-bar .peg-confirm-btn:disabled {
  background: rgba(20, 20, 30, 0.4) !important;
  background-image: none !important;
  color: rgba(246, 249, 255, .35) !important;
  border-color: rgba(212, 175, 55, .35) !important;
  box-shadow: none !important;
  cursor: not-allowed;
}

/* NOTE: the deck's authoritative styling is the "CARD PANEL / FIXED HEADER" block lower
   in this file (later source order, so its !important wins). This older block no longer
   positions the deck; it is kept minimal so the rules between here and there do not shift. */
#panel-action {
  position: fixed !important;
  z-index: 230 !important;
  transform: none !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

#panel-action #card-area {
  padding: 2px 4px !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  border-radius: 8px !important;
}

#panel-action #card-label {
  display: none !important;
}

#panel-action #card-info {
  display: none !important;
}

#panel-action #current-card {
  font-size: 1em !important;
  margin: 0 !important;
  line-height: 1 !important;
}

#panel-action #current-card .card-back {
  width: 34px !important;
  height: 48px !important;
  border-width: 2px !important;
}

#panel-action #current-card .card-face {
  min-width: 38px !important;
  min-height: 48px !important;
  padding: 4px 6px !important;
  border-radius: 6px !important;
}

#panel-action #current-card .card-face .cf-rank {
  font-size: 20px !important;
}

#panel-action #current-card .card-face .cf-suit {
  font-size: 16px !important;
}

#current-card {
  outline: 2px solid #d4af37 !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 1px rgba(212, 175, 55, .2), 0 4px 12px rgba(0, 0, 0, .55) !important;
}

@media (max-width: 760px) {
  #ft-peg-bar {
    padding: 0 88px 0 8px !important;
    gap: 6px !important;
  }

  #ft-peg-bar .peg-btn {
    padding: 2px 4px !important;
  }

  #ft-peg-bar .peg-btn .peg-glyph {
    font-size: 17px !important;
  }

  #ft-peg-bar .peg-btn .peg-nickname {
    font-size: 9px !important;
  }

  #ft-peg-bar .peg-confirm-btn {
    padding: 2px 6px !important;
    min-width: 64px !important;
  }

  #panel-action {
    max-width: 88px !important;
  }
}

@media (max-width: 420px) {
  #ft-peg-bar {
    gap: 4px !important;
    padding: 0 70px 0 6px !important;
  }

  #ft-peg-bar .peg-btn {
    padding: 2px 2px !important;
  }

  #ft-peg-bar .peg-btn .peg-glyph {
    font-size: 15px !important;
  }

  #ft-peg-bar .peg-btn .peg-nickname {
    font-size: 8px !important;
  }

  #ft-peg-bar .peg-confirm-btn {
    padding: 2px 4px !important;
    min-width: 56px !important;
  }

  #panel-action {
    max-width: 72px !important;
  }

  #panel-action #current-card .card-back {
    width: 28px !important;
    height: 40px !important;
  }

  #panel-action #current-card .card-face {
    min-width: 32px !important;
    min-height: 40px !important;
  }

  #panel-action #current-card .card-face .cf-rank {
    font-size: 16px !important;
  }

  #panel-action #current-card .card-face .cf-suit {
    font-size: 13px !important;
  }
}

/* ════════════════════════════════════════════════════════════════
   TOASTS — larger and easier to read.
   ════════════════════════════════════════════════════════════════ */
.emoji-toast {
  font-size: 18px !important;
  padding: 14px 18px !important;
  border-radius: 14px !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55) !important;
  font-weight: 600;
  letter-spacing: 0.01em;
}

#emoji-feed {
  max-width: min(420px, 92vw) !important;
  gap: 10px !important;
}

/* ════════════════════════════════════════════════════════════════
   STRIP PEG-BAR PANEL CHROME — KEEP BOARD UNCOVERED
   The peg-bar must be invisible (no background/border/shadow) and
   no taller than its buttons. Padding-left reserves the card-deck
   slot, padding-right reserves the confirm-button slot, so the
   peg buttons never overlap either floating control.
   ════════════════════════════════════════════════════════════════ */
#ft-peg-bar {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 120px 0 12px !important;
  /* right=confirm slot; card moved to top-right so no left reservation needed */
  pointer-events: none !important;
}

#ft-peg-bar>* {
  pointer-events: auto;
}

@media (max-width: 760px) {
  #ft-peg-bar {
    padding: 0 96px 0 8px !important;
  }
}

@media (max-width: 420px) {
  #ft-peg-bar {
    padding: 0 78px 0 6px !important;
  }
}

/* ════════════════════════════════════════════════════════════════
   CAMERA TOGGLE — round icon top-right, matches music/leave/gear.
   Replaces the on-board #panel-cam (Manual/Top/Angle/Auto) which
   covered the play field.
   ════════════════════════════════════════════════════════════════ */
#btn-camera-toggle {
  position: fixed;
  top: 12px;
  right: 144px;
  z-index: 50;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(8, 20, 30, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 180, 255, 0.28);
  color: rgba(160, 220, 255, 0.80);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  user-select: none;
}

#btn-camera-toggle:hover {
  background: rgba(0, 80, 120, 0.55);
  color: #fff;
  border-color: rgba(0, 220, 255, 0.6);
  transform: scale(1.06);
}

#camera-panel {
  position: fixed;
  top: 56px;
  right: 144px;
  z-index: 60;
  background: rgba(8, 10, 24, 0.94);
  border: 1px solid rgba(80, 220, 255, 0.28);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  display: none;
  flex-direction: column;
  gap: 6px;
  min-width: 120px;
}

#camera-panel.open {
  display: flex;
}

#camera-panel .cam-pop-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e6f4ff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

#camera-panel .cam-pop-btn:hover {
  background: rgba(0, 180, 255, 0.18);
  border-color: rgba(80, 220, 255, 0.5);
}

#camera-panel .cam-pop-btn.active {
  background: rgba(0, 200, 255, 0.28);
  border-color: rgba(120, 235, 255, 0.7);
  color: #fff;
  font-weight: 600;
}

/* On mobile the round icons collapse into the hamburger — keep this
   icon and its popup hidden there too. */
@media (max-width: 760px) {

  #btn-camera-toggle,
  #camera-panel {
    display: none !important;
  }
}

/* The old on-board camera panel must NEVER cover the board. */

/* ════════════════════════════════════════════════════════════════
   PEG-BUTTON ACTIVATION COLORS
   Active = the peg's own color fills the background; the dot and
   nickname switch to a complementary near-white with a dark halo
   so they stay legible against any peg hue.
   ════════════════════════════════════════════════════════════════ */
#ft-peg-bar .peg-btn.active {
  background: var(--peg-color, #6cf) !important;
  border-color: #fff3a8 !important;
  box-shadow:
    0 0 0 1px rgba(255, 230, 130, .4),
    0 0 14px var(--peg-color, #6cf),
    inset 0 0 8px rgba(0, 0, 0, .25) !important;
  color: #ffffff !important;
}

#ft-peg-bar .peg-btn.active .peg-glyph {
  color: #ffffff !important;
  text-shadow:
    0 0 4px rgba(0, 0, 0, .55),
    0 1px 2px rgba(0, 0, 0, .7) !important;
}

#ft-peg-bar .peg-btn.active .peg-nickname {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .65) !important;
  opacity: 1 !important;
}

/* Selected (staged) stays gold-tinted to distinguish from merely-active. */
#ft-peg-bar .peg-btn.selected {
  background: linear-gradient(135deg, #f0cc55 0%, #d4af37 100%) !important;
  border-color: #fff3a8 !important;
  color: #1a1306 !important;
  box-shadow:
    0 0 0 1px rgba(255, 230, 130, .55),
    0 0 18px #d4af37,
    inset 0 0 8px rgba(255, 240, 180, .25) !important;
}

#ft-peg-bar .peg-btn.selected .peg-glyph,
#ft-peg-bar .peg-btn.selected .peg-nickname {
  color: #1a1306 !important;
  text-shadow: 0 1px 0 rgba(255, 240, 180, .55) !important;
}

/* ════════════════════════════════════════════════════════════════
   HR-6.2: Footer black band REMOVED.
   The #ft-footer-bg strip was covering the bottom of the play
   field. The peg buttons and confirm sit directly on the viewport;
   no decorative band is needed.
   ════════════════════════════════════════════════════════════════ */
#ft-footer-bg {
  display: none !important;
}

/* ════════════════════════════════════════════════════════════════
   HARD RULE (HR-6.2) ENFORCEMENT — KILL ALL LEFTOVER BOTTOM PANELS
   The only bottom-of-viewport UI is #ft-peg-bar. Every other
   floating panel (debug metrics, log pill, hint pill, old confirm
   bar, dev hud) is hidden so nothing can cover the play field.
   ════════════════════════════════════════════════════════════════ */
#panel-options,
#panel-metrics,
#panel-log,
#ft-confirm-bar,
#ft-instruction-banner,
#ft-footer-bg,
#fasttrack-hud,
#fasttrack-3d-hud,
#fasttrack-xcode-hud {
  display: none !important;
}

/* ════════════════════════════════════════════════════════════════
   PEG BUTTONS — opaque filled tiles with gold outline.
   ════════════════════════════════════════════════════════════════ */
#ft-peg-bar .peg-btn {
  background: #0e1422 !important;
  box-shadow: 0 0 0 1px rgba(212, 175, 55, .25), 0 2px 8px rgba(0, 0, 0, .55) !important;
}

#ft-peg-bar .peg-btn:hover:not(:disabled):not(.active):not(.selected) {
  background: #182336 !important;
}

#ft-peg-bar .peg-confirm-btn:disabled {
  background: #0e1422 !important;
  box-shadow: 0 0 0 1px rgba(212, 175, 55, .25), 0 2px 8px rgba(0, 0, 0, .55) !important;
}

/* Footer band stays fully hidden — buttons float directly on the
   board, no rail, no border, no void. */

/* Disabled peg buttons stay tinted with the owner's peg color so the
   player can still read the roster — they're just dimmed to communicate
   "no legal move with this peg right now". (user_directive_2026-05-18) */
#ft-peg-bar .peg-btn[disabled],
#ft-peg-bar .peg-btn:disabled {
  opacity: 0.7 !important;
  filter: brightness(0.65) saturate(0.85) !important;
  /* DO NOT force background here — inline style from JS carries the
     per-peg color and must survive the disabled state. */
  border-color: rgba(212, 175, 55, 0.45) !important;
  box-shadow: 0 0 0 1px rgba(212, 175, 55, .18), 0 2px 8px rgba(0, 0, 0, .55) !important;
}

/* Confirm button visible in disabled state too. */
#ft-peg-bar .peg-confirm-btn:disabled {
  opacity: 0.85 !important;
  filter: none !important;
  background: #0e1422 !important;
  color: #f6f9ff !important;
  border-color: rgba(212, 175, 55, 0.55) !important;
  box-shadow: 0 0 0 1px rgba(212, 175, 55, .2), 0 2px 8px rgba(0, 0, 0, .55) !important;
}

/* ════════════════════════════════════════════════════════════════
   PEG NICKNAMES — float as little toasts ABOVE each button so the
   button itself shows only the dot. Toast matches peg color.
   ════════════════════════════════════════════════════════════════ */
#ft-peg-bar .peg-btn {
  position: relative !important;
  overflow: visible !important;
}

#ft-peg-bar .peg-btn .peg-nickname {
  position: absolute !important;
  left: 50% !important;
  bottom: calc(100% + 4px) !important;
  transform: translateX(-50%) !important;
  width: auto !important;
  max-width: calc(100% + 16px) !important;
  padding: 2px 8px !important;
  font-size: 10px !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
  background: rgba(8, 12, 24, 0.85) !important;
  color: #f6f9ff !important;
  border: 1px solid var(--peg-color, rgba(212, 175, 55, 0.55)) !important;
  border-radius: 999px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .55) !important;
  pointer-events: none !important;
  opacity: 1 !important;
  z-index: 2;
}

/* Centre the dot now that the label is outside. */
#ft-peg-bar .peg-btn .peg-glyph {
  font-size: 22px !important;
}

/* ════════════════════════════════════════════════════════════════
   CARD PANEL / FIXED HEADER DECK  (user_directive_2026-07-18, supersedes 2026-05-18)
   The deck lives in the fixed header band on EVERY screen size, so shrinking the
   screen can never move or hide it. It is a horizontal row pinned to the header,
   right of the turn status and left of the icon strip. The board renders only in
   #container, which is inset below this header (see the last block of this file and
   _viewSize in fasttrack-3d.js), so the deck can never cover a board hole.

   Only the word "DRAW" appears, painted ON the card itself via ::after. The legacy
   #card-info label and #draw-btn button stay hidden: clicking the card draws. The
   Pass button sits in the same header row. Card is sized to fit the header height.
   ════════════════════════════════════════════════════════════════ */
#panel-action {
  position: fixed !important;
  top: 0 !important;
  right: 190px !important;   /* clears the 4-icon strip (music/camera/leave/settings) top-right on desktop */
  left: auto !important;
  bottom: auto !important;
  height: var(--ft-header-h) !important;
  z-index: 230 !important;
  width: auto !important;
  max-width: 62vw !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  transform: none !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 7px !important;
}

/* Below 760px the icon strip collapses to a single hamburger, so the deck only needs
   to clear that: pull it back to the far right, leaving the hamburger its corner. */
@media (max-width: 760px) {
  #panel-action { right: 58px !important; }
}

/* Hide the standalone label/button: the card itself is the draw control. */
#panel-action #card-label,
#panel-action #card-info,
#panel-action #draw-btn {
  display: none !important;
}

/* Pass button sits in the header row, compact so the whole deck fits the header height. */
#panel-action #btn-pass-turn {
  margin: 0 !important;
  padding: 6px 10px !important;
  font-size: 0.8em !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  height: auto !important;
  min-height: 0 !important;
  align-self: center !important;
}

#panel-action #card-area {
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 8px !important;
  display: block !important;
  width: 40px !important;
  height: 56px !important;
}

#panel-action #current-card {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0 !important;
  font-size: 0 !important;
  width: 40px !important;
  height: 56px !important;
  display: block !important;
}

#panel-action #current-card .card-back,
#panel-action #current-card .card-face {
  width: 40px !important;
  height: 56px !important;
  min-width: 40px !important;
  min-height: 56px !important;
  max-width: 40px !important;
  max-height: 56px !important;
  padding: 3px !important;
  border-width: 2px !important;
  border-radius: 5px !important;
  box-sizing: border-box !important;
}

#panel-action #current-card .card-face .cf-rank {
  font-size: 16px !important;
  line-height: 1 !important;
}

#panel-action #current-card .card-face .cf-suit {
  font-size: 12px !important;
  line-height: 1 !important;
}

/* "DRAW" label PAINTED ON the card back (only while the card back
   is showing, i.e. before a card is drawn this turn). Centered. */

/* ────────────────────────────────────────────────────────────────
   TEXT-FREE GAMEPLAY MODE (user_directive_2026-05-18)
   The peg-button bar + Confirm button is now the SOLE gameplay
   input. The legacy text-based move-cycle bar and "Tap a glowing…"
   instruction banner are kept in the DOM only as engine state
   proxies — they must never render. !important overrides any
   inline display:flex applied by _refreshConfirmBar.
   ──────────────────────────────────────────────────────────────── */
#ft-confirm-bar,
#ft-instruction-banner,
#ft-hover-tip {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ════════════════════════════════════════════════════════════════
   PEG-BAR HELP TIP — small dismissible pill floating ABOVE the peg
   bar (and above the floating nickname toasts) so it never covers
   the buttons or their labels. Auto-hides once the user dismisses
   it (localStorage). Auto-hides during bot turns via [hidden].
   Anchored bottom-centre; max-width keeps it from overlapping the
   left/right edge controls.
   ════════════════════════════════════════════════════════════════ */
#ft-peg-help {
  position: fixed;
  left: 50%;
  bottom: 88px;
  /* clears peg bar (~46px) + nickname pill (~24px) + 8px gap */
  transform: translateX(-50%);
  z-index: 45;
  /* above board, below modal overlays */
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 7px 10px 7px 14px;
  background: rgba(10, 16, 30, 0.92);
  color: #f6f9ff;
  border: 1px solid rgba(212, 175, 55, 0.55);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(212, 175, 55, 0.18);
  font-size: 12.5px;
  line-height: 1.25;
  pointer-events: auto;
  animation: ft-peg-help-pulse 2.4s ease-in-out infinite;
}

#ft-peg-help[hidden] {
  display: none !important;
}

#ft-peg-help .ft-peg-help-text {
  white-space: normal;
  text-align: center;
}

#ft-peg-help .ft-peg-help-text b {
  color: #ffd86b;
  font-weight: 700;
}

#ft-peg-help-close {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #f6f9ff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#ft-peg-help-close:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.6);
}

@keyframes ft-peg-help-pulse {

  0%,
  100% {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(212, 175, 55, 0.18);
  }

  50% {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(212, 175, 55, 0.45);
  }
}

/* On narrow screens the peg bar grows a row taller — lift the tip. */
@media (max-width: 540px) {
  #ft-peg-help {
    bottom: 104px;
    font-size: 11.5px;
    padding: 6px 8px 6px 12px;
  }
}

/* ===========================================================================
   FIXED HEADER (deck) + FOOTER (controls): the board renders ONLY between them.
   user_directive_2026-07-18: the deck of cards lives in a fixed header on EVERY
   screen size, and the renderer sizes to #container (see _viewSize in fasttrack-3d.js).
   #container is inset between these two bars, so no control panel can EVER cover a
   board hole (the reason phones were unplayable). This block is intentionally last so
   it wins the cascade over the older float-over-the-peripheries rules above.
   =========================================================================== */

#container { inset: auto; top: var(--ft-header-h); bottom: var(--ft-footer-h); left: 0; right: 0; }

#ft-header-bg {
  position: fixed; top: 0; left: 0; right: 0; height: var(--ft-header-h); z-index: 40;
  pointer-events: none; background: rgba(8, 16, 30, 0.62);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
#ft-footer-bg {
  display: none !important;
  position: fixed; top: auto; left: 0; right: 0; bottom: 0; height: var(--ft-footer-h); z-index: 10;
  pointer-events: none; background: rgba(8, 16, 30, 0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

/* player / turn status: left of the header */
#panel-players {
  position: fixed; top: 0; left: 0; right: auto; bottom: auto; height: var(--ft-header-h);
  max-width: 54vw; transform: none; border: none; border-radius: 0;
  background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  display: flex; align-items: center; gap: 8px; padding: 0 10px; z-index: 45; overflow: hidden;
}
#panel-players:hover { transform: none; }

/* show the turn status in the header (an older rule hid #game-status for the previous layout) */
#panel-players #game-status {
  display: block !important; border-bottom: none !important;
  padding: 0 !important; margin: 0 !important; white-space: nowrap !important;
}

/* the DECK itself (position + card + buttons) is defined in the "Card deck" block above,
   which keeps the !important it needs to win the cascade. Nothing for it here on purpose. */

/* keep the move-choices panel and camera buttons out of the board, tucked just above the footer */
#panel-options { bottom: calc(var(--ft-footer-h) + 6px); left: 8px; max-height: 38vh; transform: none; }
#panel-cam {
  display: none !important; bottom: calc(var(--ft-footer-h) + 6px); right: 8px; top: auto; transform: none; }

/* ── TURN MARQUEE — seating order scrolling across the footer strip ── */
/* Sits above #ft-footer-bg (z-index 10) but below the controls, and never
   takes pointer events so it cannot block a click on the board. */
#ft-turn-marquee {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: var(--ft-footer-h, 44px);
  z-index: 11; pointer-events: none; overflow: hidden;
  display: flex; align-items: center;
  font: 600 13px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: .02em; white-space: nowrap;
}
#ft-turn-marquee-track {
  display: inline-flex; align-items: center; gap: 26px;
  padding-left: 100%;
  will-change: transform;
  animation: ft-marquee-scroll 26s linear infinite;
}
@keyframes ft-marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}
/* Someone who prefers less motion still needs to SEE the order, so the strip
   stays and only the scrolling stops. */
@media (prefers-reduced-motion: reduce) {
  #ft-turn-marquee-track { animation: none; padding-left: 12px; }
}
.ft-mq-seat {
  display: inline-flex; align-items: center; gap: 7px;
  color: rgba(233, 237, 242, .55);
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid transparent;
}
.ft-mq-seat .ft-mq-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: currentColor; opacity: .5; flex: none;
}
/* The player holding isTurn. Colour alone is not enough, so the active seat
   also gets a ring, full-strength text and a pulse. */
.ft-mq-seat.is-turn {
  color: #fff;
  background: rgba(255, 255, 255, .10);
  border-color: rgba(255, 255, 255, .35);
}
.ft-mq-seat.is-turn .ft-mq-dot { opacity: 1; animation: ft-mq-pulse 1.1s ease-in-out infinite; }
@keyframes ft-mq-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.5); } }
@media (prefers-reduced-motion: reduce) {
  .ft-mq-seat.is-turn .ft-mq-dot { animation: none; }
}
.ft-mq-seat .ft-mq-tag { opacity: .6; font-weight: 500; font-size: 11px; }
.ft-mq-sep { color: rgba(233, 237, 242, .25); }

/* ── Touch: the board owns its gestures ──────────────────────────
   Without this the browser is free to read a tap as the start of a scroll or a
   pinch and never deliver it to the game, which is one half of why taps were
   being lost on a phone. The other half was waiting for a 'click' that
   OrbitControls suppresses; see the TOUCH INPUT notes in fasttrack-3d.js. */
canvas { touch-action: none; }

/* The choice box and the hint sit above the board furniture. */
#ft-move-choices { -webkit-tap-highlight-color: transparent; }
#ft-move-choices button:focus-visible { outline: 3px solid #00c8ff; outline-offset: 2px; }

/* ── Undo offer ─────────────────────────────────────────────────────────────
   Shown for a few seconds after a human's move lands. Sits above the footer,
   centred, clear of the board centre. Buttons are 48px tall for thumbs. */
#ft-undo-offer {
  position: fixed;
  left: 50%;
  bottom: calc(var(--ft-footer-h, 56px) + 14px);
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  gap: 10px;
  align-items: center;
}
#ft-undo-offer[hidden] { display: none; }
#ft-undo-offer button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(12, 18, 34, 0.92);
  color: #fff;
  font: 600 16px/1 system-ui, sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
#ft-undo-btn { border-color: #ffcf5a; }
#ft-undo-offer button:hover,
#ft-undo-offer button:focus-visible { background: rgba(30, 44, 78, 0.96); outline: none; }
.ft-undo-ring { width: 28px; height: 28px; transform: rotate(-90deg); }
.ft-undo-ring circle { fill: none; stroke-width: 4; }
.ft-undo-ring-track { stroke: rgba(255, 255, 255, 0.18); }
/* r = 16, so the circumference is about 100.5: the dash offset runs 0 -> 100.5. */
.ft-undo-ring-fill { stroke: #ffcf5a; stroke-dasharray: 100.5; stroke-dashoffset: 0; }

/* ── Split dial ─────────────────────────────────────────────────────────────
   One compact panel for the 7 split: two pegs, one slider, one Play button.
   Sits above the footer like the undo offer (the two never show together). */
#ft-split-dial {
  position: fixed;
  left: 50%;
  bottom: calc(var(--ft-footer-h, 56px) + 14px);
  transform: translateX(-50%);
  z-index: 60;
  width: min(440px, calc(100vw - 16px));
  padding: 10px 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 207, 90, 0.55);
  background: rgba(12, 18, 34, 0.94);
  color: #fff;
  font: 500 15px/1.25 system-ui, sans-serif;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}
#ft-split-dial[hidden] { display: none; }
.ft-sd-title { text-align: center; font-weight: 700; color: #ffe566; margin-bottom: 6px; }
.ft-sd-pairs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 8px; }
.ft-sd-pairs:empty { display: none; }
.ft-sd-pairs button {
  min-height: 40px; padding: 0 12px; border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.3); background: transparent; color: #dfe9ff;
  font: inherit; cursor: pointer;
}
.ft-sd-pairs button[aria-pressed="true"] { border-color: #ffcf5a; background: rgba(255, 207, 90, 0.18); color: #fff; }
.ft-sd-row { display: flex; align-items: center; gap: 8px; }
.ft-sd-side { display: flex; flex-direction: column; align-items: center; min-width: 64px; max-width: 92px; }
.ft-sd-name { font-size: 13px; color: #c9d6f2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ft-sd-steps { font-size: 28px; line-height: 1.1; color: #ffe566; }
#ft-sd-range { flex: 1; min-width: 0; height: 44px; accent-color: #ffcf5a; }
#ft-sd-less, #ft-sd-more {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.06);
  color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
#ft-sd-less:disabled, #ft-sd-more:disabled { opacity: 0.3; cursor: default; }
.ft-sd-note { min-height: 1.25em; margin: 6px 0 8px; text-align: center; font-size: 13px; color: #b7ffd6; }
.ft-sd-actions { display: flex; gap: 8px; justify-content: center; }
.ft-sd-actions button {
  min-height: 48px; padding: 0 18px; border-radius: 24px; font: 600 16px/1 system-ui, sans-serif; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.06); color: #fff;
}
#ft-sd-play { border-color: #ffcf5a; background: rgba(255, 207, 90, 0.22); flex: 1; max-width: 240px; }

/* ── Card draw: size and distance from the screen edge ──────────────────────
   Testers wanted the draw card bigger and not jammed against the edge. These
   three numbers are the only place its size and inset are set; the rules below
   apply them over the older fixed 40 x 56 sizing. Rank and suit scale with it. */
:root { --ft-header-h: 66px; --ft-footer-h: 62px; --ft-card-w: 64px; --ft-card-h: 90px; --ft-card-inset: 24px; }

/* narrower phones: the peg bar wraps to two rows, so the footer band grows */
@media (max-width: 560px) { :root { --ft-header-h: 58px; --ft-footer-h: 94px; --ft-card-w: 52px; --ft-card-h: 73px; --ft-card-inset: 14px; } }

/* right: auto lets the panel shrink to the card, so it does not lie across the board. */
#panel-action { height: auto !important; max-width: none !important; right: auto !important; }
#panel-action #card-area,
#panel-action #current-card {
  width: var(--ft-card-w) !important;
  height: var(--ft-card-h) !important;
}
#panel-action #current-card .card-back,
#panel-action #current-card .card-face {
  width: var(--ft-card-w) !important;
  height: var(--ft-card-h) !important;
  min-width: var(--ft-card-w) !important;
  min-height: var(--ft-card-h) !important;
  max-width: var(--ft-card-w) !important;
  max-height: var(--ft-card-h) !important;
  border-radius: 8px !important;
}
#panel-action #current-card .card-face .cf-rank { font-size: calc(var(--ft-card-w) * 0.42) !important; }
#panel-action #current-card .card-face .cf-suit { font-size: calc(var(--ft-card-w) * 0.32) !important; }
#panel-action #current-card:has(.card-back)::after {
  content: "DRAW";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Rajdhani', 'Segoe UI', sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff8d8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 6px rgba(255, 214, 51, 0.55);
  pointer-events: none;
  text-transform: uppercase; font-size: calc(var(--ft-card-w) * 0.24); }

/* ════════════════════════════════════════════════════════════════
   PLAYER VIEW (Ken, 2026-11-05): the camera stays where the player puts it. When the
   board has been turned or zoomed away from the player's own view, the camera buttons
   glow so the way back is easy to find.
   ════════════════════════════════════════════════════════════════ */
body.ft-off-player-view #btn-camera-toggle {
  color: #fff;
  border-color: rgba(255, 214, 102, 0.9);
  box-shadow: 0 0 0 3px rgba(255, 214, 102, 0.35), 0 0 14px rgba(255, 214, 102, 0.55);
}
body.ft-off-player-view #panel-cam .cam-btn,
body.ft-off-player-view #hamburger-menu .hm-cam-btn {
  border-color: rgba(255, 214, 102, 0.9);
  color: #ffe9a8;
}

/* ════════════════════════════════════════════════════════════════
   TURN PANEL (Ken, 2026-11-05): five numbered peg buttons in the footer, the 7 meter,
   and Confirm that becomes Undo. fasttrack-turn-panel.js drives it; the old confirm
   bar, split dial and undo pop-up stand down.
   ════════════════════════════════════════════════════════════════ */
body.ft-turn-panel #ft-confirm-bar,
body.ft-turn-panel #ft-split-dial,
body.ft-turn-panel #ft-undo-offer,
body.ft-turn-panel #ft-move-choices { display: none !important; }

/* The bar is the way to play on every screen now, so it shows on desktops too; older !important rules
   that hid it there, and that sized the glyph and showed the nicknames, are overruled here. */
body.ft-turn-panel #ft-peg-bar { display: flex !important; }
body.ft-turn-panel #ft-peg-bar .peg-btn .peg-nickname { display: none !important; }
body.ft-turn-panel #ft-peg-bar .peg-btn {
  min-width: 52px; min-height: 52px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  transition: opacity 0.15s, box-shadow 0.15s, transform 0.08s;
}
body.ft-turn-panel #ft-peg-bar .peg-btn .peg-glyph {
  font: 800 26px/1 system-ui, Arial, sans-serif !important;
}
body.ft-turn-panel #ft-peg-bar .peg-btn:disabled {
  opacity: 0.28;
  filter: saturate(0.4);
  cursor: default;
}
body.ft-turn-panel #ft-peg-bar .peg-btn.active {
  opacity: 1;
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 0 16px var(--peg-color, #ffd666);
  cursor: pointer;
}
body.ft-turn-panel #ft-peg-bar .peg-btn.selected {
  border-color: #ffd666;
  box-shadow: 0 0 0 4px #ffd666, 0 0 20px #ffd666;
  transform: translateY(-3px);
}
body.ft-turn-panel #ft-peg-confirm.is-undo {
  background: #2b3445;
  color: #ffe9a8;
  border-color: #ffd666;
}

body.ft-turn-panel #ft-peg-bar .peg-btn.dim { opacity: 0.28; filter: saturate(0.4); box-shadow: none; }

/* Turn panel on wider screens: a compact row in the middle of the footer, not stretched edge to edge. */
@media (min-width: 761px) {
  body.ft-turn-panel #ft-peg-bar {
    left: 50% !important; right: auto !important; width: auto !important;
    transform: translateX(-50%) !important;
  }
  body.ft-turn-panel #ft-peg-bar .peg-btn { flex: 0 0 auto !important; width: 64px !important; }
  body.ft-turn-panel #ft-peg-bar #ft-peg-buttons { flex: 0 0 auto !important; width: auto !important; gap: 10px; }
}

/* On phones the help tip sits above the install pill and the portfolio label, not on them. */
@media (max-width: 760px) {
  body.ft-turn-panel #ft-peg-help { bottom: calc(150px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* Choosing a landing hole (Ken, 2026-11-05): the peg buttons become gold hole numbers, the chosen one green,
   with a small back button to return to the pegs. A sixth button exists only during the rare 6-hole move. */
body.ft-turn-panel #ft-peg-bar .peg-btn.hole-btn .peg-glyph { color: #2a1600 !important; }
body.ft-turn-panel #ft-peg-bar .peg-btn.hole-btn.active { box-shadow: 0 0 0 2px rgba(255, 214, 102, 0.6), 0 0 14px #ffd666; }
body.ft-turn-panel #ft-peg-bar .peg-btn.hole-btn.selected { box-shadow: 0 0 0 4px #35ff7a, 0 0 18px #35ff7a; }
#ft-peg-back {
  min-width: 40px; min-height: 52px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1); color: #fff; font: 800 22px system-ui, Arial, sans-serif; cursor: pointer;
}
#ft-peg-back[hidden] { display: none; }
@media (max-width: 760px) {
  body.ft-turn-panel #ft-peg-bar .peg-btn.extra-btn, body.ft-turn-panel #ft-peg-bar .peg-btn.hole-btn { min-width: 44px; }
}

/* The footer, final form (Ken, 2026-11-05): seven slots, numbered only when there is something to press; a blank
   slot is dormant. Confirm replaces the numbers once the choice is complete and becomes Undo after it; the whole
   bar hides on a bot's turn. */
body.ft-turn-panel.ft-bar-idle #ft-peg-bar { display: none !important; }
body.ft-turn-panel #ft-peg-buttons[hidden] { display: none !important; }
body.ft-turn-panel #ft-peg-confirm[hidden] { display: none !important; }
body.ft-turn-panel #ft-peg-bar .peg-btn.dormant {
  background: transparent !important; border: 1px dashed rgba(255, 255, 255, 0.14) !important;
  box-shadow: none !important; opacity: 1; filter: none; cursor: default;
}
body.ft-turn-panel #ft-peg-bar .peg-btn.count-btn .peg-glyph,
body.ft-turn-panel #ft-peg-bar .peg-btn.hole-btn .peg-glyph { color: #1a1408 !important; }
body.ft-turn-panel #ft-peg-confirm { min-width: 168px; min-height: 52px; font-size: 18px; }
/* Numbers are pegs, letters are holes (Ken, 2026-11-06). A two-character stop label such as A7 is set smaller so
   it fits the narrow phone slot. */
body.ft-turn-panel #ft-peg-bar .peg-btn.long-label .peg-glyph { font-size: 17px !important; letter-spacing: -0.5px; }
@media (max-width: 760px) {
  body.ft-turn-panel #ft-peg-bar #ft-peg-buttons { gap: 4px !important; }
  body.ft-turn-panel #ft-peg-bar .peg-btn { min-width: 40px !important; width: 40px !important; padding: 0 !important; }
}
/* Shortcut buttons (Ken, 2026-11-18): a word such as Traverse or Other gets a button that grows to fit it,
   on a phone too; the dark text reads on the mint tint. */
body.ft-turn-panel #ft-peg-bar .peg-btn.word-label { width: auto !important; min-width: 56px !important; max-width: none !important; padding: 0 10px !important; flex: 0 0 auto !important; }
body.ft-turn-panel #ft-peg-bar .peg-btn.word-label .peg-glyph { font-size: 15px !important; white-space: nowrap; color: #08261a !important; }
/* A single symbol (🎯 🐔 🏁) keeps a full square so the picture is not squeezed when words share the row. */
body.ft-turn-panel #ft-peg-bar .peg-btn.emoji-label { flex: 0 0 auto !important; min-width: 48px !important; }
@media (max-width: 760px) {
  body.ft-turn-panel #ft-peg-bar .peg-btn.emoji-label { width: 44px !important; min-width: 44px !important; }
  body.ft-turn-panel #ft-peg-bar .peg-btn.word-label { padding: 0 8px !important; }
  body.ft-turn-panel #ft-peg-bar .peg-btn.word-label .peg-glyph { font-size: 13px !important; letter-spacing: 0; }
}
body.ft-turn-panel #ft-peg-bar { background: rgba(8, 16, 30, 0.94) !important; border-radius: 14px; }
/* The ✓ step (Ken, 2026-11-18): every other slot disappears; hidden, not removed, so the ✓ stays where the
   pressed button was. */
/* Two-symbol buttons (🏁↻ traverse, 🪂↪ bail out): picture-sized, not word-sized (Ken, 2026-11-18). */
body.ft-turn-panel #ft-peg-bar .peg-btn.word-label.pair-label .peg-glyph { font-size: 26px !important; letter-spacing: 1px; }
@media (max-width: 760px) {
  body.ft-turn-panel #ft-peg-bar .peg-btn.word-label.pair-label .peg-glyph { font-size: 22px !important; }
}
body.ft-turn-panel.ft-bar-ready #ft-peg-bar .peg-btn.dormant { visibility: hidden !important; }
body.ft-turn-panel #ft-peg-bar .peg-btn.selected .peg-glyph { font-weight: 900; }

/* -- The card table (Ken, 2026-11-08) -----------------------------------------------
   The player whose turn it is, then two piles side by side: their own draw deck (face
   down, cards left) and the card drawn this turn (face up, with the drawer's picture).
   Built by renderCardTable() in fasttrack-game-core.js. The old single card is hidden. */
#panel-action #card-area {
  position: relative !important; width: auto !important; height: auto !important; cursor: pointer; }
#panel-action #card-area #current-card { display: none !important; }
#ft-card-table { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
#ft-card-table .ftt-owner {
  display: flex; align-items: center; gap: 5px; max-width: calc(var(--ft-card-w) * 2 + 8px);
  padding: 2px 9px 2px 4px; border: 1.5px solid #9fb0c4; border-radius: 999px;
  background: rgba(8, 14, 30, 0.78); color: #e8ecff; font: 700 12px/1.3 system-ui, sans-serif;
  white-space: nowrap; overflow: hidden;
}
#ft-card-table .ftt-owner-pic { font-size: 15px; line-height: 1; }
#ft-card-table .ftt-owner-name { overflow: hidden; text-overflow: ellipsis; }
#ft-card-table .ftt-piles { display: flex; gap: 8px; }
#ft-card-table .ftt-pile {
  position: relative; box-sizing: border-box; width: var(--ft-card-w); height: var(--ft-card-h);
  border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
/* The back is the deck owner's colour (set inline from the player, Ken 2026-11-15), so the deck on
   the table shows whose turn it is. White border and white lattice read on every player colour,
   the yellow included; #1b2a6b is only the fallback when no colour is known. */
#ft-card-table .ftt-back {
  border: 2px solid rgba(255, 255, 255, 0.9); background-color: #1b2a6b;
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.24) 0 4px, transparent 4px 9px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.24) 0 4px, transparent 4px 9px);
  box-shadow: 2px 2px 0 #0d1640, 4px 4px 0 rgba(13, 22, 64, 0.6);   /* a stack, not one card */
}
#ft-card-table .ftt-back.can-draw { animation: ftt-pulse 1.4s ease-in-out infinite; }
@keyframes ftt-pulse { 50% { box-shadow: 2px 2px 0 #0d1640, 4px 4px 0 rgba(13, 22, 64, 0.6), 0 0 14px 3px #ffd75e; } }
#ft-card-table .ftt-draw {
  padding: 2px 5px; border-radius: 4px; background: rgba(8, 14, 30, 0.85); color: #ffd75e;
  font: 800 11px/1 system-ui, sans-serif; letter-spacing: 0.08em;
}
#ft-card-table .ftt-count {
  position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%);
  min-width: 22px; padding: 1px 5px; border-radius: 999px; background: #0d1640; border: 1px solid #f4d27a;
  color: #f4d27a; font: 700 10px/1.2 system-ui, sans-serif; text-align: center;
}
#ft-card-table .ftt-face { background: #fffdf6; border: 2px solid #d9c27a; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
#ft-card-table .ftt-face.red { color: #c8102e; }
#ft-card-table .ftt-face.black { color: #111; }
#ft-card-table .ftt-rank { font: 800 calc(var(--ft-card-h) * 0.3)/1 Georgia, serif; }
#ft-card-table .ftt-suit { font: 400 calc(var(--ft-card-h) * 0.24)/1 Georgia, serif; }
#ft-card-table .ftt-pic {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #9fb0c4; background: #0d1640; font-size: 13px; line-height: 18px; text-align: center;
}
#ft-card-table .ftt-empty {
  border: 2px dashed rgba(232, 236, 255, 0.35); color: rgba(232, 236, 255, 0.5);
  font: 700 10px/1 system-ui, sans-serif; letter-spacing: 0.06em; text-transform: uppercase;
}

/* "Leave fast track" toggle in the footer (Ken, 2026-11-08). */
#ft-leave-ft {
  margin: 0 6px 0 0; padding: 7px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  border: 1.5px solid #7fd6ff; background: rgba(8, 14, 30, 0.85); color: #bfeaff;
  font: 700 12px/1 system-ui, sans-serif; align-self: center;
}
#ft-leave-ft.is-leaving { border-color: #ffb36b; color: #ffd2a6; }
#ft-leave-ft:hover { filter: brightness(1.15); }

/* "New peg" / "Board peg" choice in the footer (Ken, 2026-11-08). */
.ft-entry-btn {
  margin: 0 6px 0 0; padding: 9px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  border: 1.5px solid #ffd666; background: rgba(8, 14, 30, 0.85); color: #ffe7a3;
  font: 800 13px/1 system-ui, sans-serif; align-self: center;
}
#ft-entry-board { border-color: #9fd3ff; color: #cfeaff; }
/* Out of holding = a drawn jail cell with bars and a right arrow (Ken, 2026-11-18). */
#ft-entry-new { padding: 5px 12px; line-height: 0; }
.ft-entry-btn:hover { filter: brightness(1.15); }

/* Phones (Ken, 2026-11-11: "Leave fast track" missing on a smartphone, and the 7th button cut in half).
   Seven 52px slots plus ↩ plus "Leave fast track" are wider than a phone, and the bar is centred, so the
   overflow was cut off at BOTH ends: measured at 360px, slots 4 to 7 were off screen with the toggle up.
   On phones the bar wraps: the extra buttons (↩, Leave fast track, New peg / Board peg) take a row of
   their own on top, and the seven slots share the full width below, shrinking to fit. */
@media (max-width: 760px) {
  body.ft-turn-panel #ft-peg-bar { flex-wrap: wrap !important; justify-content: center !important; row-gap: 6px; }
  body.ft-turn-panel #ft-peg-bar #ft-peg-buttons {
    order: 2; flex: 1 1 100% !important; width: auto !important; min-width: 0;
    gap: 4px; justify-content: center;
  }
  body.ft-turn-panel #ft-peg-bar .peg-btn { flex: 1 1 0 !important; min-width: 0 !important; max-width: 52px; width: auto !important; }
  body.ft-turn-panel #ft-peg-confirm { order: 3; }
  body.ft-turn-panel #ft-peg-back, #ft-leave-ft, .ft-entry-btn { order: 1; margin: 0; }
  body.ft-turn-panel #ft-peg-back { min-height: 36px; }
}

/* The win celebration (Ken, 2026-11-11): the winner's name, confetti and balloons that keep going,
   and the Play again / Leave game buttons. Built by showWinCelebration in 3d-ui.js. Above the board
   and every control; the sky never takes a tap, only the panel does. */
#ft-win {
  position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center;
  padding: 16px; box-sizing: border-box; background: radial-gradient(ellipse at center, rgba(8, 10, 24, 0.35), rgba(8, 10, 24, 0.72));
  animation: ftwFade 0.5s ease-out both;
}
#ft-win .ftw-sky { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
#ft-win .ftw-confetti {
  position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; opacity: 0.95;
  animation-name: ftwFall; animation-timing-function: linear; animation-iteration-count: infinite;
}
#ft-win .ftw-balloon {
  position: absolute; bottom: -120px; width: 46px; height: 58px; border-radius: 50% 50% 48% 48% / 56% 56% 44% 44%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.75) 0 6%, var(--balloon) 22%, var(--balloon));
  box-shadow: inset -6px -8px 14px rgba(0, 0, 0, 0.25);
  animation-name: ftwRise; animation-timing-function: ease-in-out; animation-iteration-count: infinite;
}
#ft-win .ftw-balloon::after {     /* the string */
  content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 60px; background: rgba(255, 255, 255, 0.55);
}
#ft-win .ftw-panel {
  position: relative; text-align: center; padding: 22px 26px 24px; border-radius: 22px; max-width: 92vw;
  background: rgba(8, 10, 24, 0.86); border: 2px solid var(--win-color);
  box-shadow: 0 0 40px var(--win-color), 0 10px 40px rgba(0, 0, 0, 0.6);
  animation: ftwPop 0.6s cubic-bezier(.2, 1.4, .4, 1) both;
}
#ft-win .ftw-crown { font-size: 64px; line-height: 1; animation: ftwBob 1.6s ease-in-out infinite; }
#ft-win .ftw-title {
  margin: 8px 0 4px; font: 900 clamp(32px, 9vw, 64px)/1.05 system-ui, Arial, sans-serif; color: var(--win-color);
  text-shadow: 0 0 18px var(--win-color), 0 3px 8px rgba(0, 0, 0, 0.8); overflow-wrap: anywhere;
}
#ft-win .ftw-sub { margin: 4px 0 0; font: 700 20px/1.3 system-ui, Arial, sans-serif; color: #f2f5ff; }
#ft-win .ftw-buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 20px; }
#ft-win .ftw-buttons[hidden] { display: none; }
#ft-win .ftw-btn {
  min-height: 48px; padding: 10px 22px; border-radius: 999px; cursor: pointer;
  font: 800 17px system-ui, Arial, sans-serif; border: 2px solid rgba(255, 255, 255, 0.5);
  animation: ftwFade 0.4s ease-out both;
}
#ft-win .ftw-again { background: linear-gradient(135deg, #1f9d55, #2bb673); color: #fff; border-color: #3ed089; }
#ft-win .ftw-leave { background: rgba(255, 255, 255, 0.1); color: #fff; }
#ft-win .ftw-btn:disabled { opacity: 0.6; cursor: default; }
@keyframes ftwFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ftwPop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes ftwBob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-8px) rotate(6deg); } }
@keyframes ftwFall { from { transform: translateY(0) rotate(0); } to { transform: translateY(110vh) rotate(var(--spin, 540deg)); } }
@keyframes ftwRise {
  0% { transform: translate(0, 0) rotate(-4deg); }
  50% { transform: translate(18px, -60vh) rotate(5deg); }
  100% { transform: translate(-10px, -130vh) rotate(-4deg); }
}
@media (prefers-reduced-motion: reduce) {
  #ft-win .ftw-confetti, #ft-win .ftw-balloon { animation-duration: 20s !important; }
}

/* Reactions stay live after a win (Ken, 2026-11-20): the win screen (#ft-win, z-index 100000) covers the page,
   so once it is up the emoji tray, the reaction feed and the balloons are lifted above it. The tray opens from
   the win screen's "React" button (3d-ui.js showWinCelebration). */
body.ft-won #emoji-ui,
body.ft-won #emoji-feed,
body.ft-won .emoji-balloon { z-index: 100002 !important; }
body.ft-won #emoji-ui { display: flex !important; }

/* ── Rules and help (Ken, 2026-11-20): the ? in the top-right row opens help.html in a new tab. It sits left of
   the camera button (settings 12, leave 56, music 100, camera 144, help 188). On phones the row collapses into
   the ☰ menu, which has its own "Rules & help" item. ── */
#btn-help {
  position: fixed;
  top: 12px;
  right: 188px;
  z-index: 50;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(8, 20, 30, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 214, 102, 0.45);
  color: #ffd76b;
  font: 800 19px/1 system-ui, sans-serif;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  user-select: none;
}
#btn-help:hover,
#btn-help:focus-visible {
  background: rgba(90, 70, 10, 0.6);
  color: #fff;
  border-color: rgba(255, 214, 102, 0.9);
  transform: scale(1.06);
}
@media (max-width: 760px) {
  #btn-help { display: none !important; }
}
/* The menu's help item is a link, drawn like the menu's buttons. */
#hamburger-menu a.hm-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 214, 102, 0.4);
  border-radius: 8px;
  background: rgba(20, 30, 50, 0.6);
  color: #ffd76b;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
#hamburger-menu a.hm-link:hover { background: rgba(60, 50, 20, 0.7); }
#hamburger-menu a.hm-link .hm-icon { font-weight: 800; }
/* The first-move tip links to the full rules; the tip itself may ignore taps, the link must not. */
#ft-peg-help .ft-peg-help-link { color: #8fd3ff; font-weight: 700; pointer-events: auto; white-space: nowrap; }