:root {
  --bg: #121014;
  --bg-raised: #1c1920;
  --bg-hover: #262230;
  --border: #322d3d;
  --text: #f0edf5;
  --muted: #9b93ab;
  --accent: #e8722c;
  --accent-hover: #f5854a;
  --error: #ff6b6b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--error); }

button { font: inherit; cursor: pointer; }
input, select {
  font: inherit;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
input:focus { outline: 1px solid var(--accent); }

.btn {
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 14px;
  text-decoration: none;
  display: inline-block;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--error); border-color: var(--error); background: transparent; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}
.login-card h1 { margin: 0; font-size: 26px; }
.login-card p { margin: 0; }

.logo-disc {
  width: 72px;
  height: 72px;
  margin: 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--accent) 0 14%, #0a090b 15% 30%, #191721 31% 34%, #0a090b 35% 54%, #191721 55% 58%, #0a090b 59% 78%, #191721 79% 82%, #0a090b 83% 100%);
  box-shadow: 0 0 30px rgba(232, 114, 44, 0.25);
}
.logo-disc.small { width: 26px; height: 26px; display: inline-block; vertical-align: -6px; box-shadow: none; }

/* ---------- layout ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; white-space: nowrap; }
.topbar input[type="search"] { flex: 1; max-width: 420px; }
.topbar nav { margin-left: auto; display: flex; gap: 10px; align-items: center; }

main { padding: 24px; padding-bottom: 120px; max-width: 1200px; margin: 0 auto; }

h2 { font-size: 22px; margin: 8px 0 18px; }

/* ---------- library grid ---------- */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}
.album-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
}
.album-card:hover { transform: translateY(-3px); background: var(--bg-hover); }
.album-cover {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--bg);
}
.album-cover.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: var(--muted);
  background: radial-gradient(circle at center, #26222e 0 20%, #14121a 60%);
}
.album-card-info { padding: 10px 12px 12px; }
.album-card-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-card-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty-state .logo-disc { margin-bottom: 20px; }

/* ---------- album detail ---------- */
.album-header { display: flex; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.album-header .album-cover, .album-header .album-cover.placeholder {
  width: 220px; height: 220px; border-radius: var(--radius); flex-shrink: 0;
}
.album-header-info { display: flex; flex-direction: column; gap: 6px; justify-content: flex-end; min-width: 260px; }
.album-header-info h2 { margin: 0; font-size: 30px; }
.album-header-info .artist { font-size: 18px; }
.album-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.track-table { width: 100%; border-collapse: collapse; }
.track-table td, .track-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.track-table th { color: var(--muted); font-weight: 500; font-size: 13px; }
.track-table tr.playable { cursor: pointer; }
.track-table tr.playable:hover { background: var(--bg-hover); }
.track-table tr.playing td { color: var(--accent); }
.track-pos { color: var(--muted); width: 44px; }
.track-dur { color: var(--muted); text-align: right !important; width: 70px; }
.track-actions { text-align: right !important; width: 110px; white-space: nowrap; }
.icon-btn {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 6px;
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn.big { font-size: 24px; }
.no-audio { color: var(--muted); font-style: italic; font-size: 13px; }

/* ---------- add flow ---------- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.dragover { border-color: var(--accent); background: rgba(232, 114, 44, 0.06); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.discogs-row { display: flex; gap: 10px; margin: 18px 0; align-items: center; flex-wrap: wrap; }
.discogs-row input { flex: 1; min-width: 240px; }

.upload-row-file { font-size: 12px; color: var(--muted); }
.progress {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.progress > * { display: block; height: 100%; background: var(--accent); width: 0%; transition: width 0.2s; }
.status-ok { color: #6dd67f; }

/* ---------- sides ---------- */
.section-title { font-size: 16px; color: var(--muted); margin: 26px 0 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.sides-list { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.side-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  width: 100%;
  max-width: 640px;
}
.side-row.playing .side-status, .side-row.playing .side-chip { color: var(--accent); border-color: var(--accent); }
.side-chip {
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.side-status { min-width: 160px; font-size: 14px; }
.side-progress-wrap { flex: 1; }
.side-progress { display: block; }
.side-actions { display: flex; gap: 2px; }

/* ---------- recorder ---------- */
.rec-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.rec-field select { width: 100%; }
.level-meter {
  height: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 10px;
}
.level-meter > div { height: 100%; width: 0%; background: #6dd67f; transition: width 0.06s linear; }
.rec-time { font-size: 32px; font-variant-numeric: tabular-nums; text-align: center; margin: 8px 0 12px; }

/* ---------- player ---------- */
.player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  z-index: 20;
}
.player-cover { width: 52px; height: 52px; border-radius: 6px; object-fit: cover; background: var(--bg); }
.player-meta { min-width: 140px; max-width: 220px; overflow: hidden; }
.player-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-controls { display: flex; align-items: center; gap: 4px; }
.player-seek { flex: 1; display: flex; align-items: center; gap: 10px; }
.player-seek input { flex: 1; }
.time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.volume { width: 90px; }

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

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: min(560px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
}
.modal h3 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (max-width: 640px) {
  .player { flex-wrap: wrap; }
  .player-seek { order: 5; flex-basis: 100%; }
  .volume { display: none; }
  .topbar { flex-wrap: wrap; }
}
