/*
 * שש־בש קלאסי · BlumSoft IL
 * © 2026 Robert Blumenthal. All rights reserved.
 * Copying or redistribution without written permission is prohibited.
 */

:root {
  color-scheme: light;
  --ink: #2f211b;
  --muted: #75635a;
  --white: #f6edcf;
  --white-deep: #d5c49a;
  --black: #181716;
  --black-soft: #363331;
  --wine: #8d332b;
  --wine-dark: #5d1f1b;
  --tan: #dec898;
  --gold: #e0ad48;
  --wood: #6b3822;
  --wood-dark: #2f160f;
  --felt: #b99768;
  --blue: #0b5881;
  --green: #16805c;
  --danger: #9d2f2b;
  --shadow: 0 18px 50px rgba(28, 12, 7, .32);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-height: 100%;
  background: #1d100c;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: "Heebo", "Assistant", Arial, system-ui, sans-serif;
  background:
    radial-gradient(circle at 16% 6%, rgba(255,255,255,.12), transparent 23%),
    radial-gradient(circle at 80% 14%, rgba(232,182,76,.13), transparent 25%),
    linear-gradient(150deg, #efe4cc 0%, #d8c3a3 42%, #c7a982 100%);
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; }
button { touch-action: manipulation; }
a { color: #0c5b84; font-weight: 800; }

.game-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 70px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #fff8e8;
  border-bottom: 1px solid rgba(255,255,255,.18);
  background:
    linear-gradient(90deg, rgba(255,255,255,.05), transparent 18%, rgba(0,0,0,.1)),
    linear-gradient(145deg, #633420, #30170f);
  box-shadow: 0 7px 20px rgba(45, 20, 12, .28);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 13px;
  color: #3a2117;
  font-size: 23px;
  font-weight: 950;
  background: linear-gradient(145deg, #f2d98c, #c68d31);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.75), 0 5px 12px rgba(0,0,0,.25);
}

.brand strong { display: block; font-size: 21px; line-height: 1.05; letter-spacing: -.25px; }
.brand small { display: block; margin-top: 4px; color: #dbcbbd; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.header-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 13px;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  background: rgba(255,255,255,.09);
  box-shadow: inset 0 1px rgba(255,255,255,.12);
}
.icon-btn:hover { background: rgba(255,255,255,.16); }
.language-btn { width: auto; min-width: 48px; padding-inline: 9px; font-size: 13px; font-weight: 900; }
.icon-btn:focus-visible, button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid #f4bd4e;
  outline-offset: 3px;
}

.game-layout {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px 18px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 350px);
  gap: 22px;
  align-items: start;
}

.table-zone { min-width: 0; }

.turn-banner {
  min-height: 48px;
  margin: 0 0 10px;
  padding: 9px 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(86,45,25,.18);
  border-radius: 14px;
  background: rgba(255,250,239,.78);
  box-shadow: 0 6px 20px rgba(65,34,20,.1);
  backdrop-filter: blur(9px);
}
.turn-banner strong { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn-banner.awaiting-roll {
  border-color: rgba(190,118,20,.78);
  animation: turnAwaitingRoll 1.08s ease-in-out infinite;
}
.presence-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; box-shadow: 0 0 0 4px rgba(22,128,92,.12); background: var(--green); }
.presence-dot.offline { box-shadow: 0 0 0 4px rgba(117,99,90,.1); background: #8a7d76; }
.presence-dot.connecting { box-shadow: 0 0 0 4px rgba(224,173,72,.16); background: var(--gold); animation: pulse 1s infinite; }
.move-clock { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.move-clock b { color: var(--wine-dark); }

.board-frame {
  position: relative;
  padding: clamp(9px, 1.5vw, 18px);
  border: 1px solid #2c140d;
  border-radius: clamp(15px, 2vw, 24px);
  background:
    repeating-linear-gradient(93deg, rgba(255,255,255,.045) 0 2px, rgba(0,0,0,.045) 2px 5px, transparent 5px 14px),
    radial-gradient(ellipse at 50% 0, rgba(255,215,149,.25), transparent 42%),
    linear-gradient(145deg, #8d5131 0%, #4a2417 45%, #753d25 100%);
  box-shadow:
    inset 0 0 0 3px rgba(255,211,141,.18),
    inset 0 -8px 15px rgba(31,11,5,.38),
    var(--shadow);
}
.move-traces {
  position: absolute;
  z-index: 12;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.move-trace {
  fill: none;
  stroke: #ffcf4e;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 2px rgba(31, 13, 6, .85));
}
.move-trace.black { stroke: #7ee6ff; }
.move-trace-dot {
  fill: #fff8d4;
  stroke: #5a2918;
  stroke-width: 2;
  filter: drop-shadow(0 2px 2px rgba(31, 13, 6, .72));
}

.board-frame::before,
.board-frame::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: inherit;
}
.board-frame::before { inset: 4px; border: 1px solid rgba(255,223,177,.28); }
.board-frame::after { inset: 10px; border: 1px solid rgba(37,14,8,.36); }

.board-and-off {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(44px, 7vw, 78px);
  aspect-ratio: 1.72 / 1;
  min-height: 0;
  overflow: hidden;
  border: 2px solid #2c150f;
  border-radius: clamp(7px, 1vw, 13px);
  background: #5f3422;
  box-shadow: inset 0 0 18px rgba(0,0,0,.55), 0 2px 2px rgba(255,255,255,.22);
}

.playing-surface {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) minmax(24px, .8fr) repeat(6, minmax(0, 1fr));
  grid-template-rows: 1fr 1fr;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(70,35,21,.14), transparent 48%, rgba(255,255,255,.08)),
    repeating-linear-gradient(0deg, rgba(255,255,255,.023) 0 1px, transparent 1px 4px),
    linear-gradient(145deg, #c7aa7b, #ae8b5d);
  box-shadow: inset 0 0 25px rgba(45,22,12,.32);
  user-select: none;
  touch-action: none;
}

.playing-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 28% 30%, rgba(255,255,255,.1), transparent 32%), radial-gradient(circle at 73% 74%, rgba(58,25,14,.1), transparent 36%);
  mix-blend-mode: soft-light;
}

.point {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  cursor: default;
  background: transparent;
  isolation: isolate;
}
.point::before {
  content: "";
  position: absolute;
  left: 2%;
  width: 96%;
  height: 91%;
  z-index: -1;
  filter: drop-shadow(0 2px 1px rgba(42,20,11,.24));
}
.point.top::before { top: 0; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.point.bottom::before { bottom: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.point.wine::before { background: linear-gradient(90deg, #67231e, #9b3c31 48%, #5a1d19); }
.point.tan::before { background: linear-gradient(90deg, #c8aa72, #f0dca9 48%, #b69158); }
.point.last-move::before { filter: drop-shadow(0 0 7px rgba(255,210,91,.9)); }
.point.legal-target::after,
.off-zone.legal-target::after {
  content: "";
  position: absolute;
  z-index: 8;
  pointer-events: none;
  border: 3px solid #0b9a72;
  border-radius: 12px;
  box-shadow: 0 0 0 3px rgba(255,255,255,.72), 0 0 18px rgba(10,145,106,.75);
  animation: legalGlow 1.15s ease-in-out infinite alternate;
}
.point.legal-target::after { inset: 7% 8%; }
.off-zone.legal-target::after { inset: 7px; }
.point.selected::after,
.bar-zone.selected::after {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: 7;
  pointer-events: none;
  border: 3px solid #f1bd4b;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(241,189,75,.8);
}

.point-number {
  position: absolute;
  left: 50%;
  z-index: 5;
  transform: translateX(-50%);
  color: rgba(53,31,21,.66);
  font-size: clamp(7px, .75vw, 11px);
  font-weight: 900;
  pointer-events: none;
}
.top .point-number { top: 2px; }
.bottom .point-number { bottom: 2px; }

.checker-stack {
  position: absolute;
  inset-inline: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  padding-inline: 5%;
  pointer-events: none;
}
.top .checker-stack { top: 3%; flex-direction: column; }
.bottom .checker-stack { bottom: 3%; flex-direction: column-reverse; }

.checker,
.mini-checker {
  position: relative;
  display: block;
  flex: 0 0 auto;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(30,20,12,.58);
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,.14),
    inset 0 -4px 8px rgba(0,0,0,.24),
    0 3px 4px rgba(36,18,10,.48);
}
.checker::before,
.mini-checker::before {
  content: "";
  position: absolute;
  inset: 13%;
  border: 1px solid rgba(79,54,31,.35);
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.42), inset 0 -2px 3px rgba(0,0,0,.17);
}
.checker.white,
.mini-checker.white { background: radial-gradient(circle at 34% 25%, #fffdf2 0 13%, #f3e7c4 38%, #c6b080 78%, #8f784e 100%); }
.checker.black,
.mini-checker.black { border-color: #080706; background: radial-gradient(circle at 34% 24%, #696461 0 8%, #302e2d 36%, #141312 73%, #050505 100%); }
.checker.black::before,
.mini-checker.black::before { border-color: rgba(255,255,255,.16); }
.checker {
  width: min(87%, 48px);
  min-width: 13px;
  pointer-events: auto;
  color: #201710;
  font-size: clamp(8px, 1.2vw, 13px);
  font-weight: 950;
  line-height: 1;
  touch-action: none;
}
.checker.black { color: #fff7df; }
.checker + .checker { margin-top: clamp(-10px, -1.15vw, -3px); }
.bottom .checker + .checker { margin-top: 0; margin-bottom: clamp(-10px, -1.15vw, -3px); }
.checker.movable { cursor: grab; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18), inset 0 -4px 8px rgba(0,0,0,.23), 0 0 0 3px rgba(16,132,94,.74), 0 4px 8px rgba(32,14,8,.54); }
.checker.movable:active { cursor: grabbing; }
.checker-count {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  text-shadow: 0 1px rgba(255,255,255,.55);
}
.black .checker-count { text-shadow: 0 1px #000; }

.board-bar {
  position: relative;
  z-index: 4;
  grid-column: 7;
  grid-row: 1 / 3;
  display: grid;
  grid-template-rows: 1fr 1fr;
  border-inline: 1px solid rgba(43,18,10,.58);
  background:
    repeating-linear-gradient(92deg, rgba(255,255,255,.08) 0 1px, rgba(0,0,0,.07) 1px 4px, transparent 4px 10px),
    linear-gradient(90deg, #4c2417, #7b452d 50%, #3e1c12);
  box-shadow: inset 0 0 8px rgba(0,0,0,.52), 0 0 8px rgba(44,20,12,.26);
}
.bar-zone {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 2px;
}
.bar-zone:first-child { align-items: flex-start; }
.bar-zone:last-child { align-items: flex-end; }
.bar-stack { width: 100%; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.bar-zone:last-child .bar-stack { flex-direction: column-reverse; }
.bar-stack .checker { width: min(78%, 42px); }
.bar-label {
  position: absolute;
  inset-inline: 0;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  color: rgba(255,239,218,.54);
  font-size: clamp(7px, .7vw, 10px);
  font-weight: 900;
  letter-spacing: .13em;
  text-align: center;
  pointer-events: none;
}

.off-tray {
  position: relative;
  display: grid;
  grid-template-rows: 1fr 1fr;
  padding: 5px;
  gap: 5px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 2px, rgba(0,0,0,.05) 2px 5px, transparent 5px 12px),
    linear-gradient(145deg, #6f3a24, #3b1b12);
  box-shadow: inset 8px 0 14px rgba(0,0,0,.3);
}
.off-zone {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 7px;
  background: rgba(20,7,3,.23);
}
.off-stack { position: absolute; inset: 5px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.off-zone:last-child .off-stack { flex-direction: column-reverse; }
.off-piece {
  width: 74%;
  height: clamp(7px, 1.25vw, 13px);
  flex: 0 0 auto;
  margin-bottom: 2px;
  border: 1px solid rgba(0,0,0,.52);
  border-radius: 50%;
  box-shadow: inset 0 2px 2px rgba(255,255,255,.3), 0 2px 2px rgba(0,0,0,.35);
}
.off-zone:last-child .off-piece { margin: 2px 0 0; }
.off-piece.white { background: linear-gradient(#fff5d9, #bca370); }
.off-piece.black { background: linear-gradient(#514d49, #090909); }
.off-count {
  position: absolute;
  inset-inline-end: 4px;
  top: 4px;
  z-index: 5;
  min-width: 22px;
  padding: 2px 5px;
  border-radius: 99px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  background: rgba(0,0,0,.58);
}

.drag-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  margin: 0 !important;
  opacity: .94;
  transform: translate(-50%, -50%) scale(1.13);
  filter: drop-shadow(0 12px 9px rgba(0,0,0,.46));
}

.board-help { margin: 13px 4px 0; color: #5f5048; font-size: 13px; text-align: center; }

.control-panel { display: grid; gap: 12px; position: sticky; top: 92px; }
.players-card, .dice-card, .room-card {
  border: 1px solid rgba(79,43,27,.16);
  border-radius: 18px;
  background: rgba(255,250,239,.88);
  box-shadow: 0 10px 28px rgba(70,35,20,.13);
  backdrop-filter: blur(10px);
}
.players-card { overflow: hidden; }
.player-row { min-height: 74px; padding: 10px 12px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 10px; align-items: center; }
.player-row + .player-row { border-top: 1px solid rgba(82,48,31,.12); }
.player-row.your-turn { box-shadow: inset 5px 0 var(--gold); background: linear-gradient(90deg, rgba(226,174,69,.17), transparent); }
.player-row.disconnected { opacity: .58; }
.mini-checker { width: 39px; }
.player-copy { min-width: 0; }
.player-copy strong { display: block; overflow: hidden; color: #38251c; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.player-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.wins { min-width: 48px; text-align: center; }
.wins b { display: block; color: var(--wine-dark); font-size: 24px; line-height: 1; }
.wins small { color: var(--muted); font-size: 9px; }

.dice-card { padding: 18px; text-align: center; }
.dice-stage { min-height: 83px; display: flex; align-items: center; justify-content: center; gap: 17px; perspective: 500px; direction: ltr; }
.die {
  width: 64px;
  height: 64px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  border: 1px solid #b69e75;
  border-radius: 15px;
  background: linear-gradient(145deg, #fffdf5 0%, #efe3c8 68%, #c7b48c 100%);
  box-shadow: inset 0 2px 2px #fff, inset 0 -5px 8px rgba(99,75,42,.18), 0 7px 9px rgba(45,24,15,.28);
  transform: rotate(-3deg);
}
.die:nth-child(2) { transform: rotate(4deg); }
.die.empty { opacity: .42; }
.pip { width: 10px; height: 10px; place-self: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #604039, #190f0d 70%); box-shadow: inset 0 1px 2px rgba(0,0,0,.75), 0 1px rgba(255,255,255,.65); }
.die.rolling { animation: diceRoll .62s cubic-bezier(.2,.7,.2,1); }
.remaining { min-height: 28px; margin: 8px 0 12px; color: var(--muted); font-size: 12px; }
.remaining .die-chip { display: inline-grid; place-items: center; min-width: 25px; height: 25px; margin: 0 2px; border: 1px solid #c8b184; border-radius: 7px; color: #43271c; font-weight: 900; background: #fff9e9; box-shadow: 0 2px 4px rgba(64,35,21,.16); }

.primary-btn, .secondary-btn, .text-btn, .resume-btn {
  border-radius: 12px;
  cursor: pointer;
  font-weight: 900;
}
.primary-btn {
  width: 100%;
  min-height: 48px;
  padding: 11px 18px;
  border: 1px solid #3a1b11;
  color: #fff9ed;
  background: linear-gradient(#7d4228, #4b2417);
  box-shadow: inset 0 1px rgba(255,255,255,.18), 0 5px 11px rgba(54,25,14,.26);
}
.primary-btn:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.primary-btn:disabled { cursor: not-allowed; opacity: .45; filter: grayscale(.2); }
.roll-btn.awaiting-roll:not(:disabled) {
  border-color: #f3bf4d;
  outline: 3px solid rgba(241,181,58,.36);
  outline-offset: 3px;
  animation: rollButtonAwaiting 1.08s ease-in-out infinite;
}
.secondary-btn {
  min-height: 39px;
  padding: 8px 14px;
  border: 1px solid #bfa77d;
  color: #4b2b1f;
  background: #fff9eb;
}
.secondary-btn:hover:not(:disabled) { background: #fff; }
.secondary-btn:disabled { cursor: not-allowed; opacity: .45; }
.text-btn { min-height: 38px; padding: 7px 12px; border: 0; color: #5a463d; background: transparent; }
.text-btn.danger { color: var(--danger); }
.text-btn:disabled { cursor: not-allowed; opacity: .45; }

.room-card { padding: 16px; text-align: center; }
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.room-code { direction: ltr; min-height: 42px; color: #4d2719; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 31px; font-weight: 950; letter-spacing: .16em; font-variant-numeric: tabular-nums; }
.room-card p:not(.eyebrow) { min-height: 36px; margin: 6px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.room-actions { display: flex; justify-content: center; gap: 8px; }
.game-actions { display: flex; align-items: center; justify-content: center; gap: 6px; }

.lobby-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  min-height: var(--app-height, 100dvh);
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  overflow: auto;
  background: rgba(27,13,9,.66);
  backdrop-filter: blur(10px);
}
.lobby-card {
  width: min(100%, 470px);
  padding: 27px;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 24px;
  background: linear-gradient(155deg, #fffdf7, #f2e5cc);
  box-shadow: 0 26px 70px rgba(20,7,3,.48);
}
.lobby-logo { height: 58px; display: flex; justify-content: center; direction: ltr; }
.lobby-logo .mini-checker { width: 52px; margin: 0 -5px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.16), inset 0 -5px 8px rgba(0,0,0,.24), 0 7px 12px rgba(42,21,12,.3); }
.lobby-logo .mini-checker:last-child { transform: translateY(7px); }
.lobby-card h1 { margin: 12px 0 7px; color: #4b2518; font-size: 31px; text-align: center; }
.lobby-card > p { margin: 0 auto 19px; color: var(--muted); font-size: 14px; line-height: 1.55; text-align: center; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 17px; padding: 5px; border-radius: 14px; background: #e5d6bc; }
.mode-switch button { min-height: 42px; border: 0; border-radius: 10px; color: #694b3c; font-weight: 900; cursor: pointer; background: transparent; }
.mode-switch button.active { color: #fff; background: #5a2d1d; box-shadow: 0 4px 10px rgba(53,25,15,.25); }
.lobby-card label { display: block; margin: 11px 2px 6px; color: #4d3328; font-size: 13px; font-weight: 850; }
.lobby-card input:not([type="radio"]) { width: 100%; min-height: 49px; padding: 10px 13px; border: 1px solid #c8b28d; border-radius: 12px; color: #35241c; background: rgba(255,255,255,.78); }
.gender-picker {
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  border: 0;
}
.gender-picker legend { width: 100%; margin: 0 2px 6px; padding: 0; color: #4d3328; font-size: 13px; font-weight: 850; }
.gender-picker label { position: relative; margin: 0; display: block; cursor: pointer; }
.gender-picker input { position: absolute; opacity: 0; pointer-events: none; }
.gender-picker span {
  min-height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid #c8b28d;
  border-radius: 11px;
  color: #5f463a;
  background: rgba(255,255,255,.6);
}
.gender-picker input:checked + span { border-color: #6d3924; color: #fff; background: #5a2d1d; box-shadow: 0 4px 10px rgba(53,25,15,.2); }
.gender-picker input:focus-visible + span { outline: 3px solid #f4bd4e; outline-offset: 2px; }
.field-hint { margin: 6px 2px 0 !important; color: var(--muted) !important; font-size: 11px !important; line-height: 1.45 !important; }
#joinCode { direction: ltr; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 23px; font-weight: 900; letter-spacing: .22em; text-align: center; }
.form-error { min-height: 22px; margin: 7px 0 !important; color: var(--danger) !important; font-size: 12px !important; text-align: center; }
.resume-btn { width: 100%; min-height: 44px; margin-top: 10px; border: 1px solid #9a814f; color: #4d331d; background: #f5dea2; }
.lobby-links { margin: 16px 0 0 !important; font-size: 12px !important; }

dialog {
  width: min(92vw, 560px);
  max-height: min(84vh, 740px);
  padding: 25px;
  overflow: auto;
  border: 1px solid #dbc59e;
  border-radius: 22px;
  color: var(--ink);
  background: #fffaf0;
  box-shadow: 0 28px 80px rgba(24,9,4,.55);
}
dialog::backdrop { background: rgba(30,13,8,.66); backdrop-filter: blur(5px); }
dialog h2 { margin: 0 0 11px; color: #50281b; }
dialog p, dialog li { font-size: 14px; line-height: 1.65; }
dialog ul { padding-inline-start: 22px; }
.dialog-close { position: absolute; inset-inline-end: 11px; top: 9px; width: 38px; height: 38px; border: 0; border-radius: 50%; color: #6b4c3d; font-size: 27px; cursor: pointer; background: transparent; }
.dialog-links { display: grid; gap: 8px; }
.die-dialog { width: min(90vw, 400px); text-align: center; }
.die-choice { display: flex; justify-content: center; gap: 12px; margin: 16px 0; direction: ltr; }
.die-choice button { width: 58px; height: 58px; border: 1px solid #bda577; border-radius: 14px; color: #3d241a; font-size: 23px; font-weight: 950; cursor: pointer; background: #fff7e5; box-shadow: 0 5px 9px rgba(62,34,21,.2); }

.toast {
  position: fixed;
  z-index: 300;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  max-width: min(90vw, 520px);
  padding: 11px 17px;
  border-radius: 99px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 18px);
  transition: .22s ease;
  background: rgba(47,28,20,.94);
  box-shadow: 0 10px 25px rgba(28,12,7,.35);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.game-footer { max-width: 1440px; margin: 16px auto 0; padding: 21px 18px 30px; color: #604b41; font-size: 12px; line-height: 1.8; text-align: center; border-top: 1px solid rgba(74,38,22,.18); }

.unauthorized {
  min-height: 100vh;
  padding: 30px 18px;
  display: grid;
  place-items: center;
  text-align: center;
  background: linear-gradient(145deg, #f3e8d5, #d9c09a);
}
.unauthorized > div { max-width: 560px; padding: 30px; border-radius: 22px; background: #fffaf0; box-shadow: var(--shadow); }
.unauthorized h1 { color: #5a281b; }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes legalGlow { from { opacity: .6; } to { opacity: 1; } }
@keyframes turnAwaitingRoll {
  0%, 100% { background: rgba(255,250,239,.88); box-shadow: 0 6px 20px rgba(65,34,20,.1), 0 0 0 0 rgba(231,167,45,0); }
  50% { background: #fff3c8; box-shadow: 0 7px 24px rgba(95,51,18,.18), 0 0 0 5px rgba(231,167,45,.28); }
}
@keyframes rollButtonAwaiting {
  0%, 100% { filter: brightness(1); transform: translateY(0) scale(1); box-shadow: inset 0 1px rgba(255,255,255,.18), 0 5px 11px rgba(54,25,14,.26), 0 0 0 0 rgba(239,178,53,0); }
  50% { filter: brightness(1.18); transform: translateY(-1px) scale(1.025); box-shadow: inset 0 1px rgba(255,255,255,.24), 0 8px 18px rgba(54,25,14,.31), 0 0 0 7px rgba(239,178,53,.3); }
}
@keyframes diceRoll {
  0% { transform: rotate(0) translateY(0) scale(1); }
  25% { transform: rotate(110deg) translateY(-16px) scale(1.08); }
  55% { transform: rotate(230deg) translateY(2px) scale(.96); }
  78% { transform: rotate(330deg) translateY(-6px) scale(1.03); }
  100% { transform: rotate(360deg) translateY(0) scale(1); }
}

@media (max-width: 980px) {
  .game-layout { grid-template-columns: 1fr; max-width: 900px; }
  .control-panel { position: static; grid-template-columns: 1fr 1fr; }
  .players-card { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .player-row + .player-row { border-top: 0; border-inline-start: 1px solid rgba(82,48,31,.12); }
  .game-actions { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .game-header { min-height: 62px; padding-block: 8px; }
  .brand-mark { width: 39px; height: 39px; border-radius: 11px; font-size: 20px; }
  .brand strong { font-size: 18px; }
  .brand small { display: none; }
  .icon-btn { width: 39px; height: 39px; border-radius: 11px; }
  .game-layout { padding: 12px 7px 8px; gap: 14px; }
  .turn-banner { margin-inline: 2px; font-size: 13px; }
  .move-clock { font-size: 12px; }
  .board-frame { padding: 7px; border-radius: 13px; }
  .board-and-off { min-height: 0; grid-template-columns: minmax(0,1fr) 39px; border-radius: 6px; }
  .playing-surface { grid-template-columns: repeat(6,minmax(0,1fr)) minmax(19px,.8fr) repeat(6,minmax(0,1fr)); }
  .checker { width: 90%; }
  .checker + .checker { margin-top: -4px; }
  .bottom .checker + .checker { margin-top: 0; margin-bottom: -4px; }
  .bar-stack .checker { width: 82%; }
  .board-help { padding-inline: 8px; font-size: 11px; }
  .control-panel { grid-template-columns: 1fr; }
  .players-card, .dice-card, .room-card, .game-actions { grid-column: 1; }
  .players-card { display: block; }
  .player-row + .player-row { border-top: 1px solid rgba(82,48,31,.12); border-inline-start: 0; }
  .player-row { min-height: 66px; }
  .dice-card { padding: 13px; }
  .dice-stage { min-height: 72px; }
  .die { width: 57px; height: 57px; }
  .lobby-card { padding: 22px 18px; border-radius: 20px; }
  .lobby-card h1 { font-size: 27px; }
}

@media (max-width: 390px) {
  .board-and-off { min-height: 0; }
  .point-number { display: none; }
  .checker + .checker { margin-top: -5px; }
  .bottom .checker + .checker { margin-bottom: -5px; }
  .room-code { font-size: 27px; }
}

/* בטלפון מסובב לרוחב מנצלים את הרוחב במקום לערום את לוח הבקרה מתחת ללוח. */
@media (orientation: landscape) and (max-height: 620px) {
  .game-header { position: relative; min-height: 48px; padding-block: 4px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 18px; }
  .brand strong { font-size: 16px; }
  .brand small { display: none; }
  .icon-btn { width: 36px; height: 36px; border-radius: 10px; font-size: 17px; }
  .game-layout {
    max-width: none;
    padding: 6px 8px 5px;
    grid-template-columns: minmax(0,1fr) minmax(222px,32vw);
    gap: 9px;
  }
  .turn-banner { min-height: 38px; margin-bottom: 5px; padding: 5px 9px; font-size: 12px; }
  .move-clock { font-size: 11px; }
  .board-frame {
    width: 100%;
    max-width: var(--landscape-board-max-width, 100%);
    margin-inline: auto;
    padding: 5px;
    border-radius: 11px;
  }
  .board-and-off { min-height: 0; grid-template-columns: minmax(0,1fr) 36px; }
  .playing-surface { grid-template-columns: repeat(6,minmax(0,1fr)) minmax(17px,.8fr) repeat(6,minmax(0,1fr)); }
  .checker { width: 88%; }
  .checker + .checker { margin-top: -5px; }
  .bottom .checker + .checker { margin-top: 0; margin-bottom: -5px; }
  .point-number, .board-help { display: none; }
  .control-panel {
    position: static;
    max-height: calc(var(--app-height, 100dvh) - 60px);
    padding: 1px 3px 8px;
    grid-template-columns: 1fr;
    gap: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .players-card, .dice-card, .room-card, .game-actions { grid-column: 1; }
  .players-card { display: block; }
  .player-row + .player-row { border-top: 1px solid rgba(82,48,31,.12); border-inline-start: 0; }
  .player-row { min-height: 49px; padding: 5px 8px; grid-template-columns: 31px minmax(0,1fr) auto; gap: 7px; }
  .mini-checker { width: 29px; }
  .player-copy strong { font-size: 13px; }
  .player-copy small { margin-top: 1px; font-size: 9px; }
  .wins { min-width: 39px; }
  .wins b { font-size: 19px; }
  .dice-card { padding: 7px 9px; }
  .dice-stage { min-height: 47px; gap: 10px; }
  .die { width: 43px; height: 43px; padding: 5px; border-radius: 10px; }
  .pip { width: 7px; height: 7px; }
  .remaining { min-height: 19px; margin: 2px 0 5px; font-size: 10px; }
  .remaining .die-chip { min-width: 20px; height: 20px; }
  .primary-btn { min-height: 37px; padding-block: 7px; }
  .room-card { padding: 7px 9px; }
  .room-code { min-height: 29px; font-size: 22px; }
  .room-card p:not(.eyebrow) { min-height: 0; margin: 2px 0 6px; }
  .secondary-btn { min-height: 34px; padding: 6px 10px; }
  .game-footer { margin-top: 5px; padding-top: 10px; }
  .lobby-backdrop { place-items: start center; }
  .lobby-card { width: min(92vw, 680px); padding: 14px 18px; }
  .lobby-logo { display: none; }
  .lobby-card h1 { margin-top: 2px; font-size: 23px; }
  .lobby-card > p { margin-bottom: 10px; font-size: 12px; }
  .mode-switch { margin-bottom: 8px; }
  .lobby-card label { margin-top: 6px; }
  .lobby-card input:not([type="radio"]) { min-height: 41px; }
  .gender-picker { margin-top: 8px; }
  .gender-picker span { min-height: 37px; }
  .field-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .turn-banner.awaiting-roll, .roll-btn.awaiting-roll:not(:disabled) { outline: 4px solid #e6a82f; outline-offset: 2px; }
}
