/* Modern 2025 CSS for Multiplication App */
:root {
  /* Modern Color Palette */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --secondary: #10b981;
  --accent: #f472b6;
  --error: #ef4444;
  --success: #22c55e;
  --background: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-light: #64748b;
  --border: #e2e8f0;
  
  /* Modern Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-secondary: linear-gradient(135deg, #10b981, #0ea5e9);
  --gradient-accent: linear-gradient(135deg, #f472b6, #ec4899);
  
  /* Modern Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.03);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.03), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.04);
  
  /* Glass Effect */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;
}

/* Reset & Base Styles */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.5;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  padding: 1rem;
}

/* Main Container - 90% screen height */
.container {
  width: 100%;
  max-width: 550px;
  height: 99vh;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.7); /* Semi-transparent for video visibility */
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1rem; /* Reduced padding */
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  animation: fadeIn 0.5s ease-out;
}

/* Modern Typography */
h1 {
  font-size: 1.5rem; /* Slightly smaller */
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  text-align: center;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  text-align: center;
}

/* High Score Card */
.high-score {
  background: rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.high-score:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.high-score h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--primary-dark);
}

/* Controls Section */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
  justify-content: center;
}

/* Modern Select */
select {
  appearance: none;
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1em;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Modern Buttons */
button {
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

button:active {
  transform: translateY(0);
}

button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%, -50%);
  transform-origin: 50% 50%;
}

button:focus:not(:active)::after {
  animation: ripple 0.8s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 0.5;
  }
  100% {
    transform: scale(30, 30);
    opacity: 0;
  }
}

/* Progress and Score */
#progress {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  text-align: center;
}

.score-counter {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.score-counter div {
  background: var(--glass-bg);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
}

#correct-count {
  color: var(--success);
  font-weight: 600;
}

#incorrect-count {
  color: var(--error);
  font-weight: 600;
}

/* Table Container - Key changes for visibility */
#table-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.2rem;
  flex: 1 1 auto; /* Grow to fill */
  min-height: 70%; /* Minimum to ensure space */
  overflow-y: hidden;
  padding: 0.1rem;
}

/* Table Rows - Make numbers bold */
.table-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.15rem 0.4rem;
  background: var(--glass-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  min-height: auto;
  height: 1.8rem;
  font-size: 0.85rem;
  font-weight: bold; /* Add bold */
}

/* Remove animations for simplicity */
.table-row:hover {
  background: rgba(255, 255, 255, 0.95);
}

/* Remove staggered animation */
.table-row:nth-child(n) { animation: none; }

/* Inputs */
input[type="number"] {
  width: 2.8rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
}

input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Input States */
input.correct {
  border-color: var(--success);
  background-color: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

input.wrong {
  border-color: var(--error);
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--error);
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Body - Remove padding to maximize viewport */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.5;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  padding: 1rem;
}

/* Container - Set to 50% width, keep height */
.container {
  width: 40%;
  max-width: 550px; /* Optional cap to prevent too wide on large screens */
  height: 100vh;
  padding: 1rem;
}

/* Button Group - Zero top spacing */
.button-group {
  margin-top: 0;
  padding-top: 0;
  margin-bottom: 0.5rem;
}

/* Table Container - Adjust flex and height */
#table-container {
  flex: 1 1 auto;
  min-height: auto; /* Remove min-height constraint */
  margin-bottom: 0;
}

/* Media Query - Minimal padding */
@media (max-width: 640px) {
  .container {
    padding: 0;
  }
}

/* Buttons - Reduce padding */
button {
  padding: 0.4rem 0.8rem; /* Smaller padding */
  font-size: 0.8rem;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Media Query for smaller screens */
@media (max-width: 640px) {
  .container {
    padding: 0.1rem;
    height: 98vh; /* Almost full for small screens */
  }
  
  h1 {
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
  }
  
  #table-container {
    gap: 0.1rem;
  }
  
  .table-row {
    padding: 0.1rem 0.2rem;
    height: 1.6rem;
    font-size: 1.5rem;
  }
  
  input[type="number"] {
    width: 2.2rem;
    padding: 0.2rem;
    font-size: 0.9rem;
  }
}

/* Media Query for very small screens */
@media (max-width: 360px) {
  .container {
    padding: 0.75rem;
  }
  
  h1 {
    font-size: 1.25rem;
  }
  
  #table-container {
    grid-template-columns: 1fr;
  }
}








/* Background Video */
#bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
}