:root { --bg: #0b0f0c; --bar: #151b17; --line: #24302a; --text: #cfe8d6; --dim: #7d9787; --accent: #4cf08a; --second: #ffd166; --error: #ff7b72;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace; }
:root[data-theme="amber"] { --bg: #130d04; --bar: #20170a; --line: #3a2b12; --text: #ffdfa6; --dim: #b08f5c; --accent: #ffb000; --second: #fff0c2; }
:root[data-theme="white"] { --bg: #101113; --bar: #1b1d20; --line: #31343a; --text: #dfe2e6; --dim: #8b929c; --accent: #ffffff; --second: #8cc8ff; }
:root[data-theme="synth"] { --bg: #12041f; --bar: #200a35; --line: #3d1a5e; --text: #ecd9ff; --dim: #a483c4; --accent: #ff5fae; --second: #ffb347; }

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { background: var(--bg); color-scheme: dark; -webkit-text-size-adjust: 100%; }
html, body { height: 100%; overflow: hidden; }
body { color: var(--text); font: 400 15px/1.65 var(--mono); }
input { font: inherit; color: inherit; }
a { color: var(--second); text-underline-offset: 3px; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.window { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.screen { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); cursor: text; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#out { overflow-wrap: break-word; }
#out p { margin: 0; }
.entry { margin: 0 0 12px; }
.banner { font-family: ui-monospace, Menlo, Consolas, "DejaVu Sans Mono", monospace; font-size: clamp(7px, 2.5vw, 17px); line-height: 1.15; color: var(--accent); text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent); margin-bottom: 10px; overflow: hidden; }
.banner-x { color: #9e1b32; text-shadow: 0 0 12px rgba(158, 27, 50, .65); }
.sub { color: var(--dim); }
.ok { color: var(--accent); }
.dim { color: var(--dim); font-size: .9em; }
.error { color: var(--error); }
.hello { margin: 12px 0 !important; }
.kbd { color: var(--accent); font-weight: 700; }
.hl { display: inline-block; padding: 0 .6ch; background: var(--second); color: var(--bg); font-weight: 700; line-height: 1.45; border-radius: 3px; }
.exit { color: var(--text); }
.help .exit { display: inline-block; margin-top: 8px; font-size: 14px; }
.title { margin: 6px 0 !important; color: var(--second); font-weight: 700; }
.echo span { color: var(--accent); }
.note { max-width: 62ch; }
.cat { color: var(--second); line-height: 1.25; margin: 6px 0 10px; }

.table { margin: 4px 0 6px; }
.table p { display: grid; column-gap: 2ch; }
.table.commands p { grid-template-columns: 2ch 11ch minmax(0, 1fr); }
.table.options p { grid-template-columns: 2ch minmax(0, 1fr); }
.table span:first-child { text-align: right; color: var(--dim); }
.table.commands span:nth-child(2) { color: var(--accent); font-weight: 700; }

.projects { list-style: none; counter-reset: p; }
.projects li { counter-increment: p; position: relative; padding: 2px 0 4px 5ch; }
.projects li::before { content: "[" counter(p) "]"; position: absolute; left: 0; color: var(--dim); }
.projects span { display: block; color: var(--dim); }
.contacts { list-style: none; }
.contacts li { display: grid; grid-template-columns: 14ch minmax(0, 1fr); gap: 10px; padding: 1px 0; }
.contacts span { color: var(--dim); }

.message { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); margin: 6px 0; padding-left: 2ch; border-left: 2px solid var(--accent); user-select: all; }

/* строка ввода: настоящее поле прозрачно и лежит поверх нарисованного текста */
.line { position: relative; min-height: 1.65em; overflow-wrap: anywhere; }
.typed { white-space: pre-wrap; }
.suggest { display: flex; flex-wrap: wrap; gap: 2px 2ch; margin-top: 4px; color: var(--dim); }
.suggest span { padding: 0 .5ch; }
.suggest .current { background: var(--accent); color: var(--bg); font-weight: 700; }
.line.busy label, .line.busy .typed { visibility: hidden; }
.progress { margin: 2px 0 8px; }
.bar-cells.error { color: var(--error); }
.bar-cells { color: var(--accent); letter-spacing: 0; white-space: nowrap; font-family: ui-monospace, Menlo, Consolas, "DejaVu Sans Mono", monospace; }
.progress p:nth-child(2) { white-space: pre; }
.services { margin: 2px 0 8px; }
.services p { display: grid; grid-template-columns: 9ch minmax(0, 1fr); }
.services p > span:first-child { white-space: pre; }
.line label { color: var(--accent); margin-right: 1ch; }
.line input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; font-size: 16px; cursor: text; }
.cursor { white-space: pre; box-shadow: inset 0 0 0 1px var(--accent); }
.line.focus .cursor { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 0%, 55% { background: var(--accent); color: var(--bg); } 56%, 100% { background: transparent; } }

/* лёгкие строки развёртки, как на старом мониторе */
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 20; background: repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, .14) 2px 3px); }

/* ---------- переписка ---------- */
.table.commands p { grid-template-columns: minmax(0, 24ch) minmax(0, 1fr); }
.table.commands span:first-child { text-align: left; color: var(--accent); font-weight: 700; }
.msg { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 1ch; }
.msg time { color: var(--dim); }
.msg b { color: var(--second); }
.msg.mine b { color: var(--accent); }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.day { color: var(--dim); text-align: center; margin: 6px 0 !important; }
.notice { color: var(--second); }

@media (max-width: 600px) {
  body { font-size: 14px; }
  .banner { font-size: calc((100vw - 34px) / 29.5); }
  .table.commands p { grid-template-columns: 1fr; padding-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) { .line.focus .cursor { animation: none; background: var(--accent); color: var(--bg); } }
