:root {
  --bg-dark: #07090e;
  --bg-card: rgba(15, 23, 42, 0.75);
  --border-gold: rgba(212, 175, 55, 0.4);
  --gold-primary: #d4af37;
  --gold-glow: rgba(212, 175, 55, 0.35);
  --accent-cyan: #38bdf8;
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --success: #22c55e;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body, html {
  width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-dark);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-primary);
  touch-action: none;
}

#app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  height: 100dvh;
  position: relative;
  background: radial-gradient(circle at 50% 30%, #151c28 0%, #07090e 100%);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

/* ---------------- Top Score Header HUD ---------------- */
#header-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: rgba(10, 15, 26, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-gold);
  z-index: 20;
  height: 64px;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 170px;
}

.player-card.active-turn {
  background: rgba(212, 175, 55, 0.12);
  border-color: var(--gold-primary);
  box-shadow: 0 0 16px var(--gold-glow);
  transform: scale(1.02);
}

.player-card.active-ia {
  background: rgba(56, 189, 248, 0.12);
  border-color: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.45);
  transform: scale(1.02);
}

.avatar-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.player-info {
  display: flex;
  flex-direction: column;
}

.player-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.player-turn-tag {
  font-size: 9px;
  font-weight: 800;
  padding: 1.5px 7px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.player-turn-tag.active {
  background: rgba(234, 179, 8, 0.22);
  border: 1px solid #eab308;
  color: #fef08a;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.4);
  animation: pulseTurn 1.8s infinite alternate ease-in-out;
}

.player-turn-tag.active-ia {
  background: rgba(56, 189, 248, 0.22);
  border: 1px solid #38bdf8;
  color: #bae6fd;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
  animation: pulseTurnIA 1.8s infinite alternate ease-in-out;
}

.player-turn-tag.waiting {
  background: rgba(148, 163, 184, 0.10);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #94a3b8;
}

@keyframes pulseTurn {
  from { box-shadow: 0 0 6px rgba(234, 179, 8, 0.3); }
  to { box-shadow: 0 0 14px rgba(234, 179, 8, 0.7); }
}

@keyframes pulseTurnIA {
  from { box-shadow: 0 0 6px rgba(56, 189, 248, 0.3); }
  to { box-shadow: 0 0 14px rgba(56, 189, 248, 0.7); }
}

.player-group-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.player-group-badge.solids {
  color: #fbbf24;
}

.player-group-badge.stripes {
  color: #38bdf8;
}

.remaining-balls {
  display: flex;
  gap: 3px;
  margin-top: 3px;
}

.ball-pip {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #334155;
  transition: background 0.3s;
}

.ball-pip.active {
  background: var(--gold-primary);
  box-shadow: 0 0 4px var(--gold-primary);
}

/* Brand Logo in Header */
.hud-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.55));
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
}

.hud-brand:hover {
  border-color: var(--gold-primary);
  box-shadow: 0 0 16px var(--gold-glow);
  transform: translateY(-1px);
}

.brand-crest {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #2a3447 0%, #0b0f19 80%);
  border: 1.5px solid var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.brand-icon {
  font-size: 16px;
  line-height: 1;
}

.brand-text-col {
  display: flex;
  flex-direction: column;
}

.game-title {
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 1.1px;
  line-height: 1.1;
  background: linear-gradient(90deg, #fffbeb 0%, #fde047 30%, #d4af37 70%, #fef08a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
  margin: 0;
  white-space: nowrap;
}

.game-subtitle {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 2.2px;
  color: #94a3b8;
  text-transform: uppercase;
  margin-top: 1px;
}

/* Match Scoreboard Center Wrapper */
.hud-match-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  flex: 1;
}

/* Center HUD Pill */
#center-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 140px;
}

.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 20px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  animation: pulseBadge 2s infinite;
}

.status-badge.foul {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--danger);
  color: #fca5a5;
}

@keyframes pulseBadge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

/* Quick Tools */
.hud-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-qr-action {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(37, 99, 235, 0.3));
  border: 1px solid #38bdf8;
  color: #e0f2fe;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
  transition: all 0.2s;
  animation: glowMobile 2.5s infinite;
}

.btn-qr-action:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.4), rgba(37, 99, 235, 0.5));
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
  transform: translateY(-1px);
}

@keyframes glowMobile {
  0%, 100% { box-shadow: 0 0 8px rgba(56, 189, 248, 0.25); }
  50% { box-shadow: 0 0 16px rgba(56, 189, 248, 0.6); }
}

.icon-btn {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: var(--gold-primary);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(1px);
}

.btn-lang {
  width: auto;
  min-width: 44px;
  padding: 0 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  background: rgba(15, 23, 42, 0.75);
}

.btn-lang:hover {
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  background: rgba(30, 41, 59, 0.9);
}

.btn-fs-action.btn-lang {
  width: auto;
  min-width: 40px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
}

/* ---------------- Canvas Area ---------------- */
#canvas-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

#poolCanvas {
  display: block;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9), 0 0 40px rgba(0, 0, 0, 0.8);
  cursor: crosshair;
  touch-action: none;
}

/* ---------------- Controls Overlay ---------------- */
#controls-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

/* ---------------- Redesigned Luxury Power Bar Controller ---------------- */
#power-bar-container {
  position: absolute;
  right: 16px;
  bottom: 18px;
  top: auto;
  transform: none;
  width: 52px;
  height: 275px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-gold);
  border-radius: 22px;
  padding: 7px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  pointer-events: auto;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7), 0 0 18px rgba(212, 175, 55, 0.2);
  z-index: 15;
  user-select: none;
}

.power-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
}

.power-label {
  font-size: 8.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--gold-primary);
  letter-spacing: 0.5px;
}

.power-value-badge {
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
  min-width: 30px;
  text-align: center;
  transition: all 0.15s ease;
}

.power-value-badge.tier-medium {
  background: rgba(234, 179, 8, 0.18);
  border-color: rgba(234, 179, 8, 0.5);
  color: #fef08a;
}

.power-value-badge.tier-strong {
  background: rgba(249, 115, 22, 0.2);
  border-color: rgba(249, 115, 22, 0.6);
  color: #fb923c;
}

.power-value-badge.tier-max {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #f87171;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  animation: pulseMax 0.6s infinite alternate;
}

@keyframes pulseMax {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

#power-track {
  width: 18px;
  flex: 1;
  background: radial-gradient(circle at 50% 50%, rgba(2, 6, 23, 0.95), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  position: relative;
  overflow: visible;
  margin: 6px 0;
  cursor: pointer;
  touch-action: none;
}

.power-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pwr-tick {
  position: absolute;
  left: 2px;
  right: 2px;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
}
.pwr-tick.tick-100 { top: 2px; background: rgba(239, 68, 68, 0.6); }
.pwr-tick.tick-75 { top: 25%; }
.pwr-tick.tick-50 { top: 50%; }
.pwr-tick.tick-25 { top: 75%; }

#power-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: linear-gradient(to top, #22c55e 0%, #eab308 50%, #f97316 75%, #ef4444 100%);
  border-radius: 10px;
  transition: height 0.04s ease-out;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.6);
}

.power-thumb {
  position: absolute;
  left: 50%;
  bottom: 0%;
  transform: translate(-50%, 50%);
  width: 24px;
  height: 9px;
  border-radius: 5px;
  background: linear-gradient(135deg, #fef08a, #d4af37, #b45309);
  border: 1px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8), 0 0 6px rgba(212, 175, 55, 0.8);
  pointer-events: none;
  transition: bottom 0.04s ease-out;
}

.power-quick-presets {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  width: 100%;
  margin-bottom: 4px;
}

.btn-pwr-chip {
  flex: 1;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-size: 7.5px;
  font-weight: 700;
  padding: 2px 0;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.btn-pwr-chip:hover, .btn-pwr-chip:active {
  background: rgba(212, 175, 55, 0.3);
  color: #fef08a;
  border-color: #d4af37;
}

#btn-fire-cue {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #eab308, #ca8a04, #a16207);
  border: 2px solid rgba(254, 240, 138, 0.9);
  color: #000;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(234, 179, 8, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

#btn-fire-cue:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(234, 179, 8, 0.9);
}

#btn-fire-cue:active {
  transform: scale(0.95);
}

.fire-icon {
  font-size: 13px;
  line-height: 1;
}

.fire-text {
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.3px;
}

/* Aim Wheel Dial (Mobile & Desktop Left Corner) */
#aim-wheel-container {
  position: absolute;
  left: 18px;
  bottom: 12px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid var(--border-gold);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: grab;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
  z-index: 15;
}

#aim-wheel-container:active {
  cursor: grabbing;
  border-color: var(--gold-primary);
}

.wheel-dial-marker {
  font-size: 22px;
  color: var(--gold-primary);
}

.wheel-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Spin Selector Mini Button (kept for DOM compatibility but hidden) */
#spin-widget-btn {
  display: none !important;
}

#modal-spin {
  display: none !important;
}

.mini-cueball {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff, #cbd5e1);
  position: relative;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.3);
}

.spin-chalk-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ---------------- Pocketed Balls Tray (Grandes y Pequeñas) ---------------- */
.pocketed-balls-tray {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, rgba(10, 15, 29, 0.98) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 26px;
  padding: 5px 18px;
  z-index: 12;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.75), inset 0 1px 1px rgba(255, 255, 255, 0.15), 0 0 14px rgba(212, 175, 55, 0.15);
  pointer-events: auto;
  white-space: nowrap;
  user-select: none;
}

.tray-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tray-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tray-title.solids {
  color: #38bdf8;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.tray-title.stripes {
  color: #facc15;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.4);
}

.tray-divider {
  width: 1px;
  height: 24px;
  background: linear-gradient(180deg, transparent, rgba(212, 175, 55, 0.5), transparent);
}

.tray-balls {
  display: flex;
  gap: 5px;
  align-items: center;
}

.tray-ball-pill {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: inset 0 -2.5px 4px rgba(0, 0, 0, 0.55), inset 0 1.5px 2px rgba(255, 255, 255, 0.75), 0 3px 6px rgba(0, 0, 0, 0.65);
  user-select: none;
  cursor: default;
}

/* In play: dimmed like a recessed dark socket in a luxury tray */
.tray-ball-pill.in-play {
  opacity: 0.30;
  filter: grayscale(35%) brightness(0.65);
  transform: scale(0.88);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8), 0 1px 2px rgba(255, 255, 255, 0.08);
}

/* Pocketed / Fallen: bright illuminated 3D sphere with golden aura */
.tray-ball-pill.pocketed {
  opacity: 1.0;
  filter: none;
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.85), inset 0 -2.5px 4px rgba(0, 0, 0, 0.55), inset 0 2px 3px rgba(255, 255, 255, 0.85), 0 3px 6px rgba(0, 0, 0, 0.7);
  animation: ballDropPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes ballDropPop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.25); }
  100% { transform: scale(1.08); opacity: 1; }
}

.tray-ball-pill.striped {
  background: #ffffff !important;
}

.tray-ball-pill.striped .stripe-band {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 0;
  right: 0;
  border-radius: 2px;
  z-index: 1;
}

.tray-ball-pill .ball-num {
  position: relative;
  z-index: 2;
  background: #ffffff;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8.5px;
  font-weight: 900;
  color: #0f172a;
  line-height: 1;
  box-shadow: inset 0 0.5px 1px rgba(0, 0, 0, 0.25);
}

/* Live Turn Announcement Toast */
.turn-announcement-toast {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px) scale(0.95);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.98));
  border: 1.5px solid #eab308;
  padding: 8px 24px;
  border-radius: 24px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.9), 0 0 20px rgba(234, 179, 8, 0.45);
  pointer-events: none;
  opacity: 0;
  transition: all 0.38s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 85;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 250px;
  max-width: 90vw;
}

.turn-announcement-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.turn-announcement-toast.turn-p1 {
  border-color: #eab308;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.9), 0 0 22px rgba(234, 179, 8, 0.5);
}

.turn-announcement-toast.turn-p1 .turn-toast-title {
  color: #fef08a;
  text-shadow: 0 0 12px rgba(234, 179, 8, 0.6);
}

.turn-announcement-toast.turn-p2 {
  border-color: #38bdf8;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.9), 0 0 22px rgba(56, 189, 248, 0.5);
}

.turn-announcement-toast.turn-p2 .turn-toast-title {
  color: #bae6fd;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

.turn-announcement-toast.turn-foul {
  border-color: #ef4444;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.9), 0 0 22px rgba(239, 68, 68, 0.6);
}

.turn-announcement-toast.turn-foul .turn-toast-title {
  color: #fca5a5;
  text-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

.turn-toast-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.turn-toast-icon {
  font-size: 16px;
}

.turn-toast-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.turn-toast-sub {
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
  margin-top: 2px;
}

/* Live Pocket Drop Toast */
.pocket-drop-toast {
  position: absolute;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%) translateY(15px);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.98));
  border: 1px solid var(--gold-primary);
  color: #fef08a;
  font-size: 11px;
  font-weight: 800;
  padding: 6px 18px;
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.9), 0 0 15px rgba(212, 175, 55, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 80;
  white-space: nowrap;
}

.pocket-drop-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Fullscreen mini bar ball badges */
.fs-balls-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fs-ball-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 8px;
  line-height: 1.2;
}

.fs-ball-badge.solids {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid #38bdf8;
  color: #bae6fd;
}

.fs-ball-badge.stripes {
  background: rgba(250, 204, 21, 0.2);
  border: 1px solid #facc15;
  color: #fef08a;
}

/* ---------------- Mingo & Cue Tilt Docked Controls (Vertical Right Side) ---------------- */
.mingo-dock {
  position: absolute;
  right: 14px;
  top: 68px;
  width: 114px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96) 0%, rgba(10, 15, 29, 0.98) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 18px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: auto;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.75), 0 0 16px rgba(212, 175, 55, 0.2);
  z-index: 15;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
  overflow: hidden;
}

.cue-3d-box {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cue-3d-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.mingo-dock-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 4px;
}

.mingo-dock-title {
  font-size: 9px;
  font-weight: 800;
  color: var(--gold-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  box-sizing: border-box;
}

.btn-mingo-reset {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: #fef08a;
  font-size: 8.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  width: auto;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.btn-mingo-reset:hover {
  background: rgba(212, 175, 55, 0.25);
  border-color: #d4af37;
  transform: scale(1.03);
}

.btn-mingo-reset:active {
  transform: scale(0.96);
}

.mingo-dock-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 5px;
}

.mingo-strike-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
}

.mingo-pad {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #f1f5f9 40%, #cbd5e1 75%, #64748b 100%);
  position: relative;
  box-shadow: inset 0 -3.5px 8px rgba(0, 0, 0, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.9), 0 4px 12px rgba(0, 0, 0, 0.65);
  cursor: crosshair;
  touch-action: none;
  overflow: hidden;
}

.mingo-crosshair-h {
  position: absolute;
  top: 50%;
  left: 8%;
  right: 8%;
  height: 1px;
  background: rgba(100, 116, 139, 0.45);
  pointer-events: none;
}

.mingo-crosshair-v {
  position: absolute;
  left: 50%;
  top: 8%;
  bottom: 8%;
  width: 1px;
  background: rgba(100, 116, 139, 0.45);
  pointer-events: none;
}

.mingo-chalk-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  border: 1.5px solid #ffffff;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px #ef4444;
  pointer-events: none;
  transition: transform 0.05s ease-out;
}

.mingo-effect-badge {
  font-size: 7.5px;
  font-weight: 800;
  color: #fbbf24;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 9999px;
  padding: 1.5px 5px;
  letter-spacing: 0.2px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.mingo-quick-spins {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5px;
  width: 100%;
}

.btn-spin-chip {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: #cbd5e1;
  font-size: 7.5px;
  font-weight: 700;
  padding: 2.5px 1px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  width: 100%;
}

.btn-spin-chip:hover {
  background: rgba(51, 65, 85, 0.95);
  color: #ffffff;
  border-color: rgba(251, 191, 36, 0.5);
}

.btn-spin-chip.active {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.35), rgba(202, 138, 4, 0.2));
  border-color: #eab308;
  color: #fef08a;
  box-shadow: 0 0 6px rgba(234, 179, 8, 0.4);
}

.cue-tilt-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.cue-tilt-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
}

.cue-tilt-label {
  font-size: 8px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: center;
}

.cue-tilt-badge {
  font-size: 8.5px;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.45);
  padding: 2px 3px;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  text-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}

.cue-tilt-slider-container {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.tilt-icon {
  font-size: 11px;
  color: var(--gold-primary);
  line-height: 1;
  font-weight: 900;
}

.cue-tilt-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 5px;
  background: rgba(2, 6, 23, 0.85);
  border-radius: 6px;
  outline: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
}

.cue-tilt-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4af37, #fef08a);
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 5px rgba(212, 175, 55, 0.8);
  cursor: grab;
}

.cue-tilt-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4af37, #fef08a);
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 5px rgba(212, 175, 55, 0.8);
  cursor: grab;
}

.cue-tilt-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  width: 100%;
}

.btn-tilt-preset {
  padding: 3px 2px;
  font-size: 8.5px;
  font-weight: 800;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.btn-tilt-preset:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #ffffff;
}

.btn-tilt-preset.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.4), rgba(202, 138, 4, 0.5));
  border-color: #d4af37;
  color: #fef08a;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

.cue-curve-directions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5px;
  width: 100%;
  margin-top: 1px;
}

.btn-curve-dir {
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 4px;
  color: #38bdf8;
  font-size: 7px;
  font-weight: 700;
  padding: 2.5px 1px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  width: 100%;
}

.btn-curve-dir:hover {
  background: rgba(14, 165, 233, 0.30);
  color: #ffffff;
  border-color: #38bdf8;
}

.btn-curve-dir.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.45), rgba(2, 132, 199, 0.3));
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

/* ---------------- Modals & Dialogs ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 90%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold-primary);
}

.btn-primary {
  background: linear-gradient(135deg, #d4af37, #ca8a04);
  border: none;
  color: #000;
  font-weight: 700;
  font-size: 14px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--gold-glow);
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.option-btn {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px;
  border-radius: 12px;
  color: var(--text-primary);
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
}

.option-btn.selected {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.15);
  color: #fef08a;
}

/* Spin Modal Target Board */
#spin-pad-container {
  display: flex;
  justify-content: center;
  padding: 15px 0;
}

#spin-pad {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff, #94a3b8);
  position: relative;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

#spin-pad-indicator {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #ffffff;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}

/* ---------------- Responsive Maximized Space for Mobile ---------------- */
@media (max-width: 850px) {
  #header-hud {
    height: 38px;
    padding: 2px 6px;
  }
  .player-card {
    min-width: 80px;
    padding: 2px 6px;
    gap: 4px;
    border-radius: 8px;
  }
  .avatar-badge {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }
  .player-name {
    font-size: 11px;
    line-height: 1.1;
  }
  .player-group-badge {
    font-size: 9px;
  }
  .ball-pip {
    width: 6px;
    height: 6px;
  }
  .hud-brand {
    padding: 2px 6px;
    gap: 5px;
    border-radius: 8px;
  }
  .brand-crest {
    width: 20px;
    height: 20px;
  }
  .brand-icon {
    font-size: 10px;
  }
  .game-title {
    font-size: 11px;
    letter-spacing: 0.8px;
    display: block;
  }
  .game-subtitle {
    display: none;
  }
  .hud-match-bar {
    gap: 4px;
  }
  .status-badge {
    font-size: 10px;
    padding: 2px 6px;
  }
  #btn-mobile {
    display: none !important; /* Game is already on mobile, free up top bar space */
  }
  .btn-qr-action {
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 800;
  }
  .icon-btn {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
  #canvas-wrapper {
    padding: 0;
    margin: 0;
  }
  #poolCanvas {
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  }
  #power-bar-container {
    right: 4px;
    height: 180px;
    width: 30px;
    padding: 4px;
  }
  #power-track {
    width: 10px;
  }
  #btn-fire-cue {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  #aim-wheel-container {
    left: 6px;
    bottom: 6px;
    width: 52px;
    height: 52px;
  }
  #spin-widget-btn {
    right: 38px;
    bottom: 6px;
    width: 36px;
    height: 36px;
  }
}

/* Mobile Landscape — Absolute Maximum Table Size */
@media (max-height: 550px) and (orientation: landscape), (max-width: 950px) and (orientation: landscape) {
  #header-hud {
    height: 38px;
    padding: 2px 6px;
  }
  .player-card {
    height: 32px;
    min-width: 70px;
    padding: 2px 4px;
    gap: 3px;
    border-radius: 6px;
  }
  .avatar-badge {
    width: 20px;
    height: 20px;
    font-size: 11px;
  }
  .player-name {
    font-size: 10px;
    line-height: 1;
  }
  .player-group-badge {
    font-size: 8px;
  }
  .ball-pip {
    width: 5px;
    height: 5px;
  }
  .status-badge {
    font-size: 9px;
    padding: 1px 5px;
  }
  .hud-brand {
    height: 24px;
    padding: 1px 6px;
    gap: 4px;
    border-radius: 6px;
  }
  .brand-crest {
    width: 16px;
    height: 16px;
  }
  .brand-icon {
    font-size: 9px;
  }
  .game-title {
    font-size: 9.5px;
    letter-spacing: 0.6px;
  }
  .hud-match-bar {
    gap: 4px;
  }
  #center-hud {
    min-width: auto;
    gap: 1px;
  }
  .champ-status-pill {
    padding: 1px 6px;
    font-size: 8px;
    height: 14px;
    gap: 3px;
  }
  #btn-mobile {
    display: none !important;
  }
  .btn-qr-action {
    padding: 2px 6px;
    font-size: 10px;
  }
  .icon-btn {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }
  #canvas-wrapper {
    padding: 0;
    margin: 0;
  }
  #poolCanvas {
    border-radius: 4px;
  }
  #power-bar-container {
    height: 160px;
    max-height: 52vh;
    right: 8px;
    bottom: 8px;
    top: auto;
    transform: none;
    width: 36px;
    padding: 3px 2px;
    border-radius: 16px;
  }
  #power-bar-container .power-header {
    gap: 1px;
  }
  #power-bar-container .power-label {
    font-size: 7.5px;
  }
  #power-bar-container .power-value-badge {
    font-size: 7.5px;
    padding: 0 3px;
    min-width: 24px;
  }
  #power-bar-container #power-track {
    width: 14px;
    margin: 3px 0;
  }
  #power-bar-container .power-quick-presets {
    display: none !important; /* Hide presets in compact landscape to prioritize track */
  }
  #power-bar-container #btn-fire-cue {
    width: 30px;
    height: 30px;
  }
  #power-bar-container .fire-icon {
    font-size: 11px;
  }
  #power-bar-container .fire-text {
    font-size: 6px;
  }
  #aim-wheel-container {
    left: 8px;
    bottom: 8px;
    width: 48px;
    height: 48px;
  }
  .pocketed-balls-tray {
    display: none !important; /* In mobile landscape, space is dedicated to table; summary is in mini-bar */
  }
  #mingo-dock {
    position: absolute !important;
    right: 8px !important;
    left: auto !important;
    top: 36px !important;
    bottom: auto !important;
    width: 74px !important;
    max-width: 74px !important;
    max-height: 290px !important;
    padding: 4px 3px !important;
    gap: 2px !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  #mingo-dock .mingo-dock-header {
    width: 100% !important;
    padding-bottom: 2px !important;
  }
  #mingo-dock .mingo-dock-title {
    font-size: 8px !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
  }
  #mingo-dock .btn-mingo-reset {
    font-size: 7px !important;
    padding: 1px 3px !important;
  }
  #mingo-dock .cue-3d-box {
    margin-bottom: 2px !important;
    max-height: 42px !important;
  }
  #mingo-dock .mingo-dock-content {
    flex-direction: column !important;
    gap: 2px !important;
    align-items: center !important;
    width: 100% !important;
  }
  #mingo-dock .mingo-pad {
    width: 34px !important;
    height: 34px !important;
  }
  #mingo-dock .mingo-pad-subtext {
    display: none !important;
  }
  #mingo-dock .cue-tilt-section {
    width: 100% !important;
    gap: 1px !important;
  }
  #mingo-dock .cue-tilt-header {
    width: 100% !important;
  }
  #mingo-dock .cue-tilt-label {
    font-size: 7.5px !important;
  }
  #mingo-dock .cue-tilt-badge {
    font-size: 7.5px !important;
    padding: 0 2px !important;
    max-width: 52px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  #mingo-dock .cue-tilt-slider-container {
    width: 100% !important;
    gap: 1px !important;
  }
  #mingo-dock .cue-tilt-slider {
    min-width: 0 !important;
    width: 100% !important;
  }
  #mingo-dock .tilt-icon {
    font-size: 9px !important;
  }
  #mingo-dock .cue-tilt-presets {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5px !important;
    width: 100% !important;
  }
  #mingo-dock .btn-tilt-preset {
    padding: 1.5px 1px !important;
    font-size: 7px !important;
    letter-spacing: -0.3px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    overflow: hidden !important;
  }
  #mingo-dock .btn-curve-dir {
    font-size: 6.5px !important;
    padding: 1.5px 0.5px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  #mingo-dock .btn-spin-chip {
    font-size: 6.5px !important;
    padding: 1.5px 0.5px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  #mingo-dock .mingo-effect-badge {
    font-size: 6.5px !important;
    padding: 1px 2px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
  }
}

/* Mobile Portrait — Dedicated Ergonomic Controller Dock & Zero Table Overlap */
@media (orientation: portrait) {
  .pocketed-balls-tray,
  #app-container.fullscreen-mode .pocketed-balls-tray {
    bottom: 198px !important;
    top: auto !important;
    padding: 3px 10px !important;
    gap: 6px !important;
    border-radius: 18px !important;
  }
  .tray-title {
    font-size: 8px !important;
    gap: 2px !important;
  }
  .tray-title .title-full {
    display: none !important;
  }
  .tray-divider {
    height: 18px !important;
  }
  .tray-ball-pill {
    width: 16px !important;
    height: 16px !important;
  }
  .tray-ball-pill.striped .stripe-band {
    top: 3px !important;
    bottom: 3px !important;
  }
  .tray-ball-pill .ball-num {
    width: 8px !important;
    height: 8px !important;
    font-size: 6px !important;
  }
  .pocket-drop-toast,
  #app-container.fullscreen-mode .pocket-drop-toast {
    bottom: 238px !important;
    top: auto !important;
    font-size: 10px !important;
    padding: 4px 12px !important;
  }
  #power-bar-container {
    position: absolute !important;
    right: 12px !important;
    bottom: 20px !important;
    top: auto !important;
    transform: none !important;
    width: 44px !important;
    height: 170px !important;
    padding: 5px 3px !important;
    border-radius: 18px !important;
  }
  #power-bar-container .power-quick-presets {
    display: none !important;
  }
  #power-bar-container #power-track {
    width: 16px !important;
  }
  #power-bar-container #btn-fire-cue {
    width: 34px !important;
    height: 34px !important;
  }
  #power-bar-container .fire-icon {
    font-size: 11px !important;
  }
  #power-bar-container .fire-text {
    font-size: 6px !important;
  }
  #aim-wheel-container {
    position: absolute !important;
    left: 14px !important;
    bottom: 20px !important;
    width: 60px !important;
    height: 60px !important;
  }
  #mingo-dock {
    position: absolute !important;
    right: 64px !important;
    left: auto !important;
    bottom: 20px !important;
    top: auto !important;
    width: 82px !important;
    max-width: 82px !important;
    height: 170px !important;
    padding: 5px 4px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  #mingo-dock .cue-3d-box {
    max-height: 44px !important;
  }
  #mingo-dock .mingo-dock-header {
    width: 100% !important;
    padding-bottom: 2px !important;
  }
  #mingo-dock .mingo-dock-title {
    font-size: 7.5px !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
  }
  #mingo-dock .btn-mingo-reset {
    font-size: 7px !important;
    padding: 1px 3px !important;
    width: 100% !important;
  }
  #mingo-dock .mingo-dock-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    gap: 2px !important;
  }
  #mingo-dock .mingo-strike-section {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 1px !important;
  }
  #mingo-dock .mingo-pad {
    width: 34px !important;
    height: 34px !important;
  }
  #mingo-dock .mingo-pad-subtext {
    display: none !important;
  }
  #mingo-dock .cue-tilt-section {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5px !important;
  }
  #mingo-dock .cue-tilt-header {
    width: 100% !important;
  }
  #mingo-dock .cue-tilt-label {
    font-size: 7.5px !important;
  }
  #mingo-dock .cue-tilt-badge {
    font-size: 7.5px !important;
    padding: 1px 3px !important;
    max-width: 48px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  #mingo-dock .cue-tilt-slider-container {
    width: 100% !important;
    gap: 1.5px !important;
  }
  #mingo-dock .cue-tilt-slider {
    min-width: 0 !important;
    width: 100% !important;
  }
  #mingo-dock .tilt-icon {
    font-size: 9px !important;
  }
  #mingo-dock .cue-tilt-presets {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5px !important;
    width: 100% !important;
  }
  #mingo-dock .btn-tilt-preset {
    padding: 1.5px 1px !important;
    font-size: 7px !important;
    letter-spacing: -0.3px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    overflow: hidden !important;
  }
  #mingo-dock .btn-curve-dir {
    font-size: 6.5px !important;
    padding: 1.5px 0.5px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  #mingo-dock .btn-spin-chip {
    font-size: 6.5px !important;
    padding: 1.5px 0.5px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  #mingo-dock .mingo-effect-badge {
    font-size: 6.5px !important;
    padding: 1px 2px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
  }
}

@media (orientation: landscape) {
  .rotate-hint {
    display: none !important;
  }
}

/* Rotation Hint Banner for Mobile Portrait */
.rotate-hint {
  position: absolute;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #38bdf8;
  color: #e0f2fe;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 49;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.8), 0 0 12px rgba(56, 189, 248, 0.4);
  animation: pulseRotate 2.5s infinite;
  pointer-events: auto;
  white-space: nowrap;
}

@keyframes pulseRotate {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.02); }
}

.rotate-hint-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  padding: 0 4px;
  display: flex;
  align-items: center;
}
.rotate-hint-close:hover {
  color: #ffffff;
}

/* ---------------- Smart Mobile Fullscreen Overlay ---------------- */
#mobile-start-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(7, 9, 14, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInOverlay 0.3s ease;
}

@keyframes fadeInOverlay {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 850px) and (orientation: portrait) {
  #mobile-start-overlay.active {
    display: flex;
  }
}

.mobile-start-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.98));
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  padding: 26px 20px;
  text-align: center;
  max-width: 320px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 30px var(--gold-glow);
}

.mobile-start-icon {
  font-size: 44px;
  margin-bottom: 12px;
  display: inline-block;
  animation: pulseRotate 2.5s infinite;
}

.mobile-start-card h2 {
  font-size: 21px;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.mobile-start-card p {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 20px;
}

.mobile-start-card p strong {
  color: #38bdf8;
}

.btn-primary-fullscreen {
  width: 100%;
  background: linear-gradient(135deg, #d4af37, #b89628);
  color: #07090e;
  font-size: 15px;
  font-weight: 800;
  padding: 13px 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary-fullscreen:active {
  transform: scale(0.97);
  background: #eab308;
}

.btn-secondary-link {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 12px;
  margin-top: 14px;
  cursor: pointer;
  text-decoration: underline;
  padding: 6px;
  display: inline-block;
}

/* ---------------- App-Level Fullscreen Mode ---------------- */
#app-container.fullscreen-mode #header-hud {
  display: none !important;
}

#app-container.fullscreen-mode #canvas-wrapper {
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  height: 100dvh;
  box-sizing: border-box;
}

@media (orientation: landscape) {
  #app-container.fullscreen-mode #canvas-wrapper {
    padding-top: 38px !important;
    padding-bottom: 8px !important;
    padding-left: 64px !important;
    padding-right: 56px !important;
  }
}

@media (orientation: portrait) {
  #app-container.fullscreen-mode #canvas-wrapper {
    padding-top: 48px !important;
    padding-bottom: 200px !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
}

#app-container.fullscreen-mode #poolCanvas {
  border-radius: 6px;
}

@media (orientation: landscape) {
  #app-container.fullscreen-mode .pocketed-balls-tray {
    bottom: 12px !important;
    top: auto !important;
  }

  #app-container.fullscreen-mode .pocket-drop-toast {
    bottom: 64px !important;
    top: auto !important;
  }
}

/* On small mobile portrait screens, hide fs-mini-bar completely so it cannot cause 788px overflow */
@media (max-width: 768px) and (orientation: portrait) {
  #app-container.fullscreen-mode .fs-mini-bar,
  #fs-mini-bar,
  .fs-mini-bar {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }
}

#app-container.fullscreen-mode .fs-mini-bar {
  display: flex !important;
}

.fs-mini-bar {
  display: none;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 20px;
  padding: 3px 12px;
  height: 32px;
  box-sizing: border-box;
  align-items: center;
  gap: 8px;
  z-index: 50;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.8), 0 0 12px var(--gold-glow);
  pointer-events: auto;
  white-space: nowrap;
  animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.fs-brand {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.8px;
  background: linear-gradient(90deg, #fffbeb, #d4af37);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  margin-right: 2px;
  white-space: nowrap;
}

.fs-player {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.fs-player.active {
  color: #fbbf24;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}

.fs-status-pill {
  font-size: 10px;
  font-weight: 700;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 2px 10px;
  border-radius: 12px;
  color: #e2e8f0;
}

.btn-fs-exit {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  pointer-events: auto;
}

.btn-fs-exit:hover {
  background: rgba(239, 68, 68, 0.5);
  color: #ffffff;
}

.btn-fs-action {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-fs-action:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: var(--gold-primary);
}

.btn-fs-action:active {
  transform: scale(0.95);
}

/* --- Championship Mode Grandmaster Billiards Styles --- */
.btn-trophy {
  color: #facc15 !important;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(161, 98, 7, 0.25)) !important;
  border-color: rgba(234, 179, 8, 0.4) !important;
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.25);
  transition: all 0.25s ease;
}

.btn-trophy:hover {
  border-color: #facc15 !important;
  box-shadow: 0 0 16px rgba(234, 179, 8, 0.6) !important;
  transform: scale(1.05);
}

.player-champ-score {
  font-size: 10px;
  font-weight: 800;
  padding: 1.5px 6px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(161, 98, 7, 0.3));
  border: 1px solid #eab308;
  color: #fef08a;
  letter-spacing: 0.5px;
  box-shadow: 0 0 6px rgba(234, 179, 8, 0.3);
}

.champ-status-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 700;
  color: #fef08a;
  background: rgba(234, 179, 8, 0.14);
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-radius: 12px;
  padding: 2px 10px;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.25);
}

.fs-champ-score {
  font-size: 10px;
  font-weight: 800;
  color: #fef08a;
  background: rgba(234, 179, 8, 0.2);
  border: 1px solid #eab308;
  padding: 1px 6px;
  border-radius: 6px;
}

/* Championship Modal */
.champ-card {
  max-width: 460px;
  width: 92vw;
  background: linear-gradient(145deg, #0b1120, #0f172a);
  border: 1.5px solid rgba(234, 179, 8, 0.5);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 25px rgba(234, 179, 8, 0.3);
}

.champ-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin: 6px 0 14px 0;
  line-height: 1.4;
  text-align: center;
}

.champ-format-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.champ-format-card {
  background: rgba(30, 41, 59, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.22s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.champ-format-card:hover {
  background: rgba(51, 65, 85, 0.85);
  border-color: rgba(234, 179, 8, 0.5);
  transform: translateY(-2px);
}

.champ-format-card.selected {
  background: linear-gradient(145deg, rgba(234, 179, 8, 0.18), rgba(161, 98, 7, 0.28));
  border-color: #eab308;
  box-shadow: 0 0 16px rgba(234, 179, 8, 0.45);
}

.champ-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 8px;
  background: #eab308;
  color: #0f172a;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.champ-name {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
}

.champ-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.champ-opponent-section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.champ-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  text-transform: uppercase;
}

.champ-opponent-buttons {
  display: flex;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}

.champ-opp-btn {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.champ-opp-btn:hover {
  border-color: #38bdf8;
  color: #f8fafc;
}

.champ-opp-btn.selected {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #bae6fd;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.champ-rules-note {
  font-size: 11px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 14px;
  line-height: 1.4;
}

.btn-start-champ {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  font-weight: 800;
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #0f172a;
  box-shadow: 0 6px 20px rgba(234, 179, 8, 0.4);
}

.btn-start-champ:hover {
  box-shadow: 0 8px 25px rgba(234, 179, 8, 0.7);
  transform: translateY(-1px);
}

.championship-menu-btn {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.22), rgba(161, 98, 7, 0.28)) !important;
  border-color: #eab308 !important;
  color: #fef08a !important;
  font-weight: 700;
}

.championship-menu-btn:hover {
  box-shadow: 0 0 16px rgba(234, 179, 8, 0.5) !important;
}

.gameover-champ-summary {
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 10px 0;
  font-size: 13px;
  font-weight: 700;
  color: #fef08a;
}

/* Player Names Customization Styles */
.btn-edit-name {
  background: transparent;
  border: none;
  font-size: 11px;
  cursor: pointer;
  padding: 1px 3px;
  margin-left: 2px;
  border-radius: 4px;
  opacity: 0.65;
  transition: opacity 0.2s, transform 0.15s, background-color 0.2s;
  vertical-align: middle;
  line-height: 1;
}

.btn-edit-name:hover {
  opacity: 1;
  transform: scale(1.15);
  background: rgba(255, 255, 255, 0.12);
}

.player-name {
  cursor: pointer;
  transition: color 0.2s;
}

.player-name:hover {
  color: #fef08a;
  text-decoration: underline dotted rgba(254, 240, 138, 0.5);
}

.player-name-inline-input {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #eab308;
  border-radius: 4px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 5px;
  width: 90px;
  outline: none;
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.5);
  font-family: inherit;
}

.player-names-config-box,
.champ-names-config-box {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 12px 0;
  text-align: left;
}

.config-name-title {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 8px;
}

.config-name-inputs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.config-name-field {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.config-name-field label {
  font-size: 11px;
  color: #cbd5e1;
  font-weight: 600;
}

.config-name-field input {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 7px 10px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.config-name-field input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}


/* ==========================================================================
   Mobile Portrait Enhanced Fit (390px screens and phones)
   ========================================================================== */
@media (max-width: 640px) {
  #header-hud {
    height: 40px !important;
    padding: 2px 6px !important;
    gap: 4px !important;
    max-width: 100vw !important;
    overflow: hidden !important;
  }

  .hud-brand {
    padding: 2px 4px !important;
    gap: 3px !important;
  }

  .game-title {
    font-size: 10px !important;
    display: none !important; /* Hide long title to give maximum room on phones */
  }

  .hud-match-bar {
    gap: 3px !important;
    flex-shrink: 1 !important;
  }

  .player-card {
    min-width: 58px !important;
    padding: 2px 4px !important;
    gap: 2px !important;
  }

  .player-name {
    font-size: 10px !important;
  }

  .status-badge {
    font-size: 9px !important;
    padding: 1px 4px !important;
  }

  /* Keep only 🔊 and ⚙️ on phone top bar, hide duplicate modal openers */
  #btn-fullscreen,
  #btn-theme,
  #btn-lang,
  #btn-championship,
  #btn-mobile {
    display: none !important;
  }

  .hud-actions {
    gap: 2px !important;
  }

  .icon-btn {
    width: 30px !important;
    height: 30px !important;
    font-size: 13px !important;
  }

  /* Mingo & Curva dock in mobile portrait */
  #mingo-dock {
    top: auto !important;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    right: 4px !important;
    left: auto !important;
    max-height: 240px !important;
    width: 68px !important;
    padding: 4px 2px !important;
    overflow-y: auto !important;
    z-index: 25 !important;
    background: rgba(10, 15, 26, 0.94) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8) !important;
  }

  #mingo-dock .cue-3d-box {
    display: none !important; /* Hide heavy 3D canvas in mini dock on phones */
  }

  #mingo-dock .mingo-pad {
    width: 52px !important;
    height: 52px !important;
  }

  #mingo-dock .mingo-quick-spins {
    display: none !important; /* Touch pad handles spin point */
  }

  #mingo-dock .cue-tilt-presets {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 2px !important;
  }

  #mingo-dock .btn-tilt-preset {
    font-size: 8px !important;
    padding: 2px 1px !important;
  }

  #mingo-dock .cue-curve-directions {
    display: none !important;
  }

  /* Power bar container mobile bottom fit */
  #power-bar-container {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    right: 76px !important;
    height: 180px !important;
    width: 32px !important;
  }

  #aim-wheel-container {
    left: 8px !important;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    width: 50px !important;
    height: 50px !important;
  }

  .pocketed-balls-tray {
    bottom: calc(6px + env(safe-area-inset-bottom, 0px)) !important;
    font-size: 9px !important;
    padding: 2px 8px !important;
  }
}


/* ==========================================================================
   STRICT MOBILE PORTRAIT HUD CONSTRAINT (Prevents 703px Horizontal Overflow)
   ========================================================================== */
@media (max-width: 768px) {
  html, body, #app-container {
    max-width: 100vw !important;
    width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  #header-hud {
    width: 100vw !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    height: 42px !important;
    padding: 2px 8px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 4px !important;
  }

  /* Hide long brand title on phones */
  .hud-brand {
    padding: 2px 4px !important;
    gap: 2px !important;
    min-width: 0 !important;
    flex-shrink: 0 !important;
  }
  .hud-brand .brand-text-col,
  .hud-brand .game-title,
  .hud-brand .game-subtitle {
    display: none !important;
  }

  .hud-match-bar {
    gap: 4px !important;
    flex: 1 !important;
    justify-content: center !important;
    min-width: 0 !important;
    max-width: calc(100vw - 120px) !important;
  }

  .player-card {
    min-width: 0 !important;
    max-width: 76px !important;
    padding: 2px 4px !important;
    gap: 3px !important;
    flex-shrink: 1 !important;
    border-radius: 6px !important;
  }

  .player-card .avatar-badge {
    width: 18px !important;
    height: 18px !important;
    font-size: 10px !important;
  }

  .player-card .player-name {
    font-size: 10px !important;
    max-width: 44px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .player-card .btn-edit-name,
  .player-card .player-turn-tag,
  .player-card .player-group-badge,
  .player-card .remaining-balls {
    display: none !important;
  }

  #center-hud {
    min-width: 0 !important;
    flex-shrink: 0 !important;
    gap: 0 !important;
  }

  .status-badge {
    font-size: 9px !important;
    padding: 1px 5px !important;
    white-space: nowrap !important;
  }

  /* Actions: Hide redundant buttons on phones */
  .hud-actions {
    gap: 3px !important;
    flex-shrink: 0 !important;
    padding-right: 4px !important;
  }

  #btn-fullscreen,
  #btn-theme,
  #btn-lang,
  #btn-championship,
  #btn-mobile {
    display: none !important;
  }

  .hud-actions .icon-btn {
    width: 28px !important;
    height: 28px !important;
    font-size: 12px !important;
  }
}


/* ==========================================================================
   FS-MINI-BAR MOBILE RESTRAINTS (Prevents 788px Horizontal Overflow)
   ========================================================================== */
@media (max-width: 768px) {
  #app-container, body, html {
    max-width: 100vw !important;
    width: 100vw !important;
    overflow-x: hidden !important;
  }

  #app-container.fullscreen-mode .fs-mini-bar,
  .fs-mini-bar {
    max-width: calc(100vw - 110px) !important;
    left: 8px !important;
    top: 6px !important;
    transform: none !important;
    gap: 4px !important;
    padding: 2px 6px !important;
    overflow: hidden !important;
    height: 30px !important;
    box-sizing: border-box !important;
  }

  #app-container.fullscreen-mode .fs-mini-bar .fs-brand,
  #app-container.fullscreen-mode .fs-mini-bar .fs-balls-indicator,
  #app-container.fullscreen-mode .fs-mini-bar #btn-fs-mobile,
  #app-container.fullscreen-mode .fs-mini-bar #btn-fs-lang,
  #app-container.fullscreen-mode .fs-mini-bar #btn-fs-champ,
  #app-container.fullscreen-mode .fs-mini-bar #btn-fs-exit,
  .fs-brand,
  .fs-balls-indicator,
  #btn-fs-mobile,
  #btn-fs-lang,
  #btn-fs-champ,
  #btn-fs-exit {
    display: none !important;
  }

  .fs-player {
    font-size: 10px !important;
    max-width: 44px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .fs-status-pill {
    font-size: 9px !important;
    padding: 1px 6px !important;
  }

  .btn-fs-action {
    width: 24px !important;
    height: 24px !important;
    font-size: 11px !important;
  }
}
