/* ЭЛТ-терминал в духе современных: бело-серый фосфор на почти чёрном, выпуклое
   стекло, скан-линии, моноширинный шрифт, строгий машинный вид. Весь интерфейс -
   экран внутри рамки-бизеля монитора; контент скроллится внутри экрана. */
:root {
  --screen: #0a0b0d;
  --text: #d7dce2;
  --bright: #ffffff;
  --dim: #78808b;
  --danger: #ff6f6f;
  --border: rgba(255, 255, 255, 0.14);
  --border-bright: rgba(255, 255, 255, 0.4);
  --glow: rgba(205, 218, 236, 0.4);
  --bezel: #16181c;
  --mono: "IBM Plex Mono", ui-monospace, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%; margin: 0; overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px; line-height: 1.55;
  /* тёмная "комната" вокруг монитора */
  background: radial-gradient(130% 110% at 50% 34%, #101215, #050607 74%);
  text-shadow: 0 0 1.5px rgba(205, 218, 236, 0.25);
}

/* корпус монитора (пластик) */
#monitor {
  position: fixed; inset: 6px;
  border-radius: 22px;
  background: linear-gradient(180deg, #23262c 0%, #16181c 55%, #101216 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.08),
    inset 0 -6px 12px rgba(0, 0, 0, 0.6),
    0 24px 60px rgba(0, 0, 0, 0.7);
}
/* экран внутри корпуса; зазор корпуса = бизель */
#app {
  position: absolute; inset: 17px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--screen);
  box-shadow:
    0 0 0 1px #000,
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 0 110px 18px rgba(0, 0, 0, 0.72),
    0 2px 10px rgba(0, 0, 0, 0.7);
}

/* винтики по углам корпуса */
.screw {
  position: absolute; z-index: 3; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #40434a, #15171b 75%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.55), 0 1px 1px rgba(255,255,255,0.06);
}
.screw::before {
  content: ""; position: absolute; top: 50%; left: 1.5px; right: 1.5px; height: 1px;
  background: rgba(0,0,0,0.6); transform: translateY(-50%) rotate(42deg);
}
.screw.tl { top: 5px; left: 5px; }
.screw.tr { top: 5px; right: 5px; }
.screw.bl { bottom: 5px; left: 5px; }
.screw.br { bottom: 5px; right: 5px; }

/* индикатор питания */
#led {
  position: absolute; z-index: 4; bottom: 3px; right: 26px;
  width: 6px; height: 6px; border-radius: 50%;
  background: #6ee08c; box-shadow: 0 0 8px #6ee08c, 0 0 2px #fff;
  animation: ledBlink 4s steps(1) infinite;
}
/* кнопка питания */
#pwr {
  position: absolute; z-index: 4; bottom: 3px; right: 8px;
  width: 12px; height: 5px; border-radius: 2px;
  background: linear-gradient(180deg, #30333a, #17191d);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 1px 1px rgba(0,0,0,0.5);
}
/* шильдик */
#brand {
  position: absolute; z-index: 4; bottom: 1px; left: 16px;
  font-family: var(--mono); font-size: 7px; letter-spacing: 0.22em;
  color: rgba(255,255,255,0.2);
}
/* проводки из-под монитора */
#cables {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  width: 240px; height: 96px; margin-top: -8px; z-index: -1; overflow: visible;
}
#cables { display: none; }
#cables path { fill: none; stroke-linecap: round; }
#cables .c1 { stroke: #0d0e11; stroke-width: 7; }
#cables .c2 { stroke: #1a1c20; stroke-width: 5; }
/* выпуклость стекла: вигнетка по краям + верхний блик */
#app::before {
  content: ""; position: absolute; inset: 0; z-index: 18; pointer-events: none;
  border-radius: 12px;
  background:
    radial-gradient(140% 120% at 50% 46%, transparent 56%, rgba(0,0,0,0.55) 100%),
    radial-gradient(75% 42% at 50% 3%, rgba(210,222,238,0.05), transparent 70%);
}
/* скан-линии + мерцание */
#app::after {
  content: ""; position: absolute; inset: 0; z-index: 19; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.22) 0 1px, transparent 1px 3px);
  animation: flicker 5s steps(50) infinite;
}
/* бегущая полоса развёртки */
#scan {
  position: absolute; left: 0; right: 0; top: -160px; height: 160px;
  z-index: 20; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(210,222,238,0.05), transparent);
  animation: scan 7s linear infinite;
}


/* область контента - скроллится внутри экрана */
#view {
  position: absolute; inset: 0 0 52px 0; overflow-y: auto;
  padding: 22px 18px 26px;
}

h1 {
  font-size: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--bright); text-shadow: 0 0 8px var(--glow);
  margin: 4px 0 18px;
}
h1::before { content: "> "; color: var(--dim); }
h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; color: var(--dim); margin: 24px 0 10px; }
h2::before { content: "// "; }
.hint { color: var(--dim); font-size: 13px; }
.dim { color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; font-size: 12px; }
.center { text-align: center; }
.spacer { height: 10px; }

/* панели-строки */
.card, .task {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-bottom: 7px;
}
.card { padding: 14px 16px; }
.readout { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.row { display: flex; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }

/* задача */
.task {
  padding: 11px 14px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; user-select: none;
  transition: background .1s steps(2), border-color .1s steps(2), opacity .2s steps(3);
}
.task:hover { background: rgba(255,255,255,0.07); border-color: var(--border-bright); }
.task.done { opacity: 0.45; }
.task.done .task-text { text-decoration: line-through; }
.box {
  flex: none; color: var(--bright); font-weight: 600; letter-spacing: -0.05em;
  text-shadow: 0 0 6px var(--glow); white-space: pre;
  padding: 2px 2px; margin: -2px -2px;
}
.task-main { flex: 1; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.task-time { flex: none; color: var(--dim); font-size: 13px; }
.task-text { flex: 1; min-width: 0; }
.task-rec { flex: none; color: var(--dim); font-size: 9px; letter-spacing: 0.12em; border: 1px solid var(--border); border-radius: 2px; padding: 1px 4px; }
.task-pts { color: var(--bright); white-space: nowrap; }
.task-pts::before { content: "+"; color: var(--dim); }

/* "Новая шапка!" - показывается на задаче, чьё выполнение прямо сейчас
   пересечёт порог дропа (см. wouldDropHat/handleTasksList) - миниатюра
   справа от фразы это РЕАЛЬНОЕ превью того, что выпадет (шапка уже
   забронирована на бэкенде - см. ensurePendingHat), не рандомная картинка */
.task-hat-drop {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: -3px 0 7px; padding: 6px 14px 8px;
  border: 1px solid var(--border-bright); border-top: none; border-radius: 0 0 3px 3px;
  background: rgba(255,255,255,0.03);
}
.task-hat-drop-label { color: var(--bright); font-size: 12px; text-shadow: 0 0 6px var(--glow); white-space: nowrap; }
.task-hat-drop-art { flex: none; color: var(--dim); font-size: 11px; line-height: 1.2; }

/* раскрываемое описание задачи */
.task-desc {
  margin: -4px 0 8px 40px; padding: 8px 12px;
  border-left: 1px solid var(--border-bright);
  color: var(--text); font-size: 13px; white-space: pre-wrap;
  background: rgba(255,255,255,0.02);
}
.task-desc[hidden] { display: none; }
.task-desc::before { content: "// "; color: var(--dim); }
.task-desc .btn { display: block; width: auto; margin-top: 8px; }

/* экран задач: шапка и низ зафиксированы, скроллится только список */
.tasks-screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 22px 18px 10px; }
.tasks-screen h1 { flex: none; }
.tasks-head { flex: none; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.tasks-head h1 { margin-bottom: 10px; }
/* если заголовок с кнопками не помещаются в строку - кнопки уходят на свою
   строку и прижимаются вправо, а не заставляют экран скроллиться вбок.
   Скобки-ASCII вокруг пары кнопок метят их как единую группу терминала. */
.tasks-head-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.tasks-head-actions::before { content: "["; color: var(--dim); margin-right: 6px; }
.tasks-head-actions::after { content: "]"; color: var(--dim); margin-left: 6px; }

/* шапка с кнопкой "назад" вместо заголовка со стандартной "> " */
.tasks-head.with-back { justify-content: flex-start; align-items: center; }
.tasks-head.with-back h1 { margin-bottom: 0; }
.backbtn + h1::before { content: none; }
.backbtn {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 6px 10px; margin-right: 12px;
  border: 1px solid var(--border-bright); border-radius: 3px;
  background: transparent; cursor: pointer;
  color: var(--bright); font-family: var(--mono); font-size: 12px;
  transition: background .1s steps(2), box-shadow .1s steps(2);
}
.backbtn:hover { background: rgba(255,255,255,0.13); box-shadow: 0 0 14px rgba(205,218,236,0.14); }
.backbtn-arrow {
  display: inline-block; text-shadow: 0 0 6px var(--glow);
  transform: scaleX(-1); animation: flipArrow .3s steps(3);
}
.backbtn-label { color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
@keyframes flipArrow { from { transform: scaleX(1); } to { transform: scaleX(-1); } }
.linkbtn { background: none; border: none; color: var(--dim); cursor: pointer; font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.linkbtn:hover { color: var(--bright); text-shadow: 0 0 6px var(--glow); }
.task.selected { border-color: var(--border-bright); background: rgba(255,255,255,0.09); }
.selbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0 2px; }
.selbar span { color: var(--dim); font-size: 13px; }

/* модалка */
.modal-ov { position: absolute; inset: 0; z-index: 40; background: rgba(0,0,0,0.62); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { width: 100%; max-width: 320px; background: var(--screen); border: 1px solid var(--border-bright); border-radius: 4px; padding: 18px; box-shadow: 0 0 34px rgba(0,0,0,0.6); }
.modal-title { color: var(--bright); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; text-shadow: 0 0 8px var(--glow); }
.modal .btn { margin-top: 8px; }
.tasklist { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 2px 4px; }
.tasks-footer { flex: none; padding-top: 8px; }
.tasks-footer .datenav { margin-top: 12px; }

/* подвкладки задач */
.subtabs { display: flex; gap: 6px; margin-bottom: 16px; }
.subtab {
  flex: 1; padding: 9px; border: 1px solid var(--border); border-radius: 3px;
  background: transparent; color: var(--dim); cursor: pointer;
  font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px;
  transition: background .1s steps(2), color .1s steps(2);
}
.subtab.active { background: rgba(255,255,255,0.1); color: var(--bright); border-color: var(--border-bright); text-shadow: 0 0 6px var(--glow); }

/* навигация по датам - степпер по дню туда-обратно, дата по центру, рядом
   мелкая ссылка "Сегодня" если ушёл с текущего дня, календарь на
   произвольный прыжок. Вместо ряда чипов по каждой дате с задачами -
   тот рос без границ и не показывал, где сегодня относительно того, что видно. */
.datenav { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.datebtn {
  flex: none; width: 34px; height: 30px; border: 1px solid var(--border); border-radius: 3px;
  background: transparent; color: var(--dim); cursor: pointer;
  font-family: var(--mono); font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: color .2s ease, border-color .2s ease;
}
.datebtn:hover { color: var(--bright); border-color: var(--border-bright); }
.datenav-center { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
.datenav-label {
  color: var(--bright); font-family: var(--mono); font-size: 13px;
  letter-spacing: 0.04em; text-shadow: 0 0 6px var(--glow); white-space: nowrap;
}
.datechip {
  flex: none; padding: 3px 8px; border: 1px solid var(--border); border-radius: 3px;
  background: transparent; color: var(--dim); cursor: pointer;
  font-family: var(--mono); font-size: 11px; white-space: nowrap;
}
.datechip:hover { color: var(--bright); border-color: var(--border-bright); }
.calbtn {
  position: relative; flex: none; width: 34px; height: 30px;
  border: 1px solid var(--border-bright); border-radius: 3px;
  display: flex; align-items: center; justify-content: center; color: var(--bright); cursor: pointer;
}
.calbtn svg { width: 17px; height: 17px; }
.calbtn input[type=date] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
/* Chrome/WebKit открывает пикер только по клику на встроенную иконку календаря,
   не по всему полю - без этого кликабельным оказывался только маленький кусок
   невидимого инпута, а не вся видимая кнопка (десктоп, мышью, это сразу заметно) */
.calbtn input[type=date]::-webkit-calendar-picker-indicator {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0;
}

/* поле с меткой */
.field { margin: 12px 0; }
.field label { display: block; margin-bottom: 6px; }
.field.two { display: flex; gap: 10px; }
.field.two > div { flex: 1; }

/* экран активного чата: шапка и низ (ввод + завершить) зафиксированы, скроллится только лог */
.chat-screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 22px 18px 10px; }
.chat-screen h1 { flex: none; }
.chat-footer { flex: none; padding-top: 10px; }

/* сцена компаньона: ascii-кролик + шапка рисуются в canvas (см.
   renderCompanionStage в app.js), не текстом - раньше это был один <pre>,
   и совмещение строк (низ шапки на голове) держалось на ручном разборе
   пробелов, зависело от line-height/шрифта конкретного устройства и на
   части экранов шапка визуально разваливалась на куски. Canvas кладёт
   каждый символ на пиксельную позицию, которую считаем сами. */
/* margin-top:auto прижимает кролика+биографию к низу экрана (к подвкладкам),
   а не даёт им повиснуть под шапкой с пустотой снизу - весь пустой запас
   высоты уходит наверх, под заголовок, вместо низа */
/* position:relative - якорь для .companion-bubble (position:absolute,
   растёт вверх от сцены, см. ниже) */
.companion-stage { position: relative; flex: none; text-align: center; padding: 26px 0 14px; margin-top: auto; }
/* контейнер под canvas тела/шапки (см. renderCompanionStage) - сам без
   размеров, их выставляет JS по факту нарисованного. display:block - не
   inline-block: соседний .companion-bubble тоже inline-block, и с ним оба
   вставали в один ряд бок о бок вместо того, чтобы идти друг под другом. */
.companion-sprite { display: block; width: fit-content; margin: 0 auto; }

/* диалоговое облачко - последняя реплика компаньона, печатается по буквам
   при открытии вкладки; хвостик указывает вниз, на самого компаньона.
   position:absolute, bottom:100% - подвешено СВЕРХУ .companion-stage, растёт
   вверх по мере печати текста, а не толкает компаньона+био вниз по экрану
   (раньше пузырь был в обычном потоке НАД спрайтом, и рост его высоты во
   время печати двигал спрайт+био ниже - "прыгали") */
.companion-bubble {
  position: absolute; left: 50%; bottom: calc(100% + 14px); transform: translateX(-50%);
  max-width: 280px; padding: 10px 14px;
  border: 1px solid var(--border-bright); border-radius: 6px;
  background: rgba(255,255,255,0.04); color: var(--bright);
  font-size: 13px; line-height: 1.4; text-align: left;
  text-shadow: 0 0 5px var(--glow); min-height: 1.4em;
}
.companion-bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  border-left: 7px solid transparent; border-right: 7px solid transparent;
  border-top: 7px solid var(--border-bright);
}

/* шапка чата - кролик (со своей шапкой, если есть) мини-иконкой рядом с
   заголовком, а не во весь экран */
.companion-chat-head { align-items: center; justify-content: flex-start; gap: 10px; }
.companion-chat-head h1 { margin-bottom: 0; }
.companion-mini-stage { flex: none; display: flex; flex-direction: column; align-items: center; }
.companion-sprite-mini { flex: none; display: inline-block; }

/* нижняя подвкладка внутри "Компаньон" - профиль/чат/инвентарь */
.companion-subtabs { margin-top: auto; margin-bottom: 0; padding-top: 10px; border-top: 1px solid var(--border); }

/* аксессуар накладывается поверх базового рисунка шапки - должен выбиваться */
.hat-accessory { color: var(--bright); text-shadow: 0 0 6px var(--glow); }

/* инвентарь шапок */
.hat-name { color: var(--bright); text-shadow: 0 0 6px var(--glow); margin-bottom: 2px; }
.hat-card-ascii { flex: none; color: var(--dim); font-size: 11px; line-height: 1.2; }

/* чат поддержки */
.chat {
  display: flex; flex-direction: column; gap: 7px;
  max-height: 54vh; overflow-y: auto;
  padding: 12px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 3px;
  background: rgba(0, 0, 0, 0.22);
}
.chat.readonly { max-height: 40vh; opacity: 0.85; }
.chat-screen .chat { flex: 1; max-height: none; margin-bottom: 0; }
.msg {
  max-width: 84%; padding: 7px 11px;
  border: 1px solid var(--border); border-radius: 3px;
  font-size: 14px; white-space: pre-wrap; word-break: break-word;
}
.msg-who { display: block; font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 3px; }
.msg.mine { align-self: flex-end; border-color: var(--border-bright); background: rgba(255,255,255,0.06); color: var(--bright); }
.msg.them { align-self: flex-start; }
.msg.pending { opacity: 0.5; }
/* эскалационное сообщение - вне характера компаньона, должно выделяться */
.msg.system {
  align-self: center; max-width: 100%; text-align: center;
  border-color: rgba(255,111,111,0.4); background: rgba(255,111,111,0.06);
  color: var(--bright);
}
.msg.system .msg-who { color: var(--danger); }
/* короткое описание характера компаньона над чатом */
.companion-bio { padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.chat-input { display: flex; gap: 8px; margin-bottom: 10px; }
.chat-input input { flex: 1; }
.chat-input .btn { width: auto; flex: none; padding: 0 18px; font-size: 16px; }

/* админ: просмотр чатов */
.admin-top { flex: none; }
.sortsel { display: flex; gap: 12px; }
.linkbtn.on { color: var(--bright); text-shadow: 0 0 6px var(--glow); }
.chat-meta { color: var(--dim); font-size: 12px; margin-bottom: 8px; word-break: break-word; }
.chat-meta::before { content: "// "; }

/* кнопки */
button { font-family: var(--mono); font-size: 14px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px;
  border: 1px solid var(--border-bright); border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--bright); cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500;
  text-shadow: 0 0 7px var(--glow);
  transition: background .1s steps(2), box-shadow .1s steps(2);
}
.btn:hover { background: rgba(255,255,255,0.13); box-shadow: 0 0 20px rgba(205,218,236,0.18), inset 0 0 20px rgba(205,218,236,0.06); }
.btn:active { background: rgba(255,255,255,0.2); }
.btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(255,111,111,0.4); text-shadow: 0 0 8px rgba(255,111,111,0.35); }
.btn.small { width: auto; padding: 7px 14px; font-size: 12px; }

/* поля */
input[type=text], input[type=number], input[type=time], input[type=date], textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 3px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--bright); caret-color: var(--bright);
  font-family: var(--mono); font-size: 15px;
  text-shadow: 0 0 5px var(--glow);
}
textarea { min-height: 76px; resize: vertical; margin: 6px 0; line-height: 1.5; }
input:focus, textarea:focus { outline: none; border-color: var(--border-bright); box-shadow: 0 0 14px rgba(205,218,236,0.12); }
input::placeholder, textarea::placeholder { color: var(--dim); }
input[type=time]::-webkit-calendar-picker-indicator,
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(0.85); opacity: 0.6; cursor: pointer; }

/* toggle */
.toggle { display: flex; margin: 13px 0; border: 1px solid var(--border); border-radius: 3px; overflow: hidden; }
.toggle button {
  flex: 1; padding: 10px; border: none; border-right: 1px solid var(--border);
  background: transparent; color: var(--dim); cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px;
  transition: background .2s ease, color .2s ease;
}
.toggle button:last-child { border-right: none; }
.toggle button.active { background: rgba(255,255,255,0.12); color: var(--bright); text-shadow: 0 0 6px var(--glow); }

/* нижняя навигация - внутри экрана. На телефоне вкладок (до 7 у admin) больше,
   чем помещается растянутым рядом - там #tabs всплывает списком поверх
   компактной #tabs-toggle вместо того, чтобы сжимать подписи. На десктопе
   (см. media query) #tabs - обычная боковая панель, #tabs-toggle скрыта. */
#tabs-toggle {
  display: none; position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  height: 52px; border: none; border-top: 1px solid var(--border);
  background: rgba(6, 7, 9, 0.9); color: var(--bright);
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em;
  text-transform: uppercase; text-shadow: 0 0 8px var(--glow); cursor: pointer;
}
.tabs-toggle-arrow { display: inline-block; transition: transform .18s ease; }
#tabs-toggle.open .tabs-toggle-arrow { transform: rotate(180deg); }
#tabs {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  height: 52px; display: flex;
  background: rgba(6, 7, 9, 0.9);
  border-top: 1px solid var(--border);
}
#tabs button {
  flex: 1; padding: 12px 4px; border: none; background: none;
  color: var(--dim); font-size: 11px; cursor: pointer;
  font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em;
  transition: color .2s ease;
}
#tabs button.active { color: var(--bright); text-shadow: 0 0 8px var(--glow); }

@media (max-width: 819px) {
  #tabs-toggle { display: block; }
  #tabs {
    display: none;
    bottom: 52px; height: auto; max-height: 60vh; overflow-y: auto;
    flex-direction: column; border-top: none; border-bottom: 1px solid var(--border-bright);
    box-shadow: 0 -8px 24px rgba(0,0,0,0.4);
  }
  /* "выезжает" снизу и печатается построчно, как терминал рисует свою же графику -
     тот же приём, что и в printIn для #view, просто со сдвигом снизу вверх */
  #tabs.open { display: flex; animation: menuPullOut .22s steps(6, end) both; }
  #tabs.open::before {
    content: ""; position: absolute; top: 0; left: 0; height: 1px; width: 100%;
    background: var(--border-bright); box-shadow: 0 0 6px var(--glow);
    animation: drawLine .18s steps(8, end) both;
  }
  #tabs.open button { opacity: 0; animation: printIn .22s steps(4, end) forwards; }
  #tabs.open button:nth-child(1) { animation-delay: .02s; }
  #tabs.open button:nth-child(2) { animation-delay: .05s; }
  #tabs.open button:nth-child(3) { animation-delay: .08s; }
  #tabs.open button:nth-child(4) { animation-delay: .11s; }
  #tabs.open button:nth-child(5) { animation-delay: .14s; }
  #tabs.open button:nth-child(6) { animation-delay: .17s; }
  #tabs.open button:nth-child(7) { animation-delay: .20s; }
  #tabs button {
    flex: none; text-align: left; padding: 14px 18px; font-size: 13px;
    border-bottom: 1px solid var(--border);
  }
  #tabs button::before { content: "  "; }
  /* активная вкладка и так названа на самой кнопке-тоггле со стрелкой - повторять
     её в списке незачем, при открытии показываем только то, куда можно перейти */
  #tabs button.active { display: none; }
}

@keyframes menuPullOut {
  0% { transform: translateY(100%); opacity: 0.4; }
  60% { transform: translateY(-4px); }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes drawLine { from { width: 0; } to { width: 100%; } }

/* крупный показатель */
.big-number {
  font-family: var(--mono); font-size: 40px; font-weight: 600; color: var(--bright);
  text-shadow: 0 0 16px var(--glow), 0 0 4px rgba(255,255,255,0.5);
}

/* лого/курсор */
.term-logo {
  font-size: 40px; font-weight: 600; letter-spacing: 0.18em; color: var(--bright);
  text-shadow: 0 0 16px var(--glow); margin-bottom: 10px;
}
.cursor {
  display: inline-block; width: 0.55em; height: 1.05em; margin-left: 5px;
  background: var(--bright); vertical-align: -0.16em;
  box-shadow: 0 0 8px var(--glow);
  animation: blink 1.1s steps(1) infinite;
}

/* тост - внутри экрана */
.toast {
  position: absolute; bottom: 66px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(14, 16, 20, 0.95);
  border: 1px solid var(--border-bright);
  color: var(--bright); border-radius: 3px;
  padding: 11px 18px; font-family: var(--mono); font-size: 14px;
  text-shadow: 0 0 7px var(--glow);
  opacity: 0; pointer-events: none; z-index: 30;
  box-shadow: 0 0 24px rgba(205,218,236,0.16);
  white-space: pre-line; text-align: center; line-height: 1.5;
}
.toast::before { content: "[ "; color: var(--dim); }
.toast::after { content: " ]"; color: var(--dim); }
.toast.show { animation: toastIn .12s steps(2) forwards; }

/* текстовый спиннер как в старом терминале */
.spinner {
  display: inline-block; width: 1ch; flex: none;
  color: var(--bright); font-weight: 600; text-shadow: 0 0 6px var(--glow);
}
.spinner::before { content: "|"; animation: spinner .28s steps(1) infinite; }

/* экран входа */
.login { max-width: 340px; margin: 0 auto; padding-top: 20vh; text-align: center; }
.login .login-btn { max-width: 260px; margin: 26px auto 8px; }
.no-nav #tabs, .no-nav #tabs-toggle { display: none; }
.no-nav #view { bottom: 0; }

/* появление контента - строки впечатываются рывками, по очереди */
#view > * { animation: printIn .26s steps(5, end) both; }
#view > *:nth-child(2) { animation-delay: .07s; }
#view > *:nth-child(3) { animation-delay: .14s; }
#view > *:nth-child(4) { animation-delay: .21s; }
#view > *:nth-child(5) { animation-delay: .28s; }
#view > *:nth-child(n+6) { animation-delay: .35s; }

@keyframes printIn { 0% { opacity: 0; } 40% { opacity: 0.15; } 55% { opacity: 0.7; } 70% { opacity: 0.2; } 100% { opacity: 1; } }
@keyframes spinner { 0% { content: "|"; } 25% { content: "/"; } 50% { content: "-"; } 75% { content: "\\"; } }
@keyframes toastIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes blink { 0%,50% { opacity: 1; } 51%,100% { opacity: 0; } }
@keyframes flicker { 0%,100% { opacity: 1; } 4% { opacity: 0.85; } 8% { opacity: 1; } 48% { opacity: 0.95; } 52% { opacity: 0.88; } 56% { opacity: 1; } }
@keyframes scan { 0% { top: -160px; } 100% { top: 100%; } }
@keyframes ledBlink { 0%,94% { opacity: 1; } 95%,100% { opacity: 0.35; } }
@keyframes blinkText { 0%,60% { opacity: 1; } 61%,100% { opacity: 0.35; } }
.processing { animation: blinkText 0.9s steps(1) infinite; }

/* десктоп - монитор как центрированный объект в тёмной комнате */
@media (min-width: 820px) {
  #monitor {
    inset: auto;
    top: 46%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(1000px, calc(100vw - 96px));
    height: min(700px, calc(100vh - 150px));
    border-radius: 28px;
  }
  #app { inset: 18px; border-radius: 12px; }
  #cables { display: block; }
  .toast { bottom: 30px; }

  #tabs {
    top: 0; bottom: 0; left: 0; right: auto; width: 232px; height: auto;
    flex-direction: column; align-items: stretch;
    border-top: none; border-right: 1px solid var(--border);
    padding: 28px 12px; gap: 2px;
    background: rgba(6, 7, 9, 0.5);
  }
  #tabs button {
    flex: none; text-align: left; padding: 11px 14px; font-size: 13px;
  }
  #tabs button::before { content: "  "; }
  #tabs button.active::before { content: "> "; }
  #view {
    inset: 0 0 0 232px;
    padding: 38px clamp(28px, 5vw, 80px) 44px;
  }
  #view > * { max-width: 720px; }
  .no-nav #view { inset: 0; }
  h1 { font-size: 19px; }
  .toast { bottom: 30px; }
}
