/* ── Reset & Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0e0c0a;
  --surface: #1a1714;
  --surface2: #242018;
  --border: #333028;
  --gold: #c9a84c;
  --gold-dim: #8a6e2e;
  --text: #e8e0d0;
  --text-dim: #7a7060;
  --text-mid: #a89880;
  --green-bg: #2a4a2a;
  --green-border: #3a6a3a;
  --green-text: #90c090;
  --mono: 'Space Mono', monospace;
  --serif: 'Playfair Display', serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Scanline overlay */
body::after {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent, transparent 2px,
    rgba(0,0,0,0.025) 2px, rgba(0,0,0,0.025) 4px
  );
  pointer-events: none;
  z-index: 9000;
}

/* ── Header ── */
header {
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  position: sticky; top: 0; z-index: 100;
}

.logo {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--gold);
  font-style: italic;
  letter-spacing: .5px;
}
.logo span {
  font-style: normal;
  color: var(--text-dim);
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: 2px;
  text-transform: uppercase;
  display: block;
  margin-top: -2px;
}

.header-right {
  display: flex; align-items: center; gap: 14px;
}

#connection-status {
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-dim); display: flex; align-items: center; gap: 7px;
}

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-dim); transition: all .4s; flex-shrink: 0;
}
.dot.live  { background: #5a8a5a; box-shadow: 0 0 6px #5a8a5a; }
.dot.error { background: #8a4040; box-shadow: 0 0 6px #8a4040; }

#gear-btn {
  background: none; border: 1px solid var(--border); border-radius: 2px;
  width: 34px; height: 34px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 16px; transition: all .15s; flex-shrink: 0;
}
#gear-btn:hover,
#gear-btn.active {
  border-color: var(--gold-dim); color: var(--gold); background: rgba(201,168,76,.08);
}

/* ── Settings Drawer ── */
#drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px); z-index: 9998;
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
#drawer-backdrop.show { opacity: 1; pointer-events: all; }

#settings-drawer {
  position: fixed; top: 0; right: 0;
  width: 380px; max-width: 95vw; height: 100vh;
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 9999; overflow-y: auto;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.16,1,.3,1);
  display: flex; flex-direction: column;
}
#settings-drawer.open { transform: translateX(0); }

.drawer-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.drawer-title {
  font-size: 10px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--gold-dim); font-weight: 700;
}
#close-drawer {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 18px; line-height: 1;
  transition: color .15s; padding: 2px 4px;
}
#close-drawer:hover { color: var(--text); }

.drawer-body { padding: 20px; flex: 1; padding-bottom: 80px}


/* Form elements */
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

.section-label {
  font-size: 9px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--gold-dim); margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.field { margin-bottom: 12px; }
.field label {
  display: block; font-size: 10px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 5px;
}
.field input,
.field select {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 2px; padding: 8px 10px; font-family: var(--mono);
  font-size: 11px; color: var(--text); outline: none; transition: border-color .2s;
}
.field input:focus,
.field select:focus { border-color: var(--gold-dim); }
.field input::placeholder { color: var(--text-dim); }
.field select option { background: var(--surface2); }

.hint { font-size: 10px; color: var(--text-dim); margin-top: 4px; line-height: 1.6; }

.col-map { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.col-map .field { margin-bottom: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 2px; border: 1px solid transparent;
  font-family: var(--mono); font-size: 11px; cursor: pointer;
  letter-spacing: .5px; transition: all .15s; font-weight: 700; text-transform: uppercase;
}
.btn-ghost { background: transparent; color: var(--text-mid); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text-mid); color: var(--text); }
.btn-danger {
  background: transparent; color: #c09090; border-color: #6a3a3a;
  width: 100%; font-size: 10px;
}
.btn-danger:hover { background: rgba(138,64,64,.15); }

/* ── Main / Play Zone ── */
main {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 48px 24px;
}

/* Welcome screen */
#setup-screen {
  text-align: center; max-width: 420px;
  animation: fadeUp .5s ease both;
}
#setup-screen .big-icon { font-size: 58px; margin-bottom: 18px; opacity: .3; }
#setup-screen h2 {
  font-family: var(--serif); font-size: 28px; color: var(--text);
  margin-bottom: 10px; font-weight: 400; font-style: italic;
}
#setup-screen p { color: var(--text-dim); line-height: 1.75; font-size: 12px; margin-bottom: 28px; }

.welcome-btns { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.btn-welcome-main {
  background: var(--gold); color: #0e0c0a; border-color: var(--gold);
  padding: 12px 32px; font-size: 12px; width: 260px;
}
.btn-welcome-main:hover { background: #dbb85a; }
.btn-welcome-sub {
  background: transparent; color: var(--text-mid); border-color: var(--border);
  padding: 10px 32px; font-size: 11px; width: 260px;
}
.btn-welcome-sub:hover { border-color: var(--text-mid); color: var(--text); }

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}


/* Album card */
#album-card {
  display: none; flex-direction: column; align-items: center;
  width: 100%; max-width: 520px;
  animation: cardIn .4s cubic-bezier(.16,1,.3,1);
}

.card-inner {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 3px; width: 100%; overflow: hidden;
}
.card-accent { height: 3px; background: linear-gradient(90deg, var(--gold), var(--gold-dim), transparent); }
.card-body { padding: 38px 40px 30px; text-align: center; }

.album-number {
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold-dim); margin-bottom: 22px;
}

.vinyl-art { width: 120px; height: 120px; margin: 0 auto 26px; position: relative; }
#vinyl-canvas {
  width: 120px; height: 120px; border-radius: 50%;
  display: block;
}
/* gold centre spindle hole */
.vinyl-art::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); width: 10px; height: 10px;
  border-radius: 50%; background: var(--gold); opacity: .85;
  pointer-events: none;
}

.album-band {
  font-family: var(--serif); font-size: 13px; color: var(--gold);
  letter-spacing: 2px; text-transform: uppercase; margin-bottom: 5px; font-style: italic;
}
.album-title {
  font-family: var(--serif); font-size: 32px; font-weight: 700;
  color: var(--text); line-height: 1.15; margin-bottom: 18px;
}
.album-meta {
  font-size: 10px; color: var(--text-dim); letter-spacing: 1.5px; text-transform: uppercase;
  padding: 10px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin-bottom: 30px;
}
.card-prompt { font-size: 13px; color: var(--text-mid); margin-bottom: 22px; line-height: 1.6; }
.card-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn-yes {
  background: var(--green-bg); color: var(--green-text); border: 1px solid var(--green-border);
  padding: 12px 28px; font-size: 12px; min-width: 160px;
}
.btn-yes:hover { background: #345034; }
.btn-no {
  background: var(--surface2); color: var(--text-mid); border: 1px solid var(--border);
  padding: 12px 28px; font-size: 12px; min-width: 160px;
}
.btn-no:hover { border-color: var(--text-mid); color: var(--text); }

/* Stats bar */
#stats-bar {
  display: none; flex-direction: row;
  width: 100%; max-width: 520px; margin-top: 22px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 2px; padding: 12px 20px;
}
#stats-bar.visible { display: flex; }
.stat { text-align: center; flex: 1; padding: 0 12px; border-right: 1px solid var(--border); }
.stat:last-child { border-right: none; }
.stat-val { font-size: 22px; font-family: var(--serif); color: var(--gold); font-weight: 700; }
.stat-label { font-size: 9px; color: var(--text-dim); letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px; }

#skipped-note {
  display: none; width: 100%; max-width: 520px; margin-top: 10px;
  font-size: 10px; color: var(--text-dim); text-align: center; letter-spacing: .5px;
}

/* Done screen */
#done-screen { display: none; text-align: center; max-width: 400px; }
#done-screen .big-icon { font-size: 58px; margin-bottom: 16px; }
#done-screen h2 {
  font-family: var(--serif); font-size: 30px; font-weight: 400;
  font-style: italic; color: var(--gold); margin-bottom: 10px;
}
#done-screen p { color: var(--text-dim); font-size: 12px; line-height: 1.7; }


/* Toast */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); padding: 12px 22px; border-radius: 2px;
  font-size: 12px; opacity: 0; transition: all .3s;
  z-index: 20000; white-space: nowrap; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.success { border-color: var(--green-border); color: var(--green-text); }
#toast.error   { border-color: #6a3a3a; color: #c09090; }

/* ── Responsive ── */
@media (max-width: 600px) {
  main { padding: 28px 14px; }
  .card-body { padding: 26px 18px 22px; }
  .album-title { font-size: 24px; }
  header { padding: 14px 16px; }
  #settings-drawer { width: 100vw; }
}