:root {
  color-scheme: dark;
  --bg: #07111e;
  --bg-elevated: rgba(10, 25, 39, 0.78);
  --panel-border: rgba(160, 214, 255, 0.18);
  --text: #eff7ff;
  --muted: rgba(216, 232, 247, 0.72);
  --accent: #82f7d8;
  --accent-strong: #f7a25c;
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(0, 163, 255, 0.2), transparent 34%),
    radial-gradient(circle at bottom right, rgba(247, 162, 92, 0.22), transparent 28%),
    linear-gradient(160deg, #050a12 0%, #07111e 48%, #091722 100%);
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
}

body {
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(290px, 360px) 1fr;
  min-height: 100vh;
}

.control-panel {
  padding: 28px;
  border-right: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(8, 18, 30, 0.94), rgba(7, 17, 30, 0.64));
  backdrop-filter: blur(24px);
  overflow-y: auto;
}

.panel-header h1 {
  margin: 10px 0 12px;
  font-size: clamp(2.1rem, 3vw, 3.4rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
}

.eyebrow,
.legend-header span:last-child,
.microcopy,
.metric span {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-copy {
  margin: 0;
  max-width: 32ch;
  color: rgba(239, 247, 255, 0.82);
  line-height: 1.55;
}

.control-group,
.legend-block {
  margin-top: 28px;
}

.control-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.file-picker {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: rgba(12, 32, 52, 0.52);
}

.file-picker input {
  width: 100%;
  color: var(--muted);
}

.primary-button,
.secondary-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
}

.primary-button {
  color: #04141f;
  background: linear-gradient(135deg, var(--accent), #b4ffe3);
  box-shadow: 0 10px 30px rgba(130, 247, 216, 0.24);
}

.secondary-button {
  color: var(--text);
  background: rgba(127, 170, 207, 0.16);
  border: 1px solid rgba(160, 214, 255, 0.18);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  box-shadow: none;
}

.metric {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(160, 214, 255, 0.12);
}

.metric strong {
  font-weight: 600;
  text-align: right;
}

.legend-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.hint-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.hint-list li,
.microcopy {
  color: var(--muted);
}

.lyrics-panel {
  margin: 0;
  padding: 16px;
  min-height: 168px;
  max-height: 260px;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(160, 214, 255, 0.1);
  background: rgba(9, 22, 34, 0.58);
  color: rgba(239, 247, 255, 0.86);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.58;
  white-space: pre-wrap;
}

.hint-list {
  display: grid;
  gap: 10px;
}

.hint-list li {
  padding-left: 18px;
  position: relative;
  line-height: 1.45;
}

.hint-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.stage-panel {
  position: relative;
  overflow: hidden;
}

.canvas-frame {
  position: relative;
  width: 100%;
  height: 100%;
}

#spiral-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hover-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 240px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(8, 22, 35, 0.9);
  border: 1px solid rgba(160, 214, 255, 0.18);
  box-shadow: 0 16px 36px var(--shadow);
  backdrop-filter: blur(18px);
  pointer-events: none;
}

.hover-tooltip strong {
  display: block;
  margin-bottom: 4px;
}

.hover-tooltip span {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(52vh, 1fr);
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--panel-border);
  }

  .stage-panel {
    min-height: 60vh;
  }
}
