/* =====================================================================
   HOLOGRAPHIC SPACE BATTLE SIMULATOR — Interface Stylesheet
   ===================================================================== */

:root {
  --cyan: #46f0ff;
  --cyan-soft: #8ff7ff;
  --teal: #1be3c8;
  --blue: #3aa0ff;
  --violet: #9a6bff;
  --magenta: #ff4ddb;
  --enemy: #ff5a6e;
  --warn: #ffcf5a;
  --bg-0: #02060d;
  --bg-1: #04101c;
  --glass: rgba(10, 32, 54, 0.34);
  --glass-line: rgba(96, 224, 255, 0.35);
  --glow: 0 0 12px rgba(70, 240, 255, 0.55);
  --font-display: 'Orbitron', system-ui, sans-serif;
  --font-mono: 'Share Tech Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 38%, #06182b 0%, #030a14 55%, #01040a 100%);
  color: var(--cyan-soft);
  font-family: var(--font-mono);
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* ---------- Screen post overlays ---------- */
#screen-fx { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.scanlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(70,240,255,0.05) 0px,
    rgba(70,240,255,0.05) 1px,
    transparent 2px,
    transparent 3px);
  mix-blend-mode: screen;
  opacity: 0.45;
  animation: scanmove 8s linear infinite;
}
@keyframes scanmove { from { background-position-y: 0; } to { background-position-y: 120px; } }
.vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 52%, rgba(0,4,10,0.75) 100%);
}
.aberration {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(255,77,219,0.05) 100%);
  mix-blend-mode: screen;
}

/* =====================================================================
   BOOT / SPLASH
   ===================================================================== */
.boot {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(8,30,52,0.6), rgba(1,4,10,0.96) 70%),
    #01040a;
  transition: opacity 1.1s ease, visibility 1.1s ease;
}
.boot.fade-out { opacity: 0; visibility: hidden; }

.boot-frame {
  position: relative;
  width: min(720px, 90vw);
  padding: 42px 48px 36px;
  text-align: center;
  border: 1px solid var(--glass-line);
  background: linear-gradient(180deg, rgba(8,28,48,0.5), rgba(4,14,26,0.35));
  box-shadow: 0 0 60px rgba(20,120,180,0.25), inset 0 0 40px rgba(20,120,180,0.08);
  backdrop-filter: blur(6px);
  clip-path: polygon(0 14px, 14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px));
}
.boot-frame::before {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid rgba(70,240,255,0.12);
  pointer-events: none;
  clip-path: inherit;
}

.boot-emblem { width: 120px; height: 120px; margin: 0 auto 14px; filter: drop-shadow(0 0 14px rgba(70,240,255,0.7)); }
.emblem-svg { width: 100%; height: 100%; }
.emblem-svg .ring { fill: none; stroke: var(--cyan); stroke-width: 1.4; opacity: 0.85; transform-origin: 60px 60px; }
.emblem-svg .r1 { animation: spin 14s linear infinite; stroke-dasharray: 40 14; }
.emblem-svg .r2 { animation: spin 9s linear infinite reverse; stroke-dasharray: 16 10; opacity: 0.6; }
.emblem-svg .r3 { animation: spin 6s linear infinite; stroke-dasharray: 6 8; opacity: 0.5; }
.emblem-svg .tri { fill: none; stroke: var(--cyan-soft); stroke-width: 1.6; opacity: 0.9; animation: pulse 2.4s ease-in-out infinite; }
.emblem-svg .core { fill: var(--cyan-soft); animation: pulse 1.6s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }

.boot-title {
  font-family: var(--font-display);
  margin: 6px 0 4px;
  line-height: 1.04;
  letter-spacing: 6px;
}
.boot-title span { display: block; }
.boot-title .t1 { font-size: clamp(20px, 3.6vw, 34px); font-weight: 700; color: var(--cyan); text-shadow: 0 0 18px rgba(70,240,255,0.6); }
.boot-title .t2 { font-size: clamp(26px, 5vw, 50px); font-weight: 900; color: #eaffff; text-shadow: 0 0 26px rgba(120,200,255,0.8); }
.boot-title .t3 { font-size: clamp(18px, 3.2vw, 30px); font-weight: 700; color: var(--violet); text-shadow: 0 0 18px rgba(154,107,255,0.7); }

.boot-sub { font-size: 12px; letter-spacing: 4px; color: rgba(143,247,255,0.6); margin-bottom: 22px; }

.boot-log {
  text-align: left;
  height: 132px;
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(143,247,255,0.85);
  border-top: 1px solid rgba(70,240,255,0.15);
  border-bottom: 1px solid rgba(70,240,255,0.15);
  padding: 10px 4px;
  margin-bottom: 18px;
}
.boot-log .ln { opacity: 0; animation: lineIn 0.25s ease forwards; }
.boot-log .ok { color: var(--teal); }
.boot-log .warnln { color: var(--warn); }
.boot-log b { color: #eaffff; }
@keyframes lineIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

.boot-bar { position: relative; height: 22px; border: 1px solid var(--glass-line); background: rgba(4,18,32,0.6); overflow: hidden; }
.boot-bar-fill { position: absolute; inset: 0; width: 0%; background: linear-gradient(90deg, rgba(27,227,200,0.5), rgba(70,240,255,0.9)); box-shadow: 0 0 18px rgba(70,240,255,0.7); transition: width 0.3s ease; }
.boot-bar-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; letter-spacing: 3px; color: #eaffff; mix-blend-mode: difference; }

.enter-btn {
  margin-top: 26px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 5px;
  font-size: 16px;
  color: #02131d;
  background: linear-gradient(180deg, var(--cyan-soft), var(--cyan));
  border: none;
  padding: 16px 42px;
  cursor: pointer;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  box-shadow: 0 0 28px rgba(70,240,255,0.6);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
  animation: btnPulse 2.2s ease-in-out infinite;
}
.enter-btn:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 44px rgba(70,240,255,0.9); filter: brightness(1.12); }
.enter-btn.hidden { display: none; }
@keyframes btnPulse { 0%,100% { box-shadow: 0 0 22px rgba(70,240,255,0.5); } 50% { box-shadow: 0 0 40px rgba(70,240,255,0.85); } }

.boot-author { margin-top: 20px; font-size: 11px; letter-spacing: 3px; color: rgba(143,247,255,0.45); }

/* =====================================================================
   HUD
   ===================================================================== */
.hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: 0; transition: opacity 1.4s ease; }
.hud.visible { opacity: 1; }
.hud.hidden { display: none; }
.hud > * { pointer-events: none; }
.hud button, .hud .roster-item, .hud .panel { pointer-events: auto; }

.panel {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(7px);
  box-shadow: inset 0 0 26px rgba(20,120,180,0.08), 0 0 22px rgba(0,0,0,0.4);
  clip-path: polygon(0 10px, 10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
  margin-bottom: 14px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: 3px;
  padding: 10px 14px; color: var(--cyan);
  border-bottom: 1px solid rgba(70,240,255,0.18);
  background: linear-gradient(90deg, rgba(70,240,255,0.1), transparent);
}
.panel-head em { font-style: normal; color: var(--cyan-soft); font-family: var(--font-mono); font-size: 12px; }

/* Top bar */
.hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: linear-gradient(180deg, rgba(2,10,20,0.78), transparent);
}
.hud-brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 34px; height: 34px; position: relative;
  background:
    conic-gradient(from 0deg, var(--cyan), var(--violet), var(--magenta), var(--cyan));
  border-radius: 50%;
  filter: drop-shadow(0 0 10px rgba(70,240,255,0.7));
  animation: spin 8s linear infinite;
}
.brand-mark::after { content:""; position:absolute; inset:6px; border-radius:50%; background:#04101c; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-line1 { font-family: var(--font-display); font-weight: 900; font-size: 16px; letter-spacing: 3px; color: #eaffff; text-shadow: var(--glow); }
.brand-line2 { font-size: 10.5px; letter-spacing: 2px; color: rgba(143,247,255,0.6); }

.hud-clock { text-align: center; }
.clock-time { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: 4px; color: var(--cyan); text-shadow: var(--glow); }
.clock-label { font-size: 10px; letter-spacing: 3px; color: rgba(143,247,255,0.55); }

.hud-status { display: flex; gap: 10px; }
.status-pill { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: 2px; padding: 7px 12px; border: 1px solid var(--glass-line); background: rgba(6,22,38,0.5); clip-path: polygon(8px 0,100% 0,calc(100% - 8px) 100%,0 100%); }
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 8px var(--teal); animation: pulse 1.8s ease-in-out infinite; }
.status-pill.alt i { background: var(--violet); box-shadow: 0 0 8px var(--violet); }
.status-pill b { color: #eaffff; }

/* Left + right asides */
.hud-left { position: absolute; left: 18px; top: 86px; width: 280px; }
.hud-right { position: absolute; right: 18px; top: 86px; width: 280px; }

.force-bars { padding: 12px 14px 4px; }
.force-row { margin-bottom: 12px; }
.force-row label { display:block; font-size: 10px; letter-spacing: 2px; color: rgba(143,247,255,0.7); margin-bottom: 5px; }
.meter { height: 9px; background: rgba(4,16,28,0.8); border: 1px solid rgba(70,240,255,0.2); overflow: hidden; }
.meter-fill { height: 100%; width: 100%; transition: width 0.4s ease; }
.meter-fill.ally { background: linear-gradient(90deg, var(--teal), var(--cyan)); box-shadow: 0 0 12px rgba(70,240,255,0.6); }
.meter-fill.enemy { background: linear-gradient(90deg, #ff8a3a, var(--enemy)); box-shadow: 0 0 12px rgba(255,90,110,0.6); }

.roster { max-height: 38vh; overflow-y: auto; padding: 6px 8px 10px; }
.roster::-webkit-scrollbar { width: 5px; }
.roster::-webkit-scrollbar-thumb { background: rgba(70,240,255,0.3); }
.roster-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin: 4px 0;
  border: 1px solid rgba(70,240,255,0.12);
  background: rgba(8,26,44,0.4);
  cursor: pointer; transition: all 0.15s ease;
  clip-path: polygon(6px 0,100% 0,calc(100% - 6px) 100%,0 100%);
}
.roster-item:hover { background: rgba(70,240,255,0.12); border-color: var(--glass-line); transform: translateX(3px); }
.roster-item.selected { background: rgba(70,240,255,0.18); border-color: var(--cyan); box-shadow: inset 0 0 14px rgba(70,240,255,0.25); }
.roster-item.dead { opacity: 0.3; filter: grayscale(1); cursor: default; }
.ri-icon { width: 26px; height: 26px; flex: none; display: grid; place-items: center; color: var(--cyan); }
.ri-icon svg { width: 22px; height: 22px; filter: drop-shadow(0 0 4px rgba(70,240,255,0.7)); }
.ri-body { flex: 1; min-width: 0; }
.ri-name { font-size: 12px; color: #eaffff; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri-class { font-size: 9.5px; letter-spacing: 2px; color: rgba(143,247,255,0.55); }
.ri-hp { width: 46px; height: 5px; background: rgba(4,16,28,0.9); border: 1px solid rgba(70,240,255,0.2); flex: none; }
.ri-hp > i { display: block; height: 100%; background: linear-gradient(90deg,var(--teal),var(--cyan)); }

/* Telemetry */
.telemetry { padding: 14px; min-height: 180px; }
.tele-empty { text-align: center; color: rgba(143,247,255,0.4); padding: 50px 10px; letter-spacing: 2px; font-size: 12px; }
.tele-empty small { font-size: 10px; opacity: 0.7; }
.tele-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: #eaffff; letter-spacing: 2px; margin-bottom: 2px; text-shadow: var(--glow); }
.tele-sub { font-size: 10px; letter-spacing: 2px; color: rgba(143,247,255,0.55); margin-bottom: 14px; }
.tele-stat { margin-bottom: 11px; }
.tele-stat label { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: 2px; color: rgba(143,247,255,0.7); margin-bottom: 4px; }
.tele-stat label b { color: #eaffff; }
.tele-bar { height: 8px; background: rgba(4,16,28,0.8); border: 1px solid rgba(70,240,255,0.2); overflow: hidden; }
.tele-bar > i { display: block; height: 100%; transition: width 0.3s ease; }
.tele-bar.hull > i { background: linear-gradient(90deg,var(--teal),var(--cyan)); box-shadow: 0 0 10px rgba(70,240,255,0.5); }
.tele-bar.shield > i { background: linear-gradient(90deg,var(--blue),var(--violet)); box-shadow: 0 0 10px rgba(154,107,255,0.5); }
.tele-bar.weapon > i { background: linear-gradient(90deg,var(--warn),var(--magenta)); box-shadow: 0 0 10px rgba(255,77,219,0.5); }
.tele-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.tele-cell { border: 1px solid rgba(70,240,255,0.15); padding: 8px; background: rgba(8,26,44,0.4); }
.tele-cell span { display:block; font-size: 9px; letter-spacing: 2px; color: rgba(143,247,255,0.55); }
.tele-cell b { font-family: var(--font-display); font-size: 15px; color: var(--cyan); }

/* Minimap */
.minimap-panel { margin-top: 4px; }
#minimap { display: block; width: 100%; height: auto; background: rgba(2,10,18,0.6); }

/* Bottom deck */
.hud-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  padding: 16px 22px 18px;
  background: linear-gradient(0deg, rgba(2,10,20,0.82), transparent);
}
.cmd-group { display: flex; gap: 10px; }
.cmd-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 84px; padding: 9px 12px;
  background: rgba(8,26,44,0.55); border: 1px solid var(--glass-line);
  color: var(--cyan-soft); cursor: pointer;
  font-family: var(--font-mono); letter-spacing: 1px;
  clip-path: polygon(7px 0,100% 0,calc(100% - 7px) 100%,0 100%);
  transition: all 0.14s ease;
}
.cmd-btn b { font-family: var(--font-display); font-size: 13px; color: var(--cyan); }
.cmd-btn span { font-size: 9.5px; letter-spacing: 1.5px; }
.cmd-btn:hover { background: rgba(70,240,255,0.16); transform: translateY(-2px); box-shadow: 0 0 18px rgba(70,240,255,0.4); }
.cmd-btn:active { transform: translateY(0); }
.cmd-btn.active { background: rgba(70,240,255,0.22); border-color: var(--cyan); box-shadow: inset 0 0 14px rgba(70,240,255,0.3); }

.cmd-center { display: flex; gap: 14px; }
.ability-btn {
  position: relative;
  min-width: 210px; padding: 12px 18px;
  font-family: var(--font-display); font-weight: 700; letter-spacing: 3px; font-size: 13px;
  color: #02131d; cursor: pointer; border: none;
  background: linear-gradient(180deg, var(--cyan-soft), var(--teal));
  clip-path: polygon(12px 0,100% 0,calc(100% - 12px) 100%,0 100%);
  box-shadow: 0 0 22px rgba(70,240,255,0.5);
  transition: transform 0.14s ease, filter 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}
.ability-btn.alt { background: linear-gradient(180deg, #ffb0f0, var(--magenta)); box-shadow: 0 0 22px rgba(255,77,219,0.5); }
.ability-btn:hover { transform: translateY(-2px); filter: brightness(1.12); }
.ability-btn .ab-title { display: block; }
.ability-btn .ab-cd { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px; opacity: 0.85; margin-top: 2px; }
.ability-btn.cooling { filter: grayscale(0.6) brightness(0.7); cursor: not-allowed; }
.ability-btn.cooling::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px;
  width: var(--cd, 0%); background: rgba(2,19,29,0.6);
}

.cmd-group.right { justify-content: flex-end; }

/* Center hint / toasts */
.center-hint {
  position: absolute; top: 22%; left: 50%; transform: translateX(-50%);
  font-family: var(--font-display); font-weight: 700; letter-spacing: 5px;
  font-size: clamp(16px, 2.4vw, 26px);
  color: var(--cyan-soft); text-shadow: 0 0 24px rgba(70,240,255,0.8);
  opacity: 0; transition: opacity 0.4s ease; text-align: center;
}
.center-hint.show { opacity: 1; }
.center-hint.victory { color: var(--teal); }
.center-hint.defeat { color: var(--enemy); text-shadow: 0 0 24px rgba(255,90,110,0.8); }

/* Selection marquee */
.marquee {
  position: absolute; border: 1px solid var(--cyan);
  background: rgba(70,240,255,0.1);
  box-shadow: inset 0 0 12px rgba(70,240,255,0.3);
  display: none; z-index: 12;
}

/* Help */
.hud-help {
  position: absolute; left: 50%; bottom: 116px; transform: translateX(-50%);
  font-size: 11px; letter-spacing: 1px; color: rgba(143,247,255,0.55);
  background: rgba(2,10,20,0.5); padding: 6px 16px; border: 1px solid rgba(70,240,255,0.14);
  clip-path: polygon(8px 0,100% 0,calc(100% - 8px) 100%,0 100%);
}
.hud-help b { color: var(--cyan); }

/* Cooldown text states */
.ab-cd.ready { color: #02131d; }

/* Responsive */
@media (max-width: 1100px) {
  .hud-left, .hud-right { width: 230px; }
  .ability-btn { min-width: 150px; font-size: 11px; }
}
@media (max-width: 820px) {
  .hud-left, .hud-right { display: none; }
  .hud-help { display: none; }
  .cmd-btn span { display: none; }
  .cmd-btn { min-width: 48px; }
  .hud-clock { display: none; }
}
.hidden { display: none !important; }
