:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --surface: #fffaf2;
  --surface-strong: #ffffff;
  --ink: #1f2522;
  --muted: #687069;
  --line: #d8d0c2;
  --accent: #c73d2c;
  --accent-dark: #982f23;
  --teal: #1f7a75;
  --gold: #cf9634;
  --danger: #9d2d2d;
  --shadow: 0 18px 50px rgba(34, 29, 22, 0.13);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(31, 122, 117, 0.09), transparent 260px),
    var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

audio {
  width: 100%;
  min-height: 44px;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

header.app-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 18px;
}

main.app-shell {
  padding: 10px 0 48px;
  outline: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--gold);
  color: var(--ink);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

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

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-nav a,
.button,
.icon-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
  line-height: 1;
  padding: 0 14px;
  text-decoration: none;
  white-space: nowrap;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button.ghost {
  background: transparent;
}

.button.danger {
  border-color: rgba(157, 45, 45, 0.35);
  color: var(--danger);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  min-height: 280px;
  align-items: end;
  gap: 28px;
  overflow: hidden;
  border-radius: var(--radius);
  padding: clamp(24px, 5vw, 56px);
  background:
    linear-gradient(135deg, rgba(255, 250, 242, 0.96), rgba(244, 241, 234, 0.78)),
    repeating-linear-gradient(90deg, rgba(31, 122, 117, 0.16) 0 1px, transparent 1px 24px);
  box-shadow: var(--shadow);
}

.public-hero {
  background:
    linear-gradient(135deg, rgba(255, 250, 242, 0.94), rgba(31, 122, 117, 0.12)),
    repeating-linear-gradient(90deg, rgba(199, 61, 44, 0.16) 0 1px, transparent 1px 22px);
}

.hero h1,
.login-card h1,
.not-found h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.15rem, 7vw, 5.7rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero h1 {
  text-wrap: balance;
}

.lede {
  max-width: 700px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.hero-art {
  align-self: stretch;
  display: grid;
  min-height: 180px;
  align-items: center;
}

.waveform {
  display: grid;
  height: 180px;
  grid-template-columns: repeat(18, 1fr);
  align-items: center;
  gap: 8px;
}

.waveform span {
  display: block;
  height: var(--h);
  min-height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--teal));
}

.stack {
  display: grid;
  gap: 18px;
}

.compact {
  align-content: start;
}

.layout-grid,
.recording-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 20px;
}

.recording-layout {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.beat-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 242, 0.86);
  box-shadow: 0 8px 28px rgba(34, 29, 22, 0.08);
  padding: 20px;
}

.beat-card {
  display: grid;
  gap: 16px;
}

.beat-card-main {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(260px, 1.1fr);
  align-items: center;
  gap: 16px;
}

h2,
h3,
p {
  margin-top: 0;
}

h2,
h3 {
  margin-bottom: 6px;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

code {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  padding: 1px 5px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(31, 122, 117, 0.28);
  outline-offset: 2px;
}

.form-grid,
.section-heading,
.share-row,
.button-row,
.card-actions,
.submission-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-grid {
  align-items: start;
}

.section-heading {
  justify-content: space-between;
}

.share-row input {
  min-width: 0;
  flex: 1;
}

.file-drop {
  min-height: 130px;
  place-items: center;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  padding: 18px;
  text-align: center;
}

.file-drop input {
  max-width: 320px;
  border: 0;
  padding: 0;
}

.file-drop span {
  color: var(--ink);
  font-size: 1.02rem;
}

.file-drop small {
  color: var(--muted);
}

.form-status {
  min-height: 22px;
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.quality-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.form-status.success {
  color: var(--teal);
}

.form-status.error {
  color: var(--danger);
}

.beat-list,
.submission-list {
  display: grid;
  gap: 14px;
}

details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

summary {
  cursor: pointer;
  font-weight: 800;
}

.submission {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.submission-player {
  display: grid;
  gap: 8px;
}

.submission-player audio[data-role="beat-backing"] {
  display: none;
}

.toggle-line {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.toggle-line input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.mix-controls {
  display: grid;
  gap: 8px;
}

.mix-controls label {
  display: grid;
  grid-template-columns: 64px minmax(110px, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.mix-controls input[type="range"] {
  height: 28px;
  padding: 0;
  accent-color: var(--teal);
}

.login-page {
  display: grid;
  min-height: calc(100vh - 140px);
  place-items: center;
}

.login-card {
  width: min(100%, 520px);
}

.empty-state {
  text-align: center;
}

.public-page {
  display: grid;
  gap: 20px;
}

.pill {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  padding: 8px 11px;
  white-space: nowrap;
}

.recorder-display {
  display: grid;
  min-height: 150px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(31, 122, 117, 0.08), rgba(207, 150, 52, 0.08)),
    #fff;
}

.recorder-display strong {
  font-size: 2.8rem;
  letter-spacing: 0;
}

.record-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #b9b1a4;
}

.record-dot.active {
  background: var(--accent);
  box-shadow: 0 0 0 8px rgba(199, 61, 44, 0.15);
}

.not-found {
  max-width: 680px;
}

@media (max-width: 880px) {
  .hero,
  .layout-grid,
  .recording-layout,
  .beat-card-main,
  .submission {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 0;
  }

  .hero-art {
    min-height: 120px;
  }

  .waveform {
    height: 120px;
  }

  .section-heading,
  .share-row,
  .button-row,
  .submission-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button,
  .icon-button,
  .top-nav a {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
  }

  header.app-shell {
    align-items: stretch;
    flex-direction: column;
  }

  .hero,
  .panel,
  .beat-card,
  .empty-state {
    padding: 16px;
  }

  .hero h1,
  .login-card h1,
  .not-found h1 {
    font-size: 2.2rem;
    line-height: 1;
  }

  .form-grid {
    flex-direction: column;
  }
}
