/* NEUROPATH — daily game (Mindivr games family) */

:root {
  --void: #0a0b10;
  --bg-1: #0f1118;
  --bg-2: #151823;
  --surface: #181b26;
  --surface-2: #1f2330;
  --text: #eef0f6;
  --muted: #aeb4c4;
  --dim: #6a7082;
  --line: rgba(238, 240, 246, 0.08);
  --line-2: rgba(238, 240, 246, 0.16);
  --np: #4ade80;
  --np-soft: #86efac;
  --np-deep: #22c55e;
  --np-glow: rgba(74, 222, 128, 0.35);
  --start: #fbbf24;
  --end: #f87171;
  --block: #1a2234;
  --display: 'Cormorant Garamond', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(ellipse 55% 45% at 20% 0%, rgba(74, 222, 128, 0.08), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 100%, rgba(45, 212, 191, 0.05), transparent 55%),
    linear-gradient(180deg, var(--void) 0%, var(--bg-1) 60%, var(--void) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--display);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

#bg-dust { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#bg-dust .d {
  position: absolute; width: 2px; height: 2px; background: #fff; border-radius: 50%;
  opacity: 0.28; animation: tw var(--dur, 5s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
@keyframes tw { 0%, 100% { opacity: 0.08; } 50% { opacity: 0.55; } }

.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.035;
  mix-blend-mode: overlay;
  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='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#root { position: relative; z-index: 2; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  background: rgba(10, 11, 16, 0.88); backdrop-filter: blur(12px);
}
.topbar a.brand {
  font-family: var(--display); font-style: italic; font-size: 22px;
  letter-spacing: 0.04em; color: var(--muted); text-decoration: none;
}
.topbar a.brand b { color: var(--np); font-weight: 600; font-style: normal; }
.top-meta {
  display: flex; gap: 10px; align-items: center;
  font-family: var(--mono); font-size: 12px; color: var(--dim);
  letter-spacing: 0.1em; text-transform: uppercase;
}
.top-meta .dot { width: 4px; height: 4px; background: var(--np); border-radius: 50%; }

.stage {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 32px 20px 60px; max-width: 720px; width: 100%; margin: 0 auto;
}

.hero { text-align: center; padding: 36px 0 26px; }
.hero .eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.3em;
  color: var(--np); text-transform: uppercase; margin-bottom: 18px;
}
.hero h1 {
  font-weight: 500; font-size: clamp(48px, 9vw, 82px);
  line-height: 0.95; letter-spacing: -0.02em; margin-bottom: 8px;
}
.hero h1 .grad { font-style: italic; color: var(--np); }
.hero .sub {
  font-style: italic; color: var(--muted); font-size: 17px;
  max-width: 460px; margin: 8px auto 0; line-height: 1.5;
}

.divider {
  display: flex; align-items: center; gap: 12px; margin: 26px 0; width: 100%; max-width: 460px;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--np-deep), transparent);
}
.divider .mark { font-size: 14px; color: var(--np); }

.intro-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line-2); border-radius: 6px;
  padding: 28px; width: 100%; max-width: 500px;
}
.intro-card h2 { font-weight: 500; font-size: 28px; margin-bottom: 12px; }
.intro-card p { color: var(--muted); line-height: 1.6; font-size: 15px; margin-bottom: 14px; }
.intro-rules {
  list-style: none; margin: 16px 0 24px; padding: 16px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.intro-rules li {
  display: flex; gap: 12px; padding: 6px 0; font-size: 14px; color: var(--muted);
}
.intro-rules li .num {
  font-family: var(--mono); color: var(--np); font-size: 11px;
  flex-shrink: 0; width: 18px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 28px; font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; border: none; border-radius: 2px;
  cursor: pointer; transition: all 0.3s var(--ease); width: 100%;
  color: #052010; background: linear-gradient(135deg, var(--np-soft), var(--np));
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px); box-shadow: 0 12px 32px var(--np-glow);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line-2);
}
.btn.ghost:hover:not(:disabled) {
  background: var(--surface); border-color: var(--np); color: var(--text); box-shadow: none;
}

.board-frame { width: 100%; max-width: 420px; margin: 0 auto; }
.board-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 4px 16px; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.2em; color: var(--dim); text-transform: uppercase;
}
.board-header .mode-tag {
  display: inline-flex; align-items: center; gap: 8px; color: var(--np);
}
.board-header .mode-tag::before {
  content: ''; width: 6px; height: 6px; background: var(--np);
  border-radius: 50%; box-shadow: 0 0 8px var(--np);
}
.board-header .timer { color: var(--text); font-size: 14px; letter-spacing: 0.1em; }

.board-shell { position: relative; width: 100%; aspect-ratio: 1; }
.path-svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 1;
}
.board {
  position: relative; z-index: 2; display: grid; gap: 2px;
  width: 100%; height: 100%; user-select: none; touch-action: none;
}
.cell {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 2px; cursor: crosshair;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.cell:hover:not(.blocked) { background: var(--surface-2); }
.cell.in-path { background: rgba(74, 222, 128, 0.1); border-color: rgba(74, 222, 128, 0.35); }
.cell.current { border-color: var(--np); box-shadow: 0 0 12px var(--np-glow); }
.cell.start { border-color: rgba(251, 191, 36, 0.45); }
.cell.end { border-color: rgba(248, 113, 113, 0.4); }
.cell.blocked {
  background: var(--block); border-color: rgba(100, 116, 139, 0.3);
  cursor: not-allowed; pointer-events: none;
}
.cell.blocked::after {
  content: ""; width: 50%; height: 50%;
  background: repeating-linear-gradient(
    135deg, transparent, transparent 2px,
    rgba(100, 116, 139, 0.4) 2px, rgba(100, 116, 139, 0.4) 4px
  );
  border-radius: 1px;
}
.cell-number {
  font-family: var(--mono); font-size: clamp(0.6rem, 3vw, 0.8rem);
  font-weight: 500; color: var(--text);
}
.cell.start .cell-number { color: var(--start); }
.cell.end .cell-number { color: var(--end); }
.cell.in-path .cell-number { color: var(--np-soft); }
.cell-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(238, 240, 246, 0.15);
}
.cell.in-path .cell-dot { background: var(--np); box-shadow: 0 0 6px var(--np-glow); }
.path-line {
  stroke: var(--np); stroke-width: 3; stroke-linecap: round; fill: none;
  opacity: 0.8; filter: drop-shadow(0 0 4px var(--np-glow));
}
.cell.win { animation: winPop 0.35s var(--ease) forwards; }
@keyframes winPop { 50% { transform: scale(1.05); background: rgba(74, 222, 128, 0.2); } }

.controls {
  display: flex; gap: 10px; margin-top: 16px;
}
.controls .info-box {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 16px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  color: var(--muted); text-transform: uppercase;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 2px; padding: 12px 14px;
}
.controls .info-box b { color: var(--np-soft); }
.controls .btn-undo {
  flex: 0 0 auto; width: auto; padding: 12px 18px;
}

.result-card {
  text-align: center; padding: 32px 24px; margin: 24px 0;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line-2); border-radius: 6px;
  width: 100%; max-width: 520px;
}
.result-card .glyph { font-size: 28px; letter-spacing: 0.2em; margin-bottom: 10px; }
.result-card h3 {
  font-style: italic; font-size: 34px; color: var(--np-soft); margin-bottom: 4px;
}
.result-card .aka { color: var(--muted); font-style: italic; margin-bottom: 18px; }
.result-stats {
  display: flex; justify-content: center; gap: 28px; margin: 18px 0 24px;
}
.result-stats .s-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em;
  color: var(--dim); text-transform: uppercase; margin-bottom: 4px;
}
.result-stats .s-value { font-family: var(--mono); font-size: 22px; color: var(--text); }
.result-fact {
  background: var(--void); border-left: 2px solid var(--np);
  padding: 14px 16px; margin: 18px 0; text-align: left;
  font-size: 14px; line-height: 1.6; color: var(--muted); font-style: italic;
}
.result-fact b {
  color: var(--np-soft); font-style: normal; font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  display: block; margin-bottom: 6px;
}
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.leaderboard {
  margin: 32px 0 0; padding: 24px 0 0; border-top: 1px solid var(--line);
  width: 100%; max-width: 520px;
}
.leaderboard h3 { font-style: italic; font-size: 22px; text-align: center; margin-bottom: 4px; }
.leaderboard .lb-sub {
  text-align: center; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.25em; color: var(--dim); text-transform: uppercase; margin-bottom: 18px;
}
.lb-list { list-style: none; }
.lb-row {
  display: grid; grid-template-columns: 32px 1fr auto auto; gap: 12px;
  align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.lb-row.self {
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.08), transparent);
  border-left: 2px solid var(--np); padding-left: 12px;
}
.lb-rank { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.lb-rank.top1 { color: var(--np-soft); font-size: 14px; }
.lb-rank.top2 { color: #d4d4d4; }
.lb-rank.top3 { color: #c79a6b; }
.lb-name {
  font-family: var(--display); color: var(--text); font-size: 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-moves { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.lb-time { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.lb-empty { text-align: center; padding: 20px; color: var(--dim); font-style: italic; font-size: 14px; }
.signin-prompt {
  text-align: center; padding: 18px; background: var(--surface);
  border: 1px dashed var(--line-2); border-radius: 6px; margin-bottom: 16px;
  font-size: 13px; color: var(--muted);
}
.signin-prompt button {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 10px;
  background: var(--text); color: var(--void); border: none;
  padding: 10px 16px; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.15em; text-transform: uppercase; cursor: pointer;
  border-radius: 2px; transition: transform 0.25s;
}
.signin-prompt button:hover { transform: translateY(-1px); }

.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--np); color: var(--text);
  padding: 12px 20px; border-radius: 2px; font-family: var(--mono);
  font-size: 12px; letter-spacing: 0.15em; z-index: 100;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); opacity: 0; transition: opacity 0.3s;
}
.toast.show { opacity: 1; }
.footer-tip {
  text-align: center; font-style: italic; color: var(--dim);
  font-size: 12px; margin-top: 28px; padding: 12px;
}

@media (max-width: 540px) {
  .stage { padding: 20px 14px 40px; }
  .topbar { padding: 14px 16px; }
  .result-stats { gap: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  #bg-dust .d, .cell.win { animation: none !important; }
}
