:root {
  --bg: #000;
  --fg: #fff;
  --muted: #9a9a9a;
  --line: #3a3a3a;
  --card: #0d0d0d;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }

h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.loading { padding: 40px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.error { color: #ff8a8a; font-weight: 600; }

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.screen.center {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  padding-top: calc(24px + env(safe-area-inset-top));
}
.screen.center h1 { font-size: 26px; }

.logo-big { width: 160px; height: auto; }

/* Buttons */
.btn {
  appearance: none;
  border: 2px solid var(--fg);
  background: transparent;
  color: var(--fg);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn.primary { background: var(--fg); color: var(--bg); }
.btn.big { min-height: 54px; font-size: 18px; width: 100%; }
.btn.small { min-height: 40px; padding: 6px 16px; font-size: 15px; border-color: var(--line); color: #ddd; }
.btn:disabled { opacity: .35; cursor: default; }
.btn:active:not(:disabled) { transform: scale(.97); }

.link {
  appearance: none; background: none; border: 0; padding: 12px;
  color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 15px;
}

.icon-btn {
  appearance: none; background: none; border: 0; color: var(--fg);
  width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer;
  flex: none;
}

/* Install screen */
.steps { text-align: left; padding-left: 24px; margin: 0; max-width: 340px; }
.steps li { margin: 0 0 16px; padding-left: 4px; }
.share-icon { display: inline-flex; vertical-align: -4px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; }

/* Login */
.name-list { display: grid; gap: 12px; width: 100%; max-width: 340px; }
.pin-form { display: grid; gap: 14px; width: 100%; max-width: 340px; }
.pin-input {
  width: 100%; text-align: center; font-size: 32px; letter-spacing: 10px;
  background: var(--bg); border: 2px solid var(--fg); border-radius: var(--radius);
  padding: 12px; outline: none;
}

/* Header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.brand h1 { font-size: 22px; letter-spacing: .5px; white-space: nowrap; }
.logo-small { height: 22px; width: auto; flex: none; }
.add-btn { flex: none; padding: 8px 14px; font-size: 16px; }

/* Notifications banner */
.notif-banner {
  border: 2px solid var(--fg); border-radius: var(--radius);
  padding: 16px; margin-bottom: 20px; display: grid; gap: 12px;
}

.section-title { font-size: 14px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin: 8px 0 12px; }
.empty { color: var(--muted); padding: 8px 0 16px; }

.list { display: grid; gap: 14px; }

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 14px;
}
.card-head { display: flex; gap: 14px; align-items: flex-start; }
.date {
  flex: none; min-width: 64px; text-align: center;
  border: 2px solid var(--fg); border-radius: 10px;
  padding: 6px 8px; font-weight: 800; font-size: 19px;
  font-variant-numeric: tabular-nums;
}
.titles { min-width: 0; }
.track { font-size: 20px; line-height: 1.25; overflow-wrap: anywhere; }
.artists { color: #cfcfcf; overflow-wrap: anywhere; }

.checks { display: grid; gap: 4px; }
.check {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; cursor: pointer; user-select: none;
}
.check input {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 28px; height: 28px; flex: none;
  border: 2px solid var(--fg); border-radius: 7px;
  background: transparent; display: grid; place-items: center; cursor: pointer;
}
.check input:checked { background: var(--fg); }
.check input:checked::after {
  content: ""; width: 7px; height: 14px; margin-top: -3px;
  border: solid var(--bg); border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.check input:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.check input:checked + span { color: var(--fg); }
.check span { color: #e6e6e6; }

.notes { display: flex; gap: 8px; align-items: flex-end; }
textarea, input[type="text"], input[type="date"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid #777;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px; /* stops iPhone zooming in */
  outline: none;
}
textarea { resize: vertical; min-height: 48px; }
textarea:focus, input:focus { border-color: var(--fg); }
.notes textarea { flex: 1; }
.save-notes { flex: none; }

.card-actions { display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 12px; }

/* Released */
.released { margin-top: 28px; border-top: 1px solid var(--line); }
.released summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  min-height: 56px; font-size: 14px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted);
}
.released summary::-webkit-details-marker { display: none; }
.released summary::before { content: "▸"; font-size: 16px; transition: transform .15s; }
.released[open] summary::before { transform: rotate(90deg); }
.released .list { padding-bottom: 16px; }

/* Dialogs */
dialog.sheet {
  background: #111; color: var(--fg);
  border: 1px solid var(--line); border-radius: 18px;
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 20px; margin: auto;
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, .75); }
dialog.sheet > * + * { margin-top: 14px; }
dialog h2 { font-size: 22px; }
.release-form { display: grid; gap: 14px; }
.release-form label { display: grid; gap: 6px; font-weight: 600; }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }
.menu-notif { display: grid; gap: 10px; }

input[type="date"] { min-height: 48px; color-scheme: dark; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-weight: 600; z-index: 50; max-width: calc(100vw - 32px); text-align: center;
}

@media (max-width: 360px) {
  .brand h1 { font-size: 19px; }
  .logo-small { display: none; }
}
