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

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

html {
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

body {
  height: 100%;
  min-width: 820px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: 'Roboto Mono', monospace;
  background: #1a1a1a;
  color: #a0a0a0;
  letter-spacing: 0.02em;
}

.site-header {
  flex-shrink: 0;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
}

.site-name {
  font-family: 'Roboto Mono', monospace;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: #ffffff;
}

/* Range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: #333;
  outline: none;
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: #6B8AFF;
  border-radius: 50%;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #6B8AFF;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Color box */
.color-box {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 1px solid #333;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.color-box input[type="color"] {
  position: absolute;
  width: 100%;
  height: 100%;
  border: none;
  cursor: pointer;
  opacity: 0;
}

.color-box::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Empty slot — waiting for user to pick a color */
.color-box.empty {
  border: 1px dashed #555;
  background: transparent !important;
}

.color-box.empty::after {
  content: '+';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 18px;
  font-weight: 300;
  pointer-events: none;
}

/* Layout */
.dashboard {
  display: grid;
  grid-template-columns: 1fr minmax(480px, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
  min-width: 820px;
  margin: 0 2rem;
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 1rem 2.5rem 1.5rem;
  background: #1a1a1a;
  overflow-y: auto;
}

.preview-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
  padding: 2rem;
  position: relative;
  overflow: hidden;
  min-width: 480px;
  height: 100%;
  max-height: 100%;
}

/* Section labels */
.section-label {
  font-size: 13px;
  font-weight: 400;
  color: #666;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}


/* Link input */
.link-input {
  width: 100%;
  padding: 12px 14px;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  color: #a0a0a0;
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  font-weight: 300;
  outline: none;
  transition: border-color 0.2s;
}

.link-input::placeholder {
  color: #444;
}

.link-input:focus {
  border-color: #6B8AFF;
}

.link-hint {
  font-size: 11px;
  color: #555;
  margin-top: 8px;
  font-weight: 300;
}

.link-hint.error {
  color: #ff6b6b;
}

.link-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.link-field {
  flex: 1;
  min-width: 0;
}

.album-art {
  display: none;
  width: 110px;
  height: 110px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  margin-left: auto;
}

.album-art.visible {
  display: block;
}

/* Track metadata */
.track-meta {
  display: none;
  flex-direction: column;
  gap: 3px;
  margin-top: 7px;
}

.track-meta.visible {
  display: flex;
}

.track-title {
  font-size: 13px;
  font-weight: 500;
  color: #c8c8c8;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-family: 'Roboto Mono', monospace;
  font-size: 11px;
  font-weight: 300;
  color: #6B8AFF;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: underline;
  transition: color 0.15s;
  display: block;
}

.track-artist:hover {
  color: #a0c0ff;
}

/* Color palette */
.color-palette {
  display: flex;
  gap: 10px;
}

.palette-note {
  font-size: 11px;
  color: #555;
  margin-top: 12px;
  font-weight: 300;
}

/* Slider */
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.slider-header .section-label {
  margin-bottom: 0;
}

.slider-value {
  font-size: 12px;
  color: #6B8AFF;
}

.slider-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

.slider-hint {
  font-size: 10px;
  color: #555;
  font-weight: 300;
}

/* Composition buttons */
.composition-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.comp-btn {
  padding: 12px 8px;
  background: transparent;
  border: 1px solid #333;
  border-radius: 6px;
  color: #666;
  font-size: 11px;
  font-weight: 400;
  cursor: pointer;
  font-family: 'Roboto Mono', monospace;
  letter-spacing: 0.02em;
  transition: all 0.15s;
}

.comp-btn.active {
  background: #6B8AFF;
  border-color: #6B8AFF;
  color: #1a1a1a;
}

/* Generate button */
.generate-btn {
  margin-top: 16px;
  padding: 14px;
  background: transparent;
  border: 1px solid #6B8AFF;
  border-radius: 6px;
  color: #6B8AFF;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  font-family: 'Roboto Mono', monospace;
  letter-spacing: 0.05em;
  transition: all 0.15s;
}

.generate-btn:hover {
  background: #6B8AFF;
  color: #1a1a1a;
}

/* Canvas */
#gradient-canvas {
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

/* ═══════════════════════════════════
   Viewer page  (body.viewer)
   ═══════════════════════════════════ */

body.viewer {
  background: #0d0d0d;
  min-width: unset;
  display: block;
  overflow: hidden;
}

body.viewer #viewer-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

body.viewer .site-header {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  flex-shrink: unset;
}

body.viewer .site-name {
  color: var(--ui-color, #6B8AFF);
}

.back-btn {
  font-family: 'Roboto Mono', monospace;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--ui-color, #6B8AFF);
  text-decoration: none;
  border: 1px solid var(--ui-color, #6B8AFF);
  border-radius: 6px;
  padding: 12px 4px;
  align-self: flex-start;
  transition: all 0.15s;
  display: inline-block;
}

.back-btn:hover {
  background: var(--ui-color, #6B8AFF);
  color: var(--ui-hover-color, #0d0d0d);
}

.track-overlay {
  position: absolute;
  bottom: 2rem;
  left: 2rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
}

.track-overlay-art {
  width: 56px;
  height: 56px;
  border-radius: 4px;
  object-fit: cover;
  display: none;
  flex-shrink: 0;
}

.track-overlay-art.visible {
  display: block;
}

.track-overlay-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.track-overlay-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ui-color, #6B8AFF);
  letter-spacing: 0.02em;
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-overlay-artist {
  font-size: 11px;
  font-weight: 300;
  color: var(--ui-color, #6B8AFF);
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: color 0.15s;
}

.track-overlay-artist:hover { opacity: 0.7; }
