:root {
  --bg: #0c1017;
  --panel: #151b26;
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #eef2f7;
  --muted: #8b98ab;
  --accent: #eab308;
  --accent-glow: rgba(234, 179, 8, 0.35);
  --green: #22c55e;
  --danger: #ef4444;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #162030 0%, #090c12 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  padding: 10px 16px;
  gap: 8px;
}

/* Buttons */
.btn-row {
  display: flex;
  gap: 6px;
}

.btn {
  background: #1e2736;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}

.btn:hover {
  background: #283447;
  border-color: rgba(255, 255, 255, 0.25);
}

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

.btn-accent {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #111827;
  border-color: #fde047;
}

.btn-accent:hover {
  background: linear-gradient(135deg, #facc15, #eab308);
}

.btn-xs {
  padding: 3px 7px;
  font-size: 11px;
}

.btn-lg {
  padding: 10px 24px;
  font-size: 15px;
  border-radius: 10px;
}

.btn-with-pad {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-with-pad .pad-key {
  padding: 1px 6px;
  font-size: 10px;
}

.btn-gamepad.connected {
  border-color: rgba(74, 222, 128, 0.75);
  background: rgba(34, 197, 94, 0.2);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
}

/* Xbox Controls Quick Modal */
.gamepad-modal-card {
  width: min(1040px, 96vw);
  max-width: 96vw;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 22px 26px 18px;
  gap: 14px;
  align-items: stretch;
  text-align: left;
  background: linear-gradient(160deg, #18212c 0%, #111923 72%, #0d151e 100%);
  border-color: rgba(159, 180, 168, 0.35);
}
#gamepad-modal .gamepad-modal-card {
  width: min(1040px, 96vw);
  max-width: 96vw;
}

.pad-guide-heading {
  text-align: center;
}
.pad-guide-heading .win-eyebrow {
  color: #d8e2dc;
  background: rgba(150, 178, 163, 0.1);
  border-color: rgba(159, 180, 168, 0.25);
}
.pad-guide-heading h2 {
  margin: 8px 0 4px;
  color: #edf0ea;
  font-size: 23px;
}
.pad-guide-heading p {
  color: #b4c0ca;
  font-size: 13px;
  line-height: 1.5;
}

.pad-guide-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.95fr) minmax(390px, 1.05fr);
  align-items: start;
  gap: 20px;
}
.pad-illustration {
  min-width: 0;
  padding: 12px 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: radial-gradient(ellipse at 50% 42%, rgba(74, 97, 112, 0.2), rgba(14, 21, 29, 0.7) 72%);
}
.xbox-controller {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.pad-svg-label {
  fill: #dce3e6;
  font: 800 10px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.8px;
  text-anchor: middle;
}
.pad-svg-button {
  fill: #f2f4f5;
  font: 900 11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-anchor: middle;
}
.pad-svg-face-key {
  fill: #fff;
  font: 900 16px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-anchor: middle;
}
.pad-svg-caption {
  fill: #aab7c0;
  font: 700 9px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 1.1px;
  text-anchor: middle;
}
.pad-diagram-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  color: #b4c0ca;
  font-size: 11px;
}
.pad-diagram-key span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pad-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.pad-dot-move { background: #8db5a1; }
.pad-dot-action { background: #b9b69a; }

.pad-guide-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 9px;
}
.pad-guide-section {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}
.pad-guide-section h3 {
  margin: 0 0 7px;
  color: #d4dccf;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pad-guide-row {
  display: grid;
  grid-template-columns: minmax(90px, auto) 1fr;
  align-items: start;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.045);
  color: #d1d8dd;
  font-size: 11px;
  line-height: 1.38;
}
.pad-guide-row:first-of-type {
  border-top: 0;
}
.pad-guide-row .pad-key {
  justify-self: start;
  padding: 3px 7px;
  font-size: 10px;
  background: #34414e;
  border-color: rgba(202, 215, 221, 0.25);
  color: #eef2f3;
}
.pad-guide-row .pad-key.key-a { background: #477d5a; border-color: #83b691; color: #f3fbf3; }
.pad-guide-row .pad-key.key-b { background: #86494e; border-color: #c18588; color: #fff4f4; }
.pad-guide-row .pad-key.key-x { background: #416b91; border-color: #82a9cb; color: #f4f9ff; }
.pad-guide-row .pad-key.key-y { background: #817648; border-color: #b2a86e; color: #fffdf2; }
.pad-guide-row .pad-key.key-bumper { background: #394550; border-color: #82909b; color: #e5e9e7; }
.gamepad-modal-card > #btn-close-gamepad {
  align-self: center;
}

@media (max-width: 820px) {
  .pad-guide-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .pad-illustration {
    width: min(560px, 100%);
    justify-self: center;
  }
}
@media (max-width: 520px) {
  .gamepad-modal-card {
    width: 96vw;
    padding: 16px 12px 14px;
  }
  .pad-guide-heading h2 {
    font-size: 20px;
  }
  .pad-guide-heading p {
    font-size: 12px;
  }
  .pad-guide-legend {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }
  .pad-guide-row {
    grid-template-columns: minmax(98px, auto) 1fr;
    gap: 6px;
  }
  .pad-guide-row .pad-key {
    white-space: normal;
  }
}

.pad-grid {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 4px 0 8px;
}

.pad-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 13px;
  color: #e2e8f0;
}

.pad-key {
  font-size: 11px;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: 7px;
  background: #273245;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f8fafc;
  white-space: nowrap;
}

.pad-key.key-a { background: #16a34a; border-color: #86efac; color: #052e16; }
.pad-key.key-b { background: #dc2626; border-color: #fca5a5; color: #ffffff; }
.pad-key.key-x { background: #2563eb; border-color: #93c5fd; color: #ffffff; }
.pad-key.key-y { background: #eab308; border-color: #fef08a; color: #111827; }
.pad-key.key-bumper { background: #334155; border-color: #94a3b8; color: #fef08a; }

/* Pause & Settings Modal (Gamepad-Navigable) */
.pause-modal-card {
  width: 470px;
  max-width: 94vw;
  padding: 24px 28px 20px;
}

.pause-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 8px;
}

.pause-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}

.pause-item:hover,
.pause-item.focused {
  background: rgba(234, 179, 8, 0.14);
  border-color: rgba(250, 204, 21, 0.8);
  box-shadow: 0 0 16px rgba(234, 179, 8, 0.2);
  transform: translateX(2px);
}

.pause-item.pause-danger:hover,
.pause-item.pause-danger.focused {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(248, 113, 113, 0.85);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.22);
}

.pause-value {
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.pause-value.on {
  background: rgba(34, 197, 94, 0.22);
  color: #86efac;
}

.pause-felt-item {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.pause-felt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pause-felt-name {
  font-size: 12px;
  font-weight: 800;
  color: #fde047;
}

.felt-swatches {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 7px;
}

/* Mini table: felt centre, wood frame (border-box), metal line between */
.felt-swatch {
  height: 30px;
  min-width: 0;
  padding: 0;
  border-radius: 7px;
  border: 5px solid transparent;
  box-shadow: inset 0 0 0 1.5px var(--swatch-metal, #d4a84f), 0 2px 6px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, outline-color 0.15s;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.felt-swatch:hover {
  transform: scale(1.08);
}

.felt-swatch.selected {
  outline-color: #fde047;
  box-shadow: inset 0 0 0 1.5px var(--swatch-metal, #d4a84f), 0 0 12px rgba(250, 204, 21, 0.45), 0 4px 10px rgba(0, 0, 0, 0.5);
  transform: scale(1.1);
}

.pause-footer-hint {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2px;
}

.pause-footer-hint .pad-key {
  padding: 1px 6px;
  font-size: 10px;
}

/* Table Stage */
.table-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#pool-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
  touch-action: none;
  cursor: crosshair;
}

/* Toast Banner */
.toast {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(234, 179, 8, 0.55);
  color: #fef08a;
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

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

.toast.foul {
  border-color: rgba(239, 68, 68, 0.75);
  color: #fca5a5;
}

/* Modals */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 14, 0.78);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  border-radius: 20px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: #151c28;
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-radius: 20px;
  padding: 28px 36px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 520px;
}

.modal-trophy {
  font-size: 46px;
  line-height: 1;
}

.modal-card h2 {
  font-size: 24px;
  color: #fef08a;
}

.modal-card p {
  color: var(--muted);
  font-size: 14px;
}

/* Championship Victory Modal */
.win-modal-card {
  width: 560px;
  max-width: 94vw;
  padding: 28px 34px 26px;
  background: radial-gradient(circle at 50% 0%, #242f44 0%, #121824 62%, #0c1018 100%);
  border: 1.5px solid rgba(234, 179, 8, 0.6);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.88), 0 0 50px rgba(234, 179, 8, 0.22);
  gap: 10px;
  animation: winCardReveal 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes winCardReveal {
  0% { opacity: 0; transform: scale(0.84) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.win-eyebrow {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 2.8px;
  text-transform: uppercase;
  color: #fde047;
  background: rgba(234, 179, 8, 0.14);
  border: 1px solid rgba(234, 179, 8, 0.35);
  padding: 3px 14px;
  border-radius: 999px;
}

.win-crest {
  position: relative;
  width: 78px;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px 0;
}

.win-crest-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.45) 0%, rgba(234, 179, 8, 0) 70%);
  animation: crestPulse 2.2s ease-in-out infinite;
}

@keyframes crestPulse {
  0%, 100% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.18); opacity: 1; }
}

.win-trophy-icon {
  position: relative;
  font-size: 52px;
  line-height: 1;
  filter: drop-shadow(0 6px 14px rgba(234, 179, 8, 0.55));
  animation: trophyFloat 2.4s ease-in-out infinite;
}

@keyframes trophyFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.win-headline {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.5px;
  background: linear-gradient(180deg, #ffffff 0%, #fef08a 55%, #eab308 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.win-sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.win-versus {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

.win-player-box {
  position: relative;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.win-player-box.champion {
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.16) 0%, rgba(234, 179, 8, 0.04) 100%);
  border-color: rgba(250, 204, 21, 0.65);
  box-shadow: 0 0 22px rgba(234, 179, 8, 0.18);
}

.win-champ-tag {
  position: absolute;
  top: -10px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #fde047, #ca8a04);
  color: #111827;
  padding: 2px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.win-player-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.win-player-score {
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
  color: #fef08a;
  font-variant-numeric: tabular-nums;
}

.win-player-score small {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.win-player-breakdown {
  display: flex;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.win-balls-mini {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-top: 2px;
}

.win-cta {
  padding: 11px 32px;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 24px rgba(234, 179, 8, 0.3);
}

.rules-card {
  text-align: left;
  align-items: flex-start;
}

.rules-card h2 {
  align-self: center;
}

.rules-card button {
  align-self: center;
  margin-top: 6px;
}

.rules-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #cbd5e1;
}

.rules-list ul {
  margin-top: 4px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---- Big-screen scaling (see src/ui/uiScale.js) ----
   `zoom` keeps layout and hit-testing consistent (unlike transform: scale).
   Viewport-relative limits are divided by the scale so zoomed panels still fit. */
.home-card,
.modal-card,
.name-kb-card,
.power-hud-overlay,
.spin-hud-overlay {
  zoom: var(--ui-scale, 1);
}
.home-card {
  max-width: calc(96vw / var(--ui-scale, 1));
  max-height: calc(94vh / var(--ui-scale, 1));
}
.hud-top,
.hud-bottom {
  zoom: var(--ui-scale, 1);
}

/* TV / console: focus must be obvious from across the room */
.tv-mode .focused {
  outline: 3px solid rgba(250, 204, 21, 0.9);
  outline-offset: 3px;
}
.tv-mode .home-pad-hint,
.tv-mode .pause-footer-hint {
  font-size: 14px;
}

/* =======================================================================
   MENU ROWS (home + pause) — big rows, clear gold focus for TV / Xbox
   ======================================================================= */
.menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
/* Tabs on top of a menu (Juego · Mesa), switched with LB / RB:
   a segmented control on a dark rail, the active tab in gold */
.menu-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 2px auto 6px;
  width: 100%;
}
.menu-tabs-rail {
  display: flex;
  flex: 1;
  max-width: 320px;
  padding: 4px;
  gap: 4px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.65);
  border: 1px solid rgba(251, 191, 36, 0.22);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 255, 255, 0.04);
}
.menu-tab {
  flex: 1;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #94a3b8;
  font: inherit;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.menu-tab:hover {
  color: #e2e8f0;
}
.menu-tab.active {
  color: #1c1405;
  background: linear-gradient(180deg, #fde68a 0%, #fbbf24 55%, #d97706 100%);
  box-shadow: 0 2px 10px rgba(251, 191, 36, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.menu-tab-icon {
  margin-right: 6px;
}
.menu-tab-key {
  flex: none;
  opacity: 0.85;
}
body.touch-device .menu-tab-key {
  display: none;
}
.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 8px 14px 8px 18px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.12s;
  -webkit-user-select: none;
  user-select: none;
}
.menu-row.hidden {
  display: none;
}
.menu-row:hover {
  background: rgba(255, 255, 255, 0.07);
}
.menu-row.focused {
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.1);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.18), 0 6px 18px rgba(0, 0, 0, 0.35);
}
.menu-label {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.menu-choice {
  display: flex;
  align-items: center;
  gap: 8px;
}
.menu-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 170px;
  font-size: 16px;
  font-weight: 700;
  color: #fde68a;
}
.menu-arrow {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(15, 23, 42, 0.6);
  color: #cbd5e1;
  font-size: 13px;
  cursor: pointer;
}
.menu-row.focused .menu-arrow {
  color: #fde047;
  border-color: rgba(250, 204, 21, 0.6);
}
.menu-mini-table.felt-swatch {
  width: 34px;
  height: 22px;
  border-width: 4px;
  border-radius: 5px;
  outline: none;
  transform: none;
  cursor: inherit;
}
/* Main action (Jugar) */
.menu-row.menu-primary {
  justify-content: center;
  min-height: 58px;
  margin-top: 6px;
  background: linear-gradient(180deg, #facc15, #ca8a04);
  border-color: #fde68a;
  color: #1c1917;
}
.menu-row.menu-primary .menu-label {
  font-size: 20px;
  font-weight: 900;
}
.menu-row.menu-primary.focused {
  box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.35), 0 8px 22px rgba(250, 204, 21, 0.35);
  transform: scale(1.01);
}
/* Actions that ask for a second press */
.menu-row.confirming {
  border-color: #f87171;
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
}
.menu-row.menu-danger .menu-label {
  color: #fca5a5;
}
.menu-row.menu-danger.confirming .menu-label {
  color: #fecaca;
}

/* Narrow screens (phones): rows must fit without cutting the ▶ arrow */
@media (max-width: 560px) {
  .home-card {
    padding: 18px 14px 16px;
    gap: 12px;
  }
  .home-title {
    font-size: 30px;
    white-space: nowrap;
  }
  .menu-row {
    min-height: 46px;
    padding: 6px 8px 6px 12px;
    gap: 6px;
  }
  .menu-label {
    font-size: 14px;
    white-space: nowrap;
  }
  .menu-choice {
    flex: 1;
    min-width: 0;
    justify-content: flex-end;
    gap: 4px;
  }
  .menu-value {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .menu-arrow {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
  }
  .menu-row.menu-primary .menu-label {
    font-size: 18px;
  }
}
@media (max-width: 400px) {
  .menu-mini-table {
    display: none !important;
  }
}

/* =======================================================================
   PHONES & TABLETS
   ======================================================================= */

/* Phone upright (narrow): controls wrap, compact names and bubbles */
@media (max-width: 560px) {
  .app {
    padding: 6px 8px;
    gap: 6px;
  }
  .player-name {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30vw;
  }
  .hud-bottom {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 8px 10px;
  }
  .hud-bottom .power-control {
    flex: 1 1 100%;
  }
  .banter-bubble {
    max-width: 72vw;
  }
  .banter-text {
    font-size: 14px !important;
    padding: 7px 11px !important;
  }
  .banter-avatar {
    width: 44px !important;
    height: 44px !important;
  }
}
/* Touch devices held upright (iPad / phone): ask to turn sideways */
.rotate-screen {
  display: none;
}
@media (orientation: portrait) {
  body.touch-device .rotate-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: radial-gradient(circle at 50% 40%, #1a2232, #0a0e15);
    color: #fde68a;
    text-align: center;
    padding: 24px;
  }
  body.touch-device .rotate-icon {
    font-size: 56px;
    animation: rotateHint 1.8s ease-in-out infinite;
  }
  body.touch-device .rotate-title {
    font-size: 22px;
    font-weight: 900;
  }
  body.touch-device .rotate-sub {
    font-size: 14px;
    color: #cbd5e1;
  }
}
@keyframes rotateHint {
  0%, 30% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}

/* Phone sideways (short screen): one compact strip on top, compact
   controls below, so the table gets almost all the height */
@media (max-height: 520px) and (orientation: landscape) {
  .app {
    padding: 4px 10px;
    gap: 4px;
  }
  .app .hud-top {
    grid-template-columns: 1fr minmax(220px, 280px) 1fr;
    zoom: 0.7;
  }
  .app .hud-top .center-scoreboard {
    grid-column: auto;
    order: 0;
    width: auto;
  }
  .hud-bottom {
    zoom: 0.72;
    padding: 4px 12px;
  }
  .banter-text {
    font-size: 14px !important;
    padding: 6px 10px !important;
  }
  .banter-avatar {
    width: 40px !important;
    height: 40px !important;
  }
}

/* Pause card wide enough for "Pantalla completa ◀ Desactivada ▶" */
.pause-modal-card {
  width: min(480px, 94vw);
}
.menu-label {
  white-space: nowrap;
}

/* A small portrait next to a menu value (Tu jugador, Compañero) */
.menu-mini-face {
  display: inline-block;
  width: 30px;
  height: 30px;
  margin-right: 8px;
  border-radius: 50%;
  border: 1.5px solid rgba(251, 191, 36, 0.55);
  background-color: #0f172a;
  vertical-align: middle;
  flex: none;
}
.menu-row[data-row="torneoEnCurso"] .menu-label {
  color: #7dd3fc;
}
