:root {
  --bg: #050505;
  --board-bg: #111116;
  --cell-empty: #1a1a24;
  --text: #f8fafc;
  --accent: #00f0ff;
  --game-field-width: 380px;
  --game-field-height: 640px;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

::selection {
  background: transparent !important;
  color: inherit !important;
}

::-moz-selection {
  background: transparent !important;
  color: inherit !important;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  perspective: 1200px;
  transition: background-color 0.8s ease;
}

.game-cabinet {
  position: relative;
  width: var(--game-field-width, 380px);
  max-width: 420px;
  background: var(--board-bg);
  border-radius: 20px;
  padding: 10px 10px 8px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  transform-style: preserve-3d;
  transition: background-color 0.8s ease;
}


/* Splashscreen / Startscreen - schirmt Updates und Reloads nahtlos ab */
#update-curtain {
  position: fixed;
  inset: 0;
  z-index: 9999999;
  background: var(--bg, #050505);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 1;
  pointer-events: all;
  transition: opacity 0.28s ease-out;
}

#update-curtain.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

#update-curtain.active,
html.is-updating #update-curtain {
  opacity: 1 !important;
  pointer-events: all !important;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  user-select: none;
  -webkit-user-select: none;
}

.splash-logo {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8), 0 0 24px rgba(0, 240, 255, 0.25);
  display: block;
}

.splash-title {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #f8fafc;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8), 0 0 24px rgba(0, 240, 255, 0.35);
}

/* ==========================================
   TOP BAR (BURGER MENU & TITLE)
   ========================================== */
#game-title-bar {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  margin-bottom: 2px;
  padding: 0;
  height: 48px;
  box-sizing: border-box;
  cursor: pointer;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

.burger-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  background: var(--board-bg);
  border: 1px solid rgba(255, 0, 60, 0.25);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  z-index: 30;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  padding: 0;
}

.burger-btn:hover {
  border-color: rgba(255, 0, 60, 0.5);
  box-shadow: 0 0 12px rgba(255, 0, 60, 0.25);
}

.burger-btn:active {
  transform: translateY(-50%) scale(0.94);
}

.burger-btn .burger-line {
  display: block;
  width: 20px;
  height: 2.2px;
  background: #ff3366;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease, background 0.2s ease;
}

.burger-btn:hover .burger-line {
  background: #ff003c;
}

/* Morph to X when open */
.burger-btn.open .burger-line:nth-child(1) {
  transform: translateY(7.2px) rotate(45deg);
  background: #ff3366;
}

.burger-btn.open .burger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.burger-btn.open .burger-line:nth-child(3) {
  transform: translateY(-7.2px) rotate(-45deg);
  background: #ff3366;
}

.game-title-wrap {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding-left: 28px; /* Titel harmonisch nach rechts rücken, gleicht Burger-Button links optisch aus */
  box-sizing: border-box;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

#title-canvas {
  display: block;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6));
  cursor: pointer;
  touch-action: manipulation;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
  transition: transform 0.15s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.2s ease;
}

/* Hide title canvas completely while menu is open to prevent any shine-through */
#btn-burger.open ~ #game-title #title-canvas,
#game-title-bar.menu-open #title-canvas {
  opacity: 0 !important;
  pointer-events: none;
  transform: scale(0.92);
}

/* Slide-out Menu covering the title */
.burger-slide-menu {
  position: absolute;
  left: 50px;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 52px;
  display: none;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  z-index: 25;
  padding: 0 8px;
  box-sizing: border-box;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.85);
  
  /* Slide out to right animation with bleed room for shadows and hover borders */
  clip-path: inset(-8px 100% -8px 0 round 14px);
  opacity: 0;
  pointer-events: none;
  transition: clip-path 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
}

.burger-slide-menu.open {
  display: flex;
  clip-path: inset(-8px -8px -8px 0 round 14px);
  opacity: 1;
  pointer-events: auto;
}

.burger-slide-menu .icon-btn {
  background: var(--board-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  width: clamp(38px, 10.5vw, 44px);
  height: clamp(38px, 10.5vw, 44px);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.burger-slide-menu .icon-btn svg {
  display: block;
  stroke: currentColor;
  width: 22px;
  height: 22px;
  transition: transform 0.2s ease;
}

.burger-slide-menu .icon-btn:hover {
  color: #00f0ff;
  border-color: rgba(0, 240, 255, 0.6);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
  transform: translateY(-1px) scale(1.04);
}

.burger-slide-menu .icon-btn:active {
  transform: scale(0.95);
}

/* ==========================================
   HEADER ROW (INTEGRIERTE SCORE & HIGHSCORE)
   ========================================== */
#header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px 2px;
  gap: 12px;
  box-sizing: border-box;
}

.score-box {
  flex: 1;
  background: transparent;
  height: auto;
  padding: 2px 4px;
  border-radius: 0;
  text-align: center;
  box-shadow: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: none;
}

.score-box:hover {
  box-shadow: none;
}

.score-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #94a3b8;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 2px;
}

.score-label.gold {
  color: #fbbf24;
  opacity: 0.88;
}

.score-val {
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

#best.score-val {
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
}

@media (max-width: 380px) {
  #game-title-bar {
    height: 46px;
  }
  .burger-btn {
    left: 0;
    width: 38px;
    height: 38px;
  }
  .burger-slide-menu {
    left: 46px;
    right: 0;
    height: 48px;
    padding: 0 4px;
    clip-path: inset(-6px 100% -6px 0 round 12px);
  }
  .burger-slide-menu.open {
    clip-path: inset(-6px -6px -6px 0 round 12px);
  }
  #header {
    padding: 2px 4px 1px;
    gap: 8px;
  }
}

.icon-btn.off {
  opacity: 0.3;
}

#badges-container {
  display: flex;
  gap: 6px;
  margin-top: 2px;
  margin-bottom: 2px;
}

.info-badge {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Rival Tracker Banner (Mobile: Top 3 / PC: Top 6) */
.rival-tracker {
  width: 100%;
  padding: 0;
  margin: 3px 0 4px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
}

.rival-card {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 5px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  min-height: 84px;
  box-sizing: border-box;
}

.rival-card:hover {
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.rival-card:active {
  transform: scale(0.99);
}

.rival-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  line-height: 1.25;
  padding: 3px 6px;
  border-radius: 6px;
  border: none;
  background: transparent;
}

.rival-row.closest {
  background: transparent;
  border: none;
}

.rival-row.me {
  background: rgba(0, 240, 255, 0.08);
  border: 1.5px solid #00f0ff;
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.25), inset 0 0 6px rgba(0, 240, 255, 0.12);
}

.rival-row.gold-leader {
  background: transparent;
  border: none;
}

.rival-rank {
  font-weight: 800;
  width: 28px;
  min-width: 28px;
  font-size: 13px;
  text-align: left;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.rival-rank.rank-1 { color: #fbbf24; text-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }
.rival-rank.rank-2 { color: #e2e8f0; text-shadow: 0 0 8px rgba(226, 232, 240, 0.35); }
.rival-rank.rank-3 { color: #cd7f32; text-shadow: 0 0 8px rgba(205, 127, 50, 0.35); }
.rival-rank.rank-other { color: #64748b; }

.rival-row.podium-1 .rival-score { color: #fbbf24; text-shadow: 0 0 6px rgba(251, 191, 36, 0.25); }
.rival-row.podium-2 .rival-score { color: #e2e8f0; text-shadow: 0 0 6px rgba(226, 232, 240, 0.2); }
.rival-row.podium-3 .rival-score { color: #cd7f32; text-shadow: 0 0 6px rgba(205, 127, 50, 0.2); }

.rival-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  flex: 1 1 auto;
}

.rival-name {
  font-weight: 700;
  font-size: 13px;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
}

.rival-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
  min-width: 75px;
  flex-shrink: 0;
}

.rival-score {
  font-weight: 800;
  color: #fbbf24;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  text-align: right;
  width: 100%;
}

.rival-diff {
  color: #94a3b8;
  font-size: 10px;
  white-space: nowrap;
}

.info-version-tag {
  font-size: 11px;
  font-weight: 700;
  color: #00f0ff;
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 999px;
  padding: 2px 8px;
}

.info-card {
  padding: 20px;
}

#btn-info-done {
  flex-shrink: 0;
  margin-top: 14px;
}

#legal-content,
#help-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.3) transparent;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y !important;
}

#legal-content,
#legal-content *,
#help-content,
#help-content * {
  touch-action: pan-y !important;
}

#legal-content::-webkit-scrollbar,
#help-content::-webkit-scrollbar {
  width: 5px;
}

#legal-content::-webkit-scrollbar-track,
#help-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}

#legal-content::-webkit-scrollbar-thumb,
#help-content::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.3);
  border-radius: 4px;
}

#legal-content::-webkit-scrollbar-thumb:hover,
#help-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 240, 255, 0.55);
}


#game-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  margin-top: 4px;
  flex-grow: 1;
  width: 100%;
}

canvas {
  border-radius: 8px;
}

#canvas {
  box-shadow: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 5, 0.92);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(8px);
  padding: 10px;
  touch-action: pan-y;
  box-sizing: border-box;
}

.modal-card {
  background: #111827;
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 16px;
  padding: 20px;
  width: var(--game-field-width, 380px) !important;
  max-width: 420px !important;
  height: var(--game-field-height, 640px) !important;
  max-height: 96vh !important;
  color: #cbd5e1;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(0, 240, 255, 0.12);
}

.modal-card h3 {
  margin-top: 0;
  color: #38bdf8;
}

.modal-card p,
.modal-card li {
  font-size: 12px;
  line-height: 1.5;
}

.lang-switcher {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.lang-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f8fafc;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
}

.lang-btn.active {
  background: #0284c7;
  border-color: #38bdf8;
}

button.primary-btn {
  background: linear-gradient(135deg, #0284c7, #00f0ff);
  color: #050505;
  border: none;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 800;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 240, 255, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

button.primary-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(0, 240, 255, 0.6);
}

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

button.whatsapp-btn {
  background: rgba(37, 211, 102, 0.12);
  color: #25D366;
  border: 1px solid rgba(37, 211, 102, 0.4);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, background 0.2s ease;
}

button.whatsapp-btn:hover {
  background: rgba(37, 211, 102, 0.22);
  border-color: rgba(37, 211, 102, 0.8);
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35);
  color: #4ade80;
}

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

button.gameover-leaderboard-btn {
  width: 100%;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--board-bg);
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: #00f0ff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, background 0.2s ease;
}

button.gameover-leaderboard-btn:hover {
  background: rgba(0, 240, 255, 0.12);
  border-color: rgba(0, 240, 255, 0.7);
  box-shadow: 0 4px 16px rgba(0, 240, 255, 0.3);
}

button.gameover-leaderboard-btn:active {
  transform: scale(0.96);
}

/* ==========================================
   GAME OVER MODAL & 3 SCORES PANEL
   ========================================== */
.modal-overlay.fade-in {
  animation: modalFadeIn 0.5s ease forwards;
}

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

.modal-card.pop-in {
  animation: cardPopIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardPopIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.gameover-card {
  box-sizing: border-box;
  text-align: center;
  padding: 22px 18px;
  background: #111827;
  border: 1px solid rgba(0, 240, 255, 0.25);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(0, 240, 255, 0.12);
  border-radius: 16px;
  justify-content: center;
  align-items: stretch;
  overflow-y: auto;
}

.gameover-scores-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 14px 12px;
  margin-bottom: 16px;
}

.gameover-primary-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gameover-score-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.gameover-score-value {
  font-size: 34px;
  font-weight: 900;
  color: #00f0ff;
  line-height: 1.1;
  margin: 3px 0;
  text-shadow: 0 0 16px rgba(0, 240, 255, 0.35);
  font-variant-numeric: tabular-nums;
}

.gameover-badge-new-record {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
  margin-top: 3px;
  transition: all 0.2s ease;
}

.gameover-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 12px 2px;
}

.gameover-sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.gameover-stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 9px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.gameover-stat-box.clickable {
  cursor: pointer;
}

.gameover-stat-box.clickable:hover {
  background: rgba(0, 240, 255, 0.06);
  border-color: rgba(0, 240, 255, 0.35);
  transform: translateY(-1px);
}

.gameover-stat-label {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.gameover-stat-number {
  font-size: 19px;
  font-weight: 800;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.gameover-stat-number.personal {
  color: #fbbf24;
}

.gameover-stat-number.game-record {
  color: #a78bfa;
}

.gameover-stat-holder {
  font-size: 10px;
  color: #cbd5e1;
  margin-top: 2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================
   SETTINGS MODAL & SWITCHES
   ========================================== */
.settings-card {
  padding: 20px;
  background: #111827;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.25);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
  flex-shrink: 0;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-size: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.settings-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y !important;
}

.settings-content,
.settings-content * {
  touch-action: pan-y !important;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.setting-row.column {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.setting-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.setting-icon {
  font-size: 22px;
  width: 28px;
  text-align: center;
}

.setting-title {
  font-size: 14px;
  font-weight: 600;
  color: #f8fafc;
}

.setting-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

/* Settings Select Dropdown */
.settings-select {
  background: #1e293b;
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 8px;
  color: #f8fafc;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  max-width: 175px;
}

.settings-select:focus {
  border-color: #00f0ff;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.settings-select option {
  background: #0f172a;
  color: #f8fafc;
}

/* Switch Toggle Button */
.toggle-switch-btn {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  width: 50px;
  height: 28px;
  position: relative;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s;
  padding: 0;
  flex-shrink: 0;
}

.toggle-switch-btn .slider {
  position: absolute;
  top: 2px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #64748b;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.toggle-switch-btn.active {
  background: rgba(0, 240, 255, 0.2);
  border-color: #00f0ff;
}

.toggle-switch-btn.active .slider {
  transform: translateX(22px);
  background: #00f0ff;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.7);
}

.disabled-toggle {
  cursor: not-allowed !important;
  opacity: 0.6 !important;
}

/* Slider range styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: #1e293b;
  height: 8px;
  border-radius: 4px;
  outline: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin: 8px 0;
  touch-action: pan-x;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #00f0ff;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
  border: 2px solid #ffffff;
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #00f0ff;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
  border: 2px solid #ffffff;
  transition: transform 0.15s ease;
}

/* Grid Size Selector */
.grid-size-options {
  display: flex;
  width: 100%;
  gap: 6px;
  justify-content: space-between;
}

.grid-size-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.grid-size-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.grid-size-btn.active {
  background: #0284c7;
  border-color: #00f0ff;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

/* Confirm Modal */
.confirm-card {
  text-align: center;
  padding: 24px 20px;
  background: #111827;
  border: 1px solid rgba(255, 0, 60, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(255, 0, 60, 0.2);
  justify-content: center;
  align-items: center;
}

.confirm-icon {
  font-size: 32px;
  margin-bottom: 10px;
}

.confirm-msg {
  font-size: 15px;
  font-weight: 600;
  color: #f8fafc;
  margin: 0 0 20px 0;
  line-height: 1.4;
}

.confirm-btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-btn {
  flex: 1;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  background: var(--board-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

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

.confirm-btn.yes {
  background: var(--board-bg);
  border: 1px solid rgba(255, 0, 60, 0.4);
  color: #ff3366;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

.confirm-btn.yes:hover {
  color: #ff003c;
  border-color: rgba(255, 0, 60, 0.8);
  box-shadow: 0 4px 14px rgba(255, 0, 60, 0.35);
}

/* Session Transfer Modal */
.session-card {
  text-align: center;
  padding: 24px 20px;
  background: #111827;
  border: 1px solid rgba(0, 240, 255, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(0, 240, 255, 0.2);
  justify-content: center;
  align-items: center;
}

.confirm-btn.no {
  background: var(--board-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

.confirm-btn.no:hover {
  color: #00f0ff;
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 4px 14px rgba(0, 240, 255, 0.25);
}

/* Universal Cyber Modal Button */
.modal-btn {
  background: var(--board-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 9px 28px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-btn:hover {
  color: #00f0ff;
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 4px 14px rgba(0, 240, 255, 0.25);
}

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

/* Leaderboard Modal */
.leaderboard-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: #111827;
  border: 1px solid rgba(0, 240, 255, 0.3);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(0, 240, 255, 0.15);
  box-sizing: border-box;
  overflow: hidden;
  touch-action: pan-y;
}

.user-profile-box {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
}

.username-input-row {
  display: flex;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
}

.username-input {
  width: 100%;
  height: 42px;
  min-height: 42px;
  box-sizing: border-box;
  background: #050505;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  touch-action: auto;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.username-input-row .username-input {
  flex: 1 1 0;
  min-width: 0;
}

.username-input:focus {
  border-color: #00f0ff;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.btn-save-username {
  flex-shrink: 0;
  height: 42px;
  padding: 0 20px !important;
  font-size: 14px !important;
  white-space: nowrap;
  border-radius: 8px !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Auth Tabs & Forms */
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.auth-tab {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-tab.active {
  background: rgba(0, 240, 255, 0.2);
  border-color: #00f0ff;
  color: #00f0ff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.auth-form .username-input {
  width: 100%;
  height: 42px;
}

.auth-btn-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.auth-logout-btn {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  margin-top: 4px;
}

.auth-logout-btn:hover {
  color: #f87171;
}

.settings-action-btn {
  background: var(--board-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.settings-action-btn:hover {
  color: #00f0ff;
  border-color: rgba(0, 240, 255, 0.4);
}

.settings-action-btn.danger {
  color: #ff3366;
  border-color: rgba(255, 0, 60, 0.35);
}

.settings-action-btn.danger:hover {
  color: #ff003c;
  border-color: rgba(255, 0, 60, 0.7);
  box-shadow: 0 2px 8px rgba(255, 0, 60, 0.3);
}

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

.leaderboard-list {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 4px 2px 0;
  margin: 0 0 6px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.35) transparent;
}

.leaderboard-list::-webkit-scrollbar {
  width: 5px;
}

.leaderboard-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.35);
  border-radius: 4px;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 240, 255, 0.6);
}

.leaderboard-list,
.leaderboard-list * {
  touch-action: pan-y !important;
}

/* Account Modal */
.account-card {
  box-sizing: border-box;
  padding: 20px;
  background: #111827;
  border: 1px solid rgba(0, 240, 255, 0.25);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(0, 240, 255, 0.12);
  border-radius: 16px;
  touch-action: pan-y;
}

#account-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: pan-y !important;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}

#account-modal-body,
#account-modal-body * {
  touch-action: pan-y !important;
}

#btn-account-done {
  flex-shrink: 0;
  margin-top: auto;
}

.leaderboard-row {
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  touch-action: pan-y !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.leaderboard-row.me {
  background: rgba(0, 240, 255, 0.06);
  border: 2px solid #00f0ff;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.35), inset 0 0 8px rgba(0, 240, 255, 0.15);
}

.leaderboard-rank {
  font-weight: 800;
  width: 32px;
  min-width: 32px;
  font-size: 13px;
  text-align: left;
}

.leaderboard-rank.rank-1 { color: #fbbf24; }
.leaderboard-rank.rank-2 { color: #cbd5e1; }
.leaderboard-rank.rank-3 { color: #d97706; }
.leaderboard-rank.rank-other { color: #64748b; }

.leaderboard-name-col {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
}

.status-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-badge.live {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #4ade80;
}

.status-badge.final {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #94a3b8;
  font-size: 8.5px;
}

.live-exclamation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
  color: #ff3366;
  text-shadow: 0 0 6px rgba(255, 51, 102, 0.6);
  user-select: none;
  cursor: default;
  margin-right: 4px;
}

.online-status-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.online-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.online-status-dot.glowing {
  box-shadow: 0 0 7px currentColor;
}

.online-status-dot.dimmed {
  box-shadow: none;
  opacity: 0.85;
}

.online-status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  letter-spacing: 0.2px;
  line-height: 1.2;
  white-space: nowrap;
  user-select: none;
  transition: all 0.25s ease;
}

.online-status-badge.glowing {
  box-shadow: 0 0 6px currentColor;
}

.online-status-badge.mini {
  font-size: 9px;
  padding: 0 4px;
}

.leaderboard-name {
  min-width: 0;
  font-weight: 600;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  font-weight: 800;
  color: #fbbf24;
  font-size: 14px;
  min-width: 60px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ==========================================
   ORIENTATION WARNING (MOBILE LANDSCAPE BLOCK)
   ========================================== */
#orientation-curtain {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999999;
  background: #050505;
  color: #f8fafc;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  box-sizing: border-box;
}

.orientation-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: 320px;
}

.orientation-icon {
  font-size: 48px;
  animation: phoneRotate 2.2s ease-in-out infinite;
}

@keyframes phoneRotate {
  0%, 20% { transform: rotate(-90deg); }
  50%, 70% { transform: rotate(0deg); }
  100% { transform: rotate(-90deg); }
}

.orientation-title {
  color: #00f0ff;
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.5px;
}

.orientation-text {
  color: #94a3b8;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

/* Aktiviert bei Mobilgeräten im Querformat (Höhe <= 550px und Querformat) */
@media screen and (orientation: landscape) and (max-height: 550px) and (hover: none) and (pointer: coarse) {
  #orientation-curtain {
    display: flex !important;
  }
}

