:root {
  --red: #d7263d;
  --white: #ffffff;
  --black: #1f1f1f;
  --bg: #0f172a;
  --panel: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #22c55e;
  --overlay: rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, #0b1022, #0f172a);
  color: var(--text);
}

/* BASIC APP LAYOUT */

.app { max-width: 1000px; margin: 0 auto; padding: 24px; }
header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
h1 { margin: 0; font-size: 28px; }
.status-bar { display: flex; gap: 16px; font-weight: 600; }
.wind-strip { display: flex; gap: 8px; margin-top: 10px; }
.chip { background: #1f2937; color: var(--text); padding: 6px 10px; border-radius: 999px; font-size: 12px; }
.chip.current { background: #22c55e; color: #052e14; }

/* SCOREBOARD */

.scoreboard {
  background: var(--panel);
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}
.scoreboard h2 { margin-top: 0; font-size: 20px; }
.scoreboard table { width: 100%; border-collapse: collapse; }
.scoreboard th, .scoreboard td { text-align: center; padding: 10px; }
.scoreboard thead th { color: var(--muted); font-weight: 600; }
.scoreboard tbody td:first-child { text-align: left; font-weight: 700; }
.scoreboard tbody td { border-top: 1px solid #1f2937; }

/* DICE AREA – DESKTOP BASELINE */

.dice-area { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.team-block { background: var(--panel); padding: 16px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.25); }
.team-block h3 { margin-top: 0; font-size: 18px; color: var(--muted); }
.dice-pair { display: flex; align-items: center; gap: 20px; flex-wrap: nowrap; justify-content: flex-start; }
.dice-row, .dice-pair { perspective: 900px; }
.rule-reminder { margin-bottom: 10px; font-size: 14px; color: var(--muted); }

/* Single-line centered rule reminder under dice */
.rule-reminder { margin-bottom: 0; margin-top: 10px; text-align: center; white-space: nowrap; }

/* 3D DIE CUBE BASE (used for old 3D view – still fine to keep) */

.dice { display: block; position: relative; }
.die-cube {
  position: absolute; inset: 0;
  transform-style: preserve-3d; will-change: transform; transform-origin: 50% 50%;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) rotateZ(var(--rz, 0deg));
}
.die-cube::before {
  content: '';
  position: absolute; inset: -2px; border-radius: 16px;
  pointer-events: none;
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.06),
    inset 0 0 24px rgba(255,255,255,0.06),
    inset 0 0 28px rgba(0,0,0,0.18);
}
.face {
  position: absolute; inset: 0; border-radius: 14px;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  box-shadow: 0 18px 32px rgba(0,0,0,0.45), inset 0 6px 12px rgba(255,255,255,0.08), inset 0 -6px 12px rgba(0,0,0,0.25);
}
.face::before {
  content: '';
  position: absolute; inset: 0; border-radius: 14px;
  pointer-events: none;
  box-shadow: inset 2px 2px 4px rgba(255,255,255,0.10), inset -2px -2px 5px rgba(0,0,0,0.18);
}
.dice.red .face {
  background: linear-gradient(145deg, #b41f32, #e0344a);
  border: 1px solid rgba(255,255,255,0.08);
}
.dice.white .face {
  background: linear-gradient(145deg, #f4f4f4, #dcdcdc);
  border: 1px solid rgba(0,0,0,0.08);
}
.dice.red {
  background: linear-gradient(145deg, #b41f32, #e0344a);
  border: 1px solid rgba(255,255,255,0.08);
}
.dice.white {
  background: linear-gradient(145deg, #f4f4f4, #dcdcdc);
  border: 1px solid rgba(0,0,0,0.08);
}
.dice::before {
  content: '';
  position: absolute; inset: 0; border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05), inset 12px 12px 24px rgba(0,0,0,0.15), inset -12px -12px 24px rgba(255,255,255,0.06);
  pointer-events: none;
}

.pip { width: 18px; height: 18px; border-radius: 50%; margin: auto; visibility: hidden; }
.dice.red .pip { background: var(--white); }
.dice.white .pip { background: var(--black); }
/* Blank dice state: show cube but hide pips */
.dice.blank .pip { visibility: hidden !important; }

/* Composite 3D roll animation (spin → tumble → bounce) */
.dice.rolling .die-cube {
  animation: rollComposite 1.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  filter: saturate(1.05) contrast(1.05);
}
.dice .die-cube.settling {
  animation: settleZ 260ms ease-out;
}
@keyframes rollComposite {
  0% {
    transform: translate3d(0, 0, 0) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }
  20% {
    transform: translate3d(0, 0, 0)
      rotateX(0deg) rotateY(0deg)
      rotateZ(calc(var(--spinDir, 1) * 360deg));
  }
  40% {
    transform: translate3d(0, 0, 0)
      rotateX(calc(var(--dirX, 1) * 60deg))
      rotateY(calc(var(--dirY, 1) * 40deg))
      rotateZ(calc(var(--spinDir, 1) * 720deg));
  }
  70% {
    transform: translate3d(0, calc(var(--bounce, 1) * 6px), 0)
      rotateX(calc(var(--dirX, 1) * 200deg))
      rotateY(calc(var(--dirY, 1) * 180deg))
      rotateZ(calc(var(--spinDir, 1) * 1080deg));
  }
  85% {
    transform: translate3d(0, calc(var(--bounce, 1) * -3px), 0)
      rotateX(calc(var(--dirX, 1) * 260deg))
      rotateY(calc(var(--dirY, 1) * 230deg))
      rotateZ(calc(var(--spinDir, 1) * 1200deg));
  }
  100% {
    transform: translate3d(0, 0, 0) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }
}

@keyframes settleZ {
  0%   { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) rotateZ(var(--rzOvershoot, 0deg)); }
  100% { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) rotateZ(var(--rz, 0deg)); }
}

/* 3D cube faces positions (96px cube => 48px half-depth) */
.face-1 { transform: translateZ(48px); }
.face-6 { transform: rotateY(180deg) translateZ(48px); }
.face-3 { transform: rotateY(-90deg) translateZ(48px); }
.face-4 { transform: rotateY(90deg) translateZ(48px); }
.face-2 { transform: rotateX(90deg) translateZ(48px); }
.face-5 { transform: rotateX(-90deg) translateZ(48px); }

.pos1 { grid-area: 1 / 1; }
.pos2 { grid-area: 1 / 2; }
.pos3 { grid-area: 1 / 3; }
.pos4 { grid-area: 2 / 1; }
.pos5 { grid-area: 2 / 2; }
.pos6 { grid-area: 2 / 3; }
.pos7 { grid-area: 3 / 1; }
.pos8 { grid-area: 3 / 2; }
.pos9 { grid-area: 3 / 3; }

/* Ensure container is transparent; only faces provide color and shading */
.dice { background: transparent; border: none; width: 96px; height: 96px; border-radius: 14px; position: relative; }
.dice.red, .dice.white { background: transparent !important; border: none !important; }
.dice::before { display: none; }
/* Hide backfaces to avoid board-like flipping visuals */
.face { backface-visibility: hidden; }

/* Hide die labels entirely (remove G/B markers near dice) */
.dice.red::before, .dice.white::before { display: none !important; content: '' !important; }

/* Wind tile styled like a die */
.wind-die {
  width: 96px; height: 96px; border-radius: 14px;
  display: none;
  place-items: center; font-size: 56px;
  background: #ffffff; color: #0b0b0b;
  box-shadow: 0 10px 25px rgba(0,0,0,0.35);
  flex-shrink: 0;
}
.wind-die.visible { display: grid; }
.wind-die.against { opacity: 0.35; }
.wind-die.with { opacity: 1; }

/* CONTROLS */

.controls { display: flex; gap: 12px; margin-top: 16px; }
button { cursor: pointer; border: 0; padding: 10px 16px; border-radius: 10px; font-size: 16px; font-weight: 700; }
#roll-btn { background: var(--accent); color: #052e14; }
button.secondary { background: #334155; color: var(--text); }

/* Center controls stack: Next Quarter beneath Roll */
.center-controls { display: flex; flex-direction: column; gap: 12px; align-items: center; }
#next-quarter-btn { background: var(--accent); color: #052e14; }
button:disabled { opacity: 0.6; cursor: not-allowed; }
button.accent { background: var(--accent); color: #052e14; }
button.small { font-size: 14px; padding: 8px 12px; }

.message { margin-top: 12px; min-height: 24px; }
#message { font-weight: 700; }

/* HISTORY PANEL */

.history { background: var(--panel); padding: 16px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.25); margin-top: 16px; }
.history h2 { margin-top: 0; font-size: 20px; }
.history-list { list-style: none; padding: 0; margin: 0; }
.history-list li { padding: 8px 0; border-top: 1px solid #1f2937; font-size: 14px; color: var(--muted); }

/* NEW LAYOUT: single row dice + centered roll button */

.dice.red .pip { background: var(--black) !important; }
.dice-area { display: block; margin-top: 16px; }
.dice-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; }
.pair-block { background: var(--panel); padding: 16px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.25); }
.pair-block h3 { margin-top: 0; font-size: 18px; color: var(--muted); }
.center-controls { display: flex; align-items: center; justify-content: center; }
.dice-row .center-controls { justify-self: center; align-self: center; text-align: center; }
.dice-pair { gap: 20px; }
.pair-block { min-width: 420px; }
.center-controls #roll-btn { min-width: 110px; }
.center-controls #roll-btn,
.center-controls #next-quarter-btn {
  width: 160px;
}

/* TEAM ENTRY */

.teams { background: var(--panel); padding: 12px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.25); margin-bottom: 16px; }
.team-inputs { display: flex; gap: 12px; }
.team-inputs label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.team-inputs input { background: #0b1220; border: 1px solid #334155; color: var(--text); padding: 6px 10px; border-radius: 8px; }

/* WELCOME SCREEN */

.welcome-overlay { position: static; min-height: 100vh; display: grid; place-items: center; background: transparent; }
.welcome-card { background: var(--panel); padding: 24px; border-radius: 14px; width: 520px; max-width: 92vw; text-align: center; box-shadow: 0 20px 40px rgba(0,0,0,0.35); }
.welcome-logo { width: 220px; height: auto; margin: 8px auto 6px; display: block; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.35)); }
.welcome-title { margin: 8px 0 14px; font-size: 26px; }
.welcome-actions { display: flex; gap: 12px; justify-content: center; }
.welcome-actions .primary { background: var(--accent); color: #052e14; }
.welcome-actions .secondary { background: #334155; color: var(--text); }

/* TEAM SELECTION SCREEN */

.team-select-screen { min-height: 100vh; display: grid; place-items: center; }
.team-card { background: var(--panel); padding: 24px; border-radius: 14px; width: 520px; max-width: 92vw; text-align: center; box-shadow: 0 20px 40px rgba(0,0,0,0.35); }
.team-title { margin: 8px 0 14px; font-size: 26px; }
.team-select-row { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 12px 0; }
.team-label { font-weight: 700; color: var(--muted); text-align: left; }
.team-select { background: #0b1220; border: 1px solid #334155; color: var(--text); padding: 10px; border-radius: 8px; font-size: 16px; }
.team-actions { display: flex; justify-content: center; margin-top: 12px; }
.team-actions .primary { background: var(--accent); color: #052e14; }

/* SEASON DASHBOARD */

.dashboard { min-height: 100vh; display: grid; place-items: start center; padding: 24px; }
.dashboard-inner { width: 100%; max-width: 1000px; }
.dashboard-title { margin: 8px 0 14px; font-size: 28px; }
.dash-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-panel { background: var(--panel); padding: 16px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.25); }
.dash-panel h2 { margin-top: 0; font-size: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dashboard-actions { display: flex; justify-content: flex-end; gap: 12px; margin-bottom: 8px; }
.dashboard-actions .small { font-size: 8.5pt; padding: 8px 12px; }

/* LADDER TABLE */

.ladder-table { width: 100%; border-collapse: collapse; }
.ladder-table th, .ladder-table td { text-align: center; padding: 8px; }
.ladder-table thead th { color: var(--muted); font-weight: 600; }
.ladder-table tbody td:first-child { text-align: center; }
.ladder-table tbody td:nth-child(2) { text-align: left; font-weight: 700; }
.ladder-table tbody tr { border-top: 1px solid #1f2937; }

/* Bold separator after 5th team to show finals cutoff */
.ladder-table tbody tr.ladder-cutoff td { border-bottom: 3px solid #1f2937; }

/* FIXTURE LIST */

.fixture-list { list-style: none; padding: 0; margin: 0; }
.fixture-list li { padding: 8px 0; border-top: 1px solid #1f2937; font-size: 14px; color: var(--text); }
.fixture-actions { margin-top: 10px; display: flex; justify-content: flex-end; }
.fixture-actions .small { font-size: 14px; padding: 8px 12px; }
.fixture-list li.fixture-round { border-top: none; color: var(--muted); font-weight: 700; margin-top: 6px; }

/* Wind emoji styling */
.wind-emoji { font-size: 28px; display: inline-block; vertical-align: middle; margin-left: 8px; }

/* COIN FLIP */

.coin {
  width: 88px; height: 88px; margin: 10px auto;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffd56b, #c9a235);
  box-shadow: 0 14px 28px rgba(0,0,0,0.35), inset 0 8px 16px rgba(255,255,255,0.35), inset 0 -8px 16px rgba(0,0,0,0.25);
  position: relative;
  transform-style: preserve-3d; will-change: transform;
}
.coin-face {
  position: absolute; inset: 0; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #3b2f04;
  backface-visibility: hidden;
}
.coin-face.heads { content: 'H'; }
.coin-face.tails { transform: rotateY(180deg); }
.coin.flipping { animation: coinFlip 900ms cubic-bezier(0.25, 0.8, 0.25, 1); }
@keyframes coinFlip {
  0%   { transform: rotateY(0deg); }
  25%  { transform: rotateY(180deg); }
  50%  { transform: rotateY(360deg); }
  75%  { transform: rotateY(540deg); }
  100% { transform: rotateY(720deg); }
}
.coin.show-heads { transform: rotateY(0deg); }
.coin.show-tails { transform: rotateY(180deg); }

/* MODALS */

.modal { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 1000; }
.modal-content { position: relative; background: var(--panel); padding: 16px; border-radius: 12px; width: 820px; max-width: 95vw; max-height: 85vh; overflow: auto; box-shadow: 0 20px 40px rgba(0,0,0,0.35); }
.modal-close { position: absolute; top: 8px; right: 8px; background: #334155; color: var(--text); border: 0; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-weight: 700; }

#history-modal .modal-content { width: 1000px; }
.history-actions { display: flex; gap: 12px; margin-bottom: 8px; }

/* League History modal layout */
#league-history-modal .modal-content { width: 1000px; }

/* Head-to-Head needs extra width for columns */
#headtohead-modal .modal-content { width: 1100px; }

/* Simple grid for the premiers timeline */
.timeline-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.timeline-grid .tile { background: var(--panel); border-radius: 8px; padding: 8px; display:flex; flex-direction:column; align-items:center; text-align:center; }
.timeline-grid .tile img { width: 100px; height: auto; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)); }
.timeline-grid .tile .year { font-weight: 600; margin-bottom: 6px; }
.timeline-grid .tile .team { font-size: 0.9rem; opacity: 0.85; }

.panel-head label { white-space: nowrap; }

/* League history grid in modal */

.league-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.league-grid section { background: rgba(31,41,55,0.35); border: 1px solid #1f2937; border-radius: 12px; padding: 12px; min-width: 0; }
.league-grid h3 { margin: 0 0 8px; }
.league-grid h4 { margin: 8px 0 4px; font-weight: 600; }

#league-history-modal #alltime-ladder-section { grid-column: 1 / -1; }

/* All-Time Ladder table */

#alltime-ladder-table { width: 100%; border-collapse: collapse; font-size: 14px; }
#alltime-ladder-table thead th { position: sticky; top: 0; background: #111827; color: #e5e7eb; text-align: left; padding: 8px; border-bottom: 1px solid #374151; }
#alltime-ladder-table tbody td { padding: 6px 8px; border-bottom: 1px solid #1f2937; }
#alltime-ladder-table tbody tr:nth-child(even) { background: rgba(17,24,39,0.35); }
#alltime-ladder-table tbody tr:hover { background: rgba(55,65,81,0.35); }
#alltime-ladder-table td:nth-child(2),
#alltime-ladder-table td:nth-child(3),
#alltime-ladder-table td:nth-child(4),
#alltime-ladder-table td:nth-child(5),
#alltime-ladder-table td:nth-child(6),
#alltime-ladder-table td:nth-child(7),
#alltime-ladder-table td:nth-child(8),
#alltime-ladder-table td:nth-child(9),
#alltime-ladder-table td:nth-child(10),
#alltime-ladder-table td:nth-child(11) { text-align: right; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 4px 0; border-bottom: 1px dashed #1f2937; }
.list li:last-child { border-bottom: 0; }
.stat { padding: 8px; background: rgba(2,6,23,0.35); border: 1px solid #1f2937; border-radius: 8px; }
.stat .sub { font-size: 0.9em; color: #9CA3AF; margin-top: 4px; }

/* Z-INDEX LAYERS FOR VARIOUS MODALS */

#toss-modal { z-index: 1100; }
#round-result-modal { z-index: 1200; }
#round-result-list { max-height: 60vh; overflow: auto; }
#premiers-modal { z-index: 1300; }
#premiers-modal .modal-content { width: 640px; }
.premiers-card { text-align: center; }
.premiers-subtitle { margin-top: 4px; color: var(--muted); font-weight: 600; font-size: calc(1em + 6pt); }
.premiers-cup { width: 260px; max-width: 92%; height: auto; margin: 12px auto 6px; display: block; filter: drop-shadow(0 10px 20px rgba(0,0,0,0.45)); }

/* Season and edition badges */

.season-badge { font-size: 14px; margin-left: 12px; padding: 4px 8px; background: #0b1220; border: 1px solid #1f2937; border-radius: 8px; color: var(--muted); vertical-align: middle; }
.edition-badge { font-size: 12px; margin-left: 8px; padding: 3px 6px; background: #0b1220; border: 1px solid #1f2937; border-radius: 8px; color: var(--muted); vertical-align: middle; }

/* Next Season modal */

#season-next-modal { z-index: 1250; }
#season-next-modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }

/* Match window app wrapper */

.app.modal-app { position: fixed; z-index: 1001; top: 5%; left: 50%; transform: translateX(-50%); width: 100%; max-width: 1000px; background: var(--panel); border: 1px solid var(--border, #1f2937); border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,0.5); max-height: 90vh; overflow: auto; }
#match-close { position: fixed; z-index: 1002; top: 12px; right: 12px; }

body.modal-open { overflow: hidden; }

/* TEAM HISTORY MODAL */

#team-history-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
#team-history-buttons button {
  padding: 8px 10px;
  text-align: center;
}
#team-history-modal .modal-content {
  max-width: 900px;
}
#team-vs-table {
  width: 100%;
  border-collapse: collapse;
}
#team-vs-table th,
#team-vs-table td {
  border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 8px;
  text-align: left;
  color: #ffffff;
}
#team-vs-table thead th {
  background: #1e3a8a;
  position: sticky;
  top: 0;
  z-index: 1;
}
#team-vs-table tbody tr {
  background: #1e40af;
}

/* SAVE / LOAD SLOTS */

#slots-modal .modal-content { width: 680px; }
.slots-list { display: grid; gap: 10px; margin-top: 10px; }
.slot-item { display: flex; align-items: center; justify-content: space-between; background: #0b1220; border: 1px solid #1f2937; padding: 10px; border-radius: 10px; }
.slot-meta { color: var(--text); font-size: 13px; }
.slot-actions { display: flex; gap: 8px; }

/* ------------------------------ */
/* GLOBAL SMALL TWEAKS           */
/* ------------------------------ */

body {
  overflow-x: hidden; /* stop sideways scroll on phones */
}

/* --------------------------------------------- */
/* MATCH SCREEN – iPHONE LANDSCAPE SHRINK PASS  */
/* --------------------------------------------- */

@media (max-width: 900px) and (orientation: landscape) {

  /* Keep scoreboard as-is; just tighten the match panels */

  .dice-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }

  .pair-block {
    padding: 8px;
    min-width: 0;
  }

  .dice-pair {
    gap: 10px;
  }

  /* Smaller dice / dice images on grass */
  .dice,
  .dice-img,
  .dice-image,
  .dice-container img {
    width: 64px;
    height: 64px;
    max-width: 64px;
  }

  /* More compact Roll / Next Quarter buttons */
  .center-controls #roll-btn,
  .center-controls #next-quarter-btn {
    width: 140px;
    padding: 6px 12px;
    font-size: 14px;
  }
}
/* MOBILE LANDSCAPE – shrink match cards + buttons so they don't cover each other */
@media (max-width: 900px) and (orientation: landscape) {

  /* keep the 3-column layout but tighten gaps */
  .dice-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 6px;
  }

  /* make each grass/dice card smaller and allow it to shrink */
  .pair-block {
    width: 100%;
    max-width: 240px;   /* was effectively much larger */
    min-width: 0;       /* override the desktop min-width */
    padding: 6px 8px;   /* less padding = less overall height */
  }

  /* clamp the grass image height so the panel isn't huge */
  .pair-block img {
    width: 100%;
    height: auto;
    max-height: 110px;
    object-fit: cover;
    display: block;
  }

  /* slightly smaller Roll / Next Quarter buttons */
  .center-controls {
    gap: 6px;
  }

  .center-controls #roll-btn,
  .center-controls #next-quarter-btn {
    width: 120px;
    font-size: 14px;
    padding: 0.45rem 0.6rem;
  }
}
/* =========================================================
   MOBILE MATCH OVERHAUL – stack dice cards & shrink them
   (desktop layout is unchanged)
   ========================================================= */
@media (max-width: 900px) {

  /* Stack: Home card -> buttons -> Away card */
  .dice-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
  }

  /* Make each grass/dice card smaller and centred */
  .pair-block {
    width: 100% !important;
    max-width: 420px !important;   /* tighten overall size on phone */
    min-width: 0 !important;
    padding: 8px 10px !important;
    margin: 0 auto !important;
  }

  /* Clamp grass image height so the panel isn’t huge */
  .pair-block img {
    width: 100% !important;
    height: auto !important;
    max-height: 120px !important;
    object-fit: cover;
    display: block;
  }

  /* Slightly smaller “G / B / W” headings on mobile */
  .pair-block h3,
  .pair-block .dice-label,
  .pair-block .dice-heading {
    font-size: 14px !important;
  }

  /* Keep dice tiles from ballooning on small screens */
  .pair-block .dice-pair > * {
    max-width: 80px;
    max-height: 80px;
  }

  /* Buttons: always clearly visible between the two cards */
  .center-controls {
    order: 2;                      /* sits between home & away */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 4px 0 0;
  }

  .center-controls #roll-btn,
  .center-controls #next-quarter-btn {
    width: 150px;
    font-size: 14px;
    padding: 8px 10px;
  }
}
