:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); /* kräftigeres ease-out für Oberflächen-Bewegung */
  color-scheme: light;
  --bg: #fff;
  --surface: #fff;
  --on-text: #fff;
  --text: #111;
  --muted: #767676;
  --gray: #efefef;
  --gray-hover: #e2e2e2;
  --red: #e60023;
  --red-hover: #ad081b;
  --field: #cdcdcd;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212; --surface: #232323; --on-text: #111; --text: #f1f1f1; --muted: #a3a3a3;
  --gray: #2a2a2a; --gray-hover: #3a3a3a; --field: #4a4a4a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121212; --surface: #232323; --on-text: #111; --text: #f1f1f1; --muted: #a3a3a3;
    --gray: #2a2a2a; --gray-hover: #3a3a3a; --field: #4a4a4a;
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); overflow-x: hidden; overscroll-behavior-x: none; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; overflow-x: clip; overscroll-behavior-x: none;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
}
button, input, select { font: inherit; color: inherit; }

/* Kopfzeile */
.top {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px;
  background: var(--bg); position: sticky; top: 0; z-index: 10;
}
.top h1 { margin: 0 16px 0 0; font-size: 26px; font-weight: 800; color: var(--red); letter-spacing: -.02em; line-height: 1; }
.tabs { display: flex; gap: 4px; }
.tab { border: 0; background: none; font-weight: 600; padding: 12px 16px; border-radius: 10px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .tab:hover { background: var(--gray); } }
.tab.active { background: var(--text); color: var(--on-text); }
.badge { font-size: 12px; color: var(--muted); margin-left: 4px; }
.tab.active .badge { color: var(--on-text); opacity: .6; }

main { padding: 8px 24px 48px; max-width: 1600px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.spacer { flex: 1; }
hr { border: 0; border-top: 1px solid var(--gray-hover); margin: 16px 0; }

/* Buttons und Felder */
.btn {
  border: 0; background: var(--gray); font-weight: 600; padding: 12px 16px; border-radius: 10px; cursor: pointer;
  display: inline-block; text-align: center;
}
@media (hover: hover) and (pointer: fine) { .btn:hover:not(:disabled) { background: var(--gray-hover); } }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--red); color: #fff; }
@media (hover: hover) and (pointer: fine) { .btn.primary:hover:not(:disabled) { background: var(--red-hover); } }
.btn.danger { color: var(--red); }
dialog.wide { width: min(920px, 94vw); max-height: 90vh; max-height: 90dvh; overflow: auto; }
dialog.wide h2 { margin: 0; }
.rotate { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.rotate .icon { width: 36px; height: 36px; flex: none; font-size: 18px; }
.rotate input[type=range] { flex: 1; accent-color: var(--text); }
.layer .rot {
  display: none; position: absolute; left: 50%; top: -32px; width: 18px; height: 18px; margin-left: -9px;
  background: #fff; border: 2px solid #0074e8; border-radius: 50%; cursor: grab;
}
.layer.selected .rot { display: block; }
.intro { max-width: 60ch; margin: 4px 0 16px; }
.combos { columns: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 24px 16px; align-items: start; }
.combo { margin: 0; }
.palette { display: flex; height: 150px; border-radius: 16px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.palette div { flex: 1; display: flex; align-items: flex-end; padding: 8px; font-size: 12px; font-weight: 600; }
.combo b { display: block; margin-top: 8px; font-size: 15px; }
.combo p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.top .backup { margin-left: auto; }
.menu { margin-left: auto; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; }
.pw-msg { font-size: 14px; min-height: 20px; margin: 0 0 8px; }
.pw-msg.err { color: #c4202e; }
.set-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.set-head h2 { margin: 0; }
.set-head .icon { flex: none; }
.set-row {
  display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left;
  background: var(--gray); border: 0; border-radius: 10px; padding: 16px 16px; margin-bottom: 8px;
  font-weight: 600; cursor: pointer;
}
.set-row::after { content: "›"; font-size: 22px; line-height: 1; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .set-row:hover { background: var(--gray-hover); } }
.set-panel[hidden] { display: none; }
dialog h2 { margin: 0 0 8px; font-size: 22px; }
.dropbox { display: block; text-align: center; background: var(--gray); border: 2px dashed transparent; border-radius: 16px; padding: 24px 16px; margin: 8px 0 12px; cursor: pointer; font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .dropbox:hover { background: var(--gray-hover); } }
.dropbox.over { border-color: var(--text); }
.batch { border-top: 1px solid var(--gray-hover); padding-top: 16px; margin-bottom: 16px; }
.batch[hidden] { display: none; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 8px; cursor: pointer; }
.btn.full { width: 100%; margin-bottom: 16px; }
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }

.field, .field-inline { display: flex; flex-direction: column; gap: 8px; font-size: 13px; margin-bottom: 16px; }
.field-inline { margin: 0; }
input[type=text], input[type=email], input[type=password], select {
  background: var(--surface); border: 2px solid var(--field); border-radius: 16px; padding: 12px 16px; width: 100%; font-size: 16px;
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, select:focus { outline: 0; border-color: #0074e8; }

/* Details und Sichtbarkeit in den Bearbeiten-Dialogen */
.more { margin-bottom: 16px; }
.more summary { cursor: pointer; font-weight: 700; font-size: 14px; padding: 8px 0 12px; }
.more-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
@media (max-width: 420px) { .more-grid { grid-template-columns: 1fr; } }

/* Upload */
.upload {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--gray); border-radius: 24px; padding: 24px 24px; margin-bottom: 24px;
  border: 2px dashed transparent;
}
.upload p { margin: 4px 0 0; }
.upload.over { border-color: var(--text); }
.upload-actions { display: flex; gap: 12px; align-items: flex-end; }

/* Filter */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { border: 0; background: var(--gray); font-weight: 600; font-size: 14px; padding: 8px 16px; border-radius: 10px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .chip:hover { background: var(--gray-hover); } }
.chip.active { background: var(--text); color: var(--on-text); }
.subchips { flex-basis: 100%; display: flex; gap: 8px; flex-wrap: wrap; padding-left: 24px; }

/* Raster: alle Karten stehen in einer Reihe, gleich große Bildfelder */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 24px 16px; align-items: start; }
.card { margin: 0; display: block; width: 100%; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.card .img { --pad: 14px; position: relative; aspect-ratio: 4 / 5; background: var(--gray); border-radius: 16px; display: block; transition: background .15s; }
@media (hover: hover) and (pointer: fine) { .card:hover .img { background: var(--gray-hover); } }
.card .img img { position: absolute; inset: var(--pad); width: calc(100% - 2 * var(--pad)); height: calc(100% - 2 * var(--pad)); object-fit: contain; }
.card .meta { padding: 8px 4px 0; }
.card .meta b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta span { font-size: 12px; color: var(--muted); }
.outfits { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.outfits .card { cursor: default; }
.outfits .card .img { --pad: 0px; aspect-ratio: 9 / 16; overflow: hidden; background: #fff; border: 1px solid var(--gray-hover); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 0; }
.card-actions .btn { padding: 8px 12px; font-size: 13px; }
.card-actions .btn[hidden] { display: none; }

.empty { text-align: center; color: var(--muted); padding: 48px 16px; display: none; }
.empty.show { display: flex; }

/* Outfit bauen */
.builder { display: grid; grid-template-columns: 260px minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
.picker { max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px); overflow: auto; overscroll-behavior: contain; }
.panel { background: var(--gray); border-radius: 24px; padding: 24px; }
.picker .chips { margin-bottom: 12px; }
.picker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.picker { min-width: 0; }
.pick { aspect-ratio: 1; border: 0; border-radius: 16px; background: var(--gray); padding: 8px; cursor: pointer; display: grid; place-items: center; }
@media (hover: hover) and (pointer: fine) { .pick:hover { background: var(--gray-hover); } }
.pick.active { box-shadow: inset 0 0 0 3px var(--text); }
.pick img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }

.stage-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.layer-tools { display: flex; gap: 8px; }
.layer-tools[hidden] { display: none; }
.icon { width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--gray); cursor: pointer; display: grid; place-items: center; }
@media (hover: hover) and (pointer: fine) { .icon:hover { background: var(--gray-hover); } }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--field); padding: 0; cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 2px var(--gray), 0 0 0 4px var(--text); }
.swatch.custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatch.custom input { position: absolute; inset: -6px; width: 44px; height: 44px; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.panel .row { flex-wrap: nowrap; gap: 8px; }
.panel .row .btn { padding: 8px 12px; }
.panel .hint { margin: 16px 0 0; }
.stage {
  position: relative; width: 100%; max-width: 420px; aspect-ratio: 9/16; background: #fff;
  border: 1px solid var(--gray-hover); border-radius: 24px; overflow: hidden; touch-action: pan-y; user-select: none;
}
.stage-hint { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #aaa; padding: 24px; margin: 0; pointer-events: none; }
.layer { position: absolute; cursor: grab; touch-action: pan-y; }
.layer.selected { touch-action: none; } /* erst nach dem ersten Antippen ziehbar, sonst scrollt die Seite */
.layer img { display: block; width: 100%; height: auto; pointer-events: none; -webkit-user-drag: none; }
.layer.selected { outline: 2px solid #0074e8; outline-offset: 2px; }
.layer .handle {
  display: none; position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px;
  background: #fff; border: 2px solid #0074e8; border-radius: 50%; cursor: nwse-resize;
}
.layer.selected .handle { display: block; }

/* Dialoge */
dialog { border: 0; border-radius: 32px; background: var(--bg); color: var(--text); padding: 24px; width: min(400px, 92vw); box-shadow: 0 8px 40px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog img { display: block; width: 100%; max-height: 260px; object-fit: contain; background: var(--gray); border-radius: 16px; margin-bottom: 16px; padding: 8px; }
.up-preview {
  position: relative; height: 280px; display: block; overflow: auto; border-radius: 16px; margin-bottom: 12px; padding: 8px;
  background: repeating-conic-gradient(#ececec 0 25%, #fff 0 50%) 0 0 / 16px 16px; /* Schachbrett zeigt Transparenz */
}
.up-zoom { position: relative; --z: 1; width: calc(var(--z) * 100%); height: calc(var(--z) * 100%); display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; }
.up-zoom img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; background: none; padding: 0; margin: 0; border-radius: 0; }
.up-zoom.busy img { opacity: .4; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--on-text); padding: 12px 24px; border-radius: 12px; font-size: 14px; transition: transform .2s var(--ease-out), opacity .2s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  main { padding: 8px 16px 48px; }
  .top { padding: 8px 16px; flex-wrap: wrap; }
}

/* ---------- iPad / Tablet ---------- */
@media (min-width: 701px) and (max-width: 1100px) and (orientation: portrait) {
  /* Bild links, Auswahl und Bedienfeld rechts: alles auf einen Blick */
  .builder { grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto 1fr; gap: 24px; }
  .stage-wrap { grid-column: 1; grid-row: 1 / span 2; }
  .picker { grid-column: 2; grid-row: 1; max-height: 46vh; }
  .panel { grid-column: 2; grid-row: 2; }
  .picker-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage { max-width: min(100%, calc(76vh * 9 / 16)); }
  .grid, .outfits { gap: 16px 16px; }
  .combos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Handy ---------- */
dialog { max-height: 92vh; max-height: 92dvh; overflow: auto; }

@media (max-width: 700px) {
  /* Kopfzeile: Titel links, Sicherung rechts; Tabs wandern als Leiste nach unten */
  .top { padding: 8px 16px; flex-wrap: nowrap; }
  .top h1 { margin: 0; font-size: 22px; }
  .menu { width: 40px; height: 40px; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; gap: 0;
    background: var(--bg); border-top: 1px solid var(--gray-hover);
    padding: 8px 8px calc(12px + env(safe-area-inset-bottom));
  }
  .tab { flex: 1 1 0; min-width: 0; padding: 12px 4px; font-size: 14px; text-align: center; }
  main { padding: 4px 12px calc(96px + env(safe-area-inset-bottom)); }

  /* Raster: zwei Spalten */
  .grid, .outfits { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 8px; }
  .card .img { --pad: 8px; border-radius: 14px; }
  .card .meta b { font-size: 13px; }
  .card-actions { flex-wrap: wrap; }

  /* Upload kompakter, „ziehen“ gibt es auf dem Handy nicht */
  .upload { padding: 16px; border-radius: 18px; margin-bottom: 16px; }
  .upload > div:first-child p { display: none; }
  .upload-actions { width: 100%; }
  .upload-actions .field-inline { flex: 1; }
  .chips { margin-bottom: 12px; }

  /* Outfit bauen: Name und Speichern oben, darunter das Bild, dann Hintergrund und Auswahl.
     Das Panel löst sich auf (display: contents), seine Teile werden einzeln angeordnet. */
  .builder { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .panel { display: contents; }
  .panel > .field:first-child { order: 0; margin: 0; }
  .panel > .row { order: 6; margin: 0; }
  .stage-wrap { order: 2; }
  .panel > .field:nth-child(2) { order: 3; margin: 0; }
  .panel > .field:nth-child(3) { order: 5; margin: 0; }
  .picker { order: 4; }
  .panel .hint { display: none; }
  .builder .panel .btn:not(.primary) { background: var(--gray); }
  @media (hover: hover) and (pointer: fine) { .builder .panel .btn:not(.primary):hover:not(:disabled) { background: var(--gray-hover); } }
  .stage { max-width: min(100%, calc(60vh * 9 / 16)); border-radius: 18px; }
  .picker-grid { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 8px; overflow-y: hidden; scroll-snap-type: x proximity; }
  .pick { flex: none; width: 84px; height: 84px; aspect-ratio: auto; scroll-snap-align: start; overflow: hidden; }
  .pick img { max-width: 68px; max-height: 68px; }
  .layer-tools { flex-wrap: wrap; justify-content: center; }

  /* Dialoge nutzen die Breite */
  dialog { width: 94vw; padding: 16px; border-radius: 24px; }
  .combos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 8px; }
  .palette { height: 110px; }
  .palette div { padding: 8px; font-size: 11px; }
  .up-preview { height: 220px; }
}

/* Fingerfreundlichere Griffe am ausgewählten Teil */
@media (pointer: coarse) {
  .layer .handle { width: 28px; height: 28px; right: -14px; bottom: -14px; }
  .layer .rot { width: 28px; height: 28px; top: -44px; margin-left: -14px; }
  .btn, .chip { min-height: 40px; }
}

/* Touchgeräte allgemein (iPad, Handy): kein Doppeltipp-Zoom, keine Lupe oder Menü beim langen Drücken auf Teilen */
button, a, summary, select, label.btn, .tab, .chip, .pick, .card, .icon { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* Beschriftung von Bedienelementen nicht markierbar (Inhalte bleiben markierbar) */
button, .tab, .chip, .icon, label.btn, summary { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.layer, .layer img { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }

/* Auf dem grauen Panel brauchen Buttons einen hellen Untergrund, sonst sieht man sie nicht */
.panel .btn:not(.primary) { background: var(--surface); }
@media (hover: hover) and (pointer: fine) { .panel .btn:not(.primary):hover:not(:disabled) { background: var(--gray-hover); } }

/* Querformat mit wenig Höhe (iPad quer, kleine Laptops): ganzes Bild ohne Scrollen sichtbar */
@media (min-width: 901px) and (max-height: 900px) {
  .stage { max-width: min(100%, calc((100vh - 160px) * 9 / 16)); }
}

/* Notiz (z. B. Preis) unter der Kategorie; Platzhalter ist grau und verschwindet beim Tippen */
input::placeholder { color: #a8a8a8; opacity: 1; }
.card .meta .note { display: block; font-style: normal; font-size: 12px; color: var(--text); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta .note:empty { display: none; }

/* Kategorie-Auswahl: schlichtes Feld ohne System-Optik, eigener Pfeil */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background-color: var(--gray);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 14px;
  border: 0; border-radius: 12px; padding: 12px 48px 12px 16px; font-weight: 600; min-width: 190px;
}
@media (hover: hover) and (pointer: fine) { select:hover { background-color: var(--gray-hover); } }
select:focus-visible { outline: 0; box-shadow: 0 0 0 2px #0074e8; }
.upload select { background-color: var(--surface); }
@media (hover: hover) and (pointer: fine) { .upload select:hover { background-color: var(--gray-hover); } }

/* Beschriftung „Kategorie“ im Upload-Bereich kräftiger */
.upload .field-inline { font-size: 14px; font-weight: 700; }

@media (max-width: 700px) { .tab { font-size: 13px; padding: 12px 4px; } }

/* Anmeldung */
.locked .top, .locked main { display: none; }
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.auth[hidden] { display: none; }
.auth-card { width: 100%; max-width: 360px; }
.auth-card h1 { margin: 0 0 4px; font-size: 40px; font-weight: 800; color: var(--red, #e60023); letter-spacing: -.02em; }
.auth-card h2 { margin: 0 0 24px; font-size: 20px; }
.auth-card input { font-size: 16px; }
.auth-error { color: #c4202e; font-size: 14px; min-height: 20px; margin: 0 0 8px; }
.account { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--gray); border-radius: 16px; padding: 16px 16px; margin-bottom: 16px; }
.icon[hidden], .btn[hidden] { display: none; }

/* Bereich einzeichnen */
.up-draw-row .grow { flex: 1; white-space: nowrap; }
.up-draw-row .btn { padding: 12px 8px; }
.field[hidden] { display: none; }
.up-mode { margin-bottom: 12px; }
.up-draw-row[hidden], .up-draw-row .btn[hidden] { display: none; }
.up-draw { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; border-radius: 16px; }
.btn.on { background: var(--text); color: var(--on-text); }

/* Hochladen-Fenster am Computer breiter, mit größerer Vorschau */
@media (min-width: 701px) {
  #uploadDialog { width: min(620px, 92vw); }
  #uploadDialog .up-preview { height: 340px; }
}

/* Beim Bearbeiten bleibt das Foto oben stehen, während man die Werkzeuge darunter benutzt */
#itemDialog.editing .up-preview { position: sticky; top: 0; z-index: 3; box-shadow: 0 6px 0 var(--bg); }

/* Ausrufezeichen am Outfit, wenn ein Teil daraus gelöscht wurde */
.outfits .card .img { position: relative; }
.card .warn {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; padding: 0;
  border: 0; background: #ffb020; color: #111; font-weight: 800; font-size: 15px; line-height: 24px; text-align: center; cursor: pointer;
}

dialog.tooling .up-preview { position: sticky; top: 0; z-index: 3; box-shadow: 0 6px 0 var(--bg); }

/* ---------- Gäste und öffentliche Profile ---------- */
.guest-actions { margin-left: auto; display: flex; gap: 8px; }
.guest-actions[hidden] { display: none; }
.guest .menu { display: none; }
.viewing-profile main { display: none; }
.landing, .public { max-width: 960px; margin: 0 auto; padding: 24px 24px 48px; }
.landing[hidden], .public[hidden] { display: none; }
/* Fremdes Profil: so breit wie das eigene, Kopf und Reiter bleiben schmal */
#publicView { max-width: 1600px; padding-top: 8px; }
@media (min-width: 701px) { .public > .me-head, .public > .pub-tools, .public > .subtabs, .public > .pub-banner { max-width: 790px; } }
.landing h2 { font-size: 30px; margin: 0 0 8px; letter-spacing: -.02em; }
.find { display: flex; gap: 8px; margin: 16px 0 8px; max-width: 460px; }
.pub-back { margin-bottom: 16px; }
.pub-banner { background: var(--gray); border-radius: 14px; padding: 8px 16px; font-size: 13px; margin: 0 0 16px; }
.pub-section { margin-bottom: 24px; }
.pub-section h3 { margin: 0 0 8px; font-size: 18px; }
.pub-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.pub-tag { font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 999px; background: var(--gray); }
.pub-tag.hot { background: var(--text); color: var(--on-text); }
@media (max-width: 700px) {
  .guest-actions .btn { padding: 8px 12px; font-size: 14px; }
  .landing, .public { padding: 24px 16px 48px; }
}

/* ---------- Hinzufügen-Seite, Plus-Reiter, neue Outfit-Kachel ---------- */
.upload[hidden] { display: none; }
.page-title { margin: 4px 0 16px; font-size: 24px; letter-spacing: -.02em; }
.builder-back { margin: 4px 0 12px; }
.outfits .add-card { cursor: pointer; }
.outfits .add-card .img {
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--text) 9%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
@media (hover: hover) and (pointer: fine) { .outfits .add-card:hover .img { background: color-mix(in srgb, var(--text) 14%, transparent); } }
.add-card .plus { display: block; color: var(--muted); }

/* ---------- Suche im Schrank ---------- */
.search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.search input { flex: 1 1 220px; min-width: 0; }
.search .chips { margin: 0; flex-wrap: nowrap; }
.member-results { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.member-results[hidden] { display: none; }
.member { text-align: left; padding: 16px 16px; border: 0; border-radius: 14px; background: var(--gray); font-weight: 600; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .member:hover { background: var(--gray-hover); } }

/* ---------- Interesse, Treffer, Mitteilungen ---------- */
.pub-action { margin-top: 8px; padding: 8px 12px; font-size: 13px; }
.pub-tag.match { background: #1f7a3d; color: #fff; }
.pub-banner.match { background: #1f7a3d; color: #fff; }
.menu { position: relative; }
.menu.has-unread::after, .menu.has-reports::after { content: ''; position: absolute; top: 7px; right: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); border: 2px solid var(--bg); }
.inbox-item { padding: 12px 0; border-bottom: 1px solid var(--gray-hover); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.inbox-item.unread b::before { content: '● '; color: var(--red); }
.inbox-item p { margin: 0; }

/* ---------- Plus neben den Kategorien (Computer und Handy) ---------- */
.filter-row { display: flex; align-items: center; gap: 12px; }
.filter-row .chips { flex: 1; min-width: 0; margin-bottom: 0; }
.filter-row { margin-bottom: 16px; }
@media (max-width: 700px) {
  /* Am Handy scrollen die Kategorien seitwärts, damit das Plus rechts daneben Platz hat */
  .filter-row .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .filter-row .chips::-webkit-scrollbar { display: none; }
  .filter-row .chip { flex: none; }
}

/* Phase 5: Kaufanfrage, Melden, Sperren */
.pub-tools { display: flex; gap: 8px; margin: -8px 0 16px; }
.pub-tools .btn { padding: 8px 12px; font-size: 13px; }
.pub-report { display: block; margin-top: 8px; background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--muted, #888); text-decoration: underline; cursor: pointer; }
.pay-hint { background: var(--gray); border-radius: 12px; padding: 8px 12px; font-size: 12.5px; margin: 0 0 12px; }

/* Artikelsuche */
.member-results .grid { width: 100%; }
.member-results:has(.grid) { display: block; }

/* Hochladen-Fenster: füllt am Handy die Breite, lässt sich nicht zur Seite schieben, das Foto scrollt mit */
#uploadDialog { overflow-x: hidden; overscroll-behavior: contain; }
#uploadDialog .up-preview, #uploadDialog.tooling .up-preview { position: relative; box-shadow: none; }
@media (max-width: 700px) {
  #uploadDialog { width: 100vw; max-width: 100vw; margin: auto 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; max-height: 94vh; max-height: 94dvh; }
  #uploadDialog .up-preview { height: 46vh; height: 46dvh; max-height: 420px; }
}

.so-head { margin-bottom: 12px; }
.so-head input { width: 100%; }
.so-history { margin-bottom: 16px; }
.so-history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.so-link { background: none; border: 0; padding: 4px; font-size: 13px; color: var(--muted); text-decoration: underline; cursor: pointer; }
.so-history-row { display: flex; align-items: center; gap: 4px; }
.so-history-item { flex: 1; min-width: 0; text-align: left; padding: 12px 4px; border: 0; background: none; font-weight: 600; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-del { background: none; width: 36px; height: 36px; flex: none; font-size: 22px; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .so-del:hover { background: var(--gray); } }

.so-suggest { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; padding: 12px 4px; border: 0; border-bottom: 1px solid var(--gray); background: none; text-align: left; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .so-suggest:hover { background: var(--gray); } }
.member-results:has(.so-suggest) { gap: 0; }

/* Hinzufügen/Überspringen bleiben immer sichtbar, auch wenn das Fenster scrollt (dvh: ohne Browserleisten gerechnet) */
#uploadDialog .up-actions { position: sticky; bottom: -1px; z-index: 4; background: var(--bg); padding: 8px 0 4px; box-shadow: 0 -8px 8px -8px rgba(0, 0, 0, .12); }
@media (max-width: 700px) {
  #uploadDialog { max-height: 94dvh; }
  #uploadDialog .up-preview { height: 38dvh; max-height: 360px; }
}

/* ---------- Aufbau wie bei Vinted: Feed, Suche, Hinzufügen, Nachrichten, Profil ---------- */
.tab { display: inline-flex; align-items: center; gap: 8px; position: relative; }
.tab-ic { display: none; }
.tab-badge { margin-left: 4px; }
.tab-badge:empty { display: none; }

.me-bar { margin: 0 0 16px; }
.me-head { display: flex; align-items: center; gap: 16px; padding: 4px 0 16px; }
.me-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.me-info strong { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; background: var(--gray); font-weight: 700; font-size: 22px; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 12px; }
.me-bar[hidden] { display: none; }
.subtabs { display: flex; border-bottom: 1px solid var(--gray-hover); }
.subtab { flex: 1; border: 0; background: none; padding: 12px 8px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.subtab.active { color: var(--text); border-bottom-color: var(--text); }
.subtab .badge { font-weight: 600; }

.feed-switch { margin-bottom: 16px; }
.feed-card { cursor: default; }
.feed-owner { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 0 0 8px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-align: left; }
.feed-owner span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-img { width: 100%; border: 0; padding: 0; cursor: pointer; }
.feed-card .meta { display: flex; flex-direction: column; gap: 4px; }
.feed-card .meta .feed-name { font-weight: 600; }
.feed-card .meta .feed-price { font-size: 15px; margin-top: 4px; }
.feed-card .meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-card .meta span:not(.muted) { color: var(--text); font-size: 13px; }
.feed-more { display: flex; justify-content: center; padding: 24px 0; }
.feed-more .btn[hidden] { display: none; }
#feedEmpty:not([hidden]) { display: flex; }
#feedEmpty[hidden] { display: none; }


@media (max-width: 700px) {
  /* Untere Leiste: fünf gleich breite Felder, Symbol über der Beschriftung, Hinzufügen groß in der Mitte */
  .tabs { align-items: stretch; padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); }
  .tab { flex: 1 1 0; flex-direction: column; justify-content: center; gap: 4px; padding: 8px 4px; font-size: 11px; border-radius: 0; background: none; color: var(--muted); }
  @media (hover: hover) and (pointer: fine) { .tab:hover { background: none; } }
  .tab.active { background: none; color: var(--text); }
  .tab-ic { display: block; }
  .tab-label { font-size: 11px; line-height: 1.2; }
  .tab-badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
  .subtab { font-size: 14px; }
  .me-head .avatar { width: 48px; height: 48px; }
}
@media (min-width: 701px) {
  .feed-grid, .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .me-bar, .so-head, .search-mode, .so-history, #view-search .member-results { max-width: 760px; }
}

/* ---------- Unterhaltungen ---------- */
.thread-row { width: 100%; border: 0; border-bottom: 1px solid var(--gray-hover); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; display: grid; grid-template-columns: 24px 1fr; column-gap: 8px; row-gap: 4px; align-items: center; }
.thread-row .avatar { grid-row: span 3; align-self: start; }
.thread-top { display: flex; justify-content: space-between; gap: 8px; }
.thread-last { grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.thread-who { border: 0; background: none; font: inherit; font-weight: 700; font-size: 17px; cursor: pointer; padding: 0; color: inherit; }
.thread-msgs { display: flex; flex-direction: column; gap: 8px; flex: 1; overflow-y: auto; padding: 8px 0 12px; }
.offer-card { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0; padding: 12px; border-radius: var(--r-card); background: var(--gray); }
.offer-card .offer-status { font-size: 13px; padding: 2px 8px; border-radius: 99px; background: var(--bg, #fff); }
.offer-card .offer-note { flex-basis: 100%; margin: 0; }
.offer-card .offer-actions { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.bubble { align-self: flex-start; max-width: 80%; background: var(--gray); border-radius: 16px; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.bubble.mine { align-self: flex-end; background: var(--text); color: var(--on-text); }
.bubble.mine .muted { color: inherit; opacity: .7; }
.thread-form { display: flex; gap: 8px; align-items: stretch; }
.thread-form input[type=text] { flex: 1; min-width: 0; height: 46px; }
.thread-form .btn { height: 46px; padding-top: 0; padding-bottom: 0; }
.thread-photo { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--gray); display: grid; place-items: center; cursor: pointer; color: var(--text); }
@media (hover: hover) and (pointer: fine) { .thread-photo:hover { background: var(--gray-hover); } }
.bubble-img img { display: block; width: 100%; max-width: 240px; max-height: 280px; object-fit: cover; border-radius: 12px; margin: 0; padding: 0; background: none; }
/* Chat füllt die Seite, die Eingabeleiste sitzt unten am Bildschirmrand */
#threadPane:not([hidden]) { display: flex; flex-direction: column; height: calc(100dvh - 150px); min-height: 360px; }
.thread-form { position: sticky; bottom: calc(14px + env(safe-area-inset-bottom)); background: var(--bg); padding-top: 8px; }
@media (max-width: 700px) {
  body.in-thread .tabs { display: none; }
  body.in-thread main { padding-bottom: 8px; }
  #threadPane:not([hidden]) { height: calc(100dvh - 110px); }
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 .field { min-width: 0; }

/* Dialoge: feste Breite, nur senkrecht scrollen */
dialog { overflow-x: hidden; overscroll-behavior-x: none; }
dialog .field input, dialog .field select, dialog .field textarea { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }

/* Kategorie-Felder oben: alle gleich groß */
.filter-row .chip, #pickerFilter .chip, .subchips .chip { flex: none; width: 124px; padding-left: 8px; padding-right: 8px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Farbfilter im Feed */

/* Filter in der Suche */
.so-filters { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr; gap: 8px; margin: 0 0 16px; }
.so-filters[hidden] { display: none; }
.so-filters select, .so-filters input { width: 100%; min-width: 0; box-sizing: border-box; height: 42px; }
@media (min-width: 701px) { .so-filters { max-width: 760px; } }

/* =====================================================================
   Einheitliches Design: gleiche Ecken, Höhen und Abstände überall
   Farben und Schriften bleiben unverändert.
   ===================================================================== */
:root {
  --r-ctrl: 12px;   /* Knöpfe, Felder, Reiter, Auswahl */
  --r-card: 16px;   /* Karten, Bilder, Vorschauen */
  --r-panel: 24px;  /* Fenster, große Flächen */
  --h-ctrl: 48px;   /* Standardhöhe von Knöpfen und Feldern */
  --h-chip: 40px;   /* Filter-Felder */
  --h-sm: 36px;     /* kleine Knöpfe in Karten und Leisten */
  --gap: 16px;      /* Standardabstand zwischen Blöcken */
  --pad-page: 24px; /* Seitenrand am Computer */
}

/* Knöpfe */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--h-ctrl); padding: 0 24px; border-radius: var(--r-ctrl); line-height: 1.2; }
.btn.full { margin-bottom: var(--gap); }
.card-actions .btn, .pub-action, .pub-tools .btn, .guest-actions .btn { min-height: var(--h-sm); padding: 0 16px; font-size: 13px; }
.panel .row .btn, .up-draw-row .btn { padding: 0 16px; }
.icon { width: var(--h-ctrl); height: var(--h-ctrl); border-radius: var(--r-ctrl); }
.rotate .icon { width: var(--h-ctrl); height: var(--h-ctrl); }
.menu, .menu.icon { width: var(--h-ctrl); height: var(--h-ctrl); border-radius: var(--r-ctrl); }
.tab { border-radius: var(--r-ctrl); }
.set-row { border-radius: var(--r-ctrl); min-height: var(--h-ctrl); padding: 0 16px; margin-bottom: 8px; }

/* Filter-Felder */
.chip { display: inline-flex; align-items: center; justify-content: center; min-height: var(--h-chip); padding: 0 16px; border-radius: var(--r-ctrl); }
.chips { gap: 8px; margin-bottom: var(--gap); }
.filter-row { margin-bottom: var(--gap); }

/* Eingabefelder und Auswahl: gleiche Höhe, gleiche Ecken, gleiche Füllung */
input[type=text], input[type=email], input[type=password], select {
  min-height: var(--h-ctrl); padding: 0 16px; border: 0; border-radius: var(--r-ctrl); background-color: var(--gray); font-size: 16px;
}
select { padding-right: 48px; min-width: 0; font-weight: 600; }
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, select:focus { outline: 0; box-shadow: 0 0 0 2px #0074e8; }
.panel input[type=text], .panel select, .upload input[type=text], .upload select, .account input { background-color: var(--surface); }
.upload select { min-width: 190px; }
.field, .field-inline { gap: 8px; }
.field { margin-bottom: var(--gap); }
.field-inline { margin: 0; }
.so-filters input, .so-filters select { height: var(--h-ctrl); }
.thread-form input[type=text], .thread-form .btn { height: var(--h-ctrl); }
.thread-photo { width: var(--h-ctrl); height: var(--h-ctrl); }

/* Karten und Flächen */
.card .img, .pick, .up-preview, .palette, .dropbox, dialog img, .up-draw { border-radius: var(--r-card); }
.account { border-radius: var(--r-card); }
.member, .pub-banner, .pay-hint { border-radius: var(--r-ctrl); }
.panel, .upload, .stage, dialog { border-radius: var(--r-panel); }
.grid { gap: 24px var(--gap); }
.outfits { gap: 24px var(--gap); }
.page-title { margin: 4px 0 var(--gap); }
.pub-section { margin-bottom: 32px; }
.pub-section h3 { margin: 0 0 12px; }
.toast { border-radius: var(--r-ctrl); }

/* Fenster: gleiche Innenabstände */
dialog { padding: 24px; }
.row { gap: 8px; margin-bottom: 8px; }
.more { margin-bottom: var(--gap); }

/* Seitenränder */
main { padding: 8px var(--pad-page) 48px; }
.top { padding: 12px var(--pad-page); }
.landing, .public { padding: 24px var(--pad-page) 48px; }

@media (max-width: 900px) {
  :root { --pad-page: 16px; }
}
@media (max-width: 700px) {
  main { padding: 8px var(--pad-page) calc(96px + env(safe-area-inset-bottom)); }
  .top { padding: 8px var(--pad-page); }
  .landing, .public { padding: 24px var(--pad-page) 48px; }
  .grid, .outfits { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
  .card .img { border-radius: var(--r-card); }
  .upload, .stage { border-radius: var(--r-panel); }
  .upload { padding: 16px; margin-bottom: var(--gap); }
  dialog { padding: 24px; border-radius: var(--r-panel); }
  #uploadDialog { border-radius: var(--r-panel) var(--r-panel) 0 0; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
  .chips { margin-bottom: var(--gap); }
  .guest-actions .btn { min-height: var(--h-sm); padding: 0 12px; font-size: 14px; }
}
.so-filters { grid-template-columns: 1.5fr 1fr 1.2fr; gap: 8px; }
.so-filters select { padding: 0 32px 0 16px; background-position: right 12px center; font-size: 16px; }
.so-filters input { padding: 0 16px; font-size: 16px; }
.thread-photo { border-radius: var(--r-ctrl); }

/* ---------- Detailseite eines Teils ---------- */
.item-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; margin-bottom: 32px; }
.item-photo { aspect-ratio: 4 / 5; background: var(--gray); border-radius: var(--r-card); display: grid; place-items: center; overflow: hidden; }
.item-photo img { width: 100%; height: 100%; object-fit: contain; padding: 16px; box-sizing: border-box; }
.item-name { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.item-price { margin: 4px 0 0; font-size: 22px; font-weight: 800; }
.item-facts { margin: 16px 0; }
.item-fact { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--gray-hover); font-size: 15px; }
.item-fact dt { color: var(--muted); }
.item-fact dd { margin: 0; font-weight: 600; text-align: right; }
.seller { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0 0 var(--gap); padding: 12px 16px; border: 0; border-radius: var(--r-card); background: var(--gray); cursor: pointer; text-align: left; font: inherit; color: inherit; }
@media (hover: hover) and (pointer: fine) { .seller:hover { background: var(--gray-hover); } }
.seller-name { display: flex; flex-direction: column; }
.item-info .pub-report { margin-top: 0; }
@media (min-width: 701px) {
  .item-page { grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 32px; align-items: start; }
}

/* ---------- Rückmeldungen: Laden, Fehler, sanfte Übergänge ---------- */
.spinner { width: 20px; height: 20px; border: 3px solid var(--gray-hover); border-top-color: var(--text); border-radius: 50%; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 32px 0; color: var(--muted); font-size: 14px; }
.skeleton { position: relative; overflow: hidden; background: var(--gray); border-radius: var(--r-ctrl); }
.skeleton::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--gray-hover), transparent); transform: translateX(-100%); animation: shimmer 1.2s ease-in-out infinite; } /* nur transform: läuft ohne Neuzeichnen */
.skeleton.img { aspect-ratio: 4 / 5; border-radius: var(--r-card); }
.skeleton.line { height: 12px; margin-top: 8px; }
.skeleton.line.short { width: 60%; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton-card { display: block; }
.notice { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 24px 16px; border-radius: var(--r-card); background: var(--gray); }
.notice p { margin: 0; }
.notice.error { box-shadow: inset 0 0 0 2px var(--red); }
#feedRetry[hidden] { display: none; }
.toast.error { background: var(--red); color: #fff; }
.toast.error::before { content: '⚠ '; }

.view.active { animation: fade-in .2s var(--ease-out); }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
dialog[open] { animation: pop-in .2s var(--ease-out); }
dialog[open]::backdrop { animation: fade-bg .2s var(--ease-out); }
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade-bg { from { opacity: 0; } to { opacity: 1; } }
.public > * { animation: fade-in .2s var(--ease-out); }
.bubble { animation: fade-in .15s var(--ease-out); }
.btn, .chip, .tab, .icon, .set-row, .seller, .member, .card .img { transition: background-color .15s ease, transform .12s var(--ease-out), opacity .15s ease; }
.btn:active:not(:disabled), .chip:active, .icon:active, .set-row:active, .seller:active { transform: scale(.97); }
.card:active .img { transform: scale(.98); }
.card .img img { animation: fade-bg .2s var(--ease-out); }
/* Weniger Bewegung: nichts verschiebt oder skaliert sich mehr, sanftes Einblenden und die Ladeanzeige bleiben */
@media (prefers-reduced-motion: reduce) {
  .view.active, .public > *, .bubble, dialog[open] { animation-name: fade-bg; }
  .skeleton::after { animation: none; }
  .toast { transition-property: opacity; }
  .btn:active:not(:disabled), .chip:active, .icon:active, .set-row:active, .seller:active, .card:active .img { transform: none; }
}
.check[hidden] { display: none; }
.item-photo { max-height: 60vh; max-height: 60dvh; }

/* Rechtliches, Konto löschen, Moderation, Folgen/Merken, Willkommen */
.btn.primary.danger { background: #c4202e; color: #fff; }
.btn.primary.danger:disabled { opacity: .45; }
.legal-links { margin: 16px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.legal-links a, .check a { color: inherit; text-decoration: underline; }
.check span { line-height: 1.35; }
.legal-body { max-height: 52vh; max-height: 52dvh; overscroll-behavior: contain; overflow-y: auto; padding-right: 4px; font-size: 14px; line-height: 1.5; }
.legal-body h2 { font-size: 18px; margin: 0 0 8px; }
.legal-body h3 { font-size: 15px; margin: 16px 0 4px; }
.legal-body p, .legal-body ul, .legal-body ol { margin: 0 0 8px; }
.legal-body ul, .legal-body ol { padding-left: 24px; }
mark.todo { background: #ffe066; color: #3d3000; padding: 0 4px; border-radius: 3px; }
.welcome-steps { padding-left: 24px; line-height: 1.5; }
.welcome-steps li { margin-bottom: 8px; }
.mod-item { border: 1px solid var(--gray); border-radius: var(--r-ctrl); padding: 8px 12px; margin-bottom: 8px; font-size: 14px; }
.mod-item .row { margin-top: 8px; gap: 8px; }
.mod-item .btn { padding: 8px 12px; font-size: 13px; }
.pub-tools .btn.on { background: var(--red); color: #fff; }
.save-btn.on { color: var(--red); }
.empty .btn { margin-top: 12px; }
.feed-switch { flex-wrap: nowrap; gap: 8px; }
.feed-switch .chip { padding-left: 12px; padding-right: 12px; font-size: 14px; white-space: nowrap; }
#authConsentRow { align-items: flex-start; }
#authConsentRow input { margin-top: 4px; flex: none; }
.card .img { width: 100%; border: 0; padding: 0; cursor: pointer; }
.outfits .card .img { border: 1px solid var(--gray-hover); }
.subtab { white-space: nowrap; padding-left: 4px; padding-right: 4px; font-size: 13.5px; }
.me-social { display: block; }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.err-stack { margin: 8px 0 0; padding: 8px; border-radius: 8px; background: var(--gray); font-size: 11px; white-space: pre-wrap; word-break: break-all; max-height: 180px; overflow: auto; }

/* Sehr schmale Handys (320 px): Kopfzeile bleibt in einer Reihe, das Menü wird nie zusammengedrückt */
.menu, .menu.icon { flex-shrink: 0; }
@media (max-width: 360px) {
  .top { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .top h1 { font-size: 22px; margin-right: 0; }
  .guest-actions { gap: 8px; }
  .guest-actions .btn { padding: 0 8px; font-size: 13px; }
  .menu, .menu.icon { width: 40px; }
}

/* Lange Namen und Texte: umbrechen statt aus dem Rahmen laufen, Bilder und Symbole bleiben rund */
.avatar { flex-shrink: 0; }
.feed-owner span:last-child, .seller-name { min-width: 0; }
.seller-name, .item-name, .item-fact span, .member, .pub-banner, .notice p { overflow-wrap: anywhere; }
.item-fact { align-items: baseline; }

/* Meldungen am Handy über der unteren Leiste, nicht davor */
@media (max-width: 700px) { .toast { bottom: calc(80px + env(safe-area-inset-bottom)); } }

/* Markenvorschläge unter dem Feld */
.brand-list { border: 1px solid var(--gray-hover); border-radius: var(--r-ctrl); background: var(--surface); max-height: 280px; overflow-y: auto; overscroll-behavior: contain; }
.brand-list[hidden] { display: none; }
.brand-opt { display: block; width: 100%; min-height: 44px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--gray); background: none; text-align: left; font: inherit; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; cursor: pointer; }
.brand-opt:last-child { border-bottom: 0; }
.brand-opt.keep { font-weight: 400; color: var(--muted); }
.brand-opt:active { background: var(--gray); }
@media (hover: hover) and (pointer: fine) { .brand-opt:hover { background: var(--gray); } }

.size-list { max-height: 240px; }
.size-head { position: sticky; top: 0; padding: 8px 16px 4px; background: var(--surface); font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.landing { padding-top: 0; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

.top h1 { cursor: pointer; user-select: none; -webkit-user-select: none; }
.top h1:active { opacity: .7; }

/* Profilbild */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.lg { width: 72px; height: 72px; font-size: 28px; }
.avatar-edit { display: flex; align-items: center; gap: var(--gap); margin-bottom: 12px; }
.avatar-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.crop { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 12px; }
.crop canvas { width: min(220px, 70vw); aspect-ratio: 1; border-radius: 50%; background: var(--gray); touch-action: none; cursor: grab; }
.crop input[type=range] { width: min(260px, 80%); }
.avatar[hidden], .crop[hidden] { display: none; }
.crop canvas { width: min(300px, 80vw); }
textarea { font: inherit; font-size: 16px; color: inherit; width: 100%; box-sizing: border-box; min-height: 88px; padding: 12px 16px; border: 0; border-radius: var(--r-ctrl); background-color: var(--gray); resize: none; line-height: 1.4; }
textarea:focus { outline: 0; box-shadow: 0 0 0 2px #0074e8; }
textarea::placeholder { color: #a8a8a8; opacity: 1; }
#profMsg:empty { display: none; }
.avatar-btns { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
.avatar-edit .avatar { box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }

/* Anmeldung: mittig, gleichmäßige Abstände (16 px) */
.auth-card { display: flex; flex-direction: column; gap: 16px; text-align: center; }
.auth-card > *:not(#nope) { margin: 0; }
.auth-card h1 { font-size: 40px; line-height: 1.1; }
.auth-card h2:not(#nope) { margin-bottom: 8px; }
.auth-card .field, .auth-card .check { text-align: left; }
.auth-card .field { gap: 8px; }
.auth-card .btn.full { width: 100%; }
.auth-error { min-height: 0; }
.auth-error:empty { display: none; }
.auth-card .linkish { align-self: center; padding: 8px 12px; }
.auth-card .legal-links:not(#nope) { margin-top: 8px; }
.up-preview { touch-action: none; cursor: grab; overscroll-behavior: contain; }
.up-preview.grabbing { cursor: grabbing; }
.empty.show, #feedEmpty:not([hidden]) { flex-direction: column; align-items: center; gap: 8px; }
.empty-ic { color: var(--muted); opacity: .7; margin-bottom: 8px; }
.empty-title { color: var(--text); font-size: 18px; }
.empty-text { max-width: 320px; font-size: 14px; line-height: 1.4; }
.empty .btn { margin-top: 16px; }
.thread-who { display: inline-flex; align-items: center; gap: 8px; }

/* Outfit-Seite */
.outfit-page { display: grid; grid-template-columns: 1fr; gap: 24px; }
.outfit-photo img { display: block; width: 100%; max-width: 360px; aspect-ratio: 9 / 16; object-fit: contain; background: #fff; border: 1px solid var(--gray-hover); border-radius: var(--r-card); margin: 0 auto; }
.outfit-info { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.outfit-info > * { margin: 0; }
.outfit-sub { font-size: 16px; }
.outfit-items { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
@media (min-width: 800px) { .outfit-page { grid-template-columns: 360px 1fr; align-items: start; } .outfit-photo img { margin: 0; } }
#outfitsEmpty { margin-top: calc(var(--h-chip) + var(--gap)); } /* gleiche Höhe wie beim Schrank (dort steht darüber die Kategorienzeile) */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; } /* nur für Screenreader, damit die Liste oben bündig mit den anderen Ansichten startet */
.thread-head { margin-bottom: 16px; }

/* Zurück-Knöpfe: überall gleiche Höhe (8 px Seitenrand + 4 px) und gleicher Abstand nach unten */
.public { padding-top: 8px; }
.pub-back, .builder-back, #threadBack { margin: 4px 0 16px; }
.thread-head { align-items: flex-start; }

/* Zurück-Knopf: Winkel „<“ statt Pfeil, gleiche Größe und gleicher Abstand zum Text überall */
.back-btn { gap: 8px; padding: 0 16px 0 12px; }
.back-btn::before { content: ''; width: 10px; height: 14px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M8 1.500L2.500 7 8 12.500' fill='none' stroke='black' stroke-width='2.200' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M8 1.500L2.500 7 8 12.500' fill='none' stroke='black' stroke-width='2.200' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.so-filters .so-kind { grid-column: 1 / -1; }

/* Nachrichten: Kaufen / Verkaufen, Zeilen mit Teilfoto */
.msg-tabs { display: flex; border-bottom: 1px solid var(--gray-hover); margin: 0 0 8px; }
.msg-tab { flex: 1; border: 0; background: none; padding: 12px 8px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; text-align: center; }
.msg-tab.active { color: var(--text); border-bottom-color: var(--text); }
.msg-tab .badge { font-weight: 600; }
.msg-tabs[hidden] { display: none; }
.msg-row { grid-template-columns: 72px 1fr; column-gap: 16px; padding: 16px 0; align-items: start; }
.msg-thumb { grid-row: 1; width: 72px; height: 72px; border-radius: var(--r-ctrl); background: var(--gray); overflow: hidden; display: block; }
.msg-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.msg-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; text-align: left; }
.msg-row .thread-top, .msg-row .thread-last { grid-column: auto; }
.msg-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-who { display: flex; align-items: center; gap: 8px; }
.msg-row.unread .msg-title::before { content: '● '; color: var(--red); }
.avatar.xs { width: 20px; height: 20px; font-size: 10px; }

/* Einstellungen: klappen oben unter dem Menüknopf auf statt als Fenster in der Mitte */
#settingsDialog { position: fixed; margin: 0; top: calc(env(safe-area-inset-top, 0px) + 8px); right: var(--pad-page); left: auto; bottom: auto;
  width: min(400px, calc(100vw - 2 * var(--pad-page))); max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px)); overflow: auto; transform-origin: top right; }
#settingsDialog[open] { animation: drop-in .28s var(--ease-out); }
#settingsDialog.closing { animation: drop-out .18s var(--ease-out) forwards; }
#settingsDialog.closing::backdrop { animation: fade-out .18s var(--ease-out) forwards; }
@keyframes drop-in { from { opacity: 0; transform: translateY(-20px) scale(.96); } }
@keyframes drop-out { to { opacity: 0; transform: translateY(-20px) scale(.96); } }
@keyframes fade-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #settingsDialog[open], #settingsDialog.closing { animation-name: fade-bg; } #settingsDialog.closing { animation-name: fade-out; } }

/* Chat-Kopf: größerer Name mit Profilbild, darunter das Teil mit kleinem Bild */
.avatar.md { width: 40px; height: 40px; font-size: 16px; }
.thread-who { font-size: 22px; letter-spacing: -.01em; gap: 12px; }
.thread-head { align-items: center; gap: 16px; }
.thread-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; margin: 0 0 16px; border: 0; border-radius: var(--r-card); background: var(--gray); font: inherit; color: inherit; text-align: left; cursor: pointer; }
.thread-item:disabled { cursor: default; }
.thread-item-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.thread-item-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-thumb.sm { width: 48px; height: 48px; flex: none; border-radius: 10px; background: var(--bg); }

/* Chat-Kopf: Zurück-Knopf und Name mittig auf einer Linie (Knopf ohne eigenen Außenabstand, der Kopf trägt Rand oben und unten) */
.thread-head { padding-top: 4px; margin-bottom: 16px; }
.thread-head #threadBack { margin: 0; }


/* Handy: Outfit-Seite kompakt – Foto oben, Teile als Liste (für eigene und fremde Outfits) */
@media (max-width: 799px) {
  .outfit-photo img { max-height: 46vh; width: auto; max-width: 100%; }
  .outfit-items { grid-template-columns: 1fr; gap: 8px; }
  .outfit-items .card { display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--gray-hover); border-radius: 12px; text-align: left; }
  .outfit-items .card .img { width: 56px; height: 56px; flex: none; aspect-ratio: auto; border-radius: 8px; }
  .outfit-items .card .img { --pad: 4px; }
  .outfit-items .card .meta { padding: 0; min-width: 0; }
  .outfit-items .card .meta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
}

.outfit-actions { display: flex; gap: 8px; margin: 0 0 12px; }
.outfit-actions .btn { flex: 1; }

.chip[hidden] { display: none; }

/* Auswahlmodus im Schrank: Kreis oben rechts am Foto, unten eine Leiste mit den Sammelaktionen */
.selecting .card .img::after { content: ''; position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--text); background: var(--bg); }
.selecting .card.selected .img { outline: 3px solid var(--red); outline-offset: -3px; }
.selecting .card.selected .img::after { content: '✓'; display: grid; place-items: center; background: var(--red); border-color: var(--red); color: #fff; font-size: 13px; line-height: 1; }
.bulk-bar { position: fixed; left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 19; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; background: var(--surface); border: 1px solid var(--gray-hover); border-radius: 16px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.bulk-bar[hidden] { display: none; }
.bulk-bar b { flex: 1 1 100%; font-size: 14px; }
@media (min-width: 701px) { .bulk-bar { bottom: 20px; max-width: 560px; margin: 0 auto; } }
.bulk-bar .btn { padding-left: 12px; padding-right: 12px; }
.mod-head { font-size: 15px; margin: 24px 0 8px; }
.mod-item .muted.rec { margin: 4px 0 0; }
#confirmText { white-space: pre-line; }

.pub-bio { display: block; color: var(--text); margin-top: 4px; overflow-wrap: anywhere; }
#publicView .me-head { padding-top: 0; }
#publicView .subtabs { margin-bottom: 16px; }
#publicView .chips { margin-bottom: 16px; }

.img-wrap { position: relative; }
.heart-btn { position: absolute; right: 10px; bottom: 10px; width: 36px; height: 36px; padding: 0; border: 1px solid rgba(0,0,0,.08); border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.22); display: flex; align-items: center; justify-content: center; cursor: pointer; color: #111; z-index: 2; -webkit-tap-highlight-color: transparent; }
.heart-btn svg { display: block; pointer-events: none; }
.heart-btn.on { color: var(--red); }
.heart-btn:disabled { opacity: .6; }

/* =====================================================================
   jawnz: Unbounded nur fürs Logo und ein festes Abstandsraster
   Raster: 4 · 8 · 12 · 16 · 24 · 32 · 48 px. Kleinste Abstände 4/8 (innerhalb einer Gruppe),
   16 zwischen Blöcken, 24 zwischen Abschnitten, 32/48 für große Pausen. Kein Wert außerhalb.
   ===================================================================== */
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(fonts/unbounded-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(fonts/unbounded-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --font: 'Helvetica Neue', Helvetica, Arial, -apple-system, sans-serif;
  --font-logo: 'Unbounded', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;
  --gap: var(--s-4);
}
body { font-synthesis: none; }
/* Unbounded nur für den Schriftzug JAWNZ (Kopfzeile und Anmeldung), alles andere Helvetica */
.top h1, .auth-card h1 { font-family: var(--font-logo); }

/* Kopfzeile und Seitenränder */
.top { padding: var(--s-4) var(--pad-page); gap: var(--s-3); }
main { padding: var(--s-2) var(--pad-page) var(--s-7); }
.landing, .public { padding: var(--s-5) var(--pad-page) var(--s-7); }
.public { padding-top: var(--s-2); }
.landing { padding-top: 0; }
.tabs { gap: var(--s-1); }

/* Blöcke: überall 16 px dazwischen, Abschnitte 24 px */
.chips, .filter-row, .field, .more, .search, .so-filters, .feed-switch, .me-bar, .pub-banner, .pub-tools,
.upload, .row, .rotate, .account, .btn.full, .so-history, .so-head, .outfit-actions { margin-bottom: var(--s-4); }
.row, .outfit-actions { margin-bottom: var(--s-2); }
.pub-section, .upload { margin-bottom: var(--s-5); }
.item-page { gap: var(--s-5); margin-bottom: var(--s-6); }
.chips, .row, .search, .so-filters, .feed-switch, .pub-tools, .guest-actions, .card-actions, .avatar-btns, .picker-grid, .swatches { gap: var(--s-2); }
.pub-tools { margin-top: calc(-1 * var(--s-2)); }
.me-head { padding: var(--s-1) 0 var(--s-4); gap: var(--s-4); }
.grid, .outfits { gap: var(--s-5) var(--s-4); }
.combos { gap: var(--s-5) var(--s-4); }
.page-title { margin: var(--s-1) 0 var(--s-4); }
.item-name { margin-bottom: 0; }

/* Karten */
.card .meta { padding: var(--s-2) var(--s-1) 0; }
.card .meta .note { margin-top: var(--s-1); }
.card-actions { padding: var(--s-2) 0 0; }
.feed-owner { padding: 0 0 var(--s-2); gap: var(--s-2); }
.feed-card .meta { gap: var(--s-1); }
.feed-card .meta .feed-price { margin-top: var(--s-1); }
.feed-more { padding: var(--s-5) 0; }

/* Listen und Zeilen */
.set-row { margin-bottom: var(--s-2); }
.inbox-item { padding: var(--s-3) 0; gap: var(--s-1); }
.item-fact { padding: var(--s-3) 0; gap: var(--s-4); }
.item-facts { margin: var(--s-4) 0; }
.seller, .thread-item, .member { padding: var(--s-3) var(--s-4); }
.thread-item { padding: var(--s-3); gap: var(--s-3); margin-bottom: var(--s-4); }
.thread-head { gap: var(--s-4); margin-bottom: var(--s-4); padding-top: var(--s-1); }
.thread-msgs { gap: var(--s-2); padding: var(--s-2) 0 var(--s-3); }
.thread-form { gap: var(--s-2); padding-top: var(--s-2); }
.bubble { padding: var(--s-2) var(--s-3); gap: var(--s-1); }
.msg-row { padding: var(--s-4) 0; column-gap: var(--s-4); }
.msg-main, .thread-item-text { gap: var(--s-1); }
.msg-tabs { margin-bottom: var(--s-2); }
.member-results { gap: var(--s-2); margin-bottom: var(--s-5); }
.mod-item { padding: var(--s-3); margin-bottom: var(--s-2); }
.mod-head { margin: var(--s-5) 0 var(--s-2); }
.legal-body h3 { margin: var(--s-4) 0 var(--s-1); }
.legal-body p, .legal-body ul, .legal-body ol { margin-bottom: var(--s-2); }
.empty { padding: var(--s-7) var(--s-4); }
.empty.show, #feedEmpty:not([hidden]) { gap: var(--s-2); }
.notice { padding: var(--s-5) var(--s-4); gap: var(--s-3); }
.loading { padding: var(--s-6) 0; gap: var(--s-3); }

/* Fenster */
dialog, .panel { padding: var(--s-5); }
dialog h2 { margin: 0 0 var(--s-2); }
.avatar-edit { margin-bottom: var(--s-3); gap: var(--s-4); }
.crop { margin-bottom: var(--s-3); gap: var(--s-2); }
.row2 { gap: var(--s-3); }
.more-grid { gap: 0 var(--s-3); }
.auth { padding: var(--s-5) var(--s-4) calc(var(--s-5) + env(safe-area-inset-bottom)); }
.auth-card { gap: var(--s-4); }
.toast { padding: var(--s-3) var(--s-5); }

/* Auswahlleiste unten */
.bulk-bar { left: var(--s-3); right: var(--s-3); padding: var(--s-3); gap: var(--s-2); }
.bulk-bar .btn { padding-left: var(--s-3); padding-right: var(--s-3); }

@media (max-width: 900px) { .top { padding: var(--s-3) var(--pad-page); } }
@media (max-width: 700px) {
  .top { padding: var(--s-3) var(--pad-page); }
  main { padding: var(--s-2) var(--pad-page) calc(96px + env(safe-area-inset-bottom)); }
  .landing, .public { padding-left: var(--pad-page); padding-right: var(--pad-page); }
  .grid, .outfits, .combos { gap: var(--s-5) var(--s-4); }
  .upload { padding: var(--s-4); margin-bottom: var(--s-4); }
  dialog { padding: var(--s-5) var(--s-4); }
  #uploadDialog { padding: var(--s-5) var(--s-4) calc(var(--s-5) + env(safe-area-inset-bottom)); }
  .outfit-items { gap: var(--s-2); }
  .outfit-items .card { gap: var(--s-3); padding: var(--s-2); }
  .tabs { padding: var(--s-2) var(--s-1) calc(var(--s-2) + env(safe-area-inset-bottom)); }
  .tab { padding: var(--s-2) var(--s-1); }
}
@media (min-width: 701px) and (max-width: 1100px) and (orientation: portrait) { .grid, .outfits { gap: var(--s-5) var(--s-4); } .builder { gap: var(--s-5); } }
@media (max-width: 360px) { .top { gap: var(--s-2); padding-left: var(--s-3); padding-right: var(--s-3); } }
@media (max-width: 700px) { .landing { padding-bottom: calc(96px + env(safe-area-inset-bottom)); } }
@media (max-width: 360px) { .tab-label { font-size: 10px; letter-spacing: -.02em; } }

/* Suchverlauf: Text bündig mit der Überschrift, Kreuz bündig mit „Löschen“ */
.so-history-item { padding: 12px 0; }
.so-history-row .icon { width: 32px; height: 44px; padding: 0; flex: none; display: flex; align-items: center; justify-content: flex-end; }
.so-history-head button { padding-right: 0; }

/* Schrank-Kopfzeile: „Auswählen“ gleich hoch wie die Chips; auf dem Handy bekommen die Chips eine eigene Zeile */
@media (max-width: 599px) {
  #view-closet .filter-row { flex-wrap: wrap; row-gap: 12px; }
  #view-closet .filter-row .chips { flex: 1 1 100%; }
}

/* Hinzufügen: Kategorie-Feld schrumpft, der Knopf bleibt innerhalb des Rahmens */
.upload-actions .field-inline { min-width: 0; }
.upload-actions .field-inline select { width: 100%; min-width: 0; }
.upload-actions > .btn { flex: none; }

/* Dialoge: Textabstände auf dem Raster statt der Browser-Vorgabe (1em) */
dialog p.muted { margin: 0 0 var(--s-2); }
.welcome-steps { margin: var(--s-2) 0 var(--s-4); }
input[type=checkbox], input[type=radio] { margin: 0; }
:where(button.icon) { padding: 0; }

/* iPhone-App (Kamerainsel/Statusleiste): Kopfzeile beginnt unterhalb des sicheren Bereichs */
@media (max-width: 900px) { .top { padding-top: calc(var(--s-3) + env(safe-area-inset-top, 0px)); } }

/* Am Handy: Unterkategorien stehen als Block untereinander rechts neben der Hauptkategorie */
@media (max-width: 700px) { .filter-row .chips .subchips { flex: none; flex-basis: auto; flex-direction: column; flex-wrap: nowrap; padding-left: 0; } }

/* Feed: Teile und Outfits gleich groß, am Handy über die ganze Breite */
.feed-switch { gap: 8px; max-width: 420px; }
.feed-switch .chip { flex: 1 1 0; min-width: 0; text-align: center; padding-top: 14px; padding-bottom: 14px; font-size: 15px; }
@media (max-width: 700px) { .feed-switch { max-width: none; } }
/* Plus im Schrank nur am Computer; am Handy gibt es den Reiter „Hinzufügen“ */
.add-btn { flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--gray); display: grid; place-items: center; padding: 0; color: var(--text); cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .add-btn:hover { background: var(--gray-hover); } }
.add-btn { width: var(--h-chip); height: var(--h-chip); }
@media (max-width: 700px) { .add-btn { display: none; } }
/* Reiter „Hinzufügen“ nur am Handy; am Computer gibt es das Plus im Schrank */
.tab[data-view="add"] { display: none; }
@media (max-width: 700px) { .tab[data-view="add"] { display: inline-flex; } }
/* Am Handy sind alle Hauptkategorien im Schrank so hoch wie die gewählte mit ihren vier Unterkategorien */
@media (max-width: 700px) { #closetFilter > .chip { min-height: calc(var(--h-chip) * 4 + 24px); } }
/* Unterkategorien gleiten weich herein, statt plötzlich da zu sein */
/* Der Block wächst auch in der Höhe weich; --sub-from ist die Höhe der Hauptknöpfe, --sub-to die des größten Blocks (Accessoires: 5 Einträge) */
.chips { --sub-from: calc(var(--h-chip) * 4 + 24px); --sub-to: calc(var(--h-chip) * 5 + 32px); }
#pickerFilter { --sub-from: var(--h-chip); }
@keyframes subIn-x { from { max-width: 0; max-height: var(--sub-from); opacity: 0; transform: translateX(-10px); } to { max-width: 140px; max-height: var(--sub-to); opacity: 1; transform: none; } }
@keyframes subIn-y { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.subchips.enter { animation: subIn-y .26s var(--ease-out, cubic-bezier(.23, 1, .32, 1)) both; }
@media (max-width: 700px) { .filter-row .chips .subchips.enter { animation: subIn-x .3s var(--ease-out, cubic-bezier(.23, 1, .32, 1)) both; overflow: hidden; } }
@media (prefers-reduced-motion: reduce) { .subchips.enter { animation: none !important; } }
@keyframes subOut-x { from { max-width: 140px; max-height: var(--sub-to); opacity: 1; transform: none; } to { max-width: 0; max-height: var(--sub-from); opacity: 0; transform: translateX(-10px); } }
@keyframes subOut-y { from { opacity: 1; max-height: 200px; transform: none; } to { opacity: 0; max-height: 0; transform: translateY(-6px); } }
.subchips.leave { animation: subOut-y .24s var(--ease-out, cubic-bezier(.23, 1, .32, 1)) both; overflow: hidden; pointer-events: none; }
@media (max-width: 700px) { .filter-row .chips .subchips.leave { animation: subOut-x .26s var(--ease-out, cubic-bezier(.23, 1, .32, 1)) both; } }
@media (prefers-reduced-motion: reduce) { .subchips.leave { animation: none !important; display: none; } }
/* Einstellungs-Knopf nur im Profil */

/* Hinzufügen-Seite: eigene Kopfzeile (Schließen, Titel) ohne Logo, Abschnitte mit Überschriften */
/* Logo nur im Feed; abseits von Feed und Profil gibt es keine sichtbare Kopfzeile mehr (Gäste behalten ihre Anmelde-Knöpfe) */
@media (max-width: 700px) { .not-feed .top h1 { display: none; } } /* am Computer bleibt das Logo oben */
/* Am Handy bleibt von der Kopfzeile nur der Streifen für die Statusleiste; die untere Leiste gehört zur Kopfzeile und muss bleiben */
@media (max-width: 700px) {
  .not-feed:not(.guest) .top { padding: env(safe-area-inset-top, 0px) 0 0; min-height: 0; gap: 0; }
}
.add-bar { position: relative; display: flex; align-items: center; justify-content: center; min-height: 56px; margin: 0 0 var(--s-4, 16px); }
.add-bar h2 { margin: 0; font-size: 17px; font-weight: 700; }
.add-close { position: absolute; left: 0; bottom: 6px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--text); border-radius: 12px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .add-close:hover { background: var(--gray); } }
.add-h { margin: var(--s-5, 24px) 0 12px; font-size: 20px; letter-spacing: -.01em; }
.add-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 170px; padding: 20px; text-align: center; border: 1.5px dashed var(--field); border-radius: 14px; }
.add-drop.over { border-color: var(--text); background: var(--gray); }
.add-drop p { margin: 0; max-width: 34ch; font-size: 13px; }
.add-up-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px; border: 1.5px solid var(--text); border-radius: 12px; font-weight: 700; cursor: pointer; color: var(--text); }
@media (hover: hover) and (pointer: fine) { .add-up-btn:hover { background: var(--gray); } }
.add-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 0 16px; border: 1px solid var(--field); border-radius: 12px; font-weight: 600; }
.add-field select { flex: 1; max-width: 60%; min-width: 0; border: 0; background-color: transparent; text-align: right; font-weight: 500; }
@media (min-width: 701px) { #view-add { max-width: 560px; margin-left: auto; margin-right: auto; } }
.me-head .menu { margin-left: 0; flex: none; padding: 0; display: inline-grid; place-items: center; }
@media (max-width: 700px) { .me-head { gap: 10px; } .me-head #meProfile { padding: 0 14px; } .me-head .menu { width: 44px; height: 44px; } }

/* Am Computer sitzt der Einstellungs-Knopf oben rechts in der Kopfzeile, nur solange das Profil offen ist */
.top > .menu { margin-left: auto; }
body:not(:has(#meBar:not([hidden]))) .top > .menu { display: none; }


/* Foto bearbeiten direkt auf der Hinzufügen-Seite (der frühere Dialog steht jetzt als Bereich unter dem Foto-Feld) */
#uploadDialog.up-inline { position: static; display: block; width: auto; max-width: none; max-height: none; margin: 16px 0 0; padding: 0; overflow: visible; background: none; box-shadow: none; border-radius: 0; }
#uploadDialog.up-inline:not([open]) { display: none; }
#uploadDialog.up-inline .up-preview { height: 46dvh; max-height: 420px; }
#view-add:has(#uploadDialog[open]) #dropzone { display: none; }
#view-add:not(:has(#uploadDialog[open])) .add-actions { display: none; }
.add-actions { margin-top: 20px; }

/* Offenes Fenster: Seite dahinter bleibt stehen */
body.dlg-lock { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
dialog { overscroll-behavior: contain; }

.brand-hint { display: inline-flex; align-self: flex-start; min-height: 32px; align-items: center; margin-top: 8px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--gray); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.brand-hint[hidden] { display: none; }

/* Fotosuche */
.so-head { display: flex; align-items: center; gap: 8px; }
.so-head input[type=text] { flex: 1; min-width: 0; width: auto; }
.so-photo { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--gray); color: var(--text); cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .so-photo:hover { background: var(--gray-hover); } }
.photo-search { margin: 8px 0 16px; }
.photo-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.photo-head img { width: 56px; height: 56px; object-fit: cover; border-radius: 12px; background: var(--gray); }
.photo-head b { flex: 1; min-width: 0; }
.photo-tags { margin-bottom: 12px; }
.photo-tags:empty { display: none; }

/* Mittig: Reiter in Nachrichten ohne Leerzeichen-Versatz (leere Zähler werden ausgeblendet) */
.msg-tab { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.msg-tab .badge:empty { display: none; }

/* Feed: das Weiß hinter den Teilen und Outfits nimmt das Grau der Karte an (Multiplizieren); beim Öffnen zeigt die Ansicht den echten Hintergrund */
.card.feed-card .img.feed-img, .outfits .card.feed-card .img.feed-img { background: var(--gray); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .card.feed-card .img.feed-img img { mix-blend-mode: multiply; } }
:root[data-theme="light"] .card.feed-card .img.feed-img img { mix-blend-mode: multiply; }

/* Feed: Outfits in der Größe wie im Profil (9:16) und mit ihrem echten Hintergrund; nur Teile nehmen das Grau der Karte an */
.card.feed-card.feed-outfit .img.feed-img { --pad: 0px; aspect-ratio: 9 / 16; overflow: hidden; background: #fff; border: 1px solid var(--gray-hover); }
.card.feed-card.feed-outfit .img.feed-img img { mix-blend-mode: normal !important; }

/* Doppeltippen zoomt die Oberfläche nicht; Bilder bleiben per Pinch zoombar */
html, body, input, textarea, select { touch-action: pan-x pan-y; }

/* Einstellungen: Abschnitte mit kleinen Überschriften */
.set-head { margin: var(--s-4) 0 var(--s-2); font-size: 13px; font-weight: 600; color: var(--muted); }
.set-head:first-child { margin-top: 0; }
.set-head[hidden] { display: none; }
.set-logout { margin-top: var(--s-4); }
.set-panel[data-panel="main"] .set-row { min-height: 46px; margin-bottom: 4px; }

/* Bild vergrößern */
.item-photo img { cursor: zoom-in; }
.zoom-view { position: fixed; inset: 0; z-index: 9999; background: rgba(0, 0, 0, .92); display: grid; place-items: center; touch-action: none; overflow: hidden; user-select: none; -webkit-user-select: none; }
.zoom-view img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; will-change: transform; -webkit-user-drag: none; }
.zoom-close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .18); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }

/* Teil-Dialog: erst die Ansicht wie bei anderen Nutzern, Felder erst nach „Bearbeiten“ */
#itemDialog:not(.viewing) .item-view, #itemDialog:not(.viewing) #itViewRow { display: none; }
#itemDialog.viewing #itemForm > label.field, #itemDialog.viewing #itemMore, #itemDialog.viewing #itEditToggle, #itemDialog.viewing #itEdit, #itemDialog.viewing #itEditRow { display: none; }
#itemDialog .item-view { margin: 12px 0 8px; }
#itSimilar, #itSimilarBox { display: none; } /* „Ähnliche Teile von anderen“ gibt es bei eigenen Teilen nicht mehr */
#itViewRow .spacer { display: none; }
#itViewRow .btn { flex: 1; }
