/* משתנים גלובליים - Light Mode (ברירת מחדל) */
:root {
  --bg: #d5dde8;
  --bg-secondary: #c8d2df;
  --bg-tertiary: #bcc7d6;
  --panel: rgba(255, 255, 255, 0.93);
  --panel-light: rgba(240, 244, 250, 0.95);
  --text: #1a202c;
  --text-muted: #2d3748;
  --accent: #0055dd;
  --accent-light: #0066ff;
  --accent-glow: #1a8fee;
  --accent-dark: #003faa;
  --success: #059669;
  --success-light: #10b981;
  --danger: #dc2626;
  --danger-light: #ef4444;
  --warning: #d97706;
  --warning-light: #f59e0b;
  --shadow: rgba(0, 0, 0, 0.22);
  --glow-purple: rgba(0, 85, 221, 0.45);
  --glow-green: rgba(5, 150, 105, 0.35);
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(0, 85, 221, 0.25);
  --stars-opacity: 0.3;
  --gradient-start: rgba(0, 85, 221, 0.18);
  --gradient-mid: rgba(0, 102, 255, 0.15);
  --gradient-end: rgba(0, 130, 238, 0.12);
  
  /* משתנה גובה אפליקציה למובייל */
  --app-height: 100vh;
}

/* Dark Mode */
:root[data-theme="dark"], body.dark-mode {
  --bg: #0a0a15;
  --bg-secondary: #121226;
  --bg-tertiary: #1a1a32;
  --panel: rgba(25, 28, 55, 0.85);
  --panel-light: rgba(35, 38, 70, 0.9);
  --text: #ffffff;
  --text-muted: #b4b8d4;
  --accent: #1a9fff;
  --accent-light: #0080ff;
  --accent-glow: #66d9ff;
  --accent-dark: #0066ff;
  --success: #10b981;
  --success-light: #34d399;
  --danger: #ef4444;
  --danger-light: #f87171;
  --warning: #f59e0b;
  --warning-light: #fbbf24;
  --shadow: rgba(0, 0, 0, 0.7);
  --glow-purple: rgba(26, 159, 255, 0.6);
  --glow-green: rgba(16, 185, 129, 0.5);
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.15);
  --stars-opacity: 1;
  --gradient-start: rgba(26, 159, 255, 0.35);
  --gradient-mid: rgba(0, 128, 255, 0.3);
  --gradient-end: rgba(0, 150, 255, 0.2);
}

/* איפוס ובסיס */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* מניעת הגדלת טקסט אוטומטית במובייל */
  -webkit-text-size-adjust: 100%; 
}

html, body {
  height: 100%;
  height: var(--app-height);
  overflow: hidden; /* נועל גלילה לחלוטין ברמת ה-body */
  position: fixed;
  width: 100%;
  margin: 0;
  padding: 0;
  overscroll-behavior: none; /* מונע "קפיצות" גלילה */
}

body {
  font-family: 'Rubik', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* נגישות - סימון מיקוד למקלדת */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(26, 159, 255, 0.3);
}

/* הסרת outline כשלא צריך */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* Enhanced focus for keyboard navigation mode */
body.keyboard-nav a:focus,
body.keyboard-nav button:focus,
body.keyboard-nav input:focus,
body.keyboard-nav select:focus,
body.keyboard-nav [tabindex]:focus {
  outline: 3px solid var(--accent) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 6px rgba(26, 159, 255, 0.25) !important;
}

/* High contrast focus for option buttons */
body.keyboard-nav .option-btn:focus,
body.keyboard-nav .difficulty-btn:focus,
body.keyboard-nav .question-count-btn:focus {
  outline: 4px solid #fff !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 8px var(--accent), 0 0 20px rgba(26, 159, 255, 0.5) !important;
}

/* דילוג לתוכן עיקרי */
.skip-link {
  position: absolute;
  top: -50px;
  right: 50%;
  transform: translateX(50%);
  background: var(--accent);
  color: #fff;
  padding: 12px 24px;
  z-index: 10000;
  text-decoration: none;
  font-weight: 700;
  border-radius: 0 0 12px 12px;
  transition: top 0.3s ease;
  font-size: 1rem;
}

.skip-link:focus {
  top: 0;
}

/* רקע דינמי פרימיום */
.stars-layer {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(1200px 1200px at 15% 20%, var(--gradient-start), transparent 65%),
    radial-gradient(900px 900px at 85% 80%, var(--gradient-mid), transparent 65%),
    radial-gradient(1500px 1500px at 50% 50%, var(--gradient-end), transparent 75%),
    radial-gradient(2px 2px at 20% 30%, rgba(139, 92, 246, var(--stars-opacity)), transparent),
    radial-gradient(2px 2px at 60% 70%, rgba(139, 92, 246, calc(var(--stars-opacity) * 0.9)), transparent),
    radial-gradient(1px 1px at 80% 10%, rgba(139, 92, 246, calc(var(--stars-opacity) * 0.8)), transparent),
    radial-gradient(1px 1px at 33% 80%, rgba(139, 92, 246, calc(var(--stars-opacity) * 0.7)), transparent),
    radial-gradient(1px 1px at 10% 60%, rgba(139, 92, 246, calc(var(--stars-opacity) * 0.6)), transparent),
    radial-gradient(1px 1px at 90% 45%, rgba(139, 92, 246, calc(var(--stars-opacity) * 0.5)), transparent),
    var(--bg);
  background-size: 100% 100%, 100% 100%, 100% 100%, 200% 200%, 180% 180%, 160% 160%, 210% 210%, 190% 190%, 170% 170%, 100% 100%;
  animation: starsMove 120s ease-in-out infinite alternate, gradientPulse 25s ease infinite;
  opacity: 1;
  z-index: 0;
  pointer-events: none;
  transition: background 0.4s ease, opacity 0.4s ease;
}

@keyframes gradientPulse {
  0%, 100% { 
    filter: hue-rotate(0deg) brightness(1) saturate(1);
    transform: scale(1);
  }
  33% { 
    filter: hue-rotate(10deg) brightness(1.2) saturate(1.3);
    transform: scale(1.01);
  }
  66% { 
    filter: hue-rotate(-5deg) brightness(1.1) saturate(1.15);
    transform: scale(0.99);
  }
}

@keyframes starsMove {
  0% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 10% 20%, 20% 10%, 30% 30%, 40% 50%, 0% 0%; }
  100% { background-position: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 90% 80%, 80% 90%, 70% 70%, 60% 50%, 0% 0%; }
}

/* כותרת - Glassmorphism פרימיום */
.app-header {
  padding: clamp(12px, 1.8vh, 18px) clamp(16px, 2.5vw, 24px);
  background: var(--panel);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  border-bottom: 2px solid rgba(139, 92, 246, 0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(14px, 2.5vw, 22px);
  flex-wrap: wrap;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  box-shadow: 
    0 8px 32px var(--shadow),
    0 0 0 1px rgba(139, 92, 246, 0.3),
    inset 0 1px 0 rgba(139, 92, 246, 0.18),
    0 2px 0 rgba(139, 92, 246, 0.15);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.app-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(139, 92, 246, 0.2) 30%,
    rgba(167, 139, 250, 0.3) 50%,
    rgba(139, 92, 246, 0.2) 70%,
    transparent 100%);
  /* animation: shimmer 2s ease-in-out 1; */
  pointer-events: none;
  opacity: 0.7;
}

.app-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(139, 92, 246, 0.6) 50%,
    transparent 100%);
  /* animation: shimmer 2s ease-in-out 1 reverse; */
}

@keyframes shimmer {
  0%, 100% { transform: translateX(-200%) skewX(-20deg); opacity: 0.5; }
  50% { transform: translateX(200%) skewX(-20deg); opacity: 1; }
}

.app-header h1 {
  font-size: clamp(24px, 5.5vw, 38px);
  font-weight: 900;
  color: white;
  background: linear-gradient(135deg, #0066ff 0%, #0080ff 50%, #1a9fff 100%);
  padding: 8px 16px;
  border-radius: 12px;
  text-shadow: 0 4px 12px rgba(0, 102, 255, 0.5);
  letter-spacing: -0.3px;
  position: relative;
  margin: 0;
  box-shadow: 0 8px 25px rgba(0, 102, 255, 0.4);
}

.app-header h1 a {
  color: white;
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.app-header h1 a:hover {
  opacity: 0.85;
}

.app-header h1::after {
  content: '🎯';
  margin-right: 8px;
  font-size: 1.2em;
  animation: floatIcon 3.5s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(5deg); }
}

@keyframes gradientMove {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.controls {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.controls .buttons {
  display: flex;
  gap: 12px;
  align-items: center;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.toggle {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

/* כפתורים פרימיום */
button {
  padding: clamp(13px, 2.2vw, 16px) clamp(26px, 3.5vw, 36px);
  border: none;
  border-radius: 18px;
  font-size: clamp(14px, 2.2vw, 16px);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: inherit;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.4px;
  /* מניעת לחיצה כפולה מהירה במובייל */
  touch-action: manipulation;
}

button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.25), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}

button::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.5), rgba(167, 139, 250, 0.3));
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
  filter: blur(8px);
}

button:hover::before {
  opacity: 1;
}

button:hover::after {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 50%, #c4b5fd 100%);
  background-size: 200% 200%;
  color: white;
  box-shadow: 
    0 10px 30px rgba(139, 92, 246, 0.5),
    0 0 0 1px rgba(167, 139, 250, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  animation: gradientMove 3s ease infinite;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 
    0 16px 40px rgba(139, 92, 246, 0.6),
    0 0 0 2px rgba(167, 139, 250, 0.6),
    0 0 50px rgba(139, 92, 246, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  color: white;
  border: 2px solid var(--accent-light);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(0, 102, 255, 0.3);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent-glow) 100%);
  border-color: var(--accent-glow);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 102, 255, 0.5);
}

.btn-home {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  direction: ltr;
}

.btn-terms {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type="checkbox"] {
  width: 56px;
  height: 30px;
  appearance: none;
  background: var(--panel-light);
  border: 2px solid rgba(139, 92, 246, 0.4);
  border-radius: 15px;
  position: relative;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    inset 0 2px 10px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(139, 92, 246, 0.2);
}

input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  border-color: #a78bfa;
  box-shadow: 
    inset 0 2px 10px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(167, 139, 250, 0.4),
    0 0 25px rgba(139, 92, 246, 0.5);
}

input[type="checkbox"]::before {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, white, #f3f4f6);
  top: 2px;
  left: 2px;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    0 3px 10px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(0, 0, 0, 0.1);
}

input[type="checkbox"]:checked::before {
  transform: translateX(26px);
  box-shadow: 
    0 3px 10px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(139, 92, 246, 0.3);
}

/* תוכן ראשי */
.app-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: clamp(8px, 1.2vh, 12px) clamp(10px, 1.5vw, 14px);
  position: relative;
  z-index: 5;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* סטטיסטיקות - קלפים פרימיום */
.game-status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 1.5vw, 12px);
  margin-bottom: clamp(8px, 1.2vh, 10px);
  flex-shrink: 0;
}

.stat-card {
  background: var(--panel);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  border: 1.5px solid rgba(0, 102, 255, 0.4);
  border-radius: 18px;
  padding: clamp(14px, 2.5vh, 20px) clamp(10px, 2vw, 16px);
  text-align: center;
  box-shadow: 
    0 8px 32px var(--shadow),
    0 0 0 1px rgba(0, 102, 255, 0.3),
    inset 0 1px 0 rgba(0, 102, 255, 0.18),
    inset 0 -1px 0 rgba(0, 102, 255, 0.1);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle, rgba(0, 102, 255, 0.4), transparent 70%);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(0, 102, 255, 0.6) 50%,
    transparent 100%);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.stat-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 
    0 16px 48px rgba(0, 102, 255, 0.7),
    0 0 0 2px rgba(26, 159, 255, 0.6),
    0 0 60px rgba(0, 102, 255, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    inset 0 -2px 0 rgba(0, 0, 0, 0.35);
  border-color: rgba(26, 159, 255, 0.7);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-label {
  display: block;
  font-size: clamp(13px, 2.2vw, 16px);
  color: var(--text-muted);
  margin-bottom: clamp(6px, 1vh, 10px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.stat-value {
  display: block;
  font-size: clamp(28px, 5.5vw, 40px);
  font-weight: 900;
  background: linear-gradient(135deg, #0055dd 0%, #0066ff 50%, #0080ff 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* animation: gradientMove 2s ease 1; */
  filter: drop-shadow(0 0 12px rgba(0, 85, 221, 0.5));
  letter-spacing: -0.8px;
}

/* stat-value dark mode - brighter gradient */
:root[data-theme="dark"] .stat-value,
body.dark-mode .stat-value {
  background: linear-gradient(135deg, #0080ff 0%, #1a9fff 50%, #66d9ff 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 18px rgba(26, 159, 255, 0.7));
}

/* אזור המשחק */
.game-area {
  background: var(--panel);
  backdrop-filter: blur(35px) saturate(200%);
  -webkit-backdrop-filter: blur(35px) saturate(200%);
  border: 2px solid rgba(139, 92, 246, 0.55);
  border-radius: 24px;
  padding: clamp(10px, 1.5vh, 14px) clamp(10px, 1.5vw, 14px);
  box-shadow: 
    0 16px 64px var(--shadow),
    0 0 0 1px rgba(139, 92, 246, 0.45),
    0 0 100px rgba(139, 92, 246, 0.25),
    inset 0 2px 0 rgba(139, 92, 246, 0.18),
    inset 0 -2px 0 rgba(139, 92, 246, 0.1);
  margin-bottom: clamp(8px, 1.2vh, 10px);
  position: relative;
  flex-shrink: 0;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.game-area::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 30px;
  background: linear-gradient(135deg, 
    rgba(139, 92, 246, 0.5), 
    rgba(16, 185, 129, 0.4), 
    rgba(139, 92, 246, 0.5));
  background-size: 200% 200%;
  z-index: -1;
  opacity: 0.5;
  /* animation: borderGlow 8s ease infinite; */
  opacity: 0.2;
  filter: blur(15px);
}

@keyframes borderGlow {
  0%, 100% { 
    opacity: 0.4; 
    background-position: 0% 50%; 
  }
  50% { 
    opacity: 0.8; 
    background-position: 100% 50%; 
  }
}

.instruction {
  text-align: center;
  font-size: clamp(14px, 2.5vw, 18px);
  color: var(--text-muted);
  margin-bottom: clamp(8px, 1.2vh, 12px);
  font-weight: 600;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* תצוגת סדרה */
.sequence-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(8px, 1.8vw, 14px);
  flex-wrap: wrap;
  padding: clamp(8px, 1.2vh, 12px) 0;
  min-height: clamp(65px, 8vh, 85px);
  direction: ltr;
}

.btn-start-game {
  font-size: clamp(16px, 3.2vw, 24px);
  padding: clamp(12px, 2.2vh, 16px) clamp(28px, 4.5vw, 44px);
  min-width: 200px;
  font-weight: 800;
  letter-spacing: 0.4px;
  box-shadow: 
    0 10px 35px rgba(0, 102, 255, 0.7),
    0 0 0 2px rgba(26, 159, 255, 0.6),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

.sequence-number {
  width: clamp(65px, 11vw, 95px);
  height: clamp(65px, 11vw, 95px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0066ff 0%, #0080ff 35%, #1a9fff 70%, #66d9ff 100%);
  background-size: 200% 200%;
  border-radius: 20px;
  font-size: clamp(30px, 5.5vw, 46px);
  font-weight: 900;
  color: white;
  box-shadow: 
    0 14px 50px rgba(0, 102, 255, 0.7),
    0 0 0 3px rgba(255, 255, 255, 0.3),
    0 0 80px rgba(26, 159, 255, 0.6),
    inset 0 3px 12px rgba(255, 255, 255, 0.4),
    inset 0 -2px 8px rgba(0, 0, 0, 0.25);
  transform: scale(0);
  opacity: 0;
  animation: numberPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, 
             gradientMove 6s ease infinite;
  text-shadow: 
    0 2px 12px rgba(0, 0, 0, 0.7),
    0 0 25px rgba(255, 255, 255, 0.6);
  position: relative;
  border: 3px solid rgba(255, 255, 255, 0.35);
}

.sequence-number::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 20px;
  background: linear-gradient(135deg, 
    rgba(255,255,255,0.45), 
    transparent 35%,
    rgba(255,255,255,0.25));
  opacity: 0;
  animation: numberPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  pointer-events: none;
}

@keyframes numberPop {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.2) rotate(12deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* אזור קלט */
.input-area {
  margin-top: clamp(8px, 1.2vh, 14px);
}

.input-layout {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.2vh, 10px);
  align-items: center;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(6px, 1.2vw, 10px);
  max-width: min(600px, 90vw);
  width: 100%;
  margin: 0;
  direction: ltr;
}

.number-btn {
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-light) 100%);
  border: 2px solid rgba(139, 92, 246, 0.55);
  border-radius: 16px;
  font-size: clamp(18px, 4vw, 32px);
  font-weight: 900;
  color: var(--text);
  cursor: pointer;
  transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    0 8px 28px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(139, 92, 246, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.15),
    inset 0 -2px 0 rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
  min-height: 48px;
}

.number-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(139, 92, 246, 0.5), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.number-btn::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.6), rgba(167, 139, 250, 0.4));
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
  filter: blur(10px);
}

.number-btn:hover:not(:disabled) {
  transform: translateY(-8px) scale(1.1) rotate(3deg);
  border-color: #c4b5fd;
  box-shadow: 
    0 18px 52px rgba(139, 92, 246, 0.8),
    0 0 0 3px rgba(167, 139, 250, 0.7),
    0 0 70px rgba(139, 92, 246, 0.7),
    inset 0 3px 12px rgba(255, 255, 255, 0.35),
    inset 0 -3px 12px rgba(0, 0, 0, 0.35);
  background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 50%, #c4b5fd 100%);
  background-size: 200% 200%;
  animation: gradientMove 3s ease infinite;
  color: white;
}

.number-btn:hover:not(:disabled)::before {
  opacity: 1;
}

.number-btn:hover:not(:disabled)::after {
  opacity: 1;
}

.number-btn:active:not(:disabled) {
  transform: translateY(-6px) scale(1.06);
}

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

.number-btn.selected {
  background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
  border-color: #c4b5fd;
  color: white;
  box-shadow: 
    0 0 40px rgba(139, 92, 246, 0.7),
    inset 0 3px 15px rgba(255, 255, 255, 0.35),
    inset 0 -2px 10px rgba(0, 0, 0, 0.2);
  transform: scale(1.1);
  animation: pulseSelected 0.6s ease;
}

@keyframes pulseSelected {
  0%, 100% { transform: scale(1.1); }
  50% { transform: scale(1.15); }
}

.user-sequence {
  text-align: center;
  width: 100%;
  max-width: min(600px, 90vw);
}

.label {
  display: block;
  font-size: clamp(13px, 2.5vw, 16px);
  color: var(--text-muted);
  margin-bottom: clamp(6px, 1vh, 10px);
  font-weight: 700;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.sequence-box {
  display: flex;
  justify-content: center;
  gap: clamp(6px, 1.2vw, 10px);
  flex-wrap: wrap;
  padding: clamp(10px, 1.5vh, 14px);
  background: var(--panel-light);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  border: 2px dashed rgba(0, 102, 255, 0.55);
  margin-bottom: clamp(8px, 1.2vh, 12px);
  box-shadow: 
    inset 0 3px 10px var(--shadow),
    0 0 0 1px rgba(0, 102, 255, 0.35),
    0 4px 18px var(--shadow);
  transition: background 0.4s ease, box-shadow 0.4s ease;
  direction: ltr;
}

.sequence-slot {
  width: clamp(42px, 7.5vw, 56px);
  height: clamp(42px, 7.5vw, 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-light) 100%);
  border: 2px solid rgba(139, 92, 246, 0.55);
  border-radius: 12px;
  font-size: clamp(18px, 4vw, 26px);
  font-weight: 900;
  color: var(--accent-light);
  box-shadow: 
    inset 0 3px 12px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(139, 92, 246, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.sequence-slot.filled {
  background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 45%, #c4b5fd 90%, #e9d5ff 100%);
  background-size: 200% 200%;
  border-color: #c4b5fd;
  color: white;
  box-shadow: 
    0 8px 32px rgba(139, 92, 246, 0.7),
    inset 0 3px 10px rgba(255, 255, 255, 0.35),
    0 0 25px rgba(167, 139, 250, 0.6),
    inset 0 -2px 6px rgba(0, 0, 0, 0.25);
  animation: slotFill 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
             gradientMove 5s ease infinite;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
}

@keyframes slotFill {
  0% {
    transform: scale(0.6) rotate(-15deg);
    opacity: 0.2;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.auto-submit-hint {
  font-size: clamp(12px, 2vw, 14px);
  color: var(--text-muted);
  margin-top: 10px;
  font-style: italic;
  opacity: 0.75;
  animation: pulseHint 3s ease-in-out infinite;
}

@keyframes pulseHint {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* אזור תוצאות */
.result-area {
  text-align: center;
  margin-top: clamp(16px, 2.5vw, 24px);
}

.result-message {
  font-size: clamp(22px, 5vw, 36px);
  font-weight: 900;
  margin-bottom: clamp(18px, 2.8vw, 24px);
  padding: clamp(18px, 3vw, 28px);
  border-radius: 22px;
  letter-spacing: 0.4px;
}

.result-message.success {
  color: var(--success-light);
  background: linear-gradient(135deg, 
    rgba(16, 185, 129, 0.25) 0%, 
    rgba(52, 211, 153, 0.2) 100%);
  border: 2px solid var(--success);
  box-shadow: 
    0 16px 50px rgba(16, 185, 129, 0.6),
    0 0 0 2px rgba(52, 211, 153, 0.4),
    inset 0 3px 15px rgba(255, 255, 255, 0.2),
    inset 0 -2px 10px rgba(0, 0, 0, 0.2);
  text-shadow: 0 0 30px var(--glow-green);
  animation: successPulse 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(20px);
}

.result-message.error {
  color: var(--danger-light);
  background: linear-gradient(135deg, 
    rgba(239, 68, 68, 0.25) 0%, 
    rgba(248, 113, 113, 0.2) 100%);
  border: 2px solid var(--danger);
  box-shadow: 
    0 16px 50px rgba(239, 68, 68, 0.6),
    0 0 0 2px rgba(248, 113, 113, 0.4),
    inset 0 3px 15px rgba(255, 255, 255, 0.2),
    inset 0 -2px 10px rgba(0, 0, 0, 0.2);
  text-shadow: 0 0 30px rgba(239, 68, 68, 0.7);
  animation: errorShake 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(20px);
}

@keyframes successPulse {
  0% { 
    transform: scale(0.8) rotate(-10deg); 
    opacity: 0; 
  }
  50% { 
    transform: scale(1.12) rotate(5deg); 
  }
  100% { 
    transform: scale(1) rotate(0deg); 
    opacity: 1; 
  }
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0) scale(1) rotate(0deg); }
  10% { transform: translateX(-12px) rotate(-4deg) scale(0.95); }
  30% { transform: translateX(12px) rotate(4deg) scale(1.06); }
  50% { transform: translateX(-10px) rotate(-3deg) scale(0.98); }
  70% { transform: translateX(10px) rotate(3deg) scale(1.03); }
}

/* עזרה */
.help {
  margin-top: clamp(10px, 1.5vh, 14px);
  color: var(--text-muted);
  flex-shrink: 0;
}

.help details {
  background: var(--panel-light);
  backdrop-filter: blur(25px);
  border: 1.5px solid rgba(139, 92, 246, 0.45);
  border-radius: 14px;
  padding: clamp(12px, 1.8vh, 16px);
  box-shadow: 
    0 8px 28px var(--shadow),
    inset 0 1px 0 rgba(139, 92, 246, 0.15),
    inset 0 -1px 0 rgba(139, 92, 246, 0.1);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.help summary {
  cursor: pointer;
  font-weight: 700;
  font-size: clamp(14px, 2.5vw, 18px);
  color: var(--text);
  padding: 8px;
  border-radius: 8px;
  transition: all 0.35s ease;
}

.help summary:hover {
  background: rgba(139, 92, 246, 0.2);
  color: var(--accent-light);
  transform: translateX(-2px);
}

.help p {
  margin-top: 12px;
  line-height: 1.8;
  font-size: clamp(12px, 2vw, 14px);
}

/* Help Content - Enhanced Styles */
.help-content {
  font-size: clamp(15px, 2.4vw, 18px) !important;
  line-height: 1.6;
  color: var(--text);
}

.help-content h3 {
  font-size: clamp(18px, 3.2vw, 24px) !important;
  font-weight: 800;
  margin-top: 16px;
  margin-bottom: 10px;
  color: var(--accent-light);
  letter-spacing: -0.5px;
}

.help-content p {
  font-size: clamp(15px, 2.4vw, 18px);
  margin-bottom: 12px;
  line-height: 1.6;
}

.help-content ol,
.help-content ul {
  margin-left: 28px;
  margin-bottom: 16px;
}

.help-content li {
  font-size: clamp(15px, 2.4vw, 18px);
  margin-bottom: 8px;
  line-height: 1.6;
}

.large-list {
  font-size: clamp(15px, 2.4vw, 18px) !important;
}

.large-list li {
  font-size: clamp(15px, 2.4vw, 18px) !important;
  line-height: 1.6;
}

.number-badge {
  display: inline-block;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  color: white;
  padding: 8px 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.1em;
  margin: 0 4px;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
  min-width: 50px;
  text-align: center;
}

.example-box {
  background: rgba(139, 92, 246, 0.1);
  border-left: 5px solid var(--accent);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  font-size: clamp(14px, 2.2vw, 17px);
  line-height: 2;
}

.example-box p {
  font-size: clamp(14px, 2.2vw, 17px) !important;
  margin-bottom: 12px;
}

.difficulty-box,
.tips-box,
.faq-box {
  background: var(--panel-light);
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-radius: 16px;
  padding: 22px;
  margin: 20px 0;
  font-size: clamp(14px, 2.2vw, 17px);
}

.difficulty-box p,
.tips-box p,
.faq-box p {
  font-size: clamp(14px, 2.2vw, 17px) !important;
  margin-bottom: 14px;
  line-height: 2;
}

.faq-box p strong {
  display: block;
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--accent-light);
  font-size: 1.05em;
}

/* פוטר */
.app-footer {
  text-align: center;
  padding: clamp(12px, 1.8vh, 18px) clamp(12px, 2vw, 18px);
  color: var(--text-muted);
  font-size: clamp(10px, 1.7vw, 12px);
  position: relative;
  z-index: 5;
  border-top: 2px solid rgba(139, 92, 246, 0.35);
  margin-top: clamp(10px, 1.5vh, 14px);
  background: linear-gradient(180deg, 
    transparent 0%, 
    rgba(25, 28, 55, 0.5) 100%);
  flex-shrink: 0;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
}

.footer-main {
  margin-bottom: clamp(12px, 1.8vw, 16px);
  font-size: clamp(12px, 2.2vw, 14px);
  color: var(--text);
  font-weight: 600;
}

.footer-links {
  margin-top: 16px;
  font-size: clamp(12px, 2.2vw, 14px);
}

.footer-link {
  display: inline-block;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  border: 2px solid var(--accent);
  border-radius: 12px;
  font-weight: 700;
  transition: all 0.3s ease;
  margin: 0 8px;
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.footer-link:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.7);
  color: white;
}

.footer-disclaimer {
  margin-top: 10px;
  text-align: center;
  direction: rtl;
  font-size: 1.5em;
  font-weight: 700;
  color: var(--text);
  opacity: 1;
}

@media (max-width: 768px) {
  .footer-disclaimer {
    font-size: 1.125em;
  }
}

.footer-disclaimer summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: clamp(12px, 2vw, 14px);
  padding: 12px 18px;
  border-radius: 14px;
  transition: all 0.4s ease;
  user-select: none;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 
    0 4px 15px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.footer-disclaimer summary:hover {
  color: var(--accent-light);
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(167, 139, 250, 0.5);
  transform: translateY(-2px);
  box-shadow: 
    0 6px 20px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(167, 139, 250, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.footer-disclaimer[open] summary {
  margin-bottom: 18px;
  color: var(--accent-light);
  background: rgba(139, 92, 246, 0.2);
}

.disclaimer-content {
  background: var(--panel);
  backdrop-filter: blur(25px);
  border: 2px solid rgba(139, 92, 246, 0.5);
  border-radius: 18px;
  padding: clamp(22px, 3.5vw, 32px);
  margin-top: 16px;
  text-align: right;
  direction: rtl;
  font-size: clamp(13px, 2.2vw, 15px);
  line-height: 2;
  color: var(--text);
  box-shadow: 
    0 16px 50px var(--shadow),
    inset 0 1px 0 rgba(139, 92, 246, 0.12),
    inset 0 -1px 0 rgba(139, 92, 246, 0.08);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.disclaimer-content p {
  margin-bottom: 16px;
}

.disclaimer-content p:last-of-type {
  margin-bottom: 0;
}

.disclaimer-content strong {
  color: var(--accent-light);
  font-weight: 700;
}

.disclaimer-date {
  margin-top: 28px !important;
  padding-top: 22px;
  border-top: 2px solid rgba(139, 92, 246, 0.4);
  font-size: clamp(11px, 1.8vw, 13px);
  color: var(--text-muted);
  font-style: italic;
}

/* Modal - פופאפ מותאם */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.3s ease;
}

.modal.hidden {
  display: none !important;
}

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

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: overlayFadeIn 0.3s ease;
}

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

.modal-content {
  position: relative;
  background: var(--panel);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 2px solid rgba(139, 92, 246, 0.6);
  border-radius: 24px;
  max-width: 480px;
  width: 90vw;
  box-shadow: 
    0 24px 80px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(139, 92, 246, 0.5),
    0 0 120px rgba(139, 92, 246, 0.3),
    inset 0 2px 0 rgba(139, 92, 246, 0.2),
    inset 0 -2px 0 rgba(139, 92, 246, 0.15);
  animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

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

.modal-header {
  padding: clamp(20px, 3vh, 28px) clamp(24px, 4vw, 32px);
  background: linear-gradient(135deg, 
    rgba(139, 92, 246, 0.2) 0%, 
    rgba(167, 139, 250, 0.15) 100%);
  border-bottom: 2px solid rgba(139, 92, 246, 0.4);
  position: relative;
}

.modal-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(139, 92, 246, 0.3) 50%,
    transparent 100%);
  animation: shimmer 3s ease-in-out infinite;
  pointer-events: none;
}

.modal-header h2 {
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 800;
  color: var(--text);
  margin: 0;
  text-align: center;
  letter-spacing: -0.3px;
  text-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
}

.modal-body {
  padding: clamp(24px, 4vh, 32px) clamp(24px, 4vw, 32px);
  text-align: center;
}

.modal-body p {
  font-size: clamp(16px, 3vw, 18px);
  color: var(--text);
  margin: 0 0 16px 0;
  line-height: 1.6;
  font-weight: 500;
}

.modal-warning {
  font-size: clamp(14px, 2.5vw, 16px);
  color: var(--warning-light);
  font-weight: 600;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px;
  margin-bottom: 0 !important;
}

.modal-footer {
  padding: clamp(18px, 3vh, 24px) clamp(24px, 4vw, 32px);
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  background: linear-gradient(180deg, 
    transparent 0%, 
    rgba(139, 92, 246, 0.08) 100%);
  border-top: 1px solid rgba(139, 92, 246, 0.2);
}

.modal-footer button {
  flex: 1;
  min-width: 120px;
  padding: clamp(12px, 2vh, 14px) clamp(20px, 3vw, 28px);
  font-size: clamp(15px, 2.5vw, 17px);
  font-weight: 700;
}

.modal-btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #f87171 50%, #fca5a5 100%);
  background-size: 200% 200%;
  animation: gradientMove 3s ease infinite;
  box-shadow: 
    0 10px 35px rgba(239, 68, 68, 0.6),
    0 0 0 2px rgba(248, 113, 113, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

.modal-btn-danger:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 
    0 16px 45px rgba(239, 68, 68, 0.7),
    0 0 0 2px rgba(248, 113, 113, 0.6),
    0 0 50px rgba(239, 68, 68, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.4);
}

.modal-help {
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-body-scroll {
  overflow-y: auto;
  flex: 1;
  padding: clamp(24px, 4vh, 32px) clamp(24px, 4vw, 32px);
  max-height: calc(85vh - 120px);
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(139, 92, 246, 0.2);
  border: none;
  font-size: 28px;
  color: var(--accent-light);
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.3s ease;
  z-index: 1001;
}

.modal-close-btn:hover {
  background: rgba(0, 102, 255, 0.4);
  color: var(--accent);
  transform: rotate(90deg);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.modal-close-btn:active {
  transform: rotate(90deg) scale(0.95);
}

@media (max-width: 768px) {
  .modal-close-btn {
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    font-size: 24px;
    background: rgba(139, 92, 246, 0.3);
  }
}

@media (max-width: 480px) {
  .modal-close-btn {
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    font-size: 20px;
    background: rgba(139, 92, 246, 0.35);
  }
}

/* מחלקות עזר */
.hidden {
  display: none !important;
}

/* רספונסיבי למובייל */
@media (max-width: 768px) {
  .app-header {
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
    min-height: auto;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .app-header h1 {
    font-size: 16px;
    padding: 6px 10px;
    border-radius: 8px;
    margin: 0;
    flex-shrink: 1;
    min-width: 0;
    line-height: 1.3;
    text-align: right;
    order: 1;
    flex-basis: 100%;
    margin-bottom: 8px;
  }

  .app-header h1::after {
    display: none;
  }

  .controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    order: 2;
    flex-basis: 100%;
    width: 100%;
    direction: rtl;
  }

  .controls .buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    direction: rtl;
    flex: 1;
  }

  .btn-secondary {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 8px;
    border-width: 1px;
    white-space: nowrap;
    min-width: auto;
    line-height: 1.4;
  }

  .control-group {
    gap: 6px;
    flex-direction: row;
    align-items: center;
    margin: 0;
    direction: rtl;
  }

  .control-group.toggle {
    gap: 6px;
  }

  .control-group label {
    font-size: 11px;
    letter-spacing: 0;
    white-space: nowrap;
    margin: 0;
    line-height: 1;
  }

  input[type="checkbox"] {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    flex-shrink: 0;
  }

  input[type="checkbox"]::before {
    width: 16px;
    height: 16px;
    top: 2px;
    left: 2px;
  }

  input[type="checkbox"]:checked::before {
    transform: translateX(16px);
  }

  .app-main {
    padding: 10px 12px;
  }

  .game-status {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
  }

  .stat-card {
    padding: 8px 6px;
    border-radius: 12px;
  }

  .stat-label {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .stat-value {
    font-size: 22px;
  }

  .game-area {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 16px;
  }

  .number-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .sequence-display {
    gap: 8px;
    min-height: 70px;
    padding: 10px 0;
  }

  .sequence-box {
    gap: 8px;
    padding: 10px;
  }

  button {
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 12px;
  }

  .btn-start-game {
    font-size: 16px;
    padding: 12px 24px;
    min-width: 160px;
  }

  .app-footer {
    padding: 10px 12px;
    margin-top: 8px;
  }

  .footer-main {
    font-size: 11px !important;
    margin-bottom: 8px !important;
  }

  .footer-links {
    margin-top: 8px !important;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .footer-link {
    padding: 6px 10px !important;
    font-size: 10px !important;
    border-radius: 6px !important;
  }

  .footer-disclaimer {
    font-size: 9px !important;
    margin-top: 8px !important;
    line-height: 1.4 !important;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 8px 10px;
    gap: 8px;
  }

  .app-header h1 {
    font-size: 15px;
    padding: 5px 8px;
  }

  .controls {
    gap: 6px;
  }

  .controls .buttons {
    gap: 6px;
  }

  .btn-secondary {
    padding: 6px 10px;
    font-size: 11px;
    flex: 1;
    min-width: 60px;
  }

  .control-group label {
    font-size: 10px;
  }

  .game-status {
    gap: 6px;
    margin-bottom: 8px;
  }

  .stat-value {
    font-size: 18px;
  }

  .game-area {
    padding: 10px;
    margin-bottom: 8px;
  }

  .number-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .app-footer {
    padding: 8px 10px;
  }

  .footer-main {
    font-size: 10px !important;
    margin-bottom: 6px !important;
  }

  .footer-links {
    margin-top: 6px !important;
    gap: 4px;
  }

  .footer-link {
    padding: 5px 8px !important;
    font-size: 9px !important;
  }

  .footer-disclaimer {
    font-size: 8px !important;
    margin-top: 6px !important;
  }
}

@media (max-height: 700px) {
  .app-header h1 {
    margin-bottom: 4px;
  }
  
  .app-main {
    padding: 8px 10px;
  }
  
  .game-status {
    margin-bottom: 8px;
  }
  
  .game-area {
    padding: 8px 10px;
    margin-bottom: 8px;
  }

  .app-footer {
    padding: 6px 8px;
  }

  .footer-main {
    font-size: 10px !important;
    margin-bottom: 4px !important;
  }

  .footer-links {
    margin-top: 4px !important;
    gap: 4px;
  }

  .footer-link {
    padding: 4px 8px !important;
    font-size: 9px !important;
  }

  .footer-disclaimer {
    font-size: 8px !important;
    margin-top: 4px !important;
    line-height: 1.3 !important;
  }
}

/* =====================================================
   Perfect Score Celebration Effects
   ===================================================== */

.celebration-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

/* Balloons */
.balloon {
  position: absolute;
  width: 40px;
  height: 50px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: floatUp 4s ease-out forwards;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.balloon::before {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 40px;
  background: linear-gradient(to bottom, currentColor, transparent);
}

.balloon::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid currentColor;
}

@keyframes floatUp {
  0% {
    transform: translateY(100vh) rotate(0deg) scale(0.5);
    opacity: 0;
  }
  10% {
    opacity: 1;
    transform: translateY(80vh) rotate(5deg) scale(1);
  }
  50% {
    transform: translateY(40vh) rotate(-5deg) scale(1.1);
  }
  100% {
    transform: translateY(-20vh) rotate(10deg) scale(0.9);
    opacity: 0;
  }
}

/* Stars */
.celebration-star {
  position: absolute;
  font-size: 30px;
  animation: starFloat 3s ease-out forwards;
  text-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
}

@keyframes starFloat {
  0% {
    transform: translateY(100vh) rotate(0deg) scale(0);
    opacity: 0;
  }
  20% {
    opacity: 1;
    transform: translateY(70vh) rotate(90deg) scale(1.2);
  }
  50% {
    transform: translateY(40vh) rotate(180deg) scale(1);
  }
  100% {
    transform: translateY(-10vh) rotate(360deg) scale(0.5);
    opacity: 0;
  }
}

/* Confetti */
.confetti {
  position: absolute;
  width: 12px;
  height: 12px;
  animation: confettiFall 4s ease-out forwards;
}

.confetti.square {
  border-radius: 2px;
}

.confetti.circle {
  border-radius: 50%;
}

.confetti.ribbon {
  width: 8px;
  height: 24px;
  border-radius: 4px;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-20vh) rotate(0deg) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
    transform: translateY(0) rotate(90deg) scale(1);
  }
  100% {
    transform: translateY(110vh) rotate(720deg) scale(0.5);
    opacity: 0;
  }
}

/* Firework Burst */
.firework {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: fireworkBurst 1.5s ease-out forwards;
}

@keyframes fireworkBurst {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Sparkle effect */
.sparkle {
  position: absolute;
  font-size: 20px;
  animation: sparkleAnim 2s ease-out forwards;
  text-shadow: 0 0 10px gold, 0 0 20px gold;
}

@keyframes sparkleAnim {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }
  25% {
    transform: scale(1.5) rotate(90deg);
    opacity: 1;
  }
  50% {
    transform: scale(1) rotate(180deg);
    opacity: 1;
  }
  100% {
    transform: scale(0) rotate(360deg);
    opacity: 0;
  }
}

/* Golden Glow Overlay */
.golden-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
  animation: goldenPulse 2s ease-in-out 3;
  pointer-events: none;
  z-index: 9998;
}

@keyframes goldenPulse {
  0%, 100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

/* Trophy Animation for Perfect Score */
.trophy-celebration {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 100px;
  z-index: 10000;
  animation: trophyBounce 1s ease-out forwards;
  text-shadow: 0 0 50px gold, 0 0 100px orange;
  pointer-events: none;
}

@keyframes trophyBounce {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(-30deg);
    opacity: 0;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.3) rotate(10deg);
    opacity: 1;
  }
  70% {
    transform: translate(-50%, -50%) scale(0.9) rotate(-5deg);
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    opacity: 1;
  }
}
