/* The North Game — Topographic Glacier & Tactical North.
   One place for the design tokens; every surface reads from them. */

:root {
  --ground: #0b0e14;
  --panel: #111827;
  --ink: #f8fafc;
  --dim: #94a3b8;
  --accent: #00e5ff;
  --indigo: #6366f1;
  --amber: #fbbf24;
  --glass: rgba(255, 255, 255, 0.03);
  --line: rgba(0, 229, 255, 0.16);
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --wrap: 1180px;
  --r: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#topo { position: fixed; inset: 0; z-index: 0; opacity: 0.5; pointer-events: none; }
main, .nav, .foot { position: relative; z-index: 1; }

h1, h2, h3, h4 { font-family: var(--display); line-height: 1.12; margin: 0 0 0.5em; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.mono { font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.02em; }
.dim { color: var(--dim); }
.accent { color: var(--accent); }
.lede { color: #cbd5e1; font-size: 1.05rem; max-width: 62ch; }
.huge { font-size: clamp(2.4rem, 8vw, 4.5rem); }
.grad { background: linear-gradient(100deg, var(--accent), var(--indigo)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.18em; color: var(--accent); }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.sec { padding: 3.5rem 0; }
.sec-head { margin-bottom: 2rem; }
.pad { padding: 1.6rem; }
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r);
  backdrop-filter: blur(9px);
}

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 50; background: var(--panel); padding: 0.6rem 1rem; border-radius: 8px; }

/* nav */
.nav { position: sticky; top: 0; z-index: 20; background: rgba(11, 14, 20, 0.82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.nav-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; }
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-txt { display: flex; flex-direction: column; font-family: var(--display); font-size: 1.05rem; line-height: 1.05; }
.brand-txt strong { font-weight: 700; }
.brand-txt em { font-style: normal; color: var(--accent); }
.brand-txt small { color: var(--dim); font-size: 0.62rem; letter-spacing: 0.1em; }
.menu { display: flex; align-items: center; gap: 1.15rem; }
.menu a { color: #cbd5e1; font-size: 0.92rem; }
.menu a.on { color: var(--accent); }
.menu a:hover { color: var(--ink); text-decoration: none; }
.sfx-toggle { background: transparent; border: 1px solid var(--line); color: var(--dim); border-radius: 999px; padding: 0.3rem 0.7rem; cursor: pointer; }
.sfx-toggle[aria-pressed='true'] span { color: var(--accent); }
.burger { display: none; background: none; border: 0; cursor: pointer; padding: 0.4rem; }
.burger span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 4px 0; transition: 0.2s; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--mono); font-size: 0.82rem;
  padding: 0.62rem 1.15rem; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
  color: var(--ink); cursor: pointer; transition: 0.18s;
}
.btn:hover { border-color: var(--accent); background: rgba(0, 229, 255, 0.08); text-decoration: none; }
.btn.primary { background: var(--accent); color: #04131a; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { box-shadow: 0 0 24px rgba(0, 229, 255, 0.35); }
.btn.small { padding: 0.35rem 0.75rem; font-size: 0.72rem; }
.btn.big { padding: 0.85rem 1.8rem; font-size: 0.95rem; }
.cta { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.4rem 0; }

/* hero */
.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 2.5rem; align-items: center; padding: 4rem 0 2rem; }
.hero-stats, .cond-hero .hero-stats { display: flex; flex-wrap: wrap; gap: 1.6rem; margin: 1.6rem 0 0; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats dt { color: var(--dim); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em; }
.hero-stats dd { margin: 0.2rem 0 0; font-size: 1.35rem; font-family: var(--mono); }
.hero-map { padding: 1rem; }
.panel-head { display: flex; justify-content: space-between; margin-bottom: 0.6rem; color: var(--accent); }
#vectormap { width: 100%; height: auto; display: block; }
.map-key { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; padding: 0.8rem 0 0; margin: 0; color: var(--dim); }
.map-key li { display: flex; align-items: center; gap: 0.35rem; font-size: 0.7rem; }
.map-key i { width: 8px; height: 8px; border-radius: 50%; }

.strip { display: flex; flex-wrap: wrap; align-items: center; gap: 1.6rem; padding: 1rem 1.4rem; }
.strip div { display: flex; flex-direction: column; }
.strip span { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.62rem; }
.strip .btn { margin-left: auto; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 1.1rem; }
.card {
  --accent: #00e5ff;
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 1.3rem; border-radius: var(--r); color: var(--ink);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); text-decoration: none; }
.card-top { display: flex; justify-content: space-between; }
.card .tag { color: var(--accent); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.64rem; }
.card h3 { margin: 0.2rem 0 0; font-size: 1.35rem; }
.card-stats { display: flex; gap: 1.2rem; margin: 0.7rem 0 0; }
.card-stats dt { color: var(--dim); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.12em; }
.card-stats dd { margin: 0; font-size: 0.8rem; }
.card-go { margin-top: 0.9rem; color: var(--accent); }

.tier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.tier { padding: 1.2rem; }
.tier h3 { text-transform: uppercase; letter-spacing: 0.14em; color: var(--accent); font-size: 0.8rem; }
.tier p:nth-of-type(1) { font-size: 1.6rem; margin: 0.1rem 0 0.6rem; }
.tier p:last-child { color: var(--dim); font-size: 0.9rem; margin: 0; }

.cta-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 2.2rem; }

/* tables */
.table-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 640px; }
.tbl th, .tbl td { text-align: left; padding: 0.75rem 0.8rem; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.tbl th { font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--accent); }
.tbl .num { text-align: right; }
.tbl tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

/* game page */
.crumbs { margin-bottom: 1rem; color: var(--dim); }
.game-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; align-items: flex-end; margin-bottom: 1.4rem; }
.game-elev { display: flex; gap: 1.5rem; padding: 0.9rem 1.2rem; }
.game-elev dt { color: var(--dim); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.12em; }
.game-elev dd { margin: 0.15rem 0 0; font-size: 1rem; }

.stage { padding: 0.8rem; }
.hud { display: flex; flex-wrap: wrap; align-items: center; gap: 1.1rem; padding: 0 0.4rem 0.7rem; }
.hud-cell { display: flex; flex-direction: column; min-width: 62px; }
.hud-cell span { color: var(--dim); font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.14em; }
.hud-cell strong { font-size: 1rem; font-weight: 600; }
.hud-cell.grow { margin-right: auto; }
.canvas-wrap { position: relative; border-radius: 10px; overflow: hidden; background: #060910; }
canvas.play { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; touch-action: none; cursor: crosshair; }

.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 1.5rem; background: rgba(6, 9, 16, 0.88); backdrop-filter: blur(6px); text-align: center; }
.overlay.hidden { display: none; }
.overlay-in { max-width: 560px; }
.overlay-in .lede { margin-inline: auto; }
.tier-pick { border: 0; margin: 1.2rem 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.tier-pick legend { color: var(--dim); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 0.5rem; }
.tier-opt { display: flex; align-items: center; gap: 0.4rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.4rem 0.8rem; cursor: pointer; }
.tier-opt:has(input:checked) { border-color: var(--accent); background: rgba(0, 229, 255, 0.1); }
.tier-opt input { accent-color: var(--accent); }
.save-row { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; align-items: center; margin: 1rem 0; }
.save-row input, .fld input, .fld textarea, .fld select {
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: 0.55rem 0.8rem; font-family: var(--mono); font-size: 0.85rem;
}

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.controls div { display: flex; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.controls dt { color: var(--accent); min-width: 46%; }
.controls dd { margin: 0; color: var(--dim); font-size: 0.9rem; }
.board { list-style: none; padding: 0; margin: 0.8rem 0; counter-reset: r; }
.board li { display: flex; justify-content: space-between; gap: 0.8rem; padding: 0.42rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.board li b { font-weight: 600; color: var(--accent); }
.board-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.4rem; }
.tab { background: transparent; border: 1px solid var(--line); color: var(--dim); border-radius: 999px; padding: 0.4rem 1rem; cursor: pointer; font-family: var(--mono); font-size: 0.78rem; }
.tab.on { border-color: var(--accent); color: var(--accent); background: rgba(0, 229, 255, 0.08); }
.board-head { display: flex; justify-content: space-between; align-items: baseline; }
.board-card h2 { font-size: 1.1rem; margin: 0; }
.board-card h2 a { color: var(--accent); }

/* manual + misc */
.manual section { margin-bottom: 1.1rem; }
.ticks, .steps { padding-left: 1.2rem; color: #cbd5e1; }
.ticks li, .steps li { margin: 0.35rem 0; }
.bands { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.band { display: flex; align-items: center; gap: 0.4rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.75rem; color: var(--dim); }
.band i { font-style: normal; color: var(--accent); }
code, kbd { font-family: var(--mono); background: rgba(255, 255, 255, 0.06); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.85em; }
.cond-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: center; }
.fld { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.9rem; }
.fld span { color: var(--dim); }
.notfound { text-align: center; padding: 6rem 0; }

/* footer */
.foot { border-top: 1px solid var(--line); margin-top: 3rem; padding: 2.5rem 0 1.5rem; background: rgba(17, 24, 39, 0.5); }
.foot-in { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 2rem; }
.foot h4 { font-size: 1.1rem; }
.foot h5 { font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--accent); margin: 0 0 0.7rem; }
.foot ul { list-style: none; padding: 0; margin: 0; }
.foot li { margin: 0.3rem 0; }
.foot li a { color: var(--dim); font-size: 0.88rem; }
.foot li a:hover { color: var(--accent); }
.foot p { color: var(--dim); font-size: 0.88rem; }
.foot-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; padding-top: 1.4rem; margin-top: 1.4rem; border-top: 1px solid rgba(255, 255, 255, 0.06); color: var(--dim); }

/* sonar ping */
.ring { position: fixed; border: 1px solid var(--accent); border-radius: 50%; pointer-events: none; z-index: 60; animation: ring 0.6s ease-out forwards; }
@keyframes ring { from { width: 0; height: 0; opacity: 0.8; } to { width: 120px; height: 120px; opacity: 0; margin: -60px 0 0 -60px; } }

@media (max-width: 900px) {
  .hero, .cols, .cond-hero { grid-template-columns: 1fr; }
  .foot-in { grid-template-columns: 1fr 1fr; }
  .burger { display: block; }
  .menu { position: absolute; top: 100%; right: 0; left: 0; flex-direction: column; align-items: flex-start; gap: 0.9rem; padding: 1.2rem 1.5rem; background: rgba(11, 14, 20, 0.98); border-bottom: 1px solid var(--line); display: none; }
  .menu.open { display: flex; }
}
@media (max-width: 560px) {
  .foot-in { grid-template-columns: 1fr; }
  .game-elev { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  #topo { display: none; }
}
