:root {
  --night:   #0e2028;
  --panel:   #16303b;
  --edge:    #23434f;
  --sand:    #f0e6d6;
  --sand-dim:#9db0b5;
  --amber:   #f0a73c;
  --rust:    #c4634e;
  --radius:  14px;
}

* { box-sizing: border-box; }

/* Muss vor den Layoutregeln stehen: Klassen wie .gate setzen display:flex
   und würden das hidden-Attribut sonst überstimmen. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--night);
  color: var(--sand);
  font: 400 16px/1.5 Inter, system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

button, input { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ---------- PIN-Schleuse ---------- */
.gate {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  max-width: 26rem;
  margin-inline: auto;
}
.gate__title {
  font-family: 'Bricolage Grotesque', Inter, sans-serif;
  font-weight: 700;
  font-size: clamp(2.6rem, 12vw, 3.4rem);
  line-height: 1;
  margin: 0;
  letter-spacing: -0.03em;
}
.gate__text { margin: 0; color: var(--sand-dim); }
.gate__row { display: flex; gap: 10px; margin-top: 8px; }

.pin {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 14px 16px;
  letter-spacing: 0.06em;
}
.pin::placeholder { color: #5b7178; letter-spacing: 0.06em; }

.btn {
  background: var(--amber);
  color: #14232a;
  border: 0;
  border-radius: var(--radius);
  padding: 14px 22px;
  font-weight: 600;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }

/* ---------- Was gerade läuft ---------- */
.now {
  position: relative;
  display: flex;
  gap: 16px;
  align-items: flex-end;
  padding: 28px 20px 24px;
  min-height: 168px;
  overflow: hidden;
  border-bottom: 1px solid var(--edge);
}
.now::after {                     /* Verlauf über das unscharfe Cover */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #0e2028aa 0%, #0e2028e8 55%, var(--night) 100%);
  z-index: 1;
}
.now__backdrop {
  position: absolute;
  inset: -40px;
  background-size: cover;
  background-position: center;
  filter: blur(38px) saturate(1.3);
  opacity: 0.55;
  z-index: 0;
}
.now__art, .now__meta { position: relative; z-index: 2; }

.now__art {
  width: 84px;
  height: 84px;
  flex: none;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 10px 30px #00000066;
}
.now__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.now__art:empty, .now__art img:not([src]) { opacity: 0; }

.now__meta { min-width: 0; }
.now__state {
  margin: 0 0 4px;
  font-size: 0.8125rem;
  color: var(--amber);
}
.now__title {
  font-family: 'Bricolage Grotesque', Inter, sans-serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 7vw, 2rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
  overflow-wrap: anywhere;
}
.now__artist { margin: 6px 0 0; color: var(--sand-dim); font-size: 0.9375rem; }

/* ---------- Suche ---------- */
.search {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 20px;
  background: var(--night);
  border-bottom: 1px solid var(--edge);
}
.search__input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.search__input::placeholder { color: var(--sand-dim); }
.search__input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }

/* ---------- Meldungen ---------- */
.msg {
  margin: 0;
  padding: 0 20px;
  min-height: 0;
  font-size: 0.9375rem;
  color: var(--sand-dim);
}
.msg:not(:empty) { padding-block: 12px; }
.msg[data-tone='ok']   { color: var(--amber); }
.msg[data-tone='bad']  { color: var(--rust); }

/* ---------- Trefferliste ---------- */
.list { list-style: none; margin: 0; padding: 0; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  border-bottom: 1px solid #ffffff0f;
}
.row__art {
  width: 52px; height: 52px; flex: none;
  border-radius: 8px; object-fit: cover; background: var(--panel);
}
.row__text { flex: 1; min-width: 0; }
.row__name {
  margin: 0;
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row__sub {
  margin: 2px 0 0;
  font-size: 0.875rem;
  color: var(--sand-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row__add {
  flex: none;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--amber);
  background: transparent;
  color: var(--amber);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.row__add:hover { background: var(--amber); color: #14232a; }
.row__add[data-done='1'] {
  background: var(--amber);
  color: #14232a;
  border-color: var(--amber);
  font-size: 1.1rem;
}
.row__add:disabled { opacity: .45; cursor: default; }

/* ---------- Zuletzt gewünscht ---------- */
.recent { padding: 22px 20px 0; }
.recent__head {
  margin: 0 0 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--sand-dim);
}
.recent__list {
  margin: 0;
  padding-left: 1.1em;
  color: var(--sand-dim);
  font-size: 0.9375rem;
}
.recent__list li { margin-bottom: 4px; }

.foot {
  padding: 26px 20px 34px;
  color: #6f858c;
  font-size: 0.8125rem;
  max-width: 34rem;
}

@media (min-width: 640px) {
  .now, .search, .msg, .row, .recent, .foot { padding-inline: max(20px, calc(50vw - 20rem)); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}