/* Typsnittet ligger på samma server: inga anrop till tredje part (se fonts/LICENSE.txt). */
@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-600.woff2') format('woff2');
}

:root {
  --bg: #0a0c0b;
  --g: #39ff88;
  --fg: #f2f5f3;
  --d: #6b766f;
  --err: #ff6b6b;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }

body {
  font: 400 14px/1.7 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Långsamt pulserande grön glöd i nederkant. */
body::before {
  content: "";
  position: fixed;
  inset: -40%;
  pointer-events: none;
  background: radial-gradient(circle at 72% 105%, rgba(57, 255, 136, .15), transparent 42%);
  animation: glow 6s ease-in-out infinite alternate;
}
@keyframes glow { to { transform: translate(-6%, -4%) scale(1.1); } }

#term {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  padding: clamp(18px, 4vw, 48px);
  padding-bottom: max(clamp(18px, 4vw, 48px), env(safe-area-inset-bottom));
  cursor: text;
  scrollbar-width: thin;
  scrollbar-color: #1d2621 transparent;
}
.wrap { max-width: 880px; }

.ls-row { display: block; }

.blk, .line {
  margin: 0 0 1.15em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.p, .g { color: var(--g); }
.d { color: var(--d); }
.err { color: var(--err); }
b { font-weight: 600; color: #fff; }

a {
  color: #fff;
  text-decoration: none;
  background: linear-gradient(var(--g), var(--g)) 0 100% / 0 1px no-repeat;
  transition: background-size .3s, color .3s;
}
a:hover, a:focus-visible { background-size: 100% 1px; color: var(--g); outline: none; }

/* Blockmarkör. Den bär tecknet som står under den. */
.cur {
  display: inline-block;
  min-width: .6em;
  line-height: 1.3;
  background: var(--g);
  color: var(--bg);
  box-shadow: 0 0 12px var(--g);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { background: transparent; color: inherit; box-shadow: none; } }

.line { position: relative; }
.line:not(.focused) .cur { animation: none; background: transparent; color: inherit; box-shadow: inset 0 0 0 1px var(--g); }

/* Den riktiga inmatningen ligger osynlig ovanpå raden; #mirror visar texten. */
#cmd {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  border: 0;
  padding: 0;
  font-size: 16px; /* hindrar iOS från att zooma in */
  background: none;
  color: transparent;
  cursor: text;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* När en tangentbordsanvändare tabbar in i den statiska versionen visas den som en panel. */
#static:focus-within {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: auto;
  height: auto;
  clip: auto;
  overflow: auto;
  white-space: normal;
  padding: clamp(18px, 4vw, 48px);
  background: var(--bg);
}
#static a:focus-visible { outline: 2px solid var(--g); outline-offset: 3px; }

@media (max-width: 600px) {
  body { font-size: 12.5px; }
  .ls-pad { display: none; }
  .ls-desc { display: block; padding-left: 2ch; }
}

@media (prefers-reduced-motion: reduce) {
  body::before, .cur { animation: none; }
  a { transition: none; }
}
