/* ══════════════════════════════════════════════════
   Number Sudoku — Global Styles
   ══════════════════════════════════════════════════ */

:root {
  --primary: #3D5A99;
  --primary-light: #e0e7f3;
  --primary-lighter: #f0f3fa;
  --primary-dark: #2c4478;
  --accent: #22C55E;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1a2340;
  --text-sec: #6b7999;
  --border: #dfe3ee;
  --grid-bg: #ffffff;
  --cell-bg: #ffffff;
  --cell-selected: #3D5A99;
  --cell-highlight: #e0e7f3;
  --cell-same: #cdd6ea;
  --cell-given: #1a2340;
  --cell-user: #3D5A99;
  --cell-error: #dc3545;
  --cell-notes: #8b96b0;
  --grid-line: #d0d5e2;
  --box-line: #1a2340;
  --shadow: 0 2px 20px rgba(0,0,0,0.06);
  --numpad-bg: #e8ecf5;
  --numpad-text: #3D5A99;
  --radius: 12px;
}

[data-theme="dark"] {
  --bg: #0d1321;
  --card: #1a2340;
  --text: #e8ecf5;
  --text-sec: #8b96b0;
  --border: #2a3558;
  --grid-bg: #1a2340;
  --cell-bg: #1a2340;
  --cell-selected: #3D5A99;
  --cell-highlight: #232e4a;
  --cell-same: #2a3a62;
  --cell-given: #e8ecf5;
  --cell-user: #7b9ad8;
  --cell-notes: #5a6888;
  --grid-line: #2a3558;
  --box-line: #7b9ad8;
  --shadow: 0 2px 20px rgba(0,0,0,0.3);
  --numpad-bg: #232e4a;
  --numpad-text: #7b9ad8;
  --primary-light: #232e4a;
  --primary-lighter: #1a2340;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
  line-height: 1.5;
}

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

/* ─── HEADER ─── */
.ns-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 28px; background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.ns-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 800; font-size: 20px;
  color: var(--primary); cursor: pointer; user-select: none;
  text-decoration: none;
}
.ns-logo:hover { text-decoration: none; }
.ns-nav { display: flex; gap: 2px; align-items: center; }
.ns-nav-link {
  padding: 8px 18px; border-radius: 8px; border: none; cursor: pointer;
  font-weight: 500; font-size: 14px; font-family: 'DM Sans', sans-serif;
  background: transparent; color: var(--text-sec); transition: all 0.2s;
  text-decoration: none; display: inline-block;
}
.ns-nav-link:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.ns-nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.ns-hdr-right { display: flex; gap: 10px; align-items: center; }
.ns-icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-sec); transition: all 0.2s; font-family: inherit;
}
.ns-icon-btn:hover { background: var(--primary-light); color: var(--primary); }
.ns-play-btn {
  padding: 9px 24px; border-radius: 10px; border: none;
  background: var(--primary); color: #fff; font-weight: 700;
  font-size: 14px; font-family: 'DM Sans', sans-serif; cursor: pointer;
  transition: all 0.2s; box-shadow: 0 2px 12px rgba(61,90,153,0.3);
  text-decoration: none; display: inline-block;
}
.ns-play-btn:hover { box-shadow: 0 4px 20px rgba(61,90,153,0.45); transform: translateY(-1px); text-decoration: none; }

/* ─── CONTAINERS ─── */
.ns-main { max-width: 1100px; margin: 0 auto; padding: 20px 24px; }
.ns-content-page { max-width: 720px; margin: 0 auto; padding: 40px 24px; }
.ns-content-page h1 { font-family: 'Outfit', sans-serif; font-size: 28px; font-weight: 800; margin-bottom: 20px; }
.ns-content-page h2 { font-family: 'Outfit', sans-serif; font-size: 20px; font-weight: 700; margin: 28px 0 10px; }
.ns-content-page p { margin-bottom: 14px; color: var(--text-sec); line-height: 1.7; font-size: 15px; }
.ns-content-page ul { margin: 0 0 14px 24px; color: var(--text-sec); font-size: 15px; line-height: 1.7; }

/* ─── AD BANNER ─── */
.ns-ad {
  background: var(--primary-lighter); border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 14px; text-align: center;
  color: var(--text-sec); font-size: 11px; letter-spacing: 1px;
  margin-bottom: 20px;
}

/* ─── HERO ─── */
.ns-hero { text-align: center; padding: 48px 0 44px; }
.ns-hero h1 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(26px, 4.5vw, 42px); font-weight: 800; line-height: 1.15;
  margin-bottom: 14px;
}
.ns-hero h1 span {
  background: linear-gradient(135deg, var(--primary), #5b7cc4);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.ns-hero p { font-size: 16px; color: var(--text-sec); max-width: 420px; margin: 0 auto 32px; line-height: 1.6; }
.ns-hero-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ─── BUTTONS ─── */
.ns-btn-primary {
  padding: 13px 32px; border-radius: 12px; border: none; cursor: pointer;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 15px;
  font-family: 'DM Sans', sans-serif; transition: all 0.2s;
  box-shadow: 0 3px 14px rgba(61,90,153,0.35); display: inline-block; text-decoration: none;
}
.ns-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(61,90,153,0.45); text-decoration: none; }
.ns-btn-outline {
  padding: 13px 32px; border-radius: 12px; border: 2px solid var(--accent);
  cursor: pointer; background: transparent; color: var(--accent);
  font-weight: 700; font-size: 15px; font-family: 'DM Sans', sans-serif; transition: all 0.2s;
  display: inline-block; text-decoration: none;
}
.ns-btn-outline:hover { background: rgba(34,197,94,0.06); text-decoration: none; }
.ns-btn-continue {
  padding: 13px 32px; border-radius: 12px; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
  font-family: 'DM Sans', sans-serif; box-shadow: 0 3px 14px rgba(34,197,94,0.3);
  display: inline-block; text-decoration: none;
}

/* ─── DIFFICULTY CARDS ─── */
.ns-diff-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin-bottom: 36px;
}
.ns-diff-card {
  background: var(--card); border: 1.5px solid var(--border); border-radius: 16px;
  padding: 28px 18px; cursor: pointer; text-align: center;
  transition: all 0.25s; box-shadow: var(--shadow); font-family: inherit;
}
.ns-diff-card:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: 0 8px 30px rgba(61,90,153,0.14); }
.ns-diff-emoji { font-size: 34px; margin-bottom: 10px; }
.ns-diff-label { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 17px; margin-bottom: 4px; }
.ns-diff-desc { font-size: 12px; color: var(--text-sec); margin-bottom: 6px; }
.ns-diff-clues { font-size: 11px; color: var(--primary); font-weight: 600; }

/* ─── DAILY SECTION ─── */
.ns-daily-row { display: grid; grid-template-columns: 1fr 250px; gap: 20px; margin-bottom: 36px; }
.ns-daily-card {
  background: var(--card); border-radius: 16px; padding: 28px;
  box-shadow: var(--shadow); border: 1.5px solid var(--border); text-align: center;
}
.ns-daily-hdr { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 14px; }
.ns-daily-hdr h2 { font-family: 'Outfit', sans-serif; font-size: 19px; font-weight: 700; }
.ns-badge { background: rgba(34,197,94,0.12); color: var(--accent); padding: 3px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.ns-streak { display: flex; align-items: center; justify-content: center; gap: 5px; color: #f59e0b; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.ns-cd-label { font-size: 10px; color: var(--text-sec); letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 4px; }
.ns-cd-time { font-family: 'Outfit', sans-serif; font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; margin-bottom: 18px; }

/* ─── GAME LAYOUT ─── */
.ns-game-layout { display: flex; gap: 32px; align-items: flex-start; justify-content: center; }
.ns-game-left { flex-shrink: 0; }

.ns-diff-tabs { display: flex; gap: 0; margin-bottom: 14px; align-items: center; }
.ns-diff-tabs span { font-size: 13px; color: var(--text-sec); font-weight: 500; margin-right: 8px; }
.ns-diff-tab {
  padding: 5px 14px; border: none; background: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500;
  color: var(--text-sec); transition: all 0.15s; border-radius: 6px;
}
.ns-diff-tab:hover { color: var(--primary); }
.ns-diff-tab.active { color: var(--primary); font-weight: 700; }

/* GRID */
.ns-grid-outer {
  display: inline-block; border: 3px solid var(--box-line);
  border-radius: 4px; background: var(--grid-bg);
  box-shadow: var(--shadow); overflow: hidden;
}
.ns-grid-row { display: flex; }
.ns-cell {
  width: clamp(38px, 6.2vw, 58px); height: clamp(38px, 6.2vw, 58px);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
  font-family: 'Outfit', sans-serif; font-variant-numeric: tabular-nums;
  user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background 0.1s; background: var(--cell-bg);
}
.ns-cell.given { font-weight: 700; font-size: clamp(18px, 3.4vw, 28px); color: var(--cell-given); }
.ns-cell.user { font-weight: 600; font-size: clamp(17px, 3.2vw, 26px); color: var(--cell-user); }
.ns-cell.selected { background: var(--cell-selected) !important; color: #fff !important; }
.ns-cell.highlighted { background: var(--cell-highlight); }
.ns-cell.same-num { background: var(--cell-same); }
.ns-cell.error { color: var(--cell-error) !important; }
.ns-cell.selected.error { color: #fecaca !important; }
.ns-cell.br-box { border-right: 3px solid var(--box-line) !important; }
.ns-cell.bb-box { border-bottom: 3px solid var(--box-line) !important; }
.ns-cell.br-thin { border-right: 1px solid var(--grid-line); }
.ns-cell.bb-thin { border-bottom: 1px solid var(--grid-line); }

.ns-notes-g {
  display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(3,1fr);
  position: absolute; inset: 2px; pointer-events: none;
}
.ns-note-n {
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(7px, 1.4vw, 10px); font-weight: 500;
  color: var(--cell-notes); font-family: 'DM Sans', sans-serif;
}

/* ─── RIGHT PANEL ─── */
.ns-game-right { min-width: 240px; max-width: 300px; flex-shrink: 0; }
.ns-info-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; padding: 0 4px; }
.ns-info-item { font-size: 13px; color: var(--text-sec); font-weight: 500; }
.ns-info-item strong { color: var(--text); font-weight: 700; }
.ns-info-item.err strong { color: var(--cell-error); }
.ns-timer-val { font-variant-numeric: tabular-nums; font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 15px; color: var(--text); }
.ns-pause-btn { background: none; border: none; cursor: pointer; color: var(--text-sec); font-size: 16px; margin-left: 6px; vertical-align: middle; }
.ns-pause-btn:hover { color: var(--primary); }

.ns-actions { display: grid; grid-template-columns: repeat(5,1fr); gap: 6px; margin-bottom: 18px; }
.ns-act-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 10px 2px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--card);
  cursor: pointer; color: var(--text-sec); font-family: 'DM Sans', sans-serif;
  font-size: 9px; font-weight: 600; transition: all 0.2s; position: relative;
}
.ns-act-btn svg { width: 18px; height: 18px; }
.ns-act-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.ns-act-btn.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.ns-act-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.ns-act-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--primary); color: #fff; font-size: 9px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.ns-act-toggle {
  position: absolute; top: -4px; right: -4px;
  background: var(--text-sec); color: #fff; font-size: 8px; font-weight: 700;
  padding: 1px 5px; border-radius: 8px;
}
.ns-act-btn.active .ns-act-toggle { background: var(--primary); }

/* NUMBER PAD */
.ns-numpad { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 18px; }
.ns-num-btn {
  aspect-ratio: 1; border-radius: 14px; border: 1.5px solid var(--border);
  background: var(--numpad-bg); color: var(--numpad-text);
  font-family: 'Outfit', sans-serif; font-size: clamp(26px, 4vw, 38px); font-weight: 700;
  cursor: pointer; transition: all 0.12s;
  display: flex; align-items: center; justify-content: center;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.ns-num-btn:hover { background: var(--cell-same); transform: scale(1.04); border-color: var(--primary); }
.ns-num-btn:active { transform: scale(0.96); }
.ns-num-btn.sel { background: var(--primary) !important; color: #fff !important; border-color: var(--primary) !important; box-shadow: 0 4px 16px rgba(61,90,153,0.4); }
.ns-num-btn.done { opacity: 0.2; pointer-events: none; }

.ns-bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.ns-bottom-btn {
  padding: 14px; border-radius: 14px; border: 1.5px solid var(--border);
  background: var(--numpad-bg); font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 700; color: var(--numpad-text);
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.ns-bottom-btn:hover { background: var(--cell-same); border-color: var(--primary); }

.ns-newgame {
  width: 100%; padding: 16px; border-radius: 14px; border: none;
  background: var(--primary); color: #fff;
  font-family: 'Outfit', sans-serif; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 3px 16px rgba(61,90,153,0.3); margin-bottom: 12px;
}
.ns-newgame:hover { box-shadow: 0 6px 24px rgba(61,90,153,0.45); transform: translateY(-1px); }

.ns-back {
  display: block; text-align: center; width: 100%;
  background: none; border: none; color: var(--text-sec);
  cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: 13px; padding: 8px;
}
.ns-back:hover { color: var(--primary); }

/* ─── OVERLAYS ─── */
.ns-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; animation: nsFadeIn 0.2s ease;
}
@keyframes nsFadeIn { from{opacity:0} to{opacity:1} }
.ns-modal {
  background: var(--card); border-radius: 24px; padding: 44px 40px;
  text-align: center; max-width: 380px; width: 90%;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25); animation: nsSlideUp 0.3s ease;
}
@keyframes nsSlideUp { from{transform:translateY(20px);opacity:0} to{transform:none;opacity:1} }
.ns-modal-emoji { font-size: 52px; margin-bottom: 14px; }
.ns-modal h2 { font-family: 'Outfit', sans-serif; font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.ns-modal p { color: var(--text-sec); margin-bottom: 6px; font-size: 15px; }
.ns-modal-btns { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }

.ns-pause-ov { text-align: center; color: #fff; }
.ns-pause-ov h2 { font-family: 'Outfit', sans-serif; font-size: 28px; font-weight: 800; color: #fff; }
.ns-pause-ov p { opacity: 0.7; margin-top: 8px; color: #fff; font-size: 15px; }

/* ─── FOOTER ─── */
.ns-footer {
  text-align: center; padding: 28px 24px 18px;
  border-top: 1px solid var(--border); color: var(--text-sec); font-size: 12px;
  margin-top: 20px;
}
.ns-footer a { color: var(--text-sec); margin: 0 10px; }
.ns-footer a:hover { color: var(--primary); }

/* ─── RESPONSIVE ─── */
@media (max-width: 720px) {
  .ns-game-layout { flex-direction: column; align-items: center; }
  .ns-game-right { min-width: unset; max-width: 100%; width: 100%; max-width: 380px; }
  .ns-cell { width: clamp(34px, 10vw, 48px); height: clamp(34px, 10vw, 48px); }
  .ns-daily-row { grid-template-columns: 1fr; }
  .ns-nav { display: none; }
  .ns-header { padding: 10px 16px; }
  .ns-main { padding: 14px 10px; }
}
@media (max-width: 420px) {
  .ns-cell { width: clamp(32px, 10.5vw, 42px); height: clamp(32px, 10.5vw, 42px); }
  .ns-num-btn { font-size: 24px; }
}

/* ─── SETTINGS MODAL ─── */
.ns-settings-modal {
  background: var(--card); border-radius: 16px; padding: 28px 32px 32px;
  width: 100%; max-width: 460px; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25); animation: nsSlideUp 0.3s ease;
  position: relative;
}
.ns-settings-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.ns-settings-hdr h2 {
  font-family: 'Outfit', sans-serif; font-size: 22px; font-weight: 800; margin: 0;
}
.ns-settings-close {
  background: none; border: none; cursor: pointer; color: var(--text-sec);
  font-size: 18px; padding: 4px 8px; border-radius: 6px; line-height: 1;
  transition: background 0.15s;
}
.ns-settings-close:hover { background: var(--border); color: var(--text); }
.ns-settings-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: var(--text-sec); margin-bottom: 12px; text-transform: uppercase;
}
.ns-setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0; border-bottom: 1px solid var(--border);
}
.ns-setting-row:last-child { border-bottom: none; }
.ns-setting-label {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  font-size: 15px; font-weight: 500; width: 100%;
}
.ns-setting-chk {
  width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0;
}
.ns-setting-new {
  font-size: 10px; font-weight: 700; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 4px; padding: 2px 6px; margin-left: 6px; letter-spacing: 0.5px;
}

/* ─── INTRO POPUP (NYT-style) ─── */
.ns-intro-modal {
  background: var(--card); border-radius: 16px; overflow: hidden;
  width: 100%; max-width: 360px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.28); animation: nsSlideUp 0.3s ease;
  position: relative;
}
.ns-intro-preview {
  background: #f5a623; padding: 28px 24px 24px;
  display: flex; align-items: center; justify-content: center; min-height: 190px;
}
.ns-intro-grid-mini {
  background: #fff; border-radius: 8px; overflow: hidden;
  display: inline-block; box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.ns-ig-row { display: flex; }
.ns-ig-cell {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; border: 0.5px solid #ddd; color: #333;
  font-family: 'DM Sans', sans-serif;
}
.ns-ig-given { background: #f7efe0; color: #555; }
.ns-ig-sel { background: #3D5A99; color: #fff; }
.ns-intro-body {
  padding: 22px 24px 26px;
}
.ns-intro-badge {
  font-size: 10px; font-weight: 800; color: var(--primary); letter-spacing: 1px;
  text-transform: uppercase; display: block; margin-bottom: 6px;
}
.ns-intro-body h3 {
  font-family: 'Outfit', sans-serif; font-size: 18px; font-weight: 800;
  margin: 0 0 8px; line-height: 1.3;
}
.ns-intro-body p { color: var(--text-sec); font-size: 14px; line-height: 1.5; margin: 0; }
