/* Kleiderschrank – Design
   Grund: dunkles Woll-Grau, Akzent: Messing wie ein Kleiderbügel.
   Die Farben der Kleidung sollen wirken, darum ist alles andere ruhig. */

:root {
  --grund: #1d1b19;
  --flaeche: #2a2724;
  --flaeche-2: #34302c;
  --linie: #45403a;
  --text: #f0eae2;
  --text-2: #b8afa4;
  --messing: #d9b25e;
  --messing-text: #1d1b19;
  --gefahr: #ef7a6c;
  --schrift: 'Bricolage Grotesque', system-ui, sans-serif;
  --r: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --grund: #e9e6e1;
    --flaeche: #f8f6f3;
    --flaeche-2: #efebe5;
    --linie: #d3cdc4;
    --text: #23201d;
    --text-2: #5f574e;
    --messing: #8d6a1c;
    --messing-text: #ffffff;
    --gefahr: #b3261e;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 400 17px/1.45 var(--schrift);
  min-height: 100dvh;
  padding-bottom: calc(108px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--messing); outline-offset: 2px; }

/* ---------- Kopf mit Kleiderstange ---------- */
.kopf {
  padding: calc(20px + env(safe-area-inset-top)) 16px 8px;
  max-width: 960px; margin: 0 auto;
}
.stange {
  height: 6px; border-radius: 3px; margin-bottom: 18px;
  background: linear-gradient(var(--messing), color-mix(in srgb, var(--messing) 60%, black));
}
.kopf h1 {
  margin: 0; font-weight: 800; font-size: clamp(2.2rem, 9vw, 3.4rem);
  line-height: 1; letter-spacing: -0.02em; font-variation-settings: 'opsz' 96;
}
.zahl { margin: 6px 0 0; color: var(--text-2); }

main { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ---------- Filter ---------- */
.filter { display: grid; gap: 10px; margin: 16px 0 20px; }
.filter:empty { display: none; }
.reihe { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.reihe::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--linie); background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--grund); border-color: var(--text); }
.chip.vorschlag::after {
  content: 'Vorschlag'; font-size: 0.72rem; padding: 1px 6px; border-radius: 6px;
  background: var(--messing); color: var(--messing-text);
}

/* ---------- Etiketten (Kleidungsstücke) ---------- */
.raster {
  display: grid; gap: 18px 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.etikett {
  position: relative; border: 0; padding: 26px 0 0; text-align: left; cursor: pointer;
  background: var(--flaeche); color: inherit;
  clip-path: polygon(16% 0, 84% 0, 100% 10%, 100% 100%, 0 100%, 0 10%);
  border-radius: 0 0 var(--r) var(--r);
  transition: transform 160ms ease-out;
}
.etikett:active { transform: scale(0.97); }
.etikett::before { /* Loch im Etikett */
  content: ''; position: absolute; top: 9px; left: 50%; width: 11px; height: 11px;
  margin-left: -5.5px; border-radius: 50%; background: var(--grund);
  box-shadow: 0 0 0 2px var(--messing);
}
.etikett .foto {
  display: block; aspect-ratio: 4 / 5; margin: 0 10px; border-radius: 8px;
  background: var(--flaeche-2); overflow: hidden;
}
.etikett img { width: 100%; height: 100%; object-fit: contain; display: block; }
.etikett .text { display: grid; gap: 2px; padding: 10px 12px 12px; }
.etikett .kat { font-weight: 600; }
.etikett .farbe { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 0.92rem; }

.tupfer {
  width: 14px; height: 14px; border-radius: 50%; flex: none; display: inline-block;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 25%, transparent);
}
.tupfer.gross { width: 44px; height: 44px; }

/* ---------- Leer ---------- */
.leer {
  grid-column: 1 / -1; text-align: center; padding: 48px 16px; color: var(--text-2);
  border: 2px dashed var(--linie); border-radius: var(--r);
}
.leer strong { display: block; color: var(--text); font-size: 1.25rem; margin-bottom: 6px; }

/* ---------- Untere Leiste ---------- */
.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--grund) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--linie);
}
.knopf {
  min-height: 56px; border-radius: var(--r); border: 1.5px solid var(--linie);
  background: var(--flaeche); display: inline-flex; align-items: center; justify-content: center;
  gap: 10px; font-weight: 600; cursor: pointer; padding: 0 14px; user-select: none; white-space: nowrap;
}
.knopf svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.knopf-haupt { background: var(--messing); color: var(--messing-text); border-color: var(--messing); }
.knopf.gefahr { color: var(--gefahr); background: transparent; }
.knopf.gefahr.sicher { background: var(--gefahr); color: var(--grund); border-color: var(--gefahr); }
.knopf:active { transform: scale(0.98); }

/* ---------- Blatt (Dialog) ---------- */
dialog {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px;
  max-height: 94dvh; background: var(--flaeche); color: var(--text);
  border-radius: 22px 22px 0 0;
}
@media (min-width: 640px) { dialog { margin: auto; border-radius: 22px; } }
dialog::backdrop { background: rgb(0 0 0 / 0.55); }
dialog[open] { animation: hoch 260ms cubic-bezier(.2,.8,.2,1); }
@keyframes hoch { from { transform: translateY(40px); opacity: 0; } }
.blatt { padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.blatt-kopf { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; }
.blatt-kopf h2 { margin: 0; font-size: 1.4rem; font-weight: 800; }
.zu { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--flaeche-2); cursor: pointer; font-size: 1.1rem; }
.vorschau { background: var(--flaeche-2); border-radius: var(--r); aspect-ratio: 4 / 3; overflow: hidden; }
.vorschau img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* Freigestellte Teile liegen auf einem feinen Karomuster, damit man sieht: kein Hintergrund */
.vorschau.frei {
  background-color: var(--flaeche-2);
  background-image: conic-gradient(color-mix(in srgb, var(--text) 6%, transparent) 25%, transparent 0 50%, color-mix(in srgb, var(--text) 6%, transparent) 0 75%, transparent 0);
  background-size: 20px 20px;
}
.hg-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: -4px; }
.knopf.klein { min-height: 44px; font-size: 0.95rem; }
.hg-hinweis { margin: 0; color: var(--gefahr); font-size: 0.92rem; }
.laden p { white-space: pre-line; text-align: center; margin: 0; padding: 0 24px; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.farbe-jetzt { display: flex; align-items: center; gap: 12px; }
.farbe-jetzt strong { display: block; font-size: 1.15rem; }
.farbe-jetzt small { color: var(--text-2); }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.palette button {
  aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 25%, transparent);
}
.palette button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--flaeche), 0 0 0 5px var(--messing); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.blatt-fuss { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }
.blatt-fuss .knopf-haupt { flex: 1; }

/* ---------- Laden ---------- */
.laden {
  position: fixed; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: color-mix(in srgb, var(--grund) 85%, transparent);
}
.laden span {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid var(--linie); border-top-color: var(--messing);
  animation: dreh 0.9s linear infinite;
}
@keyframes dreh { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }

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