:root {
  --bg-deep: #070b14;
  --bg-surface: #0f172a;
  --bg-card: rgba(17, 25, 45, 0.85);
  --bg-card-hover: rgba(25, 36, 64, 0.95);
  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-glow: rgba(56, 189, 248, 0.45);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-blue: #38bdf8;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --gold: #fbbf24;
  --silver: #cbd5e1;
  --bronze: #d97706;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-lg: 0 20px 45px -15px rgba(0, 0, 0, 0.7);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  min-height: 100%;
  overflow-y: auto;
}

body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(circle at 12% 15%, rgba(56, 189, 248, 0.12), transparent 32%),
    radial-gradient(circle at 88% 12%, rgba(168, 85, 247, 0.12), transparent 35%),
    radial-gradient(circle at 50% 85%, rgba(16, 185, 129, 0.08), transparent 40%);
  color: var(--text-main);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  line-height: 1.5;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

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

/* =========================================
   TOP NAVIGATION BAR
   ========================================= */
.top-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: rgba(11, 17, 32, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.brand-logo svg {
  width: 40px;
  height: 40px;
  display: block;
  filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.35));
  transition: transform 0.25s ease;
}

.brand:hover .brand-logo svg {
  transform: scale(1.07) rotate(-4deg);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.brand-text h1 span {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.player-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.75rem 0.35rem 0.45rem;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 999px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.player-pill:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: var(--accent-blue);
  transform: translateY(-1px);
}

.player-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
}

.player-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.player-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.player-name {
  font-size: 0.85rem;
  color: #fff;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-icon {
  font-size: 0.85rem;
  color: var(--accent-blue);
  margin-left: 0.15rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 38px;
  padding: 0 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.75);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: var(--accent-blue);
}

.fullscreen-btn {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(124, 58, 237, 0.25));
  border-color: rgba(96, 165, 250, 0.4);
}

/* =========================================
   MAIN CONTAINER & HERO BANNER
   ========================================= */
.main-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
}

.home-view {
  display: none;
}

.home-view.active-view {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.92));
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: var(--shadow-lg);
}

.hero-content {
  max-width: 720px;
}

.hero-badge {
  display: inline-block;
  padding: 0.22rem 0.65rem;
  margin-bottom: 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 999px;
}

.hero-content h2 {
  font-size: 1.55rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  background: linear-gradient(90deg, #ffffff, #bae6fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-content p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.hero-stats {
  display: flex;
  gap: 0.85rem;
}

.stat-box {
  min-width: 105px;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent-blue);
}

.stat-title {
  font-size: 0.73rem;
  color: var(--text-muted);
}

/* =========================================
   GAMES GRID & CARDS
   ========================================= */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.35rem;
}

.game-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.game-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-glow);
  box-shadow: 0 24px 48px -12px rgba(14, 165, 233, 0.22);
}

.card-banner {
  position: relative;
  height: 150px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  overflow: hidden;
}

.card-banner-art {
  position: absolute;
  inset: 0;
  opacity: 0.9;
  z-index: 0;
}

.card-banner-content {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.game-genre-tag {
  position: absolute;
  top: 0.85rem;
  left: 1rem;
  z-index: 2;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f8fafc;
}

.game-device-tag {
  position: absolute;
  top: 0.85rem;
  right: 1rem;
  z-index: 2;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
}

.card-body {
  padding: 1.15rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.95rem;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-title-row h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.score-unit-badge {
  font-size: 0.72rem;
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.card-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  min-height: 2.6em;
}

/* Top 3 Leaderboard Box Inside Card */
.card-leaderboard {
  background: rgba(9, 13, 24, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
}

.lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.lb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.32rem 0.5rem;
  border-radius: 7px;
  background: rgba(30, 41, 59, 0.45);
  font-size: 0.82rem;
}

.lb-row.rank-1 {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.16), rgba(30, 41, 59, 0.4));
  border-left: 3px solid var(--gold);
}

.lb-row.rank-2 {
  background: linear-gradient(90deg, rgba(203, 213, 225, 0.12), rgba(30, 41, 59, 0.35));
  border-left: 3px solid var(--silver);
}

.lb-row.rank-3 {
  background: linear-gradient(90deg, rgba(217, 119, 6, 0.14), rgba(30, 41, 59, 0.35));
  border-left: 3px solid var(--bronze);
}

.lb-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.lb-medal {
  font-size: 0.92rem;
  line-height: 1;
}

.lb-player {
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 145px;
}

.lb-player.is-empty {
  color: #64748b;
  font-style: italic;
  font-weight: 400;
}

.lb-score {
  font-weight: 700;
  color: var(--accent-blue);
  font-variant-numeric: tabular-nums;
}

.card-actions {
  margin-top: auto;
  display: flex;
  gap: 0.6rem;
}

.play-now-btn {
  flex: 1;
  padding: 0.72rem 1rem;
  border: none;
  border-radius: 11px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.6);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.play-now-btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

/* =========================================
   IN-GAME STAGE VIEW
   ========================================= */
.game-view {
  display: none;
}

.game-view.active-view {
  display: block;
  animation: fadeIn 0.25s ease;
}

.game-stage-wrapper {
  background: #090d18;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 115px);
}

/* Fullscreen overrides */
.game-stage-wrapper:fullscreen,
.game-stage-wrapper:-webkit-full-screen,
.game-stage-wrapper.pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100vw;
  height: 100vh;
  max-width: none;
  border-radius: 0;
  border: none;
  background: #050811;
}

.game-stage-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border-subtle);
}

.stage-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.back-btn {
  padding: 0.42rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.85);
  color: #f8fafc;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.back-btn:hover {
  border-color: var(--accent-blue);
  background: rgba(51, 65, 85, 0.9);
}

.stage-title-group h2 {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.15;
}

.stage-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.stage-center {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.hud-chip {
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.hud-label {
  color: var(--text-muted);
}

.score-chip strong {
  color: var(--accent-emerald);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.best-chip strong {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.stage-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stage-action-btn {
  padding: 0.42rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.85);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.stage-action-btn:hover {
  border-color: var(--accent-blue);
  background: rgba(51, 65, 85, 0.95);
}

.primary-stage-btn {
  background: linear-gradient(135deg, #2563eb, #6366f1);
  border-color: rgba(96, 165, 250, 0.5);
}

.game-mount {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  position: relative;
  overflow: auto;
  user-select: none;
}

.ingame-top3-bar {
  width: 100%;
  padding: 0.65rem 1rem;
  background: rgba(11, 17, 32, 0.95);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ingame-top3-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ingame-top3-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 0.55rem;
}

@media (max-width: 768px) {
  .ingame-top3-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }
}

/* =========================================
   SHARED IN-GAME UI COMPONENTS
   ========================================= */
.game-shell {
  width: 100%;
  max-width: 1120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.game-toolbar {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.pill-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  border-color: var(--accent-blue);
}

.pill-btn.active {
  background: linear-gradient(135deg, #0284c7, #4f46e5);
  border-color: var(--accent-blue);
  color: #fff;
}

.canvas-frame {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-canvas {
  display: block;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: #0b1120;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  touch-action: none;
}

/* Touch Controls Bar for Mobile / Tablet */
.touch-controls {
  width: 100%;
  max-width: 760px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.touch-cluster {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.touch-btn {
  min-width: 58px;
  height: 52px;
  padding: 0 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.touch-btn:active,
.touch-btn.pressed {
  transform: scale(0.95);
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-color: #38bdf8;
}

.touch-btn.action-danger {
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.85), rgba(159, 18, 57, 0.9));
  border-color: rgba(251, 113, 133, 0.55);
}

.touch-btn.action-boost {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.85), rgba(180, 83, 9, 0.9));
  border-color: rgba(251, 191, 36, 0.55);
}

/* =========================================
   SUDOKU CUSTOM STYLES
   ========================================= */
.sudoku-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 1.25rem;
  width: 100%;
}

.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: min(92vw, 450px);
  height: min(92vw, 450px);
  background: #1e293b;
  border: 3px solid #38bdf8;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

.sudoku-cell {
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #0f172a;
  color: #f8fafc;
  font-size: clamp(1.05rem, 3.5vw, 1.45rem);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease;
}

.sudoku-cell.box-right {
  border-right: 2.5px solid #38bdf8;
}

.sudoku-cell.box-bottom {
  border-bottom: 2.5px solid #38bdf8;
}

.sudoku-cell.fixed {
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.95);
}

.sudoku-cell.user-filled {
  color: #38bdf8;
}

.sudoku-cell.related {
  background: rgba(30, 58, 138, 0.32);
}

.sudoku-cell.same-num {
  background: rgba(56, 189, 248, 0.28);
}

.sudoku-cell.selected {
  background: rgba(37, 99, 235, 0.6) !important;
  box-shadow: inset 0 0 0 2px #60a5fa;
}

.sudoku-cell.error-cell {
  background: rgba(225, 29, 72, 0.38) !important;
  color: #fda4af;
}

.sudoku-notes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 2px;
  font-size: clamp(0.5rem, 1.5vw, 0.65rem);
  color: #cbd5e1;
  font-weight: 500;
  pointer-events: none;
}

.sudoku-notes-grid span {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sudoku-sidepanel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: min(92vw, 300px);
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.numpad-btn {
  height: 52px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  background: rgba(30, 41, 59, 0.9);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.numpad-btn:hover {
  background: rgba(37, 99, 235, 0.55);
  border-color: var(--accent-blue);
}

.sudoku-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

/* =========================================
   DOMINO CUSTOM STYLES
   ========================================= */
.domino-tray {
  width: 100%;
  max-width: 920px;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.domino-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.domino-hand-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  min-height: 76px;
  align-items: center;
}

.domino-tile-btn {
  width: 54px;
  height: 102px;
  border-radius: 10px;
  border: 2px solid #94a3b8;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  color: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  box-shadow:
    0 6px 0 #cbd5e1,
    0 10px 16px rgba(0, 0, 0, 0.5);
  position: relative;
}

.domino-tile-btn:hover {
  transform: translateY(-4px);
}

.domino-tile-btn.playable {
  border-color: #10b981;
  box-shadow:
    0 6px 0 #059669,
    0 0 16px rgba(16, 185, 129, 0.55);
}

.domino-tile-btn.selected {
  transform: translateY(-10px) scale(1.06);
  border-color: #2563eb;
  box-shadow:
    0 8px 0 #1d4ed8,
    0 12px 24px rgba(37, 99, 235, 0.65);
}

.domino-tile-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.domino-tile-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* =========================================
   MODALS & TOASTS
   ========================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal-card {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(160deg, #111827, #0f172a);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 25px 55px rgba(0, 0, 0, 0.8);
  animation: fadeIn 0.22s ease;
}

.modal-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.55rem;
}

.modal-header h3 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

.modal-header p {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.modal-form {
  margin-top: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.input-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
}

.text-input {
  width: 100%;
  padding: 0.72rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-size: 0.96rem;
  outline: none;
}

.text-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.input-error {
  font-size: 0.78rem;
  color: var(--accent-rose);
}

.quick-names {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.quick-name-chip {
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.7);
  color: #e2e8f0;
  font-size: 0.73rem;
  cursor: pointer;
}

.quick-name-chip:hover {
  border-color: var(--accent-blue);
  color: #fff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.btn-primary {
  padding: 0.68rem 1.2rem;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-secondary {
  padding: 0.68rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.8);
  color: #cbd5e1;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.lb-modal-list {
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lb-modal-banner {
  margin-top: 0.35rem;
  color: var(--gold) !important;
  font-weight: 600;
}

.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 11000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-item {
  padding: 0.7rem 1rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-blue);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.2s ease;
}

/* =========================================
   RESPONSIVE DESIGN (MOBILE & TABLET)
   ========================================= */
@media (max-width: 768px) {
  .top-navbar {
    padding: 0.6rem 0.85rem;
  }

  .brand-text p,
  .btn-label-desktop {
    display: none;
  }

  .main-container {
    padding: 0.75rem 0.75rem 2rem;
  }

  .hero-banner {
    padding: 1.1rem;
  }

  .hero-content h2 {
    font-size: 1.25rem;
  }

  .hero-stats {
    width: 100%;
    justify-content: space-between;
  }

  .stat-box {
    flex: 1;
    min-width: 0;
    padding: 0.55rem 0.4rem;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .game-stage-header {
    padding: 0.55rem 0.65rem;
    gap: 0.5rem;
  }

  .stage-center {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .hud-chip {
    flex: 1;
    justify-content: center;
    padding: 0.25rem 0.4rem;
    font-size: 0.74rem;
  }
}
