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

body {
  font-family: 'Outfit', sans-serif;
  background: #0A0812;
  color: #FFF5E0;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

#scene-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#scene-container canvas {
  display: block;
}

/* TOP BAR */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  pointer-events: none;
}

#top-bar > * {
  pointer-events: auto;
}

#title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

#sun-glyph {
  font-size: 32px;
  color: #E8B84B;
  text-shadow: 0 0 20px rgba(232, 184, 75, 0.6);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(232, 184, 75, 0.4); }
  50% { text-shadow: 0 0 40px rgba(232, 184, 75, 0.8); }
}

#main-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 6px;
  color: #E8B84B;
  text-shadow: 0 0 12px rgba(232, 184, 75, 0.3);
}

#subtitle {
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 3px;
  color: rgba(255, 245, 224, 0.5);
  text-transform: uppercase;
}

#top-right {
  display: flex;
  gap: 4px;
  background: rgba(74, 53, 32, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(232, 184, 75, 0.15);
  border-radius: 28px;
  padding: 4px;
}

.mode-btn {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 20px;
  border: none;
  border-radius: 24px;
  background: transparent;
  color: rgba(255, 245, 224, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 1px;
}

.mode-btn:hover {
  color: #FFF5E0;
}

.mode-btn.active {
  background: rgba(232, 184, 75, 0.25);
  color: #E8B84B;
  box-shadow: 0 0 16px rgba(232, 184, 75, 0.15);
}

/* INTERACTION HINT */
#interaction-hint {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(74, 53, 32, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(232, 184, 75, 0.15);
  border-radius: 24px;
  padding: 10px 24px;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 1.5px;
  color: rgba(255, 245, 224, 0.6);
  transition: opacity 1s ease;
  pointer-events: none;
}

#interaction-hint.hidden {
  opacity: 0;
}

/* BOTTOM HUD */
#bottom-hud {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 32px;
  background: rgba(10, 8, 18, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(232, 184, 75, 0.12);
  border-radius: 16px;
  padding: 12px 28px;
  pointer-events: auto;
}

#pitch-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

#note-name {
  font-size: 20px;
  font-weight: 700;
  color: #E8B84B;
  letter-spacing: 2px;
}

#frequency-val {
  font-size: 13px;
  font-weight: 200;
  color: rgba(255, 245, 224, 0.6);
  font-variant-numeric: tabular-nums;
}

/* SYMPATHETIC TOGGLE */
#sympathetic-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-label {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 1px;
  color: rgba(255, 245, 224, 0.5);
  text-transform: uppercase;
}

.toggle-switch {
  width: 44px;
  height: 24px;
  background: rgba(74, 53, 32, 0.5);
  border: 1px solid rgba(232, 184, 75, 0.2);
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
}

.toggle-switch.active {
  background: rgba(232, 184, 75, 0.3);
  border-color: rgba(232, 184, 75, 0.5);
}

.toggle-knob {
  width: 18px;
  height: 18px;
  background: #E8B84B;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 3px;
  transition: all 0.3s ease;
  box-shadow: 0 0 8px rgba(232, 184, 75, 0.4);
}

.toggle-switch.active .toggle-knob {
  left: 21px;
}

/* SUSTAIN RING */
#sustain-ring-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

#sustain-ring {
  width: 48px;
  height: 48px;
}

.ring-bg {
  fill: none;
  stroke: rgba(74, 53, 32, 0.4);
  stroke-width: 3;
}

.ring-fg {
  fill: none;
  stroke: #E8B84B;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 163.36;
  stroke-dashoffset: 163.36;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.1s linear;
}

.sustain-label {
  font-size: 9px;
  font-weight: 400;
  color: rgba(255, 245, 224, 0.4);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* SUN DIAL */
#sun-dial {
  position: fixed;
  bottom: 100px;
  left: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
}

#dial-canvas {
  cursor: grab;
  border-radius: 50%;
}

#dial-canvas:active {
  cursor: grabbing;
}

#dial-angle {
  font-size: 11px;
  font-weight: 300;
  color: rgba(255, 245, 224, 0.4);
  font-variant-numeric: tabular-nums;
}

/* SPEC PANEL */
#spec-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  width: 380px;
  transform: translateX(380px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

#spec-panel.open {
  transform: translateX(0);
}

#spec-toggle-btn {
  position: absolute;
  left: -48px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 1px;
  color: rgba(255, 245, 224, 0.6);
  background: rgba(10, 8, 18, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(232, 184, 75, 0.15);
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: 12px 10px;
  cursor: pointer;
  writing-mode: vertical-lr;
  text-orientation: mixed;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
}

#spec-toggle-btn:hover {
  color: #E8B84B;
  background: rgba(74, 53, 32, 0.5);
}

#spec-toggle-icon {
  font-size: 10px;
  transition: transform 0.4s ease;
}

#spec-panel.open #spec-toggle-icon {
  transform: rotate(180deg);
}

#spec-content {
  width: 100%;
  height: 100%;
  background: rgba(10, 8, 18, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(232, 184, 75, 0.12);
  padding: 24px;
  overflow-y: auto;
}

#spec-close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  color: rgba(255, 245, 224, 0.4);
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

#spec-close:hover {
  color: #E8B84B;
  background: rgba(232, 184, 75, 0.1);
}

#spec-tabs {
  display: flex;
  gap: 2px;
  margin-top: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.spec-tab {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 14px;
  border: 1px solid rgba(232, 184, 75, 0.12);
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 245, 224, 0.4);
  cursor: pointer;
  transition: all 0.2s ease;
}

.spec-tab:hover {
  color: #FFF5E0;
  border-color: rgba(232, 184, 75, 0.3);
}

.spec-tab.active {
  color: #E8B84B;
  background: rgba(232, 184, 75, 0.12);
  border-color: rgba(232, 184, 75, 0.3);
}

#spec-body {
  font-size: 13px;
  font-weight: 300;
  line-height: 1.8;
  color: rgba(255, 245, 224, 0.7);
}

#spec-body h3 {
  font-size: 14px;
  font-weight: 600;
  color: #E8B84B;
  margin: 16px 0 8px 0;
  letter-spacing: 1px;
}

#spec-body .spec-line {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(232, 184, 75, 0.06);
}

#spec-body .spec-key {
  color: rgba(255, 245, 224, 0.5);
}

#spec-body .spec-val {
  color: #F5D98A;
  font-weight: 400;
  text-align: right;
}

#spec-body p {
  margin: 8px 0;
}

/* TOAST */
#sun-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 500;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 3px;
  color: #E8B84B;
  text-shadow: 0 0 40px rgba(232, 184, 75, 0.8);
  background: rgba(10, 8, 18, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(232, 184, 75, 0.4);
  border-radius: 16px;
  padding: 24px 48px;
  transition: opacity 1s ease;
  pointer-events: none;
}

#sun-toast.hidden {
  opacity: 0;
}

/* FOOTER */
#footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  text-align: center;
  padding: 6px;
  font-size: 10px;
  font-weight: 300;
  color: rgba(255, 245, 224, 0.2);
  letter-spacing: 1px;
  pointer-events: auto;
}

#footer a {
  color: rgba(232, 184, 75, 0.4);
  text-decoration: none;
  transition: color 0.2s ease;
}

#footer a:hover {
  color: #E8B84B;
}

/* Scrollbar styling */
#spec-content::-webkit-scrollbar {
  width: 4px;
}

#spec-content::-webkit-scrollbar-track {
  background: transparent;
}

#spec-content::-webkit-scrollbar-thumb {
  background: rgba(232, 184, 75, 0.2);
  border-radius: 2px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  #top-bar {
    padding: 12px 16px;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  #main-title {
    font-size: 16px;
    letter-spacing: 4px;
  }

  #subtitle {
    font-size: 9px;
  }

  #top-right {
    align-self: center;
  }

  .mode-btn {
    font-size: 11px;
    padding: 6px 14px;
  }

  #bottom-hud {
    gap: 16px;
    padding: 10px 16px;
    flex-wrap: nowrap;
    max-width: calc(100vw - 32px);
  }

  #sun-dial {
    bottom: 90px;
    left: 12px;
  }

  #dial-canvas {
    width: 80px;
    height: 80px;
  }

  #spec-panel {
    width: 100%;
    transform: translateX(100%);
  }

  #spec-toggle-btn {
    left: -44px;
  }

  #interaction-hint {
    bottom: 100px;
    font-size: 10px;
    padding: 8px 16px;
  }
}

/* Golden flash overlay for easter egg */
#golden-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 400;
  background: radial-gradient(circle at center, rgba(232, 184, 75, 0.4) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#golden-flash.active {
  opacity: 1;
}