/* Plattensammlung – Plattenladen statt App-Vorlage.
   Schriften kommen vom Gerät (auf dem iPad: Iowan Old Style, Avenir Next, SF Mono) –
   es wird nichts von fremden Servern geladen. */

:root {
  --paper: #f3eee5;
  --paper-2: #e8e1d3;
  --card: #fbf8f2;
  --ink: #1a1815;
  --ink-2: #6b645a;
  --ink-3: #9a9286;
  --line: #d9d0c0;
  --accent: #e2412b;
  --accent-ink: #fff8f0;
  --accent-soft: rgba(226, 65, 43, 0.12);
  --hole: var(--card);
  --shadow: 0 1px 1px rgba(40, 30, 20, 0.08), 0 10px 22px -10px rgba(40, 30, 20, 0.45);
  --shadow-lg: 0 40px 80px -30px rgba(30, 20, 10, 0.5);

  --font-display: "Iowan Old Style", "Charter", "Palatino Linotype", Palatino, Georgia, serif;
  --font-ui: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-cond: "Avenir Next Condensed", "Bahnschrift SemiCondensed", Bahnschrift, "Arial Narrow", sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --gutter: max(24px, env(safe-area-inset-left));
  --gutter-r: max(24px, env(safe-area-inset-right));
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.3, 1.5, 0.5, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12110f;
    --paper-2: #201d1a;
    --card: #1a1815;
    --ink: #f1ece3;
    --ink-2: #a49c90;
    --ink-3: #6f685e;
    --line: #302c27;
    --accent: #ff5a3c;
    --accent-ink: #1a0b06;
    --accent-soft: rgba(255, 90, 60, 0.14);
    --shadow: 0 1px 1px rgba(0, 0, 0, 0.4), 0 12px 24px -10px rgba(0, 0, 0, 0.8);
    --shadow-lg: 0 40px 80px -30px rgba(0, 0, 0, 0.9);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 500 16px/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}
body:has(dialog[open]) { overflow: hidden; }

h1, h2, p { margin: 0; }
button { font: inherit; color: inherit; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  opacity: 0;
}

.icon {
  width: 1.3em;
  height: 1.3em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: 600 16px/1 var(--font-ui);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.18s var(--spring), background-color 0.15s, color 0.15s;
}
.btn:active { transform: scale(0.95); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { background: var(--paper-2); }
.btn.danger { border-color: transparent; color: var(--accent); }
.btn.danger:hover { background: var(--accent-soft); }
.btn.big { min-height: 56px; font-size: 17px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 46px; height: 46px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.18s var(--spring);
}
.icon-btn:hover { background: var(--paper-2); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn .icon { width: 24px; height: 24px; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: 600 15px var(--font-ui);
  cursor: pointer;
}
.link-btn:hover { color: var(--ink); }
.link-btn.danger { color: var(--accent); }

/* ---------- Schallplatten ---------- */

.vinyl, .record {
  border-radius: 50%;
  background: repeating-radial-gradient(circle at 50% 50%, #0b0b0b 0 1.4px, #1c1c1c 1.4px 2.8px);
  box-shadow: inset 0 0 0 1px #000, 0 6px 18px rgba(0, 0, 0, 0.3);
}
.record { position: relative; }
.record::before {
  content: "";
  position: absolute;
  inset: 34%;
  border-radius: 50%;
  background: var(--accent);
}
.record::after {
  content: "";
  position: absolute;
  inset: 47.5%;
  border-radius: 50%;
  background: var(--hole);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Kopf ---------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  padding: calc(28px + env(safe-area-inset-top)) var(--gutter-r) 6px var(--gutter);
}
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-disc { --hole: var(--paper); width: 54px; height: 54px; flex: none; }
.loading .brand-disc { animation: spin 1.8s linear infinite; }
.brand-title {
  font: 600 clamp(30px, 4.2vw, 44px)/1 var(--font-display);
  letter-spacing: -0.015em;
}
.brand-count {
  margin-top: 6px;
  font: 500 12.5px/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.top-actions { display: flex; align-items: center; gap: 10px; }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 28px;
  padding: 14px var(--gutter-r) 14px var(--gutter);
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.in-trash .toolbar { display: none; }

.search {
  flex: 1 1 300px;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 2px solid var(--ink);
  transition: border-color 0.2s;
}
.search:focus-within { border-color: var(--accent); }
.search .icon { width: 22px; height: 22px; color: var(--ink-2); }
.search input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 500 20px var(--font-ui);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder { color: var(--ink-3); }

.sort-chips {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.sort-chips::-webkit-scrollbar { display: none; }
.chip-btn {
  flex: none;
  padding: 9px 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink-2);
  font: 600 14.5px var(--font-ui);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.chip-btn:hover { color: var(--ink); }
.chip-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.notice {
  margin: 12px var(--gutter-r) 0 var(--gutter);
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 15px;
}

.trash-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px var(--gutter-r) 0 var(--gutter);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
}
.trash-bar h2 { font: 600 30px/1 var(--font-display); }

/* ---------- Regal (Raster) ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 40px 26px;
  padding: 26px var(--gutter-r) 80px var(--gutter);
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 44px 30px; }
}

.card {
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.grid.animate .card { animation: card-in 0.55s var(--ease) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(18px); } }

.card-art { position: relative; aspect-ratio: 1 / 1; }
.card-disc {
  --hole: var(--paper);
  position: absolute;
  inset: 3%;
  z-index: 0;
  transition: transform 0.6s var(--ease);
}
.card-sleeve {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 3px;
  background: var(--paper-2);
  box-shadow: var(--shadow);
  container-type: inline-size;
  transition: transform 0.4s var(--ease);
}
@media (hover: hover) {
  .card:hover .card-disc { transform: translateX(30%) rotate(120deg); }
  .card:hover .card-sleeve { transform: translateX(-4%) rotate(-1deg); }
}
.card:active .card-sleeve { transform: scale(0.96); }
.in-trash .card-sleeve { filter: grayscale(0.85); opacity: 0.75; }

/* Nummer als runder Preis-Aufkleber */
.sticker {
  position: absolute;
  top: -12px;
  right: -10px;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 48px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 18px/1 var(--font-mono);
  letter-spacing: -0.03em;
  transform: rotate(9deg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25), inset 0 0 0 2px rgba(255, 255, 255, 0.18);
  transition: transform 0.3s var(--spring);
}
.card:hover .sticker { transform: rotate(-4deg) scale(1.06); }

.card-meta { padding-top: 14px; min-width: 0; }
.card-artist, .card-album { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-artist { font: 600 16px/1.25 var(--font-ui); }
.card-album { font: italic 400 16px/1.3 var(--font-display); color: var(--ink-2); }

/* ---------- Cover & Hüllen ohne Foto ---------- */

.cover { display: block; width: 100%; height: 100%; object-fit: cover; }

[data-tone="0"] { --tone: #e2412b; --tone-ink: #fff1e6; }
[data-tone="1"] { --tone: #f0b429; --tone-ink: #2a1d05; }
[data-tone="2"] { --tone: #2350a8; --tone-ink: #f3efe6; }
[data-tone="3"] { --tone: #2f8f83; --tone-ink: #f1f7ee; }
[data-tone="4"] { --tone: #f2a7a0; --tone-ink: #3a1410; }
[data-tone="5"] { --tone: #6b7a2e; --tone-ink: #f4f0dc; }
[data-tone="6"] { --tone: #5b2a5e; --tone-ink: #f6d9e8; }
[data-tone="7"] { --tone: #8cc7e8; --tone-ink: #0f2a3a; }
[data-tone="8"] { --tone: #1d1b19; --tone-ink: #f0b429; }
[data-tone="9"] { --tone: #efe3c8; --tone-ink: #b2341f; }

.sleeve-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.35em;
  padding: 9%;
  overflow: hidden;
  background: var(--tone);
  color: var(--tone-ink);
  font-size: 16px;
}
.sleeve-art::before {
  content: "";
  position: absolute;
  pointer-events: none;
}
.sleeve-art[data-shape="0"]::before {
  width: 75%; aspect-ratio: 1;
  top: -20%; right: -20%;
  border-radius: 50%;
  background: var(--tone-ink);
  opacity: 0.18;
}
.sleeve-art[data-shape="1"]::before {
  inset: 0 0 auto 0;
  height: 48%;
  background: repeating-linear-gradient(0deg, var(--tone-ink) 0 4%, transparent 4% 9%);
  opacity: 0.22;
}
.sleeve-art[data-shape="2"]::before {
  width: 80%; aspect-ratio: 1;
  top: 5%; left: 10%;
  border-radius: 50%;
  border: 3cqw solid var(--tone-ink);
  opacity: 0.2;
}
.sa-artist, .sa-album { position: relative; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; }
.sa-artist {
  font: 700 1.4em/0.92 var(--font-cond);
  font-size: 13cqw;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
}
.sa-album {
  font: italic 400 0.9em/1.15 var(--font-display);
  font-size: 7.5cqw;
  opacity: 0.85;
  -webkit-line-clamp: 2;
}

/* ---------- Dialoge ---------- */

dialog.sheet {
  width: min(1000px, calc(100vw - 40px));
  max-width: none;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  padding: 0;
  border: 0;
  border-radius: 26px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
dialog.sheet-small { width: min(480px, calc(100vw - 40px)); }
dialog.sheet-detail { overflow-x: hidden; }
dialog.sheet[open] { animation: sheet-in 0.42s var(--ease) both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(28px) scale(0.98); } }
dialog::backdrop {
  background: rgba(24, 18, 12, 0.42);
  -webkit-backdrop-filter: blur(8px) saturate(0.8);
  backdrop-filter: blur(8px) saturate(0.8);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 22px 4px 34px;
}
.sheet-title { font: 600 32px/1.1 var(--font-display); letter-spacing: -0.01em; }

.sheet-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 26px 34px 26px;
  background: linear-gradient(to bottom, transparent, var(--card) 40%);
}

/* ---------- Detail: Platte rutscht aus der Hülle ---------- */

.detail {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: start;
  gap: 44px;
  padding: 48px 44px 44px;
}
.detail-close { position: absolute; top: 14px; right: 14px; z-index: 3; }

.stage { position: relative; aspect-ratio: 3 / 2; }
.stage .sleeve {
  position: absolute;
  top: 0; left: 0;
  z-index: 2;
  width: 66.667%;
  height: 100%;
  border-radius: 4px;
  box-shadow: var(--shadow-lg), var(--shadow);
  container-type: inline-size;
  perspective: 1600px;
}
.sleeve-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.75s var(--ease);
}
.face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 4px;
  background: var(--paper-2);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.face-back { transform: rotateY(180deg); }
.face-back img.cover { object-fit: contain; background: var(--paper-2); }
.stage.flipped .sleeve-inner { transform: rotateY(180deg); }
.stage.zoomable .sleeve { cursor: zoom-in; }

.detail-visual { display: flex; flex-direction: column; gap: 16px; min-width: 0; position: sticky; top: 0; }
.face-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; }
.face-toggle { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--paper-2); }
.face-toggle .chip-btn { padding: 7px 14px; }
.stage .disc-slot {
  position: absolute;
  top: 3%; left: 2%;
  z-index: 1;
  width: 62.667%;
  height: 94%;
  animation: disc-out 1s var(--ease) 0.3s both;
}
@keyframes disc-out { from { transform: translateX(0); } to { transform: translateX(50%); } }
.stage .disc-slot::after {
  /* Lichtreflex – dreht sich nicht mit */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(from 25deg, transparent 0 28deg, rgba(255, 255, 255, 0.16) 48deg, transparent 72deg 205deg, rgba(255, 255, 255, 0.1) 228deg, transparent 252deg);
}
.stage .disc {
  position: relative;
  width: 100%;
  height: 100%;
  animation: spin 1.8s linear infinite; /* 33⅓ Umdrehungen pro Minute */
}
.disc-label {
  position: absolute;
  inset: 32%;
  overflow: hidden;
  border-radius: 50%;
  background: var(--tone, var(--accent));
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5);
}
.disc-label img { display: block; width: 100%; height: 100%; object-fit: cover; }
.disc-label::after {
  content: "";
  position: absolute;
  inset: 44%;
  border-radius: 50%;
  background: var(--card);
}
.shuffling .disc-slot { animation: none; }
.shuffling .detail-info { opacity: 0.3; pointer-events: none; }
.shuffling .stage .sleeve { animation: flick 0.12s ease-out; }
@keyframes flick { from { transform: translateY(-6px) rotate(-1.5deg); } }

.detail-info { display: flex; flex-direction: column; min-width: 0; transition: opacity 0.2s; }
.fresh-note {
  align-self: flex-start;
  margin-bottom: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 13px var(--font-ui);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.detail-num {
  display: flex;
  align-items: flex-start;
  gap: 0.06em;
  font: 700 clamp(84px, 12vw, 150px)/0.82 var(--font-cond);
  letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.detail-num .no {
  margin-top: 0.12em;
  font: italic 400 0.3em/1 var(--font-display);
  letter-spacing: 0;
  color: var(--ink-2);
}
.fresh .detail-num { animation: stamp 0.7s var(--spring) 0.2s both; }
@keyframes stamp { from { opacity: 0; transform: scale(1.9) rotate(-8deg); } }
.detail-artist {
  margin-top: 22px;
  font: 600 clamp(26px, 3.2vw, 36px)/1.1 var(--font-display);
  overflow-wrap: anywhere;
}
.detail-album {
  margin-top: 4px;
  font: italic 400 clamp(20px, 2.3vw, 26px)/1.25 var(--font-display);
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip {
  padding: 6px 13px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font: 600 14px var(--font-ui);
  color: var(--ink-2);
}
.detail-notes {
  margin-top: 20px;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  color: var(--ink-2);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.detail-tip { margin-top: 18px; color: var(--ink-2); font-size: 15px; }

/* Titelliste */
.tracklist { margin-top: 22px; }
.tracklist summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font: 700 13px var(--font-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
}
.tracklist summary::-webkit-details-marker { display: none; }
.tracklist summary::after { content: "–"; font-weight: 400; }
.tracklist:not([open]) summary::after { content: "+"; }
.side { margin-top: 10px; }
.side-label {
  margin-bottom: 4px;
  font: italic 400 15px var(--font-display);
  color: var(--accent);
}
.tracks { margin: 0; padding: 0; list-style: none; }
.tracks li {
  display: grid;
  grid-template-columns: 2.6em minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  border-bottom: 1px solid var(--line);
}
.tracks li:last-child { border-bottom: 0; }
.tracks li.match { background: var(--accent-soft); border-bottom-color: transparent; }
.tracks li.match .t-title { font-weight: 700; }
.t-pos { font: 600 13px var(--font-mono); color: var(--ink-3); }
.t-title { font-size: 15.5px; overflow-wrap: anywhere; }
.t-time { font: 500 13px var(--font-mono); color: var(--ink-3); }

.card-track {
  margin-top: 4px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field textarea.tracks-input { min-height: 150px; font: 500 15px/1.55 var(--font-mono); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }

/* ---------- Formular ---------- */

.edit-body {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 40px;
  padding: 20px 34px 0;
}
.cover-edit { display: flex; flex-direction: column; gap: 6px; }
.cover-drop { display: block; position: relative; cursor: pointer; }
.cover-preview {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 6px;
  container-type: inline-size;
}
.cover-preview img.cover { box-shadow: var(--shadow); }
.cover-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 20px;
  border: 2px dashed var(--line);
  border-radius: 6px;
  background: repeating-linear-gradient(-45deg, transparent 0 14px, var(--paper-2) 14px 15px);
  color: var(--ink-2);
  text-align: center;
  transition: border-color 0.2s, color 0.2s;
}
.cover-drop:hover .cover-empty { border-color: var(--accent); color: var(--accent); }
.cover-empty .icon { width: 46px; height: 46px; stroke-width: 1.4; margin-bottom: 4px; }
.cover-empty strong { font: 600 21px/1.2 var(--font-display); color: var(--ink); }
.cover-empty span { font-size: 14px; }
.cover-retake {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(15, 12, 10, 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font: 600 14px var(--font-ui);
}
.cover-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }

.fields { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font: 600 14px var(--font-ui); color: var(--ink-2); }
.field-hint { font-size: 13.5px; color: var(--ink-3); }
.field input, .field textarea {
  width: 100%;
  min-height: 52px;
  padding: 13px 15px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  background: var(--paper-2);
  color: var(--ink);
  font: 500 17px var(--font-ui);
  transition: border-color 0.15s, background-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--ink); background: var(--card); }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }
.field-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 14px; }

.number-input {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 210px;
  padding: 0 16px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  background: var(--paper-2);
  transition: border-color 0.15s, background-color 0.15s;
}
.number-input:focus-within { border-color: var(--ink); background: var(--card); }
.number-input .no { font: italic 400 24px var(--font-display); color: var(--ink-2); }
.field .number-input input {
  min-height: 64px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: 700 38px/1 var(--font-cond);
  letter-spacing: -0.02em;
}
.field .number-input input:focus { background: transparent; }

.form-error {
  margin: 18px 34px 0;
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* Rückseite im Formular */
.back-edit {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1.5px solid var(--line);
}
.back-drop { flex: none; cursor: pointer; }
.back-preview {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  overflow: hidden;
  border: 2px dashed var(--line);
  border-radius: 6px;
  color: var(--ink-3);
  background: repeating-linear-gradient(-45deg, transparent 0 10px, var(--paper-2) 10px 11px);
  transition: border-color 0.2s, color 0.2s;
}
.back-drop:hover .back-preview { border-color: var(--accent); color: var(--accent); }
.back-preview .icon { width: 30px; height: 30px; stroke-width: 1.5; }
.back-preview.has-image { border: 0; background: var(--paper-2); box-shadow: var(--shadow); }
.back-preview img { width: 100%; height: 100%; object-fit: cover; }
.back-info { display: flex; flex-direction: column; min-width: 0; }
.back-info strong { font: 600 18px/1.2 var(--font-display); }
.back-info small { color: var(--ink-2); font-size: 13.5px; }
.back-links { display: flex; flex-wrap: wrap; gap: 0 12px; margin-top: 2px; }

/* Scannen-Knopf im Suchfeld */
.scan-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 600 14.5px var(--font-ui);
  cursor: pointer;
  transition: transform 0.18s var(--spring);
}
.scan-btn:active { transform: scale(0.94); }
.scan-btn .icon { width: 18px; height: 18px; }

/* „Noch nicht im Regal“ */
.notfound { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 34px 28px 28px; text-align: center; }
.notfound-disc { --hole: var(--card); width: 96px; height: 96px; margin-bottom: 6px; animation: spin 1.8s linear infinite; }
.notfound p { color: var(--ink-2); max-width: 340px; }
.notfound-actions { display: flex; flex-direction: column; gap: 6px; width: 100%; margin-top: 12px; }

/* Bild groß ansehen */
dialog.lightbox {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(12, 10, 8, 0.95);
  color: #fff;
  overflow: hidden;
}
dialog.lightbox[open] { animation: fade-in 0.25s ease both; }
dialog.lightbox::backdrop { background: transparent; }
.lightbox-scroll {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow: auto;
  cursor: zoom-in;
  -webkit-overflow-scrolling: touch;
}
.lightbox-scroll img {
  display: block;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 100px);
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.lightbox-scroll.zoomed { display: block; cursor: zoom-out; }
.lightbox-scroll.zoomed img { width: 230%; max-width: none; max-height: none; }
.lightbox-close {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  z-index: 2;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-hint {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(16px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  pointer-events: none;
}

/* ---------- Automatisch ausfüllen ---------- */

.file-btn { position: relative; }

.autofill {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: var(--paper);
  border: 1.5px dashed var(--line);
}
.autofill-head strong { display: block; font: 600 19px/1.2 var(--font-display); }
.autofill-head small { display: block; margin-top: 2px; font-size: 13.5px; color: var(--ink-2); }
.autofill-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.autofill-actions .btn { flex: 1 1 auto; }
.barcode-row { display: flex; gap: 6px; }
.barcode-row input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding: 0 14px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  background: var(--paper-2);
  color: var(--ink);
  font: 600 17px var(--font-mono);
  letter-spacing: 0.04em;
  -webkit-appearance: none;
  appearance: none;
}
.barcode-row input::placeholder { font: 500 15px var(--font-ui); letter-spacing: 0; color: var(--ink-3); }
.barcode-row input:focus { outline: none; border-color: var(--ink); background: var(--card); }

/* Trefferliste */
dialog.sheet-medium { width: min(620px, calc(100vw - 40px)); }
.lookup-sub { padding: 2px 34px 0; color: var(--ink-2); font-size: 15px; }
.lookup-sub:empty { display: none; }
.lookup-notice { margin: 14px 24px 0; }
.lookup-list { display: flex; flex-direction: column; padding: 12px 14px 4px; }
.hit {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 16px;
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s var(--spring);
}
.hit:hover { background: var(--paper-2); }
.hit:active { transform: scale(0.98); }
.hit > .icon { color: var(--ink-3); }
.hit-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  flex: none;
  overflow: hidden;
  border-radius: 4px;
  background: var(--paper-2);
  box-shadow: var(--shadow);
}
.hit-thumb img { width: 100%; height: 100%; object-fit: cover; animation: fade-in 0.3s ease both; }
.hit-disc { --hole: var(--paper-2); width: 78%; height: 78%; box-shadow: none; }
@keyframes fade-in { from { opacity: 0; } }
.hit-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.hit-text strong { font: 600 18px/1.2 var(--font-display); overflow-wrap: anywhere; }
.hit-artist { font-weight: 600; font-size: 15px; }
.hit-text small { color: var(--ink-2); font-size: 13.5px; }
.lookup-loading, .lookup-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 34px 20px 30px;
  color: var(--ink-2);
  text-align: center;
}
.lookup-empty strong { font: 600 22px var(--font-display); color: var(--ink); }
.lookup-spinner { --hole: var(--card); width: 84px; height: 84px; animation: spin 1.8s linear infinite; }
.lookup-credit { padding: 6px 34px 22px; color: var(--ink-3); font-size: 12.5px; }

/* ---------- Menü ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 24px 10px;
}
.stat { padding: 14px 14px 12px; border-radius: 16px; background: var(--paper-2); }
.stat b { display: block; font: 700 32px/1 var(--font-cond); letter-spacing: -0.02em; }
.stat span { display: block; margin-top: 4px; font: 600 12.5px var(--font-ui); color: var(--ink-2); }

.menu-list { display: flex; flex-direction: column; padding: 8px 12px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 13px 12px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s;
}
.menu-item:hover, .menu-item:active { background: var(--paper-2); }
.menu-item > .icon { width: 24px; height: 24px; color: var(--ink-2); }
.menu-item strong { display: flex; align-items: center; gap: 8px; font: 600 16px var(--font-ui); }
.menu-item small { display: block; margin-top: 2px; color: var(--ink-2); font-size: 14px; }
.count-pill:empty { display: none; }
.count-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 12px var(--font-mono);
}
.menu-info { padding: 6px 24px 22px; color: var(--ink-3); font-size: 13px; }

/* ---------- Leere Zustände ---------- */

.empty {
  max-width: 460px;
  margin: 30px auto 80px;
  padding: 0 var(--gutter-r) 0 var(--gutter);
  text-align: center;
}
.empty .stage { width: 280px; margin: 0 auto 34px; }
.empty-title { font: 600 30px/1.15 var(--font-display); margin-bottom: 10px; }
.empty p { color: var(--ink-2); }
.empty .btn { margin-top: 26px; }

/* ---------- Hinweis-Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 15px 22px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--paper);
  font: 600 15.5px var(--font-ui);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translate(-50%, 24px) scale(0.96);
  transition: opacity 0.3s var(--ease), transform 0.4s var(--spring);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- Anmeldung ---------- */

.auth-page { display: grid; place-items: center; padding: 40px 22px; }
.auth-card { width: min(400px, 100%); text-align: center; }
.auth-disc { --hole: var(--paper); width: 170px; height: 170px; margin: 0 auto 34px; animation: spin 1.8s linear infinite; }
.auth-card h1 { font: 600 40px/1.05 var(--font-display); letter-spacing: -0.015em; margin-bottom: 10px; }
.auth-card > p { color: var(--ink-2); }
.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 30px; text-align: left; }
.auth-form .btn { width: 100%; margin-top: 6px; }
.auth-error {
  margin: 0;
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 15px/1.4 var(--font-ui);
  text-align: left;
  white-space: pre-wrap;
}
.auth-warn, .auth-small { margin-top: 20px; font-size: 14px; color: var(--ink-2); }

/* ---------- iPhone & schmale Fenster ---------- */

@media (max-width: 760px) {
  .detail { grid-template-columns: 1fr; gap: 26px; padding: 34px 22px 26px; }
  .detail-visual { width: 100%; max-width: 480px; justify-self: center; position: static; }
  .edit-body { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 14px 22px 0; }
  .edit-body .fields { display: contents; }
  .edit-body .autofill { order: -1; }
  .cover-edit { width: 100%; max-width: 320px; margin: 0 auto; }
  .sheet-head { padding: 20px 14px 2px 22px; }
  .sheet-title { font-size: 27px; }
  .sheet-foot { padding: 20px 22px calc(18px + env(safe-area-inset-bottom)); }
  .sheet-foot .btn { flex: 1; }
  .form-error { margin: 16px 22px 0; }
}

@media (max-width: 600px) {
  :root { --gutter: max(18px, env(safe-area-inset-left)); --gutter-r: max(18px, env(safe-area-inset-right)); }
  .masthead { padding-top: calc(20px + env(safe-area-inset-top)); }
  .brand-disc { width: 44px; height: 44px; }
  .top-actions { width: 100%; }
  .top-actions .btn { flex: 1; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px 20px; }
  .sticker { min-width: 42px; height: 42px; font-size: 16px; }
  .card-artist { font-size: 15px; }
  .card-album { font-size: 15px; }
  .stats { padding: 10px 18px 6px; }
  .stat b { font-size: 26px; }

  dialog.sheet, dialog.sheet-small {
    width: 100%;
    max-height: 94vh;
    max-height: 94dvh;
    margin: auto 0 0;
    border-radius: 26px 26px 0 0;
  }
  dialog.sheet[open] { animation: sheet-up 0.45s var(--ease) both; }
  @keyframes sheet-up { from { transform: translateY(100%); } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
