:root {
  --ink: #263b47;
  --paper: #fff8eb;
  --coral: #ef796f;
  --line: 2px solid var(--ink);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font:
    16px/1.45 system-ui,
    -apple-system,
    sans-serif;
  background:
    radial-gradient(#dcc9ad 1px, transparent 1px) 0 0/20px 20px,
    var(--paper);
}
button,
input,
select {
  font: inherit;
}
button {
  min-height: 44px;
  border: var(--line);
  border-radius: 12px;
  background: #fffdf6;
  color: var(--ink);
  padding: 9px 14px;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--ink);
  touch-action: manipulation;
  cursor: pointer;
}
button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}
button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.shell {
  max-width: 1060px;
  margin: auto;
  padding: 16px;
}
.shell > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 4px 0 18px;
}
.brand {
  font-size: clamp(22px, 6vw, 32px);
  font-weight: 950;
  letter-spacing: -1.4px;
  color: var(--ink);
  text-decoration: none;
}
.header-links {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-links a,
.cake-link {
  font-size: 13px;
  color: var(--ink);
}
.notice {
  border: var(--line);
  background: #ffe9bb;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-weight: 700;
}
.hero,
.panel {
  background: #fffdf6;
  border: var(--line);
  border-radius: 20px;
  box-shadow: 6px 6px 0 var(--ink);
  padding: clamp(18px, 5vw, 34px);
}
.hero h1 {
  font-size: clamp(32px, 9vw, 58px);
  line-height: 0.98;
  letter-spacing: -3px;
  margin: 5px 0 13px;
}
.eyebrow {
  margin: 0;
  color: #87633e;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 12px;
}
.lede {
  max-width: 630px;
  margin: 0 0 20px;
  color: #526a70;
}
.games {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}
.game {
  border: var(--line);
  border-radius: 16px;
  padding: 15px;
  background: #fff5df;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: start;
}
.game:nth-child(2) {
  background: #e5f5f2;
}
.game:nth-child(3) {
  background: #e7f3fa;
}
.game h2 {
  margin: 7px 0;
  font-size: 23px;
  letter-spacing: -0.8px;
}
.game p {
  font-size: 13px;
  margin: 0;
}
.game .emoji {
  font-size: 34px;
}
.game button {
  margin-top: auto;
  width: 100%;
}
button.game {
  width: 100%;
  box-shadow: none;
  text-align: start;
  cursor: pointer;
}
button.game:active {
  transform: none;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.primary {
  background: var(--coral);
}
.fields {
  display: grid;
  gap: 10px;
  max-width: 430px;
}
.fields label,
.chooser label {
  font-size: 13px;
  font-weight: 800;
}
.fields input,
.fields select {
  min-height: 44px;
  border: var(--line);
  border-radius: 10px;
  padding: 9px;
  background: #fff;
}
.room-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}
.room-head h1 {
  margin: 3px 0;
  font-size: clamp(28px, 7vw, 43px);
  line-height: 1;
}
.room-code {
  font:
    700 12px ui-monospace,
    monospace;
  background: #edf3ef;
  border: var(--line);
  border-radius: 9px;
  padding: 6px;
}
.members {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin: 18px 0;
}
.member {
  border: var(--line);
  border-radius: 12px;
  padding: 9px;
  background: #fff4dd;
  font-size: 13px;
}
.member strong {
  display: block;
}
.member span {
  font-size: 11px;
}
.match-list,
.chooser {
  display: grid;
  gap: 9px;
  margin: 12px 0;
}
.match {
  border: var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #eef7f4;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}
.match small {
  display: block;
}
.board-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 250px;
}
.board-panel {
  padding: clamp(12px, 3vw, 22px);
}
.board-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.status-pill {
  font-size: 12px;
  font-weight: 900;
  background: #f5dc91;
  border: var(--line);
  border-radius: 999px;
  padding: 5px 9px;
}
.chess-wrap {
  min-width: 0;
}
.chess-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: min(100%, 650px);
  margin: auto;
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
}
.square {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #f7dcad;
  display: grid;
  place-items: center;
  line-height: 1;
  font-size: 0;
  overflow: hidden;
}
.square:active {
  transform: none;
  box-shadow: none;
}
.square:focus-visible {
  outline: 4px solid #fff;
  outline-offset: -6px;
  z-index: 2;
}
.square.dark {
  background: #bf8866;
}
.square.selected {
  outline: 5px solid #e94762;
  outline-offset: -5px;
  z-index: 1;
}
.square.legal::after {
  content: "";
  width: 24%;
  height: 24%;
  border-radius: 50%;
  background: #76bda0;
  opacity: 0.8;
}
.square.legal:has(.piece)::after {
  position: absolute;
  width: 82%;
  height: 82%;
  border: 3px solid #76bda0;
  background: none;
}
.piece {
  width: 78%;
  height: 78%;
  display: block;
  overflow: visible;
  z-index: 1;
}
.coord {
  position: absolute;
  pointer-events: none;
  font:
    800 clamp(8px, 1.7vw, 11px)/1 ui-monospace,
    monospace;
  letter-spacing: 0;
  color: #263b47;
  opacity: 0.85;
  z-index: 2;
}
.dark .coord {
  color: #fff8df;
}
.rank-label {
  top: 4px;
  left: 4px;
}
.file-label {
  right: 4px;
  bottom: 4px;
}
.chess-meta {
  width: min(100%, 650px);
  margin: 10px auto 0;
  font-size: 13px;
}
.chess-meta p {
  margin: 0 0 6px;
}
.move-list {
  max-height: 110px;
  overflow: auto;
  margin: 0;
  padding: 8px 10px 8px 28px;
  border: var(--line);
  border-radius: 10px;
  background: #fff4dd;
}
.move-list li {
  display: inline;
  margin-right: 9px;
}
.board-actions {
  margin-top: 12px;
}
.promotion {
  position: fixed;
  z-index: 5;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100vw - 32px);
  padding: 16px;
  border: var(--line);
  border-radius: 14px;
  background: #fffdf6;
  box-shadow: 6px 6px 0 var(--ink);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.promotion p {
  width: 100%;
  margin: 0;
}
.chess-side {
  display: grid;
  align-content: start;
  gap: 9px;
}
.rule-copy {
  font-size: 12px;
  color: #556b70;
}
.back {
  margin-top: 10px;
}
.hidden {
  display: none !important;
}
@media (max-width: 680px) {
  .shell {
    padding: 12px;
  }
  .games {
    grid-template-columns: 1fr;
  }
  .game {
    min-height: 0;
  }
  .game {
    min-height: 0;
  }
  .board-layout {
    grid-template-columns: 1fr;
  }
  .chess-side {
    grid-template-columns: 1fr;
  }
  .board-top,
  .room-head,
  .match {
    align-items: start;
    flex-direction: column;
  }
  .promotion {
    width: calc(100vw - 32px);
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
#board {
  position: relative;
}
.board3d-canvas {
  display: block;
  width: 100%;
  height: min(650px, 100vw);
  touch-action: manipulation;
  border: var(--line);
  border-radius: 10px;
  background: #f3dfbf;
}
.three-active {
  min-height: min(650px, 100vw);
}
.three-active > .board3d-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.three-active .chess-wrap,
.three-active .ludo-wrap {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.three-active .board-actions {
  position: relative;
  z-index: 2;
  margin-top: min(650px, 100vw);
}

.ludo-wrap {
  display: grid;
  gap: 12px;
  justify-items: center;
}
.ludo-grid {
  display: grid;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  grid-template-rows: repeat(15, minmax(0, 1fr));
  width: min(100%, 620px);
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  background: #fffbef;
}
.ludo-cell {
  border: 1px solid #c9b493;
  background: #fffdf6;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}
.ludo-cell .star {
  font-size: clamp(9px, 2.6vw, 17px);
  color: #1a3a32;
  line-height: 1;
}
.ludo-cell.safe {
  background: #9fd8b8;
}
.ludo-cell[data-color="red"],
.ludo-yard[data-color="red"] {
  background: var(--red);
}
.ludo-cell[data-color="blue"],
.ludo-yard[data-color="blue"] {
  background: var(--blue);
}
.ludo-cell[data-color="yellow"],
.ludo-yard[data-color="yellow"] {
  background: var(--yellow);
}
.ludo-cell[data-color="green"],
.ludo-yard[data-color="green"] {
  background: var(--green);
}
.ludo-yard {
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
}
.ludo-yard-inner {
  width: 68%;
  height: 68%;
  background: #fffdf6;
  border: 2px solid var(--ink);
  border-radius: 18%;
}
.ludo-finish {
  background: conic-gradient(
    from 45deg,
    var(--blue) 0 25%,
    var(--yellow) 0 50%,
    var(--green) 0 75%,
    var(--red) 0
  );
  border: 2px solid var(--ink);
}
.ludo-target {
  border-radius: 50%;
  margin: 16%;
  border: 3px dashed var(--ink);
  animation: ludo-pulse 1s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
.ludo-stack {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  align-content: center;
  min-width: 0;
  min-height: 0;
  z-index: 2;
  pointer-events: none;
}
.ludo-piece {
  pointer-events: auto;
  flex: 0 0 82%;
  max-width: 82%;
  aspect-ratio: 1;
  min-height: 0;
  min-width: 0;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 2px 0 var(--ink);
  font: 900 clamp(7px, 1.7vw, 12px)/1 system-ui;
  color: #fff;
  text-shadow: 0 1px 0 var(--ink);
  background: var(--red);
}
.ludo-stack .ludo-piece + .ludo-piece {
  margin-left: -58%;
}
.in-yard .ludo-piece {
  flex-basis: 62%;
  max-width: 62%;
}
.ludo-piece[data-color="blue"] {
  background: var(--blue);
}
.ludo-piece[data-color="yellow"] {
  background: var(--yellow);
}
.ludo-piece[data-color="green"] {
  background: var(--green);
}
.ludo-piece:disabled {
  opacity: 1;
  cursor: default;
}
.ludo-piece.withdrawn {
  opacity: 0.35;
}
.ludo-piece.movable {
  position: relative;
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 6px var(--ink);
  animation: ludo-hop 0.7s ease-in-out infinite;
  z-index: 3;
}
.ludo-hud {
  margin: 12px auto 0;
  display: flex;
  gap: 14px;
  align-items: center;
  width: min(100%, 620px);
  border: var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff4dd;
  border-left: 12px solid var(--hud, #ccc);
}
.ludo-news {
  display: grid;
  gap: 3px;
  font-size: 13px;
}
.ludo-news strong {
  font-size: 15px;
}
.die {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  width: 58px;
  height: 58px;
  padding: 8px;
  border: var(--line);
  border-radius: 12px;
  background: #fffdf6;
  box-shadow: 0 3px 0 var(--ink);
}
.die i {
  border-radius: 50%;
}
.die i.pip {
  background: var(--ink);
}
.die.dud {
  background: #f3d2cc;
}
.die.rolled {
  animation: ludo-roll 0.6s cubic-bezier(0.3, 1.6, 0.5, 1);
}
@keyframes ludo-roll {
  0% {
    transform: rotate(-200deg) scale(0.4);
  }
  60% {
    transform: rotate(20deg) scale(1.25);
  }
  100% {
    transform: none;
  }
}
@keyframes ludo-hop {
  50% {
    transform: translateY(-18%) scale(1.08);
  }
}
@keyframes ludo-pulse {
  50% {
    transform: scale(0.8);
    opacity: 0.5;
  }
}
.three-active .ludo-hud {
  position: relative;
  z-index: 2;
  margin-top: calc(min(650px, 100vw) + 12px);
}
.three-active .ludo-hud + .board-actions {
  margin-top: 12px;
}
.ludo-fun-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.ludo-fun-feed {
  position: absolute;
  inset-inline: 16px;
  bottom: 20px;
  display: grid;
  justify-items: center;
  gap: 6px;
}
.ludo-fun-line {
  max-width: min(92%, 380px);
  background: #17403a;
  color: #fff8df;
  border: 2px solid #d9a441;
  border-radius: 12px;
  padding: 8px 12px;
  text-align: center;
  font-weight: 800;
}
.ludo-fun-sticker,
.ludo-fun-gesture {
  position: absolute;
  transform: translate(-50%, -50%);
  background: #17403a;
  border: 2px solid #d9a441;
  border-radius: 12px;
  padding: 3px;
}
.ludo-fun-sticker svg {
  display: block;
  width: 58px;
  height: 58px;
}
.ludo-fun-gesture {
  font-size: 28px;
  line-height: 36px;
  width: 44px;
  height: 44px;
  text-align: center;
  padding: 2px;
  transition:
    left 0.62s ease-out,
    top 0.62s ease-out,
    transform 0.62s ease-out;
}
.ludo-fun-gesture.reduced {
  transition: none;
}
.ludo-fun-sheet {
  position: fixed;
  z-index: 20;
  inset: auto 16px 16px;
  max-height: 75vh;
  overflow: auto;
  background: #17403a;
  color: #fff8df;
  border: 3px solid #d9a441;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 6px 6px 0 #061512;
}
.ludo-fun-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.ludo-fun-sheet h3 {
  margin: 14px 0 7px;
  font-size: 14px;
}
.ludo-fun-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.ludo-fun-grid button {
  min-height: 38px;
  padding: 6px 9px;
  font-size: 12px;
}
.ludo-fun-grid .ludo-fun-sticker-button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 3px;
}
.ludo-fun-sticker-button svg {
  width: 42px;
  height: 42px;
}
@media (prefers-reduced-motion: reduce) {
  .ludo-fun-gesture {
    transition: none;
  }
}
.voice-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.voice-controls[hidden],
.voice-controls [hidden] {
  display: none;
}
.voice-controls button {
  padding: 7px 9px;
  font-size: 12px;
  box-shadow: none;
}
.voice-controls [aria-pressed="true"] {
  background: #c6e4e4;
}
.voice-controls small {
  width: 100%;
  color: #8b5a2b;
}
.voice-controls [data-voice-remote] {
  font-size: 14px;
}
.board2d {
  display: contents;
}
.square.last {
  background: #f1dc86;
}
.square.dark.last {
  background: #d1b453;
}
.square.check {
  background: radial-gradient(circle, #ff6b57 0 38%, #c8352a 75%);
}
.draw-offer {
  margin: 0 0 6px;
  padding: 6px 9px;
  border: var(--line);
  border-radius: 10px;
  background: #e5f5f2;
  font-weight: 800;
}
.sync-state {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 800;
  color: #3f7f68;
}
.sync-state.sync-bad {
  color: #b23a2c;
}
.language {
  float: inline-end;
  padding: 7px 10px;
  font-size: 12px;
}
.onboarding {
  max-width: 520px;
}
.terms {
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.terms input {
  width: auto;
  margin-top: 4px;
}
.lounge-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}
.lounge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: start;
  background: #eef7f4;
}
.lounge span {
  font-size: 12px;
  font-weight: 700;
}

.three-active.board3d-loading {
  min-height: 0;
}
.three-active.board3d-loading::before {
  content: var(--board3d-loading, "Loading 3D board…");
  display: block;
  margin: 0 auto 8px;
  width: min(100%, 620px);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}
.three-active.board3d-loading > .board3d-canvas {
  visibility: hidden;
}
.three-active.board3d-loading .chess-wrap,
.three-active.board3d-loading .ludo-wrap {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
  border: 0 !important;
}
.three-active.board3d-loading .board-actions,
.three-active.board3d-loading .ludo-hud {
  margin-top: 12px;
}
.game p {
  max-width: 100%;
  color: #18313a;
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.chess-board {
  direction: ltr;
}
.ludo-grid {
  direction: ltr;
}
