:root {
  --ink: #17202a;
  --muted: #5d6978;
  --line: #d8dee8;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --deep: #14213d;
  --accent: #b71c1c;
  --accent-2: #0f766e;
  --gold: #e9b44c;
  --shadow: 0 18px 40px rgba(20, 33, 61, 0.12);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(20, 33, 61, 0.08), transparent 280px),
    var(--paper);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 14px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 14px;
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--deep);
  color: #fff;
  font-weight: 800;
}

.brand-title,
.brand-subtitle {
  display: block;
}

.brand-title {
  overflow: hidden;
  color: var(--deep);
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-link {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--deep);
  font-weight: 700;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  min-height: 210px;
  border-radius: 8px;
  padding: 26px;
  background:
    linear-gradient(120deg, rgba(20, 33, 61, 0.92), rgba(20, 33, 61, 0.66)),
    url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1400&q=80");
  background-position: center;
  background-size: cover;
  color: #fff;
  box-shadow: var(--shadow);
}

.hero h1 {
  max-width: 720px;
  margin: 8px 0 0;
  font-size: clamp(2rem, 7vw, 4.8rem);
  line-height: 0.98;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: var(--gold);
}

.hero-stat {
  display: grid;
  min-width: 84px;
  min-height: 84px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.hero-stat span {
  font-size: 2rem;
  font-weight: 850;
  line-height: 1;
}

.hero-stat small {
  color: rgba(255, 255, 255, 0.78);
}

.view {
  display: none;
  padding: 22px 0;
}

.view.is-active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2,
.content-section h3,
.export-panel h2 {
  margin: 0;
  color: var(--deep);
}

.search-box,
label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

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

input:focus,
textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

textarea {
  resize: vertical;
}

.status {
  min-height: 22px;
  color: var(--muted);
  font-size: 0.92rem;
}

.song-list {
  display: grid;
  gap: 12px;
}

.song-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 22px rgba(20, 33, 61, 0.06);
}

.song-card:hover,
.song-card:focus-visible {
  border-color: rgba(183, 28, 28, 0.5);
  transform: translateY(-1px);
}

.song-artwork {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(183, 28, 28, 0.9), rgba(15, 118, 110, 0.75)),
    var(--deep);
  background-position: center;
  background-size: cover;
  color: #fff;
  font-weight: 850;
}

.song-card-content {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.song-card-content strong,
.song-card-content span,
.song-card-content small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-card-content strong {
  color: var(--deep);
  font-size: 1.02rem;
}

.song-card-content span {
  color: var(--ink);
}

.song-card-content small {
  color: var(--muted);
}

.song-arrow {
  color: var(--accent);
  font-size: 2rem;
  line-height: 1;
}

.icon-text-button,
.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
}

.icon-text-button {
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--deep);
}

.icon-text-button span:first-child {
  font-size: 1.7rem;
  line-height: 0;
}

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

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--deep);
}

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

.ghost-button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.song-detail {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
  margin-top: 16px;
}

.detail-cover {
  display: grid;
  min-height: 330px;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(20, 33, 61, 0.88), rgba(183, 28, 28, 0.78)),
    var(--deep);
  background-position: center;
  background-size: cover;
  color: #fff;
  font-size: 4rem;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.detail-main {
  display: grid;
  align-content: center;
  gap: 14px;
  min-width: 0;
}

.detail-main h2 {
  margin: 0;
  color: var(--deep);
  font-size: clamp(2rem, 6vw, 4.2rem);
  line-height: 0.98;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.audio-stack {
  display: grid;
  gap: 10px;
}

.audio-panel {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) minmax(120px, 190px);
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.narration-panel {
  grid-template-columns: 48px minmax(0, 1fr) minmax(120px, 190px) auto;
}

.round-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.narration-panel .round-button {
  background: var(--accent-2);
}

.audio-panel strong,
.audio-panel span {
  display: block;
}

.audio-panel span {
  color: var(--muted);
  font-size: 0.86rem;
}

.volume-control {
  min-width: 0;
}

.action-row,
.editor-actions,
.export-actions,
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0;
}

.info-item {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.info-item span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.info-item strong {
  color: var(--deep);
  line-height: 1.25;
}

.content-section {
  border-top: 1px solid var(--line);
  padding: 20px 0;
}

.content-section p {
  max-width: 860px;
  margin: 10px 0 0;
  color: #2c3745;
  font-size: 1.02rem;
  line-height: 1.7;
}

.admin-shell {
  width: min(1280px, 100%);
}

.setup-panel,
.login-panel,
.export-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.setup-panel h1,
.login-panel h1 {
  margin: 0 0 10px;
  color: var(--deep);
}

.admin-workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-sidebar,
.editor-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-sidebar {
  position: sticky;
  top: 78px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 94px);
  padding: 12px;
  overflow: auto;
}

.admin-actions button {
  flex: 1 1 120px;
}

.admin-song-list {
  display: grid;
  gap: 8px;
}

.admin-song-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  text-align: left;
}

.admin-song-item.is-selected {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.admin-song-item strong,
.admin-song-item span,
.admin-song-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-song-item span,
.admin-song-item small {
  color: var(--muted);
}

.editor-panel {
  padding: 16px;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.editor-header h1 {
  margin: 4px 0 0;
  color: var(--deep);
  font-size: clamp(1.5rem, 4vw, 2.4rem);
}

.song-form {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.toggle-label {
  display: flex;
  align-items: center;
  min-height: 45px;
  gap: 10px;
  color: var(--deep);
}

.toggle-label input {
  width: 20px;
  height: 20px;
}

.export-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 10px;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 250px;
    padding: 20px;
  }

  .hero-stat {
    width: 84px;
  }

  .section-heading,
  .song-detail,
  .admin-workspace,
  .editor-header,
  .export-panel {
    grid-template-columns: 1fr;
    display: grid;
  }

  .song-detail {
    gap: 16px;
  }

  .detail-cover {
    min-height: 240px;
  }

  .audio-panel {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .volume-control {
    grid-column: 1 / -1;
  }

  .narration-panel .secondary-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .info-grid,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 520px) {
  .brand-subtitle {
    display: none;
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .song-card {
    grid-template-columns: 52px minmax(0, 1fr) 18px;
  }

  .song-artwork {
    width: 52px;
    height: 52px;
  }

  .editor-actions,
  .export-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .editor-actions button,
  .export-actions button {
    width: 100%;
  }
}
