/* =========================================================
   YAS Marketing Site — style.css
   Mobile-first, dark mode, polished
   ========================================================= */

/* ── Reset & Base ─────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2255cc;
  --primary-dark: #1a3fa0;
  --primary-light: #4d7aee;
  --accent: #ff6b35;
  --accent-dark: #e55a26;
  --bg: #f8f9ff;
  --surface: #ffffff;
  --surface-2: #f0f2fc;
  --text: #1a1f3a;
  --text-muted: #5a6080;
  --border: #dde1f0;
  --shadow: 0 4px 24px rgba(34, 85, 204, 0.10);
  --shadow-lg: 0 12px 48px rgba(34, 85, 204, 0.16);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 24px;
  --font: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
  --transition: 0.2s ease;

  /* Sudoku grid */
  --cell-size: clamp(34px, 9vw, 56px);
  --cell-font: clamp(16px, 4vw, 26px);
  --grid-border: 3px;
  --cell-border: 1px;

  /* Grid colours */
  --cell-bg: #ffffff;
  --cell-given-bg: #eef1fc;
  --cell-given-color: #1a1f3a;
  --cell-user-color: #2255cc;
  --cell-selected-bg: #c5d4f8;
  --cell-peer-bg: #e8ecfc;
  --cell-conflict-bg: #ffe3e0;
  --cell-conflict-color: #cc2222;
  --cell-same-digit-bg: #bfcef5;
  --cell-correct-color: #1a7a4a;
  --grid-line: #c8ceea;
  --grid-box-line: #2255cc;
  --note-color: #7788cc;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f1a;
    --surface: #161928;
    --surface-2: #1e2236;
    --text: #e8eaf8;
    --text-muted: #8890b8;
    --border: #2a2f4a;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.5);

    --cell-bg: #161928;
    --cell-given-bg: #1e2448;
    --cell-given-color: #c8d4f8;
    --cell-user-color: #7fa8ff;
    --cell-selected-bg: #2a3a6a;
    --cell-peer-bg: #1c2240;
    --cell-conflict-bg: #3a1a1a;
    --cell-conflict-color: #ff7070;
    --cell-same-digit-bg: #243060;
    --cell-correct-color: #4adc8a;
    --grid-line: #2a3050;
    --grid-box-line: #4d7aee;
    --note-color: #6677cc;
  }
}

/* Manual dark/light override via data-color-scheme on <html> */

html[data-color-scheme="dark"] {
  --bg: #0d0f1a;
  --surface: #161928;
  --surface-2: #1e2236;
  --text: #e8eaf8;
  --text-muted: #8890b8;
  --border: #2a2f4a;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.5);

  --cell-bg: #161928;
  --cell-given-bg: #1e2448;
  --cell-given-color: #c8d4f8;
  --cell-user-color: #7fa8ff;
  --cell-selected-bg: #2a3a6a;
  --cell-peer-bg: #1c2240;
  --cell-conflict-bg: #3a1a1a;
  --cell-conflict-color: #ff7070;
  --cell-same-digit-bg: #243060;
  --cell-correct-color: #4adc8a;
  --grid-line: #2a3050;
  --grid-box-line: #4d7aee;
  --note-color: #6677cc;
}

html[data-color-scheme="light"] {
  --bg: #f8f9ff;
  --surface: #ffffff;
  --surface-2: #f0f2fc;
  --text: #1a1f3a;
  --text-muted: #5a6080;
  --border: #dde1f0;
  --shadow: 0 4px 24px rgba(34, 85, 204, 0.10);
  --shadow-lg: 0 12px 48px rgba(34, 85, 204, 0.16);

  --cell-bg: #ffffff;
  --cell-given-bg: #eef1fc;
  --cell-given-color: #1a1f3a;
  --cell-user-color: #2255cc;
  --cell-selected-bg: #c5d4f8;
  --cell-peer-bg: #e8ecfc;
  --cell-conflict-bg: #ffe3e0;
  --cell-conflict-color: #cc2222;
  --cell-same-digit-bg: #bfcef5;
  --cell-correct-color: #1a7a4a;
  --grid-line: #c8ceea;
  --grid-box-line: #2255cc;
  --note-color: #7788cc;
}

/* ── Dark/Light mode via data-mode attribute ──────────────── */

[data-mode="light"] {
  --bg: #f5f5f0;
  --bg-card: #ffffff;
  --bg-hero: #eeeee8;
  --text: #1a1a2e;
  --text-muted: #555566;
  --border: #d0d0d8;
  --accent: #1a4db5;
  --accent-hover: #1240a0;
  --sudoku-bg: #ffffff;
  --sudoku-given: #1a1a2e;
  --sudoku-entered: #1a4db5;
  --sudoku-border: #ccccdd;
  --sudoku-box-border: #888899;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  font-family: var(--font);
  border: none;
  outline: none;
}

button:focus-visible {
  outline: 3px solid var(--primary-light);
  outline-offset: 2px;
}

/* ── Typography ───────────────────────────────────────── */

h1, h2, h3, h4 {
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.2rem, 6vw, 4rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.6rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); }

.tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--primary);
  color: #fff;
  margin-bottom: 1rem;
}

/* ── Layout helpers ───────────────────────────────────── */

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

section {
  padding: 80px 0;
}

@media (max-width: 600px) {
  section { padding: 56px 0; }
}

/* ── Navigation ───────────────────────────────────────── */

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background var(--transition), box-shadow var(--transition);
}

.site-nav.scrolled {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--text);
  text-decoration: none;
}

.nav-logo .logo-accent {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-links a,
.nav-links button {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  cursor: pointer;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links button:hover {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}

.nav-cta {
  background: var(--primary) !important;
  color: #fff !important;
  padding: 8px 20px !important;
  border-radius: 100px !important;
}

.nav-cta:hover {
  background: var(--primary-dark) !important;
}

.nav-lang-btn {
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  border: 2px solid var(--border) !important;
  padding: 6px 14px !important;
  border-radius: 100px !important;
}

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border, rgba(128,128,128,0.3));
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  color: inherit;
  line-height: 1;
  transition: background 0.15s;
}
.theme-toggle-btn:hover { background: rgba(128,128,128,0.1); }

/* Mobile menu */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

@media (max-width: 720px) {
  .menu-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 16px 20px 24px;
    box-shadow: var(--shadow-lg);
    gap: 4px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a,
  .nav-links button {
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    font-size: 1rem;
  }
}

/* ── Hero ─────────────────────────────────────────────── */

.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: 64px;
  background: linear-gradient(145deg, var(--bg) 0%, color-mix(in srgb, var(--primary) 6%, var(--bg)) 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 12%, transparent) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 8%, transparent) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
  pointer-events: none;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-headline {
  color: var(--text);
  margin-bottom: 20px;
}

.hero-headline span {
  color: var(--primary);
}

.hero-tagline {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 16px;
  max-width: 480px;
  line-height: 1.4;
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.18rem);
  color: var(--text-muted);
  margin-bottom: 36px;
  max-width: 480px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: 100px;
  border: none;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(34, 85, 204, 0.35);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(34, 85, 204, 0.45);
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 100px;
  border: 2px solid var(--border);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  cursor: pointer;
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: var(--primary);
  background: var(--surface-2);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--text);
}

/* Hero grid illustration */
.hero-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.hero-grid-demo {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0;
  border: var(--grid-border) solid var(--grid-box-line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: min(280px, 80vw);
  aspect-ratio: 1;
}

.mini-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(9px, 2vw, 14px);
  font-weight: 700;
  border: 1px solid var(--grid-line);
  background: var(--cell-bg);
  color: var(--cell-given-color);
  aspect-ratio: 1;
  transition: background var(--transition);
}

.mini-cell:nth-child(3n):not(:nth-child(9n)) {
  border-right: 2px solid var(--grid-box-line);
}

.mini-cell:nth-child(n+19):nth-child(-n+27),
.mini-cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 2px solid var(--grid-box-line);
}

.mini-cell.given { background: var(--cell-given-bg); }
.mini-cell.hl { background: var(--cell-selected-bg); color: var(--primary); }
.mini-cell.accent { background: color-mix(in srgb, var(--accent) 20%, var(--cell-bg)); color: var(--accent-dark); }

.mini-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 210px;
  padding: 3px 8px;
  background: var(--cell-given-bg);
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  color: var(--cell-given-color);
}

.mini-numpad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 2px;
  width: 100%;
  max-width: 210px;
}

.mini-num {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  background: color-mix(in srgb, var(--primary) 12%, var(--cell-given-bg));
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  border: 1px solid var(--grid-box-line);
}

.mini-controls {
  display: flex;
  gap: 2px;
  align-items: center;
  width: 100%;
  max-width: 210px;
}

.mini-ctrl {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  background: color-mix(in srgb, var(--primary) 18%, var(--cell-given-bg));
  border-radius: 3px;
  font-size: 9px;
  border: 1px solid var(--grid-box-line);
  color: var(--primary);
}

.hero-badge {
  position: absolute;
  top: -12px;
  right: -12px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 6px 14px;
  border-radius: 100px;
  transform: rotate(8deg);
  box-shadow: 0 4px 12px rgba(255,107,53,0.4);
}

.theme-demo-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ── iPhone 15 Pro mockup ─────────────────────────────── */

.phone-wrap {
  position: relative;
  display: inline-block;
  margin: 0 auto;
  /* Extra horizontal room for side buttons */
  padding: 0 6px;
}

/* Volume buttons (left) */
.phone-wrap::before {
  content: '';
  position: absolute;
  left: 0;
  top: 88px;
  width: 3px;
  height: 28px;
  background: #3a3a3c;
  border-radius: 2px 0 0 2px;
  box-shadow: 0 38px 0 #3a3a3c, 0 72px 0 #3a3a3c;
}
/* Power button (right) */
.phone-wrap::after {
  content: '';
  position: absolute;
  right: 0;
  top: 112px;
  width: 3px;
  height: 54px;
  background: #3a3a3c;
  border-radius: 0 2px 2px 0;
}

.phone-frame {
  position: relative;
  width: 260px;
  background: linear-gradient(160deg, #3a3a3c 0%, #1c1c1e 50%, #2c2c2e 100%);
  border-radius: 48px;
  padding: 10px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset -1px 0 0 rgba(255,255,255,0.04),
    0 0 0 1px #111,
    0 40px 120px rgba(0,0,0,0.8),
    0 8px 24px rgba(0,0,0,0.5);
  flex-shrink: 0;
}

/* Home indicator */
.phone-frame::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: rgba(255,255,255,0.22);
  border-radius: 2px;
}

.phone-screen {
  border-radius: 40px;
  overflow: hidden;
  min-height: 500px;
  position: relative;
}

/* Status bar */
.phone-status-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px 0;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  letter-spacing: 0.02em;
  z-index: 5;
}
.phone-icons { font-size: 9px; letter-spacing: 1px; }

/* Dynamic Island */
.dynamic-island {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 86px;
  height: 24px;
  background: #000;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06);
  z-index: 5;
}

.phone-screen .hero-grid-demo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 54px 0 12px;
  gap: 3px;
  width: 100%;
  min-height: 500px;
  box-shadow: none;
  border-radius: 0;
}

.phone-screen .hero-badge {
  position: static;
  transform: rotate(8deg);
  align-self: flex-end;
  margin: 0 12px 1px 0;
  font-size: 0.45rem;
  padding: 2px 6px;
}

.phone-screen .mini-grid,
.phone-screen #hero-mini-grid {
  width: 207px !important;
  max-width: 207px !important;
  min-width: 0;
  aspect-ratio: auto !important;
  overflow: visible;
  border-width: 2px !important;
}

.phone-screen .mini-header {
  max-width: 207px;
  font-size: 0.65rem;
}

.phone-screen .mini-numpad {
  max-width: 207px;
  gap: 2px;
}

.phone-screen .mini-controls {
  max-width: 207px;
  gap: 1px;
}

.phone-screen .mini-cell {
  font-size: 11px !important;
  border-width: 1px !important;
}

.phone-screen .mini-cell:nth-child(3n) {
  border-right-width: 2px !important;
}

.phone-screen .mini-cell:nth-child(n+19):nth-child(-n+27),
.phone-screen .mini-cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom-width: 2px !important;
}

/* Light mode phone */
[data-mode="light"] .phone-frame {
  background: linear-gradient(160deg, #e2e2e6 0%, #c8c8cc 50%, #d8d8dc 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.8),
    inset -1px 0 0 rgba(255,255,255,0.3),
    0 0 0 1px #999,
    0 40px 120px rgba(0,0,0,0.25),
    0 8px 24px rgba(0,0,0,0.12);
}
[data-mode="light"] .phone-frame::after {
  background: rgba(0,0,0,0.18);
}
[data-mode="light"] .phone-wrap::before,
[data-mode="light"] .phone-wrap::after {
  background: #bebec2;
}
[data-mode="light"] .phone-screen {
  background: #f0f0f5;
}
[data-mode="light"] .phone-status-bar {
  color: rgba(0,0,0,0.7);
}
[data-mode="light"] .dynamic-island {
  background: #111;
}

@media (max-width: 860px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 40px;
  }

  .hero-sub { margin: 0 auto 36px; }
  .hero-actions { justify-content: center; }
  .hero-visual { order: -1; }
}

/* ── Section headers ──────────────────────────────────── */

.section-header {
  text-align: center;
  margin-bottom: 56px;
}

.section-header h2 {
  margin-bottom: 12px;
}

.section-header p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
}

/* ── Features ─────────────────────────────────────────── */

.features {
  background: var(--surface);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 28px 24px;
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--primary-light);
}

.feature-icon {
  font-size: 2.2rem;
  margin-bottom: 14px;
  line-height: 1;
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ── Daily Challenge ──────────────────────────────────── */

.daily {
  background: var(--bg);
}

.daily-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 48px;
  align-items: start;
  justify-content: center;
  max-width: 900px;
  margin: 0 auto;
}

/* Puzzle container */
.puzzle-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
}

.puzzle-stats-row {
  display: flex;
  gap: 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  width: 100%;
  justify-content: space-between;
}

.puzzle-stats-row .stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.puzzle-stats-row .stat-val {
  color: var(--text);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

/* ── Sudoku Grid ──────────────────────────────────────── */

#sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, var(--cell-size));
  grid-template-rows: repeat(9, var(--cell-size));
  border: var(--grid-border) solid var(--grid-box-line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--grid-box-line);
  box-shadow: var(--shadow-lg);
  gap: 0;
  user-select: none;
  touch-action: manipulation;
}

.sudoku-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--cell-font);
  font-weight: 700;
  background: var(--cell-bg);
  color: var(--cell-user-color);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-right: var(--cell-border) solid var(--grid-line);
  border-bottom: var(--cell-border) solid var(--grid-line);
  position: relative;
  overflow: hidden;
}

.sudoku-cell:hover:not(.given):not(.selected) {
  background: color-mix(in srgb, var(--primary) 6%, var(--cell-bg));
}

/* Box borders */
.sudoku-cell.box-left { border-left: 0; }
.sudoku-cell.box-top  { border-top: 0; }
.sudoku-cell.box-right { border-right: 0; }
.sudoku-cell.box-bottom { border-bottom: 0; }

/* 3×3 thick box separators via nth-child */
.sudoku-cell:nth-child(3n):not(:nth-child(9n)) {
  border-right: 2px solid var(--grid-box-line);
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 2px solid var(--grid-box-line);
}

.sudoku-cell.given {
  background: var(--cell-given-bg);
  color: var(--cell-given-color);
  cursor: default;
  font-weight: 800;
}

.sudoku-cell.selected {
  background: var(--cell-selected-bg);
  color: var(--primary);
  z-index: 1;
}

.sudoku-cell.peer {
  background: var(--cell-peer-bg);
}

.sudoku-cell.same-digit {
  background: var(--cell-same-digit-bg);
}

.sudoku-cell.conflict {
  background: var(--cell-conflict-bg);
  color: var(--cell-conflict-color);
}

.sudoku-cell.correct {
  color: var(--cell-correct-color);
}

/* Shake animation for mistakes */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.sudoku-cell.shake {
  animation: shake 0.35s ease;
}

/* Notes grid inside cell */
.sudoku-cell.has-notes {
  cursor: pointer;
}

.note-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 1px;
}

.note-grid span {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(6px, 1.5vw, 9px);
  font-weight: 600;
  color: var(--note-color);
  line-height: 1;
}

/* ── Controls below grid ──────────────────────────────── */

.grid-controls {
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: space-between;
}

.ctrl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  min-width: 48px;
}

.ctrl-btn:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--primary);
}

.ctrl-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.ctrl-btn .ctrl-icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* ── Number Pad ───────────────────────────────────────── */

#number-pad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  width: 100%;
}

.num-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: clamp(14px, 3vw, 22px);
  font-weight: 700;
  color: var(--primary);
  transition: background var(--transition), border-color var(--transition), transform 0.1s;
}

.num-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: scale(1.08);
}

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

/* ── Congrats Overlay ─────────────────────────────────── */

.congrats-overlay {
  position: absolute;
  inset: -8px;
  background: color-mix(in srgb, var(--primary) 92%, #000);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  transition: opacity 0.35s ease, transform 0.35s ease;
  z-index: 10;
  gap: 16px;
  color: #fff;
}

.congrats-overlay.visible {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}

.congrats-title {
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  font-weight: 900;
  color: #fff;
}

.congrats-sub {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.8);
  max-width: 280px;
}

.btn-congrats {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 100px;
  border: none;
  text-decoration: none;
  transition: background var(--transition), transform var(--transition);
  box-shadow: 0 4px 16px rgba(255,107,53,0.4);
  cursor: pointer;
}

.btn-congrats:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
  color: #fff;
  text-decoration: none;
}

/* Confetti canvas */
#confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── Daily sidebar ────────────────────────────────────── */

.daily-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 280px;
}

.daily-info-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
}

.daily-info-card h4 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.difficulty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.diff-chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: background var(--transition), color var(--transition);
}

.diff-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.diff-chip:hover {
  background: var(--primary-light);
  color: #fff;
  border-color: var(--primary-light);
}

.tip-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.tip-text strong {
  color: var(--text);
}

@media (max-width: 860px) {
  .daily-inner {
    grid-template-columns: 1fr;
  }
  .daily-sidebar {
    max-width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .daily-info-card {
    flex: 1;
    min-width: 200px;
  }
}

@media (max-width: 600px) {
  :root {
    --cell-size: clamp(32px, 10.5vw, 44px);
    --cell-font: clamp(14px, 4.5vw, 22px);
  }
  #number-pad {
    gap: 4px;
  }
}

/* ── Stats section ────────────────────────────────────── */

.stats {
  background: var(--primary);
  color: #fff;
}

.stats .section-header h2 {
  color: #fff;
}

.stats .section-header p {
  color: rgba(255,255,255,0.85);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  text-align: center;
}

.stat-card {
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 28px 16px;
  border: 1px solid rgba(255,255,255,0.15);
  transition: background var(--transition), transform var(--transition);
}

.stat-card:hover {
  background: rgba(255,255,255,0.18);
  transform: translateY(-4px);
}

.stat-num {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  color: #fff;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.85rem;
  color: #fff;
  font-weight: 600;
}

@media (max-width: 700px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Testimonials ─────────────────────────────────────── */

.testimonials {
  background: var(--surface);
}

.quotes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.quote-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 28px 24px;
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}

.quote-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.quote-card .quote-stars {
  color: #f5a623;
  font-size: 1rem;
  margin-bottom: 14px;
  letter-spacing: 2px;
}

.quote-card blockquote {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 14px;
  font-style: italic;
}

.quote-card .quote-author {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* ── CTA Banner ───────────────────────────────────────── */

.cta-banner {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  padding: 96px 0;
  text-align: center;
  color: #fff;
}

.cta-banner h2 {
  color: #fff;
  margin-bottom: 16px;
}

.cta-banner p {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.8);
  margin-bottom: 36px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.btn-cta-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #c44e1a;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 16px 40px;
  border-radius: 100px;
  border: none;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  box-shadow: 0 6px 24px rgba(196,78,26,0.45);
  cursor: pointer;
}

.btn-cta-banner:hover {
  background: #a34015;
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(163,64,21,0.55);
  color: #fff;
  text-decoration: none;
}

/* ── Footer ───────────────────────────────────────────── */

footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-logo {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--text);
  text-decoration: none;
}

.footer-logo .logo-accent {
  color: var(--accent);
}

.footer-center {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 12px;
  align-items: center;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-lang-btn {
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  padding: 5px 14px;
  border-radius: 100px;
  color: var(--text);
  transition: background var(--transition), border-color var(--transition);
}

.footer-lang-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── Fade-in animations ───────────────────────────────── */

.fade-in {
  transform: translateY(20px);
  transition: transform 0.5s ease;
}

.fade-in.visible {
  transform: translateY(0);
}

/* stagger cards */
.feature-card:nth-child(2) { transition-delay: 0.05s; }
.feature-card:nth-child(3) { transition-delay: 0.10s; }
.feature-card:nth-child(4) { transition-delay: 0.15s; }
.feature-card:nth-child(5) { transition-delay: 0.20s; }
.feature-card:nth-child(6) { transition-delay: 0.25s; }
.feature-card:nth-child(7) { transition-delay: 0.30s; }
.feature-card:nth-child(8) { transition-delay: 0.35s; }
.feature-card:nth-child(9) { transition-delay: 0.40s; }

.stat-card:nth-child(2) { transition-delay: 0.08s; }
.stat-card:nth-child(3) { transition-delay: 0.16s; }
.stat-card:nth-child(4) { transition-delay: 0.24s; }
.stat-card:nth-child(5) { transition-delay: 0.32s; }
.stat-card:nth-child(6) { transition-delay: 0.40s; }

.quote-card:nth-child(2) { transition-delay: 0.10s; }
.quote-card:nth-child(3) { transition-delay: 0.20s; }

/* ── Hero grid theme demo ─────────────────────────────── */

.hero-grid-demo {
  transition: background 0.5s ease;
}

.hero-grid-demo[data-theme="classic"] {
  background: #ffffff;
  --cell-bg: #ffffff;
  --cell-given-bg: #eef1fc;
  --cell-given-color: #1a1f3a;
  --grid-box-line: #2255cc;
  --grid-line: #c8ceea;
  --cell-selected-bg: #c5d4f8;
  --primary: #2255cc;
}

.hero-grid-demo[data-theme="modern"] {
  background: #161928;
  --cell-bg: #161928;
  --cell-given-bg: #1e2448;
  --cell-given-color: #c8d4f8;
  --grid-box-line: #4d7aee;
  --grid-line: #2a3050;
  --cell-selected-bg: #2a3a6a;
  --primary: #4d7aee;
}

.hero-grid-demo[data-theme="amoled"] {
  background: #000000;
  --cell-bg: #000000;
  --cell-given-bg: #0a0a18;
  --cell-given-color: #b8ccff;
  --grid-box-line: #4466ff;
  --grid-line: #111122;
  --cell-selected-bg: #1a2a5a;
  --primary: #4466ff;
}

.hero-grid-demo[data-theme="warm"] {
  background: #f5f0e8;
  --cell-bg: #fdfaf4;
  --cell-given-bg: #f0e6d0;
  --cell-given-color: #3d2a05;
  --grid-box-line: #9b7828;
  --grid-line: #d4c090;
  --cell-selected-bg: #e8ddb0;
  --primary: #9b7828;
}

.hero-grid-demo[data-theme="forest"] {
  background: #0a1a0a;
  --cell-bg: #0d1f0d;
  --cell-given-bg: #162816;
  --cell-given-color: #a8d4a8;
  --grid-box-line: #4a9c4a;
  --grid-line: #1e3a1e;
  --cell-selected-bg: #203820;
  --primary: #4a9c4a;
}

.hero-grid-demo[data-theme="vegas"] {
  background: #0a0010;
  --cell-bg: #0e0018;
  --cell-given-bg: #1c0030;
  --cell-given-color: #ffd700;
  --grid-box-line: #ff0066;
  --grid-line: #380060;
  --cell-selected-bg: #2a0055;
  --primary: #ff0066;
}

.hero-grid-demo[data-theme="pixel"] {
  background: #0f0f23;
  --cell-bg: #16213e;
  --cell-given-bg: #0d2040;
  --cell-given-color: #f0e040;
  --grid-box-line: #8080ff;
  --grid-line: #3a3a88;
  --cell-selected-bg: #1a3a6a;
  --primary: #40e0ff;
}

.hero-grid-demo[data-theme="pixel"] .mini-cell {
  border-radius: 0;
  image-rendering: pixelated;
}

.hero-grid-demo[data-theme="matrix"] {
  background: #000000;
  --cell-bg: #000500;
  --cell-given-bg: #001200;
  --cell-given-color: #00ff41;
  --grid-box-line: #00aa00;
  --grid-line: #001e00;
  --cell-selected-bg: #002200;
  --primary: #00ff41;
}

.hero-grid-demo[data-theme="matrix"] .mini-cell {
  border-radius: 0;
  color: #00cc33;
  font-family: 'Courier New', monospace;
}

.hero-grid-demo[data-theme="matrix"] .mini-header,
.hero-grid-demo[data-theme="matrix"] .mini-num,
.hero-grid-demo[data-theme="matrix"] .mini-ctrl {
  border-radius: 0;
  font-family: 'Courier New', monospace;
}

.hero-grid-demo[data-theme="ugly"] {
  background: #00ff44;
  --cell-bg: #ffff00;
  --cell-given-bg: #ff6600;
  --cell-given-color: #000000;
  --grid-box-line: #ff00cc;
  --grid-line: #ff0099;
  --cell-selected-bg: #00ffff;
  --primary: #cc0000;
}

.hero-grid-demo[data-theme="ugly"] .mini-cell,
.hero-grid-demo[data-theme="ugly"] .mini-header,
.hero-grid-demo[data-theme="ugly"] .mini-num,
.hero-grid-demo[data-theme="ugly"] .mini-ctrl {
  font-family: 'Comic Sans MS', 'Comic Sans', cursive;
}

/* ── Modes section ───────────────────────────────────────────────── */
.modes-section { padding: 5rem 0; background: var(--bg-alt, rgba(128,128,128,0.03)); }
.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
}
.mode-tile {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  padding: 1.25rem 0.75rem;
  background: var(--card-bg, rgba(255,255,255,0.05));
  border: 1px solid var(--border, rgba(128,128,128,0.15));
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  text-align: center;
}
.mode-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-color: var(--accent, #2255cc);
}
.mode-tile__icon { font-size: 2rem; line-height: 1; }
.mode-tile__name { font-weight: 700; font-size: 0.9rem; }
.mode-tile__desc { font-size: 0.72rem; opacity: 0.65; line-height: 1.3; }
.mode-tile--killer { border-color: rgba(255,80,80,0.3); }
.mode-tile--diagonal { border-color: rgba(100,160,255,0.3); }

/* ── FAQ ──────────────────────────────────────────────── */

.faq-section { padding: 4rem 0; }

.faq-section .section-title {
  text-align: center;
  margin-bottom: 2rem;
}

.faq-list { max-width: 700px; margin: 0 auto; display: flex; flex-direction: column; gap: 0.5rem; }

.faq-item {
  border: 1px solid var(--border, rgba(128,128,128,0.2));
  border-radius: 10px;
  overflow: hidden;
  background: var(--card-bg, rgba(128,128,128,0.04));
}

.faq-q {
  padding: 1rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q::after { content: '+'; font-size: 1.2rem; font-weight: 300; color: var(--accent, #2255cc); transition: transform 0.2s; }
details[open] .faq-q::after { transform: rotate(45deg); }
.faq-a { padding: 0 1.25rem 1rem; font-size: 0.88rem; line-height: 1.6; color: var(--text-secondary, #666); margin: 0; }

/* ── Scrollbar (Chrome/Edge) ──────────────────────────── */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}
