@import url('https://fonts.cdnfonts.com/css/red-hat-mono');

:root {
  --bg-color: #0f181f;
  --grid-color: rgba(183, 187, 190, 0.05);
  --text-primary: #b7bbbe;
  --text-secondary: #5f666d;
  --text-highlight: #ff9e3d;
  --accent-primary: #ff9e3d;
  --accent-secondary: #ffb366;
  --accent-tertiary: #ffc799;
  --panel-bg: rgba(33, 57, 74, 0.7);
  --panel-border: rgba(255, 158, 61, 0.3);
  --panel-highlight: rgba(255, 158, 61, 0.1);
  --scanner-line: rgba(255, 158, 61, 0.7);
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: 'Red Hat Mono', monospace, sans-serif;
  overflow: hidden;
  height: 100vh;
  text-transform: uppercase;
  font-size: 1rem;
}

button,
input,
select,
textarea {
  font-family: 'Red Hat Mono', monospace, sans-serif;
}

.space-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("assets/planet.png");
  background-size: cover;
  background-position: center;
  z-index: 0;
  opacity: 0.8;
}

#three-container {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: -webkit-grab;
  cursor: grab;
}

#three-container:active {
  cursor: -webkit-grabbing;
  cursor: grabbing;
}

.interface-container {
  position: relative;
  width: 100%;
  height: 100vh;
  z-index: 2;
  pointer-events: none;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(
      to right,
      var(--grid-color) 1px,
      transparent 1px
    ),
    linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: 0;
}

.header {
  display: flex;
  justify-content: space-between;
  padding: 1.25rem;
}

.header-item {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.scanner-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 400px;
  border: 1px solid var(--accent-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.scanner-frame::before,
.scanner-frame::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--accent-primary);
  border-style: solid;
}

.scanner-frame::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.scanner-frame::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}

.scanner-frame .corner-tl {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 20px;
  height: 20px;
  border-top: 2px solid var(--accent-primary);
  border-left: 2px solid var(--accent-primary);
}

.scanner-frame .corner-tr {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 20px;
  height: 20px;
  border-top: 2px solid var(--accent-primary);
  border-right: 2px solid var(--accent-primary);
}

.scanner-frame .corner-bl {
  position: absolute;
  bottom: -1px;
  left: -1px;
  width: 20px;
  height: 20px;
  border-bottom: 2px solid var(--accent-primary);
  border-left: 2px solid var(--accent-primary);
}

.scanner-frame .corner-br {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 20px;
  height: 20px;
  border-bottom: 2px solid var(--accent-primary);
  border-right: 2px solid var(--accent-primary);
}

.scanner-id {
  position: absolute;
  bottom: -30px;
  left: 0;
  font-size: 0.75rem;
  color: var(--accent-primary);
}

.scanner-id-right {
  position: absolute;
  bottom: -30px;
  right: 0;
  font-size: 0.75rem;
  color: var(--accent-primary);
}

.scanner-line {
  position: absolute;
  width: 100%;
  height: 2px;
  background: var(--scanner-line);
  top: 0;
  box-shadow: 0 0 10px var(--accent-primary);
  -webkit-animation: scan 4s linear infinite;
          animation: scan 4s linear infinite;
}

@-webkit-keyframes scan {
  0% {
    top: 0;
  }

  100% {
    top: 100%;
  }
}

@keyframes scan {
  0% {
    top: 0;
  }

  100% {
    top: 100%;
  }
}

.data-panels {
  display: flex;
  justify-content: space-between;
  padding: 0 1.25rem;
  margin-bottom: 1.25rem;
}

.data-panel {
  width: 260px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  padding: 0.75rem;
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  pointer-events: auto;
  z-index: 10;
}

.data-panel-title {
  font-size: 0.75rem;
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.intro-panel .data-panel-title {
  justify-content: center;
}

/* Intro panel */
.intro-panel {
  max-width: 700px;
}

/* Increase width for intro panel to reduce vertical stacking */
.data-panel.intro-panel {
  width: clamp(500px, 60vw, 750px);
}

.intro-text {
  font-size: 0.65rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 0.5rem;
  text-align: center;
}

.intro-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
  justify-content: center;
}

/* Avoid overlapping the center orb on shorter viewports */
/* Tweak for 1080p height and below: widen to reduce vertical stacking */
@media (max-height: 1100px) and (min-width: 1200px) {
  .intro-panel {
    max-width: 800px;
  }
  /* Keep intro text as a single column at all sizes to avoid mid-panel gap */
  .intro-text {
    column-count: 1;
    column-gap: 0;
  }
}

@media (max-height: 800px) {
  .intro-panel {
    max-width: 650px;
  }
  .intro-text {
    font-size: 0.68rem;
    margin-bottom: 0.4rem;
  }
  .intro-actions .btn {
    padding: 0.35rem 0;
    font-size: 0.65rem;
  }
}

/* Highlight effect for spectrum analyzer when guided from intro button */
.spectrum-analyzer.highlighted {
  box-shadow: 0 0 0 0 rgba(255, 158, 61, 0.7);
  animation: pulse-highlight 1.6s ease-out 2;
}

@keyframes pulse-highlight {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 158, 61, 0.6);
    border-color: var(--accent-primary);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(255, 158, 61, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 158, 61, 0);
  }
}

.data-readouts {
  margin-top: 0.625rem;
}

.data-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  font-size: 0.68rem;
}

.data-label {
  color: var(--text-secondary);
}

.data-value {
  color: var(--text-primary);
}

/* Contact links panel */
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.4rem;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--panel-highlight);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
  font-size: 0.68rem;
}

.contact-item:hover {
  background: var(--panel-border);
  border-color: var(--accent-primary);
}

.contact-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  filter: drop-shadow(0 0 2px rgba(255, 158, 61, 0.2));
}

/* Utility: preserve text casing where needed (e.g., emails) */
.no-transform {
  text-transform: none;
}

.data-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0.625rem 0;
  position: relative;
  border-radius: 3px;
}

.data-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 3px;
  transition: width 0.5s;
}

.waveform {
  width: 100%;
  height: 50px;
  margin: 0.625rem 0;
  display: flex;
  align-items: center;
  position: relative;
}

.waveform-canvas {
  width: 100%;
  height: 100%;
}

.control-panel {
  width: 260px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  padding: 0.75rem;
  position: absolute;
  top: 20px;
  left: 20px;
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  pointer-events: auto;
  z-index: 10;
}

.control-panel h3 {
  font-size: 0.75rem;
  color: var(--accent-primary);
  margin-bottom: 0.75rem;
}

.control-group {
  margin-bottom: 0.75rem;
}

.control-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.control-label {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.control-value {
  font-size: 0.68rem;
  color: var(--text-primary);
}

.slider-container {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.slider {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  border-radius: 3px;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
}

.buttons {
  display: flex;
  gap: 0.625rem;
  margin-top: 0.9375rem;
}

.btn {
  flex: 1;
  padding: 0.45rem 0;
  background: var(--panel-highlight);
  border: 1px solid var(--panel-border);
  color: var(--accent-primary);
  font-size: 0.68rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  background: var(--panel-border);
}

.terminal-panel {
  position: absolute;
  left: 20px;
  bottom: 20px;
  width: 450px;
  height: 130px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  overflow: hidden;
  pointer-events: auto;
  z-index: 10;
}

.terminal-header {
  padding: 0.4rem 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.75rem;
  color: var(--accent-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-direction: row;
  margin-bottom: 1rem;
}

.terminal-content {
  padding: 0.5rem;
  height: calc(100% - 31px);
  overflow-y: auto;
  font-size: 0.68rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.terminal-line {
  margin-bottom: 0.25rem;
}

.command-line {
  color: white;
}

.regular-line {
  color: var(--text-highlight);
}

.typing {
  position: relative;
}

.typing::after {
  content: "|";
  position: absolute;
  -webkit-animation: blink 1s infinite;
          animation: blink 1s infinite;
}

@-webkit-keyframes blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 0.5s;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 500px;
  padding: 1.25rem;
}

.preloader-canvas-container {
  width: 180px;
  height: 180px;
}

.loading-text {
  margin-top: 1.25rem;
  text-align: center;
  color: var(--accent-primary);
  letter-spacing: 2px;
  font-size: 0.875rem;
}

.notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 0.625rem 1.25rem;
  border-radius: 5px;
  font-size: 0.75rem;
  color: var(--accent-primary);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 100;
}

.drag-handle {
  cursor: move;
  width: auto;
  height: 100%;
  color: var(--accent-primary);
}

.particle-trail {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.5s;
}

.circular-visualizer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 450px;
  height: 450px;
  pointer-events: none;
  z-index: 5;
}

.circular-visualizer canvas {
  width: 100%;
  height: 100%;
}

.audio-wave {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(255, 78, 66, 0.1);
  pointer-events: none;
  z-index: 3;
}

.audio-wave::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid rgba(255, 78, 66, 0.05);
  -webkit-animation: pulse 4s infinite;
          animation: pulse 4s infinite;
}

@-webkit-keyframes pulse {
  0% {
    width: 100%;
    height: 100%;
    opacity: 0.5;
  }

  50% {
    width: 120%;
    height: 120%;
    opacity: 0;
  }

  100% {
    width: 100%;
    height: 100%;
    opacity: 0.5;
  }
}

@keyframes pulse {
  0% {
    width: 100%;
    height: 100%;
    opacity: 0.5;
  }

  50% {
    width: 120%;
    height: 120%;
    opacity: 0;
  }

  100% {
    width: 100%;
    height: 100%;
    opacity: 0.5;
  }
}

.spectrum-analyzer {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 360px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  overflow: hidden;
  pointer-events: auto;
  z-index: 10;
}

.spectrum-header {
  padding: 0.4rem 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.75rem;
  color: var(--accent-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.spectrum-content {
  padding: 0.5rem;
  position: relative;
}

.spectrum-canvas {
  width: 100%;
  height: 100px;
  display: block;
}

.audio-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0 0.5rem 0.5rem;
}

.audio-file-input {
  display: none;
}

.audio-file-btn {
  display: block;
  padding: 0.4rem 0;
  background: var(--panel-highlight);
  border: 1px solid var(--panel-border);
  color: var(--accent-primary);
  font-size: 0.68rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  margin-bottom: 0.5rem;
}

.audio-file-btn:hover {
  background: var(--panel-border);
}

.audio-file-label {
  display: block;
  padding: 0.4rem 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  color: var(--accent-primary);
  font-size: 0.68rem;
  border-radius: 3px;
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-player {
  width: 100%;
  margin-bottom: 0.5rem;
}

.controls-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.audio-sensitivity-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  font-size: 0.68rem;
}

.audio-sensitivity-value {
  color: var(--accent-primary);
}

.controls-row {
  display: flex;
  gap: 0.625rem;
  margin-bottom: 0.625rem;
}

.demo-tracks {
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.demo-tracks-label {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  display: block;
}

.demo-track-btn {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
  background: var(--panel-highlight);
  border: 1px solid var(--panel-border);
  color: var(--accent-primary);
  font-size: 0.62rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
}

.demo-track-btn:hover {
  background: var(--panel-border);
}

.demo-track-btn.active {
  background: var(--accent-primary);
  color: #000;
}

.youtube-input {
  display: flex;
  margin-top: 0.625rem;
  margin-bottom: 0.625rem;
}

.youtube-url {
  flex: 1;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-size: 0.75rem;
  border-radius: 3px 0 0 3px;
}

.youtube-load-btn {
  padding: 0.5rem 0.625rem;
  background: var(--panel-highlight);
  border: 1px solid var(--panel-border);
  border-left: none;
  color: var(--accent-primary);
  font-size: 0.75rem;
  border-radius: 0 3px 3px 0;
  cursor: pointer;
  transition: all 0.2s;
}

.youtube-load-btn:hover {
  background: var(--panel-border);
}

.youtube-error {
  color: var(--accent-tertiary);
  font-size: 0.6875rem;
  margin-top: 0.3125rem;
  display: none;
}

.preloader-canvas-container {
  position: relative;
}

.preloader-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Floating particles */
.floating-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}