/* ========================================
   TIMBRE CUBE — Premium Dark UI
   Color palette pulled from 3D cube labels
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- Design Tokens --- */
:root {
  --accent-green: #00ff88;
  --accent-pink: #ff0088;
  --accent-cyan: #00e5ff;
  --accent-amber: #ffaa00;
  --bg-deep: #050508;
  --bg-surface: rgba(255, 255, 255, 0.03);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --bg-glass-hover: rgba(255, 255, 255, 0.10);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-dim: rgba(255, 255, 255, 0.30);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --glow-green: 0 0 20px rgba(0, 255, 136, 0.15);
  --glow-pink: 0 0 20px rgba(255, 0, 136, 0.15);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-align: center;
  background: var(--bg-deep);
  color: var(--text-primary);
  margin: 0;
  padding: 16px 20px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Title --- */
h1 {
  margin: 0 0 4px 0;
  font-size: 1.8em;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 24px rgba(0, 255, 136, 0.25));
}

/* --- Instruction Text --- */
#info {
  margin: 0 0 12px 0;
  font-size: 0.8em;
  font-weight: 300;
  color: var(--text-dim);
  letter-spacing: 0.01em;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
  transition: opacity 0.4s ease;
}

#info:hover {
  color: var(--text-secondary);
}

/* --- VR Button --- */
#vr-button-container {
  margin-bottom: 8px;
}

/* --- Main Layout --- */
.main-container {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: flex-start;
  margin: 0 auto;
  max-width: 1800px;
}

/* --- 3D Cube Container --- */
#container {
  width: 820px;
  height: 800px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: block;
  flex-shrink: 0;
  position: relative;
  /* Subtle border glow */
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(0, 255, 136, 0.03);
}

/* --- Spectro Section (Right Panel) --- */
.spectro-section {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  flex-shrink: 0;
  width: min(50vw, 700px);
  padding-top: 8px;
}

.spectro-section h3 {
  margin: 0;
  font-size: 0.7em;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* --- Spectrograph Canvas --- */
#spectrograph {
  display: block;
  width: 100%;
  max-width: 700px;
  aspect-ratio: 6 / 5;
  height: auto;
  border: 1px solid var(--border-glass);
  background: #000;
  border-radius: var(--radius-md);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.4),
    inset 0 0 30px rgba(0, 0, 0, 0.3);
}

/* --- Readouts (HUD Style) --- */
.spectro-readouts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.spectro-readouts > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.spectro-readouts > div:nth-child(1) {
  border-left: 2px solid var(--accent-green);
}

.spectro-readouts > div:nth-child(2) {
  border-left: 2px solid var(--accent-cyan);
}

.spectro-readouts > div:nth-child(3) {
  border-left: 2px solid var(--accent-pink);
}

.spectro-readouts .readout-label {
  font-size: 0.65em;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.spectro-readouts .readout-value {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 1.3em;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* Color-coded values */
.spectro-readouts > div:nth-child(1) .readout-value { color: var(--accent-green); }
.spectro-readouts > div:nth-child(2) .readout-value { color: var(--accent-cyan); }
.spectro-readouts > div:nth-child(3) .readout-value { color: var(--accent-pink); }

/* --- Button Bar --- */
.button-container {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: flex-start;
}

button {
  font-family: 'Inter', sans-serif;
  font-size: 0.78em;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 8px 18px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.05), rgba(0, 229, 255, 0.05));
  opacity: 0;
  transition: opacity 0.2s ease;
}

button:hover {
  background: var(--bg-glass-hover);
  border-color: rgba(0, 255, 136, 0.25);
  transform: translateY(-1px);
  box-shadow: var(--glow-green);
}

button:hover::before {
  opacity: 1;
}

button:active {
  transform: translateY(0);
  box-shadow: none;
}

button:focus-visible {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2);
}

/* Primary action button */
#place-marker {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.12), rgba(0, 229, 255, 0.08));
  border-color: rgba(0, 255, 136, 0.2);
  color: var(--accent-green);
}

#place-marker:hover {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 229, 255, 0.14));
  border-color: rgba(0, 255, 136, 0.4);
  box-shadow: 0 0 28px rgba(0, 255, 136, 0.2);
}

/* Destructive action */
#clear {
  color: var(--accent-pink);
  border-color: rgba(255, 0, 136, 0.12);
}

#clear:hover {
  background: rgba(255, 0, 136, 0.08);
  border-color: rgba(255, 0, 136, 0.3);
  box-shadow: var(--glow-pink);
}

/* --- Responsive --- */
@media (max-width: 1400px) {
  .main-container {
    flex-direction: column;
    align-items: center;
  }
  
  #container {
    width: min(90vw, 820px);
    height: min(85vw, 800px);
  }
  
  .spectro-section {
    width: min(90vw, 700px);
  }
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  h1 {
    font-size: 1.4em;
  }
  
  .spectro-readouts {
    grid-template-columns: 1fr;
  }
  
  .button-container {
    justify-content: center;
  }
}
