/* 1838.su — общий визуальный слой. Содержимое команд находится только в terminal.js. */
:root {
  color-scheme: dark;
  --bg: #090c10;
  --panel: #10161d;
  --panel-deep: #0b1016;
  --dialog: #171e27;
  --border: #2f3d48;
  --border-soft: #26333e;
  --text: #e6edf4;
  --text-dim: #adbfce;
  --muted: #8fa6b7;
  --accent: #73dce9;
  --accent-hover: #98eaf3;
  --success: #a0e5aa;
  --warning: #e5bc75;
  --error: #f1808f;
  --focus: #c4f2f7;
  --mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Единый адаптивный размер текста терминала. Масштабируется и на больших дисплеях. */
  --terminal-font-size: clamp(15px, calc(11px + 0.52vw), 22px);
  --ui-font-size: clamp(12px, calc(9px + 0.32vw), 16px);
}
*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--mono); }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }

.app-shell {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  padding: clamp(14px, 2.5vw, 48px);
}
.terminal-window {
  display: flex; flex-direction: column;
  width: 100%; height: calc(100dvh - clamp(28px, 5vw, 96px));
  min-height: 390px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 26px 85px #0008, 0 1px 0 #ffffff08 inset;
}
.window-header {
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  padding: clamp(16px, 1.4vw, 25px) clamp(18px, 2vw, 36px); min-height: 79px; background: #131a22; border-bottom: 1px solid var(--border-soft);
}
.identity { display: flex; gap: 14px; align-items: center; min-width: 0; }
.identity-icon { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border: 1px solid #395a65; border-radius: 11px; color: var(--accent); background: #13242b; }
.identity-icon svg { width: 23px; height: 23px; }
.identity-text { min-width: 0; }
.identity h1 { margin: 0 0 4px; font: 600 clamp(18px, calc(11px + 0.6vw), 26px)/1.3 var(--mono); color: var(--text); overflow-wrap: anywhere; }
.identity p { margin: 0; font: 400 var(--ui-font-size)/1.5 var(--mono); color: var(--muted); }
.session-indicator { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 9px; color: var(--muted); letter-spacing: .09em; font: 500 clamp(11px, calc(8px + 0.3vw), 15px)/1.4 var(--mono); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px #a0e5aa19; }
.terminal-body { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: clamp(20px, 2.5vw, 44px); background: var(--panel-deep); }
/* Prompt расположен сразу за выводом, как в SSH, а не прижат к низу пустого окна.
   При длинной истории область вывода сжимается и получает прокрутку. */
.terminal-output { flex: 0 1 auto; min-height: 0; overflow: auto; overflow-wrap: anywhere; padding: 0 4px 16px 0; scrollbar-color: #3c5363 transparent; scrollbar-width: thin; }
.output-line { font: 400 var(--terminal-font-size)/1.75 var(--mono); color: var(--text-dim); min-height: 1.85em; white-space: pre-wrap; overflow-wrap: anywhere; }
.output-line--primary { color: var(--text); font-weight: 600; }
.output-line--muted { color: var(--muted); }
.output-line--success { color: var(--success); }
.output-line--warning { color: var(--warning); }
.output-line--error { color: var(--error); }
.output-line--normal { color: var(--text-dim); }
.output-entry { margin: 0 0 7px; display: flex; flex-wrap: wrap; gap: 0 10px; align-items: baseline; }
.output-entry .output-prompt { flex-shrink: 0; }
.output-command { color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
.output-prompt, .shell-prompt { font-weight: 600; font-size: var(--terminal-font-size); line-height: 1.65; white-space: nowrap; }
.prompt-user { color: var(--success); }
.prompt-separator, .prompt-path { color: var(--text-dim); }
.prompt-host { color: var(--accent); }
.command-form {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 12px 0 4px; min-height: 49px; border-top: 1px solid var(--border-soft);
}
.command-input { flex: 1 1 90px; min-width: 55px; width: 100%; background: transparent; border: 0; border-radius: 0; outline: none; padding: 6px 0; color: var(--text); caret-color: var(--accent); font: 500 var(--terminal-font-size)/1.45 var(--mono); }
.command-input:focus-visible { outline: none; }
.command-form:focus-within { border-top-color: #47717e; }
.command-input:disabled { opacity: .5; cursor: not-allowed; }
.enter-key { display: grid; place-items: center; flex: 0 0 35px; width: 35px; height: 35px; background: #142630; border: 1px solid #395866; border-radius: 8px; color: var(--accent); }
.enter-key:hover:not(:disabled) { background: #1b3440; border-color: var(--accent); }
.enter-key:disabled { opacity: .48; cursor: not-allowed; }
.enter-key svg { width: 17px; height: 17px; }
.window-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 46px; padding: 12px clamp(18px, 2vw, 36px); border-top: 1px solid var(--border-soft); background: #121920; color: var(--muted); font: 400 var(--ui-font-size)/1.5 var(--mono); }
.window-footer a { flex: 0 0 auto; }

/* Дисклеймер — одинаковый для каждого домена, меняется только строка локации. */
.dialog-backdrop { position: fixed; inset: 0; z-index: 10; display: flex; justify-content: center; align-items: center; padding: 20px; padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: #020408c9; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.welcome-dialog { width: min(100%, 570px); max-height: min(94dvh, 800px); overflow-y: auto; padding: clamp(22px, 4vw, 34px); background: var(--dialog); border: 1px solid #425361; border-radius: 18px; box-shadow: 0 22px 100px #000b, 0 1px 0 #ffffff12 inset; scrollbar-color: #52636e transparent; }
.dialog-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 23px; }
.dialog-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #19313a; color: var(--accent); }
.dialog-icon svg { width: 23px; height: 23px; }
.dialog-heading h2 { margin: 0; font: 650 clamp(20px, 4.6vw, 24px)/1.4 var(--sans); letter-spacing: -.03em; }
/* Заголовок получает программный фокус для screen reader, но это не интерактивный элемент. */
#welcome-title:focus { outline: none; box-shadow: none; }
.dialog-copy { font: 400 clamp(15px, calc(13px + 0.2vw), 17px)/1.75 var(--sans); color: #d5e0e8; }
.dialog-copy p { margin: 0 0 15px; }
.dialog-copy .site-location { margin-top: 21px; font-weight: 600; color: var(--text); }
.dialog-copy .primary-site { margin-bottom: 0; color: var(--text-dim); }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 28px; }
.dialog-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 47px; border: 1px solid #9ce5ed; border-radius: 10px; padding: 12px 19px; background: var(--accent); color: #071319; font: 650 14px/1.3 var(--sans); transition: background-color .15s ease, transform .15s ease; }
.dialog-actions button:hover { background: #a2f0f8; }
.dialog-actions button:active { transform: translateY(1px); }
.noscript-warning { padding: 12px; color: var(--warning); border: 1px solid #6c5937; border-radius: 8px; font: 13px/1.5 var(--sans); }

/* Самостоятельные статические страницы ошибок — без JS. */
.error-window { height: auto; min-height: 470px; max-width: 830px; }
.error-indicator { color: var(--error); }
.error-content { display: flex; flex-direction: column; flex: 1; align-items: flex-start; padding: clamp(30px, 5vw, 52px); background: var(--panel-deep); }
.distro-line { margin: 0 0 35px; color: var(--muted); font: 400 12px/1.5 var(--mono); }
.error-code { margin: 0 0 3px; color: var(--error); font: 650 clamp(52px, 9vw, 86px)/1.1 var(--mono); letter-spacing: -.06em; }
.error-english { margin: 0 0 22px; color: var(--muted); font: 500 12px/1.4 var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.error-content h2 { margin: 0 0 14px; color: var(--text); font: 650 clamp(19px, 3.4vw, 26px)/1.4 var(--sans); }
.error-aside { margin: 0; max-width: 640px; color: var(--text-dim); font: 400 clamp(14px, 1.8vw, 16px)/1.7 var(--sans); }
.error-links { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 25px; margin-top: 46px; }
.action-link { display: inline-flex; justify-content: center; align-items: center; min-height: 41px; padding: 10px 14px; border-radius: 9px; background: #17333e; border: 1px solid #477686; font: 600 13px/1.35 var(--sans); text-decoration: none; }
.action-link:hover { background: #204350; }
.subtle-link { font: 400 13px/1.4 var(--sans); }

@media (max-width: 620px) {
  :root { --terminal-font-size: clamp(14px, 3.8vw, 16px); --ui-font-size: 11px; }
  .app-shell { padding: 0; min-height: 100dvh; align-items: stretch; }
  .terminal-window { height: 100dvh; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
  .window-header { gap: 8px; padding: 15px 15px; min-height: 76px; }
  .identity { gap: 10px; }
  .identity-icon { width: 34px; height: 34px; border-radius: 9px; }
  .identity-icon svg { width: 20px; height: 20px; }
  .identity p { font-size: 10px; }
  .session-indicator { font-size: 0; gap: 0; }
  .status-dot { width: 8px; height: 8px; }
  .terminal-body { padding: 19px 15px; }
  .window-footer { padding: 12px 15px; font-size: 10px; }
  .welcome-dialog { border-radius: 14px; }
  .dialog-copy { font-size: 14px; line-height: 1.68; }
  .error-layout .app-shell { min-height: 100dvh; }
  .error-window { min-height: 100dvh; }
  .error-content { padding: 34px 21px; }
  .error-indicator { font-size: 9px; }
}
@media (max-width: 360px) {
  .identity p { font-size: 9px; }
  .window-footer { flex-wrap: wrap; }
  .command-form { column-gap: 6px; }
  .shell-prompt { font-size: 12px; }
  .dialog-backdrop { padding: 10px; }
  .welcome-dialog { padding: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
