:root {
  --ink: #201d19;
  --paper: #f5efe4;
  --paper-2: #e7dcc9;
  --red: #d72c35;
  --red-dark: #8f1820;
  --blue: #1d4f91;
  --blue-dark: #102f5d;
  --gold: #d5a641;
  --shadow: 0 24px 70px rgba(47, 36, 23, .17);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: #ddd1be; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 22%, rgba(255,255,255,.9) 0 2%, transparent 23%),
    radial-gradient(circle at 83% 70%, rgba(255,255,255,.55) 0 3%, transparent 27%),
    #ede4d5;
  font-family: "DM Sans", system-ui, sans-serif;
  overflow-x: hidden;
}

button, input { font: inherit; }
button { color: inherit; }

.texture {
  position: fixed;
  inset: 0;
  opacity: .28;
  pointer-events: none;
  z-index: 10;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
}

.topbar {
  min-height: 84px;
  padding: 16px clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(246, 240, 230, .82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(52, 43, 33, .12);
  position: relative;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; color: inherit; }
.brand-mark { width: 40px; height: 40px; display: grid; place-content: center; gap: 3px; transform: rotate(45deg); }
.brand-mark i { width: 22px; height: 6px; display: block; border-radius: 1px; }
.brand-mark i:nth-child(1) { background: var(--red); }
.brand-mark i:nth-child(2) { background: #f5f2eb; border: 1px solid #c8bca8; }
.brand-mark i:nth-child(3) { background: var(--blue); }
.brand b { font: 800 16px/1 "Unbounded", sans-serif; letter-spacing: .04em; display: block; }
.brand small { font-size: 9px; letter-spacing: .28em; font-weight: 700; opacity: .57; display: block; margin-top: 5px; }

.top-actions { display: flex; align-items: center; gap: 9px; }
.icon-button, .lang-button, .outline-button, .reset-button { height: 42px; border-radius: 12px; border: 1px solid rgba(34,29,24,.15); background: rgba(255,255,255,.55); font-weight: 700; cursor: pointer; transition: .2s ease; }
.icon-button:hover, .lang-button:hover, .outline-button:hover { background: white; transform: translateY(-1px); }
.icon-button { width: 42px; display: grid; place-items: center; }
.icon-button svg { width: 19px; fill: currentColor; }
.icon-button.muted svg { opacity: .35; }
.lang-button { padding: 0 14px; display: flex; align-items: center; gap: 8px; }
.lang-button i { width: 6px; height: 6px; border-right: 1.5px solid; border-bottom: 1.5px solid; transform: rotate(45deg) translateY(-2px); }
.outline-button { padding: 0 16px; }
.reset-button { padding: 0 18px; background: var(--ink); color: #fff; border-color: var(--ink); }
.reset-button:hover { background: #000; transform: translateY(-1px); }

.game-shell {
  width: min(1500px, 100%);
  min-height: calc(100vh - 140px);
  margin: 0 auto;
  padding: 30px clamp(16px, 3.4vw, 54px) 34px;
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(460px, 820px) minmax(200px, 280px);
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3vw, 54px);
}

.player-card {
  min-height: 330px;
  border-radius: 24px;
  background: rgba(248,243,234,.78);
  border: 1px solid rgba(51,42,33,.13);
  box-shadow: 0 14px 40px rgba(62,45,25,.08);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: .35s ease;
}
.player-card.active { transform: translateY(-5px); background: rgba(255,252,245,.98); }
.player-card--al.active { box-shadow: 0 16px 50px rgba(178,31,39,.18), inset 0 0 0 1px rgba(215,44,53,.25); }
.player-card--rs.active { box-shadow: 0 16px 50px rgba(29,79,145,.18), inset 0 0 0 1px rgba(29,79,145,.25); }
.player-card__stripe { position: absolute; inset: 0 0 auto; height: 5px; }
.player-card--al .player-card__stripe { background: var(--red); }
.player-card--rs .player-card__stripe { background: linear-gradient(90deg, #cf2632 0 33%, #214e8b 33% 66%, #f1eee7 66%); }
.player-card__identity { display: flex; align-items: center; gap: 12px; }
.crest { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; flex: 0 0 auto; }
.crest svg { width: 38px; height: 38px; }
.crest--al { background: var(--red); }
.crest--al path { fill: #171411; }
.crest--rs { background: #f3efe8; border: 1px solid #cabda8; }
.crest--rs .shield { fill: var(--red); }
.crest--rs .cross, .crest--rs .spark { fill: #f8f5ef; }
.eyebrow { font-size: 9px; letter-spacing: .18em; font-weight: 800; opacity: .47; }
.player-card h2 { margin: 4px 0 0; font: 700 clamp(16px, 1.5vw, 22px)/1 "Unbounded", sans-serif; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; }
.turn-dot { width: 10px; height: 10px; margin-left: auto; border-radius: 50%; background: #c9beae; box-shadow: 0 0 0 5px rgba(201,190,174,.18); }
.player-card--al.active .turn-dot { background: var(--red); box-shadow: 0 0 0 5px rgba(215,44,53,.16); }
.player-card--rs.active .turn-dot { background: var(--blue); box-shadow: 0 0 0 5px rgba(29,79,145,.16); }
.player-card__stats { display: grid; grid-template-columns: 1fr 1fr; margin: 28px 0 22px; border-top: 1px solid rgba(41,34,27,.11); border-bottom: 1px solid rgba(41,34,27,.11); }
.player-card__stats > span { padding: 17px 5px; text-align: center; }
.player-card__stats > span + span { border-left: 1px solid rgba(41,34,27,.11); }
.player-card__stats b { font: 700 25px/1 "Unbounded", sans-serif; display: block; }
.player-card__stats small { font-size: 8px; letter-spacing: .12em; font-weight: 800; opacity: .48; display: block; margin-top: 7px; }
.player-status { margin: 18px 0 0; font-size: 12px; text-align: center; font-weight: 700; opacity: .55; }
.active .player-status { opacity: 1; }
.player-card--al.active .player-status { color: var(--red-dark); }
.player-card--rs.active .player-status { color: var(--blue-dark); }

.motif { height: 58px; display: flex; justify-content: center; align-items: center; gap: 1px; opacity: .9; }
.motif i { width: 25px; height: 25px; display: block; transform: rotate(45deg); border: 5px double; }
.motif i:nth-child(2), .motif i:nth-child(4) { width: 15px; height: 15px; border-width: 3px; }
.motif--al { color: var(--red); }
.motif--al i:nth-child(3) { background: #1e1b18; box-shadow: inset 0 0 0 4px var(--red); }
.motif--rs { color: var(--blue); }
.motif--rs i:nth-child(3) { color: var(--red); box-shadow: inset 0 0 0 4px #f2eadc; }

.board-zone { width: 100%; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.round-label { width: 100%; margin: 0 0 12px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; color: #716758; }
.round-label span { height: 1px; background: currentColor; opacity: .26; }
.round-label b { font-size: 9px; letter-spacing: .24em; }
.board-wrap { width: min(100%, 760px); aspect-ratio: 1; position: relative; }
.board-halo { position: absolute; inset: 5%; border-radius: 11%; box-shadow: 0 35px 65px rgba(59,42,23,.25); }
#gameBoard { width: 100%; height: 100%; display: block; overflow: visible; position: relative; }
.board-rim { fill: #29241f; stroke: #191612; stroke-width: 5; }
.board-surface { fill: url(#microPattern); stroke: #ddcfba; stroke-width: 5; }
.board-fold { fill: none; stroke: #b8aa94; stroke-width: 1; stroke-dasharray: 5 7; opacity: .42; }
.board-cross-guide { fill: rgba(255,255,255,.24); stroke: #cbbda7; stroke-width: 1.5; }
.track-cell { fill: #fffaf1; stroke: #8f8473; stroke-width: 2; transition: .2s ease; }
.track-cell.safe-al { fill: #f4c3c3; stroke: var(--red); stroke-width: 3; }
.track-cell.safe-rs { fill: #bcd0e9; stroke: var(--blue); stroke-width: 3; }
.track-marker { font: 800 11px "Unbounded", sans-serif; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.home-cell { stroke-width: 2; }
.home-cell.al { fill: #f5d1d0; stroke: var(--red); }
.home-cell.rs { fill: #cad8e9; stroke: var(--blue); }
.base-pad { stroke-width: 3; }
.base-pad.al { fill: #f1d1ce; stroke: #bb3238; }
.base-pad.rs { fill: #cfdded; stroke: #32609a; }
.base-title { font: 700 9px "Unbounded", sans-serif; letter-spacing: .16em; text-anchor: middle; }
.base-dot { fill: rgba(255,255,255,.84); stroke: rgba(33,28,23,.34); stroke-width: 2; }
.kosovo-shape { fill: #d7c7ae; stroke: #9c8e77; stroke-width: 2; }
.center-seam { fill: none; stroke: #b8a68a; stroke-width: 1; stroke-dasharray: 3 4; }
.center-title { font: 800 18px "Unbounded", sans-serif; text-anchor: middle; fill: #312b24; letter-spacing: .08em; }
.center-subtitle { font: 700 7px "DM Sans", sans-serif; text-anchor: middle; fill: #6d6253; letter-spacing: .2em; }
.center-stars { fill: #aa8c52; }
.piece { cursor: pointer; filter: url(#tokenShadow); }
.piece .token-body { transition: transform .2s ease; transform-box: fill-box; transform-origin: center; }
.piece:hover .token-body { transform: translateY(-3px); }
.piece .pawn-shadow { fill: rgba(22,18,14,.2); }
.piece .pawn-base, .piece .pawn-body, .piece .pawn-head { fill: var(--pawn-color, var(--red)); stroke: #fff9ef; stroke-width: 2.5; }
.piece .pawn-shine { fill: rgba(255,255,255,.3); pointer-events: none; }
.piece.selectable .token-body { animation: piecePulse 1s ease-in-out infinite; }
.piece.selectable .pawn-base, .piece.selectable .pawn-body, .piece.selectable .pawn-head { stroke: #f4ba3c; stroke-width: 4; }
@keyframes piecePulse { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-5px) scale(1.08); } }
.piece.moving { pointer-events: none; }
.piece.moving .token-body { animation: pawnHop .18s ease-in-out infinite alternate; }
@keyframes pawnHop { from { transform: translateY(0) scale(1); } to { transform: translateY(-7px) scale(1.04); } }

.turn-panel {
  width: min(640px, 95%);
  min-height: 98px;
  margin-top: -8px;
  padding: 13px 14px 13px 24px;
  border-radius: 20px;
  background: rgba(252,248,240,.96);
  border: 1px solid rgba(48,40,31,.15);
  box-shadow: 0 18px 44px rgba(59,44,27,.16);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: relative;
  z-index: 4;
}
.turn-copy { min-width: 0; }
.turn-kicker { font-size: 8px; letter-spacing: .2em; font-weight: 800; opacity: .5; display: block; }
.turn-copy strong { font: 700 18px "Unbounded", sans-serif; display: block; margin: 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turn-copy small { font-size: 11px; color: #73695b; }
.dice-button { min-width: 205px; height: 70px; padding: 8px 17px 8px 8px; border: 0; border-radius: 14px; background: var(--red); color: #fff; display: flex; align-items: center; gap: 14px; cursor: pointer; box-shadow: 0 8px 20px rgba(169,31,40,.23); transition: .2s ease; }
.turn-panel.rs-turn .dice-button { background: var(--blue); box-shadow: 0 8px 20px rgba(29,79,145,.23); }
.dice-button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.04); }
.dice-button:disabled { cursor: default; opacity: .68; }
.dice { width: 54px; height: 54px; border-radius: 11px; background: #fff9ef; flex: 0 0 auto; display: grid; grid-template: repeat(3,1fr) / repeat(3,1fr); padding: 8px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.08); }
.pip { width: 7px; height: 7px; background: var(--ink); border-radius: 50%; place-self: center; display: none; }
.p1 { grid-area: 1 / 1; } .p2 { grid-area: 1 / 2; } .p3 { grid-area: 1 / 3; }
.p4 { grid-area: 2 / 2; } .p5 { grid-area: 3 / 1; } .p6 { grid-area: 3 / 2; } .p7 { grid-area: 3 / 3; }
.dice[data-value="1"] .p4,
.dice[data-value="2"] .p1, .dice[data-value="2"] .p7,
.dice[data-value="3"] .p1, .dice[data-value="3"] .p4, .dice[data-value="3"] .p7,
.dice[data-value="4"] .p1, .dice[data-value="4"] .p3, .dice[data-value="4"] .p5, .dice[data-value="4"] .p7,
.dice[data-value="5"] .p1, .dice[data-value="5"] .p3, .dice[data-value="5"] .p4, .dice[data-value="5"] .p5, .dice[data-value="5"] .p7,
.dice[data-value="6"] .p1, .dice[data-value="6"] .p2, .dice[data-value="6"] .p3, .dice[data-value="6"] .p5, .dice[data-value="6"] .p6, .dice[data-value="6"] .p7 { display: block; }
.dice.rolling { animation: diceShake .58s ease; }
@keyframes diceShake { 0%,100% { transform: rotate(0) scale(1); } 20% { transform: rotate(-12deg) scale(.94); } 45% { transform: rotate(10deg) scale(1.05); } 70% { transform: rotate(-6deg); } }
.dice-cta { text-align: left; }
.dice-cta b { display: block; font: 700 11px "Unbounded", sans-serif; }
.dice-cta small { font-size: 9px; opacity: .7; display: block; margin-top: 4px; }

footer { min-height: 56px; padding: 11px clamp(20px,4vw,64px); border-top: 1px solid rgba(52,43,33,.12); display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #756b5d; font-size: 8px; font-weight: 800; letter-spacing: .16em; }
footer p { display: flex; align-items: center; gap: 10px; margin: 0; }
.footer-dot { width: 7px; height: 7px; border-radius: 50%; }
.footer-dot--al { background: var(--red); } .footer-dot--rs { background: var(--blue); }

.modal { width: min(600px, calc(100% - 28px)); max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); padding: 0; border: 1px solid rgba(45,37,29,.16); border-radius: 28px; background: #f9f4ea; color: var(--ink); box-shadow: 0 40px 100px rgba(30,24,18,.4); overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal::backdrop { background: rgba(25,22,18,.66); backdrop-filter: blur(9px); }
.modal form { padding: clamp(28px, 5vw, 50px); text-align: center; position: relative; }
.modal-close { position: absolute; right: 18px; top: 15px; border: 0; background: transparent; font-size: 28px; color: #766c5e; cursor: pointer; }
.modal-kicker { font-size: 9px; letter-spacing: .25em; color: #8d7252; font-weight: 800; }
.modal h1, .modal h2 { margin: 12px auto; font: 700 clamp(27px, 5vw, 42px)/1.12 "Unbounded", sans-serif; letter-spacing: -.04em; }
.modal p { color: #756b5d; max-width: 430px; margin: 0 auto 28px; line-height: 1.55; }
.mode-picker { margin: 21px 0 14px; }
.mode-picker > span, .player-count-picker > span, .format-picker > span, .side-picker > span, .color-picker > span { display: block; margin-bottom: 9px; font-size: 8px; letter-spacing: .2em; font-weight: 800; color: #817666; }
.mode-picker > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-choice { min-height: 58px; padding: 10px 13px; border: 1px solid #cfc2ae; border-radius: 13px; background: #fffaf2; cursor: pointer; text-align: left; transition: .2s ease; }
.mode-choice b, .mode-choice small { display: block; }
.mode-choice b { font: 700 9px "Unbounded", sans-serif; }
.mode-choice small { margin-top: 5px; color: #817666; font-size: 8px; }
.mode-choice.selected { border-color: var(--ink); background: #e9dfcf; box-shadow: inset 0 0 0 1px var(--ink); }
.player-count-picker { margin: 0 0 14px; }
.player-count-picker[hidden] { display: none; }
.player-count-picker > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.player-count-choice { min-height: 48px; padding: 7px 12px; border: 1px solid #cfc2ae; border-radius: 12px; background: #fffaf2; cursor: pointer; display: flex; align-items: center; gap: 10px; text-align: left; }
.player-count-choice b { font: 700 18px "Unbounded", sans-serif; }
.player-count-choice small { color: #817666; font-size: 8px; font-weight: 800; letter-spacing: .07em; }
.player-count-choice.selected { border-color: var(--gold); background: #f4ead0; box-shadow: inset 0 0 0 1px var(--gold); }
.format-picker { margin: 0 0 14px; }
.format-picker[hidden] { display: none; }
.format-picker > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.format-choice { min-height: 52px; padding: 9px 12px; border: 1px solid #cfc2ae; border-radius: 12px; background: #fffaf2; cursor: pointer; text-align: left; }
.format-choice b, .format-choice small { display: block; }
.format-choice b { font: 700 9px "Unbounded", sans-serif; }
.format-choice small { margin-top: 5px; color: #817666; font-size: 8px; }
.format-choice.selected { border-color: var(--ink); background: #e9dfcf; box-shadow: inset 0 0 0 1px var(--ink); }
.side-picker { margin: 14px 0 18px; }
.side-picker > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.side-choice { min-height: 58px; padding: 9px 14px; border: 1px solid #cfc2ae; border-radius: 13px; background: #fffaf2; cursor: pointer; display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr 1fr; column-gap: 10px; text-align: left; align-items: center; transition: .2s ease; }
.side-choice i { grid-row: 1 / 3; width: 20px; height: 20px; border-radius: 50%; border: 5px solid; }
.side-choice b { align-self: end; font: 700 10px "Unbounded", sans-serif; }
.side-choice small { align-self: start; margin-top: 2px; font-size: 7px; letter-spacing: .13em; color: #817666; font-weight: 800; }
.side-choice--al i { color: var(--red); } .side-choice--rs i { color: var(--blue); }
.side-choice--al.selected { border-color: var(--red); background: #f8e4e1; box-shadow: inset 0 0 0 1px var(--red); }
.side-choice--rs.selected { border-color: var(--blue); background: #e1e9f3; box-shadow: inset 0 0 0 1px var(--blue); }
.color-picker { margin: -3px 0 14px; }
.color-picker[hidden] { display: none; }
.color-picker > div { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.color-choice { min-height: 42px; padding: 7px 8px; border: 1px solid #cfc2ae; border-radius: 11px; background: #fffaf2; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--ink); }
.color-choice i { width: 16px; height: 16px; border-radius: 50%; background: var(--choice-color); box-shadow: inset 0 0 0 2px rgba(255,255,255,.65); }
.color-choice small { font-size: 7px; font-weight: 800; letter-spacing: .06em; }
.color-choice--red { --choice-color: #d72c35; } .color-choice--blue { --choice-color: #1d4f91; } .color-choice--green { --choice-color: #28865d; } .color-choice--gold { --choice-color: #c78b19; }
.color-choice.selected { border-color: var(--choice-color); background: color-mix(in srgb, var(--choice-color) 12%, #fffaf2); box-shadow: inset 0 0 0 1px var(--choice-color); }
.color-choice:disabled { opacity: .34; cursor: not-allowed; }
.color-hint { display: block; min-height: 13px; margin-top: 7px; color: #817666; font-size: 8px; }
.name-fields { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; margin: 24px 0; text-align: left; }
.name-field > span { display: flex; align-items: center; gap: 7px; font-size: 10px; margin: 0 0 8px 4px; }
.name-field > span em { margin-left: auto; font-style: normal; font-size: 7px; letter-spacing: .1em; color: #8b7f6f; }
.name-field > span i { width: 8px; height: 8px; border-radius: 50%; }
.name-field--al > span i { background: var(--red); } .name-field--rs > span i { background: var(--blue); }
.name-field input { width: 100%; height: 52px; border: 1px solid #cfc2ae; background: #fffdfa; border-radius: 12px; padding: 0 14px; outline: none; font-weight: 700; text-transform: uppercase; }
.name-field input:focus { border-color: #8a7960; box-shadow: 0 0 0 3px rgba(138,121,96,.12); }
.name-field input[readonly] { cursor: default; background: #f6efe4; color: #3f382f; }
.name-field input:disabled { color: #8b8275; background: #e9e2d8; cursor: not-allowed; }
.versus { align-self: end; height: 52px; display: grid; place-items: center; font: 700 9px "Unbounded", sans-serif; opacity: .45; }
.start-button { width: 100%; min-height: 56px; border: 0; border-radius: 14px; background: var(--ink); color: #fff; cursor: pointer; font: 700 11px "Unbounded", sans-serif; letter-spacing: .06em; display: flex; align-items: center; justify-content: center; gap: 18px; transition: .2s ease; }
.start-button:hover { transform: translateY(-2px); background: #090807; }
.start-button:disabled { opacity: .62; cursor: wait; transform: none; }
.start-button i { font: normal 21px sans-serif; }
.setup-note { display: block; margin-top: 14px; color: #8c8172; font-size: 9px; }
.room-panel { margin: -5px 0 18px; padding: 13px; border: 1px solid #b9aa93; border-radius: 14px; background: #eee5d7; text-align: left; }
.room-panel[hidden] { display: none; }
.room-status { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; color: #5d554a; font-size: 8px; letter-spacing: .1em; }
.room-status i { width: 8px; height: 8px; border-radius: 50%; background: #4c9462; box-shadow: 0 0 0 4px rgba(76,148,98,.12); }
.room-panel--error .room-status i { background: var(--red); box-shadow: 0 0 0 4px rgba(215,44,53,.12); }
.invite-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.invite-row input { min-width: 0; height: 42px; padding: 0 11px; border: 1px solid #cfc2ae; border-radius: 10px; background: #fffdfa; color: #5d554a; font-size: 10px; outline: none; }
.invite-row button { min-width: 106px; border: 0; border-radius: 10px; background: var(--ink); color: #fff; cursor: pointer; font: 700 8px "Unbounded", sans-serif; letter-spacing: .05em; }
.room-roster { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 10px; }
.room-seat { padding: 7px 8px; border-radius: 9px; background: rgba(255,255,255,.55); color: #756b5d; font-size: 8px; font-weight: 800; letter-spacing: .05em; }
.room-seat.joined { color: var(--ink); }
.room-seat.connected::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #4c9462; }
.room-seat:not(.connected)::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #b9aa93; }
.room-seat.has-color { border-left: 4px solid var(--seat-color); padding-left: 6px; }
.rules-modal { max-width: 530px; }
.rules-modal form { text-align: left; }
.rules-modal h2 { font-size: 30px; text-align: center; margin-bottom: 28px; }
.rules-modal ol { padding: 0; margin: 0 0 28px; list-style: none; display: grid; gap: 11px; }
.rules-modal li { display: flex; align-items: center; gap: 15px; padding: 12px; border-radius: 14px; background: #eee5d7; }
.rules-modal li > b { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: #fffaf2; color: var(--red); font: 700 17px "Unbounded", sans-serif; }
.rules-modal li:nth-child(even) > b { color: var(--blue); }
.rules-modal li strong, .rules-modal li small { display: block; }
.rules-modal li strong { font-size: 12px; margin-bottom: 3px; }
.rules-modal li small { color: #756b5d; line-height: 1.35; }
.win-modal { max-width: 470px; }
.win-modal form { padding-top: 58px; overflow: hidden; }
.win-crown { font-size: 56px; color: var(--gold); display: block; position: relative; z-index: 1; animation: winFloat 2s ease-in-out infinite; }
.win-modal h2 { position: relative; z-index: 1; }
.win-rays { position: absolute; width: 250px; height: 250px; left: calc(50% - 125px); top: -55px; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(213,166,65,.16) 0 8deg, transparent 8deg 18deg); animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes winFloat { 50% { transform: translateY(-7px) rotate(5deg); } }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px); padding: 12px 18px; border-radius: 12px; background: #211e1a; color: white; font-size: 12px; font-weight: 700; opacity: 0; pointer-events: none; z-index: 100; transition: .3s ease; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .game-shell { grid-template-columns: 160px minmax(430px, 680px) 160px; gap: 15px; }
  .player-card { padding: 17px; min-height: 285px; }
  .crest { width: 43px; height: 43px; border-radius: 12px; }
  .crest svg { width: 32px; }
  .player-card__identity { gap: 8px; }
  .player-card h2 { font-size: 13px; }
  .motif i { width: 19px; height: 19px; }
}

@media (max-width: 820px) {
  .topbar { min-height: 68px; padding: 11px 16px; }
  .outline-button, .icon-button { display: none; }
  .brand b { font-size: 12px; }
  .brand small { font-size: 7px; }
  .game-shell { padding: 17px 10px 26px; grid-template-columns: 1fr 1fr; gap: 10px; align-items: stretch; }
  .board-zone { grid-row: 1; grid-column: 1 / -1; }
  .player-card { grid-row: 2; min-height: auto; padding: 14px; border-radius: 16px; }
  .player-card.active { transform: translateY(-2px); }
  .player-card__stats { margin: 14px 0 0; }
  .player-card__stats > span { padding: 10px 3px; }
  .motif, .player-status { display: none; }
  .turn-panel { margin-top: 0; }
  footer { flex-direction: column; justify-content: center; text-align: center; }
}

@media (min-width: 821px) and (max-width: 1050px) {
  .game-shell {
    min-height: calc(100svh - 140px);
    padding: 20px 12px 24px;
    grid-template-columns: clamp(100px, 15vw, 140px) minmax(0, 600px) clamp(100px, 15vw, 140px);
    gap: 12px;
    align-items: start;
  }
  .player-card { min-height: 270px; padding: 13px 11px; border-radius: 19px; align-self: start; margin-top: clamp(145px, calc((100vw - 548px) / 2), 190px); }
  .player-card__identity { gap: 6px; }
  .crest { width: 36px; height: 36px; border-radius: 10px; }
  .crest svg { width: 27px; height: 27px; }
  .eyebrow { font-size: 7px; letter-spacing: .13em; }
  .player-card h2 { font-size: 10px; line-height: 1.08; overflow-wrap: anywhere; }
  .turn-dot { display: none; }
  .player-card__stats { margin: 18px 0 14px; }
  .player-card__stats > span { padding: 12px 2px; }
  .player-card__stats b { font-size: 20px; }
  .motif { height: 48px; }
  .motif i { width: 19px; height: 19px; border-width: 4px; }
  .motif i:nth-child(2), .motif i:nth-child(4) { width: 12px; height: 12px; }
  .player-status { margin-top: 12px; font-size: 10px; }
  .turn-panel { min-height: 90px; }
}

@media (max-width: 560px) {
  .brand-mark { width: 30px; height: 30px; }
  .brand-mark i { width: 17px; height: 4px; }
  .lang-button { padding: 0 10px; }
  .reset-button { padding: 0 12px; font-size: 11px; }
  .game-shell { display: flex; flex-wrap: wrap; }
  .board-zone { order: 1; }
  .player-card { order: 2; width: calc(50% - 5px); }
  .player-card__identity { align-items: center; }
  .crest { width: 34px; height: 34px; }
  .crest svg { width: 27px; height: 27px; }
  .eyebrow { display: none; }
  .player-card h2 { font-size: 10px; }
  .player-card__stats b { font-size: 18px; }
  .player-card__stats small { font-size: 6px; }
  .round-label { margin-bottom: 4px; }
  .turn-panel { width: 100%; min-height: 78px; padding: 9px 9px 9px 15px; gap: 8px; border-radius: 15px; }
  .turn-copy strong { font-size: 12px; }
  .turn-copy small { display: none; }
  .dice-button { min-width: 144px; height: 60px; padding: 6px 10px 6px 6px; gap: 8px; }
  .dice { width: 48px; height: 48px; }
  .modal form { padding: 28px 20px; }
  .modal h1 { font-size: 26px; }
  .modal p { margin-bottom: 18px; }
  .mode-picker { margin: 14px 0 10px; }
  .player-count-picker { margin-bottom: 10px; }
  .format-picker { margin-bottom: 10px; }
  .color-picker { margin-bottom: 10px; }
  .color-choice { min-height: 39px; padding-inline: 5px; }
  .color-choice small { display: none; }
  .side-picker { margin: 10px 0 14px; }
  .name-fields { margin: 16px 0; }
  .name-fields { grid-template-columns: 1fr; gap: 8px; }
  .versus { display: none; }
  .invite-row { grid-template-columns: 1fr; }
  .invite-row button { min-height: 42px; }
  .dice-cta b { font-size: 8px; }
  .name-fields { grid-template-columns: 1fr; }
  .side-choice { padding-inline: 10px; }
  .versus { height: 18px; align-self: center; }
  .setup-note { display: none; }
  .modal form { padding: 20px 20px max(16px, env(safe-area-inset-bottom)); }
}

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