/* ==========================================================================
   LOBORCA GATEWAY — Immersive selection screen
   Dual-color cyber-shrine system: cyan (TOOL MATRIX) / magenta (TMI ARCHIVE)
   ========================================================================== */

:root {
  --navy:          #05060f;
  --navy-deep:      #020309;
  --cyan:           #00f6ff;
  --cyan-dim:       #0aa8c2;
  --cyan-soft:      rgba(0, 246, 255, 0.35);
  --magenta:        #ff2fd0;
  --magenta-dim:    #b23a9c;
  --magenta-soft:   rgba(255, 47, 208, 0.35);
  --text:           #eaf6ff;
  --text-dim:       #93a8bd;
  --glass-bg:       rgba(8, 12, 26, 0.38);
  --glass-bg-hover: rgba(8, 12, 26, 0.22);
  --glass-border:   rgba(255, 255, 255, 0.10);
  --ease-out:       cubic-bezier(.16, .8, .24, 1);
  --ease-soft:      cubic-bezier(.4, 0, .2, 1);
  --dur-fast:       .35s;
  --dur-med:        .8s;
  --dur-slow:       1.6s;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--navy-deep);
  color: var(--text);
  font-family: 'Rajdhani', 'Noto Sans JP', system-ui, sans-serif;
  overflow: hidden;
  position: relative;
  cursor: default;
}

body.zones-ready { cursor: default; }

/* ==========================================================================
   Ambient particle canvas
   ========================================================================== */

#particle-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ==========================================================================
   Scanlines + film grain
   ========================================================================== */

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0) 0px,
      rgba(0, 0, 0, 0.16) 1px,
      rgba(0, 0, 0, 0) 3px
    );
  mix-blend-mode: multiply;
  opacity: .55;
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 39;
  pointer-events: none;
  width: 200%;
  height: 200%;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 1.4s steps(4) infinite;
}

@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(-2%, 1%); }
  100% { transform: translate(1%, -1%); }
}

/* ==========================================================================
   Custom cursor glow (desktop pointer only)
   ========================================================================== */

.cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 26px; height: 26px;
  border: 1px solid var(--cyan-soft);
  border-radius: 50%;
  z-index: 100;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: width .25s var(--ease-out), height .25s var(--ease-out),
              border-color .25s ease, background .25s ease, opacity .2s ease;
  opacity: 0;
  mix-blend-mode: screen;
}

.cursor-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 18px 4px var(--cyan-soft);
  opacity: .8;
}

.cursor-glow.is-visible { opacity: 1; }
.cursor-glow.side-tool { border-color: var(--cyan); }
.cursor-glow.side-tool::after { box-shadow: 0 0 24px 6px var(--cyan-soft); }
.cursor-glow.side-tmi { border-color: var(--magenta); }
.cursor-glow.side-tmi::after { box-shadow: 0 0 24px 6px var(--magenta-soft); }
.cursor-glow.is-hover { width: 64px; height: 64px; }

@media (hover: none), (pointer: coarse) {
  .cursor-glow { display: none; }
}

/* ==========================================================================
   Stage
   ========================================================================== */

.gateway {
  position: relative;
  width: 100vw;
  height: 100dvh;
  z-index: 5;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

/* -- Layer 0: shrine background -- */

.bg-shrine {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  z-index: 0;
  opacity: 0;
  transform: scale(1.08);
  filter: saturate(1.15) brightness(.85);
  transition: opacity 2.2s var(--ease-out), transform 3.5s var(--ease-out), filter 1.8s ease;
}

.gateway.stage-bg .bg-shrine {
  opacity: 1;
  transform: scale(1);
}

.gateway.stage-zones .bg-shrine {
  filter: saturate(1.3) brightness(.65);
}

.bg-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(2,3,9,0) 0%, rgba(2,3,9,.55) 68%, rgba(2,3,9,.92) 100%),
    linear-gradient(180deg, rgba(2,3,9,.75) 0%, rgba(2,3,9,0) 22%, rgba(2,3,9,0) 70%, rgba(2,3,9,.85) 100%);
}

/* -- Layer 1: guardian emblem -- */

.kamon-wrap {
  position: absolute;
  top: 30%;
  left: 50%;
  width: min(15vw, 190px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(.7);
  z-index: 3;
  opacity: 0;
  transition: opacity 1.8s var(--ease-out) .2s, transform 1.8s var(--ease-out) .2s;
  pointer-events: none;
}

.gateway.stage-kamon .kamon-wrap {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.kamon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(0, 246, 255, .45)) drop-shadow(0 0 30px rgba(255, 47, 208, .3));
  animation: kamon-float 6s ease-in-out infinite;
}

.kamon-ring {
  position: absolute;
  inset: -22%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .12);
  animation: kamon-spin 30s linear infinite;
}

.kamon-ring::before {
  content: '';
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, .08);
  animation: kamon-spin-rev 46s linear infinite;
}

@keyframes kamon-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3.5%); }
}
@keyframes kamon-spin     { to { transform: rotate(360deg); } }
@keyframes kamon-spin-rev { to { transform: rotate(-360deg); } }

/* -- Layer 2: hero text -- */

.hero-text {
  position: relative;
  z-index: 4;
  text-align: center;
  padding: min(20vh, 210px) 24px 0;
  pointer-events: none;
}

.eyebrow {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: clamp(.65rem, 1vw, .8rem);
  letter-spacing: .4em;
  color: var(--text-dim);
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
}
.eyebrow span { color: var(--cyan); text-shadow: 0 0 12px var(--cyan-soft); }

.gateway.stage-title .eyebrow { opacity: 1; transform: translateY(0); }

.title {
  position: relative;
  margin-top: 14px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(1.9rem, 6.4vw, 4.6rem);
  letter-spacing: .12em;
  color: var(--text);
  text-shadow:
    0 0 12px rgba(234, 246, 255, .35),
    0 0 34px var(--cyan-soft),
    0 0 60px var(--magenta-soft);
  opacity: 0;
  transform: translateY(14px) scale(.98);
  transition: opacity 1.1s var(--ease-out), transform 1.1s var(--ease-out);
}

.gateway.stage-title .title { opacity: 1; transform: translateY(0) scale(1); }

.title-glitch {
  position: absolute;
  inset: 0;
  color: var(--cyan);
  opacity: 0;
  clip-path: inset(0 0 0 0);
}

.gateway.stage-title .title-glitch {
  animation: title-glitch 2.6s steps(1) .9s 1;
}

@keyframes title-glitch {
  0%   { opacity: 0; }
  4%   { opacity: .7; transform: translate(-3px, 1px); clip-path: inset(10% 0 60% 0); }
  8%   { opacity: 0; }
  40%  { opacity: .5; transform: translate(2px, -1px); clip-path: inset(60% 0 5% 0); color: var(--magenta); }
  44%  { opacity: 0; }
  100% { opacity: 0; }
}

.subtitle {
  margin-top: 18px;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 300;
  font-size: clamp(.85rem, 1.6vw, 1.15rem);
  letter-spacing: .18em;
  color: var(--text-dim);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s var(--ease-out) .15s, transform 1s var(--ease-out) .15s;
}
.subtitle .jp { color: rgba(255, 47, 208, .8); }

.gateway.stage-title .subtitle { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   Zones — the two paths
   ========================================================================== */

.zones {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 0;
  padding: 6vh 5vw 4vh;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1.1s var(--ease-out), transform 1.1s var(--ease-out);
}

.gateway.stage-zones .zones {
  opacity: 1;
  transform: translateY(0);
}

.zones-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 clamp(14px, 2.4vw, 34px);
}

.divider-line {
  width: 1px;
  flex: 1;
  min-height: 40px;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.25), transparent);
}

.divider-glyph {
  font-family: 'Noto Sans JP', serif;
  writing-mode: vertical-rl;
  font-size: .85rem;
  letter-spacing: .3em;
  color: var(--text-dim);
  opacity: .7;
}

.zone {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 46vh;
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  isolation: isolate;
  cursor: pointer;
  transform: translateZ(0) scale(1);
  transition: transform .6s var(--ease-out), box-shadow .6s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.zone-frame {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid var(--glass-border);
  pointer-events: none;
  transition: border-color .5s ease, box-shadow .5s ease;
}

.zone-overlay {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity .6s var(--ease-out), transform 1.2s var(--ease-out);
  mix-blend-mode: screen;
  z-index: 1;
}

.zone-scan {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, transparent 0%, rgba(255,255,255,.08) 48%, transparent 52%);
  background-size: 100% 220%;
  background-position: 0 -60%;
  opacity: 0;
  transition: opacity .4s ease;
}

.zone-glow {
  position: absolute;
  inset: -30%;
  z-index: 0;
  opacity: 0;
  transition: opacity .6s var(--ease-out);
  filter: blur(30px);
}

.zone--tool .zone-glow { background: radial-gradient(ellipse at 50% 80%, var(--cyan-soft), transparent 65%); }
.zone--tmi  .zone-glow { background: radial-gradient(ellipse at 50% 80%, var(--magenta-soft), transparent 65%); }

.zone-particles {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.zone-particles span {
  position: absolute;
  bottom: -6%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  opacity: 0;
  animation: particle-rise linear infinite;
}

.zone--tool .zone-particles span { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.zone--tmi  .zone-particles span { background: var(--magenta); box-shadow: 0 0 6px var(--magenta); }

@keyframes particle-rise {
  0%   { opacity: 0; transform: translateY(0) translateX(0); }
  10%  { opacity: .9; }
  90%  { opacity: .5; }
  100% { opacity: 0; transform: translateY(-120%) translateX(var(--drift, 12px)); }
}

.zone-glass {
  position: relative;
  z-index: 3;
  width: 100%;
  margin: 0 clamp(10px, 2vw, 24px) clamp(14px, 3vw, 28px);
  padding: clamp(16px, 2.6vw, 30px) clamp(16px, 2.6vw, 26px);
  border-radius: 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background .5s ease, border-color .5s ease, transform .5s var(--ease-out);
}

.zone-kicker {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: .68rem;
  letter-spacing: .32em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.zone-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  font-size: clamp(1.5rem, 3.4vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: .05em;
  margin: 4px 0 2px;
}

.zone-desc {
  font-size: clamp(.8rem, 1.1vw, .95rem);
  color: var(--text-dim);
  font-weight: 400;
  max-width: 34ch;
}

.zone-cta {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  font-family: 'Orbitron', sans-serif;
  font-size: .72rem;
  letter-spacing: .3em;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .4s ease, transform .4s ease, border-color .4s ease, background .4s ease;
}

.arrow { transition: transform .4s var(--ease-out); }

/* -- TOOL (cyan) -- */
.zone--tool .zone-title { color: #eafeff; text-shadow: 0 0 18px var(--cyan-soft); }
.zone--tool .zone-cta { color: var(--cyan); }

/* -- TMI (magenta) -- */
.zone--tmi .zone-title { color: #fdeaf9; text-shadow: 0 0 18px var(--magenta-soft); }
.zone--tmi .zone-cta { color: var(--magenta); }

/* -- Hover / focus / active states -- */
.zone:hover,
.zone:focus-visible,
.zone.is-active {
  transform: scale(1.025);
}

.zone:hover .zone-overlay,
.zone:focus-visible .zone-overlay,
.zone.is-active .zone-overlay {
  opacity: .55;
  transform: scale(1);
}

.zone:hover .zone-scan,
.zone.is-active .zone-scan {
  opacity: 1;
  animation: scan-sweep 2.4s linear infinite;
}

@keyframes scan-sweep {
  0%   { background-position: 0 -60%; }
  100% { background-position: 0 160%; }
}

.zone:hover .zone-glow,
.zone.is-active .zone-glow { opacity: .8; }

.zone:hover .zone-glass,
.zone.is-active .zone-glass { transform: translateY(-4px); }

.zone--tool:hover .zone-glass,
.zone--tool.is-active .zone-glass { border-color: var(--cyan-soft); background: var(--glass-bg-hover); }
.zone--tmi:hover .zone-glass,
.zone--tmi.is-active .zone-glass { border-color: var(--magenta-soft); background: var(--glass-bg-hover); }

.zone--tool:hover .zone-frame,
.zone--tool.is-active .zone-frame { border-color: var(--cyan-soft); box-shadow: 0 0 40px -6px var(--cyan-soft), inset 0 0 30px -12px var(--cyan-soft); }
.zone--tmi:hover .zone-frame,
.zone--tmi.is-active .zone-frame { border-color: var(--magenta-soft); box-shadow: 0 0 40px -6px var(--magenta-soft), inset 0 0 30px -12px var(--magenta-soft); }

.zone:hover .zone-cta,
.zone:focus-visible .zone-cta,
.zone.is-active .zone-cta {
  opacity: 1;
  transform: translateY(0);
}

.zone--tool:hover .zone-cta { border-color: var(--cyan-soft); background: rgba(0, 246, 255, .08); }
.zone--tmi:hover .zone-cta  { border-color: var(--magenta-soft); background: rgba(255, 47, 208, .08); }

.zone:hover .arrow { transform: translateX(4px); }

.zone:active { transform: scale(.99); }

/* ==========================================================================
   Scroll / hint
   ========================================================================== */

.scroll-hint {
  position: relative;
  z-index: 4;
  text-align: center;
  padding-bottom: 22px;
  font-family: 'Orbitron', sans-serif;
  font-size: .62rem;
  letter-spacing: .38em;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 1.2s ease 2.4s;
}

.gateway.stage-zones .scroll-hint { opacity: .55; }

.scroll-hint::before,
.scroll-hint::after {
  content: '';
  display: inline-block;
  width: 26px;
  height: 1px;
  background: var(--text-dim);
  vertical-align: middle;
  margin: 0 10px;
}

/* ==========================================================================
   Transition veil (click → redirect)
   ========================================================================== */

.transition-veil {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--navy-deep);
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .5s ease;
}

.transition-veil.is-active {
  opacity: 1;
  pointer-events: all;
}

.veil-bolt {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, var(--cyan-soft), transparent 60%);
}

.transition-veil.side-tmi .veil-bolt {
  background: radial-gradient(circle at 50% 50%, var(--magenta-soft), transparent 60%);
}

.transition-veil.is-active .veil-bolt {
  animation: veil-pulse .9s var(--ease-out) forwards;
}

@keyframes veil-pulse {
  0%   { opacity: 0; transform: scale(.2); }
  40%  { opacity: 1; }
  100% { opacity: .9; transform: scale(2.2); }
}

.veil-label {
  position: relative;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: .5em;
  font-size: .8rem;
  color: var(--text);
  opacity: 0;
  transition: opacity .3s ease .3s;
}

.transition-veil.is-active .veil-label { opacity: .85; }

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .hero-text { padding-top: 16vh; }
  .kamon-wrap { top: 22%; width: 22vw; }

  .zones {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto 1fr;
    padding: 3vh 6vw 3vh;
    gap: 4px;
  }

  .zones-divider {
    flex-direction: row;
    padding: 10px 0;
  }
  .divider-line { height: 1px; width: auto; min-width: 24px; min-height: 0; flex: 1; }
  .divider-glyph { writing-mode: horizontal-tb; }

  .zone { min-height: 30vh; }
}

@media (max-width: 520px) {
  .title { letter-spacing: .06em; }
  .zone-title { font-size: 1.5rem; }
  .zone-desc { display: none; }
  .kamon-wrap { width: 26vw; top: 19%; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .hero-text { padding-top: 10vh; }
  .kamon-wrap { width: 11vh; top: 16%; }
  .zone { min-height: 34vh; }
}

/* ==========================================================================
   LOBORCA HUD WIDGET (Translucent Cyber HUD)
   ========================================================================== */

.hud-widget {
  position: fixed;
  top: 24px;
  left: 24px;
  width: min(340px, calc(100vw - 32px));
  background: rgba(8, 14, 30, 0.62);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(0, 246, 255, 0.22);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 20px rgba(0, 246, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  z-index: 50;
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  overflow: hidden;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  user-select: none;
}

.hud-widget:hover {
  border-color: rgba(0, 246, 255, 0.45);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.75), 0 0 28px rgba(0, 246, 255, 0.16);
}

/* Corner accent lines */
.hud-widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  border-top: 2px solid var(--cyan);
  border-left: 2px solid var(--cyan);
  border-top-left-radius: 12px;
  pointer-events: none;
}

.hud-widget::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 14px;
  height: 14px;
  border-bottom: 2px solid var(--magenta);
  border-right: 2px solid var(--magenta);
  border-bottom-right-radius: 12px;
  pointer-events: none;
}

/* Header */
.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(0, 246, 255, 0.08) 0%, rgba(255, 47, 208, 0.04) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: grab;
}

.hud-header:active {
  cursor: grabbing;
}

.hud-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-status-dot {
  width: 7px;
  height: 7px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--cyan);
  animation: hud-dot-pulse 2s infinite ease-in-out;
}

@keyframes hud-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.hud-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #cdeeff;
}

.hud-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hud-btn-mini {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-dim);
  border-radius: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s ease;
}

.hud-btn-mini:hover {
  background: rgba(0, 246, 255, 0.15);
  border-color: var(--cyan);
  color: var(--text);
}

/* Tabs */
.hud-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.hud-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 8px 12px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.25s ease;
  position: relative;
}

.hud-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.hud-tab.active {
  color: var(--cyan);
  background: rgba(0, 246, 255, 0.06);
}

.hud-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

/* Tab Panels */
.hud-panel {
  display: none;
  padding: 12px 14px;
  max-height: 380px;
  overflow-y: auto;
}

.hud-panel.active {
  display: block;
}

/* Sections */
.hud-section {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.hud-section:last-child {
  margin-bottom: 0;
}

.hud-sec-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.sec-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}

.sec-badge {
  font-size: 0.58rem;
  font-family: 'Orbitron', sans-serif;
  padding: 2px 6px;
  background: rgba(0, 246, 255, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(0, 246, 255, 0.3);
  border-radius: 4px;
  letter-spacing: 0.08em;
}

.sec-live-pulse {
  font-size: 0.55rem;
  font-family: 'Orbitron', sans-serif;
  padding: 2px 6px;
  background: rgba(255, 47, 208, 0.15);
  color: var(--magenta);
  border: 1px solid rgba(255, 47, 208, 0.4);
  border-radius: 4px;
  letter-spacing: 0.1em;
  animation: live-blink 1.5s infinite;
}

@keyframes live-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hud-ip-display {
  font-family: 'Orbitron', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.06em;
  text-shadow: 0 0 10px rgba(0, 246, 255, 0.4);
  display: block;
  word-break: break-all;
}

.hud-sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.hud-sub-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sub-label {
  font-size: 0.58rem;
  color: var(--text-dim);
  letter-spacing: 0.12em;
}

.sub-val {
  font-size: 0.78rem;
  color: #e2effa;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Environment section */
.hud-env-section {
  position: relative;
  overflow: hidden;
  animation: env-fade-in 0.2s ease both;
}

@keyframes env-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.hud-env-section::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(180deg, transparent, rgba(0, 246, 255, 0.07), transparent);
  animation: env-scanline 4s linear infinite;
  pointer-events: none;
}

@keyframes env-scanline {
  0%   { top: -40%; }
  100% { top: 100%; }
}

.hud-env-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.hud-env-item {
  position: relative;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.hud-env-item:hover {
  border-color: rgba(0, 246, 255, 0.5);
  box-shadow: 0 0 12px rgba(0, 246, 255, 0.25), inset 0 0 8px rgba(0, 246, 255, 0.06);
  background: rgba(0, 246, 255, 0.04);
}

.hud-env-item.env-full {
  grid-column: 1 / -1;
}

.env-item-top {
  display: flex;
  align-items: center;
  gap: 4px;
}

.env-led {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  animation: hud-dot-pulse 2s infinite ease-in-out;
}

.env-online-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  color: var(--cyan-dim);
}

.env-item-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.58rem;
  color: var(--text-dim);
  letter-spacing: 0.12em;
}

.env-icon {
  font-size: 0.72rem;
  filter: drop-shadow(0 0 4px rgba(0, 246, 255, 0.4));
}

.env-val {
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 8px rgba(0, 246, 255, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-env-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
}

.env-footer-label {
  color: var(--text-dim);
}

.env-footer-val {
  font-family: 'Orbitron', monospace;
  color: #00f5ff;
  text-shadow: 0 0 8px rgba(0, 245, 255, 0.5);
  font-weight: 700;
}

/* Weather styles */
.hud-weather-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.weather-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weather-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.3));
}

.weather-temp {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(0, 246, 255, 0.4);
}

.weather-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.w-detail-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
}

.w-detail-k {
  color: var(--text-dim);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.w-detail-v {
  color: #fff;
  font-weight: 600;
}

/* Orbit Mini styles */
.hud-orbit-mini {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.orbit-cell {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
}

.o-label {
  display: block;
  font-size: 0.54rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

.o-val {
  display: block;
  font-family: 'Orbitron', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  color: #fce8f8;
  margin-top: 2px;
}

/* Map Panel */
#panelOrbit {
  padding: 8px;
}

.hud-map-wrapper {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(0, 246, 255, 0.2);
}

.hud-map {
  height: 220px;
  width: 100%;
  background: #050711;
}

.map-overlay-info {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  background: rgba(5, 7, 17, 0.82);
  backdrop-filter: blur(8px);
  border-radius: 4px;
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  z-index: 1000;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
}

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.legend-dot.dot-user {
  background: var(--magenta);
  box-shadow: 0 0 6px var(--magenta);
}

.legend-dot.dot-iss {
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}

/* Leaflet Marker Styling */
.hud-iss-marker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.iss-radar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: radar-pulse 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

@keyframes radar-pulse {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

.iss-symbol {
  font-size: 1.1rem;
  filter: drop-shadow(0 0 6px var(--cyan));
}

.hud-user-marker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.user-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255, 47, 208, 0.35);
  animation: radar-pulse 1.8s ease-out infinite;
}

.user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--magenta);
  box-shadow: 0 0 8px var(--magenta);
}

.hud-map-tooltip {
  background: rgba(5, 8, 20, 0.9) !important;
  border: 1px solid var(--cyan) !important;
  color: var(--text) !important;
  font-family: 'Rajdhani', sans-serif !important;
  font-size: 0.72rem !important;
  box-shadow: 0 0 10px rgba(0, 246, 255, 0.4) !important;
  border-radius: 4px !important;
}

/* Footer */
.hud-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-family: 'Orbitron', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.hud-signal {
  color: var(--cyan);
}

/* Compact Mode */
.hud-widget.compact .hud-body,
.hud-widget.compact .hud-footer {
  display: none;
}

.hud-widget.compact {
  width: auto;
  min-width: 200px;
}

/* Mobile responsive */
@media (max-width: 600px) {
  .hud-widget {
    top: 12px;
    left: 12px;
    width: calc(100vw - 24px);
    max-width: 360px;
  }
}

