/* ============================================
   SUDOKU — Futuristic / Cyberpunk design system
   Dark mode, neon, holographic, glitch aesthetic
   ============================================ */

:root {
  /* Type */
  --font-display: "Space Grotesk", "Inter Tight", -apple-system, sans-serif;
  --font-sans: "Inter Tight", "Inter", -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-serif: "Space Grotesk", sans-serif; /* alias kept for legacy refs */

  /* Color — deep space */
  --bg-0: #05060B;          /* deepest void */
  --bg-1: #0A0E1A;          /* base */
  --bg-2: #10162B;          /* elevated */
  --bg-3: #1A2240;          /* card */
  --bg-4: #232C50;          /* hover */

  --paper: var(--bg-1);
  --paper-2: var(--bg-2);
  --paper-3: var(--bg-3);

  --ink: #E8ECFF;           /* primary text */
  --ink-2: #B8BFE0;         /* secondary */
  --ink-3: #6B779E;         /* tertiary */
  --ink-4: #3D466B;         /* faded */

  --rule: #1F2747;          /* hairlines */
  --rule-glow: #2A3568;

  /* Accents — neon */
  --accent-cyan: #00F0FF;        /* primary neon */
  --accent-magenta: #FF2D9C;     /* hot pink */
  --accent-violet: #8B5CF6;      /* violet */
  --accent-lime: #C6FF3D;        /* acid green */
  --accent-amber: #FFB800;       /* warning */
  --accent-red: #FF3860;         /* error */
  --accent-blue: #4A8FFF;

  /* Map legacy names so existing markup still works */
  --accent-yellow: var(--accent-lime);
  --accent-green: var(--accent-cyan);
  --accent-coral: var(--accent-magenta);

  /* Sudoku-specific */
  --cell-bg: rgba(15, 21, 45, 0.4);
  --cell-bg-related: rgba(0, 240, 255, 0.06);
  --cell-bg-same: rgba(0, 240, 255, 0.16);
  --cell-bg-selected: rgba(0, 240, 255, 0.28);
  --cell-bg-error: rgba(255, 56, 96, 0.18);
  --cell-given: var(--ink);
  --cell-input: var(--accent-cyan);
  --cell-error: var(--accent-red);

  /* Spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* Radii */
  --r-1: 2px; --r-2: 4px; --r-3: 8px; --r-pill: 999px;

  /* Shadows / glows */
  --glow-cyan: 0 0 20px rgba(0, 240, 255, 0.4), 0 0 40px rgba(0, 240, 255, 0.15);
  --glow-magenta: 0 0 20px rgba(255, 45, 156, 0.4), 0 0 40px rgba(255, 45, 156, 0.15);
  --glow-lime: 0 0 16px rgba(198, 255, 61, 0.5);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04), 0 12px 40px rgba(0, 0, 0, 0.6);
  --shadow-pop: 0 1px 0 rgba(255,255,255,0.06), 0 24px 60px rgba(0, 240, 255, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(ellipse 80% 60% at 70% -10%, rgba(139, 92, 246, 0.15), transparent),
    radial-gradient(ellipse 60% 50% at 10% 110%, rgba(0, 240, 255, 0.12), transparent),
    var(--bg-0);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* Subtle animated grid backdrop */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black, transparent);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black, transparent);
}

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ---------- Typography utilities ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.92;
}

.serif { font-family: var(--font-display); }
.sans  { font-family: var(--font-sans); }
.mono  { font-family: var(--font-mono); }

/* ---------- Top nav (masthead) ---------- */
.masthead {
  border-bottom: 1px solid var(--rule);
  background: rgba(5, 6, 11, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.masthead::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), var(--accent-magenta), transparent);
  opacity: 0.6;
}
.masthead-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 32px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}
.masthead-date {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  text-transform: uppercase;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.masthead-date::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-lime);
  box-shadow: 0 0 8px var(--accent-lime);
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.masthead-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.masthead-logo .dot {
  color: var(--accent-magenta);
  text-shadow: 0 0 10px var(--accent-magenta);
}
.masthead-logo .glyph {
  display: inline-block;
  width: 22px; height: 22px;
  background:
    linear-gradient(45deg, var(--accent-cyan), var(--accent-magenta));
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  box-shadow: var(--glow-cyan);
}
.masthead-nav {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.masthead-nav a {
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-2);
  transition: all .15s ease;
  position: relative;
}
.masthead-nav a:hover {
  border-color: var(--rule-glow);
  color: var(--accent-cyan);
}
.masthead-nav a.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: inset 0 0 12px rgba(0, 240, 255, 0.15);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 14px 26px;
  border-radius: var(--r-2);
  transition: all .18s ease;
  border: 1px solid transparent;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.16), transparent 70%);
  transform: translateX(-100%);
  transition: transform .5s ease;
}
.btn:hover::before { transform: translateX(100%); }
.btn-primary {
  background: var(--accent-cyan);
  color: var(--bg-0);
  box-shadow: var(--glow-cyan);
}
.btn-primary:hover {
  background: white;
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-glow);
}
.btn-ghost:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}
.btn-accent {
  background: var(--accent-magenta);
  color: white;
  box-shadow: var(--glow-magenta);
}
.btn-accent:hover { background: var(--accent-cyan); color: var(--bg-0); box-shadow: var(--glow-cyan); }
.btn:active { transform: translateY(1px); }
.btn-lg {
  padding: 18px 34px;
  font-size: 13px;
}

/* ---------- Page container ---------- */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}
.container-narrow {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--rule);
  margin-top: 96px;
  padding: 32px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

/* ---------- Pills/Tags ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: var(--r-2);
  background: rgba(0, 240, 255, 0.08);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.3);
}
.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.pill-red    { background: rgba(255,56,96,0.1);  color: var(--accent-red);     border-color: rgba(255,56,96,0.4); }
.pill-blue   { background: rgba(74,143,255,0.1); color: var(--accent-blue);    border-color: rgba(74,143,255,0.4); }
.pill-yellow { background: rgba(198,255,61,0.1); color: var(--accent-lime);    border-color: rgba(198,255,61,0.4); }
.pill-green  { background: rgba(0,240,255,0.1);  color: var(--accent-cyan);    border-color: rgba(0,240,255,0.4); }

/* ---------- Section heading ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 14px;
  margin-bottom: 28px;
  position: relative;
}
.section-head::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 80px; height: 1px;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 0;
  text-transform: uppercase;
}
.section-head .section-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(135deg, rgba(26,34,64,0.5), rgba(16,22,43,0.5));
  border: 1px solid var(--rule);
  border-radius: var(--r-3);
  padding: 24px;
  position: relative;
  backdrop-filter: blur(10px);
}

/* corner brackets — futuristic chrome */
.brackets {
  position: relative;
}
.brackets::before, .brackets::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border-color: var(--accent-cyan);
  border-style: solid;
}
.brackets::before {
  top: -1px; left: -1px;
  border-width: 1px 0 0 1px;
}
.brackets::after {
  bottom: -1px; right: -1px;
  border-width: 0 1px 1px 0;
}

/* dot rule */
.dot-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-3);
}
.dot-rule::before, .dot-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
  opacity: .6;
}

/* selection */
::selection {
  background: var(--accent-cyan);
  color: var(--bg-0);
}

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--rule-glow); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-cyan); }
