:root {
  /* الألوان الأساسية */
  --bg: #050510;
  --bg-2: #0a0a1a;
  --surface: rgba(26, 26, 53, 0.8);
  --surface-solid: #1a1a35;
  --surface-light: rgba(255, 255, 255, 0.05);
  --text: #ffffff;
  --text-muted: #8888aa;
  --text-dim: #555577;
  
  /* ألوان اللعبة */
  --green: #22c55e;
  --green-glow: rgba(34, 197, 94, 0.6);
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.6);
  --blue: #3b82f6;
  --blue-glow: rgba(59, 130, 246, 0.6);
  --yellow: #eab308;
  --yellow-glow: rgba(234, 179, 8, 0.6);
  
  /* ألوان مميزة */
  --primary: #a855f7;
  --primary-2: #ec4899;
  --primary-glow: rgba(168, 85, 247, 0.5);
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  /* التصميم */
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;
  --radius-full: 9999px;
  
  /* الظلال */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--primary-glow);
  
  /* الحركات */
  --ease: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --transition-fast: 0.15s var(--ease);
  --transition: 0.3s var(--ease);
  --transition-slow: 0.5s var(--ease);
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Container */
.app {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  overflow: hidden;
  isolation: isolate;
}

/* Background Animation */
.bg-animation {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, #1a1a3e 0%, var(--bg) 70%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: orbFloat 20s ease-in-out infinite;
}

.orb--1 {
  width: 300px;
  height: 300px;
  background: var(--primary);
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.orb--2 {
  width: 250px;
  height: 250px;
  background: var(--primary-2);
  bottom: -80px;
  left: -80px;
  animation-delay: -7s;
}

.orb--3 {
  width: 200px;
  height: 200px;
  background: var(--accent);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -30px) scale(1.1); }
  50% { transform: translate(-20px, 20px) scale(0.9); }
  75% { transform: translate(20px, 30px) scale(1.05); }
}

/* Screens */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: flex;
  animation: screenEnter 0.5s var(--ease-out);
}

@keyframes screenEnter {
  from { opacity: 0; transform: translateY(30px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Start Screen */
.screen--start {
  justify-content: center;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.start-header {
  margin-bottom: 8px;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.logo__icon-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo__glow {
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  animation: logoGlow 3s ease-in-out infinite;
}

@keyframes logoGlow {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

.logo__icon {
  font-size: 72px;
  animation: logoFloat 4s ease-in-out infinite;
  filter: drop-shadow(0 0 30px var(--primary-glow));
  z-index: 1;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-12px) rotate(5deg); }
}

.logo__title {
  font-size: clamp(32px, 10vw, 48px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -2px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.logo__title span {
  background: linear-gradient(135deg, #a855f7 0%, #ec4899 50%, #f59e0b 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.logo__subtitle {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 1px;
}

/* Stats Row */
.stats-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 400px;
}

.stat-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
  transition: all var(--transition);
}

.stat-card:active {
  transform: scale(0.97);
}

.stat-card__icon {
  font-size: 20px;
}

.stat-card__value {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-card__label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Play Button */
.btn--play {
  max-width: 340px;
  padding: 20px 32px;
  font-size: 19px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 
    0 8px 32px var(--primary-glow),
    inset 0 1px 0 rgba(255,255,255,0.2);
  position: relative;
  overflow: hidden;
  animation: playPulse 2s ease-in-out infinite;
}

@keyframes playPulse {
  0%, 100% { box-shadow: 0 8px 32px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,0.2); }
  50% { box-shadow: 0 8px 48px var(--primary-glow), 0 0 80px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,0.2); }
}

.btn__glow {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: btnShine 3s ease-in-out infinite;
}

@keyframes btnShine {
  0% { left: -100%; }
  50%, 100% { left: 100%; }
}

.btn__icon {
  font-size: 18px;
}

/* Modes Section */
.modes-section {
  width: 100%;
  max-width: 400px;
}

.section-title {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}

.modes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

.mode-btn__icon {
  font-size: 20px;
  transition: transform var(--transition);
}

.mode-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.mode-btn.active .mode-btn__icon {
  transform: scale(1.1);
}

/* Bottom Nav */
.bottom-nav {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 400px;
  margin-top: auto;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

.nav-btn span:first-child {
  font-size: 20px;
}

.nav-btn:active {
  transform: scale(0.96);
  background: var(--surface-solid);
}

/* Game Screen */
.screen--game {
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn:active {
  transform: scale(0.9);
  background: var(--surface-solid);
}

.level-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 20px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
}

.level-display__label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.level-display__value {
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}

.game-stats {
  display: flex;
  gap: 8px;
}

.game-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 14px;
  font-weight: 700;
}

.game-stat__icon {
  font-size: 14px;
}

/* Combo Display */
.combo-display {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--warning), var(--danger));
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.5);
  transition: transform 0.3s var(--ease);
  z-index: 10;
}

.combo-display.show {
  transform: translateX(-50%) scale(1);
  animation: comboPop 0.5s var(--ease);
}

@keyframes comboPop {
  0% { transform: translateX(-50%) scale(0); }
  50% { transform: translateX(-50%) scale(1.2); }
  100% { transform: translateX(-50%) scale(1); }
}

.combo-display__text {
  font-size: 10px;
  opacity: 0.8;
}

/* Status Bar */
.status-bar {
  display: flex;
  justify-content: center;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
}

.status__icon {
  font-size: 16px;
}

.status.watching {
  border-color: var(--yellow);
  box-shadow: 0 0 20px rgba(234, 179, 8, 0.3);
}

.status.watching .status__text {
  color: var(--yellow);
}

.status.your-turn {
  border-color: var(--green);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
  animation: statusPulse 1s ease-in-out infinite;
}

.status.your-turn .status__text {
  color: var(--green);
}

@keyframes statusPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.status.correct {
  border-color: var(--success);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
}

.status.correct .status__text {
  color: var(--success);
}

.status.wrong {
  border-color: var(--danger);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

.status.wrong .status__text {
  color: var(--danger);
}

/* Board */
.board-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
}

.board-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.board-glow.active {
  opacity: 0.5;
  animation: boardGlowPulse 1s ease-in-out infinite;
}

@keyframes boardGlowPulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.1); opacity: 0.6; }
}

.board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: min(380px, 90vw);
  aspect-ratio: 1;
}

/* Pads */
.pad {
  position: relative;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform 0.1s var(--ease), filter 0.15s, box-shadow 0.2s;
  outline: none;
  overflow: hidden;
  filter: brightness(0.5) saturate(0.7);
  box-shadow: 
    inset 0 -6px 0 rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.1);
}

.pad__inner {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(145deg, rgba(255,255,255,0.1), transparent 60%);
}

.pad__shine {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.1) 50%, transparent 60%);
  transform: rotate(45deg) translateX(-100%);
  transition: transform 0.6s;
}

.pad--green  { background: var(--green); }
.pad--red    { background: var(--red); }
.pad--blue   { background: var(--blue); }
.pad--yellow { background: var(--yellow); }

.pad.active {
  filter: brightness(1.5) saturate(1.3);
  transform: scale(1.03);
  box-shadow: 
    inset 0 -6px 0 rgba(0,0,0,0.15),
    inset 0 1px 0 rgba(255,255,255,0.3),
    0 0 40px currentColor,
    0 0 80px currentColor,
    0 0 120px currentColor;
}

.pad.active .pad__shine {
  transform: rotate(45deg) translateX(100%);
}

.pad--green.active  { color: var(--green); }
.pad--red.active    { color: var(--red); }
.pad--blue.active   { color: var(--blue); }
.pad--yellow.active { color: var(--yellow); }

.pad:disabled {
  cursor: not-allowed;
}

/* Progress */
.progress-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress {
  position: relative;
  height: 8px;
  background: var(--surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  border-radius: var(--radius-full);
  transition: width 0.3s var(--ease);
  position: relative;
}

.progress__glow {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  border-radius: var(--radius-full);
  transition: width 0.3s var(--ease);
}

.progress-text {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Game Over Screen */
.screen--over {
  justify-content: center;
  align-items: center;
}

.over-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding: 32px 24px;
  background: var(--surface);
  backdrop-filter: blur(40px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: cardEnter 0.6s var(--ease);
  overflow: hidden;
}

@keyframes cardEnter {
  from { opacity: 0; transform: scale(0.8) translateY(30px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.over-card__confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.over-card__header {
  position: relative;
  margin-bottom: 16px;
}

.over-card__emoji {
  font-size: 72px;
  animation: emojiBounce 1s var(--ease);
  position: relative;
  z-index: 1;
}

@keyframes emojiBounce {
  0% { transform: scale(0) rotate(-30deg); }
  50% { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1) rotate(0); }
}

.over-card__glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.2); }
}

.over-card__title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 20px;
}

.over-card__score {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.score-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: var(--surface-light);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.06);
}

.score-item__label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.score-item__value {
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}

.score-item--best .score-item__value {
  background: linear-gradient(135deg, var(--warning), var(--danger));
  -webkit-background-clip: text;
  background-clip: text;
}

.over-card__rank {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: var(--radius-full);
  margin-bottom: 20px;
}

.rank-badge {
  font-size: 20px;
}

.rank-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--warning);
}

.over-card__new-record {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.2));
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: var(--radius-full);
  margin-bottom: 20px;
  animation: recordPulse 1s ease-in-out infinite;
}

@keyframes recordPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.over-card__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s;
  color: white;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.96);
}

.btn--primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 24px var(--primary-glow);
}

.btn--ghost {
  background: var(--surface-light);
  border: 1px solid rgba(255,255,255,0.1);
}

.btn--reward {
  background: linear-gradient(135deg, var(--warning), var(--danger));
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
}

.btn--danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
  margin-top: 20px;
}

/* Achievements Screen */
.screen--achievements,
.screen--settings {
  gap: 20px;
}

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.screen-header h2 {
  font-size: 20px;
  font-weight: 800;
}

.achievements-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* Settings */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
}

.setting-item__info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.setting-item__icon {
  font-size: 20px;
}

.setting-item__label {
  font-size: 15px;
  font-weight: 600;
}

.toggle {
  position: relative;
  width: 52px;
  height: 30px;
  background: var(--surface-light);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
}

.toggle[data-enabled="true"] {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
}

.toggle__knob {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  transition: all var(--transition);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.toggle[data-enabled="false"] .toggle__knob {
  right: calc(100% - 25px);
}

/* Overlay */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 16, 0.95);
  backdrop-filter: blur(20px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.overlay.active {
  display: flex;
}

.overlay__content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay__text {
  font-size: 140px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: countdownPop 0.7s var(--ease);
}

@keyframes countdownPop {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.overlay__ring {
  position: absolute;
  width: 200px;
  height: 200px;
  border: 3px solid var(--primary);
  border-radius: 50%;
  animation: ringExpand 1s ease-out infinite;
}

@keyframes ringExpand {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* Toast */
.toast-container {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  background: var(--surface-solid);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.4s var(--ease);
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Achievement Popup */
.achievement-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 28px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.95), rgba(236, 72, 153, 0.95));
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(168, 85, 247, 0.5);
  z-index: 300;
  transition: transform 0.5s var(--ease);
}

.achievement-popup.show {
  transform: translate(-50%, -50%) scale(1);
}

.achievement-popup__icon {
  font-size: 48px;
  animation: achievementIcon 0.6s var(--ease);
}

@keyframes achievementIcon {
  0% { transform: scale(0) rotate(-180deg); }
  100% { transform: scale(1) rotate(0); }
}

.achievement-popup__title {
  font-size: 12px;
  opacity: 0.8;
  font-weight: 600;
}

.achievement-popup__name {
  font-size: 18px;
  font-weight: 800;
}

/* Particle Canvas */
.particle-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* Responsive */
@media (max-height: 700px) {
  .screen--start { gap: 16px; }
  .logo__icon { font-size: 56px; }
  .logo__icon-wrapper { width: 80px; height: 80px; }
  .logo__title { font-size: 28px; }
  .stat-card { padding: 10px 6px; }
  .stat-card__value { font-size: 18px; }
  .board { max-width: 300px; }
  .over-card { padding: 24px 20px; }
  .over-card__emoji { font-size: 56px; }
}

@media (max-height: 600px) {
  .screen--start { gap: 12px; }
  .stats-row { display: none; }
  .board { max-width: 260px; }
}