:root {
  --bg: #0f1220;
  --panel: #171b2e;
  --panel2: #1e2340;
  --text: #e8ecff;
  --muted: #8b93b8;
  --accent: #7c5cff;
  --accent2: #22c55e;
  --danger: #ef4444;
  --border: #2a3157;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body { min-height: 100vh; }

#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .3px;
}

button {
  font: inherit;
  color: var(--text);
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  cursor: pointer;
  transition: transform .1s, opacity .1s;
}
button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: default; }

.primary {
  background: linear-gradient(135deg, #7c5cff, #5b8cff);
  border: none;
  font-weight: 700;
}
.ghost { background: transparent; }

.status {
  font-weight: 700;
  color: #c9d2ff;
  min-height: 22px;
}

.players {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.player {
  flex: 1 1 120px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 13px;
}
.player.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.player .name { font-weight: 700; }
.player .meta { color: var(--muted); font-size: 12px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px;
}

h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0 0 7px;
}

.table {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 54px;
}
.set {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  padding: 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid transparent;
}
.set.editing {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.tile.small.selected {
  transform: translateY(-4px);
}
.empty { color: var(--muted); font-size: 13px; padding: 6px 2px; }

.rack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 64px;
}
.rack-group {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.rack-label {
  flex: 0 0 22px;
  width: 22px;
  line-height: 58px;
  text-align: center;
  font-size: 14px;
}
.rack-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.tile {
  position: relative;
  width: 44px;
  height: 58px;
  border-radius: 9px;
  background: linear-gradient(180deg, #f7f8ff, #dfe4f7);
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  border: 2px solid transparent;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
  transition: transform .12s, box-shadow .12s;
  user-select: none;
}
.tile.small {
  width: 34px;
  height: 44px;
  font-size: 15px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}
.tile.c1 { color: #d21f3c; }
.tile.c2 { color: #1d4ed8; }
.tile.c3 { color: #111; }
.tile.c4 { color: #15803d; }

.tile.joker {
  background: linear-gradient(135deg, #2b1a4d, #5b2ea6);
  color: #fff;
  font-size: 22px;
}
.tile.small.joker { font-size: 18px; }

.tile.selected {
  transform: translateY(-10px);
  border-color: var(--accent);
  box-shadow: 0 10px 18px rgba(124, 92, 255, .45), 0 3px 0 rgba(0, 0, 0, .35);
}

.tile .dot {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.tile .dot.c1 { background: #d21f3c; }
.tile .dot.c2 { background: #1d4ed8; }
.tile .dot.c3 { background: #111; }
.tile .dot.c4 { background: #16a34a; }

.hint {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}
.hint.error { color: #ff8a8a; }

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.controls .primary { grid-column: 1 / -1; }

.log {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 110px;
  overflow: auto;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  width: 100%;
  max-width: 380px;
}
.modal-card h2 {
  color: var(--text);
  font-size: 18px;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 8px;
}
.choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.result-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.result-line:last-child { border-bottom: none; }

/* ---------- juicy theme ---------- */

body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% 0%, #1b1450 0%, transparent 45%),
    radial-gradient(circle at 85% 12%, #0e3b52 0%, transparent 40%),
    radial-gradient(circle at 50% 100%, #171033 0%, transparent 55%),
    linear-gradient(160deg, #070a14 0%, #0b1022 45%, #080b18 100%);
  background-attachment: fixed;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .3;
  z-index: 0;
  pointer-events: none;
}

body::before {
  background: radial-gradient(circle, rgba(124, 92, 255, .85), transparent 65%);
  top: -26vmax;
  left: -18vmax;
  animation: aurora 18s ease-in-out infinite alternate;
}

body::after {
  background: radial-gradient(circle, rgba(34, 211, 238, .7), transparent 65%);
  bottom: -28vmax;
  right: -18vmax;
  animation: aurora 22s ease-in-out infinite alternate-reverse;
}

#app {
  position: relative;
  z-index: 1;
  gap: 12px;
}

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 120;
  pointer-events: none;
}

header { padding: 2px 2px 0; gap: 10px; }

.brand {
  position: relative;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: .4px;
  background: linear-gradient(90deg, #ffffff, #a78bfa, #67e8f9, #ffffff);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: text-flow 7s linear infinite;
}

.brand::after {
  content: "✨";
  position: absolute;
  top: -4px;
  right: -16px;
  font-size: 12px;
  animation: twinkle 2.2s ease-in-out infinite;
}

button {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(45, 52, 90, .92), rgba(24, 30, 54, .92));
  border: 1px solid rgba(139, 92, 246, .28);
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: transform .14s cubic-bezier(.2, .8, .2, 1.2), box-shadow .2s, filter .2s;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.15);
  box-shadow: 0 12px 26px rgba(0, 0, 0, .32), 0 0 20px rgba(139, 92, 246, .18);
}

button:active:not(:disabled) { transform: scale(.96); }
button:disabled { opacity: .42; filter: saturate(.6); }

.primary {
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 45%, #22d3ee 100%);
  background-size: 180% 180%;
  border: none;
  font-weight: 800;
  animation: gradient-shift 6s ease infinite;
  box-shadow: 0 10px 30px rgba(99, 102, 241, .45), inset 0 1px 0 rgba(255, 255, 255, .2);
}

.primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: -80%;
  width: 55%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: skewX(-20deg);
  animation: shine 3.6s ease-in-out infinite;
}

.ghost {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .12);
}

.status {
  font-weight: 800;
  letter-spacing: .2px;
  min-height: 24px;
  background: linear-gradient(90deg, #67e8f9, #a78bfa, #f472b6, #67e8f9);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: text-flow 6s linear infinite;
}

.player {
  background: linear-gradient(160deg, rgba(31, 37, 64, .85), rgba(15, 19, 36, .85));
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .2);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}

.player.active {
  border-color: rgba(34, 211, 238, .75);
  background: linear-gradient(160deg, rgba(34, 211, 238, .16), rgba(139, 92, 246, .14));
  box-shadow: 0 0 24px rgba(34, 211, 238, .22), inset 0 0 0 1px rgba(34, 211, 238, .35);
  animation: player-pulse 2.4s ease-in-out infinite;
}

.player .name { font-weight: 800; }
.player .meta { margin-top: 2px; }

.panel {
  background: linear-gradient(160deg, rgba(26, 31, 54, .92), rgba(14, 18, 35, .9));
  border: 1px solid rgba(139, 92, 246, .22);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(12px);
}

h2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  letter-spacing: .1em;
}

h2 span { color: rgba(255, 255, 255, .55); font-weight: 800; }

.table {
  position: relative;
  overflow: hidden;
  gap: 8px;
  min-height: 56px;
  padding: 10px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 30% 15%, rgba(34, 197, 94, .18), transparent 45%),
    radial-gradient(circle at 75% 85%, rgba(34, 211, 238, .12), transparent 45%),
    linear-gradient(160deg, #0c2b22, #071a15 60%, #081410);
  box-shadow: inset 0 2px 18px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(34, 197, 94, .16);
}

.table::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 14px 14px;
  opacity: .35;
  pointer-events: none;
}

.set {
  position: relative;
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .22);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

.set.editable { cursor: pointer; }
.set.editable .tile,
.set.targetable .tile { cursor: pointer; }

.set.editable:hover {
  border-color: rgba(34, 211, 238, .45);
  box-shadow: 0 0 22px rgba(34, 211, 238, .14);
  transform: translateY(-1px);
}

.set.editing {
  border-color: #22d3ee;
  box-shadow: 0 0 0 1px #22d3ee inset, 0 0 28px rgba(34, 211, 238, .35);
  animation: edit-glow 1.4s ease-in-out infinite alternate;
}

.set.targetable {
  cursor: pointer;
  border-color: rgba(34, 211, 238, .45);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, .25) inset, 0 0 22px rgba(34, 211, 238, .16);
}

.table.celebrate .set {
  animation: set-pop .5s cubic-bezier(.2, .9, .3, 1.4) both;
}

.empty {
  position: relative;
  color: rgba(226, 232, 255, .5);
}

.rack-label {
  line-height: 60px;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, .25));
}

.rack-row {
  perspective: 700px;
}

.tile {
  width: 46px;
  height: 60px;
  border-radius: 11px;
  background: linear-gradient(145deg, #ffffff 0%, #e7ebff 45%, #c7cfea 100%);
  border: 2px solid rgba(255, 255, 255, .55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    inset 0 -2px 0 rgba(0, 0, 0, .08),
    0 4px 0 #8f98c2,
    0 8px 14px rgba(0, 0, 0, .35);
  transition: transform .16s cubic-bezier(.2, .8, .2, 1.4), box-shadow .18s;
  will-change: transform;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 2px 2px auto;
  height: 42%;
  border-radius: 8px 8px 14px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.tile:hover {
  transform: translateY(-3px) rotateX(-6deg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    inset 0 -2px 0 rgba(0, 0, 0, .08),
    0 7px 0 #8f98c2,
    0 14px 22px rgba(0, 0, 0, .4);
}

.tile:active { transform: translateY(-1px) scale(.98); }

.tile.small {
  width: 36px;
  height: 46px;
  font-size: 15px;
  border-radius: 9px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    inset 0 -2px 0 rgba(0, 0, 0, .08),
    0 3px 0 #8f98c2,
    0 6px 12px rgba(0, 0, 0, .32);
}

.tile .num { position: relative; z-index: 2; }

.tile.c1 { color: #e11d48; text-shadow: 0 1px 0 #fff; }
.tile.c2 { color: #1d4ed8; text-shadow: 0 1px 0 #fff; }
.tile.c3 { color: #111827; text-shadow: 0 1px 0 #fff; }
.tile.c4 { color: #15803d; text-shadow: 0 1px 0 #fff; }

.tile.joker {
  background: linear-gradient(135deg, #2b1a4d, #7c3aed, #0ea5e9, #2b1a4d);
  background-size: 300% 300%;
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 255, 255, .8);
  animation: joker-flow 5s linear infinite;
}

.tile.small.joker { font-size: 18px; }

.tile.selected {
  transform: translateY(-12px) scale(1.05);
  border-color: rgba(34, 211, 238, .95);
  box-shadow:
    0 0 0 2px rgba(34, 211, 238, .35),
    0 14px 26px rgba(34, 211, 238, .35),
    0 4px 0 #8f98c2;
  animation: selected-glow 1.1s ease-in-out infinite alternate;
  z-index: 3;
}

.tile.small.selected {
  transform: translateY(-5px) scale(1.04);
}

.tile .dot {
  z-index: 3;
  box-shadow: 0 0 8px currentColor;
}

.tile .dot.c1 { background: #e11d48; color: #e11d48; }
.tile .dot.c2 { background: #2563eb; color: #2563eb; }
.tile .dot.c3 { background: #111827; color: #111827; }
.tile .dot.c4 { background: #16a34a; color: #16a34a; }

.hint {
  transition: color .2s;
  min-height: 22px;
}

.hint.error {
  color: #fecdd3;
  text-shadow: 0 0 12px rgba(251, 113, 133, .4);
}

.hint.shake { animation: shake .42s cubic-bezier(.36, .07, .19, .97); }

.log {
  background: rgba(255, 255, 255, .025);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 12px;
  padding: 8px 10px;
}

.modal {
  background: rgba(4, 6, 15, .62);
  backdrop-filter: blur(10px);
  z-index: 100;
}

.modal-card {
  background: linear-gradient(160deg, rgba(30, 36, 66, .98), rgba(14, 18, 35, .98));
  border: 1px solid rgba(139, 92, 246, .35);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 60px rgba(139, 92, 246, .15);
  animation: modal-pop .35s cubic-bezier(.2, .9, .3, 1.3) both;
}

.modal.win .modal-card {
  border-color: rgba(251, 191, 36, .6);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 70px rgba(251, 191, 36, .28);
}

.modal.win .modal-card h2 {
  background: linear-gradient(90deg, #fbbf24, #f472b6, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.choice button {
  width: 100%;
  font-weight: 700;
}

.combo-badge {
  position: fixed;
  left: 50%;
  top: 34%;
  z-index: 130;
  padding: 14px 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(139, 92, 246, .96), rgba(34, 211, 238, .96));
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: .5px;
  white-space: nowrap;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
  box-shadow: 0 20px 50px rgba(34, 211, 238, .35), inset 0 1px 0 rgba(255, 255, 255, .4);
  pointer-events: none;
  animation: combo-pop 1.05s cubic-bezier(.2, .9, .3, 1.3) both;
}

.workspace-panel {
  border-color: rgba(34, 211, 238, .38);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .35), 0 0 26px rgba(34, 211, 238, .12);
}

.workspace-panel.hidden { display: none; }

.workspace-panel h2 { color: #67e8f9; }

.workspace {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 48px;
}

.workspace-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 2px;
}

#fillBtn.active {
  border-color: rgba(34, 211, 238, .8);
  box-shadow: 0 0 24px rgba(34, 211, 238, .28), inset 0 0 0 1px rgba(34, 211, 238, .35);
}

#undoBtn[hidden] { display: none; }

@keyframes text-flow {
  to { background-position: -300% 0; }
}

@keyframes aurora {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vmax, 4vmax) scale(1.1); }
  100% { transform: translate(-4vmax, 8vmax) scale(.94); }
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes shine {
  0%, 55% { left: -80%; }
  80%, 100% { left: 130%; }
}

@keyframes twinkle {
  0%, 100% { opacity: .25; transform: scale(.8) rotate(-8deg); }
  50% { opacity: 1; transform: scale(1.25) rotate(8deg); }
}

@keyframes selected-glow {
  from {
    box-shadow:
      0 0 0 2px rgba(34, 211, 238, .25),
      0 12px 22px rgba(34, 211, 238, .25),
      0 4px 0 #8f98c2;
  }
  to {
    box-shadow:
      0 0 0 3px rgba(34, 211, 238, .5),
      0 18px 32px rgba(34, 211, 238, .45),
      0 4px 0 #8f98c2;
  }
}

@keyframes edit-glow {
  from { box-shadow: 0 0 0 1px #22d3ee inset, 0 0 18px rgba(34, 211, 238, .2); }
  to { box-shadow: 0 0 0 1px #22d3ee inset, 0 0 36px rgba(34, 211, 238, .45); }
}

@keyframes player-pulse {
  0%, 100% { box-shadow: 0 0 18px rgba(34, 211, 238, .18), inset 0 0 0 1px rgba(34, 211, 238, .3); }
  50% { box-shadow: 0 0 32px rgba(34, 211, 238, .32), inset 0 0 0 1px rgba(34, 211, 238, .5); }
}

@keyframes set-pop {
  0% { opacity: .35; transform: scale(.9) translateY(6px); filter: blur(2px); }
  60% { opacity: 1; transform: scale(1.035) translateY(-1px); filter: blur(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes joker-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

@keyframes modal-pop {
  0% { opacity: 0; transform: translateY(18px) scale(.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes combo-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5) rotate(-5deg); }
  28% { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(2deg); }
  62% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1.18) rotate(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

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


/* ---------- layout and control dock ---------- */

#app {
  padding-bottom: calc(255px + env(safe-area-inset-bottom));
}

.workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  position: relative;
  z-index: 4;
}

.workspace-head h2 { margin: 0; }

.mini-btn {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: none;
  white-space: nowrap;
}

.mini-btn:hover:not(:disabled) { transform: none; }

.workspace {
  padding-top: 10px;
  max-height: 176px;
  overflow-y: auto;
  align-content: flex-start;
}

.workspace .tile.selected {
  transform: translateY(-4px) scale(1.03);
}

.rack { padding-top: 16px; }
.workspace-panel h2 { position: relative; z-index: 5; }

.controls {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  width: min(760px, calc(100vw - 24px));
  z-index: 90;
  padding: 8px;
  border-radius: 18px;
  background: rgba(9, 13, 26, .86);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(139, 92, 246, .3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.controls .primary { grid-column: 1 / -1; }
.controls button { padding: 10px 12px; }

@media (max-width: 420px) {
  .controls { width: calc(100vw - 16px); }
}


.hint {
  position: fixed;
  left: 12px;
  right: 12px;
  margin: 0 auto;
  bottom: calc(174px + env(safe-area-inset-bottom));
  max-width: 736px;
  max-height: 92px;
  overflow-y: auto;
  z-index: 91;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(9, 13, 26, .9);
  border: 1px solid rgba(139, 92, 246, .3);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .5);
  backdrop-filter: blur(12px);
  font-size: 13px;
}

.hint:empty { display: none; }

.hint.error {
  color: #fecdd3;
  border-color: rgba(251, 113, 133, .45);
  background: rgba(40, 12, 24, .92);
}


/* ---------- drag and drop ---------- */

.set.draft {
  border-style: dashed;
  border-color: rgba(251, 191, 36, .65);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, .15) inset, 0 0 24px rgba(251, 191, 36, .12);
}

.set-handle {
  flex: 0 0 16px;
  align-self: center;
  width: 16px;
  text-align: center;
  color: rgba(255, 255, 255, .48);
  font-size: 17px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.set-handle:active { cursor: grabbing; }

.new-set-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px;
  border: 1px dashed rgba(34, 211, 238, .45);
  border-radius: 12px;
  color: rgba(226, 232, 255, .62);
  background: rgba(34, 211, 238, .04);
  text-align: center;
  font-size: 13px;
}

.new-set-zone span { font-weight: 700; color: #67e8f9; }
.new-set-zone small { font-size: 11px; opacity: .65; }

.tile.draggable { cursor: grab; touch-action: none; }
.tile.dragging-source { opacity: .35; }

.drag-ghost {
  opacity: .95;
  transform: translate(-50%, -50%) scale(1.07) rotate(-2deg) !important;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, .6));
  z-index: 300 !important;
}


/* ---------- lobby / online / timer ---------- */

.hidden { display: none !important; }

.loading {
  margin: 30vh auto 0;
  max-width: 360px;
  text-align: center;
  color: var(--muted);
  padding: 20px;
}

#lobby, #roomScreen, #gameScreen {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#profile {
  flex: 0 0 auto;
  border-color: rgba(34, 211, 238, .35);
  box-shadow: 0 0 22px rgba(34, 211, 238, .12);
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  flex: 1;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  color: #fff;
  border-color: rgba(34, 211, 238, .6);
  background: linear-gradient(135deg, rgba(34, 211, 238, .18), rgba(139, 92, 246, .18));
  box-shadow: 0 0 22px rgba(34, 211, 238, .18);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}

input, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: rgba(14, 18, 35, .9);
  border: 1px solid rgba(139, 92, 246, .28);
  border-radius: 10px;
  padding: 10px 11px;
  outline: none;
}

input:focus, select:focus {
  border-color: rgba(34, 211, 238, .65);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, .12);
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row > * { flex: 1; }
.row > button { flex: 0 0 auto; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  font-size: 13px;
  color: var(--muted);
}
.check input { width: auto; }

.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  margin: 10px 0;
}

.room-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .035);
}
.room-card .name { font-weight: 800; }
.room-card .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.room-card button { flex: 0 0 auto; padding: 8px 14px; }

.room-code {
  color: #67e8f9;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .12em;
  margin: 4px 0 10px;
}

.timer {
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5);
}
.timer-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22d3ee, #8b5cf6);
  box-shadow: 0 0 14px rgba(34, 211, 238, .55);
  transition: width .25s linear;
}
.timer-fill.low { background: linear-gradient(90deg, #fbbf24, #ef4444); }

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  max-width: min(520px, calc(100vw - 24px));
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(40, 12, 24, .95);
  border: 1px solid rgba(251, 113, 133, .5);
  color: #fecdd3;
  font-size: 13px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  animation: modal-pop .25s ease both;
}

#authError {
  white-space: pre-line;
  color: #fecdd3;
  border-color: rgba(251, 113, 133, .4);
  line-height: 1.45;
}


/* ================= reference table UI ================= */

body {
  background:
    radial-gradient(circle at 50% -10%, #1b5fb8 0%, transparent 55%),
    radial-gradient(circle at 100% 100%, #0a2b5c 0%, transparent 50%),
    linear-gradient(160deg, #061a38 0%, #082a57 55%, #041226 100%);
  background-attachment: fixed;
}
body::before {
  background: radial-gradient(circle, rgba(26, 126, 234, .5), transparent 65%);
  top: -34vmax;
  left: -10vmax;
}
body::after {
  background: radial-gradient(circle, rgba(250, 204, 21, .18), transparent 65%);
  bottom: -30vmax;
  right: -10vmax;
}
#app {
  max-width: 1400px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  height: 100dvh;
}
header { flex: 0 0 auto; }
.brand { font-size: 20px; }

.game-screen {
  display: grid;
  grid-template-columns: 152px minmax(0, 1fr) 96px;
  grid-template-rows: minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  flex: 1 1 auto;
}

.players-rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 2px;
}

.players-rail .player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(9, 46, 98, .92), rgba(5, 24, 54, .92));
  border: 1px solid rgba(120, 180, 255, .22);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .28);
}
.players-rail .player.active {
  border-color: rgba(34, 211, 238, .85);
  background: linear-gradient(160deg, rgba(15, 78, 150, .98), rgba(7, 35, 74, .98));
  box-shadow: 0 0 24px rgba(34, 211, 238, .25), inset 0 0 0 1px rgba(34, 211, 238, .4);
}
.players-rail .avatar {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(145deg, #3b82f6, #1e3a8a);
  border: 2px solid rgba(191, 219, 254, .7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 3px 8px rgba(0, 0, 0, .35);
}
.players-rail .player.active .avatar {
  border-color: #67e8f9;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .3), 0 0 20px rgba(34, 211, 238, .45);
}
.players-rail .player-info { min-width: 0; }
.players-rail .name {
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.players-rail .meta {
  font-size: 10.5px;
  color: rgba(219, 234, 254, .68);
  margin-top: 1px;
  white-space: nowrap;
}

.board-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  min-width: 0;
}
.status {
  flex: 0 0 auto;
  font-size: 13px;
  padding: 0 4px;
  min-height: 18px;
}
.board {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: flex-start;
  gap: 16px 24px;
  padding: 16px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 20% 0%, rgba(78, 163, 255, .24), transparent 45%),
    radial-gradient(circle at 90% 100%, rgba(0, 0, 0, .22), transparent 55%),
    linear-gradient(160deg, #0e55b0 0%, #0a4292 55%, #073472 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .12),
    inset 0 -14px 40px rgba(0, 0, 0, .26),
    0 18px 40px rgba(0, 0, 0, .38);
  border: 1px solid rgba(125, 190, 255, .25);
}
.board::before { display: none; }

.board .set {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  transition: transform .15s, filter .15s;
}
.board .set.draft {
  border: 2px dashed rgba(248, 113, 113, .85);
  background: rgba(127, 29, 29, .18);
  padding: 3px;
}
.board .set.editable:hover { filter: brightness(1.12); transform: translateY(-1px); }
.set-handle {
  flex: 0 0 14px;
  width: 14px;
  color: rgba(255, 255, 255, .32);
  font-size: 14px;
  line-height: 1;
}
.board .empty { color: rgba(219, 234, 254, .6); }

.tile {
  width: 44px;
  height: 56px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf8 0%, #f3eee2 62%, #e6dfd0 100%);
  border: 1px solid #bfb6a4;
  border-bottom: 3px solid currentColor;
  box-shadow:
    inset 0 1px 0 #fff,
    0 2px 0 #9c917c,
    0 5px 10px rgba(0, 0, 0, .32);
  font-size: 19px;
  letter-spacing: -.5px;
  transition: transform .14s cubic-bezier(.2, .8, .2, 1.4), box-shadow .16s;
}
.tile::before { display: none; }
.tile .num { position: relative; z-index: 2; font-weight: 900; }
.tile .dot { display: none; }
.tile.small {
  width: 36px;
  height: 46px;
  font-size: 16px;
  border-bottom-width: 3px;
}
.tile.c1 { color: #c62828; }
.tile.c2 { color: #1565c0; }
.tile.c3 { color: #1b1b1b; }
.tile.c4 { color: #2e7d32; }
.tile.joker {
  background: linear-gradient(145deg, #b3261e 0%, #e5484d 55%, #8e1b16 100%);
  color: #fff;
  border-color: #fca5a5;
  border-bottom-color: #7f1d1d;
  animation: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
.tile:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 #fff, 0 4px 0 #9c917c, 0 10px 16px rgba(0, 0, 0, .38);
}
.tile.selected { transform: translateY(-5px) scale(1.04); }

.rack-wood {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .28), transparent 16%),
    repeating-linear-gradient(90deg, rgba(90, 50, 12, .08) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, #d9a86a 0%, #c38a45 45%, #9a6428 100%);
  border: 1px solid rgba(255, 224, 178, .55);
  box-shadow:
    inset 0 2px 0 rgba(255, 245, 225, .55),
    inset 0 -6px 14px rgba(60, 30, 5, .35),
    0 14px 28px rgba(0, 0, 0, .42);
}
.rack {
  max-height: 132px;
  overflow-y: auto;
  gap: 5px;
  padding: 0;
}
.rack-row { gap: 3px; }
.rack-label { line-height: 46px; font-size: 13px; filter: none; opacity: .85; }


.side-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(11, 64, 130, .92), rgba(5, 28, 63, .94));
  border: 1px solid rgba(125, 190, 255, .25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 14px 30px rgba(0, 0, 0, .35);
  overflow-y: auto;
}
.score-box {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 7px 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .2);
  color: #fde68a;
  font-weight: 900;
  font-size: 16px;
}
.timer-box {
  width: 100%;
  padding: 6px 5px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .2);
  text-align: center;
}
#timerText { font-size: 24px; font-weight: 900; line-height: 1; color: #fff; }
.timer { width: 100%; height: 5px; margin-top: 5px; }
.timer-fill { background: linear-gradient(90deg, #67e8f9, #3b82f6); box-shadow: 0 0 10px rgba(59, 130, 246, .6); }

.orb {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-size: 20px;
  line-height: 1;
  border: 2px solid rgba(255, 255, 255, .2);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .25), 0 6px 14px rgba(0, 0, 0, .35);
}
.orb small { font-size: 9px; font-weight: 800; opacity: .8; margin-top: 1px; }
.orb.confirm {
  background: linear-gradient(145deg, #22b866, #0f6b39);
  border-color: #86efac;
  color: #ecfdf5;
}
.orb.undo {
  background: linear-gradient(145deg, #c03838, #7f1d1d);
  border-color: #fca5a5;
  color: #fef2f2;
}
.orb.draw {
  background: linear-gradient(145deg, #3b82f6, #1e3a8a);
  border-color: #93c5fd;
}
.orb.small {
  width: 42px;
  height: 42px;
  font-size: 16px;
  background: linear-gradient(145deg, rgba(59, 130, 246, .35), rgba(15, 23, 42, .7));
  border-color: rgba(147, 197, 253, .35);
}
.orb:disabled { opacity: .32; filter: saturate(.4); }

.game-screen .hint {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  margin: 0;
  max-width: none;
  max-height: 54px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(3, 20, 45, .55);
  border: 1px solid rgba(125, 190, 255, .16);
  box-shadow: none;
  backdrop-filter: none;
  color: #dbeafe;
  font-size: 12px;
  overflow-y: auto;
}
.game-screen .hint:empty { display: none; }
.game-screen .hint.error {
  color: #fecaca;
  border-color: rgba(248, 113, 113, .5);
  background: rgba(80, 10, 20, .65);
}
.game-screen .log { display: none; }
.board .new-set-zone {
  border-color: rgba(191, 219, 254, .45);
  background: rgba(255, 255, 255, .045);
  color: rgba(219, 234, 254, .8);
}
.board .new-set-zone span { color: #bfdbfe; }

/* lobby / room: blue table style */

#lobby, #roomScreen { overflow-y: auto; }
#lobby .panel, #roomScreen .panel, #authError {
  background: linear-gradient(160deg, rgba(10, 54, 110, .94), rgba(4, 24, 52, .94));
  border-color: rgba(125, 190, 255, .24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 18px 40px rgba(0, 0, 0, .35);
}
#lobby .player {
  background: linear-gradient(160deg, rgba(9, 46, 98, .92), rgba(5, 24, 54, .92));
  border-color: rgba(120, 180, 255, .25);
}
#lobby .tab {
  background: rgba(9, 46, 98, .7);
  border-color: rgba(125, 190, 255, .2);
  color: rgba(219, 234, 254, .75);
}
#lobby .tab.active {
  color: #fff;
  border-color: rgba(147, 197, 253, .8);
  background: linear-gradient(135deg, #1d6fd6, #0f4fa8);
  box-shadow: 0 0 22px rgba(59, 130, 246, .3);
}
#lobby .primary, #roomScreen .primary, .primary {
  background: linear-gradient(135deg, #2b7fe0, #0f4fa8);
  border-color: #60a5fa;
  box-shadow: 0 10px 26px rgba(15, 79, 168, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
  animation: none;
}
.primary::after { display: none; }
#lobby input, #lobby select {
  background: rgba(4, 22, 48, .9);
  border-color: rgba(96, 165, 250, .3);
}
#lobby input:focus, #lobby select:focus { border-color: #60a5fa; box-shadow: 0 0 0 2px rgba(96, 165, 250, .18); }
.room-card {
  background: linear-gradient(160deg, rgba(15, 64, 126, .75), rgba(5, 26, 55, .75));
  border-color: rgba(125, 190, 255, .2);
}
.room-code { color: #fde68a; }

.modal-card {
  background: linear-gradient(160deg, rgba(10, 48, 98, .99), rgba(4, 20, 45, .99));
  border-color: rgba(147, 197, 253, .35);
}
.modal.win .modal-card {
  border-color: rgba(251, 191, 36, .7);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .65), 0 0 70px rgba(251, 191, 36, .25);
}
.result-line { border-bottom-color: rgba(147, 197, 253, .2); }

@media (max-width: 760px) {
  #app { height: 100dvh; }
  .game-screen {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 6px;
  }
  .players-rail {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 2px;
  }
  .players-rail .player {
    flex: 0 0 auto;
    min-width: 126px;
    padding: 5px 7px;
  }
  .players-rail .avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 15px;
  }
  .players-rail .name { font-size: 11px; }
  .players-rail .meta { font-size: 9.5px; }
  .board {
    padding: 10px;
    gap: 10px 14px;
    border-radius: 14px;
  }
  .tile { width: 38px; height: 49px; font-size: 17px; border-radius: 7px; }
  .tile.small { width: 32px; height: 41px; font-size: 14px; }
  .rack-wood { padding: 7px 8px; border-radius: 12px; }
  .rack { max-height: 100px; }
  .rack-label { line-height: 41px; }
  .side-controls {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 6px;
    border-radius: 14px;
    overflow: visible;
  }
  .score-box, .timer-box { flex: 0 1 82px; padding: 5px; }
  #timerText { font-size: 18px; }
  .orb { width: 46px; height: 46px; font-size: 18px; }
  .orb.small { width: 38px; height: 38px; font-size: 14px; }
  .orb small { display: none; }
  .game-screen .hint { max-height: 46px; font-size: 11.5px; }
}

.players-rail .avatar.has-photo { overflow: hidden; padding: 0; }
.players-rail .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}


/* fill viewport and make rack one horizontal row */
#app {
  height: 100vh;
  height: 100dvh;
}
#lobby, #roomScreen {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.game-screen {
  flex: 1 1 0;
  height: 100%;
  min-height: 0;
}
.rack-wood {
  overflow: hidden;
}
.rack {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 3px;
}
.rack-group {
  flex: 0 0 auto;
}
.rack-row {
  flex-wrap: nowrap;
}
.rack-label {
  line-height: 56px;
}
.rack::-webkit-scrollbar { height: 6px; }
.rack::-webkit-scrollbar-thumb { background: rgba(80, 45, 10, .45); border-radius: 99px; }

@media (max-width: 760px) {
  .rack { max-height: none; }
  .rack-label { line-height: 49px; }
}


/* show all hand tiles and fill screen height */
#gameScreen:not(.hidden) {
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  min-height: 0;
}
.rack {
  flex-wrap: wrap;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 190px;
  align-content: flex-start;
}
.rack::-webkit-scrollbar { width: 6px; }
.rack::-webkit-scrollbar-thumb { background: rgba(80, 45, 10, .45); border-radius: 99px; }

@media (max-width: 760px) {
  #gameScreen:not(.hidden) { height: calc(100dvh - 64px); }
  .rack { max-height: 170px; }
}


/* fit table and rack to the screen */
body.game-active header { display: none; }
body.game-active #gameScreen:not(.hidden) {
  height: calc(100vh - 12px);
  height: calc(100dvh - 12px);
}
.board {
  display: block;
  padding: 0;
  overflow: hidden;
}
.board-inner {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: flex-start;
  gap: 16px 24px;
  padding: 16px;
  transform-origin: top left;
  will-change: transform;
}
.rack {
  display: block;
  padding: 0;
  height: auto;
  overflow: hidden;
}
.rack-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  transform-origin: top left;
  will-change: transform;
}
.joker-badge {
  position: absolute;
  right: 2px;
  bottom: 1px;
  z-index: 4;
  min-width: 14px;
  padding: 0 2px;
  border-radius: 4px;
  background: #fff;
  color: #b3261e;
  font-size: 9px;
  font-weight: 900;
  line-height: 13px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

@media (max-width: 760px) {
  .board-inner { padding: 10px; gap: 10px 14px; }
  .rack-inner { gap: 3px; }
  body.game-active #gameScreen:not(.hidden) { height: calc(100dvh - 12px); }
}


@media (max-width: 760px) {
  .game-screen {
    display: flex;
    flex-direction: column;
  }
  .players-rail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    overflow: visible;
    flex: 0 0 auto;
  }
  .players-rail .player {
    min-width: 0;
    padding: 5px 7px;
  }
  .board-column {
    flex: 1 1 auto;
    min-height: 0;
  }
  .board {
    flex: 1 1 auto;
    min-height: 0;
  }
  .side-controls {
    flex: 0 0 auto;
  }
}


/* no text selection / long-press menu in the game UI */
html, body, #app, #app * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input, select, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
img {
  -webkit-user-drag: none;
  pointer-events: none;
}
.players-rail .avatar img { pointer-events: none; }


.board { min-height: 40vh; }
.designs-link {
  display: block;
  text-align: center;
  margin: 4px 0 8px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px dashed rgba(147, 197, 253, .45);
  color: #bfdbfe;
  text-decoration: none;
  font-size: 13px;
  background: rgba(59, 130, 246, .08);
}
.designs-link:hover { background: rgba(59, 130, 246, .16); }
