/* BVN BP Command Center — Sci-Fi HUD styles (premium pass) */
:root {
  --hud: #06B6D4;
  --hud-bright: #22D3EE;
  --hud-blue: #0EA5E9;
  --ok: #22C55E;
  --warn: #F97316;
  --danger: #EF4444;
  --bg: #020617;
  --panel: rgba(15, 23, 42, 0.85);
  --tP: #E5F2FF;
  --tS: #94A3B8;
}

/* registered angle for the rotating border arc (progressive enhancement) */
@property --a {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: #E5F2FF;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}
/* circular indicator (avoids forbidden Tailwind rounded-full) */
.circle { border-radius: 9999px; }

/* ============ ambient background layers ============ */
.bg-fx {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.bg-fx::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(1200px 520px at 50% -12%, rgba(6,182,212,0.10), transparent 70%),
              radial-gradient(900px 400px at 85% 110%, rgba(14,165,233,0.06), transparent 70%);
}
/* twinkling starfield */
.bg-stars { position: absolute; inset: 0; opacity: .75; animation: starsTwinkle 9s ease-in-out infinite alternate; }
.bg-stars::before {
  content: ""; position: absolute; inset: -60%;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(229,242,255,0.9), transparent 50%),
    radial-gradient(1px 1px at 28% 66%, rgba(148,163,184,0.8), transparent 50%),
    radial-gradient(1.5px 1.5px at 44% 33%, rgba(165,243,252,0.9), transparent 50%),
    radial-gradient(1px 1px at 58% 82%, rgba(148,163,184,0.7), transparent 50%),
    radial-gradient(1.5px 1.5px at 71% 15%, rgba(229,242,255,0.85), transparent 50%),
    radial-gradient(1px 1px at 83% 55%, rgba(165,243,252,0.75), transparent 50%),
    radial-gradient(1px 1px at 91% 28%, rgba(148,163,184,0.6), transparent 50%),
    radial-gradient(1.5px 1.5px at 9% 88%, rgba(229,242,255,0.7), transparent 50%),
    radial-gradient(1px 1px at 37% 7%, rgba(148,163,184,0.65), transparent 50%),
    radial-gradient(1px 1px at 64% 48%, rgba(165,243,252,0.6), transparent 50%);
  background-size: 520px 520px; background-repeat: repeat;
  animation: starsDrift 140s linear infinite;
}
@keyframes starsTwinkle { from { opacity: .55; } to { opacity: .95; } }
@keyframes starsDrift { to { transform: translate(130px, 70px); } }
/* tactical grid, drifting slowly */
.bg-grid {
  position: absolute; inset: 0; opacity: .55;
  background-image:
    linear-gradient(rgba(6,182,212,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6,182,212,0.055) 1px, transparent 1px);
  background-size: 46px 46px;
  animation: gridDrift 36s linear infinite;
  mask-image: radial-gradient(ellipse 90% 75% at 50% 30%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 75% at 50% 30%, #000 30%, transparent 100%);
}
@keyframes gridDrift { to { background-position: 46px 46px; } }
/* rising data particles */
.bg-drift { position: absolute; inset: 0; opacity: .5; }
.bg-drift::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: 0;
  background-image:
    radial-gradient(1px 1px at 8% 20%, rgba(34,211,238,0.55), transparent 50%),
    radial-gradient(1px 1px at 18% 70%, rgba(34,211,238,0.4), transparent 50%),
    radial-gradient(1.2px 1.2px at 27% 40%, rgba(34,211,238,0.5), transparent 50%),
    radial-gradient(1px 1px at 38% 15%, rgba(34,211,238,0.4), transparent 50%),
    radial-gradient(1.2px 1.2px at 49% 85%, rgba(34,211,238,0.5), transparent 50%),
    radial-gradient(1px 1px at 58% 55%, rgba(34,211,238,0.45), transparent 50%),
    radial-gradient(1px 1px at 68% 25%, rgba(34,211,238,0.4), transparent 50%),
    radial-gradient(1.2px 1.2px at 77% 75%, rgba(34,211,238,0.5), transparent 50%),
    radial-gradient(1px 1px at 88% 45%, rgba(34,211,238,0.45), transparent 50%),
    radial-gradient(1px 1px at 96% 10%, rgba(34,211,238,0.4), transparent 50%);
  background-size: 240px 240px; background-repeat: repeat;
  animation: driftUp 26s linear infinite;
}
@keyframes driftUp { to { background-position-y: 240px; } }
/* content sits above ambient layers */
#view, footer { position: relative; z-index: 1; }

/* global scanlines */
.scanlines {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(6,182,212,0.045) 0px, rgba(6,182,212,0.045) 1px, transparent 1px, transparent 3px);
  mix-blend-mode: screen;
}

/* ============ L-shaped corners + rotating border arc ============ */
.corners { position: relative; }
/* animated gradient border ring (1px, rotates around the panel) */
.corners::before {
  content: ""; position: absolute; inset: 0; padding: 1px; pointer-events: none;
  border-radius: inherit;
  background: conic-gradient(from 0deg, rgba(6,182,212,0) 0deg, rgba(6,182,212,0) 250deg, rgba(34,211,238,0.9) 320deg, rgba(6,182,212,0.25) 360deg);
  background: conic-gradient(from var(--a, 0deg), rgba(6,182,212,0) 0deg, rgba(6,182,212,0) 250deg, rgba(34,211,238,0.9) 320deg, rgba(6,182,212,0.25) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: hudSpin 7s linear infinite;
}
@keyframes hudSpin { to { --a: 360deg; } }
.corners > i {
  position: absolute; width: 14px; height: 14px; border: 0 solid rgba(34,211,238,0.7);
  box-shadow: 0 0 8px rgba(34,211,238,0.4);
  transition: transform 150ms ease, border-color 150ms ease;
}
.corners > i.tl { top: -1px; left: -1px;  border-top-width: 2px; border-left-width: 2px; }
.corners > i.tr { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.corners > i.bl { bottom: -1px; left: -1px;  border-bottom-width: 2px; border-left-width: 2px; }
.corners > i.br { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.tactical:hover .corners > i.tl { transform: translate(3px, 3px); }
.tactical:hover .corners > i.tr { transform: translate(-3px, 3px); }
.tactical:hover .corners > i.bl { transform: translate(3px, -3px); }
.tactical:hover .corners > i.br { transform: translate(-3px, -3px); }
.tactical:hover .corners > i { border-color: var(--hud-bright); box-shadow: 0 0 12px rgba(34,211,238,0.7); }

/* per-panel data-overload band — now streaming */
.scan-band { position: relative; }
.scan-band::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(34,211,238,0.22) 0px, rgba(34,211,238,0.22) 1px, transparent 1px, transparent 4px);
  opacity: 0.10; transition: opacity 300ms ease;
  animation: scanDrift 6s linear infinite;
}
.scan-band:hover::after { opacity: 0.38; }
@keyframes scanDrift { to { background-position: 0 4px; } }

/* ============ glow / pulse ============ */
@keyframes pulseGlow {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,211,238,0.55); }
  50%      { opacity: 0.55; box-shadow: 0 0 12px 4px rgba(34,211,238,0.18); }
}
.pulse-glow   { animation: pulseGlow 2s ease-in-out infinite; }
.pulse-ok     { animation: pulseGlow 2s ease-in-out infinite; box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
.pulse-warn   { animation: pulseGlow 1.4s ease-in-out infinite; box-shadow: 0 0 0 0 rgba(249,115,22,0.55); }
.pulse-danger { animation: pulseGlow 1s ease-in-out infinite; box-shadow: 0 0 0 0 rgba(239,68,68,0.55); }
@keyframes blink { 0%,55% { opacity: 1; } 56%,100% { opacity: 0.25; } }
.blink { animation: blink 1.2s steps(1) infinite; }

/* ============ header radar (holographic sweep) ============ */
.radar {
  width: 96px; height: 96px; border-radius: 9999px; position: relative; overflow: hidden;
  border: 1px solid rgba(34,211,238,0.4);
  background: radial-gradient(circle, rgba(6,182,212,0.07) 0 32%, transparent 32% 100%);
  box-shadow: 0 0 26px rgba(6,182,212,0.25), inset 0 0 26px rgba(6,182,212,0.12);
}
.radar::before {
  content: ""; position: absolute; inset: 0; border-radius: 9999px;
  background: repeating-radial-gradient(circle, transparent 0 21px, rgba(34,211,238,0.16) 21px 22px);
}
.radar::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34,211,238,0.5), transparent);
  transform: rotate(35deg);
}
.radar-ring { position: absolute; inset: 0; border-radius: 9999px; }
.radar-sweep {
  position: absolute; inset: 0; border-radius: 9999px;
  background: conic-gradient(from 0deg, rgba(34,211,238,0) 0deg, rgba(34,211,238,0) 300deg, rgba(34,211,238,0.45) 350deg, rgba(34,211,238,0.95) 360deg);
  animation: spin 6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.radar-blip {
  position: absolute; width: 5px; height: 5px; border-radius: 9999px;
  background: #22D3EE; box-shadow: 0 0 10px #22D3EE;
  animation: blipPulse 2.4s ease-in-out infinite;
}
.radar-blip:nth-child(3) { animation-delay: 0.8s; }
.radar-blip:nth-child(4) { animation-delay: 1.6s; }
@keyframes blipPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.8); }
  50%      { opacity: 1;    transform: scale(1.15); }
}

/* ============ holographic shimmer title ============ */
.holo-text {
  background: linear-gradient(100deg, #E5F2FF 0%, #22D3EE 25%, #E5F2FF 50%, #22D3EE 75%, #E5F2FF 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: holoShift 7s linear infinite;
}
@keyframes holoShift { to { background-position: -220% center; } }

/* ============ nav modes ============ */
#navModes button { position: relative; overflow: hidden; }
#navModes button::after {
  content: ""; position: absolute; left: 14%; right: 14%; bottom: 0; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #22D3EE, transparent);
  transform: scaleX(0); opacity: 0;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s;
}
#navModes button:hover::after,
#navModes button.nav-on::after { transform: scaleX(1); opacity: 1; }
#navModes button.nav-on { animation: navBreath 3s ease-in-out infinite; }
@keyframes navBreath {
  0%, 100% { box-shadow: 0 0 10px rgba(6,182,212,0.25); }
  50%      { box-shadow: 0 0 24px rgba(6,182,212,0.55); }
}

/* ============ buttons: hover light-sweep ============ */
.hud-active { position: relative; overflow: hidden; }
.hud-active::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(105deg, transparent, rgba(34,211,238,0.30), transparent);
  transform: skewX(-18deg); opacity: 0; pointer-events: none;
  transition: left 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s;
}
.hud-active:hover::before { left: 135%; opacity: 1; }

/* ============ view transition (mode switch) ============ */
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px) scale(0.995); filter: blur(2px); }
  to   { opacity: 1; transform: none; filter: none; }
}
.view-enter { animation: viewIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ============ progress + shine ============ */
.progress-track { background: #020617; border: 1px solid rgba(6,182,212,0.3); overflow: hidden; }
.progress-fill {
  background: linear-gradient(90deg, var(--hud) 0%, var(--hud-bright) 100%);
  box-shadow: 0 0 10px rgba(6,182,212,0.55);
  position: relative; overflow: hidden; height: 100%;
}
.progress-fill::after {
  content: ""; position: absolute; inset: 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
  animation: shine 2.4s linear infinite;
}
@keyframes shine { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.line-in { animation: slideIn 0.4s ease both; }

.hud-active:active {
  box-shadow: inset 0 0 18px rgba(34,211,238,0.55), 0 0 10px rgba(6,182,212,0.35);
  border-color: rgba(34,211,238,0.7);
  color: #E5F2FF;
  transform: translateY(0);
}
:focus-visible { outline: 2px solid var(--hud-bright); outline-offset: 2px; }

/* ============ toast: slide-in entrance ============ */
@keyframes toastIn {
  from { transform: translateX(28px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 100; padding: 10px 16px; border-radius: 6px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: #E5F2FF;
  background: rgba(2,6,23,0.92); opacity: 0; transition: opacity 0.2s ease; pointer-events: none;
  animation: toastIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  border-left: 2px solid rgba(34,211,238,0.6);
  box-shadow: 0 0 18px rgba(6,182,212,0.18);
}
.toast-ok { border-left-color: rgba(34,197,94,0.7); border: 1px solid rgba(34,197,94,0.6); box-shadow: 0 0 14px rgba(34,197,94,0.3); }
.toast-warn { border-left-color: rgba(239,68,68,0.7); border: 1px solid rgba(239,68,68,0.6); box-shadow: 0 0 14px rgba(239,68,68,0.3); }

/* ============ character icon tiles ============ */
.chip { position: relative; padding: 0; overflow: hidden; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.chip-icon { position: relative; display: block; aspect-ratio: 1 / 1; width: 100%; background: #050a1a; }
.chip-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.chip-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.1rem; font-weight: 700; color: var(--hud-bright);
  text-shadow: 0 0 8px rgba(34,211,238,0.6);
}
.chip[draggable="true"] { cursor: grab; }
.chip[draggable="true"]:active { cursor: grabbing; }
[data-slot].drag-over { border-color: var(--hud-bright) !important; box-shadow: 0 0 16px rgba(6,182,212,0.5) !important; }
.chip.pending { outline: 2px solid var(--hud-bright); box-shadow: 0 0 16px rgba(34,211,238,0.55); }

/* ============ premium scrollbar + selection ============ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #020617; }
::-webkit-scrollbar-thumb {
  background: rgba(6,182,212,0.28); border: 2px solid #020617; border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(6,182,212,0.5); }
::selection { background: rgba(6,182,212,0.35); color: #E5F2FF; }

/* ============ mobile: bottom tab bar (thumb-friendly app nav) ============ */
#mobileTabBar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
  display: flex; justify-content: space-around; align-items: stretch;
  background: rgba(2,6,23,0.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(6,182,212,0.3);
  box-shadow: 0 -10px 30px rgba(2,6,23,0.7);
  padding-bottom: env(safe-area-inset-bottom);
  touch-action: manipulation;
}
/* 断点双保险（须在 #mobileTabBar 定义之后，同特异性后者胜出）：
   PC(≥1024px) 永不显示底部栏；<1024px 才显示 */
@media (min-width: 1024px) {
  #mobileTabBar { display: none !important; }
  #navModes { display: flex !important; }
}
@media (max-width: 1023.98px) {
  #navModes { display: none !important; }
}
.mtab {
  flex: 1; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #64748b; background: none; border: none; cursor: pointer; padding: 6px 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease, background 0.2s ease;
}
.mtab-ico { font-size: 20px; line-height: 1; }
.mtab-label { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.mtab:active { background: rgba(6,182,212,0.12); }
.mtab-on { color: #22D3EE; text-shadow: 0 0 12px rgba(34,211,238,0.6); }
.mtab-on .mtab-ico { position: relative; }
.mtab-on .mtab-ico::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  width: 18px; height: 2px; background: #22D3EE; border-radius: 2px;
  box-shadow: 0 0 8px #22D3EE;
}

/* ============ mobile: sandbox palette tap-selection ============ */
.pal-sel { outline: 2px solid #22D3EE; box-shadow: 0 0 14px rgba(34,211,238,0.6); }

/* ============ review: 六维评分滑块 + 角色格 ============ */
.rv-slider {
  -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 3px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, rgba(6,182,212,0.55), rgba(34,211,238,0.85));
  box-shadow: inset 0 0 6px rgba(2,6,23,0.8);
}
.rv-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #22D3EE; border: 2px solid #020617;
  box-shadow: 0 0 10px rgba(34,211,238,0.7);
  transition: transform 0.15s ease;
}
.rv-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.rv-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #22D3EE; border: 2px solid #020617;
  box-shadow: 0 0 10px rgba(34,211,238,0.7);
}
.rv-char { position: relative; overflow: hidden; }
.rv-char:active { transform: scale(0.96); }

/* ============ mobile adaptations ============ */
@media (max-width: 1023px) {
  /* keep content clear of the bottom tab bar */
  #view { padding-bottom: 6.5rem; }
}
@media (max-width: 767px) {
  /* roomier touch targets: buttons + form controls at least 44px tall */
  .hud-active:not(.chip) { min-height: 44px; }
  input, select, textarea { min-height: 44px; }
  .hud-active { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .chip { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
  /* panels get tighter padding on phones */
  .corners.tactical { padding: 1rem !important; }
  /* toast floats above the tab bar, centered */
  .toast { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); text-align: center; }
  /* account modal scrollable on small screens */
  #accountModal { padding: 14px; }
  #accountModal .corners { max-height: 92vh; overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
