/* CHURCH STREET CHECKERS — a Btown Games production */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --night: #221420;      /* dusk over the Marketplace */
  --night-2: #341d2b;
  --cream: #f6ecd9;
  --cream-dim: #d8c3a8;
  --gold: #f2b34c;       /* string-light amber */
  --brick: #7c3a24;      /* the paving bricks (the playing squares) */
  --brick-2: #8a4229;
  --mortar: #5c2a18;
  --paver: #cdb08a;      /* the light granite pavers */
  --paver-2: #bda078;
  --granite: #8f8578;    /* curbstone board frame */
  --red: #d0402f;        /* café-table red */
  --red-hi: #ef6a4f;
  --red-deep: #93261a;
  --iron: #33303a;       /* cast-iron black */
  --iron-hi: #57525f;
  --iron-deep: #141218;
}

html, body {
  height: 100%;
  overscroll-behavior: none;
  background: var(--night);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* Dusk downtown: plum sky → sunset ember → lamplit street */
#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    #17101c 0%,
    #2c1626 22%,
    #5c2833 30%,
    #a3543a 36%,
    #d98a4e 40%,
    #3a1e2b 41%,
    #2c1723 70%,
    #1c1019 100%
  );
}

#skyline {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(40% - 11vh);
  width: 100%;
  height: 11vh;
  opacity: 0.95;
  pointer-events: none;
}

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- screens */

.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px calc(env(safe-area-inset-bottom, 0px) + 8px);
}

#menu { justify-content: center; }

.menu-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3vh;
  width: 100%;
  max-width: 430px;
  flex: 1;
  justify-content: center;
  min-height: 0;
}

/* wordmark */
#logo { text-align: center; }
.l-street {
  display: block;
  font-size: clamp(16px, 2.8vh, 24px);
  font-weight: 900;
  letter-spacing: 0.5em;
  margin-left: 0.5em; /* optical centering vs letterspacing */
  color: var(--gold);
  text-shadow: 0 2px 0 rgba(23, 16, 28, 0.85);
}
.l-checkers { display: block; margin-top: 0.6vh; white-space: nowrap; }
.l-checkers i {
  display: inline-block;
  font-style: normal;
  font-weight: 900;
  font-size: clamp(34px, min(9.5vh, 11.5vw), 78px);
  line-height: 1;
  color: var(--red);
  -webkit-text-stroke: 2.5px #17101c;
  text-shadow: 0 5px 0 #17101c, 0 8px 18px rgba(0, 0, 0, 0.45);
  animation: bobble 2.6s ease-in-out infinite;
}
.l-checkers i:nth-child(even) {
  color: var(--iron);
  -webkit-text-stroke: 2.5px var(--cream);
}
.l-checkers i:nth-child(2) { animation-delay: 0.1s; }
.l-checkers i:nth-child(3) { animation-delay: 0.2s; }
.l-checkers i:nth-child(4) { animation-delay: 0.3s; }
.l-checkers i:nth-child(5) { animation-delay: 0.4s; }
.l-checkers i:nth-child(6) { animation-delay: 0.5s; }
.l-checkers i:nth-child(7) { animation-delay: 0.6s; }
.l-checkers i:nth-child(8) { animation-delay: 0.7s; }
@keyframes bobble {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-8px) rotate(1.5deg); }
}

#tagline {
  text-align: center;
  color: var(--cream);
  font-size: clamp(13px, 2vh, 16px);
  font-weight: 600;
  line-height: 1.45;
  text-shadow: 0 1px 4px rgba(23, 16, 28, 0.85);
}

#modes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.big-btn {
  font-size: clamp(18px, 2.8vh, 23px);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #17101c;
  background: linear-gradient(180deg, #ffc86a, var(--gold));
  border: 3px solid #17101c;
  border-radius: 16px;
  padding: 14px 38px;
  box-shadow: 0 5px 0 #17101c, 0 10px 22px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.06s ease;
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #17101c; }

.mode-sub {
  font-size: 12px;
  color: var(--cream-dim);
  font-style: italic;
  text-shadow: 0 1px 3px rgba(23, 16, 28, 0.85);
  margin-top: -2px;
  text-align: center;
}

#botRow {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 390px;
  margin-top: 1vh;
}
.bot-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  color: var(--cream);
  background: rgba(23, 16, 28, 0.55);
  border: 2px solid rgba(246, 236, 217, 0.3);
  border-radius: 14px;
  cursor: pointer;
  touch-action: manipulation;
}
.bot-btn:active { background: rgba(246, 236, 217, 0.14); }
.bot-name { font-size: 13px; font-weight: 900; letter-spacing: 0.05em; }
.bot-blurb { font-size: 11px; color: var(--cream-dim); font-style: italic; }

.fleet-credit {
  flex: none;
  text-align: center;
  font-size: 12px;
  color: var(--cream-dim);
  text-shadow: 0 1px 3px rgba(23, 16, 28, 0.9);
  padding-bottom: 4px;
}
.fleet-credit a { color: var(--gold); font-weight: 700; text-decoration: none; }
.fleet-credit a:active { text-decoration: underline; }

/* ---------------------------------------------------------------- game screen */

#game { justify-content: flex-start; gap: 0.8vh; }

#topbar {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chip-btn {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--cream);
  background: rgba(23, 16, 28, 0.55);
  border: 2px solid rgba(246, 236, 217, 0.3);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}
.chip-btn:active { background: rgba(246, 236, 217, 0.2); }

#mute {
  font-size: 17px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 2px solid rgba(246, 236, 217, 0.25);
  background: rgba(23, 16, 28, 0.55);
  color: var(--cream);
  cursor: pointer;
  touch-action: manipulation;
}

#tally {
  flex: 1;
  text-align: center;
  font-size: clamp(13px, 2vh, 16px);
  font-weight: 900;
  letter-spacing: 0.05em;
  color: var(--cream);
  text-shadow: 0 1px 4px rgba(23, 16, 28, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tally .t-red { color: var(--red-hi); }
#tally .t-black { color: #b9b3c4; }

/* turn banner */
#turnbar {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
#turnChip {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.14em;
  padding: 7px 16px;
  border-radius: 999px;
  border: 2px solid #17101c;
  color: var(--cream);
  box-shadow: 0 3px 0 rgba(23, 16, 28, 0.6);
  transition: background 0.2s ease, color 0.2s ease;
}
#turnChip:empty { display: none; }
#turnChip.red { background: linear-gradient(180deg, var(--red-hi), var(--red)); }
#turnChip.black { background: linear-gradient(180deg, var(--iron-hi), var(--iron)); }
#turnChip.thinking { animation: thinkPulse 1s ease-in-out infinite; }
@keyframes thinkPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
#forcedChip {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  border-radius: 999px;
  color: #17101c;
  background: linear-gradient(180deg, #ffc86a, var(--gold));
  border: 2px solid #17101c;
  box-shadow: 0 3px 0 rgba(23, 16, 28, 0.6);
  animation: thinkPulse 0.9s ease-in-out infinite;
}

/* ---------------------------------------------------------------- the bricks */

#street {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
}

#lights {
  width: min(100vw, 520px);
  height: clamp(18px, 3.2vh, 30px);
  margin-bottom: 0.4vh;
  pointer-events: none;
}
#lights .bulbs circle {
  fill: var(--gold);
  filter: drop-shadow(0 0 2px rgba(242, 179, 76, 0.9));
  animation: twinkle 2.8s ease-in-out infinite;
}
#lights .bulbs circle:nth-child(odd) { animation-delay: 1.1s; }
#lights .bulbs circle:nth-child(3n) { animation-delay: 1.9s; }
@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* live material: what remains, plus a quiet record of what was captured */
#materialBar {
  width: min(94vw, 440px, 56vh);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 5px;
}
.material {
  min-width: 0;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  color: var(--cream);
  background: rgba(23, 16, 28, 0.58);
  border: 1px solid rgba(246, 236, 217, 0.25);
  border-radius: 9px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
}
.material-side {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.material-count {
  min-width: 20px;
  font-size: 16px;
  line-height: 1;
  font-weight: 900;
  text-align: center;
}
.red-material .material-count { color: var(--red-hi); }
.black-material .material-count { color: #c9c2d6; }
.material-count.bump { animation: countBump 0.26s ease-out; }
@keyframes countBump {
  35% { transform: scale(1.38); color: var(--gold); }
}
.capture-tray {
  flex: 1;
  min-width: 44px;
  height: 18px;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  gap: 2px;
  padding: 2px 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
}
.black-material .capture-tray { justify-content: flex-end; }
.tray-piece {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  box-shadow: inset 0 -1px 1px rgba(0, 0, 0, 0.45);
}
.tray-piece.red { background: var(--red); border: 1px solid var(--red-hi); }
.tray-piece.black { background: var(--iron); border: 1px solid #77717f; }

/* the board flips between turns in pass & play */
#boardScene {
  width: min(94vw, 440px, 56vh);
  transition: transform 0.55s ease-in-out;
}
#boardScene.flipped { transform: rotate(180deg); }

#board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: clamp(5px, 1.4vw, 8px) solid var(--granite);
  border-radius: 10px;
  box-shadow:
    inset 0 0 0 2px rgba(23, 16, 28, 0.55),
    0 10px 26px rgba(0, 0, 0, 0.5);
  background: var(--paver);
  overflow: hidden;
}

#cells {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}
#cells > button {
  border: none;
  padding: 0;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
#cells > button.movable { cursor: grab; }
/* light granite pavers */
#cells > button.light {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.06)),
    var(--paver);
}
#cells > button.light:nth-child(even) { background-color: var(--paver-2); }
/* the playing squares: Church Street brick, mortar lines and all */
#cells > button.dark {
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0 26%,
      var(--mortar) 26% 30%,
      transparent 30% 62%,
      var(--mortar) 62% 66%,
      transparent 66% 100%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(0, 0, 0, 0.12)),
    var(--brick);
}
#cells > button.dark:nth-child(odd) { background-color: var(--brick-2); }

/* where the selected piece can land */
#cells > button.target::after {
  content: "";
  position: absolute;
  inset: 34%;
  border-radius: 50%;
  background: rgba(242, 179, 76, 0.95);
  box-shadow: 0 0 8px 2px rgba(242, 179, 76, 0.6), inset 0 -2px 0 rgba(23, 16, 28, 0.35);
  animation: targetPulse 1s ease-in-out infinite;
}
#cells > button.target.capture-hop::after {
  inset: 26%;
  background: radial-gradient(circle at 50% 42%, #ffd9a1, var(--gold) 70%);
  border: 2.5px solid #17101c;
}
#cells > button.drop::after {
  inset: 18%;
  animation: none;
  background: radial-gradient(circle at 50% 42%, #ffe6bd, var(--gold) 72%);
  box-shadow: 0 0 14px 5px rgba(242, 179, 76, 0.75), inset 0 -2px 0 rgba(23, 16, 28, 0.35);
}
@keyframes targetPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
/* the square the selected piece stands on */
#cells > button.from { box-shadow: inset 0 0 0 3px var(--gold); }
#cells.disabled > button { pointer-events: none; }
@media (hover: hover) {
  #cells > button.dark:hover { filter: brightness(1.12); }
}

/* ---------------------------------------------------------------- checkers */

#pieces { position: absolute; inset: 0; pointer-events: none; }
#effectLayer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }

.piece {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  padding: 7%;
  will-change: left, top;
  transition: left 0.22s ease-in-out, top 0.22s ease-in-out, transform 0.55s ease-in-out;
}
#boardScene.flipped .piece { transform: rotate(180deg); }
.piece::before {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 50%;
}
/* café-table red */
.piece.red::before,
.capture-fly.red::before {
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.5) 0 9%, transparent 30%),
    radial-gradient(circle at 50% 50%, transparent 0 58%, rgba(246, 236, 217, 0.85) 60% 68%, transparent 70%),
    radial-gradient(circle at 50% 42%, var(--red-hi), var(--red) 55%, var(--red-deep));
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.4), 0 3px 5px rgba(0, 0, 0, 0.45);
}
/* cast iron */
.piece.black::before,
.capture-fly.black::before {
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.35) 0 9%, transparent 30%),
    radial-gradient(circle at 50% 50%, transparent 0 58%, rgba(246, 236, 217, 0.55) 60% 68%, transparent 70%),
    radial-gradient(circle at 50% 42%, var(--iron-hi), var(--iron) 55%, var(--iron-deep));
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.5), 0 3px 5px rgba(0, 0, 0, 0.5);
}
/* a little crown for the kings */
.piece.king::after {
  content: "👑";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(11px, 4.4vw, 22px);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
  animation: crownIn 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes crownIn {
  from { transform: scale(0) rotate(-40deg); }
  to { transform: scale(1) rotate(0); }
}

/* a piece that MUST jump glows amber */
.piece.must::before {
  animation: mustGlow 0.9s ease-in-out infinite;
}
@keyframes mustGlow {
  0%, 100% { box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.4), 0 0 6px 2px rgba(242, 179, 76, 0.75); }
  50% { box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.4), 0 0 16px 6px rgba(242, 179, 76, 0.95); }
}

.piece.selected { z-index: 3; }
.piece.selected::before {
  outline: 3px solid var(--gold);
  outline-offset: 1px;
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.4), 0 0 14px 4px rgba(242, 179, 76, 0.8);
}

.piece.dragging {
  z-index: 6;
  transition: none;
  transform: translate(var(--dx, 0px), var(--dy, 0px)) scale(1.12);
}
#boardScene.flipped .piece.dragging {
  transform: translate(var(--dx, 0px), var(--dy, 0px)) rotate(180deg) scale(1.12);
}
.piece.dragging::before {
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.4), 0 10px 16px rgba(0, 0, 0, 0.5);
}
.piece.snapback { transition: transform 0.18s ease; }

/* a captured piece pops off the bricks */
.piece.zapped { z-index: 2; }
.piece.zapped::before {
  animation: zap 0.3s ease-in forwards;
}
.piece.flown::before { opacity: 0; }
@keyframes zap {
  to { transform: scale(0.1) rotate(90deg); opacity: 0; }
}

.capture-fly {
  position: fixed;
  z-index: 50;
  pointer-events: none;
}
.capture-fly::before {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 50%;
}

.crown-burst {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}
.crown-burst::before {
  content: "";
  position: absolute;
  width: 48px;
  height: 48px;
  margin: -24px;
  border: 4px solid var(--gold);
  border-radius: 50%;
  animation: crownRing 0.65s ease-out forwards;
}
.crown-burst i {
  position: absolute;
  width: 7px;
  height: 7px;
  margin: -3.5px;
  border-radius: 50%;
  background: #ffd16f;
  box-shadow: 0 0 6px 2px rgba(242, 179, 76, 0.9);
  animation: crownSpark 0.65s ease-out var(--spark-delay) forwards;
}
@keyframes crownRing {
  from { transform: scale(0.25); opacity: 1; }
  to { transform: scale(1.35); opacity: 0; }
}
@keyframes crownSpark {
  from { transform: translate(0, 0) scale(1); opacity: 1; }
  to { transform: translate(var(--spark-x), var(--spark-y)) scale(0.2); opacity: 0; }
}
@keyframes comboNudge {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-5px) rotate(-0.35deg); }
  65% { transform: translateX(4px) rotate(0.3deg); }
}
#board.combo-nudge { animation: comboNudge 0.24s ease-out; }
@keyframes crownBeat {
  40% { box-shadow: inset 0 0 0 3px rgba(255, 209, 111, 0.9), 0 0 26px 8px rgba(242, 179, 76, 0.55); }
}
#board.crown-beat { animation: crownBeat 0.62s ease-out; }

#momentBanner {
  position: absolute;
  left: 50%;
  top: 58%;
  z-index: 12;
  pointer-events: none;
  max-width: 90vw;
  padding: 10px 18px;
  border: 3px solid #17101c;
  border-radius: 14px;
  color: #17101c;
  background: linear-gradient(180deg, #ffe09c, var(--gold));
  box-shadow: 0 5px 0 rgba(23, 16, 28, 0.85), 0 10px 25px rgba(0, 0, 0, 0.4);
  font-size: clamp(20px, 6vw, 34px);
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-align: center;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(-2deg);
}
#momentBanner.moment-banner { animation: momentIn 0.58s cubic-bezier(.2, 1.35, .35, 1); }
#momentBanner.crown { color: #5d2e0d; }
@keyframes momentIn {
  0% { transform: translate(-50%, -50%) scale(0.45) rotate(3deg); opacity: 0; }
  45% { transform: translate(-50%, -50%) scale(1.1) rotate(-2deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); opacity: 1; }
}

/* endgame: the losing side fades into the dusk */
#board.showdown .piece.dimmed { filter: brightness(0.45) saturate(0.6); }

/* ---------------------------------------------------------------- results */

#resultbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 15;
}
#resultText {
  font-size: clamp(19px, 3.2vh, 28px);
  font-weight: 900;
  letter-spacing: 0.09em;
  text-align: center;
  color: var(--cream);
  text-shadow: 0 3px 0 rgba(23, 16, 28, 0.85), 0 6px 16px rgba(0, 0, 0, 0.5);
  transform: rotate(-1.5deg);
  animation: resultIn 0.35s ease-out;
}
#resultText.red-win { color: var(--red-hi); }
#resultText.black-win { color: #c9c2d6; }
@keyframes resultIn {
  from { transform: rotate(-1.5deg) scale(0.6); opacity: 0; }
  to { transform: rotate(-1.5deg) scale(1); opacity: 1; }
}
#resultBtns { display: flex; gap: 10px; align-items: center; }
#resultBtns .big-btn { padding: 11px 28px; font-size: 17px; }
#creditEnd { margin-top: auto; }

/* monthly leaderboard (vs-bot games only) */
#lb {
  width: min(92vw, 340px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 14px;
  background: linear-gradient(180deg, var(--night-2), var(--night));
  border: 3px solid #17101c;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  color: var(--cream);
}
.lb-tabs { display: flex; gap: 8px; }
.lb-tab {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--cream-dim);
  background: rgba(23, 16, 28, 0.6);
  border: 2px solid rgba(246, 236, 217, 0.25);
  border-radius: 999px;
  cursor: pointer;
}
.lb-tab.sel {
  color: #17101c;
  background: linear-gradient(180deg, #ffc86a, var(--gold));
  border-color: #17101c;
}
#lbStatus { font-size: 12px; font-weight: 700; color: var(--cream-dim); text-align: center; }
#lbList {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#lbList li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 8px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
}
#lbList li.me { background: rgba(242, 179, 76, 0.18); color: var(--gold); }
#lbList .rank { width: 24px; text-align: center; flex: none; }
#lbList .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
#lbList .sc { flex: none; font-variant-numeric: tabular-nums; }
#lbForm { display: flex; gap: 8px; width: 100%; }
#lbForm input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--cream);
  background: rgba(23, 16, 28, 0.72);
  border: 2px solid rgba(246, 236, 217, 0.3);
  border-radius: 10px;
  outline: none;
}
#lbForm input:focus { border-color: var(--gold); }
#lbRenameBtn { font-size: 11px; padding: 5px 12px; }

/* ---------------------------------------------------------------- Scoop */

#cheer {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) - 6px);
  right: 3%;
  z-index: 14;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  animation: cheerUp 0.55s cubic-bezier(0.2, 1.4, 0.4, 1);
}
#cheerSvg { width: clamp(74px, 13vh, 120px); height: auto; }
#cheerBubble {
  background: var(--cream);
  color: #17101c;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 14px 14px 3px 14px;
  margin-right: 40%;
  margin-bottom: 2px;
  max-width: 200px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  animation: bubbleIn 0.3s ease-out 0.4s backwards;
}
@keyframes cheerUp {
  from { transform: translateY(110%); }
  to { transform: translateY(0); }
}
@keyframes bubbleIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ------------------------------------------------------------ online play */

.online-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream-dim);
  text-shadow: 0 1px 3px rgba(23, 16, 28, 0.85);
  margin-top: 1.6vh;
}
#onlineRow {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 390px;
  margin-top: 6px;
}
#rejoinBtn { margin-top: 10px; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(23, 16, 28, 0.76);
  backdrop-filter: blur(3px);
}
.op-card {
  width: min(92vw, 340px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 18px;
  background: linear-gradient(180deg, var(--night-2), var(--night));
  border: 3px solid #17101c;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  color: var(--cream);
  text-align: center;
}
.op-title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.op-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--cream-dim);
  text-align: left;
  margin-bottom: -6px;
}
.op-card input {
  width: 100%;
  padding: 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--cream);
  background: rgba(23, 16, 28, 0.72);
  border: 2px solid rgba(246, 236, 217, 0.3);
  border-radius: 12px;
  outline: none;
  text-align: center;
}
.op-card input:focus { border-color: var(--gold); }
#opCode { letter-spacing: 0.4em; text-transform: uppercase; font-size: 24px; }
.op-error {
  font-size: 13px;
  font-weight: 700;
  color: #ffb09c;
}
.op-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-top: 4px;
}
.op-btns .big-btn { font-size: 16px; padding: 12px 22px; }
#lobbyCode {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  color: var(--gold);
  text-shadow: 0 3px 0 #17101c;
  padding: 6px 0;
  animation: lobbyPulse 1.6s ease-in-out infinite;
}
@keyframes lobbyPulse {
  50% { opacity: 0.75; }
}
#lobbyHint { font-size: 13px; color: var(--cream-dim); }

/* ---------------------------------------------------------------- desktop */

@media (min-width: 700px) {
  #game { gap: 1.4vh; }
  #turnChip { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .l-checkers i, #lights .bulbs circle, #turnChip.thinking, #forcedChip,
  .piece.must::before, #cells > button.target::after, .piece.king::after,
  .piece.zapped::before, #resultText, #cheer, #cheerBubble, #lobbyCode,
  .material-count.bump, #board.combo-nudge, #board.crown-beat,
  #momentBanner.moment-banner, .crown-burst::before { animation: none !important; }
  .crown-burst i { display: none; }
  #boardScene, .piece, .piece.snapback { transition: none !important; }
}
