:root {
  --fg: #33ff66;
  --fg-rgb: 51, 255, 102;
  --fg-dim: #1c9c42;
  --fg-faint: rgba(51, 255, 102, 0.12);
  --bg: #040a06;
  --bg-2: #07130b;
  --solvenda: #03364b;
  --solvenda-2: #304962;
  --beige: #d9d0b8;
  --beige-dark: #b3a88c;
  --glow: 0 0 2px rgba(var(--fg-rgb), 0.9), 0 0 10px rgba(var(--fg-rgb), 0.45), 0 0 24px rgba(var(--fg-rgb), 0.2);
  --font: "VT323", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-pixel: "Press Start 2P", var(--font);
  --max: 1240px;
}

body.amber {
  --fg: #ffb000;
  --fg-rgb: 255, 176, 0;
  --fg-dim: #a8740a;
  --fg-faint: rgba(255, 176, 0, 0.12);
  --bg: #0b0700;
  --bg-2: #140d02;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 0%, var(--bg-2) 0%, var(--bg) 70%) fixed,
    var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: clamp(1.35rem, 1.15rem + 0.6vw, 1.7rem);
  line-height: 1.35;
  text-shadow: var(--glow);
  -webkit-font-smoothing: antialiased;
  transition: color 0.4s, background-color 0.4s;
}

/* Scanlines + vignette ovanpå allt */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
}

body::before {
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.28) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  animation: flicker 6s infinite steps(1);
}

body::after {
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  41% { opacity: 0.85; }
  42% { opacity: 1; }
  77% { opacity: 0.92; }
  78% { opacity: 1; }
}

::selection {
  background: var(--fg);
  color: var(--bg);
  text-shadow: none;
}

a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.2em;
}

a:hover,
a:focus-visible {
  background: var(--fg);
  color: var(--bg);
  text-shadow: none;
  text-decoration: none;
}

:focus-visible {
  outline: 2px dashed var(--fg);
  outline-offset: 3px;
}

b,
strong {
  font-weight: normal;
  color: #fff;
  text-shadow: var(--glow);
}

.dim {
  color: var(--fg-dim);
}

kbd {
  font-family: var(--font);
  display: inline-block;
  padding: 0 0.35em;
  margin: 0 0.1em;
  border: 1px solid var(--fg-dim);
  border-bottom-width: 3px;
  border-radius: 3px;
  line-height: 1.1;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  padding: 0.5rem 1rem;
  background: var(--fg);
  color: var(--bg);
}

/* ---------- Boot ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: #000;
  padding: clamp(1rem, 4vw, 3rem);
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.35s;
}

.boot.is-done {
  opacity: 0;
  pointer-events: none;
}

.boot__text {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(1.1rem, 1rem + 0.6vw, 1.6rem);
  white-space: pre-wrap;
  color: #c8c8c8;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.35);
}

.boot__text .ok {
  color: var(--fg);
  text-shadow: var(--glow);
}

.boot__skip {
  position: absolute;
  bottom: 1.5rem;
  left: clamp(1rem, 4vw, 3rem);
  right: 1rem;
  margin: 0;
  color: #777;
  text-shadow: none;
}

/* ---------- Menyrad ---------- */
.menubar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.35rem clamp(0.75rem, 3vw, 2rem);
  background: var(--solvenda);
  border-bottom: 2px solid var(--fg-dim);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.menubar__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  text-decoration: none;
  letter-spacing: 0.1em;
}

.menubar__logo {
  width: 1.8rem;
  height: 1.75rem;
  overflow: visible;
  filter: drop-shadow(0 0 4px rgba(var(--fg-rgb), 0.7));
}

.menubar__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-left: auto;
}

.menubar__nav a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 0 0.3rem 0 0;
  white-space: nowrap;
}

.menubar__nav kbd {
  border: 0;
  margin: 0 0.35rem 0 0;
  background: var(--fg);
  color: var(--solvenda);
  text-shadow: none;
  border-radius: 0;
}

.menubar__nav a:hover kbd,
.menubar__nav a:focus-visible kbd {
  background: var(--solvenda);
  color: var(--fg);
}

.menubar__clock {
  color: var(--fg-dim);
  min-width: 3.5ch;
}

/* ---------- Layout ---------- */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem);
}

.section {
  padding: clamp(3rem, 8vw, 5.5rem) 0 0;
}

.section__title {
  font-family: var(--font-pixel);
  font-weight: normal;
  font-size: clamp(0.9rem, 0.7rem + 1vw, 1.35rem);
  line-height: 1.6;
  margin: 0 0 1.25rem;
}

.section__title .dim {
  font-size: 0.75em;
}

.section__intro {
  margin: -0.5rem 0 1.5rem;
  max-width: 60ch;
}

.prose p,
p.prose {
  max-width: 68ch;
}

/* ---------- Hero ---------- */
.hero {
  min-height: calc(100vh - 3.5rem);
  min-height: calc(100svh - 3.5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 0 2rem;
}

.prompt {
  margin: 0 0 2rem;
  color: var(--fg-dim);
}

.cursor {
  display: inline-block;
  animation: blink 1s steps(1) infinite;
  color: var(--fg);
}

.blink {
  animation: blink 1.2s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero__logo {
  margin: 0 0 1.5rem;
  line-height: 0;
  overflow: visible;
}

.hero__logo svg {
  width: min(100%, 720px);
  height: auto;
  aspect-ratio: 335 / 83;
  overflow: visible;
  color: var(--fg);
  filter:
    drop-shadow(0 0 2px rgba(var(--fg-rgb), 0.9))
    drop-shadow(0 0 14px rgba(var(--fg-rgb), 0.45));
  animation: jitter 7s infinite;
}

@keyframes jitter {
  0%, 96%, 100% { transform: translateX(0); }
  97% { transform: translateX(-3px) skewX(-2deg); }
  98% { transform: translateX(2px); }
}

.hero__lead {
  font-family: var(--font-pixel);
  font-size: clamp(1rem, 0.7rem + 1.6vw, 1.9rem);
  line-height: 1.5;
  margin: 0 0 1rem;
}

.hero__sub {
  max-width: 60ch;
  margin: 0 0 2rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 3rem;
}

.btn {
  display: inline-block;
  padding: 0.35rem 1rem;
  background: var(--fg);
  color: var(--bg);
  text-shadow: none;
  text-decoration: none;
  box-shadow: 0 0 16px rgba(var(--fg-rgb), 0.45);
  font-size: 1.15em;
}

.btn:hover,
.btn:focus-visible {
  background: #fff;
  color: var(--bg);
}

.btn--ghost {
  background: transparent;
  color: var(--fg);
  text-shadow: var(--glow);
  box-shadow: inset 0 0 0 2px var(--fg);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  background: var(--fg);
  color: var(--bg);
  text-shadow: none;
}

.statusline {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 2rem;
  border-top: 1px dashed var(--fg-dim);
  color: var(--fg-dim);
}

/* ---------- Fönster ---------- */
.window {
  border: 2px solid var(--fg);
  box-shadow: 0 0 18px rgba(var(--fg-rgb), 0.18), inset 0 0 30px rgba(var(--fg-rgb), 0.05);
  background: rgba(0, 0, 0, 0.35);
}

.window__bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.1rem 0.75rem;
  background: var(--fg);
  color: var(--bg);
  text-shadow: none;
}

.window__bar .dim {
  color: var(--bg);
  opacity: 0.7;
}

.window__body {
  padding: clamp(1rem, 3vw, 1.75rem);
}

.window__body > :first-child {
  margin-top: 0;
}

.window__body > :last-child {
  margin-bottom: 0;
}

/* ---------- DIR-listning ---------- */
.dir-head,
.dir-foot {
  margin: 0 0 1rem;
}

.dir-foot {
  margin: 1rem 0 0;
}

.dir {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dir li {
  display: grid;
  grid-template-columns: 9ch 4ch 1fr;
  gap: 0 1rem;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px dotted rgba(var(--fg-rgb), 0.25);
}

.dir li:hover {
  background: var(--fg-faint);
}

.dir__name,
.dir__ext {
  white-space: nowrap;
}

.dir__ext {
  color: var(--fg-dim);
}

/* ---------- Team ---------- */
.team {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
}

.player {
  position: relative;
  border: 2px solid var(--fg);
  padding: 1.25rem 1.25rem 1.5rem;
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 18px rgba(var(--fg-rgb), 0.15);
  transition: transform 0.15s, box-shadow 0.15s;
}

.player:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 28px rgba(var(--fg-rgb), 0.35);
}

.player:hover .player__tag::before {
  content: "\25B6  ";
}

.player__tag {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  margin: 0 0 1rem;
  color: var(--fg-dim);
}

.player:hover .player__tag {
  color: var(--fg);
}

.player__avatar {
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 0 1rem;
  fill: var(--fg);
  shape-rendering: crispEdges;
  filter: drop-shadow(0 0 6px rgba(var(--fg-rgb), 0.6));
}

.player__name {
  font-family: var(--font-pixel);
  font-weight: normal;
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 0 0 0.75rem;
}

.player__stats {
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--fg);
  background: var(--fg-faint);
}

.player__stats dt {
  color: var(--fg-dim);
  font-size: 0.85em;
}

.player__stats dd {
  margin: 0 0 0.35rem;
  color: #fff;
}

.player__stats dd:last-child {
  margin-bottom: 0;
}

.bars {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.bars li {
  display: grid;
  grid-template-columns: 13ch auto;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9em;
}

.bar {
  position: relative;
  display: block;
  width: 124px;
  height: 14px;
  border: 1px solid var(--fg-dim);
}

.bar::before {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc(var(--v) * 12px - 3px);
  background: repeating-linear-gradient(90deg, var(--fg) 0 9px, transparent 9px 12px);
  box-shadow: 0 0 6px rgba(var(--fg-rgb), 0.4);
}

/* ---------- Arkad / dator ---------- */
.computer {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(220px, 1fr);
  gap: 2rem;
  align-items: start;
}

.monitor {
  background: linear-gradient(160deg, #e6dec8 0%, var(--beige) 45%, var(--beige-dark) 100%);
  border-radius: 22px 22px 14px 14px;
  padding: 22px 22px 0;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.6),
    inset 0 -4px 0 rgba(0, 0, 0, 0.15),
    0 20px 40px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(var(--fg-rgb), 0.08);
  text-shadow: none;
}

.monitor__bezel {
  background: #2a2a26;
  padding: 18px;
  border-radius: 16px;
  box-shadow: inset 0 0 0 3px #1a1a17, inset 0 6px 14px rgba(0, 0, 0, 0.7);
}

.monitor__screen {
  position: relative;
  aspect-ratio: 1;
  background: radial-gradient(ellipse at center, #0b1a0f 0%, #020503 80%);
  border-radius: 18px / 24px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), 0 0 0 2px #000;
}

body.amber .monitor__screen {
  background: radial-gradient(ellipse at center, #1a1205 0%, #050300 80%);
}

.monitor__screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 40%),
    repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.35) 2px 3px);
  border-radius: inherit;
}

.monitor__screen canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  touch-action: none;
  outline: none;
}

.monitor__screen:focus-within {
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), 0 0 0 2px var(--fg);
}

.noscript {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
  margin: 0;
  color: var(--fg);
  text-shadow: var(--glow);
}

.monitor__chin {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 14px 6px 16px;
  color: #6b6450;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  background: linear-gradient(180deg, #c9c1a8, #e8e1cc);
  border-radius: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

.badge svg {
  width: 96px;
  height: 19px;
  color: var(--solvenda);
}

.monitor__model {
  margin-left: auto;
  letter-spacing: 0.1em;
}

.monitor__led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--fg);
  box-shadow: 0 0 8px var(--fg), 0 0 2px #fff inset;
}

.monitor__led.is-busy {
  animation: blink 0.25s steps(1) infinite;
}

.computer__side {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 1rem;
  border: 2px solid var(--fg);
}

.scoreboard dt {
  color: var(--fg-dim);
}

.scoreboard dd {
  margin: 0;
  font-family: var(--font-pixel);
  font-size: 0.9rem;
  text-align: right;
}

.computer__side .btn {
  align-self: flex-start;
  font: inherit;
  border: 0;
  cursor: pointer;
}

.controls {
  margin: 0;
}

.controls kbd {
  margin-bottom: 0.25rem;
}

.dpad {
  display: none;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 56px);
  gap: 4px;
  justify-content: center;
}

.dpad button {
  font: inherit;
  font-size: 1.4rem;
  color: var(--fg);
  text-shadow: var(--glow);
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid var(--fg);
  border-radius: 6px;
  cursor: pointer;
  touch-action: manipulation;
}

.dpad button:active {
  background: var(--fg);
  color: var(--bg);
}

.dpad__up { grid-column: 2; grid-row: 1; }
.dpad__left { grid-column: 1; grid-row: 2; }
.dpad .dpad__mid { grid-column: 2; grid-row: 2; font-size: 1rem; }
.dpad__right { grid-column: 3; grid-row: 2; }
.dpad__down { grid-column: 2; grid-row: 3; }

.fineprint {
  margin: 0;
  font-size: 0.85em;
}

@media (hover: none) and (pointer: coarse) {
  .dpad {
    display: grid;
  }
}

/* ---------- Kontakt ---------- */
.contacts {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.contacts li {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--fg);
  background: var(--fg-faint);
}

.contacts__name {
  color: #fff;
}

.contacts a {
  overflow-wrap: anywhere;
}

/* ---------- Footer / CLI ---------- */
.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 5rem) clamp(1rem, 4vw, 2rem) 2rem;
}

.cli {
  border-top: 2px solid var(--fg);
  padding-top: 1rem;
}

.cli__output {
  max-height: 16rem;
  overflow-y: auto;
}

.cli__output p,
.cli__output pre {
  margin: 0 0 0.25rem;
  font-family: var(--font);
  white-space: pre-wrap;
}

.cli__line {
  display: flex;
  align-items: baseline;
  gap: 0.5ch;
}

.cli__prompt {
  white-space: nowrap;
}

.cli input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--fg);
  text-shadow: var(--glow);
  background: transparent;
  border: 0;
  outline: none;
  caret-color: var(--fg);
  padding: 0;
}

.footer__copy {
  margin: 2rem 0 0;
  color: var(--fg-dim);
  font-size: 0.9em;
}

/* ---------- Effekter ---------- */
.glitch {
  animation: glitch 0.6s steps(2) 3;
}

@keyframes glitch {
  0% { transform: translate(0); filter: none; }
  25% { transform: translate(-4px, 2px); filter: hue-rotate(90deg); }
  50% { transform: translate(3px, -2px); }
  75% { transform: translate(-2px, 0); filter: invert(1); }
  100% { transform: translate(0); filter: none; }
}

/* ---------- Responsivt ---------- */
@media (max-width: 860px) {
  .computer {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .menubar {
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
  }

  .menubar__clock {
    display: none;
  }

  .menubar__nav {
    margin-left: 0;
    width: 100%;
    gap: 0.25rem 0.75rem;
    font-size: 0.95em;
  }

  .menubar__nav kbd {
    display: none;
  }

  html {
    scroll-padding-top: 6rem;
  }

  .dir li {
    grid-template-columns: auto 1fr;
  }

  .dir__desc {
    grid-column: 1 / -1;
  }

  .monitor {
    padding: 14px 14px 0;
  }

  .monitor__bezel {
    padding: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  body::before {
    opacity: 0.6;
  }
}
