:root {
  --ludo-purple: #7c5cff;
  --ludo-purple-soft: rgba(124, 92, 255, 0.16);
  --ludo-surface: #111620;
  --ludo-surface-2: #171d29;
  --ludo-line: rgba(166, 179, 204, 0.17);
  --ludo-copy: #f5f7fb;
  --ludo-muted: #9da9bb;
  --ludo-red: #dc6674;
  --ludo-green: #55ad8b;
  --ludo-yellow: #d8aa4b;
  --ludo-blue: #5e84d9;
}

body.day-mode {
  --ludo-surface: #ffffff;
  --ludo-surface-2: #f3f6fb;
  --ludo-line: #d9e1ea;
  --ludo-copy: #17212b;
  --ludo-muted: #5f6b7a;
}

.ludo-layer .game-dialog {
  width: min(1460px, calc(100vw - 28px));
  max-height: min(940px, calc(100dvh - 28px));
  background:
    radial-gradient(circle at 50% -10%, rgba(124, 92, 255, 0.14), transparent 34rem),
    #0d1119;
}

body.day-mode .ludo-layer .game-dialog {
  background: #f3f6fb;
}

.ludo-layer .game-dialog-body {
  overscroll-behavior: contain;
}

.ludo-layer .game-dialog-footer {
  min-height: 70px;
}

.ludo-layer button,
.ludo-layer input,
.ludo-layer summary {
  -webkit-tap-highlight-color: transparent;
}

.ludo-layer button:focus-visible,
.ludo-layer input:focus-visible,
.ludo-layer summary:focus-visible,
.message-game-card button:focus-visible {
  outline: 3px solid rgba(124, 92, 255, 0.34);
  outline-offset: 2px;
}

.ludo-layer button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.ludo-mode-screen,
.ludo-setup-screen,
.ludo-lobby,
.ludo-searching,
.ludo-results {
  width: min(900px, 100%);
  margin: auto;
}

.ludo-mode-intro,
.ludo-setup-head,
.ludo-lobby-head {
  display: flex;
  align-items: center;
  gap: 18px;
}

.ludo-mode-intro h3,
.ludo-setup-head h3,
.ludo-lobby-head h3,
.ludo-searching h3,
.ludo-results h3 {
  margin: 0;
  color: var(--ludo-copy);
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  letter-spacing: -0.045em;
}

.ludo-mode-intro p,
.ludo-setup-head p,
.ludo-lobby-head p,
.ludo-searching p,
.ludo-results p {
  margin: 5px 0 0;
  color: var(--ludo-muted);
}

.ludo-mini-board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  flex: 0 0 70px;
  width: 70px;
  height: 70px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  padding: 8px;
  background: #111827;
  box-shadow: 0 16px 35px rgba(38, 19, 93, 0.28);
}

.ludo-mini-board i:nth-child(1) { background: var(--ludo-red); }
.ludo-mini-board i:nth-child(2) { background: var(--ludo-green); }
.ludo-mini-board i:nth-child(3) { background: var(--ludo-blue); }
.ludo-mini-board i:nth-child(4) { background: var(--ludo-yellow); }

.ludo-game-mark {
  flex: 0 0 76px;
  width: 76px;
  height: 76px;
  overflow: hidden;
  border: 1px solid rgba(174, 107, 255, 0.58);
  border-radius: 23px;
  background: #050409;
  box-shadow: 0 16px 38px rgba(60, 22, 126, 0.38), inset 0 0 0 1px rgba(226, 184, 255, 0.14);
}

.ludo-game-mark img,
.ludo-invitation-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ludo-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 30px;
}

.ludo-mode-card {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 22px;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px 14px;
  min-height: 132px;
  border: 1px solid var(--ludo-line);
  border-radius: 23px;
  padding: 20px;
  color: var(--ludo-copy);
  background: var(--ludo-surface);
  text-align: left;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12);
  transition: transform 170ms ease, border-color 170ms ease, background 170ms ease;
}

.ludo-mode-card:hover {
  border-color: rgba(124, 92, 255, 0.55);
  background: linear-gradient(145deg, rgba(124, 92, 255, 0.12), var(--ludo-surface));
  transform: translateY(-3px);
}

.ludo-mode-card > span:first-child {
  display: grid;
  grid-row: 1 / 3;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 17px;
  color: #b9a8ff;
  background: var(--ludo-purple-soft);
}

.ludo-mode-card > span .ui-icon { width: 27px; height: 27px; }
.ludo-mode-card > strong { align-self: end; font-size: 1rem; }
.ludo-mode-card > small { align-self: start; color: var(--ludo-muted); line-height: 1.45; }
.ludo-mode-card > i { grid-column: 3; grid-row: 1 / 3; color: #9278f7; }

.ludo-pending-invites {
  display: grid;
  gap: 9px;
  margin-top: 26px;
}

.ludo-pending-invites > strong { font-size: 0.82rem; color: var(--ludo-muted); }
.ludo-pending-invites > button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--ludo-line);
  border-radius: 17px;
  padding: 12px;
  color: var(--ludo-copy);
  background: var(--ludo-surface);
  text-align: left;
}
.ludo-pending-invites > button > span:first-child { display: grid; place-items: center; width: 42px; height: 42px; overflow: hidden; border-radius: 13px; color: #fff; background: #6f50e4; }
.ludo-pending-invites > button > span:nth-child(2) { display: grid; gap: 3px; }
.ludo-pending-invites small { color: var(--ludo-muted); }

.ludo-setup-head { align-items: flex-start; margin-bottom: 26px; }
.ludo-setup-head > button {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--ludo-line);
  border-radius: 14px;
  color: var(--ludo-copy);
  background: var(--ludo-surface);
}

.ludo-choice-group {
  min-width: 0;
  margin: 18px 0;
  border: 1px solid var(--ludo-line);
  border-radius: 20px;
  padding: 17px;
  background: var(--ludo-surface);
}
.ludo-choice-group legend { padding: 0 8px; color: var(--ludo-copy); font-weight: 800; }
.ludo-choice-group > p { margin: 10px 2px 0; color: var(--ludo-muted); font-size: 0.8rem; }
.ludo-segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ludo-segmented button {
  min-height: 46px;
  border: 1px solid var(--ludo-line);
  border-radius: 13px;
  color: var(--ludo-muted);
  background: var(--ludo-surface-2);
  font-weight: 800;
}
.ludo-segmented button.active { color: #fff; border-color: #8065ed; background: #6e50e5; box-shadow: 0 10px 24px rgba(81, 51, 177, 0.25); }

.ludo-online-note,
.ludo-selection-count,
.ludo-room-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ludo-muted);
}
.ludo-online-note { justify-content: flex-start; border: 1px solid rgba(98, 205, 183, 0.25); border-radius: 18px; padding: 15px; background: rgba(98, 205, 183, 0.07); }
.ludo-online-note > svg { flex: 0 0 24px; color: #62cdb7; }
.ludo-online-note span { display: grid; gap: 3px; }
.ludo-online-note strong { color: var(--ludo-copy); }
.ludo-start-button { width: 100%; margin-top: 18px; }

.ludo-friend-search {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ludo-line);
  border-radius: 16px;
  padding: 0 14px;
  color: var(--ludo-muted);
  background: var(--ludo-surface);
}
.ludo-friend-search input {
  width: 100%;
  min-height: 50px;
  border: 0;
  outline: 0;
  color: var(--ludo-copy);
  background: transparent;
  font: inherit;
}
.ludo-friend-picker { display: grid; gap: 9px; max-height: 340px; margin: 12px 0; overflow: auto; }
.ludo-friend-choice,
.ludo-lobby-slot {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--ludo-line);
  border-radius: 17px;
  padding: 10px 13px;
  color: var(--ludo-copy);
  background: var(--ludo-surface);
  text-align: left;
}
.ludo-friend-choice.selected { border-color: #8165ee; background: var(--ludo-purple-soft); }
.ludo-friend-choice > span:nth-child(2), .ludo-lobby-slot > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.ludo-friend-choice small, .ludo-lobby-slot small { overflow: hidden; color: var(--ludo-muted); text-overflow: ellipsis; white-space: nowrap; }
.ludo-avatar { position: relative; display: block; width: 48px; height: 48px; }
.ludo-avatar img { width: 100%; height: 100%; border: 1px solid var(--ludo-line); border-radius: 15px; object-fit: cover; }
.ludo-avatar i { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border: 3px solid var(--ludo-surface); border-radius: 50%; background: #697386; }
.ludo-avatar i.online { background: #62cdb7; }
.ludo-selection-count { padding: 0 3px; font-size: 0.8rem; }
.ludo-feedback { border: 1px solid rgba(244, 99, 116, 0.32); border-radius: 14px; padding: 11px 13px; color: #ff9aa7; background: rgba(244, 63, 94, 0.08); }

.ludo-empty,
.ludo-chat-empty {
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 150px;
  color: var(--ludo-muted);
  text-align: center;
}
.ludo-empty > span, .ludo-chat-empty > svg { color: #9479f5; }

.ludo-searching { display: grid; place-items: center; gap: 10px; min-height: 540px; text-align: center; }
.ludo-globe { position: relative; display: grid; place-items: center; width: 142px; height: 142px; margin-bottom: 12px; border-radius: 50%; color: #c3b5ff; background: radial-gradient(circle, #5139b3 0, #17152d 62%, #0c1018 63%); box-shadow: 0 0 0 16px rgba(124, 92, 255, 0.06), 0 0 60px rgba(124, 92, 255, 0.24); }
.ludo-globe span svg { width: 58px; height: 58px; }
.ludo-globe i { position: absolute; inset: -10px; border: 1px solid rgba(156, 132, 255, 0.28); border-radius: 50%; animation: ludo-orbit 2.8s linear infinite; }
.ludo-globe i:nth-child(3) { inset: -22px; animation-duration: 3.8s; animation-direction: reverse; }
.ludo-globe i:nth-child(4) { inset: 10px; animation-duration: 2.2s; }
.ludo-player-slots { display: flex; gap: 10px; margin: 12px 0; }
.ludo-player-slots span { display: grid; place-items: center; width: 46px; height: 46px; border: 1px dashed #50596a; border-radius: 15px; color: #a996f5; background: var(--ludo-surface); }
.ludo-player-slots span.filled { border-style: solid; border-color: #7f66e5; background: var(--ludo-purple-soft); }
.ludo-searching time { color: var(--ludo-copy); font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.ludo-search-hint { color: var(--ludo-muted); }
.ludo-search-offer { display: grid; gap: 6px; width: min(430px, 100%); border: 1px solid var(--ludo-line); border-radius: 18px; padding: 16px; background: var(--ludo-surface); }
.ludo-search-offer small { color: var(--ludo-muted); }
.ludo-search-offer button { min-height: 42px; margin-top: 7px; border: 1px solid #7458de; border-radius: 13px; color: #fff; background: #6849d3; font-weight: 800; }

.ludo-lobby-head { justify-content: space-between; }
.ludo-lobby-head > span { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 19px; color: #c8bbff; background: var(--ludo-purple-soft); font-size: 1.05rem; font-weight: 900; }
.ludo-lobby-head p button { border: 0; padding: 0; color: #a98fff; background: transparent; font-weight: 800; }
.ludo-lobby-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 26px 0; }
.ludo-lobby-slot.empty { border-style: dashed; }
.ludo-lobby-slot.invited { color: var(--ludo-muted); }
.ludo-invite-decision { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid rgba(124, 92, 255, 0.38); border-radius: 18px; padding: 16px; background: var(--ludo-purple-soft); }
.ludo-invite-decision > div, .ludo-lobby-actions { display: flex; gap: 10px; }
.ludo-lobby-actions { justify-content: flex-end; margin-top: 20px; }
.ludo-waiting-copy { border-radius: 15px; padding: 14px; color: var(--ludo-muted); background: var(--ludo-surface); text-align: center; }
.ludo-room-settings { margin-top: 18px; border-top: 1px solid var(--ludo-line); padding-top: 15px; font-size: 0.78rem; }
.ludo-room-settings span { display: flex; align-items: center; gap: 6px; }

.ludo-room {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(470px, 1fr) minmax(230px, 280px);
  align-items: start;
  gap: 16px;
  min-width: 0;
}

.ludo-layer .game-dialog-body:has(.ludo-room) { padding: 16px; }

.ludo-room-sidebar,
.ludo-dice-console,
.ludo-turn-banner {
  border: 1px solid var(--ludo-line);
  background: rgba(20, 25, 36, 0.88);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.13);
}
body.day-mode :is(.ludo-room-sidebar, .ludo-dice-console, .ludo-turn-banner) { background: #fff; box-shadow: 0 2px 8px rgba(20, 35, 55, 0.06); }
.ludo-room-sidebar { overflow: hidden; border-radius: 21px; }
.ludo-room-sidebar > header { display: flex; align-items: center; gap: 10px; min-height: 64px; border-bottom: 1px solid var(--ludo-line); padding: 12px 14px; }
.ludo-room-sidebar > header > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #ad99ff; background: var(--ludo-purple-soft); }
.ludo-room-sidebar > header > div { display: grid; flex: 1; gap: 2px; min-width: 0; }
.ludo-room-sidebar > header strong { color: var(--ludo-copy); }
.ludo-room-sidebar > header small { color: var(--ludo-muted); }
.ludo-room-sidebar > header button { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--ludo-line); border-radius: 11px; color: var(--ludo-muted); background: var(--ludo-surface); }
.ludo-player-list { display: grid; gap: 8px; padding: 12px; }
.ludo-player-card { --player-color: #7c5cff; display: grid; grid-template-columns: 43px minmax(0, 1fr) 28px; align-items: center; gap: 9px; min-height: 62px; border: 1px solid transparent; border-radius: 15px; padding: 8px; color: var(--ludo-copy); background: rgba(255, 255, 255, 0.025); }
body.day-mode .ludo-player-card { background: #f7f9fc; }
.ludo-player-card.color-red { --player-color: var(--ludo-red); }
.ludo-player-card.color-green { --player-color: var(--ludo-green); }
.ludo-player-card.color-yellow { --player-color: var(--ludo-yellow); }
.ludo-player-card.color-blue { --player-color: var(--ludo-blue); }
.ludo-player-card.active { border-color: var(--player-color); box-shadow: inset 3px 0 var(--player-color); }
.ludo-player-card.disconnected { opacity: 0.62; }
.ludo-player-card .ludo-avatar { width: 43px; height: 43px; }
.ludo-player-card > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.ludo-player-card strong, .ludo-player-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ludo-player-card small { color: var(--ludo-muted); font-size: 0.69rem; }
.ludo-player-card > b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: var(--player-color); background: color-mix(in srgb, var(--player-color) 16%, transparent); }
.ludo-match-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; border-top: 1px solid var(--ludo-line); padding: 10px; }
.ludo-match-tools button { display: grid; place-items: center; gap: 4px; min-height: 54px; border: 0; border-radius: 12px; color: var(--ludo-muted); background: var(--ludo-surface); font-size: 0.64rem; font-weight: 750; }
.ludo-match-tools button:hover { color: #b6a5ff; background: var(--ludo-purple-soft); }
.ludo-settings { border-top: 1px solid var(--ludo-line); padding: 12px; color: var(--ludo-muted); font-size: 0.78rem; }
.ludo-settings summary { display: flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 800; }
.ludo-settings label { display: flex; align-items: center; gap: 8px; margin-top: 11px; }

.ludo-board-stage { display: grid; justify-items: center; gap: 12px; min-width: 0; }
.ludo-turn-banner { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 11px; width: min(680px, 100%); border-radius: 17px; padding: 11px 14px; }
.ludo-turn-banner.mine { border-color: rgba(124, 92, 255, 0.52); background: linear-gradient(100deg, rgba(124, 92, 255, 0.17), rgba(20, 25, 36, 0.9)); }
body.day-mode .ludo-turn-banner.mine { background: linear-gradient(100deg, #eeeafd, #fff); }
.ludo-turn-banner > div { display: grid; gap: 2px; }
.ludo-turn-banner strong { color: var(--ludo-copy); }
.ludo-turn-banner small { color: var(--ludo-muted); }
.ludo-turn-dot { width: 11px; height: 11px; border-radius: 50%; background: #7c5cff; box-shadow: 0 0 0 5px rgba(124, 92, 255, 0.12); }
.ludo-turn-dot.color-red, .color-dot.color-red { background: var(--ludo-red); }
.ludo-turn-dot.color-green, .color-dot.color-green { background: var(--ludo-green); }
.ludo-turn-dot.color-yellow, .color-dot.color-yellow { background: var(--ludo-yellow); }
.ludo-turn-dot.color-blue, .color-dot.color-blue { background: var(--ludo-blue); }
.ludo-secure-badge { display: flex; align-items: center; gap: 5px; border: 1px solid rgba(98, 205, 183, 0.28); border-radius: 999px; padding: 6px 9px; color: #70d4bf; background: rgba(98, 205, 183, 0.08); font-size: 0.68rem; font-weight: 850; }
.ludo-secure-badge svg { width: 13px; height: 13px; }

.ludo-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  width: min(680px, 100%);
  aspect-ratio: 1;
  overflow: hidden;
  border: 7px solid #171c26;
  border-radius: 25px;
  background: #e9edf3;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.29), inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  isolation: isolate;
}
body.day-mode .ludo-board { border-color: #fff; box-shadow: 0 10px 30px rgba(36, 49, 71, 0.14); }
.ludo-cell { position: relative; grid-row: var(--row); grid-column: var(--column); min-width: 0; min-height: 0; }
.ludo-cell.track, .ludo-cell.home-lane { border: 0.5px solid #c4ccd7; background: #f7f9fc; }
.ludo-cell.home-zone.color-red { background: color-mix(in srgb, var(--ludo-red) 65%, #fff); }
.ludo-cell.home-zone.color-green { background: color-mix(in srgb, var(--ludo-green) 66%, #fff); }
.ludo-cell.home-zone.color-yellow { background: color-mix(in srgb, var(--ludo-yellow) 64%, #fff); }
.ludo-cell.home-zone.color-blue { background: color-mix(in srgb, var(--ludo-blue) 64%, #fff); }
.ludo-cell.home-lane.color-red { background: color-mix(in srgb, var(--ludo-red) 75%, #fff); }
.ludo-cell.home-lane.color-green { background: color-mix(in srgb, var(--ludo-green) 75%, #fff); }
.ludo-cell.home-lane.color-yellow { background: color-mix(in srgb, var(--ludo-yellow) 75%, #fff); }
.ludo-cell.home-lane.color-blue { background: color-mix(in srgb, var(--ludo-blue) 75%, #fff); }
.ludo-cell.ludo-center { background: conic-gradient(from 45deg, var(--ludo-green) 0 25%, var(--ludo-yellow) 0 50%, var(--ludo-blue) 0 75%, var(--ludo-red) 0); }
.safe-mark { position: absolute; inset: 0; display: grid; place-items: center; color: #7b8492; font-size: clamp(0.45rem, 1.3vw, 0.86rem); }

.ludo-token { --token: #7c5cff; position: absolute; z-index: calc(3 + var(--stack)); top: 50%; left: 50%; display: grid; place-items: center; width: 72%; aspect-ratio: 1; border: 2px solid rgba(255, 255, 255, 0.84); border-radius: 50%; padding: 0; background: var(--token); box-shadow: 0 3px 6px rgba(10, 14, 22, 0.4), inset 0 2px 2px rgba(255, 255, 255, 0.42); transform: translate(calc(-50% + var(--stack) * 2px), calc(-50% - var(--stack) * 2px)); }
.ludo-token.color-red { --token: #d64d60; }
.ludo-token.color-green { --token: #369b76; }
.ludo-token.color-yellow { --token: #d49a27; }
.ludo-token.color-blue { --token: #3f6fcc; }
.ludo-token span { width: 34%; height: 34%; border-radius: 50%; background: rgba(255, 255, 255, 0.58); }
.ludo-token.valid { cursor: pointer; animation: ludo-valid-token 1.05s ease-in-out infinite; }
.ludo-token.valid::after { position: absolute; inset: -12px; border-radius: 50%; content: ""; }
.ludo-token.valid:hover { filter: brightness(1.16); }

.ludo-dice-console { --player-glow: #7c5cff; display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; align-items: center; gap: 14px; width: min(680px, 100%); min-height: 100px; border-radius: 19px; padding: 10px 14px; }
.ludo-dice-console.color-red { --player-glow: var(--ludo-red); }
.ludo-dice-console.color-green { --player-glow: var(--ludo-green); }
.ludo-dice-console.color-yellow { --player-glow: var(--ludo-yellow); }
.ludo-dice-console.color-blue { --player-glow: var(--ludo-blue); }
.ludo-dice-console > div:nth-child(2) { display: grid; gap: 4px; }
.ludo-dice-console strong { color: var(--ludo-copy); }
.ludo-dice-console small { color: var(--ludo-muted); }
.ludo-dice-stage { display: grid; place-items: center; width: 76px; height: 76px; perspective: 520px; }
.ludo-die { position: relative; width: 52px; height: 52px; transform-style: preserve-3d; filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.34)); transition: transform 480ms cubic-bezier(.2,.8,.2,1); }
.die-face { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 3px; border: 1px solid rgba(122, 127, 145, 0.38); border-radius: 12px; padding: 7px; background: linear-gradient(145deg, #fff, #dfe3eb); box-shadow: inset 5px 5px 8px rgba(255,255,255,.78), inset -5px -5px 9px rgba(94,103,124,.18); backface-visibility: hidden; }
.die-face i { border-radius: 50%; background: transparent; }
.die-face i.visible { background: #262b36; box-shadow: inset 1px 1px 2px #080a0f, 0 1px 1px #fff; }
.face-1 { transform: translateZ(26px); }
.face-6 { transform: rotateY(180deg) translateZ(26px); }
.face-2 { transform: rotateY(90deg) translateZ(26px); }
.face-5 { transform: rotateY(-90deg) translateZ(26px); }
.face-3 { transform: rotateX(90deg) translateZ(26px); }
.face-4 { transform: rotateX(-90deg) translateZ(26px); }
.ludo-die.show-1 { transform: rotateX(0) rotateY(0); }
.ludo-die.show-2 { transform: rotateX(0) rotateY(-90deg); }
.ludo-die.show-3 { transform: rotateX(-90deg) rotateY(0); }
.ludo-die.show-4 { transform: rotateX(90deg) rotateY(0); }
.ludo-die.show-5 { transform: rotateX(0) rotateY(90deg); }
.ludo-die.show-6 { transform: rotateX(180deg) rotateY(0); }
.ludo-dice-stage.rolling .ludo-die { animation: ludo-dice-roll 940ms cubic-bezier(.16,.84,.3,1); }
.ludo-dice-stage.rolling::after { position: absolute; width: 54px; height: 12px; border-radius: 50%; background: color-mix(in srgb, var(--player-glow) 45%, transparent); filter: blur(8px); transform: translateY(38px); content: ""; animation: ludo-dice-shadow 940ms ease; }
.ludo-roll-button { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 94px; min-height: 48px; border: 1px solid color-mix(in srgb, var(--player-glow) 72%, #fff); border-radius: 14px; color: #fff; background: color-mix(in srgb, var(--player-glow) 85%, #32246d); box-shadow: 0 10px 22px color-mix(in srgb, var(--player-glow) 28%, transparent); font-weight: 850; }

.ludo-chat-panel { display: grid; grid-template-rows: auto minmax(180px, 1fr) auto auto auto; max-height: 720px; }
.ludo-chat-log { display: flex; flex-direction: column; gap: 10px; min-height: 180px; max-height: 410px; overflow: auto; padding: 12px; }
.ludo-chat-log article { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: start; gap: 8px; }
.ludo-chat-log article.mine { direction: rtl; }
.ludo-chat-log article.mine > * { direction: ltr; }
.ludo-chat-log article img { width: 30px; height: 30px; border-radius: 10px; object-fit: cover; }
.ludo-chat-log article div { position: relative; border-radius: 13px; padding: 8px 9px 17px; color: var(--ludo-copy); background: var(--ludo-surface); }
.ludo-chat-log article.mine div { color: #fff; background: #6547d0; }
.ludo-chat-log article strong { display: block; margin-bottom: 3px; font-size: 0.67rem; }
.ludo-chat-log article p { margin: 0; overflow-wrap: anywhere; font-size: 0.78rem; line-height: 1.4; }
.ludo-chat-log article time { position: absolute; right: 7px; bottom: 3px; color: currentColor; opacity: 0.62; font-size: 0.57rem; }
.ludo-reactions { display: flex; justify-content: space-between; gap: 3px; border-top: 1px solid var(--ludo-line); padding: 8px; }
.ludo-reactions button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; font-size: 1rem; }
.ludo-reactions button:hover { background: var(--ludo-purple-soft); transform: translateY(-2px); }
.ludo-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 7px; padding: 8px; }
.ludo-chat-form input { min-width: 0; min-height: 44px; border: 1px solid var(--ludo-line); border-radius: 13px; padding: 0 12px; color: var(--ludo-copy); background: var(--ludo-surface); font: inherit; font-size: 0.8rem; }
.ludo-chat-form button { display: grid; place-items: center; border: 0; border-radius: 12px; color: #fff; background: #6a4bd8; }
.ludo-leave-button { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; border: 0; border-top: 1px solid var(--ludo-line); color: #ef8897; background: transparent; font-weight: 800; }
.ludo-spectator-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 0; border-top: 1px solid var(--ludo-line); padding: 13px; color: var(--ludo-muted); font-size: .76rem; }

.ludo-reaction-burst { position: fixed; z-index: 7; inset: 50% auto auto 50%; pointer-events: none; transform: translate(-50%, -50%); }
.ludo-reaction-burst span { display: grid; place-items: center; opacity: 0; transform: translateY(20px) scale(.75); }
.ludo-reaction-burst.show span { animation: ludo-reaction 1.25s ease forwards; }
.ludo-reaction-burst b { font-size: 4rem; filter: drop-shadow(0 10px 18px rgba(0,0,0,.35)); }
.ludo-reaction-burst small { border-radius: 999px; padding: 5px 9px; color: #fff; background: rgba(10,13,20,.82); }
.ludo-reaction-burst.capture .ludo-capture-burst { position: relative; width: 96px; height: 96px; animation-duration: .8s; }
.ludo-capture-burst b { display: grid; place-items: center; width: 100%; height: 100%; color: #fff0a6; font-size: 3rem; }
.ludo-capture-burst i { position: absolute; top: 46px; left: 46px; width: 9px; height: 9px; border-radius: 50%; background: #8c70ff; animation: ludo-particle .72s ease-out forwards; }
.ludo-capture-burst i:nth-of-type(2) { --particle-x: 44px; --particle-y: -30px; background: #62cdb7; }
.ludo-capture-burst i:nth-of-type(3) { --particle-x: -40px; --particle-y: -24px; background: #e7bc55; }
.ludo-capture-burst i:nth-of-type(4) { --particle-x: 12px; --particle-y: 44px; background: #e96d7b; }
.ludo-capture-burst i:nth-of-type(1) { --particle-x: -28px; --particle-y: 38px; }

.ludo-results { display: grid; justify-items: center; gap: 9px; padding: 24px 0; text-align: center; }
.ludo-result-crown { display: grid; place-items: center; width: 90px; height: 90px; border: 1px solid rgba(194, 166, 255, 0.4); border-radius: 28px; color: #d5c9ff; background: linear-gradient(145deg, #7959ed, #3d277e); box-shadow: 0 20px 45px rgba(82, 51, 178, .3); }
.ludo-result-crown svg { width: 43px; height: 43px; }
.ludo-ranking { display: grid; gap: 8px; width: min(620px, 100%); margin: 18px 0; }
.ludo-ranking article { display: grid; grid-template-columns: 34px 13px minmax(0, 1fr) 25px; align-items: center; gap: 10px; border: 1px solid var(--ludo-line); border-radius: 16px; padding: 12px; color: var(--ludo-copy); background: var(--ludo-surface); text-align: left; }
.ludo-ranking article.winner { border-color: rgba(124, 92, 255, .52); background: linear-gradient(100deg, var(--ludo-purple-soft), var(--ludo-surface)); }
.ludo-ranking article > b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--ludo-surface-2); }
.ludo-ranking article > span:nth-child(3) { display: grid; gap: 3px; }
.ludo-ranking small { color: var(--ludo-muted); }
.color-dot { width: 11px; height: 11px; border-radius: 50%; }
.ludo-result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }

.ludo-share-picker { position: absolute; z-index: 12; inset: 0; display: grid; place-items: center; padding: 18px; }
.ludo-share-scrim { position: absolute; inset: 0; border: 0; background: rgba(4, 6, 11, .72); backdrop-filter: blur(8px); }
.ludo-share-picker > section { position: relative; width: min(440px, 100%); max-height: min(620px, calc(100dvh - 120px)); overflow: hidden; border: 1px solid var(--ludo-line); border-radius: 23px; color: var(--ludo-copy); background: var(--ludo-surface); box-shadow: 0 28px 80px rgba(0,0,0,.4); }
.ludo-share-picker > section > header { display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--ludo-line); padding: 16px; }
.ludo-share-picker > section > header strong { font-size: 1.1rem; }
.ludo-share-picker > section > header p { margin: 0 0 3px; }
.ludo-share-picker > section > header button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--ludo-line); border-radius: 12px; color: var(--ludo-copy); background: var(--ludo-surface-2); }
.ludo-share-picker > section > div { display: grid; gap: 7px; max-height: 480px; overflow: auto; padding: 10px; }
.ludo-share-picker > section > div > button { display: grid; grid-template-columns: 46px minmax(0,1fr) 22px; align-items: center; gap: 11px; min-height: 66px; border: 1px solid transparent; border-radius: 15px; padding: 9px; color: var(--ludo-copy); background: transparent; text-align: left; }
.ludo-share-picker > section > div > button:hover { border-color: rgba(124,92,255,.42); background: var(--ludo-purple-soft); }
.ludo-share-picker img { width: 46px; height: 46px; border-radius: 14px; object-fit: cover; }
.ludo-share-picker > section > div > button span { display: grid; gap: 3px; min-width: 0; }
.ludo-share-picker > section > div > button small { color: var(--ludo-muted); }
.ludo-share-picker > section > div > button > svg { color: #9278f7; }

.message-game-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 11px;
  width: min(430px, 100%);
  border: 1px solid rgba(153, 128, 247, 0.42);
  border-radius: 17px;
  padding: 13px;
  color: #f7f8fc;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.2), rgba(19, 23, 34, 0.94));
  box-shadow: 0 10px 28px rgba(20, 12, 46, 0.18);
}
body.day-mode .message-game-card { color: #17212b; border-color: #d5cbed; background: linear-gradient(135deg, #eeeafd, #fff); }
.message-game-card-icon { display: grid; grid-row: 1 / 3; place-items: center; width: 48px; height: 48px; overflow: hidden; border: 1px solid rgba(174, 107, 255, .54); border-radius: 15px; color: #fff; background: #050409; }
.message-game-card-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.message-game-card-copy { display: grid; gap: 2px; min-width: 0; }
.message-game-card-copy small { color: #b8a9f4; font-size: .67rem; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.message-game-card-copy strong { font-size: .94rem; }
.message-game-card-copy > span { color: #aab3c3; font-size: .72rem; text-transform: capitalize; }
body.day-mode .message-game-card-copy > span { color: #5f6b7a; }
.message-game-card-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 7px; }
.message-game-card-actions button { min-height: 36px; border: 1px solid rgba(166, 179, 204, .25); border-radius: 11px; padding: 0 12px; color: inherit; background: rgba(255,255,255,.055); font-weight: 800; }
.message-game-card-actions button.primary { color: #fff; border-color: #785de0; background: #6848d5; }

/* The shared game footer styles use an explicit display mode, so preserve the
   native hidden contract for controls that are not valid in the current view. */
.ludo-layer #restartGameButton[hidden] { display: none !important; }

/* Premium Moose Ludo table ------------------------------------------------ */
.ludo-layer .game-dialog {
  background:
    radial-gradient(circle at 50% -12%, rgba(124, 92, 255, .22), transparent 35rem),
    radial-gradient(circle at 4% 60%, rgba(64, 198, 177, .08), transparent 28rem),
    linear-gradient(145deg, #0d1119, #090d14 74%);
}

.ludo-dialog-identity {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  min-height: 52px;
  column-gap: 13px;
}

.ludo-dialog-identity::before {
  grid-row: 1 / 4;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(174, 107, 255, .5);
  border-radius: 16px;
  background: #050409 url("/moose-ludo-icon.png") center / cover no-repeat;
  box-shadow: 0 10px 25px rgba(67, 30, 133, .28), inset 0 0 0 1px rgba(226, 184, 255, .12);
  content: "";
}

.ludo-dialog-identity > * { grid-column: 2; }

.ludo-room-sidebar,
.ludo-dice-console,
.ludo-turn-banner {
  border-color: rgba(159, 142, 225, .2);
  background: linear-gradient(145deg, rgba(25, 30, 43, .96), rgba(14, 19, 28, .94));
  box-shadow: 0 18px 50px rgba(0, 0, 0, .2), inset 0 1px rgba(255, 255, 255, .035);
  backdrop-filter: blur(18px);
}

.ludo-room-sidebar { border-radius: 24px; }
.ludo-room-sidebar > header { min-height: 68px; background: linear-gradient(90deg, rgba(124, 92, 255, .075), transparent); }
.ludo-sidebar-header-actions { display: flex; gap: 6px; }
.ludo-room-sidebar > header .ludo-sidebar-header-actions > button { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--ludo-line); border-radius: 11px; color: var(--ludo-muted); background: rgba(255, 255, 255, .035); }
.ludo-room-sidebar > header .ludo-exit-compact { color: #f18c9a; }
.ludo-room-sidebar > header .ludo-exit-compact:hover { border-color: rgba(241, 109, 128, .42); color: #ffb1bd; background: rgba(225, 72, 96, .1); }
.ludo-layer .game-dialog-header .ludo-global-exit { display: flex; align-items: center; gap: 7px; width: auto; min-width: 82px; padding: 0 13px; border-color: rgba(239, 111, 130, .26); color: #ffafba; background: rgba(225, 72, 96, .075); font-weight: 850; }
.ludo-global-exit span { font-size: .72rem; }
.ludo-global-exit:hover { border-color: rgba(239, 111, 130, .48) !important; background: rgba(225, 72, 96, .14) !important; }

.ludo-player-card {
  min-height: 70px;
  border-color: rgba(255, 255, 255, .035);
  padding: 9px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .012));
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.ludo-player-card.active {
  border-color: color-mix(in srgb, var(--player-color) 72%, #fff);
  background: linear-gradient(115deg, color-mix(in srgb, var(--player-color) 16%, transparent), rgba(255, 255, 255, .025));
  box-shadow: inset 3px 0 var(--player-color), 0 10px 26px color-mix(in srgb, var(--player-color) 13%, transparent);
  transform: translateX(2px);
}
.ludo-player-card .ludo-avatar { border: 2px solid color-mix(in srgb, var(--player-color) 62%, #fff); box-shadow: 0 7px 17px rgba(0,0,0,.22); }
.ludo-token-progress { display: flex !important; gap: 4px; margin-top: 3px; }
.ludo-token-progress i { width: 12px; height: 3px; border-radius: 999px; background: rgba(151, 161, 181, .22); }
.ludo-token-progress i.complete { background: var(--player-color); box-shadow: 0 0 7px color-mix(in srgb, var(--player-color) 55%, transparent); }

.ludo-turn-banner {
  position: relative;
  min-height: 66px;
  overflow: hidden;
  border-radius: 20px;
  padding: 10px 15px;
}
.ludo-turn-banner::after { position: absolute; top: -30px; right: 12%; width: 150px; height: 90px; border-radius: 50%; background: color-mix(in srgb, var(--player-color, #7c5cff) 15%, transparent); filter: blur(25px); content: ""; pointer-events: none; }
.ludo-turn-banner.color-red { --player-color: var(--ludo-red); }
.ludo-turn-banner.color-green { --player-color: var(--ludo-green); }
.ludo-turn-banner.color-yellow { --player-color: var(--ludo-yellow); }
.ludo-turn-banner.color-blue { --player-color: var(--ludo-blue); }
.ludo-turn-kicker { color: color-mix(in srgb, var(--player-color) 72%, #fff); font-size: .61rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.ludo-turn-banner strong { font-size: .98rem; }
.ludo-secure-badge { position: relative; z-index: 1; }

.ludo-board-shell {
  --board-glow: #7c5cff;
  position: relative;
  width: min(680px, 100%);
  border: 1px solid color-mix(in srgb, var(--board-glow) 30%, rgba(255,255,255,.12));
  border-radius: 32px;
  padding: 36px 10px 10px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.025) 34%, rgba(0,0,0,.18)),
    #111722;
  box-shadow: 0 30px 80px rgba(0,0,0,.38), 0 0 44px color-mix(in srgb, var(--board-glow) 10%, transparent), inset 0 1px rgba(255,255,255,.12);
  isolation: isolate;
}
.ludo-board-shell.color-red { --board-glow: var(--ludo-red); }
.ludo-board-shell.color-green { --board-glow: var(--ludo-green); }
.ludo-board-shell.color-yellow { --board-glow: var(--ludo-yellow); }
.ludo-board-shell.color-blue { --board-glow: var(--ludo-blue); }
.ludo-board-aura { position: absolute; z-index: -1; inset: 8% 12%; border-radius: 35%; background: color-mix(in srgb, var(--board-glow) 18%, transparent); filter: blur(48px); pointer-events: none; }
.ludo-board {
  width: 100%;
  border: 3px solid rgba(255,255,255,.72);
  border-radius: 24px;
  background: #e7ebf2;
  box-shadow: 0 20px 52px rgba(0,0,0,.32), inset 0 0 0 1px rgba(41,49,64,.18);
}
.ludo-cell { overflow: visible; }
.ludo-cell.track,
.ludo-cell.home-lane {
  border-color: rgba(93, 104, 123, .26);
  background: linear-gradient(145deg, #fff, #e9edf4);
  box-shadow: inset 1px 1px rgba(255,255,255,.88), inset -1px -1px rgba(95,105,124,.1);
}
.ludo-cell.track.safe { background: linear-gradient(145deg, #fff, #e8e3fa); }
.ludo-cell.track.start.color-red { background: color-mix(in srgb, var(--ludo-red) 66%, #fff); }
.ludo-cell.track.start.color-green { background: color-mix(in srgb, var(--ludo-green) 68%, #fff); }
.ludo-cell.track.start.color-yellow { background: color-mix(in srgb, var(--ludo-yellow) 68%, #fff); }
.ludo-cell.track.start.color-blue { background: color-mix(in srgb, var(--ludo-blue) 68%, #fff); }
.ludo-cell.home-zone { box-shadow: inset 0 0 44px rgba(0,0,0,.08); }
.ludo-cell.home-zone.color-red { background: linear-gradient(145deg, #d86a78, #b84256); }
.ludo-cell.home-zone.color-green { background: linear-gradient(145deg, #62b995, #31876a); }
.ludo-cell.home-zone.color-yellow { background: linear-gradient(145deg, #e0b65c, #ba8525); }
.ludo-cell.home-zone.color-blue { background: linear-gradient(145deg, #6e92df, #3e65b7); }
.ludo-cell.home-pad { display: grid; place-items: center; }
.home-pad-ring { position: absolute; z-index: 1; inset: -17%; border: 2px solid rgba(255,255,255,.62); border-radius: 50%; background: radial-gradient(circle at 35% 28%, rgba(255,255,255,.35), rgba(15,20,30,.16) 65%); box-shadow: 0 8px 18px rgba(0,0,0,.16), inset 0 0 0 3px rgba(255,255,255,.1); }
.ludo-cell.home-lane { box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.ludo-cell.home-gate { filter: saturate(1.15) brightness(1.04); }
.ludo-cell.ludo-center { background: conic-gradient(from 45deg, #4fa984 0 25%, #d0a141 0 50%, #5279cc 0 75%, #d15969 0); }
.safe-mark { z-index: 1; color: #6d5ac0; font-size: clamp(.5rem, 1.4vw, .9rem); text-shadow: 0 1px #fff; }
.ludo-board-crest { position: absolute; z-index: 6; top: 5px; left: 50%; display: flex; align-items: center; gap: 7px; min-width: 118px; height: 27px; overflow: hidden; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; padding: 3px 9px 3px 4px; color: #fff; background: linear-gradient(145deg, #171d29, #080b11); box-shadow: 0 8px 20px rgba(0,0,0,.3), 0 0 18px rgba(124,92,255,.16); transform: translateX(-50%); pointer-events: none; }
.ludo-board-crest img { width: 20px; height: 20px; border-radius: 6px; object-fit: cover; }
.ludo-board-crest span { color: rgba(255,255,255,.86); font-size: .54rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }

.ludo-token {
  border-width: 2px;
  background: radial-gradient(circle at 34% 24%, rgba(255,255,255,.88) 0 8%, color-mix(in srgb, var(--token) 72%, #fff) 9%, var(--token) 47%, color-mix(in srgb, var(--token) 72%, #05070b) 100%);
  box-shadow: 0 5px 10px rgba(7,10,16,.42), inset 0 2px 2px rgba(255,255,255,.5), inset 0 -2px 3px rgba(0,0,0,.22);
}
.ludo-token span { border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.34); box-shadow: inset 0 1px 2px rgba(0,0,0,.2); }
.ludo-token.valid { z-index: 8; }

.ludo-dice-console {
  grid-template-columns: 140px minmax(0, 1fr) auto;
  min-height: 112px;
  border-radius: 23px;
  padding: 11px 16px;
}
.ludo-dice-stage-wrap { display: flex; align-items: center; gap: 7px; min-width: 0; }
.ludo-dice-readout { display: grid; place-items: center; min-width: 45px; border: 1px solid color-mix(in srgb, var(--player-glow) 36%, transparent); border-radius: 13px; padding: 6px; background: color-mix(in srgb, var(--player-glow) 9%, transparent); }
.ludo-dice-readout small { font-size: .52rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.ludo-dice-readout b { color: #fff; font-size: 1.45rem; line-height: 1; font-variant-numeric: tabular-nums; }
.ludo-dice-copy { display: grid; gap: 2px; }
.ludo-dice-copy > span { color: color-mix(in srgb, var(--player-glow) 68%, #fff); font-size: .62rem; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.ludo-dice-copy > strong { font-size: 1.05rem; }
.ludo-roll-button { min-width: 128px; min-height: 58px; border-radius: 18px; padding: 0 14px; text-align: left; }
.ludo-roll-button > span:first-child { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: rgba(255,255,255,.14); }
.ludo-roll-button > span:last-child { display: grid; gap: 1px; }
.ludo-roll-button strong { color: #fff; font-size: .84rem; }
.ludo-roll-button small { color: rgba(255,255,255,.7); font-size: .6rem; }

.ludo-die.show-1 { --land-x: 0deg; --land-y: 0deg; transform: rotateX(var(--land-x)) rotateY(var(--land-y)); }
.ludo-die.show-2,
.ludo-die.show-3,
.ludo-die.show-4,
.ludo-die.show-5,
.ludo-die.show-6 { --land-x: 0deg; --land-y: 0deg; transform: rotateX(var(--land-x)) rotateY(var(--land-y)); }

.ludo-exit-sheet { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: 20px; }
.ludo-exit-scrim { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(3, 6, 12, .7); backdrop-filter: blur(9px); }
.ludo-exit-sheet > section { position: relative; display: grid; justify-items: center; width: min(440px, 100%); border: 1px solid rgba(151, 130, 238, .35); border-radius: 28px; padding: 28px; color: var(--ludo-copy); background: linear-gradient(145deg, #1a2030, #0e131c); box-shadow: 0 30px 90px rgba(0,0,0,.55); text-align: center; }
.ludo-exit-icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 13px; border: 1px solid rgba(149,127,240,.36); border-radius: 21px; color: #b8a7ff; background: var(--ludo-purple-soft); }
.ludo-exit-icon svg { width: 29px; height: 29px; }
.ludo-exit-sheet h3 { margin: 2px 0 7px; font-size: 1.7rem; letter-spacing: -.045em; }
.ludo-exit-sheet p:not(.eyebrow) { max-width: 350px; margin: 0; color: var(--ludo-muted); line-height: 1.55; }
.ludo-exit-sheet > section > div { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; width: 100%; margin-top: 22px; }
.ludo-exit-sheet > section > div button { justify-content: center; min-height: 48px; }
.ludo-confirm-leave { grid-column: 1 / -1; min-height: 46px; border: 1px solid rgba(239, 85, 108, .35); border-radius: 14px; color: #ff9baa; background: rgba(225, 55, 82, .09); font-weight: 850; }
.ludo-exit-sheet > section > small { margin-top: 14px; color: var(--ludo-muted); font-size: .67rem; letter-spacing: .08em; text-transform: uppercase; }

body.day-mode .ludo-layer .game-dialog { background: radial-gradient(circle at 50% -10%, rgba(124,92,255,.1), transparent 30rem), #eef2f7; }
body.day-mode :is(.ludo-room-sidebar, .ludo-dice-console, .ludo-turn-banner) { border-color: #d9e1ea; background: linear-gradient(145deg, #fff, #f8faff); }
body.day-mode .ludo-player-card { border-color: #e4e9f0; background: linear-gradient(135deg, #fff, #f4f7fb); }
body.day-mode .ludo-board-shell { border-color: #d5dce6; background: linear-gradient(145deg, #fff, #e8edf5); box-shadow: 0 18px 44px rgba(29,42,62,.16), 0 0 32px color-mix(in srgb, var(--board-glow) 8%, transparent); }
body.day-mode .ludo-board { border-color: #fff; }
body.day-mode .ludo-dice-readout b { color: #17212b; }
body.day-mode .ludo-exit-sheet > section { border-color: #d6cdef; background: linear-gradient(145deg, #fff, #f4f1fc); box-shadow: 0 24px 70px rgba(38,45,65,.25); }

/* Match loading, material depth, and game feel --------------------------- */
.ludo-loading {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: min(660px, calc(100dvh - 210px));
  padding: 34px 18px;
  color: var(--ludo-copy);
  text-align: center;
}
.ludo-loading-mark { position: relative; width: 92px; height: 92px; margin-bottom: 20px; }
.ludo-loading-mark img { position: relative; z-index: 2; width: 100%; height: 100%; border: 1px solid rgba(183,145,255,.46); border-radius: 27px; object-fit: cover; box-shadow: 0 20px 46px rgba(61,33,128,.38); }
.ludo-loading-mark span { position: absolute; z-index: 1; inset: -12px; border: 2px solid rgba(137,105,255,.16); border-top-color: #9f87ff; border-radius: 31px; animation: ludo-loading-spin 1.15s linear infinite; }
.ludo-loading h3 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.35rem); letter-spacing: -.05em; }
.ludo-loading > p:not(.eyebrow) { max-width: 430px; margin: 8px 0 23px; color: var(--ludo-muted); line-height: 1.55; }
.ludo-loading-table { position: relative; display: grid; grid-template-columns: repeat(2, 1fr); width: min(290px, 78vw); aspect-ratio: 1.75; overflow: hidden; border: 1px solid rgba(159,135,247,.28); border-radius: 24px; padding: 12px; background: linear-gradient(145deg, #242033, #111620); box-shadow: 0 22px 55px rgba(0,0,0,.28); }
.ludo-loading-table i { background: linear-gradient(120deg, rgba(255,255,255,.035) 25%, rgba(255,255,255,.11) 44%, rgba(255,255,255,.035) 65%); background-size: 240% 100%; animation: ludo-shimmer 1.35s ease-in-out infinite; }
.ludo-loading-table i:nth-child(1) { border-radius: 13px 0 0; }
.ludo-loading-table i:nth-child(2) { border-radius: 0 13px 0 0; }
.ludo-loading-table i:nth-child(3) { border-radius: 0 0 0 13px; }
.ludo-loading-table i:nth-child(4) { border-radius: 0 0 13px; }
.ludo-loading-table b { position: absolute; top: 50%; left: 50%; width: 42px; height: 42px; border: 7px solid #eee9ff; border-radius: 13px; background: #7c5cff; box-shadow: 0 9px 24px rgba(57,32,130,.42); transform: translate(-50%,-50%) rotate(45deg); }
.ludo-loading > small { display: flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--ludo-muted); }
.ludo-loading > small span { width: 8px; height: 8px; border-radius: 50%; background: #62cdb7; box-shadow: 0 0 0 5px rgba(98,205,183,.1); animation: ludo-live-pulse 1.6s ease-in-out infinite; }
body.day-mode .ludo-loading-table { background: linear-gradient(145deg, #fff, #e9edf5); }

.ludo-ambient-particles { position: absolute; z-index: -1; inset: 0; overflow: hidden; pointer-events: none; }
.ludo-ambient-particles i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: rgba(157,127,255,.42); box-shadow: 0 0 14px rgba(124,92,255,.65); animation: ludo-ambient-float 7s ease-in-out infinite; }
.ludo-ambient-particles i:nth-child(1) { top: 8%; left: 30%; }
.ludo-ambient-particles i:nth-child(2) { top: 24%; right: 6%; animation-delay: -2.2s; }
.ludo-ambient-particles i:nth-child(3) { top: 66%; left: 17%; animation-delay: -4.1s; }
.ludo-ambient-particles i:nth-child(4) { right: 22%; bottom: 8%; animation-delay: -1.1s; }
.ludo-ambient-particles i:nth-child(5) { top: 43%; left: 48%; animation-delay: -5.3s; }
.ludo-ambient-particles i:nth-child(6) { top: 13%; right: 35%; animation-delay: -3.3s; }
.ludo-ambient-particles i:nth-child(7) { left: 40%; bottom: 2%; animation-delay: -6s; }

.ludo-player-card-copy { display: grid; gap: 2px; min-width: 0; }
.ludo-piece-bank { display: flex; gap: 4px; margin-top: 5px; }
.ludo-piece-bank i { position: relative; width: 11px; height: 11px; border: 1px solid color-mix(in srgb, var(--player-color) 58%, #fff); border-radius: 50%; background: radial-gradient(circle at 32% 25%, #fff 0 8%, color-mix(in srgb, var(--player-color) 74%, #fff) 10%, var(--player-color) 62%, color-mix(in srgb, var(--player-color) 66%, #05070b)); box-shadow: 0 2px 4px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.45); opacity: .38; }
.ludo-piece-bank i.on-board { opacity: 1; transform: translateY(-1px); }
.ludo-piece-bank i.complete { opacity: 1; box-shadow: 0 0 0 2px rgba(255,255,255,.12), 0 0 10px color-mix(in srgb, var(--player-color) 62%, transparent); }
.ludo-piece-bank i.complete::after { position: absolute; inset: 2px; border-radius: 50%; background: #fff; content: ""; opacity: .78; }
.ludo-player-state { position: relative; }
.ludo-player-card.active .ludo-player-state::after { position: absolute; inset: -4px; border: 1px solid var(--player-color); border-radius: 12px; content: ""; animation: ludo-live-pulse 1.7s ease-out infinite; }

.ludo-turn-banner { grid-template-columns: 44px minmax(0, 1fr) auto; }
.ludo-turn-avatar { position: relative; z-index: 1; width: 42px; height: 42px; border-radius: 14px; padding: 2px; background: conic-gradient(var(--player-color), transparent 38%, var(--player-color)); box-shadow: 0 7px 18px color-mix(in srgb, var(--player-color) 25%, transparent); animation: ludo-turn-ring 3s linear infinite; }
.ludo-turn-avatar img { display: block; width: 100%; height: 100%; border: 2px solid #161c27; border-radius: 12px; object-fit: cover; animation: ludo-turn-ring-reverse 3s linear infinite; }
.ludo-turn-avatar i { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border: 2px solid #161c27; border-radius: 50%; background: #62cdb7; }

.ludo-board-shell {
  background:
    linear-gradient(90deg, rgba(255,255,255,.045), transparent 18%, rgba(0,0,0,.12) 43%, rgba(255,255,255,.03) 72%, transparent),
    repeating-linear-gradient(4deg, rgba(255,255,255,.025) 0 1px, transparent 1px 9px),
    linear-gradient(145deg, #34281f, #191511 48%, #292019);
  box-shadow: 0 34px 90px rgba(0,0,0,.48), 0 0 48px color-mix(in srgb, var(--board-glow) 11%, transparent), inset 0 1px rgba(255,255,255,.18), inset 0 -7px 15px rgba(0,0,0,.28);
  transform: translateZ(0);
}
.ludo-board-shell::after { position: absolute; inset: 7px; z-index: -1; border: 1px solid rgba(223,183,126,.1); border-radius: 25px; content: ""; }
.ludo-board { contain: layout paint; transform: translateZ(0); }
.ludo-board {
  position: relative;
  overflow: hidden;
  background: #0a0f19 url("/moose-ludo-board.svg?v=original-logo-2") center / 100% 100% no-repeat;
}
.ludo-board::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.32), inset 0 18px 32px rgba(255,255,255,.06), inset 0 -18px 30px rgba(2,6,23,.16);
  content: "";
  pointer-events: none;
}
.ludo-cell {
  z-index: 2;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
.ludo-cell.ludo-center,
.ludo-cell.home-zone,
.ludo-cell.home-lane,
.ludo-cell.track,
.ludo-cell.track.safe,
.ludo-cell.track.start {
  background: transparent !important;
}
.home-pad-ring,
.safe-mark {
  display: none;
}
.ludo-cell.valid-destination {
  background: rgba(124, 92, 255, .1) !important;
  border-radius: 18%;
}
.ludo-token {
  z-index: calc(8 + var(--stack));
}
.ludo-cell.track,
.ludo-cell.home-lane { border-color: rgba(86,91,105,.31); box-shadow: inset 1px 1px rgba(255,255,255,.95), inset -2px -2px rgba(72,78,91,.12), 0 1px rgba(0,0,0,.05); transition: filter 150ms ease, transform 150ms ease; }
.safe-mark svg { width: 46%; height: 46%; stroke-width: 2.2; filter: drop-shadow(0 1px rgba(255,255,255,.8)); }
.ludo-cell.valid-destination { z-index: 2; filter: brightness(1.07); }
.ludo-destination-ring { position: absolute; z-index: 2; inset: 10%; border: 2px solid #7c5cff; border-radius: 31%; background: rgba(124,92,255,.1); box-shadow: 0 0 0 3px rgba(124,92,255,.12), 0 0 15px rgba(124,92,255,.58), inset 0 0 8px rgba(124,92,255,.2); animation: ludo-destination-pulse 1.1s ease-in-out infinite; pointer-events: none; }
.ludo-token { will-change: transform, filter; }
.ludo-token::before { position: absolute; inset: 8%; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; content: ""; box-shadow: inset 0 -2px 3px rgba(0,0,0,.22); }
.ludo-token.valid:hover { z-index: 12; transform: translate(calc(-50% + var(--stack) * 2px), calc(-58% - var(--stack) * 2px)) scale(1.14); }
.ludo-token.pending { animation: ludo-token-pending .65s ease-in-out infinite; }
.ludo-board .ludo-cell,
.ludo-board .ludo-cell.track,
.ludo-board .ludo-cell.track.safe,
.ludo-board .ludo-cell.track.start,
.ludo-board .ludo-cell.home-zone,
.ludo-board .ludo-cell.home-lane,
.ludo-board .ludo-cell.ludo-center {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
.ludo-board .home-pad-ring,
.ludo-board .safe-mark {
  display: none !important;
}
.ludo-board .ludo-token {
  z-index: calc(8 + var(--stack));
}

.die-face { overflow: hidden; }
.ludo-die.idle { transform: rotateX(-10deg) rotateY(18deg); filter: saturate(.55); opacity: .82; }
.ludo-die.idle .die-face { display: grid; place-items: center; color: #6d5a9f; background: linear-gradient(145deg, #fff, #e7e1f2); }
.ludo-die.idle .die-face > b { position: static; width: auto; height: auto; border: 0; color: #6d5a9f; background: transparent; box-shadow: none; font-size: 1.4rem; }
.die-face > b { position: absolute; z-index: 3; top: 3px; right: 4px; display: grid; place-items: center; width: 14px; height: 14px; border: 1px solid rgba(100,78,170,.18); border-radius: 5px; color: #4b397f; background: rgba(245,242,255,.88); box-shadow: 0 1px 3px rgba(44,34,80,.12); font-size: 9px; line-height: 1; font-variant-numeric: tabular-nums; }
.ludo-die-value { display: none; }
.ludo-dice-console.pending { border-color: color-mix(in srgb, var(--player-glow) 55%, transparent); box-shadow: 0 18px 50px rgba(0,0,0,.2), 0 0 28px color-mix(in srgb, var(--player-glow) 14%, transparent); }
.ludo-dice-console.pending .ludo-roll-button svg { animation: ludo-loading-spin .8s linear infinite; }
.ludo-roll-button:not(:disabled):hover { filter: brightness(1.09); transform: translateY(-2px); }
.ludo-roll-button:not(:disabled):active { transform: translateY(1px) scale(.985); }

.ludo-chat-log article.ludo-system-event { grid-template-columns: 30px minmax(0,1fr); padding: 8px; border: 1px solid rgba(132,111,218,.16); border-radius: 13px; background: rgba(124,92,255,.055); animation: ludo-event-in 230ms ease both; }
.ludo-system-event > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; color: #b5a5f8; background: rgba(124,92,255,.13); }
.ludo-system-event > span svg { width: 15px; height: 15px; }
.ludo-chat-log article.ludo-system-event div { padding: 1px 0 13px; background: transparent; }
.ludo-chat-log article.ludo-system-event p { color: var(--ludo-muted); }

.ludo-reaction-burst.home .ludo-home-burst { position: relative; width: 120px; height: 120px; animation-duration: 1.05s; }
.ludo-home-burst b { display: grid; place-items: center; width: 100%; height: 100%; color: #ffdc70; font-size: 4.2rem; text-shadow: 0 8px 30px rgba(230,177,49,.5); }
.ludo-home-burst i { position: absolute; top: 57px; left: 57px; width: 8px; height: 18px; border-radius: 999px; background: #8e70ff; animation: ludo-particle .95s ease-out forwards; }
.ludo-home-burst i:nth-of-type(1) { --particle-x: 0; --particle-y: -70px; }
.ludo-home-burst i:nth-of-type(2) { --particle-x: 56px; --particle-y: -42px; background: #62cdb7; transform: rotate(48deg); }
.ludo-home-burst i:nth-of-type(3) { --particle-x: 70px; --particle-y: 18px; background: #e8be56; transform: rotate(88deg); }
.ludo-home-burst i:nth-of-type(4) { --particle-x: 32px; --particle-y: 65px; background: #e9677a; transform: rotate(145deg); }
.ludo-home-burst i:nth-of-type(5) { --particle-x: -42px; --particle-y: 58px; background: #62cdb7; transform: rotate(205deg); }
.ludo-home-burst i:nth-of-type(6) { --particle-x: -70px; --particle-y: 3px; background: #e8be56; transform: rotate(260deg); }
.ludo-home-burst i:nth-of-type(7) { --particle-x: -43px; --particle-y: -54px; background: #e9677a; transform: rotate(318deg); }

.ludo-results { position: relative; overflow: hidden; width: min(760px, 100%); min-height: 590px; align-content: center; border: 1px solid rgba(148,124,238,.22); border-radius: 30px; padding: 34px; background: radial-gradient(circle at 50% 8%, rgba(124,92,255,.22), transparent 18rem), linear-gradient(145deg, rgba(28,34,49,.96), rgba(12,16,24,.98)); box-shadow: 0 30px 90px rgba(0,0,0,.34); }
.ludo-winner-avatar { position: relative; z-index: 2; width: 106px; height: 106px; margin-bottom: 9px; padding: 4px; border-radius: 34px; background: linear-gradient(145deg, #ffde76, #8c67ff 65%); box-shadow: 0 20px 46px rgba(102,67,203,.4); }
.ludo-winner-avatar img { display: block; width: 100%; height: 100%; border: 4px solid #111722; border-radius: 30px; object-fit: cover; }
.ludo-winner-avatar span { position: absolute; right: -9px; bottom: -7px; display: grid; place-items: center; width: 39px; height: 39px; border: 3px solid #151a25; border-radius: 13px; color: #2b1f0b; background: #ffd664; box-shadow: 0 8px 20px rgba(0,0,0,.28); }
.ludo-result-stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; width: min(540px,100%); margin: 14px 0 2px; }
.ludo-result-stats span { display: grid; gap: 3px; border: 1px solid var(--ludo-line); border-radius: 15px; padding: 11px; background: rgba(255,255,255,.035); }
.ludo-result-stats b { color: var(--ludo-copy); font-size: 1rem; }
.ludo-result-stats small { color: var(--ludo-muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .07em; }
.ludo-victory-confetti { position: absolute; inset: 0; pointer-events: none; }
.ludo-victory-confetti i { position: absolute; top: -20px; left: calc(5% + (var(--i) * 5.8%)); width: 7px; height: 16px; border-radius: 3px; background: hsl(calc(250 + var(--i) * 19) 82% 65%); animation: ludo-confetti-fall calc(2.5s + (var(--i) * .09s)) ease-in calc(var(--i) * -.13s) infinite; opacity: .76; }
body.day-mode .ludo-results { background: radial-gradient(circle at 50% 8%, rgba(124,92,255,.16), transparent 18rem), linear-gradient(145deg, #fff, #f1f4fa); }
body.day-mode .ludo-winner-avatar img { border-color: #fff; }

@keyframes ludo-loading-spin { to { transform: rotate(360deg); } }
@keyframes ludo-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes ludo-live-pulse { 50% { opacity: .42; transform: scale(1.12); } }
@keyframes ludo-turn-ring { to { transform: rotate(360deg); } }
@keyframes ludo-turn-ring-reverse { to { transform: rotate(-360deg); } }
@keyframes ludo-ambient-float { 50% { opacity: .25; transform: translateY(-24px) scale(.7); } }
@keyframes ludo-destination-pulse { 50% { opacity: .52; transform: scale(.84); } }
@keyframes ludo-token-pending { 50% { filter: brightness(1.35); transform: translate(calc(-50% + var(--stack) * 2px), calc(-57% - var(--stack) * 2px)) scale(1.12); } }
@keyframes ludo-event-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes ludo-confetti-fall { 0% { opacity: 0; transform: translateY(-20px) rotate(0); } 15% { opacity: .8; } 100% { opacity: 0; transform: translateY(620px) rotate(540deg); } }

@keyframes ludo-orbit { to { transform: rotate(360deg); } }
@keyframes ludo-valid-token { 50% { box-shadow: 0 0 0 5px rgba(255,255,255,.75), 0 0 0 9px var(--token), 0 8px 15px rgba(0,0,0,.36); transform: translate(calc(-50% + var(--stack) * 2px), calc(-50% - var(--stack) * 2px)) scale(1.09); } }
@keyframes ludo-dice-roll { 0% { transform: translateY(0) rotateX(0) rotateY(0) rotateZ(0); } 24% { transform: translateY(-25px) rotateX(220deg) rotateY(155deg) rotateZ(80deg); } 62% { transform: translateY(-8px) rotateX(610deg) rotateY(510deg) rotateZ(250deg); } 82% { transform: translateY(-3px) rotateX(680deg) rotateY(590deg) rotateZ(330deg); } 100% { transform: translateY(0) rotateX(calc(720deg + var(--land-x))) rotateY(calc(720deg + var(--land-y))) rotateZ(360deg); } }
@keyframes ludo-dice-shadow { 0%, 100% { opacity: .6; transform: translateY(38px) scale(1); } 30% { opacity: .12; transform: translateY(38px) scale(.55); } }
@keyframes ludo-reaction { 0% { opacity: 0; transform: translateY(30px) scale(.65); } 20% { opacity: 1; transform: translateY(0) scale(1.08); } 72% { opacity: 1; transform: translateY(-25px) scale(1); } 100% { opacity: 0; transform: translateY(-70px) scale(.85); } }
@keyframes ludo-particle { to { opacity: 0; transform: translate(var(--particle-x), var(--particle-y)) scale(.2); } }

@media (max-width: 1180px) {
  .ludo-room { grid-template-columns: minmax(210px, 240px) minmax(430px, 1fr); }
  .ludo-chat-panel { grid-column: 1 / -1; grid-template-rows: auto minmax(120px, 220px) auto auto auto; }
  .ludo-chat-log { max-height: 220px; }
}

@media (max-width: 760px) {
  .ludo-room-sidebar > header .ludo-sidebar-header-actions > button {
    width: 44px;
    height: 44px;
  }
  .ludo-layer .game-dialog { height: calc(var(--app-viewport-height, 100dvh) - env(safe-area-inset-top)); max-height: none; }
  .ludo-layer .game-dialog-header { flex: 0 0 auto; }
  .ludo-layer .game-dialog-header p:last-child { display: none; }
  .ludo-layer .game-dialog-footer { min-height: 64px; }
  .ludo-mode-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 20px; }
  .ludo-mode-card { min-height: 92px; border-radius: 19px; padding: 14px; }
  .ludo-mode-card > span:first-child { width: 48px; height: 48px; border-radius: 15px; }
  .ludo-mini-board, .ludo-game-mark { flex-basis: 58px; width: 58px; height: 58px; border-radius: 18px; }
  .ludo-dialog-identity { grid-template-columns: 44px minmax(0, 1fr); min-height: 44px; column-gap: 10px; }
  .ludo-dialog-identity::before { width: 44px; height: 44px; border-radius: 14px; }
  .ludo-lobby-slots { grid-template-columns: 1fr; }
  .ludo-invite-decision { align-items: stretch; flex-direction: column; }
  .ludo-invite-decision > div > button { flex: 1; }
  .ludo-room-settings { align-items: flex-start; flex-direction: column; }
  .ludo-room-sidebar > header button { width: 44px; height: 44px; }
  .ludo-room {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .ludo-layer .game-dialog-body:has(.ludo-room) { padding: 10px 10px 18px; }
  .ludo-board-stage { order: 1; width: 100%; }
  .ludo-players-panel { order: 2; width: 100%; }
  .ludo-chat-panel { order: 3; width: 100%; max-height: none; }
  .ludo-player-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ludo-player-card { grid-template-columns: 36px minmax(0, 1fr) 24px; min-height: 62px; padding: 7px; }
  .ludo-player-card .ludo-avatar { width: 36px; height: 36px; }
  .ludo-board-shell { width: min(100%, calc(var(--app-viewport-height, 100dvh) - 244px)); min-width: 0; border-radius: 24px; padding: 32px 6px 6px; box-shadow: 0 22px 52px rgba(0,0,0,.36), 0 0 28px color-mix(in srgb, var(--board-glow) 9%, transparent), inset 0 1px rgba(255,255,255,.16); }
  .ludo-board { width: 100%; min-width: 0; border-width: 2px; border-radius: 18px; }
  .ludo-board-crest { top: 4px; min-width: 110px; height: 24px; }
  .ludo-turn-banner { grid-template-columns: 38px minmax(0,1fr) auto; min-height: 62px; padding: 8px 10px; }
  .ludo-turn-avatar { width: 36px; height: 36px; border-radius: 12px; }
  .ludo-turn-avatar img { border-radius: 10px; }
  .ludo-turn-banner small { font-size: .69rem; }
  .ludo-secure-badge { padding: 5px 7px; }
  .ludo-dice-console { grid-template-columns: 108px minmax(0, 1fr) 104px; min-height: 92px; gap: 9px; padding: 8px 10px; }
  .ludo-dice-stage-wrap { gap: 2px; }
  .ludo-dice-stage { width: 60px; height: 62px; transform: scale(.8); }
  .ludo-dice-readout { min-width: 40px; padding: 5px 4px; }
  .ludo-dice-readout b { font-size: 1.25rem; }
  .ludo-roll-button { min-width: 98px; min-height: 50px; padding: 0 9px; }
  .ludo-roll-button > span:first-child { width: 30px; height: 30px; }
  .ludo-exit-sheet { align-items: end; padding: 10px; }
  .ludo-exit-sheet > section { border-radius: 26px 26px 20px 20px; padding: 24px 18px calc(20px + env(safe-area-inset-bottom)); }
  .ludo-chat-form input, .ludo-friend-search input { font-size: 16px; }
  .ludo-chat-log { max-height: 240px; }
  .ludo-chat-log article.ludo-system-event { padding: 7px; }
  .ludo-loading { min-height: calc(var(--app-viewport-height, 100dvh) - 190px); }
  .ludo-loading-table { width: min(250px, 76vw); }
  .ludo-results { min-height: 0; border-radius: 24px; padding: 28px 15px; }
  .ludo-result-stats { gap: 6px; }
  .ludo-result-stats span { padding: 9px 5px; }
  .ludo-result-actions { display: grid; width: 100%; }
  .ludo-result-actions button { width: 100%; }
  .message-game-card { min-width: 0; }
}

@media (max-width: 390px) {
  .ludo-mode-intro p, .ludo-setup-head p { font-size: .76rem; }
  .ludo-player-list { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; padding: 8px; }
  .ludo-player-card { grid-template-columns: 32px minmax(0,1fr); min-height: 57px; }
  .ludo-player-card .ludo-avatar { width: 32px; height: 32px; }
  .ludo-player-state { display: none !important; }
  .ludo-player-card small { font-size: .61rem; }
  .ludo-piece-bank { gap: 3px; }
  .ludo-piece-bank i { width: 9px; height: 9px; }
  .ludo-board-shell { width: 100%; min-width: 0; }
  .ludo-turn-banner { grid-template-columns: 34px minmax(0, 1fr); }
  .ludo-turn-avatar { width: 32px; height: 32px; }
  .ludo-secure-badge { display: none; }
  .ludo-dice-console { grid-template-columns: 98px minmax(0, 1fr) 92px; gap: 7px; }
  .ludo-dice-copy > span, .ludo-dice-copy > small, .ludo-roll-button small, .ludo-dice-readout small { display: none; }
  .ludo-dice-stage { width: 54px; transform: scale(.72); }
  .ludo-dice-readout { min-width: 34px; }
  .ludo-roll-button { min-width: 88px; padding: 0 7px; }
  .ludo-exit-sheet > section > div { grid-template-columns: 1fr; }
  .ludo-confirm-leave { grid-column: 1; }
}

@media (min-width: 761px) and (hover: hover) {
  .ludo-cell.track:hover { z-index: 2; filter: brightness(1.08); transform: translateY(-1px); }
}

@media (min-width: 761px) and (min-height: 781px) and (max-height: 950px) {
  .ludo-board-stage {
    gap: 8px;
  }

  .ludo-board-shell {
    width: min(100%, calc(100dvh - 440px));
    max-width: 510px;
  }

  .ludo-turn-banner {
    min-height: 58px;
    padding-block: 7px;
  }

  .ludo-dice-console {
    min-height: 88px;
  }
}

@media (min-width: 761px) and (max-height: 780px) {
  .ludo-layer .game-dialog-body:has(.ludo-room) { overflow: hidden; padding: 4px 12px; }
  .ludo-room { grid-template-columns: minmax(190px, 230px) minmax(410px, 1fr); gap: 12px; height: calc(100% - 12px); }
  .ludo-chat-panel { display: none; }
  .ludo-board-stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(176px, 220px); grid-template-rows: auto minmax(0, 1fr); align-items: center; gap: 6px 12px; height: 100%; }
  .ludo-board-shell { grid-column: 1; grid-row: 2; width: min(100%, calc(100dvh - 300px)); max-height: calc(100dvh - 300px); }
  .ludo-turn-banner,
  .ludo-dice-console { width: 100%; }
  .ludo-turn-banner { grid-column: 1 / -1; grid-row: 1; min-height: 52px; padding-block: 6px; }
  .ludo-dice-console { grid-column: 2; grid-row: 2; grid-template-columns: 1fr; align-content: center; justify-items: center; min-height: 0; padding: 14px 10px; text-align: center; }
  .ludo-dice-copy { justify-items: center; }
  .ludo-roll-button { width: 100%; min-width: 0; }
  .ludo-players-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; height: 100%; max-height: 100%; }
  .ludo-player-list { max-height: none; overflow: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .ludo-layer *,
  .message-game-card * { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
