/* === CSS VARIABLES === */
:root {
  --bg: #F5F0E8;
  --surface: #FFFFFF;
  --surface-2: #FBF8F3;
  --ink: #1A1A2E;
  --ink-light: #4A4A6A;
  --accent: #2D6A4F;
  --accent-rgb: 45,106,79;
  --accent-hover: #235C42;
  --accent2: #E76F51;
  --accent3: #457B9D;
  --muted: #9B8EA0;
  --muted-light: #C8C0B0;
  --grid-line: #C8C0B0;
  --grid-box: #6B5E4E;
  --selected: #D4E6DC;
  --peer: rgba(0,0,0,0.06);
  --match: #FFF0DC;
  --error: #E63946;
  --error-bg: #FFF0F0;
  --given: #1A1A2E;
  --filled: #1A3A6B;  /* solid dark blue — clearly correct, distinguishable from black */
  --pencil: #457B9D;
  --success: #2D6A4F;
  --shadow: 0 4px 24px rgba(26,26,46,0.10);
  --shadow-lg: 0 8px 40px rgba(26,26,46,0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
  --wash: rgba(69, 123, 157, 0.05);
}
[data-theme="dark"] {
  --bg: #13131F;
  --surface: #1E1E30;
  --surface-2: #252538;
  --ink: #F0EDE8;
  --ink-light: #B0AAC0;
  --accent: #52B788;
  --accent-hover: #40A876;
  --accent2: #E76F51;
  --accent3: #74B3CE;
  --muted: #6B6080;
  --muted-light: #3A3450;
  --grid-line: #3A3450;
  --grid-box: #B0AAC0;
  --selected: #1E3A2F;
  --peer: rgba(255,255,255,0.06);
  --match: #3A2A18;
  --given: #F0EDE8;
  --filled: #74B3CE;  /* dark theme — clear blue */
  --pencil: #74B3CE;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
}
[data-theme="sepia"] {
  --bg: #F2E8D9;
  --surface: #FDF6EC;
  --surface-2: #F8F0E2;
  --ink: #1A1A2E;
  --ink-light: #4A4A6A;
  --accent: #8B4513;
  --accent-hover: #7A3C10;
  --accent2: #D2691E;
  --accent3: #6B7C3A;
  --grid-line: #C4A882;
  --grid-box: #8B6914;
  --selected: #F0DEC0;
  --peer: #F8F0E0;
  --match: #FFE8C0;
  --given: #2C1810;
  --filled: #1A3A6B;  /* dark blue works on sepia too */
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--bg-tint, transparent);
  pointer-events: none;
  z-index: 0;
  transition: background 0.8s ease;
}

/* === NAVIGATION === */
#nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--muted-light);
  box-shadow: var(--shadow);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--accent);
  cursor: pointer;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.nav-logo span { color: var(--accent); }
.nav-logo-dot {
  width: 8px; height: 8px;
  background: var(--accent2);
  border-radius: 50%;
  display: inline-block;
  margin-bottom: 2px;
}
.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}
.nav-links a {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  letter-spacing: 0.01em;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--selected);
  color: var(--accent);
}
.nav-streak {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent2);
  background: rgba(231, 111, 81, 0.1);
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
}
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 5px;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: all 0.3s;
}
.mobile-menu {
  display: none;
  position: fixed;
  top: 60px; left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--muted-light);
  padding: 16px;
  z-index: 99;
  flex-direction: column;
  gap: 4px;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
}
.mobile-menu a:hover { background: var(--selected); color: var(--accent); }

/* Ad banner below nav */
.ad-top {
  background: var(--surface-2);
  border-bottom: 1px solid var(--muted-light);
  text-align: center;
  padding: 8px;
}
.ad-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.ad-slot {
  display: block;
  /* Invisible until AdSense injects content */
  min-height: 0;
  overflow: hidden;
}
.ad-slot:empty { display: none; }
.ad-slot-728 { width: min(728px, 100%); height: 90px; margin: 0 auto; }
.ad-slot-300 { width: 300px; height: 250px; }

/* === PAGE SYSTEM === */
.page { display: none; animation: fadeSlideIn 0.3s ease; }
.page.active { display: block; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUpIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 4px 20px 20px;
  position: relative;
  z-index: 1;
}

/* === HOME PAGE === */
.home-hero {
  text-align: center;
  padding: 2px 0 2px;
}
.puzzle-title-wrap {
  margin-bottom: 8px;
}
.puzzle-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.puzzle-name {
  font-family: 'Cinzel', 'Playfair Display', serif;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--grid-box);
  line-height: 1.05;
  margin-bottom: 2px;
  transition: color 0.5s ease;
}
.puzzle-eyebrow { margin-bottom: 2px; }
.puzzle-eyebrow { margin-bottom: 0; }
.puzzle-name { margin-bottom: 0 !important; }
.puzzle-meta {
  font-size: 0.83rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 6px;
}
.social-proof {
  background: var(--surface);
  border: 1px solid var(--muted-light);
  border-radius: 30px;
  padding: 7px 16px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-light);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  justify-content: center;
}
.social-live { color: var(--accent); display: flex; align-items: center; gap: 5px; }
.live-dot {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.social-divider { color: var(--muted-light); }

/* === GAME LAYOUT === */
.game-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}
@media (min-width: 900px) {
  .game-layout {
    grid-template-columns: 180px 1fr 180px;
    gap: 24px;
  }
}
.game-sidebar-left, .game-sidebar-right {
  display: none;
}
@media (min-width: 900px) {
  .game-sidebar-left, .game-sidebar-right { display: block; padding-top: 44px; }
}
.game-center { display: flex; flex-direction: column; align-items: center; gap: 4px; }

/* === GRID === */
.grid-wrap {
  position: relative;
  display: inline-block;
  background: transparent;
  transition: filter 0.5s ease;
}
.grid-wrap.diamond-glow {
  filter: drop-shadow(3px 3px 3px rgba(26,26,46,0.18)) drop-shadow(-3px 3px 3px rgba(26,26,46,0.18));
}
.grid-diamond-wrap {
  background: transparent;
}
#sudoku-grid.grid-diamond + .grid-wash,
.grid-wrap:has(#sudoku-grid.grid-diamond) {
  background: transparent !important;
}
.grid-wash {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  pointer-events: none;
  z-index: 0;
  transition: background 0.5s ease;
}
#sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  border: 3px solid var(--grid-box);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  width: min(90vw, 480px);
  height: min(90vw, 480px);
  background: var(--surface);
}
#sudoku-grid.grid-6x6 {
  grid-template-columns: repeat(6, 1fr) !important;
}
.grid-diamond-wrap {
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Diamond grid CSS removed — pending trademark © RFUSA LLC */

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Roboto Mono', monospace;
  font-size: clamp(1.1rem, 4.5vw, 1.6rem);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  position: relative;
  border-right: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
  user-select: none;
  background: var(--surface);
  color: var(--given);
  aspect-ratio: 1;
}
.cell:focus { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 2; }
.cell.given { color: var(--given); font-weight: 700; }
.cell.filled { color: var(--filled); }
.cell.error { color: var(--error); background: var(--error-bg) !important; animation: shake 0.3s; }
.cell.check-error { outline: 2px solid var(--error); outline-offset: -2px; background: var(--error-bg) !important; animation: shake 0.3s; }
.cell.selected { background: var(--selected) !important; }
.cell.peer { background: var(--peer); }
.cell.match { background: var(--match); }
.cell.completed { animation: cellPop 0.4s ease forwards; }
@keyframes cellPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); background: var(--selected); }
  100% { transform: scale(1); }
}

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

/* Box borders for 9x9 */
.cell.box-right { border-right: 2.5px solid var(--grid-box); }
.cell.box-bottom { border-bottom: 2.5px solid var(--grid-box); }

/* Pencil marks */
.cell.notes-mode .cell-num { display: none; }
.pencil-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%; height: 100%;
  padding: 1px;
}
.pencil-num {
  font-family: 'Roboto Mono', monospace;
  font-size: clamp(0.35rem, 1.2vw, 0.55rem);
  color: var(--pencil);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* === CONTROLS === */
.controls-wrap {
  width: min(72vw, 420px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.control-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 0;
  width: 100%;
}
.control-row .icon-btn {
  padding: 4px 2px;
  justify-content: center;
  gap: 0;
}
.ctrl-btn {
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.ctrl-icon {
  font-size: 1rem;
  line-height: 1.2;
}
.ctrl-label {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--muted);
}
.ctrl-btn:hover .ctrl-label { color: var(--accent); }
.ctrl-btn.active .ctrl-label { color: white; }
.numpad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 0;
}
.num-btn {
  font-family: 'Roboto Mono', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 10px 4px;
  border: 2px solid var(--muted-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--grid-box);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.num-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.num-btn:active { transform: scale(0.94); box-shadow: none; }
.num-btn:focus { outline: none; }
.num-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num-btn:active { transform: translateY(0); }
.icon-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--muted-light);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all var(--transition);
  white-space: nowrap;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.icon-btn:focus { outline: none; }
button:focus:not(:focus-visible) { outline: none; }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.icon-btn.danger:hover { border-color: var(--error); color: var(--error); }
.erase-btn { border-color: var(--muted-light); }

/* === TIMER === */
.timer-display {
  font-family: 'Cinzel', 'Roboto Mono', monospace;
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.12em;
  text-align: center;
}
.timer-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 12px 20px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--muted-light);
  box-shadow: var(--shadow);
}

/* === SIDEBAR CARDS === */
.sidebar-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--muted-light);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.sidebar-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--surface-2);
  font-size: 0.83rem;
}
.stat-row:last-child { border-bottom: none; }
.stat-val { font-weight: 700; color: var(--accent); font-family: 'Roboto Mono', monospace; }
.streak-big {
  text-align: center;
  padding: 8px 0;
}
.streak-number {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent2);
  line-height: 1;
}
.streak-label { font-size: 0.75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; }

/* Hall of fame mini */
.hof-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--surface-2);
}
.hof-rank { font-weight: 700; color: var(--muted); width: 18px; font-family: 'Roboto Mono', monospace; }
.hof-name { flex: 1; color: var(--ink-light); }
.hof-time { font-family: 'Roboto Mono', monospace; color: var(--accent); font-weight: 600; }

/* === VARIANT CARDS === */
.variants-section { margin-top: 32px; }
.variants-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 16px;
  text-align: center;
}
.variants-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  max-width: 760px;
  margin: 0 auto;
}
.variant-card {
  flex: 0 1 calc(33% - 12px);
  min-width: 155px;
}
@media (max-width: 640px) {
  .variant-card { flex: 0 1 calc(50% - 12px); }
}
.variant-card {
  background: var(--surface);
  border: 2px solid var(--muted-light);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  box-shadow: var(--shadow);
}
.variant-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.variant-card.active-variant { border-color: var(--accent); background: var(--selected); }
.variant-icon { font-size: 1.8rem; margin-bottom: 8px; }
.variant-name { font-family: 'Playfair Display', serif; font-size: 0.95rem; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.variant-desc { font-size: 0.75rem; color: var(--muted); margin-bottom: 8px; line-height: 1.4; }


/* === COMPLETION MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,46,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--surface);
  border-radius: 20px;
  padding: 40px 32px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-emoji { font-size: 3rem; margin-bottom: 12px; animation: bounceIn 0.5s ease; }
@keyframes bounceIn {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.modal-title { font-family: 'Playfair Display', serif; font-size: 1.7rem; font-weight: 600; color: var(--ink); margin-bottom: 4px; font-style: italic; }
.modal-subtitle { font-size: 0.9rem; color: var(--muted); margin-bottom: 24px; }
.modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.modal-stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 8px; }
.modal-stat-val { font-family: 'Roboto Mono', monospace; font-size: 1.6rem; font-weight: 700; color: var(--accent); letter-spacing: 0.05em; }
.modal-stat-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }
.share-card {
  background: var(--surface-2);
  border: 1px solid var(--muted-light);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.9;
  text-align: left;
  margin-bottom: 20px;
  white-space: pre-wrap;
}
.modal-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-primary {
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 30px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(45,106,79,0.3); }
.btn-primary:focus { outline: none; }
.btn-secondary:focus { outline: none; }
.btn-secondary {
  padding: 12px 24px;
  background: transparent;
  color: var(--ink-light);
  border: 2px solid var(--muted-light);
  border-radius: 30px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* === CONFETTI === */
.confetti-wrap { position: fixed; inset: 0; pointer-events: none; z-index: 190; overflow: hidden; }
.confetto {
  position: absolute;
  top: -10px;
  width: 8px; height: 8px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* === STATISTICS PAGE === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--muted-light);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card-val { font-family: 'Playfair Display', serif; font-size: 2.2rem; font-weight: 700; color: var(--accent); line-height: 1; margin-bottom: 6px; }
.stat-card-label { font-size: 0.78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--muted-light);
}
.activity-grid {
  display: flex;
  gap: 6px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.activity-day {
  width: 36px; height: 36px;
  border-radius: 6px;
  background: var(--muted-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  flex-direction: column;
  gap: 1px;
  opacity: 0.5;
  transition: all var(--transition);
}
.activity-day.solved { background: var(--accent); color: white; opacity: 1; }
.activity-day.today { border: 2px solid var(--accent2); opacity: 1; }
.hof-table { width: 100%; border-collapse: collapse; }
.hof-table th { text-align: left; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 8px 12px; border-bottom: 2px solid var(--muted-light); }
.hof-table td { padding: 10px 12px; border-bottom: 1px solid var(--surface-2); font-size: 0.85rem; color: var(--ink-light); }
.hof-table tr:last-child td { border-bottom: none; }
.hof-table .rank { font-weight: 700; color: var(--muted); font-family: 'Roboto Mono', monospace; }
.hof-table .time { font-family: 'Roboto Mono', monospace; color: var(--accent); font-weight: 600; }
.hof-table .gold { color: #F4A629; }
.hof-table .silver { color: #9BA4B5; }
.hof-table .bronze { color: #CD7F32; }

/* === SETTINGS PAGE === */
.settings-group { background: var(--surface); border: 1px solid var(--muted-light); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; box-shadow: var(--shadow); }
.settings-group-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); padding: 14px 18px; background: var(--surface-2); border-bottom: 1px solid var(--muted-light); }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--surface-2); }
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.setting-desc { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.toggle-switch {
  position: relative;
  width: 44px; height: 24px;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--muted-light);
  border-radius: 24px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.theme-btns { display: flex; gap: 8px; }
.theme-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}
.theme-btn:hover, .theme-btn.active { border-color: var(--ink); transform: scale(1.15); }
.select-input {
  padding: 7px 12px;
  border: 2px solid var(--muted-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239B8EA0' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* === ARCHIVE PAGE === */
.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.archive-card {
  background: var(--surface);
  border: 1px solid var(--muted-light);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}
.archive-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.archive-date { font-size: 0.7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.archive-name { font-family: 'Playfair Display', serif; font-size: 1rem; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.archive-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 700; padding: 3px 8px; border-radius: 10px; }
.badge-solved { background: rgba(45,106,79,0.1); color: var(--accent); }
.badge-unsolved { background: rgba(231,111,81,0.1); color: var(--accent2); }
.badge-unplayed { background: var(--surface-2); color: var(--muted); }

/* === ABOUT PAGE === */
.about-hero {
  background: linear-gradient(135deg, var(--surface) 0%, var(--selected) 100%);
  border-radius: 20px;
  padding: 48px 40px;
  text-align: center;
  margin-bottom: 32px;
  border: 1px solid var(--muted-light);
}
.about-logo { font-family: 'Playfair Display', serif; font-size: 2.5rem; font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.about-logo span { color: var(--accent); }
.about-tagline { font-size: 1.1rem; color: var(--ink-light); font-style: italic; }
.about-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin: 32px 0; }
.feature-card { background: var(--surface); border-radius: var(--radius); padding: 24px; border: 1px solid var(--muted-light); box-shadow: var(--shadow); }
.feature-icon { font-size: 2rem; margin-bottom: 12px; }
.feature-title { font-family: 'Playfair Display', serif; font-size: 1rem; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.feature-text { font-size: 0.83rem; color: var(--ink-light); line-height: 1.6; }
.prose { max-width: 680px; margin: 0 auto; }
.prose h2 { font-family: 'Playfair Display', serif; font-size: 1.5rem; font-weight: 600; color: var(--ink); margin: 32px 0 12px; }
.prose p { font-size: 0.92rem; color: var(--ink-light); line-height: 1.8; margin-bottom: 16px; }
.prose ul { padding-left: 20px; margin-bottom: 16px; }
.prose li { font-size: 0.92rem; color: var(--ink-light); line-height: 1.8; margin-bottom: 6px; }

/* === FOOTER === */
footer {
  background: var(--surface);
  border-top: 1px solid var(--muted-light);
  padding: 32px 20px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-logo { font-family: 'Playfair Display', serif; font-size: 1.2rem; font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.footer-logo span { color: var(--accent); }
.footer-links { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.footer-links a { font-size: 0.82rem; color: var(--muted); text-decoration: none; cursor: pointer; transition: color var(--transition); font-weight: 600; }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: 0.75rem; color: var(--muted); }

/* === THEME CHOOSER === */
.theme-group-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--muted-light);
}
.theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.theme-swatch {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 3px;
  overflow: hidden;
}
.theme-swatch:hover { transform: scale(1.12); border-color: var(--ink); }
.theme-swatch.active-swatch { border-color: var(--ink); transform: scale(1.08); }
.theme-swatch-label {
  font-size: 0.42rem;
  font-weight: 700;
  color: rgba(0,0,0,0.6);
  text-align: center;
  line-height: 1.2;
  padding: 1px 2px;
  background: rgba(255,255,255,0.6);
  border-radius: 2px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === DIAMOND NUMPAD === */
.diamond-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  gap: 0;
}
.diamond-numpad-wrap {
  display: flex;
  width: 100%;
  justify-content: center;
  gap: 0;
}
.diamond-triangle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px;
}
.diamond-triangle.left { align-items: flex-end; }
.diamond-triangle.right { align-items: flex-start; }
.diamond-row {
  display: flex;
  gap: 4px;
}
.diamond-foundation {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
  margin-top: 4px;
}
/* === RESPONSIVE === */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .nav-streak { font-size: 0.78rem; padding: 4px 10px; }
  #sudoku-grid { width: 95vw; height: 95vw; }
  .controls-wrap { width: 95vw; }
  .numpad { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .num-btn { font-size: 1.15rem; padding: 13px 4px; }
  .icon-btn { font-size: 0.75rem; padding: 7px 10px; }
}
@media (min-width: 641px) and (max-width: 899px) {
  .nav-links li:not(:nth-child(-n+4)) { display: none; }
}

/* === PAUSE OVERLAY === */
.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(245,240,232,0.95);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--ink-light);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.pause-overlay.visible { opacity: 1; pointer-events: all; }
[data-theme="dark"] .pause-overlay { background: rgba(19,19,31,0.95); }

/* Difficulty badge */
.diff-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.diff-easy { background: rgba(45,106,79,0.12); color: var(--accent); }
.diff-medium { background: rgba(69,123,157,0.12); color: var(--accent3); }
.diff-hard { background: rgba(231,111,81,0.12); color: var(--accent2); }
.diff-expert { background: rgba(230,57,70,0.12); color: var(--error); }

/* Mistake counter */
.mistake-counter {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--error);
}
.mistake-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--error); opacity: 0.3; }
.mistake-dot.used { opacity: 1; }

/* Hint flash */
.cell.hint-flash {
  animation: hintFlash 1.6s ease forwards;
  z-index: 5;
}
@keyframes hintFlash {
  0%   { box-shadow: inset 0 0 0 0px var(--accent); transform: scale(1); }
  25%  { box-shadow: inset 0 0 0 4px var(--accent); transform: scale(1.12); }
  60%  { box-shadow: inset 0 0 0 3px var(--accent); transform: scale(1.06); }
  100% { box-shadow: inset 0 0 0 0px var(--accent); transform: scale(1); }
}

/* Page header */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-family: 'Playfair Display', serif; font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.page-header p { font-size: 0.9rem; color: var(--muted); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: white;
  padding: 10px 24px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 300;
  transition: transform 0.3s ease;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Mobile bottom nav */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--muted-light);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
  justify-content: space-around;
}
@media (max-width: 640px) { .bottom-nav { display: flex; } body { padding-bottom: 70px; } }
.bottom-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.6rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color var(--transition);
}
.bottom-nav-btn.active { color: var(--accent); }
.bottom-nav-btn svg { width: 22px; height: 22px; }

/* Killer sudoku cage sum labels */
.cage-sum {
  position: absolute;
  top: 2px; left: 3px;
  font-size: clamp(0.38rem, 1.1vw, 0.52rem);
  font-family: 'Roboto Mono', monospace;
  color: var(--accent3);
  font-weight: 700;
  line-height: 1;
  z-index: 2;
  pointer-events: none;
}
