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

:root {
  --ink: #0e0c0a;
  --paper: #f5f0e8;
  --cream: #ede7d9;
  --gold: #c9973a;
  --gold-light: #e8c06a;
  --rust: #8b3a1e;
  --sage: #3d5a4c;
  --charcoal: #2a2520;
  --muted: #7a7060;
  --card-bg: #faf7f2;
  --shadow: rgba(14,12,10,0.18);
  --danger: #8b1e1e;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'DM Mono', monospace;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
  opacity: 0.5;
}

/* ── HEADER ── */
header {
  position: relative;
  padding: 3rem 2rem 2rem;
  border-bottom: 1px solid rgba(201,151,58,0.3);
  overflow: hidden;
  background: var(--charcoal);
}
header::before {
  content: '';
  position: absolute;
  top: -60px; left: -60px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,151,58,0.15) 0%, transparent 70%);
}
header::after {
  content: '';
  position: absolute;
  bottom: -80px; right: -40px;
  width: 250px; height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,58,30,0.12) 0%, transparent 70%);
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.brand { display: flex; flex-direction: column; gap: 0.25rem; }
.brand-eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  color: var(--gold);
  text-transform: uppercase;
  font-weight: 300;
}
.brand-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 900;
  color: var(--paper);
  line-height: 1;
  letter-spacing: -0.02em;
}
.brand-title em { color: var(--gold); font-style: italic; }
.brand-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1rem;
  color: rgba(245,240,232,0.5);
  margin-top: 0.25rem;
}
.login-btn {
  background: rgba(201,151,58,0.15);
  color: var(--gold);
  border: 1px solid rgba(201,151,58,0.3);
  padding: 0.65rem 1.25rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  white-space: nowrap;
}
.login-btn:hover { background: var(--gold); color: var(--charcoal); }
.login-btn svg { width: 13px; height: 13px; }

/* ── STATS BAR ── */
.stats-bar {
  background: var(--ink);
  padding: 0.6rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  overflow-x: auto;
}
.stat { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.stat-num { font-family: 'Playfair Display', serif; font-size: 1.1rem; color: var(--gold); font-weight: 700; }
.stat-label { font-size: 0.6rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); }
.stat-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }

/* ── MAIN ── */
main { max-width: 960px; margin: 0 auto; padding: 3rem 1.5rem; }

.section-label {
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, rgba(122,112,96,0.3), transparent);
}

/* ── SONGS GRID ── */
.songs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* ── SONG CARD ── */
.song-card {
  background: var(--card-bg);
  border: 1px solid rgba(14,12,10,0.08);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s, box-shadow 0.25s;
  animation: cardIn 0.5s ease both;
}
.song-card:hover { transform: translateY(-3px); box-shadow: 0 12px 40px var(--shadow); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-accent { height: 4px; background: linear-gradient(to right, var(--gold), var(--rust)); }
.card-body { padding: 1.25rem 1.25rem 0.75rem; flex: 1; }
.card-num { font-family: 'Playfair Display', serif; font-size: 0.7rem; color: var(--gold); letter-spacing: 0.1em; margin-bottom: 0.5rem; }
.card-title { font-family: 'Playfair Display', serif; font-size: 1.3rem; font-weight: 700; color: var(--charcoal); line-height: 1.2; margin-bottom: 0.75rem; }

.lyrics-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.lyrics-toggle {
  background: none; border: none;
  font-family: 'DM Mono', monospace; font-size: 0.6rem;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--sage); cursor: pointer; padding: 0;
  display: flex; align-items: center; gap: 0.4rem;
  transition: color 0.2s;
}
.lyrics-toggle:hover { color: var(--gold); }
.lyrics-toggle .chevron { transition: transform 0.3s; display: inline-block; }
.copy-lyrics-btn {
  background: none;
  border: 1px solid rgba(14,12,10,0.12);
  font-family: 'DM Mono', monospace; font-size: 0.55rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); cursor: pointer;
  padding: 0.3rem 0.6rem;
  display: flex; align-items: center; gap: 0.35rem;
  transition: all 0.2s; border-radius: 2px;
}
.copy-lyrics-btn:hover { color: var(--charcoal); border-color: var(--gold); background: rgba(201,151,58,0.06); }
.copy-lyrics-btn.copied { color: var(--sage); border-color: var(--sage); }
.lyrics-box { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; }
.lyrics-box.open { max-height: 300px; }
.lyrics-content {
  font-family: 'Cormorant Garamond', serif; font-size: 0.95rem;
  line-height: 1.75; color: var(--charcoal); font-style: italic;
  padding: 0.75rem; background: var(--cream);
  border-left: 2px solid var(--gold); margin-bottom: 0.75rem;
  overflow-y: auto; max-height: 200px;
}
.no-lyrics { font-size: 0.65rem; color: var(--muted); margin-bottom: 0.5rem; letter-spacing: 0.1em; }

/* ── PLAYER ── */
.card-player {
  padding: 0.75rem 1.25rem 1.25rem;
  border-top: 1px solid rgba(14,12,10,0.06);
  display: flex; flex-direction: column; gap: 0.6rem;
}
.player-controls { display: flex; align-items: center; gap: 0.75rem; }
.play-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--charcoal); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.2s; color: var(--gold);
}
.play-btn:hover { background: var(--gold); color: var(--charcoal); transform: scale(1.05); }
.play-btn.playing { background: var(--gold); color: var(--charcoal); }
.waveform {
  flex: 1; height: 28px; position: relative;
  cursor: pointer; display: flex; align-items: center; gap: 2px;
}
.waveform-bar { flex: 1; border-radius: 1px; background: rgba(14,12,10,0.12); transition: background 0.3s; }
.waveform-bar.played { background: var(--gold); }
.waveform-bar.active { background: var(--gold-light); animation: pulse 0.5s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.7; } to { opacity: 1; transform: scaleY(1.15); } }
.time-display { font-size: 0.6rem; color: var(--muted); white-space: nowrap; min-width: 60px; text-align: right; }
.no-audio { font-size: 0.65rem; color: var(--muted); letter-spacing: 0.1em; flex: 1; }
.download-link {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; transition: color 0.2s; padding: 0.25rem 0;
}
.download-link:hover { color: var(--rust); }
.download-link svg { width: 11px; height: 11px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 5rem 2rem; }
.big-note { font-family: 'Playfair Display', serif; font-size: 5rem; opacity: 0.15; margin-bottom: 1rem; }
.empty-state h3 { font-family: 'Playfair Display', serif; font-size: 1.5rem; color: var(--charcoal); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.8rem; color: var(--muted); line-height: 1.6; }

.deco-note { position: absolute; font-size: 8rem; opacity: 0.03; font-family: serif; pointer-events: none; user-select: none; }

/* ── ADMIN STYLES ── */
.admin-body { background: #1a1714; }
.admin-body::before { opacity: 0.2; }

.admin-header {
  background: var(--charcoal);
  border-bottom: 3px solid var(--gold);
  padding: 1rem 2rem;
}
.admin-header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.admin-brand { display: flex; align-items: center; gap: 1rem; }
.admin-brand a { text-decoration: none; }
.admin-brand-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem; font-weight: 700; color: var(--paper);
}
.admin-brand-title span { color: var(--gold); font-style: italic; }
.admin-badge {
  background: var(--gold); color: var(--charcoal);
  font-size: 0.5rem; letter-spacing: 0.2em; text-transform: uppercase;
  padding: 0.2rem 0.5rem; font-weight: 700;
}
.admin-nav { display: flex; align-items: center; gap: 1rem; }
.admin-nav a, .admin-nav button {
  font-family: 'DM Mono', monospace; font-size: 0.65rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  background: none; border: none; cursor: pointer;
  transition: color 0.2s; padding: 0;
  display: flex; align-items: center; gap: 0.4rem;
}
.admin-nav a:hover, .admin-nav button:hover { color: var(--gold); }
.admin-nav svg { width: 12px; height: 12px; }

.admin-main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

/* Flash messages */
.flash {
  padding: 0.75rem 1.25rem; margin-bottom: 1.5rem;
  font-size: 0.7rem; letter-spacing: 0.08em;
  border-left: 3px solid;
}
.flash-success { background: rgba(61,90,76,0.15); border-color: var(--sage); color: #6aad8a; }
.flash-error   { background: rgba(139,30,30,0.15); border-color: var(--danger); color: #e07070; }

/* Admin table */
.admin-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;
}
.admin-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem; color: var(--paper);
}
.btn {
  font-family: 'DM Mono', monospace; font-size: 0.65rem;
  letter-spacing: 0.15em; text-transform: uppercase;
  padding: 0.65rem 1.25rem; border: none; cursor: pointer;
  transition: all 0.2s; text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn svg { width: 12px; height: 12px; }
.btn-primary { background: var(--gold); color: var(--charcoal); }
.btn-primary:hover { background: var(--gold-light); }
.btn-danger { background: rgba(139,30,30,0.2); color: #e07070; border: 1px solid rgba(139,30,30,0.3); }
.btn-danger:hover { background: var(--danger); color: var(--paper); }
.btn-secondary { background: rgba(245,240,232,0.08); color: var(--muted); border: 1px solid rgba(245,240,232,0.1); }
.btn-secondary:hover { color: var(--paper); border-color: rgba(245,240,232,0.3); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.58rem; }

.songs-table {
  width: 100%; border-collapse: collapse;
  background: rgba(42,37,32,0.6);
}
.songs-table th {
  background: rgba(14,12,10,0.4);
  font-size: 0.58rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); padding: 0.75rem 1rem; text-align: left;
  border-bottom: 1px solid rgba(201,151,58,0.2);
}
.songs-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(245,240,232,0.05);
  font-size: 0.75rem; color: rgba(245,240,232,0.7);
  vertical-align: middle;
}
.songs-table tr:hover td { background: rgba(201,151,58,0.04); }
.song-title-cell {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem; color: var(--paper); font-weight: 700;
}
.has-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.55rem; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.2rem 0.5rem;
}
.badge-yes { background: rgba(61,90,76,0.3); color: #6aad8a; }
.badge-no  { background: rgba(122,112,96,0.15); color: var(--muted); }
.action-cell { display: flex; gap: 0.5rem; align-items: center; }

/* ── ADMIN FORM ── */
.form-card {
  background: rgba(42,37,32,0.6);
  border: 1px solid rgba(245,240,232,0.08);
  padding: 2rem;
  max-width: 640px;
}
.form-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem; color: var(--paper);
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(201,151,58,0.2);
}
.form-title span { color: var(--gold); font-style: italic; }
.field-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.25rem; }
.field-label { font-size: 0.6rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.field-input, .field-textarea, .field-select {
  background: rgba(14,12,10,0.4);
  border: 1px solid rgba(245,240,232,0.1);
  padding: 0.75rem 1rem;
  font-family: 'Cormorant Garamond', serif; font-size: 1rem;
  color: var(--paper); outline: none;
  transition: border-color 0.2s; width: 100%; resize: none;
}
.field-input:focus, .field-textarea:focus { border-color: var(--gold); }
.field-textarea { min-height: 160px; line-height: 1.6; font-style: italic; }
.field-hint { font-size: 0.6rem; color: var(--muted); margin-top: 0.25rem; }
.current-file { font-size: 0.65rem; color: var(--sage); margin-top: 0.25rem; }
.form-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-top: 0.5rem; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh; background: #1a1714;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.login-card {
  background: rgba(42,37,32,0.9);
  border: 1px solid rgba(201,151,58,0.2);
  border-top: 3px solid var(--gold);
  padding: 2.5rem;
  width: 100%; max-width: 380px;
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .big-note { font-size: 3rem; opacity: 0.4; margin-bottom: 0.5rem; }
.login-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem; font-weight: 700; color: var(--paper);
  text-align: center; margin-bottom: 0.25rem;
}
.login-title span { color: var(--gold); font-style: italic; }
.login-sub { text-align: center; font-size: 0.65rem; color: var(--muted); letter-spacing: 0.1em; margin-bottom: 2rem; }

@media (max-width: 600px) {
  .songs-grid { grid-template-columns: 1fr; }
  .brand-title { font-size: 2rem; }
  .songs-table thead { display: none; }
  .songs-table td { display: block; border: none; padding: 0.4rem 1rem; }
  .songs-table tr { border-bottom: 1px solid rgba(245,240,232,0.08); display: block; padding: 0.5rem 0; }
}
