:root {
  --ink: #f7f7fb;
  --muted: #9da2ba;
  --surface: rgba(31, 34, 57, 0.9);
  --surface-strong: #252842;
  --line: rgba(255, 255, 255, 0.1);
  --background: #111326;
  --accent: #ff6f5e;
  --accent-2: #ff9b58;
  --red: #ff5d69;
  --green: #36c98f;
  --yellow: #f7c84b;
  --blue: #5591ff;
  --shadow: 0 30px 80px rgba(3, 4, 13, 0.35);
  --radius: 24px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 6%, rgba(85, 145, 255, 0.13), transparent 28rem),
    radial-gradient(circle at 90% 85%, rgba(255, 93, 105, 0.11), transparent 31rem),
    var(--background);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

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

.ambient {
  position: fixed;
  z-index: -1;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.18;
  pointer-events: none;
}

.ambient-one { top: 12%; left: -160px; background: var(--blue); }
.ambient-two { right: -160px; bottom: 2%; background: var(--red); }

.topbar {
  width: min(1180px, calc(100% - 40px));
  height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-light { color: var(--muted); font-weight: 500; }

.brand-mark {
  width: 38px;
  height: 38px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(255, 111, 94, 0.32);
  transform: rotate(-4deg);
}

.brand-mark i { border-radius: 50%; background: #fff; opacity: 0.95; }

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 12px currentColor;
}

.connection-pill.is-online .status-dot { background: var(--green); }
.connection-pill.is-offline .status-dot { background: var(--red); }

.sound-toggle {
  min-height: 35px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.sound-toggle:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.2); }
.sound-toggle.is-muted { opacity: 0.62; }
.sound-icon { font-size: 13px; }

main { width: 100%; }

.screen {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  animation: screen-in 420ms ease both;
}

.screen[hidden] { display: none !important; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.landing-screen {
  min-height: calc(100vh - 120px);
  padding: 48px 0 90px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.75fr);
  align-items: center;
  gap: clamp(50px, 9vw, 120px);
}

.eyebrow, .step-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.16em;
}

.hero-copy h1, .lobby-heading h1, .game-topline h1 {
  margin: 13px 0 20px;
  font-size: clamp(46px, 6.5vw, 82px);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.hero-copy h1 span {
  color: transparent;
  background: linear-gradient(110deg, var(--accent), var(--accent-2));
  background-clip: text;
  -webkit-background-clip: text;
}

.hero-copy > p {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.hero-features {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  color: #c9ccda;
  font-size: 13px;
  font-weight: 650;
}

.hero-features span { display: inline-flex; align-items: center; gap: 8px; }
.feature-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 11px;
  font-style: normal;
}

.card {
  background: linear-gradient(145deg, rgba(40, 43, 70, 0.94), rgba(28, 31, 52, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.join-card { padding: 32px; }

.card-heading, .section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.card-heading h2 {
  margin: 4px 0 0;
  font-size: 27px;
  letter-spacing: -0.035em;
}

.icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.icon-button:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.25); }

.rules-button {
  min-height: 38px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  color: #dfe1eb;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.rules-button:hover {
  background: rgba(255, 255, 255, 0.085);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

label {
  display: block;
  margin: 24px 0 9px;
  color: #c8cada;
  font-size: 12px;
  font-weight: 750;
}

label small { color: #747992; font-weight: 500; }

.input-wrap {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: rgba(10, 12, 28, 0.54);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input-wrap:focus-within {
  border-color: rgba(255, 111, 94, 0.7);
  box-shadow: 0 0 0 4px rgba(255, 111, 94, 0.09);
}

.input-wrap > span { color: #6f748f; font-size: 18px; }

.input-wrap input {
  width: 100%;
  padding: 14px 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.input-wrap input::placeholder { color: #666b82; }
.room-input-wrap input { letter-spacing: 0.16em; text-transform: uppercase; font-weight: 800; }

.form-error {
  min-height: 20px;
  margin: 10px 0 -4px;
  color: #ff9d99;
  font-size: 12px;
}

.form-actions { display: grid; gap: 10px; margin-top: 17px; }

.button {
  min-height: 52px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease, opacity 150ms ease;
}

.button:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.06); }
.button:not(:disabled):active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: 0.42; }

.button-primary {
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 28px rgba(255, 111, 94, 0.22);
}

.button-secondary {
  color: #dfe1eb;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
}

.button.compact { min-height: 44px; white-space: nowrap; }

.card-footnote {
  margin: 20px 0 0;
  color: #747991;
  font-size: 11px;
  text-align: center;
}

.lobby-screen { padding: 55px 0 90px; }
.lobby-shell { max-width: 980px; margin: 0 auto; }

.lobby-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
}

.lobby-heading h1 { margin: 8px 0 10px; font-size: clamp(40px, 5vw, 62px); }
.lobby-heading p { margin: 0; color: var(--muted); }

.room-badge {
  padding: 14px 19px;
  display: grid;
  gap: 2px;
  text-align: center;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.room-badge span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 0.14em; }
.room-badge strong { font-size: 24px; letter-spacing: 0.16em; }

.lobby-slots {
  margin: 40px 0 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.lobby-slot {
  min-height: 196px;
  padding: 22px 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.lobby-slot::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--slot-color, rgba(255,255,255,.12));
}

.slot-token {
  width: 58px;
  height: 58px;
  margin-bottom: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--slot-color, #4b4f68);
  border: 6px solid rgba(255, 255, 255, 0.2);
  border-radius: 50% 50% 46% 46%;
  box-shadow: 0 12px 24px color-mix(in srgb, var(--slot-color, #222) 30%, transparent);
  font-size: 20px;
  font-weight: 900;
}

.lobby-slot.is-empty .slot-token { opacity: 0.24; filter: grayscale(1); }
.lobby-slot strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-slot small { margin-top: 3px; color: var(--muted); }
.host-tag { margin-top: 10px; padding: 3px 8px; color: var(--yellow); background: rgba(247, 200, 75, 0.1); border-radius: 999px; font-size: 9px; font-weight: 850; letter-spacing: .1em; }
.offline-tag { color: #ff9d99; }

.lobby-actions {
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 30px;
}

.invite-row { margin-top: 8px; display: flex; gap: 8px; }
.invite-row input {
  min-width: 0;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  color: #cfd2e0;
  background: rgba(10, 12, 28, 0.5);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
}

.start-block { min-width: 210px; text-align: right; }
.start-block p { margin: 0 0 8px; color: var(--muted); font-size: 12px; }

.game-screen { padding: 26px 0 70px; }
.game-topline { margin-bottom: 18px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.game-topline h1 { margin: 3px 0 0; font-size: clamp(26px, 3vw, 39px); }
.game-topline .eyebrow b { color: #fff; letter-spacing: .12em; }

.text-button {
  padding: 8px 0;
  color: var(--muted);
  background: none;
  border: 0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.text-button:hover { color: #fff; }

.game-layout {
  display: grid;
  grid-template-columns: minmax(500px, 1fr) minmax(300px, 350px);
  align-items: start;
  gap: 20px;
}

.board-card { padding: clamp(13px, 2vw, 22px); }
.board-wrap {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  background: #f3efe5;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15), 0 15px 45px rgba(0,0,0,.22);
}
.board-wrap svg { width: 100%; height: 100%; display: block; }
.board-wrap.is-capture-shake { animation: capture-shake 420ms cubic-bezier(.36,.07,.19,.97); }

@keyframes capture-shake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  18% { transform: translate(-5px, 2px) rotate(-.4deg); }
  36% { transform: translate(5px, -2px) rotate(.45deg); }
  54% { transform: translate(-3px, -1px) rotate(-.25deg); }
  72% { transform: translate(3px, 1px) rotate(.2deg); }
}

.board-event-badge {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  padding: 10px 16px;
  color: #fff;
  background: rgba(26, 28, 47, .92);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, .34);
  font-size: clamp(10px, 2.2vw, 14px);
  font-weight: 900;
  letter-spacing: .08em;
  white-space: nowrap;
  pointer-events: none;
  animation: board-badge 1.15s ease both;
}

.board-event-badge.is-finish {
  color: #2a2440;
  background: linear-gradient(120deg, #ffe178, #ff9b58);
  border-color: rgba(255, 255, 255, .6);
}

.board-event-badge.is-blocked { color: #ffd4d0; }

@keyframes board-badge {
  0% { opacity: 0; transform: translate(-50%, -38%) scale(.7); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  72% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -66%) scale(.92); }
}
.board-help { min-height: 21px; margin: 14px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.board-help.is-your-turn { color: #fff; font-weight: 750; }
.board-help.is-previewing { color: #ffd6b7; font-weight: 800; }

.game-sidebar { display: grid; gap: 14px; }
.turn-card, .score-card, .history-card { padding: 22px; }

.turn-player { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.player-dot { width: 11px; height: 11px; flex: 0 0 auto; border-radius: 50%; background: var(--player-color); box-shadow: 0 0 14px var(--player-color); }
.color-red { --player-color: var(--red); --slot-color: var(--red); }
.color-green { --player-color: var(--green); --slot-color: var(--green); }
.color-yellow { --player-color: var(--yellow); --slot-color: var(--yellow); }
.color-blue { --player-color: var(--blue); --slot-color: var(--blue); }
.turn-player strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; letter-spacing: -.02em; }
.turn-player small { margin-left: auto; color: var(--muted); font-size: 10px; }

.dice-zone {
  margin: 18px 0;
  padding: 15px;
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 14px;
  background: rgba(10, 12, 28, 0.45);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.dice {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  color: #24263d;
  background: #f9f7f0;
  border-radius: 15px;
  box-shadow: 0 8px 20px rgba(0,0,0,.2);
  font-size: 45px;
  line-height: 1;
}

.dice.is-rolling { animation: roll 580ms ease; }
.dice.is-six { animation: six-glow 780ms ease; }
.dice.is-no-move { animation: no-move 620ms ease; }
@keyframes roll {
  0% { transform: rotate(0) scale(1); }
  35% { transform: rotate(120deg) scale(.82); }
  70% { transform: rotate(260deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes six-glow {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 20px rgba(0,0,0,.2); }
  45% { transform: scale(1.16) rotate(7deg); box-shadow: 0 0 32px rgba(247,200,75,.85); }
}

@keyframes no-move {
  0%, 100% { transform: translateX(0); }
  22%, 66% { transform: translateX(-5px); }
  44%, 88% { transform: translateX(5px); }
}

.dice-zone strong { display: block; font-size: 13px; }
.dice-zone small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.roll-button { width: 100%; }

.section-title-row { align-items: center; }
.section-title-row > span:last-child { color: var(--muted); font-size: 9px; }
.score-players { margin-top: 12px; display: grid; gap: 8px; }
.score-player {
  padding: 9px 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-radius: 11px;
  background: rgba(255,255,255,.035);
  border: 1px solid transparent;
}
.score-player.is-current { border-color: color-mix(in srgb, var(--player-color) 60%, transparent); background: color-mix(in srgb, var(--player-color) 9%, transparent); }
.score-player-name { min-width: 0; }
.score-player-name strong, .score-player-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-player-name strong { font-size: 12px; }
.score-player-name small { color: var(--muted); font-size: 9px; }
.piece-miniatures { display: flex; gap: 3px; }
.piece-miniatures i { width: 7px; height: 7px; border: 1px solid var(--player-color); border-radius: 50%; }
.piece-miniatures i.is-home { background: var(--player-color); }

.history-card { box-shadow: none; }
.history-card summary { cursor: pointer; color: #cfd2df; font-size: 12px; font-weight: 750; }
.history-card ol { max-height: 180px; margin: 14px 0 0; padding-left: 20px; overflow: auto; color: var(--muted); font-size: 10px; }
.history-card li + li { margin-top: 5px; }

.winner-overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(6, 7, 18, .78);
  backdrop-filter: blur(12px);
}
.winner-overlay[hidden] { display: none; }
.winner-card { width: min(440px, 100%); padding: 38px; position: relative; text-align: center; overflow: hidden; }
.winner-card h2 { margin: 8px 0; font-size: 34px; letter-spacing: -.04em; }
.winner-card p { margin: 0 0 24px; color: var(--muted); }
.winner-crown { display: block; margin-bottom: 10px; color: var(--yellow); font-size: 58px; text-shadow: 0 0 30px rgba(247,200,75,.3); }
.confetti { position: absolute; top: 18px; left: 20px; right: 20px; color: var(--green); letter-spacing: 24px; opacity: .55; }
.confetti span { color: var(--red); }.confetti i { color: var(--blue); }

.rules-dialog {
  width: min(530px, calc(100% - 30px));
  padding: 0;
  color: var(--ink);
  background: #22253e;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.rules-dialog::backdrop { background: rgba(6,7,18,.78); backdrop-filter: blur(8px); }
.rules-dialog form { padding: 28px; }
.rules-list { margin: 24px 0; padding-left: 24px; color: var(--muted); font-size: 13px; }
.rules-list li + li { margin-top: 13px; }
.rules-list b { color: #fff; }
.dialog-close { width: 100%; }

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 26px;
  max-width: min(420px, calc(100% - 30px));
  padding: 12px 17px;
  color: #fff;
  background: #343851;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transform: translate(-50%, 15px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #7b3441; }

.board-cell { fill: #fffdf8; stroke: #c8c2b6; stroke-width: .42; }
.board-cell.safe-red, .home-red { fill: #ff8a91; }
.board-cell.safe-green, .home-green { fill: #69daa9; }
.board-cell.safe-yellow, .home-yellow { fill: #f9d976; }
.board-cell.safe-blue, .home-blue { fill: #80adff; }
.safe-star { fill: rgba(30, 31, 45, .44); font-size: 5px; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.yard-base { fill: rgba(255,255,255,.84); stroke: rgba(38,39,55,.15); stroke-width: .6; }
.yard-spot { fill: rgba(255,255,255,.9); stroke-width: 1; }
.piece { cursor: default; filter: drop-shadow(0 1.4px 1.2px rgba(0,0,0,.34)); transition: transform 160ms ease; transform-box: fill-box; transform-origin: center; }
.piece.is-hidden-during-animation { opacity: 0; }
.piece.is-movable { cursor: pointer; animation: selectable 950ms ease-in-out infinite alternate; }
.piece.is-movable:hover { transform: scale(1.28); }
@keyframes selectable { from { filter: drop-shadow(0 0 1px #fff); } to { filter: drop-shadow(0 0 4px #fff); } }
.piece.is-finish-glow { animation: finish-glow 1.25s ease; }
.animated-piece { filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); pointer-events: none; }
.piece-step-body {
  transform-box: fill-box;
  transform-origin: center;
  animation: piece-step 136ms ease-in-out infinite;
}
.victim-piece { filter: drop-shadow(0 1px 2px rgba(0,0,0,.42)); pointer-events: none; }

.move-preview { pointer-events: none; }
.move-preview-path {
  fill: none;
  stroke: var(--player-color);
  stroke-width: 1.35;
  stroke-dasharray: 3 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .82;
  animation: preview-route 650ms linear infinite;
}
.move-preview-target-outer {
  fill: none;
  stroke: var(--player-color);
  stroke-width: 1.15;
  opacity: .82;
  transform-box: fill-box;
  transform-origin: center;
  animation: preview-target 760ms ease-in-out infinite alternate;
}
.move-preview-target {
  fill: rgba(255, 255, 255, .52);
  stroke: var(--player-color);
  stroke-width: 1.1;
}
.move-preview-ghost { opacity: .55; filter: drop-shadow(0 0 2px #fff); }

@keyframes piece-step {
  0%, 100% { transform: translateY(0) scale(1); }
  48% { transform: translateY(-1.7px) scale(1.1); }
}

@keyframes preview-route { to { stroke-dashoffset: -10.4; } }

@keyframes preview-target {
  from { opacity: .45; transform: scale(.82); }
  to { opacity: 1; transform: scale(1.16); }
}

@keyframes finish-glow {
  0%, 100% { filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); transform: scale(1); }
  35% { filter: drop-shadow(0 0 8px #fff) drop-shadow(0 0 12px var(--yellow)); transform: scale(1.45); }
  65% { filter: drop-shadow(0 0 6px #fff); transform: scale(1.18); }
}
.piece-label { fill: #fff; font-size: 3.5px; font-weight: 900; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }

@media (max-width: 900px) {
  .landing-screen { grid-template-columns: 1fr; gap: 45px; padding-top: 35px; }
  .hero-copy { text-align: center; }
  .hero-copy > p { margin-inline: auto; }
  .hero-features { justify-content: center; }
  .join-card { width: min(500px, 100%); margin: 0 auto; }
  .lobby-slots { grid-template-columns: repeat(2, 1fr); }
  .game-layout { grid-template-columns: 1fr; }
  .game-sidebar { grid-template-columns: repeat(2, 1fr); }
  .history-card { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .topbar, .screen { width: min(100% - 24px, 1180px); }
  .topbar { height: 70px; }
  .connection-label { display: none; }
  .connection-pill { padding: 9px; }
  .sound-label { display: none; }
  .sound-toggle { width: 35px; padding: 0; justify-content: center; }
  .landing-screen { min-height: auto; padding: 34px 0 60px; }
  .hero-copy h1 { font-size: clamp(42px, 14vw, 62px); }
  .hero-copy > p { font-size: 15px; }
  .hero-features { gap: 9px 13px; font-size: 11px; }
  .join-card { padding: 23px; border-radius: 20px; }
  .lobby-screen { padding: 35px 0 60px; }
  .lobby-heading { align-items: flex-start; flex-direction: column; }
  .lobby-heading h1 { font-size: 42px; }
  .room-badge { width: 100%; }
  .lobby-slots { margin-top: 24px; gap: 9px; }
  .lobby-slot { min-height: 154px; padding: 16px 9px; }
  .slot-token { width: 48px; height: 48px; }
  .lobby-actions { grid-template-columns: 1fr; gap: 22px; }
  .invite-row { flex-direction: column; }
  .start-block { text-align: left; }
  .start-block .button { width: 100%; }
  .game-screen { padding-top: 15px; }
  .game-topline h1 { font-size: 27px; }
  .game-layout { display: flex; flex-direction: column; }
  .board-card { width: 100%; border-radius: 18px; }
  .game-sidebar { width: 100%; grid-template-columns: 1fr; }
  .history-card { grid-column: auto; }
  .winner-card { padding: 30px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .board-event-badge { animation: none !important; opacity: 1; transform: translate(-50%, -50%); }
}
