:root {
  --ct-bg: #0c0818;
  --ct-purple: #8060c0;
  --ct-glow: #c0a0ff;
  --ct-teal: #60c0a0;
}

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

body {
  font-family: 'VT323', monospace;
  background: var(--ct-bg);
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(128, 96, 192, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(96, 192, 160, 0.12) 0%, transparent 40%);
  min-height: 100vh;
  color: #d8d0e8;
  font-size: 18px;
}

.ct-header h1 {
  font-size: clamp(28px, 6vw, 40px);
  color: var(--ct-glow);
  margin: 4px 0;
  text-shadow: 0 0 18px rgba(192, 160, 255, 0.55), 0 0 40px rgba(128, 96, 192, 0.35);
}

.ct-bed-scene {
  background: linear-gradient(180deg, #221640 0%, #120820 100%);
  border: 2px solid rgba(192, 160, 255, 0.35);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 16px;
  box-shadow: 0 0 28px rgba(128, 96, 192, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#ct-app {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.ct-brand {
  font-size: 14px;
  letter-spacing: 0.15em;
  color: var(--ct-purple);
}

.ct-tagline {
  font-size: 18px;
  opacity: 0.75;
  margin-bottom: 16px;
}

#ct-character {
  width: 100%;
  height: auto;
  display: block;
}

.ct-sleep-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.ct-sleep-label {
  font-size: 16px;
  color: var(--ct-teal);
  white-space: nowrap;
}

.ct-sleep-bar {
  flex: 1;
  height: 14px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(96, 192, 160, 0.3);
}

.ct-sleep-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #408878, #80e0c0);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.ct-sleep-pct {
  font-size: 20px;
  color: var(--ct-teal);
  min-width: 3em;
}

.ct-section-label {
  font-size: 16px;
  opacity: 0.7;
  margin-bottom: 8px;
}

.ct-palette {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.ct-cat-label {
  font-size: 15px;
  color: var(--ct-teal);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
}

.ct-palette-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ct-cassette {
  padding: 10px 14px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: grab;
  font-size: 16px;
  user-select: none;
  touch-action: none;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
}

.ct-cassette:active { cursor: grabbing; }

.ct-cassette--rain { background: #284868; border-color: #6090c0; }
.ct-cassette--bass { background: #283848; border-color: #5080a0; }
.ct-cassette--vinyl { background: #383028; border-color: #907860; }
.ct-cassette--synth { background: #402860; border-color: #a060c0; }
.ct-cassette--kick { background: #303030; border-color: #707070; }
.ct-cassette--hihat { background: #404038; border-color: #909080; }
.ct-cassette--snare { background: #383830; border-color: #a0a090; }
.ct-cassette--eight { background: #281828; border-color: #8040a0; }
.ct-cassette--tamb { background: #403828; border-color: #c0a060; }
.ct-cassette--heart { background: #381820; border-color: #c04060; }
.ct-cassette--sub { background: #202830; border-color: #506080; }
.ct-cassette--piano { background: #302838; border-color: #9070a0; }
.ct-cassette--pad { background: #283848; border-color: #60a0c0; }
.ct-cassette--musicbox { background: #383028; border-color: #d0b080; }
.ct-cassette--guitar { background: #342820; border-color: #a07050; }
.ct-cassette--lullaby { background: #382850; border-color: #b080e0; }
.ct-cassette--hum { background: #403050; border-color: #c0a0d0; }
.ct-cassette--static { background: #282828; border-color: #909090; }

.ct-tracks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.ct-track {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px dashed rgba(192, 160, 255, 0.25);
  border-radius: 8px;
  min-height: 52px;
}

.ct-track-num {
  font-size: 20px;
  color: var(--ct-purple);
  width: 24px;
}

.ct-track-slot {
  flex: 1;
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
}

.ct-track-slot.ct-over {
  background: rgba(96, 192, 160, 0.15);
  border: 1px dashed var(--ct-teal);
}

.ct-track-slot .ct-cassette {
  cursor: pointer;
}

.ct-viz {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  background: #080410;
  border: 1px solid rgba(192, 160, 255, 0.2);
}

.ct-msg {
  text-align: center;
  font-size: 17px;
  margin-top: 12px;
  opacity: 0.85;
}

.ct-unlock {
  position: fixed;
  inset: 0;
  background: rgba(8, 4, 16, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
}

.ct-unlock[hidden] { display: none !important; }

.ct-unlock h2 { color: var(--ct-glow); font-size: 28px; }

.ct-unlock button {
  font-family: inherit;
  font-size: 20px;
  padding: 10px 24px;
  background: var(--ct-purple);
  border: none;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
}

.ct-exit {
  position: fixed;
  top: 12px;
  right: 12px;
  font-size: 18px;
  color: rgba(200, 192, 216, 0.6);
  text-decoration: none;
}

.ct-exit:hover { color: var(--ct-glow); }

@media (max-width: 480px) {
  .ct-palette { justify-content: center; }
}
