:root {
  --felt: #1b6a48;
  --felt-deep: #0e3d2b;
  --felt-light: #2a855c;
  --wood: #4a3018;
  --wood-dark: #2a1a0c;
  --wood-light: #6b4423;
  --ivory: #f3ead6;
  --ivory-shadow: #d9ccb0;
  --ink: #1c140e;
  --gold: #d4b44a;
  --gold-deep: #b8902a;
  --cream: #f7f1e4;
  --red: #b4232e;
  --blue: #1d4e89;
  --warm: #f2c36b;
  --text: #f4ead8;
  --muted: #cbbfa6;
  --shadow: rgba(12, 8, 4, 0.55);
  --radius: 18px;
  --tile-long: 96px;
  --tile-short: 48px;
  --hand-long: 120px;
  --hand-short: 60px;
  --hand-overlap: 6px;
  --cpu-overlap: 14px;
  --table-max: 66vmin;
  --vvw: 100vw;
  --vvh: 100dvh;
}

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

html {
  height: 100%;
  height: 100svh;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  height: 100%;
  height: 100svh;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: Outfit, "Source Sans 3", system-ui, sans-serif;
  color: var(--text);
  background: #07140e;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}

button, input, select {
  font-family: inherit;
}

#app {
  position: relative;
  height: var(--vvh, 100svh);
  width: var(--vvw, 100%);
  min-height: 0;
  overflow: hidden;
}

/* ---------- PATIO ATMOSPHERE ---------- */
.patio-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 50% 18%, rgba(43, 140, 88, 0.28), transparent 58%),
    radial-gradient(700px 420px at 50% 100%, rgba(212, 180, 74, 0.08), transparent 55%),
    linear-gradient(180deg, #10261a 0%, #0a1812 42%, #070e0b 100%);
  pointer-events: none;
}

.patio-wall {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0 12px, transparent 12px 48px),
    linear-gradient(180deg, rgba(90, 70, 42, 0.35), rgba(30, 22, 14, 0.15) 42%, transparent 70%);
  opacity: 0.16;
}

.patio-glow {
  position: absolute;
  inset: auto 0 0;
  height: 40%;
  background: radial-gradient(ellipse at 50% 100%, rgba(212, 180, 74, 0.12), transparent 70%);
}

.string-lights {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  pointer-events: none;
}

.string-lights svg {
  width: 100%;
  height: 70px;
}

.string-lights .wire {
  stroke: #2a2118;
  stroke-width: 2.2;
}

.bulb {
  position: absolute;
  top: 22px;
  width: 10px;
  height: 14px;
  border-radius: 6px 6px 8px 8px;
  background: radial-gradient(circle at 40% 30%, #fff6d2, var(--warm) 55%, #c9892a);
  box-shadow: 0 0 14px 4px rgba(242, 195, 107, 0.45);
  transform: translateX(-50%);
  animation: twinkle 2.4s ease-in-out infinite;
}

.bulb.gold {
  background: radial-gradient(circle at 40% 30%, #fff, var(--gold) 60%, #8a5a12);
  animation-duration: 2.8s;
}
.bulb.warm {
  top: 34px;
  animation-duration: 2.1s;
}

.string-lights .bulb:nth-child(2) { animation-delay: 0s; }
.string-lights .bulb:nth-child(3) { animation-delay: 0.35s; }
.string-lights .bulb:nth-child(4) { animation-delay: 0.7s; }
.string-lights .bulb:nth-child(5) { animation-delay: 0.15s; }
.string-lights .bulb:nth-child(6) { animation-delay: 1.1s; }
.string-lights .bulb:nth-child(7) { animation-delay: 0.5s; }
.string-lights .bulb:nth-child(8) { animation-delay: 1.4s; }
.string-lights .bulb:nth-child(9) { animation-delay: 0.25s; }
.string-lights .bulb:nth-child(10) { animation-delay: 0.9s; }

@keyframes twinkle {
  0%, 100% {
    opacity: 1;
    filter: brightness(1);
    box-shadow: 0 0 12px 3px rgba(242, 195, 107, 0.4);
  }
  40% {
    opacity: 0.45;
    filter: brightness(0.55);
    box-shadow: 0 0 4px 1px rgba(242, 195, 107, 0.12);
  }
  55% {
    opacity: 1;
    filter: brightness(1.35);
    box-shadow: 0 0 22px 8px rgba(255, 220, 140, 0.7);
  }
  70% {
    opacity: 0.7;
    filter: brightness(0.85);
    box-shadow: 0 0 10px 3px rgba(242, 195, 107, 0.3);
  }
}

.plant {
  position: absolute;
  width: 180px;
  height: 280px;
  background:
    radial-gradient(ellipse at 50% 80%, #0d2a1c 0 30%, transparent 31%),
    radial-gradient(ellipse at 30% 50%, #1f5a38 0 22%, transparent 23%),
    radial-gradient(ellipse at 70% 46%, #246644 0 26%, transparent 27%),
    radial-gradient(ellipse at 48% 28%, #2f7a4e 0 20%, transparent 21%);
  opacity: 0.42;
  filter: blur(0.2px);
}

.plant-left { left: -40px; bottom: 8%; }
.plant-right { right: -50px; bottom: 18%; transform: scaleX(-1); }

.chair {
  position: absolute;
  width: 70px;
  height: 86px;
  border: 5px solid #c9d0c4;
  border-radius: 8px 8px 4px 4px;
  opacity: 0.22;
  box-shadow: inset 0 18px 0 #aeb6aa;
}

.chair::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -18px;
  height: 16px;
  border: 5px solid #c9d0c4;
  border-top: 0;
}

.chair-tl { top: 88px; left: 4%; transform: rotate(-8deg); }
.chair-tr { top: 96px; right: 5%; transform: rotate(7deg); }
.chair-bl { bottom: 6%; left: 3%; transform: rotate(4deg); }
.chair-br { bottom: 8%; right: 3%; transform: rotate(-5deg); }

/* ---------- SCREENS ---------- */
.screen {
  position: relative;
  z-index: 1;
  display: none;
  height: 100%;
  min-height: 0;
}

.screen.active {
  display: flex;
}

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

.plant-left,
.plant-right,
.chair { display: none; }

#screen-start {
  align-items: center;
  justify-content: center;
  padding: max(64px, calc(env(safe-area-inset-top) + 52px)) 20px max(28px, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.start-card {
  position: relative;
  overflow: visible;
  width: min(400px, 100%);
  max-height: none;
  text-align: center;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.start-card::before { display: none; }

.barrio-extras { display: none; }

.start-brand {
  margin-bottom: 22px;
}

.start-card > :not(.barrio-extras) {
  position: relative;
  z-index: 1;
}

.beer-ring {
  position: absolute;
  width: 70px;
  height: 70px;
  right: 18px;
  top: 22px;
  border: 3px solid rgba(180, 140, 70, 0.18);
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px rgba(120, 80, 30, 0.08);
  transform: rotate(-12deg);
}

.napkin {
  position: absolute;
  left: -8px;
  bottom: 36px;
  width: 54px;
  height: 42px;
  background: linear-gradient(135deg, rgba(247, 241, 228, 0.16), rgba(247, 241, 228, 0.05));
  border: 1px dashed rgba(247, 241, 228, 0.18);
  transform: rotate(-18deg);
  border-radius: 2px;
}

.loose-tile {
  position: absolute;
  width: 38px;
  height: 20px;
  border-radius: 3px;
  background: linear-gradient(160deg, #fffaf0, #d9ccb0);
  border: 1px solid #cfc3a6;
  box-shadow: 0 4px 8px rgba(0,0,0,0.35);
}

.loose-tile::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 3px;
  bottom: 3px;
  width: 1px;
  background: #8a7350;
  transform: translateX(-50%);
}

.lt1 {
  left: -14px;
  top: 58px;
  animation: looseRock 5.5s ease-in-out infinite;
}

.lt2 {
  right: -12px;
  bottom: 72px;
  width: 20px;
  height: 38px;
  animation: looseRock 6.2s ease-in-out infinite reverse;
}

.lt2::before {
  left: 3px;
  right: 3px;
  top: 50%;
  bottom: auto;
  width: auto;
  height: 1px;
  transform: translateY(-50%);
}

@keyframes looseRock {
  0%, 100% { transform: rotate(-16deg) translateY(0); }
  50% { transform: rotate(-22deg) translateY(-2px); }
}

.eyebrow {
  display: inline-block;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
  color: rgba(247, 241, 228, 0.55);
  margin-bottom: 10px;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 0;
}

.title {
  font-family: Bevan, "Outfit", serif;
  font-size: clamp(48px, 12vw, 72px);
  line-height: 0.88;
  color: #fbf6ea;
  background: none;
  filter: none;
  letter-spacing: -0.02em;
}

.subtitle {
  margin-top: 10px;
  font-family: Outfit, sans-serif;
  font-style: normal;
  font-weight: 500;
  color: rgba(247, 241, 228, 0.62);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.flag-dot {
  display: inline-block;
  width: 18px;
  height: 12px;
  margin-left: 6px;
  border-radius: 2px;
  vertical-align: middle;
  background:
    linear-gradient(90deg, var(--blue) 0 33%, #fff 33% 36%, var(--red) 36% 64%, #fff 64% 67%, var(--blue) 67% 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25);
}

.tagline { display: none; }

.start-table-preview {
  display: flex;
  justify-content: center;
  margin: 0 0 28px;
}

.mini-felt {
  width: min(300px, 86%);
  height: 92px;
  border-radius: 28px;
  background: radial-gradient(circle at 50% 40%, #2f8f5c, #0e3d2b 70%);
  border: 0;
  box-shadow:
    0 0 0 10px #3a2412,
    0 0 0 11px rgba(255, 220, 160, 0.18),
    0 24px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-dominoes {
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.preview-dominoes .domino {
  --long: 72px;
  --short: 36px;
  width: var(--long);
  height: var(--short);
  transform-origin: center center;
}

.preview-tile-0 { animation: previewIdleA 3.8s ease-in-out infinite; }
.preview-tile-1 { animation: previewIdleB 4.6s ease-in-out infinite 0.4s; }
.preview-tile-2 { animation: previewIdleC 4.1s ease-in-out infinite 0.8s; }

@keyframes previewIdleA {
  0%, 100% { transform: rotate(-8deg) translateY(0); }
  35% { transform: rotate(-14deg) translateY(-4px); }
  48% { transform: rotate(-6deg) translateY(1px); }
  62% { transform: rotate(-9deg) translateY(0); }
}

@keyframes previewIdleB {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  40% { transform: rotate(3deg) translateY(-3px); }
  52% { transform: rotate(-2deg) translateY(2px) scale(0.98); }
  64% { transform: rotate(0deg) translateY(0); }
}

@keyframes previewIdleC {
  0%, 100% { transform: rotate(10deg) translateY(0); }
  30% { transform: rotate(16deg) translateY(-3px); }
  55% { transform: rotate(8deg) translateY(1px); }
}

.start-actions {
  display: grid;
  gap: 16px;
}

.start-actions[hidden],
.menu-panel[hidden],
#game-modes-section[hidden],
#login-section[hidden],
#online-room-actions[hidden],
[hidden] {
  display: none !important;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.32);
}

.mode-card {
  position: relative;
  text-align: center;
  border: 0;
  background: transparent;
  color: rgba(247, 241, 228, 0.7);
  border-radius: 16px;
  padding: 14px 6px 12px;
  cursor: pointer;
  display: grid;
  gap: 2px;
  justify-items: center;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.mode-card:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
  transform: none;
}

.mode-card.selected {
  background: #f7f1e4;
  color: #1c140e;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.mode-card.selected::before { display: none; }

.mode-kicker {
  display: none;
}

.mode-card strong {
  font-family: Outfit, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mode-desc {
  display: none;
}

.menu-heading {
  font-family: "Libre Baskerville", serif;
  font-style: italic;
  color: var(--gold);
  margin-bottom: 2px;
}

.menu-foot {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 4px;
}

.text-link {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 0;
}

.text-link:hover { color: var(--gold); }

/* ========================================
   LOGIN IN MENU SECTION
   ======================================== */

.login-prompt {
  margin: 2px 0 10px;
  color: rgba(247, 241, 228, 0.72);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-about {
  margin: 0 0 12px;
  color: rgba(247, 241, 228, 0.82);
  font-size: 14px;
  line-height: 1.4;
}

.legal-links {
  margin: 12px 0 0;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.legal-links a {
  color: rgba(228, 197, 106, 0.9);
  text-decoration: none;
}

.legal-links a:hover { text-decoration: underline; }

.btn-google-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  text-decoration: none;
  color: #1c140e;
}

.btn-google-home svg {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}

.online-room-actions {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.user-profile {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  margin-right: 0;
  padding: 3px 6px 3px 3px;
  border-radius: 18px;
  background: rgba(8, 16, 12, 0.55);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  overflow: visible;
  min-height: 44px;
  max-width: 100%;
}

.user-profile[hidden] {
  display: none !important;
}

.user-profile .user-avatar-img,
.user-profile .avatar.mini {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  margin: 0;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.28);
}

.user-id {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  flex: 1 1 auto;
  min-height: 38px;
  height: auto;
  padding: 3px 10px;
  overflow: hidden;
  border-radius: 12px;
}

.user-table {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.user-table .mini-table {
  width: 100%;
  height: 100%;
  padding: 3px;
  border-radius: 12px;
}

.user-table .mini-rail,
.user-table .mini-pad {
  border-radius: 8px;
}

.user-id::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(6, 12, 10, 0.22), rgba(6, 12, 10, 0.48));
}

.user-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f7f1e4;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.65);
}

.user-name-btn {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  max-width: 140px;
}

.user-id > .user-name {
  position: relative;
  z-index: 2;
}

.user-name-btn .user-name {
  max-width: 110px;
}

.name-edit-hint {
  color: var(--gold);
  font-size: 11px;
}

.rename-hint {
  margin: 0 0 12px;
  color: rgba(247, 241, 228, 0.72);
  font-size: 14px;
  line-height: 1.4;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-logout {
  position: relative;
  z-index: 2;
  border: 0;
  background: transparent;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 6px;
}

.btn-logout:hover {
  color: #fff;
}

/* ========================================
   END LOGIN IN MENU
   ======================================== */

.home-topbar {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  right: max(8px, env(safe-area-inset-right));
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  backdrop-filter: none;
  max-width: none;
}

.home-topbar .icon-btn {
  background: rgba(8, 16, 12, 0.45);
  border: 1px solid rgba(255,255,255,0.12);
  min-width: 44px;
  min-height: 44px;
  backdrop-filter: blur(10px);
}

.home-topbar .icon-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.vs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  position: relative;
}

.vs-row .vs-switch {
  flex: 1;
  margin: 0;
}

.ai-gear-wrap {
  position: relative;
  flex-shrink: 0;
  z-index: 4;
}

.ai-gear-wrap[hidden] { display: none !important; }

.ai-gear {
  transition: transform 0.28s cubic-bezier(0.22, 1.15, 0.32, 1), background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.ai-gear.open {
  border-color: rgba(212, 180, 74, 0.7);
  background: rgba(212, 180, 74, 0.18);
  color: var(--gold);
  transform: rotate(42deg);
}

.ai-sheet {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  text-align: left;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  margin: 0;
  padding: 0 4px;
  transform: translateY(-6px);
  transition:
    max-height 0.28s cubic-bezier(0.22, 1, 0.32, 1),
    opacity 0.2s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.32, 1),
    padding 0.22s ease,
    margin 0.22s ease;
}

#screen-start .ai-gear {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  min-width: 42px;
  min-height: 42px;
}

.ai-sheet.open {
  max-height: none;
  opacity: 1;
  pointer-events: auto;
  overflow: hidden;
  margin: 2px 0 8px;
  padding: 12px;
  transform: none;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-sheet .ai-pop-title {
  grid-column: 1 / -1;
  color: #f7f1e4;
}

.ai-pop-title {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #f7f1e4;
  margin-bottom: 0;
  font-weight: 800;
}

.ai-sheet .field {
  margin-bottom: 0;
}

.ai-sheet .field > span {
  color: rgba(247, 241, 228, 0.72);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}

.ai-sheet select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #161310;
  color: #f7f1e4;
  font-size: 14px;
  color-scheme: dark;
}

.ai-sheet option {
  background: #161310;
  color: #f7f1e4;
}

.vs-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: rgba(0, 0, 0, 0.32);
  border: 0;
  border-radius: 999px;
  padding: 4px;
  margin: 2px 0 2px;
}

.match-setup {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 10px;
  text-align: left;
}

.match-setup .field {
  margin-bottom: 0;
}

.match-setup .field > span {
  color: rgba(247, 241, 228, 0.72);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}

.match-setup select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #161310;
  color: #f7f1e4;
  font-size: 14px;
  color-scheme: dark;
}

.match-setup option {
  background: #24180e;
  color: var(--cream);
}

.lobby-setup {
  margin: 0;
}

#room-match-setup .lobby-setup:has(#room-diff-wrap[hidden]) {
  grid-template-columns: 1fr;
}

.vs-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.vs-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.22);
}

.vs-opt.active {
  background: #f7f1e4;
  color: #1c140e;
  box-shadow: none;
}

.vs-opt.active .vs-dot {
  background: #2a1c0a;
  box-shadow: none;
}

.vs-opt[data-vs="online"].active .vs-dot {
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 78, 137, 0.25);
}

.vs-opt[data-vs="ai"].active .vs-dot {
  background: #1a3d2e;
}

#screen-start,
.lobby-card {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#screen-start::-webkit-scrollbar,
.lobby-card::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.menu-launch {
  display: grid;
  gap: 8px;
}

.btn-goldline {
  background: rgba(212, 180, 74, 0.12);
  color: var(--cream);
  border: 1px solid rgba(212, 180, 74, 0.45);
}

#screen-lobby {
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  overflow-y: auto;
  scrollbar-width: none;
}

.lobby-card {
  width: min(400px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 8px 0 12px;
  text-align: center;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.lobby-title {
  font-family: Bevan, serif;
  font-size: 28px;
  margin: 2px 0 4px;
}

.lobby-sub { color: var(--muted); margin-bottom: 14px; font-size: 14px; }

#lobby-seats {
  margin: 0 0 16px;
}

.room-size-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 16px;
}

.room-size-box .room-code-label {
  display: block;
  margin-bottom: 8px;
  color: var(--gold);
}

.room-size-box .vs-switch {
  margin: 0;
  background: rgba(255, 255, 255, 0.05);
}

#lobby-mode-2p {
  grid-template-columns: 1fr;
}

.room-code-box {
  background: rgba(255, 255, 255, 0.04);
  color: var(--cream);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 14px;
  text-align: center;
  margin: 12px 0;
}

.room-code-prominent {
  background: linear-gradient(135deg, rgba(212, 180, 74, 0.2), rgba(212, 180, 74, 0.1));
  border: 3px solid var(--gold);
  box-shadow: 0 4px 20px rgba(212, 180, 74, 0.3);
  padding: 1.5rem;
}

.room-code-large {
  font-family: Outfit, sans-serif !important;
  font-size: 36px !important;
  letter-spacing: 0.22em;
  color: #f4d56e;
  text-shadow: 0 2px 10px rgba(212, 180, 74, 0.5);
}

.room-code-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--gold);
}

.mode-hint {
  margin-top: 0.5rem;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.vs-opt:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.room-code-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin: 6px 0;
}

.room-code-row strong {
  font-family: Outfit, sans-serif;
  font-size: 36px;
  letter-spacing: 0.22em;
  color: #f4d56e;
}

.btn-copy {
  padding: 8px 12px;
  font-size: 11px;
  background: rgba(212, 180, 74, 0.16);
  color: var(--gold);
  border: 1px solid rgba(212, 180, 74, 0.35);
}

.room-hint { font-size: 13px; color: var(--muted); }

.lobby-players {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.lobby-player {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
}

.lobby-player.empty { opacity: 0.55; }
.lobby-player.me {
  border-color: rgba(212, 180, 74, 0.55);
  background: rgba(212, 180, 74, 0.12);
}
.lobby-player .team {
  grid-column: 1 / -1;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.lobby-player .who { font-weight: 700; }

.lobby-player .tag {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.lobby-count { color: var(--muted); margin-bottom: 12px; }

.fill-ai {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  margin-bottom: 16px;
}

.lobby-actions { display: grid; gap: 8px; }

.join-error { color: var(--red); font-size: 13px; margin-top: 8px; }

#join-code {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-weight: 700;
  text-align: center;
  font-size: 22px;
}

.score-multi {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.score-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  font-size: 12px;
}
.score-chip .avatar.mini { margin: 0; }
.score-chip.me { border: 1px solid rgba(212, 180, 74, 0.45); }

.side-seat[hidden] { display: none !important; }

.play-area.table-4p,
.play-area.table-around {
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  position: relative;
}

.play-area.table-4p .computer-row,
.play-area.table-around .computer-row {
  grid-column: 1;
  grid-row: 1;
}

.play-area.table-4p .table-frame,
.play-area.table-around .table-frame {
  grid-column: 1;
  grid-row: 2;
  height: 100%;
  min-height: 0;
  position: relative;
}

.play-area.table-4p .player-row,
.play-area.table-around .player-row {
  grid-column: 1;
  grid-row: 3;
}

.play-area.table-4p #seat-left-wrap,
.play-area.table-4p #seat-right-wrap,
.play-area.table-around #seat-left-wrap,
.play-area.table-around #seat-right-wrap {
  position: absolute;
  top: calc(50% + 8px);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  min-width: 0;
  max-width: none;
  pointer-events: none;
}

.play-area.table-4p #seat-left-wrap,
.play-area.table-around #seat-left-wrap {
  left: 50%;
  transform: translate(calc(-1 * min(50cqw, 50cqh) - 100% - 8px), -50%);
  flex-direction: row;
  justify-self: auto;
  margin: 0;
}

.play-area.table-4p #seat-right-wrap,
.play-area.table-around #seat-right-wrap {
  left: 50%;
  transform: translate(calc(min(50cqw, 50cqh) + 8px), -50%);
  flex-direction: row;
  justify-self: auto;
  margin: 0;
}

.play-area.table-4p .seat-hud.compact,
.play-area.table-around .seat-hud.compact {
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0;
  flex-shrink: 0;
  pointer-events: auto;
  width: 48px;
}

.play-area.table-4p .seat-hud.compact .hand-meta,
.play-area.table-around .seat-hud.compact .hand-meta {
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
  max-width: 48px;
  font-size: 10px;
  line-height: 1.15;
}

.play-area.table-4p .seat-hud.compact .hand-meta span,
.play-area.table-around .seat-hud.compact .hand-meta span {
  max-width: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-area.table-4p .seat-hud.compact .avatar-stack,
.play-area.table-around .seat-hud.compact .avatar-stack {
  width: 40px;
  height: 40px;
}

.side-hand-slot {
  width: var(--hand-long);
  height: min(196px, 46cqh, 42vw);
  position: relative;
  overflow: visible;
  flex-shrink: 0;
  pointer-events: none;
}

.side-hand {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: center;
  width: min(196px, 46cqh, 42vw);
  height: var(--hand-long);
  min-height: var(--hand-long);
  max-width: none;
  max-height: none;
  overflow: hidden;
  padding: 0;
  margin: 0;
  scrollbar-width: none;
  transform: translate(calc(-50% - 6px), -50%) rotate(-90deg);
}

.play-area.table-4p #seat-right-wrap .side-hand,
.play-area.table-around #seat-right-wrap .side-hand {
  transform: translate(calc(-50% + 6px), -50%) rotate(90deg);
}

.side-hand .domino {
  margin: 0 0 0 calc(-1 * var(--cpu-overlap, 18px));
  transform: none;
}

.side-hand .domino:first-child {
  margin-left: 0;
  margin-top: 0;
}

@media (min-width: 560px) {
  .mode-grid { grid-template-columns: 1fr 1fr 1fr; }
}

@media (min-height: 820px) {
  .mini-felt {
    width: min(320px, 86%);
    height: 100px;
  }
}

.btn {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 14px 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, filter 0.15s ease;
}

.btn:active { transform: translateY(1px) scale(0.99); }

.btn-primary {
  background: #f4d56e;
  color: #1c140e;
  box-shadow: none;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

#screen-start .btn-primary,
#screen-lobby .btn-primary {
  padding: 18px 18px;
  letter-spacing: 0.16em;
  font-size: 16px;
  border-radius: 18px;
}

.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--cream);
  border: 1px solid rgba(255,255,255,0.12);
}

.btn.btn-copy {
  padding: 8px 12px;
  font-size: 11px;
  background: rgba(212, 180, 74, 0.16);
  color: var(--gold);
  border: 1px solid rgba(212, 180, 74, 0.35);
  box-shadow: none;
}

.btn-draw, .btn-pass {
  min-width: 160px;
}

.btn-draw {
  background: linear-gradient(180deg, #e8c547, #b8902a);
  color: #2a1c0a;
}

.btn-pass {
  background: rgba(180, 35, 46, 0.9);
  color: white;
}

.icon-btn {
  position: relative;
  z-index: 2;
  background: rgba(255,255,255,0.06);
  color: var(--cream);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  min-width: 40px;
  min-height: 40px;
  pointer-events: auto;
  touch-action: manipulation;
}

/* ---------- GAME LAYOUT ---------- */
#screen-game {
  flex-direction: column;
  padding:
    max(6px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right))
    max(6px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
  gap: 4px;
  isolation: isolate;
  min-height: 0;
}

.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 50;
}

.topbar-center {
  text-align: center;
  line-height: 1.1;
  pointer-events: none;
}

.topbar-center strong {
  font-family: Bevan, serif;
  font-size: 18px;
  display: block;
}

.topbar-center span {
  font-size: 11px;
  color: var(--gold);
  font-style: italic;
  font-family: "Libre Baskerville", serif;
}

.topbar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.scoreboard {
  position: absolute;
  top: 64px;
  right: 12px;
  z-index: 4;
  width: 148px;
  background: linear-gradient(180deg, #f3ead4, #e4d6b4);
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35), inset 0 0 0 2px #cbb58a;
  font-family: "Libre Baskerville", serif;
}

.score-head {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #6a542c;
  margin-bottom: 4px;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.score-col {
  text-align: center;
}

.score-name {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6d5a38;
}

.score-val {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.05;
}

.score-col.you .score-val { color: var(--blue); }
.score-col.rival .score-val { color: var(--red); }

.score-avs {
  display: flex;
  justify-content: center;
  align-items: center;
}

.score-avs .avatar.mini + .avatar.mini {
  margin-left: -10px;
}

.score-avs #score-av-partner {
  box-shadow: 0 0 0 2px #3dce7a;
}

.score-target {
  margin-top: 6px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: #6a542c;
  border-top: 1px dashed #cbb58a;
  padding-top: 6px;
}

.play-area {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 4px;
}

.hand-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
}

.hand-meta {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 2px;
}

.hand-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.hand-count {
  font-size: 12px;
  color: var(--muted);
}

.seat-hud {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.seat-hud.compact {
  flex-direction: column;
  gap: 4px;
  margin-bottom: 4px;
}

.seat-hud.compact .hand-meta {
  flex-direction: column;
  gap: 0;
  align-items: center;
  text-align: center;
}

.seat-hud.active .avatar {
  box-shadow:
    0 0 0 2px var(--gold),
    0 0 18px rgba(212, 180, 74, 0.55);
  animation: avatar-pulse 1.2s ease-in-out infinite;
}

.seat-hud.active .hand-label,
.seat-hud.active .hand-meta span:first-child {
  color: #ffe08a;
}

.seat-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(212, 180, 74, 0.2);
  color: #ffe08a;
}

.seat-hud.ally .avatar {
  box-shadow: 0 0 0 3px #3dce7a, 0 0 16px rgba(61, 206, 122, 0.45);
}

.seat-hud.foe .avatar {
  box-shadow: 0 0 0 2px #d44a3a;
}

.seat-hud.ally .seat-tag {
  background: #1f7a44;
  color: #e8ffe8;
}

.seat-hud.foe .seat-tag {
  background: #8a241c;
  color: #ffd8d0;
}

.seat-hud.me-seat .seat-tag {
  background: #2a5a9a;
  color: #e8f0ff;
}

.avatar-stack {
  position: relative;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
}

.seat-hud.compact .avatar-stack {
  width: 38px;
  height: 38px;
}

.timer-arc {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(#d4b44a calc(var(--t, 1) * 360deg), rgba(255,255,255,0.12) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  opacity: 0;
  transform: rotate(-90deg);
  pointer-events: none;
}

.timer-arc.on { opacity: 1; }
.timer-arc.urgent {
  background: conic-gradient(#e24b4b calc(var(--t, 1) * 360deg), rgba(255,255,255,0.12) 0);
  animation: timer-blink 0.7s ease-in-out infinite;
}

.avatar {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: #fff8e8;
  border: 2px solid rgba(255,255,255,0.42);
  box-shadow: 0 6px 14px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.28);
  overflow: hidden;
}

.avatar.mini {
  position: relative;
  width: 28px;
  height: 28px;
  font-size: 12px;
  inset: auto;
  margin: 0 auto 2px;
}

.avatar .av-initial { position: relative; z-index: 1; text-shadow: 0 1px 0 rgba(0,0,0,0.35); }

.avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.38), transparent 42%);
  pointer-events: none;
}

.av-sol { background: linear-gradient(160deg, #f6d36b, #d4891a 55%, #8a4a10); }
.av-cafe { background: linear-gradient(160deg, #c9895a, #6b3a1e 55%, #2a140c); }
.av-mar { background: linear-gradient(160deg, #7ec8e3, #1d4e89 55%, #0b2748); }
.av-mango { background: linear-gradient(160deg, #ffb14a, #e06b1a 55%, #8a2e0c); }
.av-rumba { background: linear-gradient(160deg, #f07a7a, #b4232e 55%, #5a1018); }
.av-palma { background: linear-gradient(160deg, #7ed39a, #1b6a48 55%, #0a2e20); }
.av-luna { background: linear-gradient(160deg, #f3ead6, #9aa3b5 55%, #3a4254); color: #1c140e; }
.av-coro { background: linear-gradient(160deg, #e2c36b, #6b3fa0 55%, #2a1648); }
.av-chispa { background: linear-gradient(160deg, #ffe08a, #d4b44a 55%, #8a5a10); }
.av-fuego { background: linear-gradient(160deg, #ff8a4a, #c41e18 55%, #4a0c08); }
.av-trueno { background: linear-gradient(160deg, #c9a8ff, #5a2ad4 55%, #1a0c48); }
.av-brisa { background: linear-gradient(160deg, #d8ffe8, #7ed9b0 55%, #1a6a48); }
.av-ola { background: linear-gradient(160deg, #9ee8ff, #1d7e9a 55%, #0b2748); }

.score-col .avatar.mini { margin-bottom: 4px; }

.avatar-picks {
  grid-template-columns: repeat(4, 1fr);
}

.avatar-pick { padding: 6px 4px; }
.avatar-pick .avatar.mini { margin-bottom: 4px; }

.lobby-player {
  grid-template-columns: auto 1fr auto;
}
.lobby-player .avatar.mini {
  margin: 0;
  width: 32px;
  height: 32px;
}
.lobby-player .who { grid-column: 2; }
.lobby-player .tag { grid-column: 3; }
.lobby-player .team { grid-column: 1 / -1; }

@keyframes avatar-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes timer-blink {
  50% { filter: brightness(1.35); }
}

.hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: var(--hand-long);
  max-width: 100%;
  overflow-x: auto;
  padding: 2px 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.hand::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.player-hand {
  gap: 0;
  padding-top: 6px;
  padding-bottom: 2px;
  min-height: calc(var(--hand-long) + 6px);
  scrollbar-width: none;
}

.player-row {
  flex-shrink: 0;
  width: 100%;
  min-height: calc(var(--hand-long) + 8px);
}

.computer-row .hand {
  align-items: flex-start;
  overflow: hidden;
}

.play-actions {
  min-height: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 0;
}

.play-actions:has(button:not([hidden])) {
  min-height: 40px;
  margin-top: 4px;
}

/* ---------- TABLE ---------- */
.table-frame {
  min-height: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  container-type: size;
  overflow: visible;
}

.wood-rail {
  --table-side: min(100cqw, 100cqh, var(--table-max, 66vmin));
  width: var(--table-side);
  height: var(--table-side);
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  box-sizing: border-box;
  border-radius: 18px;
  padding: 18px;
  position: relative;
  transform: translateZ(0);
  background:
    linear-gradient(145deg, #d2b07a 0%, #a87a42 28%, #7a5228 62%, #4a3018 100%);
  box-shadow:
    0 1px 0 rgba(255, 230, 180, 0.28),
    0 14px 0 -6px #5a3a18,
    0 22px 0 -8px #3a2410,
    0 28px 40px rgba(0, 0, 0, 0.45),
    inset 0 0 0 2px rgba(90, 50, 18, 0.45);
}

#screen-game .wood-rail {
  border-radius: 36px;
}

#screen-game .felt {
  border-radius: 22px;
}

#screen-game .table-grain {
  border-radius: inherit;
}

@supports not (width: 1cqh) {
  .wood-rail {
    width: min(100%, 68vh);
    height: auto;
    aspect-ratio: 1 / 1;
    max-height: 100%;
  }
}

.table-grain {
  pointer-events: none;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: inherit;
  z-index: 1;
  background:
    repeating-linear-gradient(
      92deg,
      rgba(255, 220, 160, 0.1) 0 2px,
      transparent 2px 7px
    ),
    repeating-linear-gradient(
      8deg,
      rgba(60, 30, 8, 0.1) 0 1px,
      transparent 1px 9px
    );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.felt {
  position: relative;
  z-index: 2;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 10px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.06), transparent 42%),
    radial-gradient(ellipse at 50% 35%, #2f8f5c 0%, var(--felt) 46%, #0a3324 100%);
  box-shadow:
    inset 0 0 0 4px #0c2a1d,
    inset 0 0 0 6px rgba(212, 180, 74, 0.18),
    inset 0 20px 50px rgba(0,0,0,0.28),
    inset 0 -30px 40px rgba(0,0,0,0.18);
}

.felt.your-turn {
  box-shadow:
    inset 0 0 0 3px #0c2a1d,
    inset 0 0 48px rgba(212, 180, 74, 0.16),
    inset 0 20px 50px rgba(0,0,0,0.28),
    inset 0 -30px 40px rgba(0,0,0,0.18);
}

.felt.their-turn {
  box-shadow:
    inset 0 0 0 3px #0c2a1d,
    inset 0 20px 50px rgba(0,0,0,0.32),
    inset 0 -30px 40px rgba(0,0,0,0.18);
}

.felt-wear {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(circle at 22% 70%, rgba(255,255,255,0.05), transparent 18%),
    radial-gradient(circle at 78% 30%, rgba(0,0,0,0.12), transparent 22%),
    repeating-linear-gradient(115deg, transparent 0 17px, rgba(255,255,255,0.015) 17px 18px);
}

.board-scroller {
  position: absolute;
  inset: 10px 10px 52px;
  overflow: hidden;
  touch-action: none;
  z-index: 2;
  transform: translateZ(0);
}

.board {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.table-hud {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
  z-index: 4;
}

.pozo {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cream);
  cursor: pointer;
}

.pozo-stack {
  position: relative;
  width: 28px;
  height: 46px;
}

.pozo-stack .domino {
  position: absolute;
  left: 0;
  top: 0;
}

.pozo-picker {
  position: absolute;
  inset: 10px 10px 52px;
  z-index: 16;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(8, 22, 16, 0.55);
  backdrop-filter: blur(3px);
  pointer-events: auto;
  overflow: hidden;
}

.pozo-picker[hidden] {
  display: none !important;
}

.pozo-picker-hint {
  margin: 0;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #fff6d2;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.pozo-picker-tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 8px 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  padding: 18px 12px;
  scrollbar-width: none;
}

.pozo-picker-tiles::-webkit-scrollbar {
  display: none;
}

.pozo-picker-tiles .domino {
  cursor: pointer;
  width: 30px;
  height: 56px;
  flex: 0 0 auto;
  margin: 0 -5px;
  pointer-events: auto;
  box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.pozo-picker-tiles .domino:hover,
.pozo-picker-tiles .domino:focus-visible {
  transform: translateY(-10px) rotate(0deg) scale(1.1) !important;
  filter: brightness(1.12);
  box-shadow: 4px 10px 16px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.turn-banner {
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 18, 14, 0.62);
  border: 1px solid rgba(212, 180, 74, 0.32);
  color: var(--cream);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.22);
}

.timer-readout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 34px;
  font-variant-numeric: tabular-nums;
}

.timer-readout b {
  font-size: 14px;
  color: var(--gold);
}

.timer-readout.urgent b { color: #ff8a8a; }

.timer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.timer-readout.urgent .timer-dot {
  background: #e24b4b;
  box-shadow: 0 0 8px #e24b4b;
  animation: timer-blink 0.7s ease-in-out infinite;
}

.end-hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.end-spot {
  pointer-events: auto;
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: rgba(212, 180, 74, 0.35);
  color: #2a1c0a;
  font-weight: 800;
  transform: translate(-50%, -50%);
  animation: pulse 1.1s ease-in-out infinite;
  cursor: pointer;
  z-index: 6;
}

.drop-pads {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}

.drop-pad {
  position: absolute;
  display: none;
  place-items: center;
  width: 38px;
  height: 66px;
  margin: 0;
  border-radius: 8px;
  border: 2px dashed rgba(212, 180, 74, 0.9);
  background: rgba(212, 180, 74, 0.28);
  color: #fff6d2;
  font-weight: 800;
  font-size: 18px;
  transform: none;
  box-shadow: 0 0 0 4px rgba(212, 180, 74, 0.1), 0 8px 18px rgba(0,0,0,0.28);
  animation: drop-pulse 1.2s ease-in-out infinite;
}

.drop-pad.slot-h {
  width: 66px;
  height: 36px;
}

.drop-pad.slot-v {
  width: 36px;
  height: 66px;
}

.drop-pad.start {
  width: 120px;
  height: 120px;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: 10px;
  transform: translate(-50%, -50%);
}

.drop-pad.blocked {
  border-color: rgba(200, 90, 90, 0.55);
  background: rgba(90, 18, 18, 0.28);
  color: #f3c4c4;
  animation: none;
  opacity: 0.7;
}

.drop-pad.ahead {
  background: rgba(212, 180, 74, 0.36);
}

.drop-pad[data-side="left"],
.drop-pad[data-side="right"] {
  border-style: dashed;
}

.drop-pad.hot {
  border-style: solid;
  background: rgba(212, 180, 74, 0.45);
  box-shadow: 0 0 0 10px rgba(212, 180, 74, 0.18), 0 12px 28px rgba(0,0,0,0.3);
  transform: none;
  animation: none;
}

.drop-pad.start.hot {
  transform: translate(-50%, -50%) scale(1.06);
}

.felt.dragging-tile {
  cursor: grabbing;
  overflow: visible;
}

.drag-ghost {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  margin: 0;
  will-change: left, top, width, height, transform;
  backface-visibility: hidden;
  filter: drop-shadow(0 16px 18px rgba(0,0,0,0.45));
  transform: rotate(-8deg) scale(1.08);
}

.drag-ghost.snapped {
  transform: none;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.35));
}

.player-hand .domino.playable {
  cursor: grab;
  touch-action: none;
}

.player-hand.dragging {
  overflow: visible;
  touch-action: none;
}

.player-hand .domino.dragging-src {
  opacity: 0.22;
  transform: none;
  filter: grayscale(0.2);
  pointer-events: none;
}

body.dragging-tile .player-hand .domino:hover,
body.dragging-tile .player-hand .domino:focus-visible {
  transform: none;
}

@keyframes drop-pulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(212, 180, 74, 0.08), 0 10px 24px rgba(0,0,0,0.25); }
  50% { box-shadow: 0 0 0 12px rgba(212, 180, 74, 0.18), 0 10px 24px rgba(0,0,0,0.25); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 180, 74, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(212, 180, 74, 0); }
}

/* ---------- DOMINO TILES ---------- */
.domino {
  --long: var(--tile-long);
  --short: var(--tile-short);
  width: var(--long);
  height: var(--short);
  display: flex;
  flex-direction: row;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.55) 0 18%, transparent 48%),
    linear-gradient(160deg, #fffdf6 0%, #f3ead6 46%, #dccdb0 100%);
  border-radius: max(6px, calc(var(--short) * 0.14));
  border: 1px solid rgba(92, 72, 44, 0.38);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.8),
    0 8px 16px rgba(0,0,0,0.34),
    inset 0 1px 0 rgba(255,255,255,0.72),
    inset 0 -3px 5px rgba(90, 70, 40, 0.14);
  position: relative;
  flex: 0 0 auto;
  box-sizing: border-box;
  overflow: hidden;
  font-size: calc(var(--short) * 0.42);
}

.domino::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.32);
  z-index: 2;
}

.domino.vertical {
  width: var(--short);
  height: var(--long);
  flex-direction: column;
}

.domino.back {
  background:
    repeating-linear-gradient(135deg, #2c2318 0 7px, #3d2e1e 7px 14px);
  border-color: #1a140e;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08),
    0 8px 16px rgba(0,0,0,0.38),
    inset 0 1px 0 rgba(255,255,255,0.08);
}

.domino.back::before { display: none; }

.domino.back .half,
.domino.back .divider {
  visibility: hidden;
}

.domino.hand-size {
  --long: var(--hand-long);
  --short: var(--hand-short);
  font-size: calc(var(--hand-short) * 0.38);
}

.player-hand .domino,
.computer-row .hand .domino {
  --long: var(--hand-long);
  --short: var(--hand-short);
  width: var(--hand-short);
  height: var(--hand-long);
  min-width: var(--hand-short);
  max-width: var(--hand-short);
  min-height: var(--hand-long);
  max-height: var(--hand-long);
  flex: 0 0 var(--hand-short);
  flex-direction: column;
  font-size: calc(var(--hand-short) * 0.34);
}

.player-hand .domino .divider,
.computer-row .hand .domino .divider {
  flex: 0 0 3px;
  width: 58%;
  height: 3px;
  margin: 0 auto;
}

.half {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  padding: 8%;
  place-items: stretch;
}

.half > span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}

.divider {
  flex: 0 0 3px;
  width: 3px;
  background: linear-gradient(#c8b894, #6d5a40);
  margin: 0;
  border-radius: 2px;
  align-self: stretch;
  box-shadow: 0 0 0 0.5px rgba(255,255,255,0.22);
}

.domino.vertical .divider {
  width: 58%;
  height: 3px;
  margin: 0 auto;
  align-self: center;
}

.pip {
  width: 58%;
  height: 58%;
  min-width: 0;
  min-height: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #6a4c38 0 14%, #24150e 58%, #090604 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.38),
    inset 0 1px 1.5px rgba(0,0,0,0.55);
  flex-shrink: 0;
}

.domino.hand-size .pip,
.player-hand .domino .pip {
  width: 60%;
  height: 60%;
}

.board-tile {
  position: absolute;
  transform-origin: center center;
  overflow: hidden;
  border-radius: max(3px, calc(var(--short) * 0.08));
  background:
    linear-gradient(165deg, #fbf6ea 0%, #efe3cb 52%, #d7c6a4 100%);
  border: 1px solid #b59d78;
  box-shadow:
    0 1px 1px rgba(0,0,0,0.28),
    0 2px 4px rgba(0,0,0,0.18),
    inset 0 1px 0 rgba(255,255,255,0.7),
    inset 0 -2px 3px rgba(80, 60, 30, 0.12);
}

.board-tile::before {
  inset: 1px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22);
}

.board-tile .divider {
  flex: 0 0 2px;
  width: 2px;
  height: auto;
}

.board-tile.vertical .divider {
  width: 54%;
  height: 2px;
}

.board-tile .pip {
  width: 44%;
  height: 44%;
  min-width: 0;
  min-height: 0;
  box-shadow:
    0 0.5px 0 rgba(255,255,255,0.28),
    inset 0 0.5px 1px rgba(0,0,0,0.5);
}

.board-tile.skin-ebano,
.board-tile.skin-hueso,
.board-tile.skin-calabaza,
.board-tile.skin-fantasma {
  box-shadow:
    0 1px 1px rgba(0,0,0,0.28),
    0 2px 4px rgba(0,0,0,0.18),
    inset 0 1px 0 rgba(255,255,255,0.18);
}
.board-tile.skin-hueso { border-radius: max(3px, calc(var(--short) * 0.08)); }

.board-tile.landing {
  animation: clack 0.32s cubic-bezier(0.2, 1.4, 0.3, 1);
}

.spark-burst {
  position: absolute;
  width: 0;
  height: 0;
  z-index: 8;
  pointer-events: none;
}

.spark-burst span {
  position: absolute;
  left: 0;
  top: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f6e27a;
  box-shadow: 0 0 8px #d4b44a;
  animation: spark 0.45s ease-out forwards;
  transform: rotate(var(--a)) translateY(0);
}

@keyframes spark {
  0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(1); }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(-28px) scale(0.3); }
}

@keyframes clack {
  0% { transform: translateY(-18px) scale(1.04); }
  55% { transform: translateY(3px) scale(0.98); }
  100% { transform: translateY(0) scale(1); }
}

.fly-tile {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  margin: 0;
  will-change: transform, width, height;
  backface-visibility: hidden;
  filter: drop-shadow(0 12px 10px rgba(0,0,0,0.35));
  transition: transform 0.24s cubic-bezier(0.22, 0.9, 0.18, 1), width 0.24s ease-out, height 0.24s ease-out;
}

.player-hand .domino {
  margin-left: calc(-1 * var(--hand-overlap, 8px));
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
  z-index: 1;
}

.player-hand .domino.deal-in,
.computer-row .domino.deal-in,
.side-hand .domino.deal-in {
  animation: deal-in 0.42s cubic-bezier(0.2, 1.2, 0.3, 1) both;
}

@keyframes deal-in {
  0% { opacity: 0; transform: translateY(18px) scale(0.88); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.player-hand .domino:first-child { margin-left: 0; }

@media (hover: hover) and (pointer: fine) {
  .player-hand .domino:hover,
  .player-hand .domino:focus-visible {
    transform: translateY(-14px);
    z-index: 3;
    filter: brightness(1.05);
  }
}

.player-hand .domino.playable {
  box-shadow:
    0 0 0 2px rgba(212, 180, 74, 0.85),
    0 8px 16px rgba(0,0,0,0.3);
  animation: playable-glow 1.6s ease-in-out infinite;
  cursor: grab;
  touch-action: none;
}

@keyframes playable-glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

.player-hand .domino.can-drag {
  cursor: grab;
  touch-action: none;
}

.player-hand .domino.unplayable {
  filter: saturate(0.7) brightness(0.82);
}

.player-hand .domino.unplayable.can-drag {
  cursor: grab;
}

.player-hand .domino.selected {
  transform: translateY(-18px) scale(1.04);
  box-shadow: 0 0 0 3px var(--gold), 0 12px 20px rgba(0,0,0,0.35);
  z-index: 4;
}

body.layout-compact .player-hand .domino.selected {
  transform: translateY(-10px) scale(1.03);
}

.computer-row .domino {
  margin-left: calc(-1 * var(--cpu-overlap, 18px));
}

.computer-row .domino:first-child { margin-left: 0; }

.win-burst {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 7;
}

.win-burst span {
  font-family: Bevan, serif;
  font-size: clamp(36px, 8vw, 72px);
  color: var(--gold);
  text-shadow: 0 6px 0 #3a2a0c, 0 18px 40px rgba(0,0,0,0.5);
  animation: pop-in 0.7s cubic-bezier(0.2, 1.4, 0.3, 1);
}

@keyframes pop-in {
  0% { transform: scale(0.4) rotate(-8deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.toast {
  position: absolute;
  left: 50%;
  top: 52px;
  bottom: auto;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(18, 14, 10, 0.9);
  color: var(--cream);
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 20;
  border: 1px solid rgba(212, 180, 74, 0.3);
  max-width: 90%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- MODALS ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(8, 12, 10, 0.66);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  backdrop-filter: blur(8px);
  pointer-events: auto;
  overflow: hidden;
}

.modal-overlay[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.modal {
  width: min(420px, 100%);
  max-height: min(88dvh, 720px);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #f7f1e4, #ece2cc);
  color: var(--ink);
  border-radius: 20px;
  padding: 0;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}

.modal-head {
  flex-shrink: 0;
  padding: 18px 20px 6px;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 20px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modal-body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.modal-actions {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(212, 180, 74, 0.14);
}

.modal.modal-patio {
  width: min(440px, 100%);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(242, 195, 107, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(28, 24, 20, 0.97), rgba(12, 14, 12, 0.98));
  color: var(--cream);
  border: 1px solid rgba(255, 220, 160, 0.16);
  box-shadow:
    0 24px 60px var(--shadow),
    inset 0 1px 0 rgba(255, 236, 200, 0.12);
}

.modal.modal-patio h2 {
  font-family: Bevan, serif;
  color: var(--cream);
  letter-spacing: 0.04em;
  margin-bottom: 0;
  font-size: 26px;
}

.modal.modal-patio .modal-body > p {
  color: var(--muted);
  line-height: 1.5;
}

.modal.modal-patio .modal-actions {
  border-top-color: rgba(212, 180, 74, 0.16);
}

.modal.modal-patio .field > span {
  color: rgba(247, 241, 228, 0.78);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}

.modal.modal-patio .field input,
.modal.modal-patio .field select {
  background: #161310;
  color: #f7f1e4;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: none;
  color-scheme: dark;
}

.modal.modal-patio .field input::placeholder {
  color: #8a7a60;
}

.modal.modal-patio .field option {
  background: #24180e;
  color: var(--cream);
}

.modal.modal-patio .toggle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 180, 74, 0.22);
  color: var(--cream);
}

.modal.modal-patio .btn-ghost {
  color: var(--cream);
  border-color: rgba(212, 180, 74, 0.4);
  background: transparent;
}

.modal.modal-patio .look-current {
  background: rgba(8, 8, 6, 0.45);
  color: var(--cream);
  border: 1px solid rgba(212, 180, 74, 0.35);
  box-shadow: none;
}

.modal.modal-patio .look-chooser.open .look-current {
  border-color: rgba(212, 180, 74, 0.7);
  box-shadow: 0 0 0 2px rgba(212, 180, 74, 0.22);
}

.modal.modal-patio .look-current-name {
  color: var(--cream);
}

.modal.modal-patio .look-current-hint {
  color: rgba(247, 241, 228, 0.55);
}

.modal.modal-patio .skin-pick {
  background: rgba(18, 14, 10, 0.85);
  color: var(--cream);
  border-color: rgba(212, 180, 74, 0.28);
}

.modal.modal-patio .skin-pick.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 180, 74, 0.35);
}

.modal h2 {
  font-family: "Libre Baskerville", serif;
  margin-bottom: 8px;
}

.modal-wide { width: min(520px, 100%); }

.look-sheet {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 6;
  flex-direction: column;
  min-height: 0;
  padding: 14px 14px 12px;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(242, 195, 107, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(28, 24, 20, 0.97), rgba(12, 14, 12, 0.98));
}

.look-sheet:not([hidden]) {
  display: flex;
}

.sheet-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-bottom: 10px;
}

.sheet-top strong {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #f7f1e4;
}

.sheet-back {
  border: 1px solid rgba(212, 180, 74, 0.3);
  background: rgba(255,255,255,0.05);
  color: var(--cream);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.look-sheet .look-tray {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: 8px;
  padding: 2px 2px 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.look-sheet .look-tray::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

#picks-tiles {
  grid-template-columns: repeat(3, 88px);
  justify-content: start;
}

#picks-tiles .skin-pick {
  aspect-ratio: 1;
  width: 88px;
  padding: 10px 8px;
  align-content: center;
}

#picks-tiles .swatch-tile {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 14px;
}

.field input, .field select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d7cbb0;
  background: white;
  font-size: 15px;
}

.ai-sheet .field select,
.match-setup .field select {
  background: #161310;
  color: #f7f1e4;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color-scheme: dark;
}

#modal-settings.look-locked .look-field {
  display: none;
}

.toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 8px;
}

.toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255,255,255,0.5);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
}

.skin-picks {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.avatar-picks {
  grid-template-columns: repeat(4, 1fr);
}

.look-tray[hidden],
.skin-picks[hidden] {
  display: none !important;
}

.skin-pick {
  border: 1px solid #d7cbb0;
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 8px 6px 7px;
  cursor: pointer;
  display: grid;
  gap: 6px;
  justify-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  position: relative;
}

.skin-pick > span {
  line-height: 1.15;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.skin-pick.selected {
  border-color: #b8902a;
  box-shadow: 0 0 0 2px rgba(184, 144, 42, 0.35);
}

.swatch {
  width: 100%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.12);
}

.swatch-patio {
  background:
    radial-gradient(circle at 50% 50%, #c41e3a 0 7px, #d4b44a 8px 10px, transparent 11px),
    radial-gradient(circle at 50% 40%, #2d8a5e, #0e3d2b);
  box-shadow: inset 0 0 0 4px #a87a42;
}

.swatch-caoba {
  background:
    radial-gradient(circle at 50% 40%, #8a2a3a, #3a1018);
  box-shadow: inset 0 0 0 3px #5a2418;
}

.swatch-flag {
  background:
    linear-gradient(#fff, #fff) center / 14px 100% no-repeat,
    linear-gradient(#fff, #fff) center / 100% 10px no-repeat,
    linear-gradient(90deg, #002d62 50%, #ce1126 50%);
}

.swatch-tile {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid #cfc3a6;
}

.swatch-marfil {
  background: linear-gradient(160deg, #fffaf0, #d9ccb0);
}

.swatch-ebano {
  background: linear-gradient(160deg, #3a322c, #12100e);
  border-color: #1a140e;
}

.swatch-hueso {
  background: linear-gradient(160deg, #f3e2b8, #c9a66b);
  border-color: #a88850;
}

.swatch-calabaza {
  background: linear-gradient(160deg, #ffb050, #c43808);
  border-color: #5a1808;
}

.swatch-fantasma {
  background: linear-gradient(160deg, #f4f0ff, #8a84a8);
  border-color: #6a6480;
}

body:not(.still) .swatch-calabaza.gif {
  animation: hw-flicker 1.05s steps(4) infinite;
}

body:not(.still) .swatch-fantasma.gif {
  animation: hw-ghost 1.2s steps(5) infinite;
}

/* Table skins */
.felt-emblem {
  display: grid;
  place-items: center;
  pointer-events: none;
  position: absolute;
  left: 50%;
  top: 48%;
  width: 92px;
  height: 92px;
  transform: translate(-50%, -50%);
  z-index: 1;
  border-radius: 50%;
  opacity: 0.9;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.28) 0 12%, transparent 20%),
    radial-gradient(circle at 50% 50%, #f1d36a 0 7%, #c41e3a 8% 56%, #8a1420 57% 66%, #e8d48a 67% 74%, #6b4423 75% 100%);
  box-shadow:
    0 0 0 3px rgba(232, 212, 138, 0.5),
    0 10px 22px rgba(0, 0, 0, 0.32);
  color: #fff6d2;
}

.emblem-mark {
  font-family: Bevan, serif;
  font-size: 30px;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

body[data-table="caoba"] .felt-emblem {
  display: none;
}

body[data-table="caoba"] .wood-rail {
  background: linear-gradient(145deg, #7a3a22, #4a1c10 40%, #2a0e08);
}

body[data-table="caoba"] .felt {
  background:
    radial-gradient(ellipse at 50% 35%, #a33a48 0%, #6e1e2c 45%, #2c0c12 100%);
  box-shadow:
    inset 0 0 0 3px #3a1016,
    inset 0 20px 50px rgba(0,0,0,0.35),
    inset 0 -30px 40px rgba(0,0,0,0.22);
}

body[data-table="caoba"] .mini-felt {
  background: radial-gradient(circle at 50% 40%, #a33a48, #2c0c12);
  border-color: #4a1c10;
}

body[data-table="caoba"] .turn-banner {
  background: rgba(42, 10, 12, 0.6);
  border-color: rgba(212, 160, 90, 0.3);
}

body[data-table="dominicana"] .wood-rail {
  background:
    linear-gradient(90deg, #002d62 0 10%, #8a6234 10% 90%, #ce1126 90% 100%);
}

body[data-table="dominicana"] .felt {
  background:
    linear-gradient(#f4f6f8, #f4f6f8) 50% 50% / 16% 100% no-repeat,
    linear-gradient(#f4f6f8, #f4f6f8) 50% 50% / 100% 20% no-repeat,
    linear-gradient(90deg, #002d62 50%, #ce1126 50%);
  box-shadow:
    inset 0 0 0 3px rgba(255,255,255,0.35),
    inset 0 20px 50px rgba(0,0,0,0.22);
}

body[data-table="dominicana"] .felt-wear {
  background:
    radial-gradient(circle at 22% 70%, rgba(255,255,255,0.08), transparent 18%),
    radial-gradient(circle at 78% 30%, rgba(0,0,0,0.12), transparent 22%);
}

body[data-table="dominicana"] .felt-emblem {
  display: grid;
  background:
    radial-gradient(circle at 50% 42%, #2f7a4e 0 18%, transparent 19%),
    radial-gradient(circle at 50% 58%, #c9a227 0 12%, transparent 13%),
    conic-gradient(from 45deg, #002d62 0 25%, #ce1126 25% 50%, #002d62 50% 75%, #ce1126 75% 100%);
  box-shadow: 0 0 0 4px #fff, 0 8px 18px rgba(0,0,0,0.25);
}

body[data-table="dominicana"] .emblem-mark {
  display: none;
}

body[data-table="dominicana"] .mini-felt {
  background:
    linear-gradient(#fff, #fff) 50% 50% / 18% 100% no-repeat,
    linear-gradient(#fff, #fff) 50% 50% / 100% 22% no-repeat,
    linear-gradient(90deg, #002d62 50%, #ce1126 50%);
  border-color: #4a3018;
}

body[data-table="dominicana"] .turn-banner {
  background: rgba(0, 20, 48, 0.55);
  border-color: rgba(255,255,255,0.35);
}

body[data-table="dominicana"] .board-scroller {
  z-index: 1;
}

/* Tile skins (per ficha, so each player can look different) */
.domino.skin-ebano::before {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}

.domino.skin-ebano {
  background: linear-gradient(160deg, #3e3833 0%, #1c1916 55%, #0e0c0b 100%);
  border-color: #0a0807;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12),
    0 6px 10px rgba(0,0,0,0.4),
    inset 0 -2px 0 rgba(0,0,0,0.35);
}

.domino.skin-ebano .divider {
  background: linear-gradient(#d4b44a, #8a6a20);
}

.domino.skin-ebano .pip {
  background: radial-gradient(circle at 35% 30%, #fff6d2, #e8d9a8 70%);
  box-shadow: 0 0.5px 0 rgba(0,0,0,0.4);
}

.domino.skin-ebano.back {
  background:
    repeating-linear-gradient(135deg, #1a120c 0 6px, #2c2118 6px 12px);
  border-color: #0a0807;
}

.domino.skin-hueso {
  background:
    linear-gradient(160deg, #f8e7c2 0%, #e6c98a 48%, #c9a66b 100%);
  border-color: #a07a40;
  border-radius: 7px;
  box-shadow:
    0 1px 0 #ffeec8,
    0 6px 10px rgba(0,0,0,0.28),
    inset 0 0 0 1px rgba(255,255,255,0.25);
}

.domino.skin-hueso .divider {
  background: linear-gradient(#8a5a2a, #5a3818);
  width: 3px;
}

.domino.skin-hueso.vertical .divider { height: 3px; width: auto; }

.domino.skin-hueso .pip {
  background: radial-gradient(circle at 35% 30%, #6b3a22, #2a120c 75%);
}

.domino.skin-hueso.back {
  background:
    repeating-linear-gradient(90deg, #7a1f28 0 8px, #1d4e89 8px 16px);
  border-color: #3a1a10;
}

.domino.skin-calabaza {
  background: linear-gradient(160deg, #ffb050 0%, #ef6a12 48%, #8a2208 100%);
  border-color: #3a1006;
  box-shadow:
    0 1px 0 rgba(255, 210, 120, 0.35),
    0 6px 10px rgba(0,0,0,0.35),
    inset 0 -2px 0 rgba(80, 16, 0, 0.3);
}

.domino.skin-calabaza .divider {
  background: linear-gradient(#3a1408, #1a0804);
}

.domino.skin-calabaza .pip {
  background: radial-gradient(circle at 35% 30%, #2a1208, #0c0402 75%);
}

.domino.skin-calabaza.back {
  background:
    repeating-linear-gradient(135deg, #4a1808 0 6px, #7a2808 6px 12px);
  border-color: #2a0c04;
}

.domino.skin-fantasma {
  background: linear-gradient(160deg, #f6f2ff 0%, #d0c8e8 48%, #8a84a8 100%);
  border-color: #6a6480;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.55),
    0 6px 12px rgba(40, 20, 80, 0.28),
    inset 0 0 0 1px rgba(255,255,255,0.28);
}

.domino.skin-fantasma .divider {
  background: linear-gradient(#5a4878, #2a1c48);
}

.domino.skin-fantasma .pip {
  background: radial-gradient(circle at 35% 30%, #3a2860, #12081c 75%);
}

.domino.skin-fantasma.back {
  background:
    repeating-linear-gradient(135deg, #2a2038 0 6px, #3a3050 6px 12px);
  border-color: #181022;
}

body:not(.still) .domino.skin-calabaza {
  animation: hw-flicker 1.05s steps(4) infinite;
}

body:not(.still) .domino.skin-fantasma {
  animation: hw-ghost 1.2s steps(5) infinite;
}

@keyframes hw-flicker {
  0%, 100% { filter: brightness(1) saturate(1); }
  25% { filter: brightness(1.18) saturate(1.2); }
  50% { filter: brightness(0.88) saturate(1.05); }
  75% { filter: brightness(1.1) saturate(1.15); }
}

@keyframes hw-ghost {
  0%, 100% { filter: brightness(1) saturate(1); }
  40% { filter: brightness(1.18) saturate(0.85); }
  70% { filter: brightness(0.92) saturate(1.12); }
}

.modal .btn-ghost {
  color: var(--ink);
  border-color: #d7cbb0;
  background: transparent;
}

.rules-body {
  display: grid;
  gap: 10px;
  font-size: 15px;
  line-height: 1.45;
}

.rules-body li {
  margin-left: 18px;
}

.modal-result {
  text-align: center;
}

.result-kicker {
  letter-spacing: 0.22em;
  font-size: 12px;
  color: var(--gold);
}

.modal-result h2 {
  font-family: Bevan, serif;
  font-size: 32px;
  color: var(--cream);
  margin: 4px 0 8px;
}

.modal-result.champ h2 { color: var(--gold); }

.modal-result.champ .result-kicker {
  font-size: 32px;
  letter-spacing: 0;
  line-height: 1;
  margin-bottom: 6px;
}

.result-flavor {
  font-family: "Libre Baskerville", serif;
  font-style: italic;
  margin-bottom: 16px;
  color: var(--muted);
}

.result-grid, .result-score, .champ-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 8px;
}

.result-grid span, .result-score span, .champ-stats span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.result-grid strong, .result-score b, .champ-stats b {
  font-size: 22px;
  color: var(--cream);
}

.modal-result .modal-actions {
  justify-content: center;
}

.thinking .turn-banner {
  animation: thinking 1.4s ease-in-out infinite;
}

@keyframes thinking {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 820px) {
  :root {
    --tile-long: 72px;
    --tile-short: 36px;
    --hand-long: 92px;
    --hand-short: 46px;
    --hand-overlap: 4px;
    --cpu-overlap: 10px;
  }

  .daily-panel {
    padding: 8px 10px;
    gap: 8px;
  }

  #comeback-line {
    font-size: 14px;
  }

  /* The claim pill stays a pill on a phone; a full-width button pushed the
     countdown into the day line. */
  #btn-comeback {
    max-width: 42%;
    width: auto;
    font-size: 10px;
    padding: 4px 8px;
    min-height: 30px;
    border-radius: 9px;
  }

  .comeback-row.is-waiting #btn-comeback {
    max-width: none;
    font-size: 9px;
    letter-spacing: 0.05em;
    padding: 4px 9px;
  }

  .quest-card {
    min-height: 44px;
  }

  .pozo-picker {
    position: fixed;
    inset: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    z-index: 60;
    background: rgba(6, 16, 12, 0.94);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px 12px 28px;
    border-radius: 16px;
  }

  .pozo-picker-tiles {
    overflow: visible;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    justify-items: center;
    align-content: start;
    gap: 12px 8px;
    padding: 8px 4px 20px;
    width: 100%;
  }

  .pozo-picker-tiles .domino {
    width: 48px;
    height: 92px;
    margin: 0;
    transform: none !important;
  }

  .pozo-picker-tiles .domino:hover,
  .pozo-picker-tiles .domino:focus-visible {
    transform: scale(1.08) !important;
  }

  .scoreboard {
    position: static;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    flex-shrink: 0;
    border-radius: 12px;
  }

  .score-head { display: none; }

  .score-row { width: 58%; gap: 6px; }

  .score-val { font-size: 20px; }

  .score-target {
    border: 0;
    padding: 0;
    margin: 0;
    font-size: 9px;
  }

  .chair, .plant { display: none; }

  .game-topbar {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .game-topbar .icon-btn {
    min-width: 36px;
    min-height: 36px;
    padding: 6px 8px;
  }

  .topbar-actions .icon-btn span { display: none; }

  .topbar-center strong { font-size: 15px; }

  #screen-game {
    padding:
      max(4px, env(safe-area-inset-top))
      max(6px, env(safe-area-inset-right))
      max(4px, env(safe-area-inset-bottom))
      max(6px, env(safe-area-inset-left));
    gap: 3px;
  }

  .play-area { gap: 2px; }

  :root { --table-max: 46dvh; }

  .wood-rail {
    --table-side: min(100cqw, 100cqh, var(--table-max, 46dvh));
  }

  .computer-row {
    width: 100%;
  }

  .computer-row .seat-hud {
    flex-direction: row;
    margin-bottom: 0;
  }

  .computer-row .hand {
    max-height: var(--hand-long);
    margin-bottom: 0;
  }

  .player-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: calc(var(--hand-long) + 40px);
    padding-bottom: 4px;
  }

  .player-row .seat-hud {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin: 0;
    align-self: flex-start;
    padding-left: 4px;
  }

  .player-row .react-wrap {
    position: absolute;
    right: 6px;
    top: 0;
    margin: 0;
    z-index: 14;
  }

  .player-row .player-hand {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-top: 2px;
    justify-content: center;
  }

  .player-row .play-actions {
    margin-top: 0;
  }

  .seat-hud {
    gap: 6px;
    margin-bottom: 0;
  }

  .avatar-stack {
    width: 36px;
    height: 36px;
  }

  .seat-hud.compact .avatar-stack {
    width: 32px;
    height: 32px;
  }

  .hand-label {
    font-size: 9px;
    letter-spacing: 0.12em;
  }

  .hand-count { font-size: 11px; }

  .wood-rail {
    padding: 10px;
    border-radius: 22px;
  }

  #screen-game .wood-rail { border-radius: 24px; }
  #screen-game .felt { border-radius: 16px; }

  .board-scroller { inset: 8px 8px 44px; }

  .table-hud {
    left: 8px;
    right: 8px;
    bottom: 6px;
  }

  .turn-banner {
    font-size: 12px;
    padding: 4px 10px;
  }

  .play-area.table-4p #seat-left-wrap,
  .play-area.table-around #seat-left-wrap {
    top: 50%;
    transform: translate(calc(-1 * min(48cqw, 48cqh) + 4px), -50%);
    gap: 4px;
  }

  .play-area.table-4p #seat-right-wrap,
  .play-area.table-around #seat-right-wrap {
    top: 50%;
    transform: translate(calc(min(48cqw, 48cqh) - 100% - 4px), -50%);
    gap: 4px;
  }

  .play-area.table-4p .seat-hud.compact,
  .play-area.table-around .seat-hud.compact {
    width: 40px;
  }

  .player-hand {
    padding-top: 4px;
  }

  .btn-draw, .btn-pass {
    min-width: 0;
  }

  .user-name { max-width: 110px; }
  .user-profile .user-avatar-img,
  .user-profile .avatar.mini { width: 32px; height: 32px; }
  .user-id { height: auto; min-height: 36px; padding: 4px 8px; }

  #screen-lobby {
    padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 520px) {
  :root {
    --hand-long: 88px;
    --hand-short: 44px;
    --tile-long: 64px;
    --tile-short: 32px;
    --hand-overlap: 3px;
    --cpu-overlap: 8px;
  }

  .start-card { padding: 0; width: min(400px, 100%); }

  .title { font-size: clamp(40px, 14vw, 56px); }

  .start-brand { margin-bottom: 12px; }

  .start-table-preview { margin-bottom: 14px; }

  .mini-felt {
    height: 72px;
    border-radius: 22px;
    box-shadow:
      0 0 0 8px #3a2412,
      0 0 0 9px rgba(255, 220, 160, 0.18),
      0 16px 28px rgba(0, 0, 0, 0.4);
  }

  .mode-card { padding: 10px 4px 8px; }

  .mode-card strong { font-size: 12px; }

  #screen-start .btn-primary,
  #screen-lobby .btn-primary {
    padding: 14px 16px;
    font-size: 14px;
  }

  .ai-sheet.open {
    grid-template-columns: 1fr;
    max-height: none;
  }

  .avatar-picks {
    grid-template-columns: repeat(3, 1fr);
  }

  .wood-rail { padding: 7px; border-radius: 18px; }

  .topbar-center { display: none; }

  .play-actions .btn { min-width: 0; padding: 10px 12px; font-size: 12px; }

  .play-area.table-4p .side-hand-slot,
  .play-area.table-around .side-hand-slot {
    display: flex;
    width: 28px;
    min-width: 28px;
    overflow: hidden;
  }

  .play-area.table-4p .side-hand .domino,
  .play-area.table-around .side-hand .domino {
    width: 14px;
    height: 28px;
    margin-bottom: -16px;
  }

  .play-area.table-4p .seat-hud.compact .hand-meta span,
  .play-area.table-around .seat-hud.compact .hand-meta span {
    max-width: 42px;
    font-size: 9px;
  }

  .computer-row .hand-label { display: none; }

  .player-row .hand-label { display: none; }

  .home-topbar {
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
  }

  .user-name { max-width: 38vw; font-size: 12px; }

  .user-profile {
    padding: 4px 6px 4px 4px;
    gap: 6px;
    min-height: 0;
    width: auto;
    flex: 0 1 auto;
    max-width: min(150px, 42vw);
    flex-wrap: nowrap;
  }

  .user-profile .user-avatar-img,
  .user-profile .avatar.mini { width: 32px; height: 32px; }

  .user-id {
    height: auto;
    min-height: 0;
    padding: 4px 8px;
    flex: 1 1 auto;
    min-width: 0;
  }

  .user-actions {
    width: auto;
    justify-content: flex-end;
  }

  .btn-logout { font-size: 11px; padding: 8px 10px; }

  #screen-start {
    padding-top: max(124px, calc(env(safe-area-inset-top) + 100px));
  }

  .score-val { font-size: 18px; }

  .scoreboard { padding: 5px 8px; }

  .modal {
    width: min(420px, 100%);
    max-height: min(92dvh, 720px);
    border-radius: 16px;
  }
}

@media (max-height: 700px) {
  .start-table-preview { margin-bottom: 14px; }
  .mini-felt { height: 72px; }
  .start-brand { margin-bottom: 12px; }
  #screen-start {
    padding-top: max(88px, calc(env(safe-area-inset-top) + 72px));
    justify-content: flex-start;
  }
}

@media (max-height: 560px) {
  .start-table-preview { display: none; }
  .eyebrow { margin-bottom: 4px; }
  .title { font-size: clamp(32px, 10vw, 48px); }
  .subtitle { margin-top: 4px; }
}

/* Short landscape phones */
@media (max-height: 500px) {
  :root {
    --hand-long: 68px;
    --hand-short: 34px;
    --tile-long: 52px;
    --tile-short: 26px;
    --hand-overlap: 4px;
    --cpu-overlap: 8px;
  }

  #screen-game {
    padding: 2px 6px 2px;
    gap: 2px;
  }

  .game-topbar .icon-btn {
    min-width: 32px;
    min-height: 32px;
    padding: 4px 6px;
  }

  .topbar-center { display: none; }

  .scoreboard {
    position: static;
    padding: 3px 8px;
  }

  .score-val { font-size: 16px; }

  .computer-row .hand { display: none; }

  .computer-row .seat-hud {
    flex-direction: row;
    margin: 0;
  }

  .player-row .seat-hud { display: none; }

  .wood-rail { padding: 6px; }

  .board-scroller { inset: 6px 6px 36px; }

  .play-area.table-4p .side-hand-slot,
  .play-area.table-around .side-hand-slot {
    display: flex;
    width: 28px;
    min-width: 28px;
    overflow: hidden;
  }

  .play-area.table-4p .side-hand .domino,
  .play-area.table-around .side-hand .domino {
    width: 14px;
    height: 28px;
    margin-bottom: -16px;
  }
}

body.layout-compact .computer-row .hand-label,
body.layout-tiny .player-row .hand-label {
  display: none;
}

body.layout-landscape .react-bar {
  position: relative;
  right: auto;
  bottom: auto;
  margin: 4px auto 0;
  z-index: 2;
}

body.layout-landscape .player-row {
  position: relative;
}

.mm-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(6, 14, 10, 0.78);
  backdrop-filter: blur(10px);
}

.mm-overlay[hidden] {
  display: none !important;
}

.mm-card {
  width: min(380px, 100%);
  text-align: center;
  padding: 28px 22px 22px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(18, 36, 28, 0.96), rgba(8, 18, 14, 0.96));
  border: 1px solid rgba(212, 180, 74, 0.28);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
}

.mm-kicker {
  letter-spacing: 0.22em;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 8px;
}

.mm-title {
  font-family: Bevan, serif;
  font-size: 26px;
  line-height: 1.1;
  color: var(--cream);
  margin-bottom: 8px;
}

.mm-sub {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 18px;
}

.mm-spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(212, 180, 74, 0.18);
  border-top-color: var(--gold);
  animation: mm-spin 0.8s linear infinite;
}

.mm-countdown {
  font-family: Bevan, serif;
  font-size: 64px;
  line-height: 1;
  color: #f4d56e;
  margin: 4px 0 12px;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.mm-count {
  min-height: 20px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: rgba(247, 241, 228, 0.78);
  margin-bottom: 18px;
}

.mm-card .btn {
  width: 100%;
}

@keyframes mm-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 520px) {
  .mm-title { font-size: 22px; }
  .mm-countdown { font-size: 52px; }
}

body.layout-around.layout-tiny .side-hand-slot {
  display: flex;
  width: 26px;
  min-width: 26px;
}

body.layout-around.layout-tiny .side-hand .domino {
  width: 12px;
  height: 24px;
  margin-bottom: -14px;
}

body.layout-tiny .score-avs .avatar.mini {
  width: 22px;
  height: 22px;
}

@media (prefers-reduced-motion: reduce) {
  .board-tile.landing, .win-burst span, .end-spot, .fly-tile, .bulb,
  .preview-tile-0, .preview-tile-1, .preview-tile-2, .lt1, .lt2,
  .avatar-pulse, .timer-blink, .playable-glow, .deal-in, .spark-burst span,
  .seat-hud.active .avatar, .drop-pad, .drag-ghost, .mm-spinner {
    animation: none;
    transition: none;
  }
}

.user-rating {
  display: inline;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #f3d48a;
  line-height: 1;
}

.user-wallet {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f3d48a;
  line-height: 1.2;
}

.home-wallet {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(8, 16, 12, 0.45);
  border: 1px solid rgba(241, 211, 106, 0.35);
  color: #f3d48a;
  font-weight: 700;
  font-size: 14px;
}

.home-wallet .btn-shop {
  margin-left: auto;
  padding: 6px 12px;
  min-height: 36px;
}

.shop-hint {
  margin: 0 0 12px;
  text-align: center;
  color: rgba(247, 241, 228, 0.78);
  font-size: 13px;
  line-height: 1.35;
}

.daily-panel {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(8, 16, 12, 0.5);
  border: 1px solid rgba(241, 211, 106, 0.28);
  display: grid;
  gap: 10px;
}

.daily-kicker {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.comeback-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 10px;
}

.comeback-copy {
  min-width: 0;
}

.comeback-copy p {
  margin: 0;
}

#comeback-line {
  margin-top: 2px;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
  color: var(--cream);
}

#btn-comeback {
  justify-self: end;
  width: auto;
  min-width: 0;
  max-width: 46%;
  min-height: 34px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
  border-radius: 10px;
  white-space: nowrap;
}

.comeback-row.is-waiting {
  grid-template-columns: 1fr;
  align-items: start;
}

.comeback-row.is-waiting #btn-comeback {
  justify-self: start;
  max-width: 100%;
  width: fit-content;
  font-size: 10px;
  padding: 4px 10px;
  min-height: 30px;
}

.daily-quests-collapse {
  border-top: 1px solid rgba(241, 211, 106, 0.14);
  padding-top: 6px;
}

.daily-quests-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 6px 2px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.daily-quests-toggle-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.daily-quests-summary {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(247, 241, 228, 0.82);
}

.daily-quests-chevron {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-right: 2px solid #f3d48a;
  border-bottom: 2px solid #f3d48a;
  transform: rotate(45deg);
  transition: transform 0.24s ease;
  margin-top: -4px;
}

.daily-quests-collapse.is-open .daily-quests-chevron {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.daily-quests-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease;
}

.daily-quests-collapse.is-open .daily-quests-body {
  grid-template-rows: 1fr;
}

.daily-quests-body-inner {
  overflow: hidden;
  min-height: 0;
}

.daily-quests-collapse.is-open .daily-quests-body-inner {
  padding-top: 8px;
}

.quest-list {
  display: grid;
  gap: 8px;
}

.quest-card {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.quest-title {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--cream);
  line-height: 1.3;
}

.quest-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #f3d48a;
}

.quest-bar {
  margin-top: 6px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.quest-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #d4b44a, #f3d48a);
}

.shop-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "preview copy"
    "preview actions";
  gap: 6px 10px;
  align-items: center;
  padding: 10px 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(10, 12, 10, 0.96);
  border-top: 1px solid rgba(241, 211, 106, 0.35);
}

.shop-bar[hidden] {
  display: none !important;
}

.shop-bar-preview {
  grid-area: preview;
  display: grid;
  place-items: center;
  min-width: 48px;
}

.shop-bar #shop-bar-copy {
  grid-area: copy;
  margin: 0;
  color: #f3d48a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.shop-bar-actions {
  grid-area: actions;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.look-sheet {
  padding-bottom: 96px;
}

.user-level,
.user-coins {
  white-space: nowrap;
}

.champ-rewards {
  margin: 8px 0 0;
  color: #f3d48a;
  font-weight: 700;
  text-align: center;
}

.shop-preview {
  display: grid;
  place-items: center;
  min-height: 64px;
  margin-bottom: 10px;
}

.lobby-chat, .game-chat {
  margin-top: 12px;
  background: rgba(8, 18, 14, 0.45);
  border: 1px solid rgba(212, 180, 74, 0.2);
  border-radius: 12px;
  padding: 8px;
}

.chat-log {
  min-height: 64px;
  max-height: 120px;
  overflow-y: auto;
  font-size: 13px;
  color: var(--cream);
}

.chat-log p { margin: 0 0 4px; }
.chat-log b { color: #f3d48a; }

.chat-form {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  border-radius: 10px;
  border: 1px solid rgba(212, 180, 74, 0.25);
  background: rgba(255,255,255,0.08);
  color: var(--cream);
  padding: 8px 10px;
}

.chat-toggle {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 12;
}

.chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  background: #e4574e;
  color: #fff;
  font: 700 10px/17px "DM Sans", sans-serif;
  text-align: center;
  pointer-events: none;
}

/* A short line over the sender's seat so chat lands where people are looking. */
.chat-pop {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%) translateY(8px) scale(0.96);
  margin-bottom: 6px;
  max-width: 168px;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(12, 24, 19, 0.96);
  border: 1px solid rgba(196, 242, 121, 0.38);
  color: var(--cream);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  opacity: 0;
  pointer-events: none;
  z-index: 9;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.chat-pop.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.chat-pop-name {
  display: block;
  font: 700 9px/1.2 "DM Sans", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c4f279;
  margin-bottom: 2px;
}

.chat-pop-text { display: block; }

#hud-left .chat-pop,
#hud-right .chat-pop {
  bottom: auto;
  top: 100%;
  margin: 6px 0 0;
  max-width: 130px;
}

.spec-banner {
  position: absolute;
  left: 50%;
  top: 48px;
  transform: translateX(-50%);
  z-index: 11;
  background: rgba(10, 18, 14, 0.8);
  color: #f3d48a;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.result-multi {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.result-multi div {
  display: flex;
  justify-content: space-between;
  color: var(--cream);
}

.friend-list, .history-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 16px;
}

.friend-row, .history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(16, 12, 8, 0.08);
}

.friend-row .who { flex: 1; min-width: 0; }
.dot-on { color: #3ddc84; }
.dot-off { color: #888; }

.skin-pick.locked {
  opacity: 0.45;
  position: relative;
}

.skin-pick.locked::after {
  content: "🔒";
  position: absolute;
  right: 6px;
  top: 6px;
  font-size: 12px;
}

.skin-pick .price-chip {
  position: absolute;
  left: 5px;
  bottom: 5px;
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0;
  text-transform: none;
  background: rgba(10, 16, 12, 0.82);
  color: #f3d48a;
  border-radius: 999px;
  padding: 1px 6px;
}

.skin-pick:not(.locked) .price-chip {
  display: none;
}

.domino.skin-dyn {
  background: linear-gradient(160deg, var(--tile-bone) 0%, var(--tile-edge) 100%);
  border-color: var(--tile-edge);
}

.domino.skin-dyn .divider {
  background: var(--tile-divider);
}

.domino.skin-dyn .pip {
  background: radial-gradient(circle at 35% 30%, var(--tile-pip), #0a0604 78%);
}

.domino.skin-dyn.back {
  background: repeating-linear-gradient(135deg, var(--tile-back) 0 6px, var(--tile-divider) 6px 12px);
  border-color: var(--tile-divider);
}

.swatch-tile.swatch-dyn {
  background: linear-gradient(160deg, var(--tile-bone), var(--tile-edge));
  border-color: var(--tile-edge);
}

.avatar.av-dyn {
  background: linear-gradient(160deg, var(--av-a), var(--av-b) 55%, var(--av-c));
}

body:not(.still) .domino.skin-anim-flash { animation: hw-flicker 0.9s steps(4) infinite; }
body:not(.still) .domino.skin-anim-pulse { animation: hw-ghost 1.4s ease-in-out infinite; }
body:not(.still) .domino.skin-anim-neon { animation: hw-flicker 1.2s steps(5) infinite; }
body:not(.still) .domino.skin-anim-aurora { animation: hw-ghost 1.8s ease-in-out infinite; }
body:not(.still) .domino.skin-anim-haunt { animation: hw-ghost 1.1s steps(5) infinite; }
body:not(.still) .domino.skin-anim-flicker { animation: hw-flicker 1.05s steps(4) infinite; }
body:not(.still) .domino.skin-anim-wave { animation: hw-ghost 1.6s ease-in-out infinite; }

.lobby-watch {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

#screen-game {
  position: relative;
}
