:root {
  color-scheme: dark;
  --bg: #05060a;
  --panel: rgba(18, 20, 29, 0.75);
  --panel-border: rgba(255, 255, 255, 0.05);
  --accent: #4ef6ff;
  --accent-2: #9c7dff;
  --text: #e9edf5;
  --muted: #8a91a6;
  --glow: 0 0 24px rgba(78, 246, 255, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% 20%, rgba(78, 246, 255, 0.08), transparent 35%),
    radial-gradient(circle at 80% 30%, rgba(156, 125, 255, 0.08), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: "Inter Tight", "Space Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

#app {
  position: fixed;
  inset: 0;
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  width: calc(100% - 32px);
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text);
  flex: 1 1 auto;
}

.brand .logo {
  height: 24px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.brand-text {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

#menuToggle {
  width: 44px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 18px;
}


.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 320px;
  flex-wrap: wrap;
}
input[type="range"] {
  min-width: 140px;
}

button,
select,
input,
option {
  font: inherit;
  color: var(--text);
}

button {
  background: linear-gradient(135deg, rgba(78, 246, 255, 0.2), rgba(156, 125, 255, 0.2));
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: var(--glow);
  border-color: rgba(78, 246, 255, 0.4);
}

input[type="range"] {
  accent-color: var(--accent);
  flex: 1;
}

select {
  background: rgba(10, 12, 20, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 7px 10px;
  color: var(--text);
}

option {
  background: #0b0f1a;
  color: var(--text);
}

.value-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  margin-left: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
}

.control-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
  color: var(--muted);
  font-size: 12px;
}

.control-stack.buttons {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.inline-check input {
  accent-color: var(--accent);
  margin: 0;
}

#toggleHelp {
  width: 36px;
  padding: 8px 0;
}

.help-panel {
  position: relative;
  margin-top: 8px;
  background: rgba(12, 14, 22, 0.92);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  font-size: 12px;
  color: var(--muted);
  backdrop-filter: blur(10px);
  z-index: 5;
}

.help-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.help-row strong {
  min-width: 52px;
  display: inline-block;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text);
  text-align: center;
}

.control-stack label {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.status-bar {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--panel-border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
}

.status-bar[data-mode="warn"] {
  color: #f3b897;
  border-color: rgba(255, 159, 122, 0.4);
  background: rgba(255, 159, 122, 0.08);
}

.status-bar[data-mode="info"] {
  color: var(--muted);
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.stat strong {
  color: var(--text);
}

.legend {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-bar {
  width: 80px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #3bc9ff, #ff9f7a);
  box-shadow: 0 0 8px rgba(59, 201, 255, 0.4);
}

.timeline-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(760px, calc(100% - 36px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px) saturate(140%);
  z-index: 10;
}

.timeline-bar #playToggle {
  width: 46px;
  height: 38px;
  padding: 0;
  flex: 0 0 auto;
}

.timeline-bar input[type="range"] {
  flex: 1;
  min-width: 240px;
}

.timeline-bar .timeline-label {
  min-width: 150px;
  text-align: center;
}

.hud-hidden #hud,
.hud-hidden #drawer,
.hud-hidden #tooltip,
.hud-hidden #timelineBar {
  display: none !important;
}

#miniInfo {
  position: fixed;
  left: 16px;
  bottom: 16px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(10px);
  z-index: 8;
  min-width: 140px;
}

.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  line-height: 1.4;
}

.mini-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.mini-info span:last-child {
  color: var(--text);
  font-weight: 600;
}

.mobile-warning {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 6, 10, 0.94);
  color: var(--text);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.mobile-warning__content {
  background: rgba(15, 17, 26, 0.8);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 18px 22px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}

.mobile-warning__title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.mobile-warning__text {
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 768px) {
  #hud {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: 92vw;
    padding: 8px 10px;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .brand .logo {
    height: 20px;
  }

  .brand-text {
    font-size: 12px;
    letter-spacing: 0.05em;
  }

  .hud-actions {
    gap: 6px;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: 4px;
  }

  .contact-btn {
    padding: 7px 10px;
    font-size: 12px;
  }

  #menuToggle {
    width: 40px;
    height: 34px;
    font-size: 16px;
  }

  #drawer {
    top: 64px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 80px);
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .controls > button,
  .controls > select,
  .controls > input[type="range"] {
    width: 100%;
  }

  .control-stack {
    width: 100%;
  }

  .control-stack.buttons {
    justify-content: space-between;
    gap: 6px;
  }

  #statusBar {
    width: 100%;
  }

  #miniInfo {
    left: 12px;
    bottom: 12px;
    min-width: 120px;
  }

  #timelineBar {
    width: calc(100% - 24px);
    bottom: 12px;
    gap: 10px;
    padding: 10px 12px;
  }

  #timelineBar input[type="range"] {
    min-width: 160px;
  }

  #mobileWarning {
    display: flex;
  }

  #app,
  #drawer,
  #hud,
  #tooltip,
  #miniInfo,
  #timelineBar {
    pointer-events: none;
  }
}

#menuToggle {
  width: 44px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 18px;
}

#drawer {
  position: fixed;
  top: 78px;
  right: 16px;
  width: min(420px, 92vw);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  z-index: 9;
  display: none;
}

.drawer-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.drawer-open #drawer {
  display: block;
}

#tooltip {
  position: fixed;
  pointer-events: none;
  padding: 10px 12px;
  background: rgba(18, 20, 29, 0.9);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 12;
  max-width: 260px;
}

#overlay {
  position: fixed;
  inset: auto 16px 16px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  z-index: 9;
}

.panel {
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  color: var(--muted);
  backdrop-filter: blur(8px);
}

.panel h3 {
  margin: 0 0 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}

.timeline-label {
  min-width: 110px;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 768px) {
  #hud {
    inset: 12px;
  }
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  input[type="range"] {
    width: 100%;
  }
}
