:root {
  --bg: #060a07;
  --fg: #a9f0b6;
  --muted: #4e7a58;
  --accent: #33ff66;
  --border: #12331c;
  --glow: 0 0 8px rgba(51, 255, 102, .45);
  --bloom: 0 0 5px rgba(51, 255, 102, .16);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
[data-theme="light"] {
  --bg: #f2f0e6;
  --fg: #23281f;
  --muted: #77816f;
  --accent: #0b8f4d;
  --border: #dbd8c8;
  --glow: none;
  --bloom: none;
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  height: var(--vvh, 100dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  font-variant-ligatures: none;
  line-height: 1.7;
}

#scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

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

[data-theme="dark"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .16) 0 1px, transparent 1px 3px);
  opacity: .38;
}
[data-theme="dark"] body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 38%, transparent 58%, rgba(0, 0, 0, .42) 100%);
}

.screen {
  max-width: 860px;
  margin: 0 auto;
  padding: 22px 20px 16px;
  text-shadow: var(--bloom);
}
.line { white-space: pre-wrap; word-break: break-word; }
.line.echo { margin-top: 16px; }
.line.out { margin-top: 4px; }
.line.sys { color: var(--muted); }
.ps1 {
  color: var(--accent);
  font-weight: 600;
  user-select: none;
  text-shadow: var(--glow);
}
.dots::after { content: "▮"; color: var(--accent); animation: blink 1s step-end infinite; }

.promptline {
  position: relative;
  margin-top: 16px;
  min-height: 1.7em;
  white-space: pre-wrap;
  word-break: break-word;
}
#cursor {
  color: var(--accent);
  text-shadow: var(--glow);
  animation: blink 1.06s step-end infinite;
}
.promptline.blurred #cursor { animation: none; opacity: .45; }
.promptline.busy > span { visibility: hidden; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.promptline input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: none;
  outline: none;
  background: transparent;
  color: transparent;
  font-family: var(--mono);
  font-size: 16px;
  caret-color: transparent;
}

.statusbar {
  flex: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 10px;
  font-size: .78rem;
  color: var(--muted);
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.sb-left {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  padding: 1px 9px;
  text-shadow: none;
}
.sb-mid { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-right { display: flex; align-items: center; gap: 10px; }
#clock { color: var(--fg); }
.statusbar button {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.statusbar button:hover { color: var(--accent); }

.sb-link { color: var(--muted); text-decoration: none; }
.sb-link:hover { color: var(--accent); }

.doc { max-width: 720px; margin: 0 auto; padding: 30px 20px 48px; text-shadow: var(--bloom); }
.doc h1 { color: var(--accent); font-size: 1.3rem; margin: 0 0 2px; text-shadow: var(--glow); }
.doc h2 { color: var(--accent); font-size: 1rem; margin: 26px 0 6px; }
.doc p, .doc li { line-height: 1.7; margin: 6px 0; }
.doc ul { margin: 6px 0; padding-left: 20px; }
.doc a { color: var(--accent); }
.doc .meta { color: var(--muted); font-size: .85rem; margin-bottom: 18px; }
.doc .back { display: inline-block; margin-top: 28px; color: var(--accent); text-decoration: none; }
.doc .back::before { content: "‹ "; }

@media (max-width: 520px) {
  .sb-mid { display: none; }
  body { font-size: 14px; }
}
