/* HUD голосового Лу: голографический интерфейс, цвет задаёт --hud (r,g,b) из hud.js. */
:root {
  --hud: 57, 212, 255;
  --bg: #020509;
  --text: #e6fbff;
  --level: 0;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Exo 2", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: rgb(var(--hud));
  font-family: var(--sans); user-select: none; -webkit-user-select: none;
}

#app {
  position: relative; height: 100%; display: grid; color: rgb(var(--hud));
  grid-template-rows: auto 1fr auto auto auto auto;
  padding: max(14px, env(safe-area-inset-top)) 18px max(14px, env(safe-area-inset-bottom));
}

/* ---------- фон ---------- */
.grid, .glow, .scan, .frame { position: absolute; inset: 0; pointer-events: none; }
.grid {
  background-image:
    linear-gradient(rgba(var(--hud), .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--hud), .06) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 72%);
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 72%);
}
.glow {
  background:
    radial-gradient(circle at 50% 40%, rgba(var(--hud), .12), transparent 52%),
    radial-gradient(circle at 50% 50%, transparent 55%, rgba(0, 0, 0, .85));
}
.scan { background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px); }
.frame i { position: absolute; width: 22px; height: 22px; border: 0 solid rgba(var(--hud), .55); }
.frame .tl { top: 10px; left: 10px; border-top-width: 1.5px; border-left-width: 1.5px; }
.frame .tr { top: 10px; right: 10px; border-top-width: 1.5px; border-right-width: 1.5px; }
.frame .bl { bottom: 10px; left: 10px; border-bottom-width: 1.5px; border-left-width: 1.5px; }
.frame .br { bottom: 10px; right: 10px; border-bottom-width: 1.5px; border-right-width: 1.5px; }

/* ---------- верхняя строка ---------- */
.hud-top {
  position: relative; display: flex; justify-content: space-between; align-items: center;
  font: 400 10px/1 var(--mono); letter-spacing: .16em; opacity: .85; padding: 4px 6px 0; white-space: nowrap;
}
.hud-top .tag b { font-weight: 600; color: var(--text); }
.hud-top .dot {
  display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%;
  background: rgb(var(--hud)); box-shadow: 0 0 8px rgb(var(--hud)); animation: blink 1.6s ease-in-out infinite;
}

/* ---------- реактор ---------- */
.reactor { position: relative; place-self: center; width: min(84vw, 47vh, 430px); aspect-ratio: 1; }
.reactor svg, .reactor canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.reactor svg { overflow: visible; }
.ring { fill: none; stroke: rgb(var(--hud)); }
.core {
  position: absolute; left: 50%; top: 50%; width: 31%; aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%) scale(calc(1 + var(--level) * .14));
  background: radial-gradient(circle, #fff 0%, rgba(var(--hud), .95) 22%, rgba(var(--hud), .35) 55%, rgba(var(--hud), 0) 72%);
  box-shadow: 0 0 calc(30px + var(--level) * 60px) rgba(var(--hud), .55), inset 0 0 22px rgba(255, 255, 255, .35);
  transition: transform .06s linear;
}
.core-label {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px; color: #031018;
}
.core-label b { font: 700 clamp(20px, 6.4vw, 30px)/1 var(--sans); letter-spacing: .28em; margin-right: -.28em; }
.core-label small { font: 600 8px/1 var(--mono); letter-spacing: .25em; opacity: .75; }

/* ---------- статус и субтитры ---------- */
.status {
  position: relative; text-align: center; font: 600 12.5px/1.2 var(--mono); letter-spacing: .3em;
  text-shadow: 0 0 10px rgba(var(--hud), .8); padding: 6px 0 12px;
}
.status .br { opacity: .5; margin: 0 .5em; }
#status::after { content: "▌"; margin-left: .15em; animation: blink 1s steps(2) infinite; }
.log {
  position: relative; min-height: 118px; display: flex; flex-direction: column; justify-content: flex-end;
  gap: 8px; text-align: center; padding: 0 6px 14px;
}
.log p { margin: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; }
.log .you { font: 400 11.5px/1.5 var(--mono); letter-spacing: .04em; opacity: .65; -webkit-line-clamp: 2; }
.log .you:not(:empty)::before { content: "ВЫ › "; opacity: .7; }
.log .lu {
  font: 300 18px/1.42 var(--sans); color: var(--text); -webkit-line-clamp: 4;
  text-shadow: 0 0 14px rgba(var(--hud), .45);
}

/* ---------- кнопки ---------- */
footer { position: relative; display: flex; justify-content: center; align-items: center; gap: 14px; min-height: 64px; }
button { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.activate, .hud-btn {
  position: relative; color: rgb(var(--hud)); font: 600 13px/1 var(--mono); letter-spacing: .3em;
  background: linear-gradient(180deg, rgba(var(--hud), .14), rgba(var(--hud), .04));
  border: 1px solid rgba(var(--hud), .75);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  box-shadow: inset 0 0 18px rgba(var(--hud), .25);
}
.activate { padding: 20px 34px 20px calc(34px + .3em); animation: pulse 2.4s ease-in-out infinite; }
.activate:disabled { opacity: .45; animation: none; }
.hud-btn { padding: 15px 18px 15px calc(18px + .3em); font-size: 11px; }
.hud-btn.off { color: #9aa7b8; border-color: rgba(154, 167, 184, .6); }
.hud-btn.danger { color: #ff7b88; border-color: rgba(255, 92, 110, .7); background: rgba(255, 71, 87, .07); }
[hidden] { display: none !important; }

.telemetry {
  position: relative; display: flex; justify-content: space-between; padding: 10px 6px 0;
  font: 400 9.5px/1 var(--mono); letter-spacing: .18em; opacity: .55;
}

/* ---------- запуск: кольца прорисовываются ---------- */
#app.boot .ring { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: draw 1.6s cubic-bezier(.4, 0, .2, 1) forwards; }
#app.boot .ring:nth-child(2n) { animation-delay: .15s; }
#app.boot .core { animation: ignite 1.6s ease-out; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes ignite { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.2); } 60% { opacity: 1; } }
@keyframes blink { 50% { opacity: .2; } }
@keyframes pulse {
  50% { box-shadow: inset 0 0 26px rgba(var(--hud), .45); filter: brightness(1.25); }
}
