:root {
  --bg-color: #ffffff;
  --panel-bg: #ffffff;
  --text-color: #0f172a;
  --text-muted: #64748b;
  --primary-color: #0f172a;
  --primary-hover: #1e293b;
  --hint-color: #854d0e;
  --danger-color: #ef4444;
  --tile-white: #ffffff;
  --tile-gray: #eeeff3;
  --tile-selected: #d6d7e0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  border-radius: 0 !important; /* Flat rectangular aesthetic, zero round rectangles */
}

html, body, #app {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overscroll-behavior: none;
  touch-action: manipulation;
}

.app-container {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* MAIN MENU - FLAT & MINIMALIST */
.menu-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding-top: max(32px, env(safe-area-inset-top, 32px));
  padding-bottom: max(32px, env(safe-area-inset-bottom, 32px));
  padding-left: 24px;
  padding-right: 24px;
  background-color: #ffffff;
  overflow-y: auto;
  box-sizing: border-box;
}

.menu-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.logo-container {
  width: 150px;
  max-width: 50vw;
  max-height: 80px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-container svg {
  width: 100%;
  height: 100%;
  max-height: 80px;
  display: block;
}

.menu-title {
  font-size: 2.4rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.5px;
  text-align: center;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 320px;
}

/* FLAT RECTANGULAR BUTTONS - NO ROUND CORNERS, NO BORDERS */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 0;
  border: none;
  box-shadow: none;
  cursor: pointer;
  transition: opacity 0.1s ease, transform 0.08s ease;
}

.btn:active {
  opacity: 0.85;
  transform: scale(0.98);
}

.btn-resume {
  background-color: #4f46e5;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.btn-blitz {
  background-color: #f59e0b;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.btn-versus {
  background-color: #2563eb;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.btn-primary {
  background-color: #0f172a;
  color: #ffffff;
}

.btn-secondary {
  background-color: #eeeff3;
  color: #0f172a;
}

.btn-danger {
  background-color: #fee2e2;
  color: #b91c1c;
}

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

/* IN-GAME SCREEN LAYOUT */
.game-screen {
  display: flex;
  width: 100vw;
  height: 100vh;
  background-color: #ffffff;
  overflow: hidden;
}

/* Portrait Layout - Safe Area Clearance for Pixel 9 */
.game-screen.portrait {
  flex-direction: column;
}

.game-screen.portrait .game-bar {
  flex-direction: row;
  width: 100%;
  padding-top: max(48px, env(safe-area-inset-top, 48px));
  padding-bottom: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: max(16px, env(safe-area-inset-right, 16px));
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.game-screen.portrait .board-area {
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
  background-color: #f1f5f9;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Landscape Layout */
.game-screen.landscape {
  flex-direction: row;
}

.game-screen.landscape .game-bar {
  flex-direction: column;
  width: calc(126px + max(16px, env(safe-area-inset-left, 16px)));
  min-width: 142px;
  height: 100%;
  padding-top: max(14px, env(safe-area-inset-top, 14px));
  padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: 16px;
  background-color: #ffffff;
  border-right: 1px solid #e2e8f0;
  justify-content: space-between;
  align-items: stretch;
  flex-shrink: 0;
  box-sizing: border-box;
}

.game-screen.landscape .board-area {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 10px;
  padding-right: max(10px, env(safe-area-inset-right, 10px));
  background-color: #f1f5f9;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Game Bar Elements */
.game-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 10;
  box-sizing: border-box;
}

.game-bar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
}

.game-screen.landscape .game-bar-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  width: 100%;
  padding: 12px 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 6px 14px;
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
}

.timer-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bonus-time-pop {
  position: absolute;
  top: -18px;
  right: -14px;
  color: #16a34a;
  font-size: 0.82rem;
  font-weight: 900;
  pointer-events: none;
  animation: bonusPop 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes bonusPop {
  0% { opacity: 0; transform: translateY(4px) scale(0.8); }
  20% { opacity: 1; transform: translateY(0) scale(1.1); }
  75% { opacity: 1; transform: translateY(-6px) scale(1); }
  100% { opacity: 0; transform: translateY(-14px) scale(0.9); }
}

.status-timer.timer-warning {
  color: #dc2626 !important;
  animation: timerPulse 0.6s infinite alternate;
}

@keyframes timerPulse {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.65; transform: scale(1.05); }
}

.game-bar-right-spacer {
  width: 86px;
  min-width: 86px;
  height: 40px;
}

.game-screen.landscape .game-bar-right-spacer {
  display: none;
}

.game-screen.landscape .status-pill {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: transparent;
  border: none;
  padding: 0;
  width: 100%;
}

.status-divider {
  color: #cbd5e1;
  font-size: 0.8rem;
}

.game-screen.landscape .status-divider {
  display: none;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.game-screen.landscape .status-item {
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 8px 6px;
  width: 100%;
  justify-content: center;
  box-sizing: border-box;
  font-size: 0.95rem;
  font-weight: 800;
}

.status-deck {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #334155;
}

.game-screen.landscape .status-deck {
  gap: 7px;
}

.status-deck svg {
  color: #64748b;
}

.game-screen.landscape .status-deck svg {
  width: 16px;
  height: 16px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #eeeff3;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: #0f172a;
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  transition: opacity 0.1s ease, background-color 0.1s ease;
  box-sizing: border-box;
}

.btn-icon:active {
  opacity: 0.8;
  background-color: #e2e8f0;
}

.game-bar-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.game-bar-nav-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.game-screen.landscape .game-bar-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.game-screen.landscape .game-bar-nav-buttons {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.game-screen.landscape .game-bar-nav-buttons button {
  width: 42px;
  height: 42px;
  min-width: 42px;
  flex-shrink: 0;
}

.game-screen.landscape .btn-hint {
  width: 100%;
  height: 42px;
  padding: 0 8px;
  box-sizing: border-box;
}

.btn-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background-color: #fef08a;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: #854d0e;
  font-weight: 800;
  padding: 0 14px;
  height: 40px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.1s ease, background-color 0.1s ease;
}

.btn-hint:active {
  opacity: 0.8;
  background-color: #fde047;
}

.hint-badge {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}

/* 3x3 CARD GRID - NATURAL ASPECT RATIO, TACTILE CARDS */
.board-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
  max-width: min(100%, 460px);
  height: 100%;
  max-height: min(100%, calc(100vw * 1.35));
  margin: auto;
  box-sizing: border-box;
  padding: 0;
}

.game-screen.landscape .board-grid {
  max-width: min(100%, calc(100vh * 1.4));
  max-height: 100%;
  aspect-ratio: 1.4 / 1;
}

.card-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  border: 2px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  border-radius: 0 !important;
  cursor: pointer;
  padding: 6px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  transition: transform 0.08s ease, background-color 0.08s ease, border-color 0.08s ease;
}

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

/* Selection State - Unmistakable Vibrant Indigo Frame */
.card-tile.selected {
  background-color: #eef2ff !important;
  border: 3px solid #4f46e5 !important;
  box-shadow: 0 0 0 1px #4f46e5, 0 4px 12px rgba(79, 70, 229, 0.25) !important;
  transform: scale(0.96);
}

.card-svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
}

/* BOARD RESHUFFLE SHIMMER ANIMATION */
.board-grid.shimmering {
  animation: boardShimmer 350ms ease-out;
}

@keyframes boardShimmer {
  0% {
    opacity: 1;
    filter: brightness(1);
  }
  35% {
    opacity: 0.45;
    filter: brightness(1.12);
  }
  100% {
    opacity: 1;
    filter: brightness(1);
  }
}

/* SLEEK NON-INTRUSIVE TOAST NOTIFICATION - FLOATS BELOW GAME BAR */
.toast-notification {
  position: absolute;
  top: max(74px, calc(env(safe-area-inset-top, 48px) + 24px));
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 0;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  z-index: 100;
  pointer-events: none;
  animation: toastFadeIn 0.15s ease-out;
  white-space: nowrap;
}

@keyframes toastFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -4px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* MODALS - FLAT RECTANGULAR CARD */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
  animation: modalFadeIn 0.15s ease-out;
}

.modal-overlay:has(.leaderboard-list) {
  z-index: 250;
}

.modal-content {
  background-color: #ffffff;
  border-radius: 0;
  border: none;
  width: 100%;
  max-width: 380px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--text-color);
  animation: modalPopIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-content h2 {
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
  color: #0f172a;
}

.leaderboard-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.tab-group {
  display: flex;
  width: 100%;
  background-color: #eeeff3;
  padding: 3px;
  gap: 3px;
  box-sizing: border-box;
}

.tab-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 800;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: center;
}

.tab-btn.active {
  background-color: #0f172a;
  color: #ffffff;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background-color: #eeeff3;
  border-radius: 0;
  border: 1.5px solid transparent;
  font-size: 0.88rem;
  transition: all 0.15s ease;
}

.leaderboard-row.cleared-row {
  background-color: #fef9c3;
  border-color: #ca8a04;
}

.leaderboard-row.current-game-row {
  background-color: #e0e7ff;
  border-color: #6366f1;
}

.leaderboard-row.cleared-row.current-game-row {
  background-color: #e0e7ff;
  border-color: #ca8a04;
}

.blitz-status-tag {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  display: inline-block;
}

.tag-cleared {
  background-color: #dcfce7;
  color: #15803d;
}

.tag-timeout {
  background-color: #f1f5f9;
  color: #475569;
}

.tag-mistake {
  background-color: #fee2e2;
  color: #b91c1c;
}

.current-badge {
  background-color: #4f46e5;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 5px;
  margin-left: 6px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  color: #0f172a;
}

.time-val {
  font-weight: 800;
  font-size: 1.05rem;
}

.meta-val {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.date-val {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 20px 0;
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.victory-content {
  text-align: center;
}

.blitz-result-badge {
  display: inline-block;
  align-self: center;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.blitz-result-badge.badge-cleared {
  background-color: #dcfce7;
  color: #15803d;
  border: 1.5px solid #16a34a;
}

.blitz-result-badge.badge-timeout {
  background-color: #f1f5f9;
  color: #334155;
  border: 1.5px solid #94a3b8;
}

.blitz-result-badge.badge-mistake {
  background-color: #fee2e2;
  color: #b91c1c;
  border: 1.5px solid #ef4444;
}

.victory-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: -8px;
}

.rank-alert {
  background-color: #fef08a;
  color: #854d0e;
  padding: 10px;
  border-radius: 0;
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
}

.victory-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background-color: #eeeff3;
  padding: 14px;
  border-radius: 0;
  border: none;
}

.stat-line {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
}

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

.victory-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.btn-full-width {
  width: 100%;
}

.victory-secondary-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
}

.victory-secondary-buttons button {
  flex: 1;
}

/* HELP MODAL STYLES */
.help-modal-content {
  max-width: 440px;
  max-height: 85vh;
}

.help-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.help-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 4px 8px;
  box-sizing: border-box;
}

.help-nav-arrow {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-nav-arrow:active {
  opacity: 0.6;
}

.help-nav-title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.help-nav-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.3px;
}

.help-dots {
  display: flex;
  gap: 5px;
}

.help-dot {
  width: 6px;
  height: 6px;
  background-color: #cbd5e1;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.help-dot.active {
  background-color: #0f172a;
  width: 14px;
}

.help-scroll-area {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 4px;
  max-height: 60vh;
}

.help-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-heading {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #eeeff3;
  padding-bottom: 4px;
}

.help-text {
  font-size: 0.86rem;
  line-height: 1.4;
  color: #334155;
}

.help-feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 4px 0;
}

.feature-item {
  background-color: #eeeff3;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feature-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
}

.feature-desc {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
}

.help-hint-rule {
  font-size: 0.8rem;
  color: #b91c1c;
  background-color: #fef2f2;
  padding: 8px 10px;
  line-height: 1.35;
}

.help-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 18px;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #334155;
}

.help-list li {
  margin-bottom: 2px;
}

/* ==========================================================================
   VERSUS MODE STYLES
   ========================================================================== */

/* Flat solid-color buzzers with no rounded corners or borders */
.versus-buzzer-btn {
  border: none;
  border-radius: 0;
  cursor: pointer;
  box-shadow: none;
  transition: opacity 0.1s ease, filter 0.1s ease, transform 0.08s ease;
  user-select: none;
  -webkit-user-select: none;
  padding: 0;
  outline: none;
}

.buzzer-blue {
  background-color: #2563eb;
}

.buzzer-red {
  background-color: #dc2626;
}

.versus-buzzer-btn:active:not(:disabled) {
  filter: brightness(0.85);
  transform: scale(0.98);
}

.versus-buzzer-btn.buzzer-active {
  box-shadow: inset 0 0 0 4px #ffffff, 0 0 16px rgba(255, 255, 255, 0.6);
  filter: brightness(1.2);
}

.versus-buzzer-btn.buzzer-locked {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Portrait Buzzer Pairs: split 50/50 horizontally */
.versus-buzzer-pair {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 52px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.versus-buzzer-pair .buzzer-half-left {
  flex: 1;
  height: 100%;
}

.versus-buzzer-pair .buzzer-half-right {
  flex: 1;
  height: 100%;
}

.game-screen.portrait .versus-buzzer-pair-top {
  margin-bottom: 0;
}

.game-screen.portrait .versus-buzzer-pair-bottom {
  margin-top: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Landscape Buzzers: on left and right sides of board */
.versus-buzzer-side {
  width: 64px;
  height: 100%;
  flex-shrink: 0;
}

.game-screen.landscape .versus-buzzer-left {
  border-right: 1px solid #e2e8f0;
}

.game-screen.landscape .versus-buzzer-right {
  border-left: 1px solid #e2e8f0;
  margin-right: env(safe-area-inset-right, 0px);
}

/* Team-colored card selections */
.card-tile.selected.selected-blue {
  background-color: #eff6ff !important;
  border: 3px solid #2563eb !important;
  box-shadow: 0 0 0 1px #2563eb, 0 4px 14px rgba(37, 99, 235, 0.35) !important;
}

.card-tile.selected.selected-red {
  background-color: #fef2f2 !important;
  border: 3px solid #dc2626 !important;
  box-shadow: 0 0 0 1px #dc2626, 0 4px 14px rgba(220, 38, 38, 0.35) !important;
}

/* GameBar Versus Badges */
.versus-team-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-weight: 800;
  font-size: 0.95rem;
  border-radius: 0;
  box-sizing: border-box;
}

.versus-team-badge.badge-blue {
  background-color: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.versus-team-badge.badge-red {
  background-color: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.team-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
}

.team-dot.dot-blue {
  background-color: #2563eb;
}

.team-dot.dot-red {
  background-color: #dc2626;
}

.game-bar-right-versus {
  display: flex;
  align-items: center;
}

.game-screen.landscape .game-bar-right-versus {
  width: 100%;
  justify-content: center;
}

.game-screen.landscape .versus-team-badge {
  width: 100%;
  justify-content: center;
  padding: 8px 6px;
}

.status-timer.versus-timer-blue {
  color: #2563eb !important;
  font-weight: 900;
}

.status-timer.versus-timer-red {
  color: #dc2626 !important;
  font-weight: 900;
}

/* Versus GameOver Modal */
.versus-winner-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  font-weight: 900;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  margin: 0 auto;
}

.versus-winner-badge.badge-blue {
  background-color: #2563eb;
  color: #ffffff;
}

.versus-winner-badge.badge-red {
  background-color: #dc2626;
  color: #ffffff;
}

.versus-winner-badge.badge-tie {
  background-color: #64748b;
  color: #ffffff;
}

.versus-final-score-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 0;
}

.versus-final-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.versus-team-title {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.col-blue .versus-team-title {
  color: #2563eb;
}

.col-red .versus-team-title {
  color: #dc2626;
}

.versus-score-number {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
}

.col-blue .versus-score-number {
  color: #1d4ed8;
}

.col-red .versus-score-number {
  color: #b91c1c;
}

.versus-score-unit {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 700;
}

.versus-score-dash {
  font-size: 2rem;
  font-weight: 900;
  color: #94a3b8;
}

/* ONLINE BUTTONS IN MENU */
.btn-online {
  background-color: #0d9488;
  color: #ffffff;
  border: none;
  font-weight: 800;
}

.btn-online:hover, .btn-online:active {
  background-color: #0f766e;
}

.btn-clash-online {
  background-color: #4f46e5;
  color: #ffffff;
  border: none;
  font-weight: 800;
}

.btn-clash-online:hover, .btn-clash-online:active {
  background-color: #4338ca;
}

.btn-race-online {
  background-color: #ea580c;
  color: #ffffff;
  border: none;
  font-weight: 800;
}

.btn-race-online:hover, .btn-race-online:active {
  background-color: #c2410c;
}

.btn-blitz-online {
  background-color: #d97706;
  color: #ffffff;
  border: none;
  font-weight: 800;
}

.btn-blitz-online:hover, .btn-blitz-online:active {
  background-color: #b45309;
}

/* ONLINE LOBBY MODAL */
.online-lobby-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.online-lobby-card {
  background: #ffffff;
  width: 100%;
  max-width: 380px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 2px solid #0f172a;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.online-lobby-header {
  text-align: center;
}

.online-lobby-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: #0f172a;
}

.online-lobby-subtitle {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 4px;
  line-height: 1.3;
}

.online-lobby-tabs {
  display: flex;
  width: 100%;
  border: 1px solid #cbd5e1;
}

.lobby-tab-btn {
  flex: 1;
  padding: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  background: #f1f5f9;
  border: none;
  color: #475569;
  cursor: pointer;
  text-align: center;
}

.lobby-tab-btn.active {
  background: #0f172a;
  color: #ffffff;
}

.online-lobby-body {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.room-code-display-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.room-code-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 1px;
}

.room-code-letters {
  display: flex;
  gap: 8px;
}

.code-letter-tile {
  width: 50px;
  height: 60px;
  background: #0f172a;
  color: #ffffff;
  font-size: 2rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0f172a;
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.15);
}

.btn-copy-code {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
}

.waiting-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: #64748b;
  font-size: 0.85rem;
}

.spinner-dots {
  display: flex;
  gap: 6px;
}

.spinner-dots span {
  width: 8px;
  height: 8px;
  background: #0f172a;
  display: inline-block;
  animation: pulse-dot 1.2s infinite ease-in-out both;
}

.spinner-dots span:nth-child(1) { animation-delay: -0.32s; }
.spinner-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes pulse-dot {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.join-input-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
}

.room-code-input {
  width: 200px;
  height: 52px;
  font-size: 1.8rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 6px;
  text-transform: uppercase;
  border: 2px solid #0f172a;
  color: #0f172a;
  background: #ffffff;
}

.btn-lobby-action {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  font-weight: 800;
}

.lobby-error-banner {
  margin-top: 10px;
  padding: 8px;
  background: #fef2f2;
  border: 1px solid #ef4444;
  color: #b91c1c;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}

.online-lobby-footer {
  margin-top: 8px;
}

.online-lobby-footer .btn {
  width: 100%;
}

/* RACE MODE BADGE */
.race-opponent-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffedd5;
  border: 1px solid #f97316;
  padding: 4px 10px;
  font-weight: 800;
  color: #c2410c;
  font-size: 0.85rem;
  box-sizing: border-box;
}

.game-screen.landscape .race-opponent-badge {
  width: 100%;
  justify-content: center;
  padding: 8px 6px;
  font-size: 0.85rem;
}

.race-final-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.rematch-banner {
  background: #eff6ff;
  border: 1px solid #3b82f6;
  color: #1d4ed8;
  padding: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 12px;
}

.online-reconnecting-banner {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #ea580c;
  color: #ffffff;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 0.85rem;
  z-index: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.blitz-opponent-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fef3c7;
  border: 1px solid #d97706;
  padding: 4px 10px;
  font-weight: 800;
  color: #92400e;
  font-size: 0.85rem;
  box-sizing: border-box;
}

.blitz-opponent-badge .opponent-sets-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.game-screen.landscape .blitz-opponent-badge {
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  font-size: 0.82rem;
}

.game-screen.landscape .blitz-opponent-badge .opponent-divider {
  display: none;
}

.game-screen.landscape .blitz-opponent-badge .opponent-time {
  font-size: 0.95rem;
  font-weight: 900;
}

.opponent-divider {
  color: #d97706;
}

.opponent-time {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.opponent-time-low {
  color: #dc2626;
  animation: pulse-low 0.8s infinite alternate;
}

@keyframes pulse-low {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.6; transform: scale(0.96); }
}


