:root {
  --bg: #030711;
  --bg-2: #08101f;
  --bg-3: #0d1830;
  --panel: rgba(7, 15, 29, 0.84);
  --panel-strong: rgba(8, 18, 35, 0.94);
  --line: rgba(124, 242, 255, 0.14);
  --line-strong: rgba(124, 242, 255, 0.28);
  --lime-line: rgba(38, 255, 107, 0.26);
  --cyan: #7cf2ff;
  --lime: #26ff6b;
  --text: #edf6ff;
  --muted: #98acc5;
  --orange: #ffb347;
  --red: #ff6b6b;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(38,255,107,0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(124,242,255,0.08), transparent 32%),
    linear-gradient(180deg, var(--bg), var(--bg-2) 35%, var(--bg-3));
}

body {
  padding: 12px;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

button, input { font: inherit; }
button, input[type="file"], input[type="range"] { touch-action: manipulation; }
button { cursor: pointer; min-height: 46px; }
code { color: var(--cyan); }

.space-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.space-glow {
  position: absolute;
  width: 45vw;
  height: 45vw;
  filter: blur(60px);
  opacity: 0.22;
}

.space-glow-a {
  top: -12vw;
  left: -12vw;
  background: radial-gradient(circle, rgba(38,255,107,0.35), transparent 62%);
}

.space-glow-b {
  right: -10vw;
  top: 10vh;
  background: radial-gradient(circle, rgba(124,242,255,0.28), transparent 62%);
}

.space-grid {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(124,242,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,242,255,0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.5), transparent 80%);
}

.starfield, .starfall { position: absolute; inset: 0; }
.starfield .star {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 0 8px rgba(124,242,255,0.7);
  opacity: 0.5;
}

.starfall .meteor {
  position: absolute;
  width: 110px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(124,242,255,0.9), rgba(38,255,107,0));
  border-radius: 999px;
  transform: rotate(-25deg);
  opacity: 0;
  animation: meteorFall linear infinite;
}

@keyframes meteorFall {
  0% { transform: translate3d(40vw, -20vh, 0) rotate(-25deg); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translate3d(-40vw, 120vh, 0) rotate(-25deg); opacity: 0; }
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1720px;
  margin: 0 auto;
}

.panel, .hero-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
}

.hero-panel h1 { margin: 0 0 8px; font-size: clamp(2rem, 5vw, 3rem); }
.hero-copy { margin: 0; line-height: 1.6; color: var(--muted); max-width: 72ch; }
.hero-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(38,255,107,0.08), rgba(124,242,255,0.06));
  border: 1px solid rgba(38,255,107,0.18);
}
.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 16px rgba(38,255,107,0.45);
}
.hero-status small, .muted, .section-hint, .empty-state { color: var(--muted); }

.layout-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.sidebar-left, .deck-panel, .loop-card { min-width: 0; }
.panel, .loop-card { padding: 14px; }

.panel-head, .loop-head, .project-actions, .transport-grid, .track-grid, .slider-grid, .track-stats, .preset-strip, .project-actions {
  display: grid;
  gap: 10px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.panel-head.compact { margin-bottom: 8px; }
.panel-head h2, .panel-head h3, .loop-head h2 { margin: 0; }

.field-block {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.field-block span { font-weight: 700; }
.field-block input {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(124,242,255,0.18);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 10px 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(38,255,107,0.28);
  background: rgba(38,255,107,0.08);
  color: var(--lime);
  font-size: 0.82rem;
  font-weight: 800;
}

.ghost-btn, .small-btn, .action-btn, .preset-btn, .add-loop-card {
  border: 1px solid rgba(124,242,255,0.18);
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.ghost-btn:hover, .small-btn:hover, .action-btn:hover, .preset-btn:hover, .add-loop-card:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.08);
  border-color: var(--line-strong);
  box-shadow: 0 0 20px rgba(124,242,255,0.08);
}
.ghost-btn, .small-btn, .action-btn, .preset-btn { padding: 12px; font-weight: 700; }
.action-btn { text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800; }
.action-btn.play, .plus-btn { border-color: rgba(38,255,107,0.32); }
.action-btn.record { border-color: rgba(255,107,107,0.28); }
.small-btn.danger, .ghost-btn.danger { border-color: rgba(255,107,107,0.26); }
.preset-btn.active, .ghost-btn.active {
  background: linear-gradient(135deg, rgba(38,255,107,0.14), rgba(124,242,255,0.12));
  border-color: rgba(38,255,107,0.42);
}
.subtle-btn { min-height: 38px; padding: 8px 10px; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; }

.panel-block {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.04);
  margin-top: 12px;
}
.note-box ul { margin: 10px 0 0 18px; padding: 0; color: var(--muted); }
.note-box li + li { margin-top: 6px; }

.preset-strip {
  display: flex;
  flex-wrap: wrap;
}
.preset-strip .preset-btn { min-height: 42px; padding: 10px 12px; }

.slider-row {
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.04);
  background: rgba(255,255,255,0.04);
}
.enhancer-row {
  border-color: rgba(38,255,107,0.1);
  background: linear-gradient(180deg, rgba(38,255,107,0.06), rgba(124,242,255,0.03));
}
.slider-row span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 700;
}
.slider-row input { width: 100%; accent-color: var(--lime); }

.deck-panel { display: grid; gap: 14px; }
.track-grid {
  grid-template-columns: 1fr;
}
.loop-card {
  display: grid;
  gap: 12px;
}
.loop-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.loop-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.loop-title { font-size: 1.3rem; }
.screen-label {
  margin: 0 0 6px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-weight: 700;
}
.source-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(38,255,107,0.28);
  background: rgba(38,255,107,0.08);
  color: var(--lime);
  font-size: 0.82rem;
  font-weight: 800;
}
.track-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.track-stats article, .wave-canvas {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.04);
}
.track-stats span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.wave-canvas {
  width: 100%;
  height: 120px;
  display: block;
  padding: 0;
  overflow: hidden;
}
.transport-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.track-actions-grid.secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.add-loop-card {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 6px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(38,255,107,0.08), rgba(124,242,255,0.08));
  border-style: dashed;
}
.add-loop-card__plus {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(38,255,107,0.28);
  font-size: 2rem;
  line-height: 1;
  color: var(--lime);
}
.add-loop-card span:last-child { color: var(--muted); }






.hero-panel--with-cover {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 420px);
  gap: 24px;
  align-items: center;
}

.hero-main {
  display: grid;
  gap: 18px;
}

.hero-cover {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-cover img {
  width: 100%;
  max-width: 420px;
  display: block;
  border-radius: 22px;
  border: 1px solid rgba(124, 242, 255, 0.22);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.42),
    0 0 30px rgba(124, 242, 255, 0.12);
}

.hero-cover::after {
  content: "";
  position: absolute;
  inset: auto 10% -10px 10%;
  height: 24px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(38,255,107,0.22), transparent 70%);
  filter: blur(14px);
  z-index: 0;
}

.hero-cover img {
  position: relative;
  z-index: 1;
}


@media (min-width: 860px) {
  .hero-panel {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    padding: 22px;
  }
  .hero-status {
    min-width: 270px;
  }
  .layout-grid {
    grid-template-columns: 330px minmax(0, 1fr);
    align-items: start;
  }
  .sidebar-left {
    position: sticky;
    top: 14px;
  }
  .track-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1360px) {
  .track-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  body { padding: 10px; }
  .hero-panel, .panel, .loop-card { padding: 12px; }
  .track-stats, .transport-grid, .track-actions-grid.secondary { grid-template-columns: 1fr; }
  .wave-canvas { height: 92px; }
  .loop-head-actions { width: 100%; }
  .loop-head-actions .source-badge, .loop-head-actions .small-btn { flex: 1 1 100%; }
}





@media (max-width: 980px) {
  .hero-panel--with-cover {
    grid-template-columns: 1fr;
  }

  .hero-cover {
    order: -1;
  }

  .hero-cover img {
    max-width: 100%;
    width: min(100%, 440px);
  }
}