@font-face {
  font-family: "JetBrains Mono";
  src: url("jetbrains-mono-latin-wght.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "VT323";
  src: url("vt323-latin.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #0d1118;
  --bg-raise: #151b26;
  --bar: #1c222e;
  --line: #2a3342;
  --fg: #d5dce8;
  --hi: #f5f8fc;
  --dim: #97a3b6;
  --faint: #5f6b7d;
  --blue: #74b9ff;
  --green: #7fdc8f;
  --yellow: #f0c674;
  --red: #ff8478;
  --pad: 28px;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background:
    radial-gradient(120% 90% at 12% 0%, #3d5283 0%, transparent 60%),
    radial-gradient(90% 80% at 100% 100%, #74506a 0%, transparent 55%),
    linear-gradient(160deg, #1f2a44, #2a2f55 50%, #3a2e4f);
  background-color: #262c4c;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-height: 100svh;
  font: 15px/1.6 var(--mono);
  color: var(--fg);
  -webkit-text-size-adjust: 100%;
}

.window {
  width: 100%;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.titlebar {
  flex: none;
  height: 40px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: linear-gradient(180deg, #2a3140, #1f2531);
  border-bottom: 1px solid #0a0d12;
}
.lights { display: flex; gap: 8px; align-items: center; }
.light {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.25);
}
.light.r { background: #ff5f57; }
.light.y { background: #febc2e; }
.light.g { background: #28c840; }
.title {
  margin: 0;
  font: 600 13px/1 var(--ui);
  color: #b4bdcb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.title b { color: var(--hi); font-weight: 600; }

.cmdbar {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  padding: 6px 12px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.3;
}
.cmdbar .label { color: var(--dim); padding: 0 6px 0 4px; }
.cmdbar a {
  color: var(--fg);
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 7px;
}
.cmdbar a:hover { background: rgba(255, 255, 255, 0.09); color: var(--hi); }
.cmdbar a[aria-current] {
  background: rgba(116, 185, 255, 0.16);
  color: var(--hi);
  box-shadow: inset 0 -2px 0 var(--blue);
}

.term {
  position: relative;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px var(--pad) 26px;
  scrollbar-width: thin;
  scrollbar-color: #3a4558 transparent;
  overflow-wrap: break-word;
}
.term:focus-visible { outline-offset: -3px; }

:where(.term) :where(p, h1, h2, h3, h4, ul, dl, pre, form, address) { margin: 0; }
.term > * + *, .log > * + *, .view > * + * { margin-top: 0.5em; }
.log:empty, .view:empty { display: none; }

.term.sec [data-hero] { display: none; }
.term.sec .view { margin-top: 0; }
.term.sec .view > .echo:first-child { margin-top: 0 !important; }

.out h2[tabindex="-1"]:focus { outline: none; }

.dim { color: var(--dim); }
.prompt { color: var(--faint); white-space: nowrap; }
.prompt .pu { color: var(--green); }
.prompt .pp { color: var(--blue); }
.prompt::after { content: " "; white-space: pre; }
.echo { margin-top: 1.3em !important; color: var(--hi); }
.term > .echo:first-child { margin-top: 0 !important; }
#lastlogin + .echo { margin-top: 0.5em !important; }

.term a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.term a:hover { color: #a8d3ff; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 5;
  background: var(--blue); color: #08111d; padding: 8px 12px; border-radius: 6px;
  font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  line-height: 1.3;
  color: #08111d !important;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 8px;
  padding: 7px 16px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #a8d3ff; border-color: #a8d3ff; }
.btn.ghost { color: var(--hi) !important; background: transparent; border-color: #4a586e; }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--dim); }
.btn.call { background: var(--green); border-color: var(--green); }
.btn.call:hover { background: #a9ecb4; border-color: #a9ecb4; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.1em !important; }

.scene {
  font-family: "VT323", ui-monospace, monospace;
  white-space: pre;
  color: #c4ccd9;
  overflow: hidden;
  user-select: none;
  min-width: 0;

  font-size: max(6.5px, calc(min(1120px, 100vw - 48px) / 112));
  line-height: 0.82;
}

html:not(.js) .term .scene { width: 112em; margin-left: calc(50% - 56em); margin-right: 0; }

.term .stage { position: relative; margin: 0.7em calc(-1 * var(--pad)) 0.6em; }
.stage.paused .scene { cursor: pointer; }

.scene-toggle {
  position: absolute;
  right: 10px;
  bottom: 6px;
  font: 600 12px/1 var(--ui);
  color: var(--dim);
  background: rgba(13, 17, 24, 0.82);
  border: 1px solid #3a4558;
  border-radius: 6px;
  padding: 6px 9px;
  cursor: pointer;
}

.scene-toggle::before {
  content: "";
  display: inline-block;
  width: 2px;
  height: 9px;
  margin-right: 7px;
  border-left: 3px solid currentColor;
  border-right: 3px solid currentColor;
  vertical-align: -1px;
}
.scene-toggle[data-state="paused"]::before {
  width: 0;
  height: 0;
  border-left: 8px solid currentColor;
  border-right: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}
.scene-toggle:hover { color: var(--hi); border-color: var(--dim); }
.scene-toggle[hidden] { display: none; }
.scene .b { color: var(--hi); }
.scene .n { color: #c4ccd9; }
.scene .d { color: #8793a6; }
.scene .f { color: #566173; }

.scene .r { --c: #ff5a45; }
.scene .y { --c: #ffd829; }
.scene .c { --c: #7fd4ff; }
.scene .w { --c: #e8ecf2; }
.scene .k { --c: #8d939c; }
.scene .g { --c: #58d66a; }
.scene .u { --c: #4b94ff; }
.scene .s { --c: #a9adb5; }
.scene .p { --c: #fff3b0; }
.scene .h { --c: #f2c9a8; }
.scene .e { --c: #b07a55; }
.scene :is(.r, .y, .c, .w, .k, .g, .u, .s, .p, .h, .e).n { color: var(--c); }
.scene :is(.r, .y, .c, .w, .k, .g, .u, .s, .p, .h, .e).b {
  color: color-mix(in srgb, var(--c) 86%, #fff);
  text-shadow: 0 0 6px color-mix(in srgb, var(--c) 35%, transparent);
}
.scene :is(.r, .y, .c, .w, .k, .g, .u, .s, .p, .h, .e).d { color: color-mix(in srgb, var(--c) 70%, var(--bg)); }
.scene :is(.r, .y, .c, .w, .k, .g, .u, .s, .p, .h, .e).f { color: color-mix(in srgb, var(--c) 45%, var(--bg)); }

.eyebrow { color: var(--green); font-size: 0.93em; letter-spacing: 0.02em; }
h1.motto {
  display: grid;
  font: 800 clamp(27px, 5.2vw, 58px)/1.08 var(--mono);
  letter-spacing: -0.03em;
  color: var(--hi);
  margin-top: 0.2em;
}
.intro { position: relative; }
.intro > canvas { position: absolute; left: 0; top: 0; pointer-events: none; }

.lead { max-width: 66ch; font-size: 1.07em; margin-top: 0.8em !important; }
.hint { margin-top: 0.9em !important; font-size: 0.93em; }

.out { margin-top: 0.5em; }
.out h2, .doc h2 {
  font: 700 1.3em/1.3 var(--mono);
  color: var(--yellow);
}
.out p, .out dl, .out ul { max-width: 74ch; }
.out ul, .doc ul { list-style: none; padding: 0; }
.out li, .doc li { position: relative; padding-left: 2ch; }
.out li::before, .doc li::before { content: "–"; position: absolute; left: 0; color: var(--faint); }
.out h2 + dl { margin-top: 0.6em; }
.out dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.15em 2ch; }
.out dt { color: var(--dim); }
.out dd { margin: 0; min-width: 0; }
.out .item { margin-top: 1em; }
.out .item > p:first-child { color: var(--hi); font-weight: 700; }
.out .price { color: var(--green); }
.indent, .out .indent { padding-left: 2ch; }
.out .item > .indent + .indent { margin-top: 0.25em; }

.form { display: grid; gap: 10px; max-width: 74ch; margin-top: 0.9em !important; }
.form label { display: grid; grid-template-columns: 11ch 1fr; align-items: start; gap: 4px 0; }
.form label > span { color: var(--dim); padding-top: 7px; }
.form input, .form textarea, .field {
  font: inherit;
  color: var(--hi);
  background: #090c12;
  border: 1px solid #3a4558;
  border-radius: 7px;
  padding: 7px 10px;
  width: 100%;
  min-width: 0;
  caret-color: var(--green);
}
.form textarea { resize: vertical; min-height: 6.4em; }
.form input:focus, .form textarea:focus, .field:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
::placeholder { color: #8a96a9; opacity: 1; }
.form .btn { justify-self: start; margin-left: 11ch; }
.hp { position: absolute !important; left: -9999px; width: 1px !important; }
.req { color: var(--red); }

.promptline {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 9px 12px 10px var(--pad);
  background: #0a0d13;
  border-top: 1px solid var(--line);
}
.promptline label { flex: none; }
.promptline input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--hi);
  background: transparent;
  border: 0;
  border-radius: 4px;
  padding: 4px 2px;
  caret-color: var(--green);
}
.promptline input:focus { outline: none; }
.promptline:focus-within { box-shadow: inset 0 2px 0 var(--blue); }
.promptline button {
  flex: none;
  font: 600 12px/1 var(--ui);
  color: var(--dim);
  background: var(--bg-raise);
  border: 1px solid #3a4558;
  border-radius: 6px;
  padding: 6px 9px;
  cursor: pointer;
}
.promptline button:hover { color: var(--hi); border-color: var(--dim); }
html:not(.js) .promptline, html:not(.js) .js-only { display: none; }

.js .typing::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  background: var(--green);
  vertical-align: -0.15em;
}

.doc { max-width: 84ch; margin-top: 1em !important; }
.doc > * + * { margin-top: 0.9em; }
.doc h1 {
  font: 800 clamp(24px, 3.4vw, 34px)/1.2 var(--mono);
  letter-spacing: -0.02em;
  color: var(--hi);
}
.doc h1 + .lead { margin-top: 0.5em !important; color: var(--dim); }
.doc > h2, .doc > section, .doc > article { margin-top: 2.2em; }
.doc section > * + *, .doc article > * + * { margin-top: 0.9em; }
.doc h3 { font: 700 1em/1.4 var(--mono); color: var(--hi); margin-top: 1.6em !important; }
.doc h2 + h3 { margin-top: 1em !important; }
.doc strong { color: var(--hi); font-weight: 700; }
.doc address { font-style: normal; }
.doc li + li { margin-top: 0.3em; }
.doc .toc { display: flex; flex-wrap: wrap; gap: 4px 3ch; margin-top: 1.4em; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.card {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px 18px;
}
.card > * + * { margin-top: 0.7em !important; }
.card h2 { font-size: 1.1em; }

.job-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.err { color: var(--red); }
.ok { color: var(--green); }

.foot {
  margin-top: 3em !important;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--dim);
  font-size: 0.87em;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 3ch;
}

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

.js .out[data-pending] { display: none; }

@media (max-width: 640px) {
  :root { --pad: 14px; }
  body { font-size: 14px; }
  .titlebar { height: 36px; padding: 0 12px; }
  .cmdbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 4px 6px; font-size: 13px; }
  .cmdbar .label { display: none; }
  .cmdbar a { text-align: center; padding: 8px 0; }
  .term { padding-top: 16px; }
  .form label { grid-template-columns: 1fr; }
  .form label > span { padding-top: 0; }
  .form .btn { margin-left: 0; }
  .promptline { padding-left: 10px; padding-right: 8px; }
  .prompt .ph, #lastlogin { display: none; }
  #lastlogin + .echo { margin-top: 0 !important; }

  html:not(.js) .term .scene { margin-left: calc(100% - 112em); }
  input, textarea { font-size: 16px !important; }
  ::placeholder { font-size: 13px; }
  .out dl { gap: 0.15em 1.5ch; }
}

@media (max-height: 520px) {
  html, body { height: auto; }
  body { display: block; min-height: 0; }
  .window { height: auto; min-height: 100vh; min-height: 100dvh; }
  .term { flex: none; display: flex; flex-direction: column; }
  .term > .intro { order: 1; }
  .term > .stage { order: 2; }
  .term > .stage ~ :not(.intro) { order: 3; }
}

@media (prefers-reduced-motion: no-preference) {
  .cmdbar a, .btn { transition: background-color 0.12s, border-color 0.12s, color 0.12s; }
}

@media print {
  body { display: block; padding: 0; background: #fff; }
  .window { height: auto; max-height: none; box-shadow: none; }
  .term { overflow: visible; }
  .promptline, .cmdbar { display: none; }
}

.toolform { display: flex; flex-wrap: wrap; gap: 10px; max-width: 74ch; }
.toolform .field { flex: 1 1 100%; }
#result:empty { display: none; }
#result {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
  overflow-wrap: anywhere;
}
#result h2 { font-size: 1.05em; }
#result .result-section + .result-section { margin-top: 1.2em; }
