:root {
  --paper: #0b2622;
  --panel: #10332d;
  --ink: #e6f5f0;
  --muted: #b0c6bf;
  --accent: #f4b324;
  --accent-2: #30bfb3;
  --danger: #f56565;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, rgba(48, 191, 179, 0.18), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(244, 179, 36, 0.14), transparent 35%),
    var(--paper);
}

.bg-shapes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 40% 60%, rgba(244, 179, 36, 0.1), transparent 35%),
    radial-gradient(circle at 70% 40%, rgba(48, 191, 179, 0.12), transparent 30%);
  filter: blur(30px);
  opacity: 0.8;
  z-index: -1;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 2.4vw, 2.6rem);
  letter-spacing: -0.03em;
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px 48px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 18px;
}

.branding .logo {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kicker {
  color: var(--muted);
}

.cta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.lang-picker {
  display: grid;
  gap: 4px;
}

.lang-picker select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.lang-picker label {
  font-size: 0.85rem;
}

.pill {
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ink);
  background: transparent;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.pill.primary {
  background: linear-gradient(120deg, #0f766e, #30bfb3);
  border: none;
  box-shadow: var(--shadow);
}

.pill.ghost {
  background: rgba(255, 255, 255, 0.04);
}

.pill:hover {
  transform: translateY(-1px);
}

.pill.icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 10px;
  font-size: 1.05rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 22px;
  align-items: center;
  background: rgba(16, 51, 45, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.lede {
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.5;
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.transport {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.record-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tempo {
  display: grid;
  gap: 4px;
  color: var(--muted);
}

.tempo input[type="range"] {
  accent-color: var(--accent-2);
}

.panel {
  background: rgba(11, 38, 34, 0.9);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 10px;
}

.panel-title {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--muted);
}

.pack-picker select {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 1rem;
}

.pack-picker .muted {
  margin-top: 8px;
}

.custom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.custom-row select {
  flex: 1;
  min-width: 220px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.pill.small {
  padding: 8px 12px;
  font-size: 0.95rem;
}

.grid {
  margin-top: 28px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(16, 51, 45, 0.8);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  display: grid;
  gap: 10px;
  overflow: hidden;
  word-break: break-word;
  transition: box-shadow 200ms ease, border-color 200ms ease, transform 200ms ease;
}

.card.collapsed {
  grid-template-columns: 1fr;
  background: linear-gradient(135deg, rgba(16, 51, 45, 0.85), rgba(32, 104, 95, 0.9));
  border-color: rgba(48, 191, 179, 0.5);
}

.card.collapsed .avatar,
.card.collapsed .tags,
.card.collapsed .mini:not(.name-edit-inline),
.card.collapsed .upload,
.card.collapsed .loop-editor,
.card.collapsed .library-picker,
.card.collapsed .wave-container,
.card.collapsed .wave-meta {
  display: none;
}

.card.collapsed .name {
  display: none;
}

.card.collapsed .name-edit-inline {
  display: block;
}

.card.playing {
  border-color: rgba(244, 179, 36, 0.5);
  box-shadow: 0 0 0 2px rgba(244, 179, 36, 0.3), 0 15px 30px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}

.card.collapsed .card-header {
  padding: 0;
}

.card.collapsed .actions {
  margin-top: -6px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.card-header > div:last-child {
  flex: 1;
  min-width: 0;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(244, 179, 36, 0.4), rgba(48, 191, 179, 0.4));
}

.name {
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.name-edit-inline input {
  border: none;
  background: transparent;
  padding: 0;
  color: inherit;
}

.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.toggle {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink);
  transition: background 120ms ease, transform 120ms ease;
}

.toggle:hover {
  transform: translateY(-1px);
}

.toggle.active {
  background: linear-gradient(120deg, #f4b324, #30bfb3);
  color: #0b2622;
  font-weight: 700;
  border: none;
}

.mini {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.mini.loop-editor {
  flex-direction: column;
  align-items: stretch;
}

.library-picker select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.mini.recorder {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.rec-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini.name-edit {
  flex-direction: column;
  align-items: stretch;
}

.name-edit-inline input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-weight: 700;
}

.name-edit-inline input:focus {
  outline: 1px solid var(--accent-2);
}

.loop-field {
  display: grid;
  gap: 4px;
}

.loop-field input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.loop-field input:focus {
  outline: 1px solid var(--accent-2);
}

.wave-container {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.wave-container canvas {
  width: 100%;
  height: 110px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.wave-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.upload {
  display: grid;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  word-break: break-word;
}

.upload input[type="file"] {
  color: var(--ink);
  max-width: 100%;
}

.upload .upload-status {
  word-break: break-word;
}

.gain {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  flex: 1;
}

.gain input[type="range"] {
  accent-color: var(--accent);
  width: 100%;
}

.footer {
  margin-top: 28px;
  padding: 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
}

.about {
  margin-top: 28px;
  padding: 0 0 12px;
  display: grid;
  gap: 6px;
}

.mini-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
}

@media (max-width: 820px) {
  header,
  .hero,
  .footer {
    flex-direction: column;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .cta {
    width: 100%;
    justify-content: flex-start;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}
