/* ===== AX LUDO EMPIRE — Royal Empire theme =====
   Dark ink board, gold filigree, jewel-tone seats. Everything here is drawn
   with CSS and inline SVG — no image files, so the whole game is three small
   text files and loads instantly on a phone. */

:root {
  --ink: #0a0d14;
  --ink-2: #0e131d;
  --panel: #121926;
  --panel-2: #182233;
  --line: #26324a;
  --line-soft: rgba(232,197,106,0.14);

  --text: #eef1f7;
  --muted: #8d99b0;

  --gold: #e8c56a;
  --gold-hi: #fff0c2;
  --gold-deep: #a8801f;
  --accent: #22d3ee;

  /* Jewel-tone seats — deeper than arcade primaries, so gold reads on top. */
  --red: #d8384a;        --red-dark: #86131f;
  --green: #2fa464;      --green-dark: #12603a;
  --yellow: #e0a72e;     --yellow-dark: #8c5f0d;
  --blue: #3a72d6;       --blue-dark: #17357e;

  --cell: #151d2c;
  --cell-2: #1b2436;

  --shadow-lg: 0 24px 60px rgba(0,0,0,0.55);
  --shadow-md: 0 10px 28px rgba(0,0,0,0.4);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 640px at 12% -12%, rgba(34,211,238,0.07), transparent 62%),
    radial-gradient(900px 560px at 100% 0%, rgba(232,197,106,0.08), transparent 58%),
    var(--ink);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
#app { min-height: 100vh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

/* ===================== HEADER ===================== */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: 0 1px 0 rgba(232,197,106,0.12), var(--shadow-md);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; }
.ax-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: linear-gradient(150deg, #1d2a44, #090d15);
  border: 1px solid rgba(232,197,106,0.45);
  font-family: 'Cinzel', Georgia, serif; font-weight: 900;
  font-size: 16px; letter-spacing: -0.5px; line-height: 1;
  box-shadow: 0 3px 10px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
}
.ax-mark b { color: var(--accent); }
.ax-mark i { color: var(--gold); font-style: normal; }
.brand-words { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name {
  font-family: 'Cinzel', Georgia, serif; font-weight: 900;
  font-size: 17px; letter-spacing: 1.4px;
  background: linear-gradient(135deg, var(--gold-deep), var(--gold-hi) 45%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: 9.5px; letter-spacing: 2.6px; color: var(--muted); font-weight: 700; text-transform: uppercase; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  background: var(--cell); border: 1px solid var(--line); color: var(--text);
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--gold); }
.icon-btn.muted { opacity: 0.45; }
.whoami {
  font-size: 11.5px; color: var(--muted); font-weight: 700;
  background: var(--cell); border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 999px; white-space: nowrap;
}

.status-banner {
  padding: 10px 16px; text-align: center; font-size: 12px; font-weight: 700;
  background: linear-gradient(90deg, rgba(216,56,74,0.16), rgba(216,56,74,0.05));
  color: #f4a2ac; border-bottom: 1px solid rgba(216,56,74,0.35);
}

/* ===================== LAYOUT ===================== */
.view {
  flex: 1; padding: 22px; display: flex; flex-direction: column; gap: 18px;
  max-width: 1060px; width: 100%; margin: 0 auto;
}
.view-game { max-width: 1180px; }

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-md);
  position: relative;
}
.panel::before {
  content: ''; position: absolute; inset: 0; border-radius: var(--radius);
  border: 1px solid var(--line-soft); pointer-events: none;
}
.panel h2 {
  margin: 0 0 16px; font-family: 'Cinzel', Georgia, serif;
  font-size: 17px; letter-spacing: 1px; color: var(--gold);
}

.field { margin-bottom: 16px; }
.field > label {
  display: block; font-size: 10.5px; font-weight: 800; letter-spacing: 1.6px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px;
}
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ===================== CONTROLS ===================== */
.btn {
  font: inherit; font-weight: 700; font-size: 13.5px;
  padding: 11px 20px; border-radius: 11px; cursor: pointer;
  border: 1px solid transparent; transition: transform .12s ease, filter .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #2b3f66, #1a2740);
  border-color: rgba(232,197,106,0.5); color: var(--gold-hi);
  box-shadow: 0 4px 14px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.09);
}
.btn-primary:hover { filter: brightness(1.15); }
.btn-gold {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: #241a04; border-color: rgba(0,0,0,0.3); font-weight: 800;
}
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--gold); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; filter: none; }

.input {
  font: inherit; font-weight: 700; letter-spacing: 1px;
  background: var(--ink-2); border: 1px solid var(--line); color: var(--text);
  padding: 11px 14px; border-radius: 11px; min-width: 0; flex: 1;
}
.input:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
.input::placeholder { color: #5c677d; letter-spacing: 1.5px; }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-btn {
  font: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
  background: var(--cell); border: 1px solid var(--line); color: var(--muted);
  padding: 10px 16px; border-radius: 11px; min-width: 54px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.seg-btn small { font-size: 9.5px; font-weight: 600; opacity: .8; letter-spacing: .2px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  color: var(--gold-hi); border-color: var(--gold);
  background: linear-gradient(180deg, #24314c, #16203200);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

/* ===================== HOME MENU ===================== */
.hero { text-align: center; padding: 18px 10px 4px; }
.crest {
  width: 78px; height: 78px; margin: 0 auto 14px;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M32 3l25 9v20c0 15-11 25-25 29C18 57 7 47 7 32V12z' fill='none' stroke='%23e8c56a' stroke-width='2.5'/%3E%3Cpath d='M32 14l3.6 7.6 8.4 1.1-6 5.9 1.5 8.3L32 33l-7.5 3.9 1.5-8.3-6-5.9 8.4-1.1z' fill='%23e8c56a'/%3E%3Cpath d='M20 44h24' stroke='%23e8c56a' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
  filter: drop-shadow(0 6px 14px rgba(232,197,106,0.28));
}
.hero-title {
  margin: 0 0 8px; font-family: 'Cinzel', Georgia, serif; font-weight: 900;
  font-size: clamp(26px, 5vw, 40px); letter-spacing: 2px;
  background: linear-gradient(135deg, var(--gold-deep), var(--gold-hi) 45%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-wrap: balance;
}
.hero-sub { margin: 0 auto; max-width: 52ch; color: var(--muted); font-size: 14px; line-height: 1.6; text-wrap: balance; }

.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.mode-card {
  font: inherit; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 20px; border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); color: var(--text);
  box-shadow: var(--shadow-md); transition: transform .15s ease, border-color .15s ease;
}
.mode-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.mode-ico { font-size: 30px; line-height: 1; color: var(--gold); }
.mode-name { font-family: 'Cinzel', Georgia, serif; font-weight: 700; font-size: 16px; letter-spacing: .6px; }
.mode-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ===================== ROOMS ===================== */
.room-code {
  font-family: 'Cinzel', Georgia, serif; letter-spacing: 4px; color: var(--gold-hi);
  background: var(--ink-2); border: 1px solid var(--gold); padding: 2px 12px; border-radius: 8px;
}
.room-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.room-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--cell); border: 1px solid var(--line); border-radius: 11px; padding: 11px 14px; font-size: 13px;
}
.empty { color: var(--muted); font-size: 13px; padding: 8px 2px; }

.player-slots { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.slot {
  display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600;
  background: var(--cell); border: 1px solid var(--line); border-radius: 11px; padding: 11px 14px;
}
.slot .dot { width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(232,197,106,0.4); flex: none; }
.slot.empty-slot { color: var(--muted); font-style: italic; }
.hint { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

/* ===================== BOARD ===================== */
.game-layout { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; justify-content: center; }
.board-wrap { position: relative; flex: 1 1 420px; max-width: min(76vh, 620px); min-width: 300px; }

.board {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  display: grid; grid-template: repeat(15, 1fr) / repeat(15, 1fr);
  gap: 1px; padding: var(--bpad); border-radius: 18px; --bpad: 10px;
  background:
    repeating-linear-gradient(45deg, rgba(232,197,106,0.04) 0 8px, transparent 8px 16px),
    linear-gradient(160deg, #131a28, #080b12);
  border: 2px solid var(--gold-deep);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(232,197,106,0.25), inset 0 0 40px rgba(0,0,0,0.6);
  touch-action: manipulation;
}

.cell {
  background: var(--cell); border: 1px solid rgba(232,197,106,0.10); border-radius: 3px;
  position: relative;
}
.cell.entry-red    { background: linear-gradient(160deg, var(--red), var(--red-dark)); }
.cell.entry-green  { background: linear-gradient(160deg, var(--green), var(--green-dark)); }
.cell.entry-yellow { background: linear-gradient(160deg, var(--yellow), var(--yellow-dark)); }
.cell.entry-blue   { background: linear-gradient(160deg, var(--blue), var(--blue-dark)); }

.cell.home-red    { background: linear-gradient(160deg, var(--red-dark), var(--red)); }
.cell.home-green  { background: linear-gradient(160deg, var(--green-dark), var(--green)); }
.cell.home-yellow { background: linear-gradient(160deg, var(--yellow-dark), var(--yellow)); }
.cell.home-blue   { background: linear-gradient(160deg, var(--blue-dark), var(--blue)); }
.cell.home-lane { border-color: rgba(232,197,106,0.35); }

/* Safe squares carry a gold star so players can see instantly where a piece
   cannot be taken — the single most misread rule in Ludo. */
.cell.safe::after {
  content: ''; position: absolute; inset: 14%;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.6l2.9 6.1 6.7.9-4.9 4.7 1.2 6.6L12 17.8 6.1 20.9l1.2-6.6L2.4 9.6l6.7-.9z' fill='%23e8c56a' fill-opacity='.85'/%3E%3C/svg%3E");
  opacity: .9; pointer-events: none;
}

/* Yards — the four corner courts where pieces wait. */
.yard-box {
  border-radius: 16px; padding: 12%;
  display: grid; grid-template: 1fr 1fr / 1fr 1fr; gap: 9%;
  border: 2px solid rgba(232,197,106,0.5);
  box-shadow: inset 0 0 22px rgba(0,0,0,0.5), 0 4px 14px rgba(0,0,0,0.4);
}
.yard-box.red    { background: linear-gradient(150deg, var(--red), var(--red-dark)); }
.yard-box.green  { background: linear-gradient(150deg, var(--green), var(--green-dark)); }
.yard-box.yellow { background: linear-gradient(150deg, var(--yellow), var(--yellow-dark)); }
.yard-box.blue   { background: linear-gradient(150deg, var(--blue), var(--blue-dark)); }
.yard-box.active-seat { animation: seatGlow 1.6s ease-in-out infinite; }
@keyframes seatGlow {
  0%,100% { box-shadow: inset 0 0 22px rgba(0,0,0,0.5), 0 0 0 0 rgba(232,197,106,0.55); }
  50%     { box-shadow: inset 0 0 22px rgba(0,0,0,0.5), 0 0 0 7px rgba(232,197,106,0); }
}
.yard-slot {
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, rgba(255,255,255,0.2), rgba(0,0,0,0.18) 72%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16), inset 0 3px 7px rgba(0,0,0,0.3);
}

/* Centre — the throne. Four triangles meeting under a gold crest. */
.center {
  position: relative; border-radius: 8px; overflow: hidden;
  background: #0c111b; border: 1px solid rgba(232,197,106,0.4);
}
.center i {
  position: absolute; inset: 0; display: block;
}
.center .t-red    { background: var(--red);    clip-path: polygon(0 0, 50% 50%, 0 100%); }
.center .t-green  { background: var(--green);  clip-path: polygon(0 0, 100% 0, 50% 50%); }
.center .t-yellow { background: var(--yellow); clip-path: polygon(100% 0, 100% 100%, 50% 50%); }
.center .t-blue   { background: var(--blue);   clip-path: polygon(0 100%, 50% 50%, 100% 100%); }
.center .throne {
  position: absolute; inset: 22%; z-index: 3;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Ccircle cx='24' cy='24' r='22' fill='%230b0f18' stroke='%23e8c56a' stroke-width='2'/%3E%3Cpath d='M11 18l6.5 5L24 13l6.5 10L37 18l-2.6 14H13.6z' fill='%23e8c56a'/%3E%3Crect x='13' y='33.5' width='22' height='3.6' rx='1.6' fill='%23e8c56a'/%3E%3C/svg%3E");
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.7));
}

/* The tokens float above the grid on their own layer, inset by exactly the
   board's padding so a 0-100% coordinate maps onto the 15x15 grid. */
.token-layer { position: absolute; inset: var(--bpad); pointer-events: none; z-index: 6; }
.token-layer .token { pointer-events: auto; }

/* ===================== TOKENS ===================== */
/* A token is a coin: colour disc, gold rim, and the rank emblem on top.
   King and Queen sit slightly larger than the Jacks so the court reads at a
   glance even on a phone. */
.token {
  position: absolute; width: 6.4%; height: 6.4%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--tk, #888);
  box-shadow:
    0 0 0 1.5px rgba(232,197,106,0.9),
    0 3px 7px rgba(0,0,0,0.6),
    inset 0 2px 4px rgba(255,255,255,0.35),
    inset 0 -3px 5px rgba(0,0,0,0.35);
  transition: left .22s cubic-bezier(.32,1.2,.5,1), top .22s cubic-bezier(.32,1.2,.5,1);
  cursor: default; z-index: 5;
}
.token.red    { --tk: radial-gradient(circle at 34% 28%, #ff8b96, var(--red) 52%, var(--red-dark)); }
.token.green  { --tk: radial-gradient(circle at 34% 28%, #7ee6ac, var(--green) 52%, var(--green-dark)); }
.token.yellow { --tk: radial-gradient(circle at 34% 28%, #ffe09b, var(--yellow) 52%, var(--yellow-dark)); }
.token.blue   { --tk: radial-gradient(circle at 34% 28%, #9cc0ff, var(--blue) 52%, var(--blue-dark)); }

.token::before {
  content: ''; position: absolute; inset: 15%;
  background-repeat: no-repeat; background-position: center 54%; background-size: contain;
  filter: drop-shadow(0 1px 1.5px rgba(0,0,0,0.7));
  pointer-events: none;
}
.token.rank-king::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 0.4h2v2.1h2.1v2H13v2.3h-2V4.5H8.9v-2H11z' fill='%23fff'/%3E%3Cpath d='M2.1 8.3l4.5 3.4L12 5.8l5.4 5.9 4.5-3.4-2 9.3H4.1z' fill='%23fff'/%3E%3Crect x='3.5' y='19.7' width='17' height='3' rx='1.4' fill='%23fff'/%3E%3C/svg%3E");
}
.token.rank-queen::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='2.5' cy='5.9' r='2.2' fill='%23fff'/%3E%3Ccircle cx='12' cy='3.2' r='2.5' fill='%23fff'/%3E%3Ccircle cx='21.5' cy='5.9' r='2.2' fill='%23fff'/%3E%3Cpath d='M2.3 8.2l4.3 3.6L12 6.5l5.4 5.3 4.3-3.6-2 9.5H4.3z' fill='%23fff'/%3E%3Crect x='3.5' y='19.5' width='17' height='3' rx='1.4' fill='%23fff'/%3E%3C/svg%3E");
}
.token.rank-jack::before {
  background-size: 76%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='5.4' r='4' fill='%23fff'/%3E%3Cpath d='M7.8 9.8h8.4c0 2.9-1.3 4.4-2.1 5.7-.7 1.3-.6 2.9.5 4.5H9.4c1.1-1.6 1.2-3.2.5-4.5-.8-1.3-2.1-2.8-2.1-5.7z' fill='%23fff'/%3E%3Crect x='5' y='19.6' width='14' height='3' rx='1.4' fill='%23fff'/%3E%3C/svg%3E");
}
.token.rank-king  { width: 7.4%; height: 7.4%; z-index: 8; box-shadow: 0 0 0 2px var(--gold), 0 3px 8px rgba(0,0,0,0.65), inset 0 2px 4px rgba(255,255,255,0.35), inset 0 -3px 5px rgba(0,0,0,0.35); }
.token.rank-queen { width: 7.0%; height: 7.0%; z-index: 7; box-shadow: 0 0 0 1.8px rgba(255,255,255,0.85), 0 3px 8px rgba(0,0,0,0.6), inset 0 2px 4px rgba(255,255,255,0.35), inset 0 -3px 5px rgba(0,0,0,0.35); }

.token.movable { cursor: pointer; animation: bob .85s ease-in-out infinite; }
.token.movable::after {
  content: ''; position: absolute; inset: -22%; border-radius: 50%;
  border: 2px solid var(--gold-hi); opacity: .9;
  animation: ripple 1.1s ease-out infinite;
}
@keyframes bob    { 0%,100% { transform: translate(-50%,-58%); } 50% { transform: translate(-50%,-44%); } }
@keyframes ripple { 0% { transform: scale(.75); opacity: .95; } 100% { transform: scale(1.25); opacity: 0; } }

/* Stacked tokens on one square get nudged so both stay visible. */
.token.stack-1 { margin-left: 1.4%;  margin-top: 1.4%; }
.token.stack-2 { margin-left: -1.4%; margin-top: -1.4%; }
.token.stack-3 { margin-left: 2.6%;  margin-top: -2.2%; }

.token.captured { animation: knockOut .45s ease-in; }
@keyframes knockOut {
  0%   { transform: translate(-50%,-50%) scale(1) rotate(0); }
  45%  { transform: translate(-50%,-140%) scale(1.35) rotate(28deg); }
  100% { transform: translate(-50%,-50%) scale(1) rotate(0); }
}

/* ===================== SIDE PANEL ===================== */
.side-panel { width: min(330px, 100%); display: flex; flex-direction: column; gap: 13px; flex: 0 1 330px; }

.turn-banner {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-left: 4px solid var(--gold);
  border-radius: 12px; padding: 13px 15px; font-weight: 800; font-size: 14px;
  box-shadow: var(--shadow-md); letter-spacing: .2px;
}
.turn-banner.seat-red    { border-left-color: var(--red); }
.turn-banner.seat-green  { border-left-color: var(--green); }
.turn-banner.seat-yellow { border-left-color: var(--yellow); }
.turn-banner.seat-blue   { border-left-color: var(--blue); }

.dice-area {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  box-shadow: var(--shadow-md);
}
.dice {
  width: 62px; height: 62px; flex: none; border-radius: 14px; cursor: pointer;
  background: linear-gradient(150deg, #fffaf0, #dfd2b4);
  border: 2px solid var(--gold-deep); color: #1a1408;
  font-size: 42px; line-height: 1; display: grid; place-items: center;
  box-shadow: 0 5px 14px rgba(0,0,0,0.55), inset 0 -3px 6px rgba(0,0,0,0.2);
}
.dice.rolling { animation: tumble .55s cubic-bezier(.36,.07,.19,.97); }
@keyframes tumble {
  0%   { transform: rotate(0) scale(1); }
  30%  { transform: rotate(160deg) scale(1.18); }
  60%  { transform: rotate(300deg) scale(.94); }
  100% { transform: rotate(360deg) scale(1); }
}
.dice-area .btn { flex: 1; }

.players-mini { display: flex; flex-direction: column; gap: 6px; }
.pm {
  display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 600;
  background: var(--cell); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
}
.pm .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1.5px rgba(232,197,106,0.5); }
.pm .pm-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm .pm-home { color: var(--gold); font-weight: 800; font-size: 11.5px; }
.pm.is-turn { border-color: var(--gold); background: linear-gradient(90deg, rgba(232,197,106,0.12), transparent); }

.emoji-bar {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px;
  background: var(--cell); border: 1px solid var(--line); border-radius: 11px; padding: 7px;
}
.emoji-btn {
  font-size: 18px; line-height: 1; padding: 5px 0; cursor: pointer;
  background: transparent; border: 0; border-radius: 7px;
}
.emoji-btn:hover { background: rgba(232,197,106,0.16); }

.log {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 13px; height: 150px; overflow-y: auto;
  font-size: 11.5px; line-height: 1.65; color: var(--muted);
}
.log b { color: var(--text); font-weight: 700; }
.log .chat-line { color: var(--gold); }

.chat-row { display: flex; gap: 7px; }
.chat-row .input { font-size: 12.5px; letter-spacing: 0; padding: 9px 12px; }

.emoji-fly { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
.emoji-fly span {
  position: absolute; font-size: 42px; left: 50%; top: 55%;
  animation: flyUp 1.5s ease-out forwards;
}
@keyframes flyUp {
  0%   { transform: translate(-50%, 0) scale(.4); opacity: 0; }
  25%  { transform: translate(-50%, -30px) scale(1.25); opacity: 1; }
  100% { transform: translate(-50%, -130px) scale(.9); opacity: 0; }
}

/* ===================== WIN MODAL ===================== */
.modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgba(4,6,11,0.82); backdrop-filter: blur(4px); padding: 20px;
}
.modal-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold); border-radius: 18px;
  padding: 32px 30px; text-align: center; max-width: 380px; width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-crown { font-size: 46px; margin-bottom: 10px; }
.win-text {
  font-family: 'Cinzel', Georgia, serif; font-weight: 700;
  font-size: 21px; margin-bottom: 22px; line-height: 1.4;
  color: var(--gold-hi); text-wrap: balance;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .game-layout { flex-direction: column; align-items: stretch; }
  .board-wrap { max-width: min(94vw, 560px); margin: 0 auto; width: 100%; }
  .side-panel { width: 100%; flex: 1 1 auto; max-width: 560px; margin: 0 auto; }
  .log { height: 110px; }
}
@media (max-width: 560px) {
  .view { padding: 14px; gap: 14px; }
  .topbar { padding: 10px 14px; }
  .brand-name { font-size: 15px; }
  .board { --bpad: 6px; border-radius: 14px; }
  .dice { width: 54px; height: 54px; font-size: 36px; }
  .hero { padding: 6px 4px 0; }
  .crest { width: 60px; height: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* A colour nobody is sitting on stays on the board (the geometry needs it)
   but drops back so it never looks like a live seat. */
.yard-box.seat-off { filter: grayscale(0.88) brightness(0.42); border-color: rgba(232,197,106,0.18); }
.yard-box.seat-off .yard-slot { opacity: 0.5; }
.cell.seat-off { filter: grayscale(0.9) brightness(0.45); }
