/* ============================================================
   DOMINO — Professional UI
   Design language: deep midnight surface, emerald felt table,
   gold accents, glass panels, smooth micro-animations.
   ============================================================ */

:root {
  /* Surfaces */
  --bg-deep: #070d16;
  --bg-mid: #0c1826;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-border: rgba(255, 255, 255, 0.09);

  /* Felt table */
  --felt-dark: #06231a;
  --felt-mid: #0d4231;
  --felt-light: #14614a;
  --wood-dark: #241207;
  --wood: #3d2210;

  /* Tiles */
  --ivory: #fdfaf1;
  --ivory-dark: #e8ddc9;
  --pip: #1d1a16;

  /* Accents */
  --gold: #f5b942;
  --gold-deep: #d99a1b;
  --gold-glow: rgba(245, 185, 66, 0.45);
  --team-a: #2dd4bf;
  --team-b: #fb7185;

  /* Text */
  --ink: #f4f1e6;
  --ink-dim: #93a6b5;
  --ink-faint: #5c7183;

  --radius-lg: 22px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  overflow: hidden;
  background: var(--bg-deep);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
}

input {
  font-family: inherit;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999999;
}

.screen {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: none;
}

.screen.active {
  display: block;
}

/* Lobby screens: center the column instead of a full-height mobile strip */
#screen-home.active,
#screen-waiting.active,
#screen-result.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Keep home at viewport height so the long guide can scroll (body is overflow:hidden) */
#screen-home.active {
  height: 100vh;
  height: 100dvh;
}

#screen-home.active .bg-scene {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#screen-game.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================================
   Background scene (home / waiting / result)
   ============================================================ */
.bg-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 120% 80% at 50% -10%, var(--bg-mid) 0%, var(--bg-deep) 70%),
    var(--bg-deep);
  z-index: 0;
}

.bg-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 26px 26px;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  animation: glowDrift 12s ease-in-out infinite alternate;
}

.glow-1 {
  width: 340px;
  height: 340px;
  background: #0e5a41;
  top: -120px;
  right: -80px;
}

.glow-2 {
  width: 300px;
  height: 300px;
  background: #8a5a13;
  bottom: -140px;
  left: -100px;
  animation-delay: -6s;
}

@keyframes glowDrift {
  from {
    transform: translate(0, 0) scale(1);
  }

  to {
    transform: translate(30px, 20px) scale(1.15);
  }
}

/* Decorative floating domino tiles on home screen */
.floating-tiles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.floating-tiles .tile {
  position: absolute;
  opacity: 0.10;
  animation: floatTile 14s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes floatTile {
  from {
    transform: translateY(0) rotate(var(--rot, -8deg));
  }

  to {
    transform: translateY(-34px) rotate(calc(var(--rot, -8deg) + 10deg));
  }
}

/* ============================================================
   Home screen
   ============================================================ */
.home-content {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  animation: fadeUp 0.55s ease both;
}

.home-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo-badge {
  width: 84px;
  height: 84px;
  border-radius: 26px;
  background: linear-gradient(145deg, #123c2d 0%, #0a2018 100%);
  border: 1px solid rgba(245, 185, 66, 0.35);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 40px rgba(245, 185, 66, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  transform: rotate(-6deg);
  animation: logoBob 5s ease-in-out infinite alternate;
}

@keyframes logoBob {
  from {
    transform: rotate(-6deg) translateY(0);
  }

  to {
    transform: rotate(-2deg) translateY(-5px);
  }
}

.logo-tile {
  width: 34px;
  height: 62px;
  background: linear-gradient(135deg, var(--ivory) 0%, var(--ivory-dark) 100%);
  border-radius: 7px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.9);
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  padding: 5px;
}

.logo-tile .logo-pip {
  width: 6px;
  height: 6px;
  background: var(--pip);
  border-radius: 50%;
  margin: auto;
}

.logo-tile .logo-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.3);
  margin: 2px 1px;
  grid-column: 1;
}

/* three pips per half laid out via grid areas */
.logo-tile {
  grid-template-columns: 1fr 1fr 1fr;
}

.logo-tile .logo-divider {
  grid-column: 1 / -1;
}

.app-title {
  margin: 0;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(180deg, #ffe9b8 0%, var(--gold) 55%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 10px 30px rgba(245, 185, 66, 0.25);
}

.app-tagline {
  margin: 2px 0 20px;
  font-size: 13px;
  color: var(--ink-dim);
  font-weight: 600;
}

.site-footer {
  margin-top: 22px;
  padding-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-faint);
}

.home-page-footer {
  position: relative;
  z-index: 1;
  width: min(100% - 32px, 800px);
  margin: 0 auto 40px;
  padding: 18px 12px 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer a {
  color: var(--ink-dim);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--gold);
}

.result-footer {
  margin-top: 16px;
}

.panel {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
  padding: 20px 18px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-dim);
  margin: 4px 2px 8px;
}

.hidden {
  display: none !important;
}

/* Telegram auto-profile (Mini App) */
.telegram-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
}

.profile-photo-wrap {
  flex-shrink: 0;
}

.profile-avatar-size.seat-avatar,
.profile-photo-wrap .seat-avatar {
  width: 52px;
  height: 52px;
  font-size: 20px;
}

.profile-info {
  text-align: left;
  flex: 1;
  min-width: 0;
}

.profile-name {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-meta {
  display: block;
  font-size: 11px;
  color: var(--ink-dim);
  font-weight: 600;
  margin-top: 2px;
}

input,
textarea {
  user-select: text;
  -webkit-user-select: text;
}

.guest-name-field {
  margin-bottom: 4px;
}

.invite-banner {
  margin-bottom: 16px;
  padding: 14px 14px 12px;
  border-radius: var(--radius-md);
  background: rgba(245, 185, 66, 0.1);
  border: 1px solid rgba(245, 185, 66, 0.35);
  text-align: center;
}

.invite-banner.hidden {
  display: none !important;
}

.invite-kicker {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}

.invite-code {
  display: block;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--ivory);
  margin-bottom: 6px;
}

.invite-hint {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-dim);
  line-height: 1.4;
}

/* Invite link landing: only name + Join (hide matchmaking + duplicate code field) */
.home-panel.invite-join-only .home-matchmaking {
  display: none !important;
}

.home-panel.invite-join-only .join-row {
  margin-top: 4px;
  gap: 0;
}

.home-panel.invite-join-only #join-code-input {
  display: none !important;
}

.home-panel.invite-join-only #join-code-btn {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
}

.seat-avatar .avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.text-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 16px;
}

.text-input::placeholder {
  color: var(--ink-faint);
  font-weight: 400;
}

.text-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 185, 66, 0.15);
}

/* --- Mode selection cards --- */
.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.mode-card {
  position: relative;
  background: rgba(0, 0, 0, 0.28);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px 10px 12px;
  color: var(--ink-dim);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.22s ease;
}

.mode-card:active {
  transform: scale(0.97);
}

.mode-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-dim);
  transition: all 0.22s ease;
}

.mode-icon svg {
  width: 24px;
  height: 24px;
}

.mode-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.mode-sub {
  font-size: 11px;
  font-weight: 600;
}

.mode-card.selected {
  border-color: var(--gold);
  background: linear-gradient(160deg, rgba(245, 185, 66, 0.14) 0%, rgba(245, 185, 66, 0.05) 100%);
  box-shadow: 0 0 22px rgba(245, 185, 66, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mode-card.selected .mode-icon {
  background: linear-gradient(135deg, #ffd97a 0%, var(--gold-deep) 100%);
  color: #2b1d03;
  box-shadow: 0 4px 14px rgba(245, 185, 66, 0.4);
}

.mode-card.selected .mode-sub {
  color: var(--gold);
}

.mode-card.selected::after {
  content: "";
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

/* --- Buttons --- */
.btn {
  width: 100%;
  border: none;
  border-radius: var(--radius-md);
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, #ffd97a 0%, var(--gold) 45%, var(--gold-deep) 100%);
  color: #2b1d03;
  box-shadow: 0 8px 22px rgba(245, 185, 66, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.btn-primary:active {
  filter: brightness(0.95);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.14);
  margin-top: 10px;
}

.btn-ghost {
  background: transparent;
  color: var(--gold);
  border: 1.5px solid rgba(245, 185, 66, 0.5);
  width: auto;
  padding: 12px 22px;
  white-space: nowrap;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 12px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.09);
}

.join-row {
  display: flex;
  gap: 8px;
}

.join-row .text-input {
  margin-bottom: 0;
  flex: 1;
}

.code-input {
  text-align: center;
  letter-spacing: 2px;
  font-weight: 800;
  text-transform: uppercase;
}

/* ============================================================
   Waiting screen
   ============================================================ */
.waiting-content {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  animation: fadeUp 0.45s ease both;
}

.back-btn {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ink-dim);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 18px;
  transition: all 0.2s ease;
}

.back-btn svg {
  width: 14px;
  height: 14px;
}

.back-btn:active {
  transform: scale(0.95);
}

.game-back-btn {
  margin-bottom: 0;
  padding: 6px 12px;
  font-size: 11px;
  flex-shrink: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.game-back-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.waiting-title {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  color: var(--ink);
}

.waiting-sub {
  margin: 4px 0 18px;
  font-size: 13px;
  color: var(--ink-dim);
  font-weight: 600;
}

.room-code-box {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px dashed rgba(245, 185, 66, 0.45);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 18px;
}

.room-code-label {
  font-size: 11px;
  color: var(--ink-dim);
  font-weight: 700;
  white-space: nowrap;
}

.room-code {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--gold);
}

.chip-btn {
  background: rgba(245, 185, 66, 0.14);
  border: 1px solid rgba(245, 185, 66, 0.4);
  color: var(--gold);
  border-radius: 18px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.chip-btn:active {
  transform: scale(0.94);
}

.seats {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.seats.solo {
  grid-template-columns: 1fr 1fr;
}

.seat {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  backdrop-filter: blur(6px);
  transition: all 0.3s ease;
  animation: fadeUp 0.4s ease both;
}

.seat.filled {
  border-color: rgba(245, 185, 66, 0.65);
  background: linear-gradient(160deg, rgba(245, 185, 66, 0.12) 0%, rgba(245, 185, 66, 0.03) 100%);
  box-shadow: 0 0 18px rgba(245, 185, 66, 0.12);
}

.seat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  color: var(--ink-dim);
  transition: all 0.3s ease;
}

.seat.filled .seat-avatar {
  background: linear-gradient(135deg, #ffd97a 0%, var(--gold-deep) 100%);
  border-color: transparent;
  color: #2b1d03;
  box-shadow: 0 4px 14px rgba(245, 185, 66, 0.4);
}

.seat-team {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 10px;
}

.team-a-tag {
  background: rgba(45, 212, 191, 0.15);
  color: var(--team-a);
  border: 1px solid rgba(45, 212, 191, 0.5);
}

.team-b-tag {
  background: rgba(251, 113, 133, 0.15);
  color: var(--team-b);
  border: 1px solid rgba(251, 113, 133, 0.5);
}

.seat-name {
  font-size: 12px;
  color: var(--ink-faint);
  font-weight: 600;
}

.seat.filled .seat-name {
  color: var(--ink);
  font-weight: 800;
}

.loader-dots {
  display: flex;
  gap: 7px;
  margin: 22px 0;
}

.loader-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.3;
  animation: dotPulse 1.2s ease-in-out infinite;
}

.loader-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loader-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {

  0%,
  100% {
    opacity: 0.25;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.25);
  }
}

.share-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.share-btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 11px 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #fff;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.share-btn:active {
  transform: scale(0.96);
}

.share-btn .btn-icon {
  width: 18px;
  height: 18px;
}

.share-telegram {
  background: linear-gradient(160deg, #2AABEE 0%, #229ED9 100%);
  box-shadow: 0 6px 16px rgba(34, 158, 217, 0.28);
}

.share-messenger {
  background: linear-gradient(160deg, #2F9BFF 0%, #0084FF 100%);
  box-shadow: 0 6px 16px rgba(0, 132, 255, 0.28);
}

.share-whatsapp {
  background: linear-gradient(160deg, #36D174 0%, #25D366 100%);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.28);
}

@media (max-width: 360px) {
  .share-btn {
    font-size: 11px;
    padding: 10px 6px;
  }
}

/* ============================================================
   Game screen — large central table (~75% viewport)
   ============================================================ */

.felt-bg {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% 42%, var(--felt-light) 0%, var(--felt-mid) 45%, var(--felt-dark) 100%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.015) 0px, rgba(255, 255, 255, 0.015) 2px, transparent 2px, transparent 4px);
  border: 3px solid rgba(61, 34, 16, 0.85);
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.55),
    0 6px 24px rgba(0, 0, 0, 0.45);
  z-index: 0;
}

.scoreboard {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Extra right padding keeps the scores clear of the fixed sound toggle */
  padding: max(6px, env(safe-area-inset-top)) 54px 4px 10px;
  gap: 6px;
  background: linear-gradient(180deg, rgba(7, 13, 22, 0.92) 0%, transparent 100%);
}

.score-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 12px 5px;
  border-radius: 12px;
  min-width: 72px;
  backdrop-filter: blur(8px);
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.55);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: all 0.3s ease;
}

.score-pill.theirs {
  background: rgba(251, 113, 133, 0.12);
  border-color: rgba(251, 113, 133, 0.55);
}

.score-pill .team-tag {
  font-size: 10px;
  color: var(--team-a);
  font-weight: 800;
}

.score-pill.theirs .team-tag {
  color: var(--team-b);
}

.score-value {
  font-size: 20px;
  font-weight: 900;
  color: var(--ivory);
  line-height: 1.15;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.round-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.round-badge.urgent .turn-timer {
  background: #fb7185;
  color: #3b0a12;
  animation: timerUrgentPulse 0.9s ease-in-out infinite alternate;
}

.round-vs {
  font-size: 14px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 1px;
  text-shadow: 0 0 14px var(--gold-glow);
}

.round-label {
  font-size: 10px;
  color: var(--ink-dim);
  font-weight: 700;
}

/* Play zone — fills ~75% of screen height */
.table-area {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 4px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.opponent-rack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 5;
}

/* Top opponent sits in normal flow — never overlaps tiles */
.opponent-rack.top {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  margin: 0;
  flex-shrink: 0;
  padding: 2px 0 4px;
  min-height: 44px;
}

.opponent-rack.hidden-rack {
  visibility: hidden;
  pointer-events: none;
}

.mini-tiles {
  display: flex;
  gap: 3px;
}

.mini-tiles.vertical {
  flex-direction: column;
}

.mini-tile {
  width: 14px;
  height: 20px;
  background: linear-gradient(135deg, #17323f 0%, #0d1f29 100%);
  border-radius: 3.5px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
}

.mini-tile::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(245, 185, 66, 0.5);
}

.mini-tiles.vertical .mini-tile {
  width: 20px;
  height: 14px;
}

.player-chip {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-dim);
  background: rgba(0, 0, 0, 0.55);
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-chip.active {
  color: #2b1d03;
  background: linear-gradient(135deg, #ffe082 0%, var(--gold-deep) 100%);
  font-weight: 800;
  border-color: #ffca28;
  box-shadow: 0 0 16px rgba(245, 185, 66, 0.7);
  animation: pulseGlow 1.5s infinite alternate ease-in-out;
}

@keyframes pulseGlow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(245, 185, 66, 0.5);
  }

  100% {
    transform: scale(1.06);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.9);
  }
}

.mid-row {
  flex: 1;
  min-height: 0;
  position: relative;
  width: 100%;
}

.opponent-rack.side {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  z-index: 5;
}

#rack-left {
  inset-inline-start: 2px;
}

#rack-right {
  inset-inline-end: 2px;
}

.board-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* More room for tiles; opponent name sits outside this box */
  padding: 8px 28px 34px;
  overflow: hidden;
  z-index: 1;
  -webkit-overflow-scrolling: touch;
}

.board-wrap.board-scrollable {
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}

.board-wrap.board-scrollable::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.board-wrap.board-scrollable::-webkit-scrollbar-thumb {
  background: rgba(245, 185, 66, 0.35);
  border-radius: 4px;
}

.board {
  position: relative;
  display: block;
  margin: 0;
  overflow: visible;
  transform-origin: center center;
  transition: transform 0.18s ease, margin 0.18s ease;
  will-change: transform;
  flex-shrink: 0;
  z-index: 2;
  max-width: none;
  max-height: none;
}

.board .tile.on-board {
  position: absolute;
  margin: 0;
}

/* ---------- Drop zones (drag & drop target placeholders) ---------- */
.drop-zone {
  position: absolute;
  width: 90px;
  height: 44px;
  border-radius: 10px;
  border: 2px dashed rgba(245, 185, 66, 0.75);
  background: rgba(245, 185, 66, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 16px;
  font-weight: 900;
  color: var(--gold);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  z-index: 10;
  box-shadow: 0 0 14px rgba(245, 185, 66, 0.3);
}

.drop-zone.interactive {
  pointer-events: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.drop-zone.active-target {
  opacity: 0.95;
  transform: scale(1);
  animation: targetPulse 1.05s infinite ease-in-out;
  border-style: solid;
  background: rgba(245, 185, 66, 0.22);
  box-shadow:
    0 0 0 2px rgba(245, 185, 66, 0.35),
    0 0 22px rgba(245, 185, 66, 0.55);
}

.drop-zone.hovered {
  opacity: 1;
  transform: scale(1.12);
  background: rgba(245, 185, 66, 0.45);
  border-color: #ffffff;
  color: #ffffff;
  box-shadow: 0 0 25px rgba(245, 185, 66, 0.85), inset 0 0 12px rgba(255, 255, 255, 0.5);
  animation: none;
}

.drop-zone .zone-end {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(43, 29, 3, 0.78);
  color: #ffe082;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 224, 130, 0.35);
}

.drop-zone.hovered .zone-end {
  background: rgba(255, 255, 255, 0.92);
  color: #2b1d03;
}

@keyframes targetPulse {
  0% {
    transform: scale(0.96);
    box-shadow:
      0 0 0 1px rgba(245, 185, 66, 0.25),
      0 0 10px rgba(245, 185, 66, 0.35);
  }

  50% {
    transform: scale(1.07);
    box-shadow:
      0 0 0 3px rgba(245, 185, 66, 0.45),
      0 0 28px rgba(245, 185, 66, 0.85);
  }

  100% {
    transform: scale(0.96);
    box-shadow:
      0 0 0 1px rgba(245, 185, 66, 0.25),
      0 0 10px rgba(245, 185, 66, 0.35);
  }
}

.turn-timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(245, 185, 66, 0.22);
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
}

@keyframes timerUrgentPulse {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.08);
  }
}

.player-chip.afk {
  border-color: rgba(253, 230, 138, 0.55);
  color: #fde68a;
  box-shadow: 0 0 0 1px rgba(253, 230, 138, 0.2);
}

.player-chip.afk.active {
  color: #3b2a05;
  background: linear-gradient(135deg, #fde68a 0%, #d97706 100%);
  border-color: #fbbf24;
}

.my-area {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  background: linear-gradient(to top, rgba(36, 18, 7, 0.98) 0%, rgba(36, 18, 7, 0.88) 75%, transparent 100%);
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.spy-toggle-btn {
  position: absolute;
  top: -46px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  background: linear-gradient(135deg, rgba(245, 185, 66, 0.25) 0%, rgba(12, 24, 38, 0.88) 100%);
  color: var(--gold);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 185, 66, 0.35);
  backdrop-filter: blur(8px);
  z-index: 10;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.spy-toggle-btn:active {
  transform: scale(0.92);
}

.spy-revealed-popup {
  position: absolute;
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(12, 24, 38, 0.95);
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 8px 12px;
  box-shadow: 0 0 25px rgba(245, 185, 66, 0.7);
  animation: fxPop 0.5s ease both;
  pointer-events: none;
}

.spy-revealed-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
}

.player-chip.me {
  background: rgba(245, 185, 66, 0.12);
  border-color: rgba(245, 185, 66, 0.4);
  color: var(--ivory);
  max-width: 220px;
}

.player-chip.me.active {
  color: #2b1d03;
  background: linear-gradient(135deg, #ffe082 0%, var(--gold-deep) 100%);
}

.hand {
  --hand-tile-w: 48px;
  --hand-tile-h: 82px;
  --hand-gap: 6px;
  --hand-pip: 6px;
  display: flex;
  justify-content: center;
  gap: var(--hand-gap);
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding: 8px 2px 10px;
  /* Prefer scaling over scrolling; pan only kicks in for very large hands */
  touch-action: manipulation;
  -webkit-overflow-scrolling: touch;
}

.hand.hand-scrollable {
  justify-content: flex-start;
  touch-action: pan-x;
}

.hand::-webkit-scrollbar {
  height: 3px;
}

.hand::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.pass-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 10px 32px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ivory);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pass-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pass-btn.urgent {
  background: linear-gradient(135deg, #ffd97a 0%, var(--gold-deep) 100%);
  color: #2b1d03;
  border-color: var(--gold);
  box-shadow: 0 0 16px var(--gold-glow);
  animation: pulseGlow 1.4s infinite alternate ease-in-out;
}

.boneyard {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}

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

.boneyard-stack {
  width: 28px;
  height: 48px;
  border-radius: 5px;
  background:
    linear-gradient(145deg, #f7f0e4 0%, #e8dcc8 55%, #d4c4a8 100%);
  border: 1.5px solid rgba(60, 40, 20, 0.35);
  box-shadow:
    3px 2px 0 rgba(60, 40, 20, 0.18),
    6px 4px 0 rgba(60, 40, 20, 0.12),
    0 4px 10px rgba(0, 0, 0, 0.25);
}

.boneyard.empty .boneyard-stack {
  opacity: 0.25;
  box-shadow: none;
}

.boneyard-count {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.boneyard-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 248, 230, 0.7);
  letter-spacing: 0.02em;
}

/* ============================================================
   Domino tiles — beveled ivory with brass pin
   ============================================================ */
.tile {
  background: linear-gradient(135deg, var(--ivory) 0%, var(--ivory-dark) 100%);
  border-radius: 8px;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.45),
    inset 0 1px 1px rgba(255, 255, 255, 0.9),
    inset 0 -2px 4px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  touch-action: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Center brass pin / rivet */
.tile.horizontal::before,
.tile.vertical::before,
.tile.in-hand::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffe699, #b8860b);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.tile.horizontal {
  width: 90px;
  height: 44px;
  flex-direction: row;
}

.tile.horizontal::after {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 50%;
  width: 1px;
  background: rgba(0, 0, 0, 0.28);
}

/* Vertical tiles on the board (doubles + turns) */
.tile.vertical {
  width: 44px;
  height: 90px;
  flex-direction: column;
}

.tile.vertical::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.28);
}

.tile.vertical .tile-half {
  padding: 5px;
}

.tile.vertical .pip {
  width: 5px;
  height: 5px;
}

.tile-half {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 6px;
  gap: 1px;
}

.pip {
  border-radius: 50%;
  background: transparent;
  margin: auto;
  width: 5px;
  height: 5px;
}

.pip.on {
  background: var(--pip);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile.in-hand {
  width: var(--hand-tile-w, 48px);
  height: var(--hand-tile-h, 82px);
  flex-direction: column;
  flex-shrink: 0;
}

.tile.in-hand::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.28);
}

.tile.in-hand .tile-half {
  padding: max(2px, calc(var(--hand-tile-w, 48px) * 0.1));
}

.tile.in-hand .pip {
  width: var(--hand-pip, 6px);
  height: var(--hand-pip, 6px);
}

.tile.disabled {
  opacity: 0.38;
  cursor: not-allowed;
  filter: saturate(0.6);
}

.tile.playable {
  box-shadow:
    0 0 0 2px var(--gold),
    0 6px 16px rgba(0, 0, 0, 0.5),
    0 0 14px rgba(245, 185, 66, 0.35);
  cursor: grab;
  animation: tileBreath 2.4s ease-in-out infinite alternate;
  animation-delay: calc(var(--i, 0) * 130ms);
}

.tile.playable.selected {
  cursor: grab;
  animation: tileSelectedPulse 0.9s ease-in-out infinite alternate;
  box-shadow:
    0 0 0 3px #fff3c4,
    0 0 0 6px rgba(245, 185, 66, 0.65),
    0 10px 22px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(245, 185, 66, 0.7);
  transform: translateY(-6px) scale(1.04);
  z-index: 3;
}

@keyframes tileSelectedPulse {
  from {
    filter: brightness(1.05);
  }

  to {
    filter: brightness(1.18);
  }
}

.tile.playable .pip.on {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 5px rgba(245, 185, 66, 0.55);
}

@keyframes tileBreath {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-3px);
  }
}

.tile.playable:hover {
  transform: translateY(-5px);
  animation: none;
}

.tile.playable.selected:hover {
  transform: translateY(-6px) scale(1.04);
  animation: tileSelectedPulse 0.9s ease-in-out infinite alternate;
}

.tile.playable:active {
  cursor: grabbing;
}

.tile.is-dragging {
  opacity: 0.2;
  filter: grayscale(60%);
  animation: none;
}

.tile.dragging-ghost {
  position: fixed !important;
  z-index: 99999 !important;
  pointer-events: none !important;
  opacity: 0.94;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.6), 0 0 0 3px var(--gold);
  transform: scale(1.15);
  transition: transform 0.05s ease-out;
  cursor: grabbing;
  animation: none;
}

/* Only the tile that was just played slams down — the rest stay put */
.board .tile.just-played {
  z-index: 3;
  animation: tileSlam 0.34s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

@keyframes tileSlam {
  0% {
    transform: scale(1.5) rotate(-7deg);
    opacity: 0;
    filter: brightness(1.8);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.6), 0 0 0 3px var(--gold);
  }

  55% {
    transform: scale(0.96) rotate(1.5deg);
    opacity: 1;
    filter: brightness(1.25);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5), 0 0 22px rgba(245, 185, 66, 0.8);
  }

  100% {
    transform: scale(1);
    filter: brightness(1);
    box-shadow:
      0 4px 10px rgba(0, 0, 0, 0.45),
      inset 0 1px 1px rgba(255, 255, 255, 0.9),
      inset 0 -2px 4px rgba(0, 0, 0, 0.18);
  }
}

/* Freshly drawn / dealt tiles slide up into the hand */
.hand .tile.dealt {
  animation: handDeal 0.44s cubic-bezier(0.2, 1.2, 0.35, 1) both;
  animation-delay: calc(var(--d, 0) * 65ms);
}

@keyframes handDeal {
  from {
    opacity: 0;
    transform: translateY(52px) rotate(9deg) scale(0.85);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   Feedback effects layer (ripples, score popups, shakes)
   ============================================================ */
.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 99998;
}

.fx-ripple {
  position: absolute;
  width: var(--s, 110px);
  height: var(--s, 110px);
  margin: calc(var(--s, 110px) / -2) 0 0 calc(var(--s, 110px) / -2);
  border-radius: 50%;
  border: 2px solid rgba(245, 185, 66, 0.75);
  box-shadow: 0 0 26px rgba(245, 185, 66, 0.45), inset 0 0 18px rgba(245, 185, 66, 0.25);
  animation: fxRipple 0.55s ease-out forwards;
}

@keyframes fxRipple {
  from {
    transform: scale(0.25);
    opacity: 0.95;
  }

  to {
    transform: scale(1.7);
    opacity: 0;
  }
}

.fx-float {
  position: absolute;
  font-size: 22px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  animation: fxFloat 1.15s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

.fx-float.bad {
  color: var(--team-b);
}

@keyframes fxFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(0.7);
  }

  25% {
    opacity: 1;
    transform: translate(-50%, -70%) scale(1.15);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -180%) scale(1);
  }
}

.fx-shake {
  animation: fxShake 0.34s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes fxShake {

  10%,
  90% {
    transform: translate(-1px, 1px);
  }

  20%,
  80% {
    transform: translate(2px, -1px);
  }

  30%,
  50%,
  70% {
    transform: translate(-3px, 2px);
  }

  40%,
  60% {
    transform: translate(3px, -2px);
  }
}

.fx-pop {
  animation: fxPop 0.42s cubic-bezier(0.2, 1.5, 0.4, 1);
}

@keyframes fxPop {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.32);
  }

  100% {
    transform: scale(1);
  }
}

.fx-flash {
  animation: fxFlash 0.5s ease-out;
}

@keyframes fxFlash {
  0% {
    filter: brightness(1);
    box-shadow: 0 0 0 rgba(245, 185, 66, 0);
  }

  35% {
    filter: brightness(1.55);
    box-shadow: 0 0 18px rgba(245, 185, 66, 0.75);
  }

  100% {
    filter: brightness(1);
    box-shadow: 0 0 0 rgba(245, 185, 66, 0);
  }
}

/* Table breathes gold while it is your move */
.table-area.my-turn .felt-bg {
  animation: feltGlow 2.6s ease-in-out infinite alternate;
}

@keyframes feltGlow {
  from {
    box-shadow:
      inset 0 0 60px rgba(0, 0, 0, 0.55),
      0 6px 24px rgba(0, 0, 0, 0.45),
      inset 0 0 0 2px rgba(245, 185, 66, 0.18);
  }

  to {
    box-shadow:
      inset 0 0 60px rgba(0, 0, 0, 0.55),
      0 6px 24px rgba(0, 0, 0, 0.45),
      inset 0 0 0 2px rgba(245, 185, 66, 0.55),
      0 0 30px rgba(245, 185, 66, 0.22);
  }
}

/* Drop-zone arrows drift toward the end they represent */
.drop-zone.active-target .zone-arrow {
  animation: zoneNudgeRight 1s ease-in-out infinite alternate;
}

.drop-zone.left-zone.active-target .zone-arrow {
  animation-name: zoneNudgeLeft;
}

@keyframes zoneNudgeRight {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(7px);
  }
}

@keyframes zoneNudgeLeft {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-7px);
  }
}

/* ============================================================
   End-of-round reveal (all remaining hands + scoring)
   ============================================================ */
.reveal-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(4, 8, 14, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.reveal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.reveal-card {
  width: 100%;
  max-width: 400px;
  max-height: 100%;
  overflow-y: auto;
  padding: 16px 16px 12px;
  border-radius: var(--radius-lg);
  background: linear-gradient(170deg, rgba(18, 30, 44, 0.98) 0%, rgba(8, 14, 22, 0.98) 100%);
  border: 1px solid rgba(245, 185, 66, 0.35);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.65);
  text-align: center;
  transform: translateY(14px) scale(0.94);
  transition: transform 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.reveal-overlay.show .reveal-card {
  transform: none;
}

.reveal-reason {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(245, 185, 66, 0.12);
  border: 1px solid rgba(245, 185, 66, 0.35);
  border-radius: 12px;
  padding: 3px 10px;
}

.reveal-title {
  margin: 8px 0 12px;
  font-size: 18px;
  font-weight: 900;
  color: var(--ink);
}

.reveal-hands {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reveal-row {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.reveal-row.allied {
  background: rgba(45, 212, 191, 0.08);
  border-color: rgba(45, 212, 191, 0.3);
}

.rr-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}

.rr-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rr-role {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9px;
}

.rr-pips {
  margin-left: auto;
  font-size: 12px;
  font-weight: 900;
  color: var(--gold);
  white-space: nowrap;
}

.rr-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.rr-empty {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
}

.tile.reveal-tile {
  width: 26px;
  height: 44px;
  flex-direction: column;
  cursor: default;
  border-radius: 5px;
  animation: revealTile 0.35s ease both;
  animation-delay: calc(var(--d, 0) * 45ms);
}

.tile.reveal-tile::before {
  width: 3px;
  height: 3px;
}

.tile.reveal-tile::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.28);
}

.tile.reveal-tile .tile-half {
  padding: 3px;
  gap: 0;
}

.tile.reveal-tile .pip {
  width: 3.5px;
  height: 3.5px;
}

@keyframes revealTile {
  from {
    opacity: 0;
    transform: rotateY(85deg) scale(0.85);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.reveal-sum {
  margin-top: 12px;
}

.reveal-totals {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.rt-chip {
  flex: 1;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.45);
}

.rt-chip.theirs {
  background: rgba(251, 113, 133, 0.12);
  border-color: rgba(251, 113, 133, 0.45);
}

.rt-label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-dim);
}

.rt-value {
  display: block;
  font-size: 20px;
  font-weight: 900;
  color: var(--ivory);
}

.rt-vs {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-faint);
}

.reveal-outcome {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-dim);
}

.reveal-outcome.good {
  color: var(--gold);
}

.reveal-outcome.bad {
  color: var(--team-b);
}

.reveal-continue-btn {
  margin-top: 14px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.28), rgba(212, 175, 55, 0.12));
  color: var(--gold);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.reveal-continue-btn:active {
  transform: scale(0.98);
}

.reveal-continue-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Sound toggle */
.sfx-toggle {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: 10px;
  z-index: 5000;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--gold);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.15s ease, color 0.2s ease, border-color 0.2s ease;
}

.sfx-toggle svg {
  width: 18px;
  height: 18px;
}

.sfx-toggle:active {
  transform: scale(0.9);
}

.sfx-toggle .icon-off {
  display: none;
}

.sfx-toggle.muted {
  color: var(--ink-faint);
}

.sfx-toggle.muted .icon-on {
  display: none;
}

.sfx-toggle.muted .icon-off {
  display: block;
}

/* ============================================================
   Result screen
   ============================================================ */
.result-card {
  position: relative;
  z-index: 1;
  width: min(100% - 32px, 420px);
  margin: 32px auto;
  text-align: center;
  padding: 36px 26px 28px;
  flex-shrink: 0;
  animation: fadeUp 0.5s ease both;
}

.result-trophy {
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(245, 185, 66, 0.2) 0%, rgba(245, 185, 66, 0.06) 100%);
  border: 1.5px solid rgba(245, 185, 66, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  box-shadow: 0 0 34px rgba(245, 185, 66, 0.25);
}

.result-trophy svg {
  width: 38px;
  height: 38px;
}

.result-trophy.celebrate {
  animation: trophyPop 0.85s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

@keyframes trophyPop {
  0% {
    transform: scale(0.2) rotate(-30deg);
    opacity: 0;
  }

  55% {
    transform: scale(1.22) rotate(8deg);
    opacity: 1;
  }

  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.result-trophy.lost {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--ink-faint);
  box-shadow: none;
}

.result-card h2 {
  font-size: 26px;
  font-weight: 900;
  color: var(--gold);
  margin: 0 0 10px;
  text-shadow: 0 2px 10px rgba(245, 185, 66, 0.3);
}

.result-score {
  font-size: 46px;
  font-weight: 900;
  color: var(--ivory);
  margin-bottom: 8px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

#result-sub {
  color: var(--ink-dim);
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 22px;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(10, 16, 26, 0.94);
  color: var(--ivory);
  padding: 10px 22px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 100000;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(245, 185, 66, 0.3);
  max-width: 86vw;
  text-align: center;
}

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

/* ============================================================
   Small screens
   ============================================================ */
@media (max-width: 340px) {

  /* Keep on-board sizes = TILE_H/TILE_V in app.js (avoid layout drift) */
  .tile.horizontal:not(.on-board) {
    width: 78px;
    height: 38px;
  }

  .tile.vertical:not(.on-board) {
    width: 38px;
    height: 78px;
  }

  .app-title {
    font-size: 34px;
  }
}

@media (max-height: 640px) {
  .board-wrap {
    padding: 40px 32px 38px;
  }

  .logo-badge {
    width: 66px;
    height: 66px;
    margin-bottom: 8px;
  }

  .app-title {
    font-size: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   Interactive 1v1 Boneyard
   ============================================================ */
.boneyard.interactive-draw {
  cursor: pointer;
  border-color: var(--gold) !important;
  box-shadow: 0 0 16px var(--gold-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  animation: boneyardPulse 1.4s ease-in-out infinite alternate;
}

.boneyard.interactive-draw:active {
  transform: scale(0.94);
}

.boneyard.interactive-draw .boneyard-label {
  color: var(--gold) !important;
  font-weight: 800;
}

@keyframes boneyardPulse {
  from {
    box-shadow: 0 0 8px rgba(245, 185, 66, 0.3);
  }

  to {
    box-shadow: 0 0 24px rgba(245, 185, 66, 0.7);
  }
}

/* ============================================================
   Quick Chat / Emotes — radial wheel + speech bubbles
   ============================================================ */
.emote-toggle-btn {
  position: absolute;
  top: -46px;
  left: 12px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  z-index: 10;
  margin: 0;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.emote-toggle-btn:active,
.emote-toggle-btn.is-holding {
  transform: scale(0.92);
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(245, 185, 66, 0.45);
}

.emote-toggle-btn.wheel-open {
  border-color: var(--gold);
  background: rgba(245, 185, 66, 0.18);
  box-shadow: 0 0 18px rgba(245, 185, 66, 0.4);
}

.emote-wheel {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
}

.emote-wheel:not(.hidden) {
  pointer-events: auto;
}

.emote-wheel.hidden {
  display: none;
}

.emote-wheel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 18, 0.35);
  backdrop-filter: blur(2px);
  animation: emoteFadeIn 0.18s ease both;
}

.emote-wheel-disc {
  --wheel-size: 220px;
  --wheel-radius: 78px;
  position: absolute;
  width: var(--wheel-size);
  height: var(--wheel-size);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(245, 185, 66, 0.12) 0%, transparent 42%),
    rgba(10, 18, 28, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(245, 185, 66, 0.12);
  transform: translate(-50%, -50%) scale(0.72);
  opacity: 0;
  transition: transform 0.22s cubic-bezier(0.34, 1.45, 0.64, 1), opacity 0.18s ease;
}

.emote-wheel.open .emote-wheel-disc {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.emote-wheel-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(245, 185, 66, 0.35);
  box-shadow: 0 0 14px rgba(245, 185, 66, 0.25);
  pointer-events: none;
}

.emote-wedge {
  --n: 8;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transform:
    rotate(calc(var(--i) * 360deg / var(--n) - 90deg))
    translate(var(--wheel-radius))
    rotate(calc(var(--i) * -360deg / var(--n) + 90deg));
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.emote-wedge:hover,
.emote-wedge.is-hot {
  background: rgba(245, 185, 66, 0.28);
  border-color: var(--gold);
  box-shadow: 0 0 18px rgba(245, 185, 66, 0.55);
  transform:
    rotate(calc(var(--i) * 360deg / var(--n) - 90deg))
    translate(var(--wheel-radius))
    rotate(calc(var(--i) * -360deg / var(--n) + 90deg))
    scale(1.18);
  z-index: 2;
}

.emote-wedge:active {
  transform:
    rotate(calc(var(--i) * 360deg / var(--n) - 90deg))
    translate(var(--wheel-radius))
    rotate(calc(var(--i) * -360deg / var(--n) + 90deg))
    scale(1.05);
}

@keyframes emoteFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Speech bubbles above player chips */
.speech-bubble {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px 10px;
  border-radius: 18px;
  background: rgba(252, 248, 235, 0.97);
  color: #1d1a16;
  border: 1.5px solid rgba(245, 185, 66, 0.65);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.45),
    0 0 16px rgba(245, 185, 66, 0.28);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  animation: speechPop 2.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  max-width: 140px;
}

.speech-bubble.mine {
  background: linear-gradient(180deg, #fff8e4 0%, #ffe9b0 100%);
  border-color: var(--gold);
}

.speech-bubble .sb-emoji {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.15));
  animation: speechBounce 0.7s ease 0.05s both;
}

.speech-bubble .sb-text {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #6b4e12;
  white-space: nowrap;
}

.speech-bubble .sb-tail {
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: inherit;
  border-right: 1.5px solid rgba(245, 185, 66, 0.65);
  border-bottom: 1.5px solid rgba(245, 185, 66, 0.65);
  transform: rotate(45deg);
  border-radius: 0 0 3px 0;
}

.speech-bubble.from-left {
  transform: translate(8px, calc(-100% - 8px));
}

.speech-bubble.from-left .sb-tail {
  left: 14px;
  margin-left: 0;
}

.speech-bubble.from-right {
  transform: translate(calc(-100% - 8px), calc(-100% - 8px));
}

.speech-bubble.from-right .sb-tail {
  left: auto;
  right: 14px;
  margin-left: 0;
}

@keyframes speechPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -70%) scale(0.45);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, calc(-100% - 18px)) scale(1.08);
  }
  22% {
    transform: translate(-50%, calc(-100% - 14px)) scale(1);
  }
  78% {
    opacity: 1;
    transform: translate(-50%, calc(-100% - 22px)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-100% - 48px)) scale(0.92);
  }
}

.speech-bubble.from-left {
  animation-name: speechPopLeft;
}

.speech-bubble.from-right {
  animation-name: speechPopRight;
}

@keyframes speechPopLeft {
  0% { opacity: 0; transform: translate(8px, -40%) scale(0.45); }
  12% { opacity: 1; transform: translate(8px, calc(-100% - 12px)) scale(1.08); }
  22% { transform: translate(8px, calc(-100% - 8px)) scale(1); }
  78% { opacity: 1; transform: translate(8px, calc(-100% - 16px)) scale(1); }
  100% { opacity: 0; transform: translate(8px, calc(-100% - 40px)) scale(0.92); }
}

@keyframes speechPopRight {
  0% { opacity: 0; transform: translate(calc(-100% - 8px), -40%) scale(0.45); }
  12% { opacity: 1; transform: translate(calc(-100% - 8px), calc(-100% - 12px)) scale(1.08); }
  22% { transform: translate(calc(-100% - 8px), calc(-100% - 8px)) scale(1); }
  78% { opacity: 1; transform: translate(calc(-100% - 8px), calc(-100% - 16px)) scale(1); }
  100% { opacity: 0; transform: translate(calc(-100% - 8px), calc(-100% - 40px)) scale(0.92); }
}

@keyframes speechBounce {
  0% { transform: scale(0.6) rotate(-12deg); }
  60% { transform: scale(1.15) rotate(6deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ============================================================
   Match Statistics Panel
   ============================================================ */
.match-stats-panel {
  width: 100%;
  margin: 14px 0 18px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: start;
}

.stats-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 11px;
  color: var(--ink-dim);
  font-weight: 600;
}

.stat-value {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.stat-tile-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rounds-history-wrap {
  margin-top: 8px;
}

.rounds-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  max-height: 120px;
  overflow-y: auto;
}

.rh-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
}

.rh-item .rh-round {
  font-weight: 700;
  color: var(--ink-dim);
}

.rh-item .rh-winner {
  font-weight: 800;
  color: var(--team-a);
}

.rh-item.lost .rh-winner {
  color: var(--team-b);
}

.rh-item .rh-pts {
  font-weight: 800;
  color: var(--gold);
}

/* ============================================================
   Reconnection Banner (UX & Reconnection)
   ============================================================ */
.reconnect-banner {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100001;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(185, 28, 28, 0.94);
  border: 1px solid rgba(252, 165, 165, 0.4);
  color: #ffffff;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 16px rgba(185, 28, 28, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  animation: reconnectPulse 1.4s ease-in-out infinite alternate;
}

.reconnect-banner.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-22px);
  pointer-events: none;
}

.rc-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: rcSpin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes rcSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes reconnectPulse {
  from {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 10px rgba(185, 28, 28, 0.3);
  }

  to {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6), 0 0 20px rgba(220, 38, 38, 0.7);
  }
}

/* ============================================================
   Anti-Screenshot & Anti-Cheat Protection
   ============================================================ */
.anti-screenshot-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(7, 13, 22, 0.98);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  transition: opacity 0.25s ease;
}

.anti-screenshot-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.anti-screenshot-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--gold-glow);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  max-width: 340px;
  width: 90%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  animation: popUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.anti-screenshot-shield {
  font-size: 52px;
  margin-bottom: 12px;
  line-height: 1;
}

.anti-screenshot-card h3 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
}

.anti-screenshot-card p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-dim);
  line-height: 1.5;
}

/* Hide the live table (hand + board) while the Mini App is backgrounded */
body.screen-protected #screen-game {
  filter: blur(42px) brightness(0.12) saturate(0.2) !important;
  pointer-events: none !important;
  user-select: none !important;
}

body.screen-protected #hand .tile.in-hand .pip,
body.screen-protected #hand .tile.in-hand .tile-half {
  opacity: 0 !important;
}

body.screen-protected #hand .tile.in-hand {
  background: linear-gradient(145deg, #1a3040, #0d1b24) !important;
  box-shadow: none !important;
}

/* Prevent image dragging, text selection, and touch callouts */
img,
canvas,
.tile,
.hand-tile,
.pip {
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -khtml-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
}

/* ============================================================
   Desktop / wide viewport — lobby composition
   ============================================================ */
@media (min-width: 768px) {
  #screen-home.active {
    justify-content: flex-start;
    padding: 24px 0 0;
  }

  #screen-waiting.active,
  #screen-result.active {
    justify-content: center;
    padding: 24px 0;
  }

  .home-content {
    width: min(100% - 48px, 480px);
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .waiting-content {
    width: min(100% - 48px, 480px);
  }

  .result-card {
    width: min(100% - 48px, 440px);
    margin: 24px auto;
  }

  .app-title {
    font-size: 46px;
  }

  .app-tagline {
    font-size: 14px;
  }
}

@media (min-width: 1024px) {
  .home-content {
    width: min(100% - 64px, 980px);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 28px 64px;
    padding: 40px 32px;
  }

  .home-brand {
    flex: 1 1 300px;
    max-width: 420px;
    align-items: flex-start;
    text-align: left;
  }

  .home-brand .logo-badge {
    margin-bottom: 18px;
  }

  .home-brand .app-title {
    font-size: 64px;
    letter-spacing: 1.5px;
    line-height: 1.05;
  }

  .home-brand .app-tagline {
    margin: 8px 0 0;
    font-size: 16px;
    line-height: 1.45;
    max-width: 28ch;
  }

  .home-content > .home-panel {
    flex: 0 1 460px;
    width: 100%;
    padding: 24px 22px;
  }

  .waiting-content {
    width: min(100% - 64px, 560px);
  }
}

/* ============================================================
   Home guide article (SEO / rules / FAQ)
   ============================================================ */
.home-guide {
  position: relative;
  z-index: 1;
  width: min(100% - 32px, 760px);
  margin: 28px auto 48px;
  padding: 28px 22px 36px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  color: var(--ink);
  line-height: 1.7;
  user-select: text;
  -webkit-user-select: text;
}

.guide-header {
  margin-bottom: 18px;
}

.guide-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.home-guide h2 {
  margin: 0 0 12px;
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 900;
  line-height: 1.25;
  color: var(--ivory);
}

.guide-lead {
  margin: 0;
  color: var(--ink-dim);
  font-size: 15px;
  font-weight: 500;
}

.guide-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.guide-toc a {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(245, 185, 66, 0.28);
  background: rgba(245, 185, 66, 0.08);
  color: var(--gold);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}

.guide-toc a:hover {
  background: rgba(245, 185, 66, 0.16);
}

.guide-section {
  padding: 18px 0 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.guide-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.home-guide h3 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 800;
  color: var(--ivory);
}

.home-guide h4 {
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--gold);
}

.home-guide p {
  margin: 0 0 12px;
  font-size: 14.5px;
  color: var(--ink-dim);
}

.home-guide strong {
  color: var(--ink);
  font-weight: 800;
}

.guide-faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 16px;
}

.guide-faq-item {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  padding: 0 14px;
}

.guide-faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--ivory);
}

.guide-faq-item summary::-webkit-details-marker {
  display: none;
}

.guide-faq-item summary::after {
  content: "+";
  float: right;
  color: var(--gold);
  font-weight: 900;
}

.guide-faq-item[open] summary::after {
  content: "–";
}

.guide-faq-item p {
  margin: 0 0 14px;
  padding-top: 0;
}

.guide-closing {
  margin-top: 8px !important;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(245, 185, 66, 0.08);
  border: 1px solid rgba(245, 185, 66, 0.22);
  color: var(--ink) !important;
}

@media (min-width: 768px) {
  .home-guide {
    width: min(100% - 48px, 800px);
    padding: 36px 40px 44px;
    margin-top: 12px;
  }

  .home-guide p {
    font-size: 15.5px;
  }
}

@media print {

  html,
  body {
    display: none !important;
  }
}