/* LORERUFF-OS — flat design system.
   Phosphor green is the voice; violet is only a state accent (active/hover/pending).
   No shadows, no radii, no gradients: the CRT feel comes from type and rhythm. */

@font-face {
  font-family: "Plex Mono";
  src: url("fonts/plexmono-400.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/plexmono-500.woff2") format("woff2");
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/plexmono-700.woff2") format("woff2");
  font-weight: 700; font-display: swap;
}

:root {
  --bg: #060907;
  --bg-raise: #0a100c;
  --phos: #39ff88;        /* primary phosphor */
  --phos-dim: #1e8a4f;    /* secondary text */
  --phos-faint: #123524;  /* borders, faint marks */
  --ink: #cfeede;         /* body text on dark */
  --violet: #b06bff;      /* accent: active states only */
  --mono: "Plex Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* static scanlines: one painted layer, zero repaint cost */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(57,255,136,0.025) 0px,
    rgba(57,255,136,0.025) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 9;
}

::selection { background: var(--phos); color: var(--bg); }

a { color: var(--phos); text-decoration: none; border-bottom: 1px solid var(--phos-faint); }
a:hover { color: var(--violet); border-bottom-color: var(--violet); }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* ---------- boot overlay ---------- */
#boot {
  position: fixed; inset: 0;
  background: #030504;
  color: var(--phos);
  z-index: 100;
  padding: 24px;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}
#bootlog { font-family: var(--mono); }
#boot .cursor {
  display: inline-block; width: .6em; height: 1.1em;
  background: var(--phos); vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* power-off: 3 hard steps, no fade */
#boot.off {
  animation: crt-off .14s steps(3, end) forwards;
  pointer-events: none;
}
@keyframes crt-off {
  0%   { transform: scaleY(1); opacity: 1; }
  60%  { transform: scaleY(0.06); opacity: 1; }
  100% { transform: scaleY(0.004); opacity: 0; }
}

/* content hidden while booting; shown instantly on power-off */
body:not(.on) .site { visibility: hidden; }

/* ---------- chrome ---------- */
header {
  border-bottom: 1px solid var(--phos-faint);
  background: var(--bg-raise);
}
.bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; max-width: 860px; margin: 0 auto;
}
.brand { font-weight: 700; letter-spacing: .06em; }
.brand::before { content: "▮ "; color: var(--violet); }
.lang a { color: var(--phos-dim); margin-left: 12px; }
.lang a.active { color: var(--violet); border-bottom-color: var(--violet); }

.hero { padding: 72px 0 48px; }
.hero h1 {
  font-size: clamp(34px, 7vw, 58px);
  color: var(--phos);
  letter-spacing: .04em;
  line-height: 1.1;
}
.hero h1 .caret {
  display: inline-block; width: .55em; height: .85em;
  background: var(--phos); vertical-align: baseline;
  animation: blink 1.1s steps(1) infinite;
}
.thesis {
  margin-top: 18px;
  font-size: clamp(18px, 3vw, 24px);
  color: var(--ink); font-weight: 500;
}
.hero p.sub { margin-top: 14px; max-width: 620px; color: var(--phos-dim); }

.statusbar {
  margin: 26px 0 0;
  padding: 10px 14px;
  border: 1px solid var(--phos-faint);
  background: var(--bg-raise);
  color: var(--violet);
  font-size: 13px;
}
.statusbar b { color: var(--ink); font-weight: 500; }

section { padding: 40px 0; border-bottom: 1px solid var(--phos-faint); }
section:last-of-type { border-bottom: 0; }

h2 {
  font-size: 15px; font-weight: 700;
  color: var(--phos); letter-spacing: .05em;
  margin-bottom: 18px;
}
h2::before { content: "// "; color: var(--phos-dim); }

.receipt { width: 100%; border-collapse: collapse; font-size: 14px; }
.receipt td { padding: 7px 0; border-bottom: 1px dotted var(--phos-faint); vertical-align: top; }
.receipt td:first-child { color: var(--phos-dim); width: 40%; padding-right: 18px; }
.receipt td:last-child { color: var(--ink); font-weight: 500; }
.receipt .val { color: var(--phos); }
.receipt .pending { color: var(--violet); }

footer { padding: 28px 0 48px; color: var(--phos-dim); font-size: 13px; }
footer .sig { color: var(--phos); }

@media (max-width: 560px) {
  .hero { padding: 48px 0 36px; }
  .receipt td:first-child { width: 48%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #boot .cursor, .hero h1 .caret { animation: none; }
}

/* ---------- overlays: invisible without JS (fail-soft) ---------- */
#limine, #boot, #cmos, #clibar, #pxe, #login, #panic, #saver, #plate, #nosignal, .screw { display: none; }
.preboot #limine { display: flex; }
.preboot #boot { display: block; }
.preboot #clibar { display: block; }
.preboot .screw { display: block; }
#pxe.open, #login.open, #panic.open { display: block; }
#saver.open { display: block; }
#nosignal.open { display: flex; }
body:not(.on) .screw { visibility: hidden; }
body:not(.on) #plate { display: none !important; }
#boot.hidden, #limine.hidden { display: none !important; }
body { padding-bottom: 44px; } /* room for the shell bar */

/* ---------- SIGNAL LOST: the roll deserves a caption ---------- */
#nosignal {
  position: fixed;
  inset: 0;
  z-index: 165;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 5, 4, 0.6);
  pointer-events: none;
  font-size: 0; /* the string lives in the DOM (role=status) but only ::after paints it */
}
#nosignal.open { display: flex; }
#nosignal::after {
  content: "SIGNAL LOST, ARE YOU HERE?";
  color: var(--phos);
  font-size: clamp(18px, 4.4vw, 40px);
  letter-spacing: 0.14em;
  text-align: center;
  padding: 0 16px;
  animation: nosignal-blink 0.8s steps(1) infinite;
}
@keyframes nosignal-blink {
  0%   { opacity: 1; }
  55%  { opacity: 1; }
  56%  { opacity: 0.15; }
  100% { opacity: 0.15; }
}

/* ---------- limine bootloader ---------- */
#limine {
  position: fixed; inset: 0;
  background: #030504; color: var(--phos);
  z-index: 100;
  flex-direction: column;
  padding: 28px 32px;
  font-size: 14px;
}
.lim-head {
  display: flex; justify-content: space-between;
  border-bottom: 1px solid var(--phos-faint); padding-bottom: 10px;
  color: var(--phos-dim);
}
.lim-head b { color: var(--phos); font-weight: 700; }
.lim-menu { margin: auto 0; }
.lim-entry { padding: 9px 14px; cursor: pointer; }
.lim-entry::before { content: "  "; }
.lim-entry.sel {
  background: var(--violet); color: #060907; font-weight: 700;
}
.lim-entry.sel::before { content: "▸ "; }
.lim-foot {
  display: flex; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--phos-faint); padding-top: 10px;
  color: var(--phos-dim); font-size: 12px;
}
.blink-slow { animation: blink 1.4s steps(1) infinite; animation-duration: calc(1.4s * var(--speed)); }

/* ---------- CMOS SETUP (Del) ---------- */
#cmos {
  position: fixed; inset: 0;
  background: rgba(3, 5, 4, 0.96);
  z-index: 120;
  align-items: center; justify-content: center;
}
#cmos.open { display: flex; }
.cmos-box { border: 1px double var(--phos); width: min(560px, 94vw); color: var(--phos); }
.cmos-title {
  display: flex; justify-content: space-between;
  background: var(--phos-faint); padding: 6px 12px; font-weight: 700;
}
.cmos-body { padding: 12px 14px; }
.cmos-row { display: flex; justify-content: space-between; padding: 6px 10px; cursor: pointer; }
.cmos-row.sel { background: var(--violet); color: #060907; }
.cmos-stat { color: var(--phos-dim); padding: 6px 10px; }
.cmos-hint {
  display: flex; justify-content: space-between; gap: 8px;
  border-top: 1px solid var(--phos-faint);
  padding: 8px 14px; color: var(--phos-dim); font-size: 12px;
}
.cmos-hint b { color: var(--phos); cursor: pointer; }

/* ---------- modules (placeholder slots) ---------- */
.mods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.module {
  border: 1px dashed var(--violet);
  padding: 16px;
  color: var(--phos-dim);
  font-size: 13px;
}
.module:hover { border-style: solid; }
.module h3 {
  display: flex; justify-content: space-between; align-items: baseline;
  color: var(--violet); font-size: 14px; margin-bottom: 8px;
}
.module .chip {
  font-size: 11px; font-weight: 400;
  border: 1px solid var(--violet); padding: 0 6px; color: var(--violet);
}
.modnote { color: var(--phos-dim); font-size: 13px; margin-bottom: 16px; }

/* ---------- shell bar (lsh): one thin line, panel and suggestions
   float ABOVE it (absolute) so the height never changes with output ---------- */
#clibar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--bg-raise);
  border-top: 1px solid var(--phos-faint);
  font-size: 13px;
  z-index: 90;
  transition: transform .18s ease;
}
#clibar.down { transform: translateY(calc(100% - 8px)); cursor: pointer; }
#clibar.down #cli-panel, #clibar.down #cli-sug { display: none; }
.cli-prompt {
  display: flex; align-items: center; gap: 8px;
  max-width: 860px; margin: 0 auto;
  padding: 8px 20px;
  cursor: text;
}
.cli-prompt .ps1 { color: var(--violet); white-space: nowrap; }
#cli-input {
  flex: 1; min-width: 40px;
  background: none; border: 0; outline: 0;
  color: var(--phos); font: inherit; caret-color: var(--phos);
}
#cli-min, #cli-snd {
  background: none; border: 1px solid var(--phos-faint);
  color: var(--phos-dim); font: inherit; font-size: 12px;
  padding: 1px 8px; cursor: pointer;
}
#cli-min:hover, #cli-snd:hover { color: var(--violet); border-color: var(--violet); }
#cli-snd.on { color: var(--phos); border-color: var(--phos-dim); }
#cli-sug {
  display: flex; gap: 14px; align-items: baseline;
  position: absolute; bottom: 100%; left: 0; right: 0;
  padding: 6px 20px;
  background: var(--bg-raise);
  border-top: 1px solid var(--phos-faint);
  color: var(--phos-dim); font-size: 12px;
}
#cli-sug b { color: var(--violet); cursor: pointer; font-weight: 500; user-select: none; }
#cli-panel {
  display: none;
  position: absolute; bottom: 100%; left: 0; right: 0;
  max-height: 42vh; overflow-y: auto;
  background: var(--bg-raise);
  border-top: 1px solid var(--phos-faint);
}
#cli-panel.open { display: block; }
#cli-out { max-width: 860px; margin: 0 auto; padding: 12px 20px 34px; } /* room under the floating suggestions */
#cli-out .line { white-space: pre-wrap; }
#cli-out .cmd { color: var(--phos-dim); }

/* ---------- CRT effects ---------- */
:root { --speed: 1; }
html.turbo { --speed: 3.5; }
#boot .cursor, .hero h1 .caret { animation-duration: calc(1.1s * var(--speed)); }
html.no-scan body::after { display: none; }

/* the roll must NOT sit on body: a transform/filter on body turns it into
   the containing block for fixed children (#nosignal, #clibar), so the
   caption would center on the 1703px document and vanish off-viewport.
   Every visible layer rolls instead; #nosignal stays still on purpose. */
body.resync .site,
body.resync #clibar,
body.resync .screw,
body.resync #plate {
  animation: resync 0.7s linear;
  animation-duration: calc(0.7s * var(--speed));
}
@keyframes resync {
  0%   { transform: translateY(0); filter: brightness(1); }
  8%   { transform: translateY(-16px); filter: brightness(1.5); }
  22%  { transform: translateY(5px); }
  38%  { transform: translateY(-7px); }
  60%  { transform: translateY(3px); filter: brightness(1.15); }
  100% { transform: translateY(0); filter: brightness(1); }
}
body.wake { animation: degauss 0.45s ease-out; }
@keyframes degauss {
  0%   { transform: scale(1.02); filter: hue-rotate(18deg) saturate(1.5); }
  60%  { transform: scale(0.998); }
  100% { transform: none; filter: none; }
}

.sl {
  position: fixed;
  bottom: 60px; left: -640px;
  z-index: 95;
  color: var(--phos);
  font-size: 12px; line-height: 1.15; white-space: pre;
  animation: choo 3s linear forwards;
  pointer-events: none;
}
@keyframes choo { to { transform: translateX(calc(100vw + 640px)); } }

@media (max-width: 560px) {
  #limine { padding: 20px; font-size: 13px; }
  .lim-foot { flex-direction: column; gap: 6px; }
}

/* ---------- v2.2: pxe ghost, login, screensaver, panic ---------- */
#pxe, #login, #panic {
  position: fixed; inset: 0; z-index: 105;
  background: #030504; color: var(--phos);
  padding: 24px; font-size: 13px; line-height: 1.5;
  white-space: pre-wrap;
  font-family: var(--mono);
}
#panic { z-index: 220; }
#saver { position: fixed; inset: 0; z-index: 150; background: #030504; }

/* ---------- case screws + inner plate ---------- */
.screw {
  position: fixed; z-index: 96;
  width: 14px; height: 14px;
  background: var(--bg);
  border: 1px solid var(--phos-dim);
  color: var(--phos-dim);
  font: 700 10px/1 var(--mono);
  padding: 0; cursor: pointer;
  transition: transform .15s ease;
}
.screw::before { content: "+"; }
.screw.loose { transform: rotate(45deg); border-color: var(--violet); color: var(--violet); }
.s1 { top: 8px; left: 8px; }
.s2 { top: 8px; right: 8px; }
.s3 { bottom: 56px; left: 8px; }
.s4 { bottom: 56px; right: 8px; }
#plate {
  position: fixed; inset: 0; z-index: 130;
  background: rgba(3, 5, 4, 0.96);
  align-items: center; justify-content: center;
}
#plate.open { display: flex; }
.plate-box { border: 1px double var(--phos); width: min(520px, 94vw); padding: 18px 20px; color: var(--phos); font-size: 13px; }
.plate-title { font-weight: 700; letter-spacing: .05em; margin-bottom: 12px; }
.plate-row { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--phos-faint); padding: 6px 0; }
.plate-row b { font-weight: 500; color: var(--ink); }
.plate-hint { color: var(--phos-dim); font-size: 12px; margin-top: 12px; }

/* ---------- konami overclock: denser scanlines, faint phosphor bloom ---------- */
html.oc body::after {
  background: repeating-linear-gradient(
    to bottom,
    rgba(57,255,136,0.05) 0px, rgba(57,255,136,0.05) 1px,
    transparent 1px, transparent 2px
  );
}
html.oc body::before {
  content: "";
  position: fixed; inset: 0; z-index: 8;
  pointer-events: none;
  background: rgba(57, 255, 136, 0.028);
}
