:root {
  --bg: #000000;
  --fg: #a8e6a3;
  --fg-soft: #6e9f6a;
  --gold: #FFB000;
  --gold-soft: #9a6a00;
  --orange: #ff9d00;
  --white: #e7ece6;
  --dim: #3c5a3a;
  --danger: #e79a8f;
  --cyan: #8fd6d1;
  --page-width: 102ch;
}

* { box-sizing: border-box; }

html { background: var(--bg); color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: #000;
  color: var(--fg);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 15px;
  line-height: 1.55;
  text-shadow: 0 0 7px rgba(129, 224, 121, .16);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.018) 0,
    rgba(255,255,255,0.018) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: .35;
}

a { color: var(--gold); text-decoration: none; }
a:hover, a:focus-visible { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--gold); color: #000; }

.site-shell {
  width: min(calc(100% - 28px), var(--page-width));
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip-link:focus { left: 12px; top: 12px; background: #000; color: var(--gold); z-index: 999; }

.top-rule, .bottom-rule {
  color: var(--gold-soft);
  white-space: pre;
  overflow: hidden;
  margin: 16px 0 8px;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.brand-stack,
.symbol-stack {
  align-self: start;
}

.symbol-stack {
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand-art,
.nornur-symbol,
.ascii-art,
.spider-art,
.web-art,
.seal-art,
.game-icon {
  white-space: pre;
  margin: 0;
  font: inherit;
  color: var(--gold);
}

.terminal-output,
.ascii-table {
  white-space: pre;
  margin: 0;
  font: inherit;
  color: var(--fg);
}

.brand-art {
  line-height: .95;
  font-size: clamp(7px, 1.1vw, 11px);
  overflow: hidden;
}

.nornur-symbol {
  line-height: 1.05;
  text-align: center;
  font-size: clamp(8px, 1.18vw, 12px);
}

.nornur-symbol--raw {
  font-size: clamp(5px, .72vw, 8px);
  line-height: .92;
  text-align: left;
}

.tagline {
  margin: 7px 0 0;
  color: var(--gold-soft);
}

.symbol-caption {
  margin: 5px 0 0;
  color: var(--gold-soft);
  font-size: .72em;
  letter-spacing: .08em;
  text-transform: lowercase;
}

.nav-wrap { margin: 17px 0 20px; }
.nav-label { color: var(--gold-soft); margin-bottom: 5px; }
.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
}
.main-nav a {
  color: var(--gold);
  white-space: nowrap;
  padding: 0 .25ch;
  text-decoration: none;
}
.main-nav a::before { content: "[ "; color: var(--gold-soft); }
.main-nav a::after { content: " ]"; color: var(--gold-soft); }
.main-nav a[aria-current="page"] { color: var(--gold); }
.main-nav a[aria-current="page"]::before { content: "[>"; color: var(--gold); }
.main-nav a[aria-current="page"]::after { content: "<]"; color: var(--gold); }
.main-nav a:hover,
.main-nav a:focus-visible {
  color: #000;
  background: var(--orange);
  text-decoration: none;
  outline: none;
  box-shadow: 0 0 9px rgba(255, 157, 0, .32);
}
.main-nav a:hover::before,
.main-nav a:hover::after,
.main-nav a:focus-visible::before,
.main-nav a:focus-visible::after {
  color: #000;
}

.page-head { margin: 20px 0 24px; }
.kicker { color: var(--gold-soft); margin: 0 0 4px; }
h1, h2, h3 { font: inherit; margin: 0; color: var(--gold); }
h1 { font-weight: 700; font-size: 1.2rem; }
h1::before { content: ">> "; color: var(--gold); }
h2 { font-weight: 700; margin-bottom: 9px; }
h2::before { content: "+--[ "; color: var(--gold-soft); }
h2::after { content: " ]"; color: var(--gold-soft); }
h3 { font-weight: 700; margin: 18px 0 6px; }

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 31ch);
  gap: 30px;
  align-items: start;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

.page-grid > *,
.two-col > * {
  min-width: 0;
}

.ascii-panel {
  position: relative;
  padding: 14px 2ch 16px;
  margin: 0 0 24px;
}
.ascii-panel::before,
.ascii-panel::after {
  display: block;
  color: var(--dim);
  overflow: hidden;
  white-space: nowrap;
}
.ascii-panel::before { content: "+--------------------------------------------------------------------------------+"; margin: -14px -2ch 12px; }
.ascii-panel::after { content: "+--------------------------------------------------------------------------------+"; margin: 12px -2ch -16px; }

/* Merge only genuinely stacked panel edges. Side-by-side cards keep both top rails. */
.page-grid > div > .ascii-panel + .ascii-panel::before,
.page-grid > aside > .ascii-panel + .ascii-panel::before,
.two-col + .ascii-panel::before,
.ascii-panel + .two-col > .ascii-panel::before {
  display: none;
}

.page-grid > div > .ascii-panel + .ascii-panel,
.page-grid > aside > .ascii-panel + .ascii-panel,
.two-col + .ascii-panel,
.ascii-panel + .two-col > .ascii-panel {
  padding-top: 6px;
}

p { margin: 0 0 12px; }
strong { color: var(--fg); }
.gold { color: var(--gold); }
.soft { color: var(--fg-soft); }
.white { color: var(--fg); }
.cyan { color: var(--gold); }
.danger { color: var(--danger); }

.prompt {
  color: var(--fg-soft);
  margin: 12px 0;
}
.prompt::before { content: "nornur@web:~$ "; color: var(--gold); }

.fake-command { color: var(--fg); }
.cursor {
  display: inline-block;
  width: .65ch;
  height: 1.05em;
  background: currentColor;
  vertical-align: -0.18em;
  animation: blink 1s steps(1,end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.ascii-button {
  display: inline-block;
  margin: 6px 0 10px;
  color: var(--gold);
  font-weight: 700;
}
.ascii-button::before { content: "[ "; color: var(--gold-soft); }
.ascii-button::after { content: " ]"; color: var(--gold-soft); }
.ascii-button:hover::before { content: "[>"; color: var(--gold); }
.ascii-button:hover::after { content: "<]"; color: var(--gold); }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2ch;
}

.ascii-gate-link {
  color: var(--gold);
  font-weight: 700;
  text-decoration: none;
}
.ascii-gate-link:hover,
.ascii-gate-link:focus-visible {
  color: var(--white);
  text-decoration: none;
}

.invite-gateway {
  line-height: 1.08;
  text-align: center;
  overflow-x: auto;
}

.stat-line { display: grid; grid-template-columns: 18ch 1fr; gap: 2ch; margin: 5px 0; }
.stat-line .label { color: var(--fg-soft); }
.stat-line a.label { color: var(--gold); text-decoration: none; }
.stat-line a.label:hover,
.stat-line a.label:focus-visible { color: var(--white); text-decoration: underline; }
.compact-stats .stat-line { grid-template-columns: 1fr; gap: 0; margin-bottom: 10px; }

.ascii-list { list-style: none; padding: 0; margin: 10px 0; }
.ascii-list li { margin: 6px 0; padding-left: 2ch; }
.ascii-list li::before { content: "*"; color: var(--gold); display: inline-block; width: 2ch; margin-left: -2ch; }

.game-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
.game-card > h2 { min-height: 1.55em; }
.game-card::after {
  margin: auto -2ch -16px;
  padding-top: 12px;
}
.two-col > .game-card:nth-child(3) {
  padding-top: 6px;
}
.two-col > .game-card:nth-child(3)::before {
  display: none;
}
.two-col > .game-card:nth-child(3) .game-title-row {
  gap: .5ch;
}
.two-col > .game-card:nth-child(3) .game-title-row h2 {
  min-width: 0;
  white-space: nowrap;
  letter-spacing: -.035em;
}
.game-icon { line-height: 1.05; margin-bottom: 14px; }
.game-visual { display: flex; justify-content: center; overflow-x: auto; }
.palette-icon { font-size: 1.05em; line-height: 1.1; }
.equipment-icon { font-size: .58em; line-height: 1.05; color: var(--gold); }
.point { color: var(--gold); }

.eye-glyph {
  display: inline-block;
  min-width: 1ch;
  text-align: center;
  color: var(--gold);
}
.eye-glyph.is-blinking { color: var(--white); }

.friendly-spider-panel {
  width: min(100%, 56ch);
  margin: 20px auto 24px;
  text-align: center;
}
.friendly-spider-panel .spider-art {
  display: table;
  margin: 0 auto;
  text-align: left;
}

.command-filter {
  width: min(100%, 60ch);
  border: 0;
  border-bottom: 1px dashed var(--dim);
  outline: 0;
  padding: 4px 0 6px;
  background: transparent;
  color: var(--fg);
  font: inherit;
  caret-color: var(--gold);
}
.command-filter:focus { border-bottom-color: var(--gold); }

.command-group { margin: 22px 0 30px; }
.command-group[hidden] { display: none; }
.command-group > summary {
  margin-bottom: 9px;
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.command-group > summary::-webkit-details-marker { display: none; }
.command-group > summary::before { content: "+--[ "; color: var(--white); }
.command-group > summary::after { content: " ] +"; color: var(--white); }
.command-group[open] > summary::after { content: " ] -"; }
.command-row {
  display: grid;
  grid-template-columns: minmax(26ch, 52ch) 1fr;
  gap: 2ch;
  padding: 4px 0;
}
.command-name { color: var(--gold); }
.command-triplet { display: flex; flex-wrap: wrap; gap: 0 .7ch; }
.command-sound { color: var(--gold); }
.command-palette { color: var(--white); }
.command-equipment { color: var(--fg); }
.command-sep { color: var(--dim); }
.command-featured {
  display: inline-block;
  padding: 0 .5ch;
  color: #000;
  background: var(--gold);
  font-weight: 700;
}
.command-desc { color: var(--fg); }
.command-row[hidden] { display: none; }

.ascii-table {
  width: 100%;
  overflow-x: auto;
  line-height: 1.55;
}
.highscore-heading { color: var(--gold); font-weight: 700; }

.highscore-meta { color: var(--fg-soft); margin-bottom: 12px; }

.status-pill { color: var(--gold); }
.status-pill::before { content: "["; color: var(--dim); }
.status-pill::after { content: "]"; color: var(--dim); }

.seal-art { text-align: center; line-height: 1.1; }

.footer {
  margin: 44px 0 24px;
  color: var(--fg-soft);
  font-size: .92em;
}
.footer-rule { color: var(--dim); overflow: hidden; white-space: nowrap; }
.footer-grid { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

.spider-field {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}
.tiny-spider {
  position: absolute;
  color: var(--white);
  opacity: .34;
  white-space: pre;
  line-height: .9;
  font-size: 11px;
  animation: skitter var(--speed, 9.5s) steps(12,end) infinite alternate;
  transform: translate3d(0,0,0);
  text-shadow: 0 0 6px rgba(255,255,255,.12);
}
.tiny-spider.gold-spider { color: var(--white); opacity: .34; }
@keyframes skitter {
  from { transform: translateX(-10px) translateY(0); }
  to { transform: translateX(32px) translateY(8px); }
}

.floating-nornur {
  position: absolute;
  top: 43%;
  right: -4.5rem;
  width: clamp(180px, 22vw, 310px);
  height: auto;
  opacity: .14;
  mix-blend-mode: screen;
  transform-origin: 50% 50%;
  filter: saturate(.92) drop-shadow(0 0 8px rgba(255,176,0,.18));
  animation: nornur-tumble 21s ease-in-out infinite;
  will-change: transform;
}
.floating-nornur.is-wandering {
  top: 0;
  right: auto;
  left: 0;
  animation: none;
}
@keyframes nornur-tumble {
  0% { transform: translate3d(0,0,0) rotate(-6deg) scale(.95); }
  16% { transform: translate3d(-18px,-16px,0) rotate(24deg) scale(1); }
  37% { transform: translate3d(-5px,12px,0) rotate(188deg) scale(.97); }
  54% { transform: translate3d(14px,-7px,0) rotate(337deg) scale(1.03); }
  65% { transform: translate3d(8px,-18px,0) rotate(309deg) scale(.98); }
  83% { transform: translate3d(-15px,9px,0) rotate(548deg) scale(1.02); }
  100% { transform: translate3d(0,0,0) rotate(714deg) scale(.95); }
}

.corner-web {
  position: fixed;
  z-index: 0;
  color: var(--white);
  opacity: .14;
  line-height: 1;
  pointer-events: none;
  white-space: pre;
  font-size: 12px;
}
.corner-web.tl { top: 0; left: 0; }
.corner-web.br { bottom: 0; right: 0; transform: rotate(180deg); }

.spider-secret {
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
}
.spider-secret:hover { color: var(--gold); opacity: 1; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  background: #000;
  color: var(--gold);
  padding: 5px 1ch;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (min-width: 781px) {
  .game-visual { min-height: 19em; align-items: flex-start; overflow: hidden; }
  .game-summary { min-height: 6.2em; }
}

@media (max-width: 780px) {
  body { font-size: 14px; }
  .masthead { grid-template-columns: 1fr; }
  .symbol-stack { justify-self: start; align-items: flex-start; }
  .nornur-symbol { text-align: left; }
  .nornur-symbol--raw { font-size: clamp(5px, 1.5vw, 7px); }
  .page-grid, .two-col { grid-template-columns: 1fr; }
  .page-grid { gap: 8px; }
  .command-row { grid-template-columns: 1fr; gap: 0; margin-bottom: 9px; }
  .brand-art { font-size: clamp(5px, 1.75vw, 8px); }
  .tiny-spider:nth-child(n+9) { display: none; }
  .invite-gateway { font-size: clamp(8px, 2.55vw, 14px); }
  .floating-nornur {
    top: 52%;
    right: -4rem;
    width: min(56vw, 260px);
    opacity: .11;
  }
}

@media (max-width: 480px) {
  .site-shell { width: min(calc(100% - 18px), var(--page-width)); }
  .main-nav { gap: 5px 8px; }
  .ascii-panel { padding-left: 1ch; padding-right: 1ch; }
  .stat-line { grid-template-columns: 1fr; gap: 0; margin-bottom: 10px; }
  .corner-web { opacity: .08; }
  .game-card::after { margin-left: -1ch; margin-right: -1ch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .floating-nornur { animation: none !important; transform: rotate(-6deg); }
}
