/* Schrift lokal ausgeliefert (kein Google-Fonts-Abruf -> keine IP-Übermittlung an Dritte).
   Inter, SIL Open Font License 1.1 - siehe public/fonts/OFL.txt */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/public/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/public/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/public/fonts/inter-latin-600-normal.woff2') format('woff2'); }

:root {
  --bg: #000000;
  --bg-raised: #0a0a0a;
  --border: #1f1f1f;
  --border-hover: #333333;
  --text: #ededed;
  --text-dim: #7a7a7a;
  --text-faint: #4a4a4a;
  --accent: #ededed;
  --danger: #d94f4f;
  --radius: 3px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ---------- Layout ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.nav-rail {
  width: 64px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  border-right: 1px solid var(--border);
  gap: 4px;
  /* Bleibt beim Scrollen stehen: immer genau Bildschirmhöhe, so dass
     Profil + Einstellungen unten am Bildschirmrand kleben - egal wie lang die Seite ist */
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  background: var(--bg);
  z-index: 40;
}

.nav-rail .brand {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  color: var(--text-dim);
}

.nav-item {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-faint);
  transition: color 0.15s, background 0.15s;
}

.nav-item:hover { color: var(--text-dim); }
.nav-item.active { color: var(--text); background: var(--bg-raised); }
.nav-item svg { width: 20px; height: 20px; }

/* Tap animation - icons and icon-like interactive elements get a subtle
   press-scale on tap/click, nothing else on the page animates */
.tap-scale,
.nav-item,
.btn-icon,
.radio-option,
.add-card,
.icon-btn {
  transition: transform 0.1s ease, color 0.15s, background 0.15s, border-color 0.15s;
}
.tap-scale:active,
.nav-item:active,
.btn-icon:active,
.radio-option:active,
.add-card:active,
.icon-btn:active {
  transform: scale(0.88);
}

.nav-spacer { flex: 1; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
  color: var(--text);
}

/* Nur auf Mobile sichtbar - Desktop hat das Profil bereits in der Sidebar */
.topbar-profile-mobile {
  display: none;
}

.content {
  flex: 1;
  padding: 32px 24px 64px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Auth pages ---------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.auth-main {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 0;
}

/* ---------- Willkommen + Features (Login) ---------- */

.welcome {
  text-align: center;
  margin-bottom: 28px;
}

.welcome-logo {
  display: flex;
  justify-content: center;
  color: var(--text);
  margin-bottom: 14px;
}

.welcome h1 {
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 18px;
  color: var(--text);
}

.feature-list {
  list-style: none;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.feature-list svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text);
}

/* ---------- Footer (Login, Register, Einstellungen, Gastansicht) ---------- */

.site-footer {
  width: 100%;
  text-align: center;
  padding: 28px 16px 24px;
}

.site-footer .wordmark {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.32em;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.site-footer .footer-line {
  font-size: 12px;
  color: var(--text-faint);
}

.site-footer em { color: var(--text-dim); }
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--text); }
.footer-sep { margin: 0 6px; }

/* ---------- Gastansicht geteilter Sammlungen ---------- */

.guest-brand {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  margin-right: 4px;
}
.guest-brand svg { width: 22px; height: 22px; }

.guest-login { width: auto; padding: 7px 12px; font-size: 13px; }

.guest-cta {
  margin-top: 40px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.guest-cta p {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 14px;
}

.field-hint {
  font-size: 11px;
  color: var(--text-faint);
  margin: 8px 0 0;
}

.auth-box {
  width: 100%;
  max-width: 320px;
  padding: 32px;
}

.auth-box .logo {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
  color: var(--text);
}

.auth-box h2 {
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 28px;
  color: var(--text);
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field input, .field select {
  width: 100%;
  padding: 9px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--border-hover);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--text);
  color: #000;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  width: 100%;
}

.btn:hover { background: #ffffff; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  width: auto;
}

.btn-ghost:hover { color: var(--text); border-color: var(--border-hover); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--border);
  width: auto;
}
.btn-danger:hover { border-color: var(--danger); }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { color: var(--text); border-color: var(--border-hover); }
.btn-icon svg { width: 17px; height: 17px; }

.error-msg {
  font-size: 13px;
  color: var(--danger);
  margin-bottom: 14px;
  text-align: center;
}

.success-msg {
  font-size: 13px;
  color: #7fbf7f;
  margin-bottom: 14px;
  text-align: center;
}

.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-faint);
}
.auth-switch a { color: var(--text-dim); }
.auth-switch a:hover { color: var(--text); }

/* ---------- Collection grid (home / social) ---------- */

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-heading h2 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  margin: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.collection-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}

.collection-card:hover { border-color: var(--border-hover); }

.collection-card .cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.collection-card.portrait .cover { aspect-ratio: 3 / 4; }

.collection-card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.collection-card .cover .empty-icon {
  color: var(--text-faint);
}

.collection-card .meta {
  padding: 10px 12px;
}

.collection-card .meta .name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-card .meta .sub {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.collection-card .meta .author {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.collection-card .meta .author img {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
}

.collection-card .meta .author span {
  font-size: 11px;
  color: var(--text-faint);
}

/* Add collection card */
.add-card {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-faint);
  background: transparent;
}
.add-card:hover { border-color: var(--border-hover); color: var(--text-dim); }
.add-card svg { width: 22px; height: 22px; }

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-faint);
}
.empty-state svg { width: 32px; height: 32px; margin-bottom: 12px; }
.empty-state p { font-size: 13px; margin: 0; }

/* ---------- Modal (create collection) ---------- */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay.open { display: flex; }

.modal-box {
  width: 100%;
  max-width: 340px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.modal-box h3 {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 20px;
  color: var(--text);
}

.radio-group {
  display: flex;
  gap: 10px;
}

.radio-option {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color 0.15s, color 0.15s;
}

.radio-option svg { width: 20px; height: 20px; flex-shrink: 0; }
.radio-option input { display: none; }
.radio-option:hover { border-color: var(--border-hover); }
.radio-option:has(input:checked) {
  border-color: var(--text-dim);
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}
.modal-actions .btn-ghost { flex: 1; }
.modal-actions .btn { flex: 1; }

/* ---------- Collection detail page ---------- */

.collection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.collection-header .title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.collection-header .title h1 {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
}

.collection-header .owner-tag {
  font-size: 12px;
  color: var(--text-faint);
}

.collection-owner-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--text-dim);
  font-size: 13px;
}
.collection-owner-tag:hover { color: var(--text); }
.collection-owner-tag img,
.collection-owner-tag .avatar-sm {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-raised);
  border: 1px solid var(--border);
}

/* Bildergalerie: feste Kachelgröße, damit alle Bilder (auch Hochformat)
   exakt gleich groß angezeigt werden. Kein 1fr-Stretch, sondern feste px-Breite,
   mehrere nebeneinander per normalem Grid-Umbruch. */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 170px);
  gap: 10px;
  justify-content: start;
}

.image-grid.portrait {
  grid-template-columns: repeat(auto-fill, 130px);
}

.image-grid img {
  width: 170px;
  height: 170px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
  cursor: pointer;
}

.image-grid.portrait img {
  width: 130px;
  height: 190px;
}

.image-item {
  position: relative;
  width: 170px;
}

.image-grid.portrait .image-item {
  width: 130px;
}

/* Sichtbarer Platzhalter, wenn eine Bilddatei nicht geladen werden kann
   (z.B. fehlende Datei auf der Platte) - besser als leer/unsichtbar */
.image-item.img-broken img {
  visibility: hidden;
}
.image-item.img-broken::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-raised);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.image-item.img-broken::after {
  content: '⚠ Bild fehlt';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 11px;
  text-align: center;
  padding: 8px;
}

.image-item .image-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.image-item:hover .image-actions { opacity: 1; }

/* Kleinere Variante der Icon-Buttons speziell für die Bild-Hover-Actions */
.image-actions .icon-btn {
  width: 26px;
  height: 26px;
  background: rgba(0,0,0,0.75);
}
.image-actions .icon-btn svg { width: 12px; height: 12px; }

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--text); border-color: var(--border-hover); }

/* Lightbox */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}
.lightbox-overlay.open { display: flex; }

.lightbox-overlay img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
}

.lightbox-close {
  position: absolute;
  top: max(20px, env(safe-area-inset-top, 0px));
  right: 20px;
  background: rgba(0,0,0,0.6);
}

.lightbox-download {
  position: absolute;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  right: 20px;
  background: rgba(0,0,0,0.6);
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  padding: 30px;
  text-align: center;
  color: var(--text-faint);
  cursor: pointer;
  margin-bottom: 20px;
  transition: border-color 0.15s, color 0.15s;
}
.upload-zone:hover { border-color: var(--border-hover); color: var(--text-dim); }
.upload-zone:disabled { opacity: 0.6; cursor: default; }
.upload-zone svg { width: 20px; height: 20px; margin-bottom: 8px; }
.upload-zone p { margin: 0; font-size: 12px; }

/* ---------- Settings panel (slide-over) ---------- */

.settings-panel {
  position: fixed;
  top: 0;
  right: -360px;
  width: 340px;
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--border);
  padding: 24px;
  transition: right 0.2s ease;
  z-index: 100;
  overflow-y: auto;
}
.settings-panel.open { right: 0; }

.settings-panel h3 {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 20px;
}

.settings-panel .close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  cursor: pointer;
  color: var(--text-faint);
}
.settings-panel .close-btn:hover { color: var(--text); }
.settings-panel .close-btn svg { width: 18px; height: 18px; }

.settings-panel .field { margin-bottom: 16px; }

/* ---------- Settings page (account) ---------- */

.settings-page-grid {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 420px;
}

.settings-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.settings-block h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  margin: 0 0 16px;
}

.api-key-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-family: monospace;
  font-size: 12px;
  color: var(--text-dim);
  word-break: break-all;
  margin-bottom: 10px;
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.avatar-preview {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-raised);
  border: 1px solid var(--border);
}

/* ---------- Friends page ---------- */

.friends-columns {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.person-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.person-row:last-child { border-bottom: none; }

.person-row img.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.person-row .info { flex: 1; min-width: 0; }
.person-row .info .name { font-size: 13px; color: var(--text); }
.person-row .info .username { font-size: 12px; color: var(--text-faint); }

.person-row .actions { display: flex; gap: 6px; }

.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.search-box input {
  flex: 1;
  padding: 9px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

/* ---------- Admin overview table ---------- */

.admin-table {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}
.admin-table-row:last-child { border-bottom: none; }

.admin-table-head {
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--bg-raised);
}

.admin-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 800px) {
  .admin-table-row {
    grid-template-columns: 1.5fr 1fr 1fr auto;
  }
  .admin-table-row > div:nth-child(4),
  .admin-table-row > div:nth-child(5) {
    display: none;
  }
}

/* ---------- Public profile page ---------- */

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.profile-header img.avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-raised);
  border: 1px solid var(--border);
}

.profile-header .name { font-size: 17px; font-weight: 500; }
.profile-header .username { font-size: 13px; color: var(--text-faint); margin-top: 2px; }

.profile-stats {
  display: flex;
  gap: 20px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.profile-stats .stat strong { color: var(--text); font-weight: 500; }

.profile-header .actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- Toggles ---------- */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.toggle-row .label { font-size: 13px; color: var(--text-dim); }

.visibility-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.visibility-switch label {
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-faint);
  cursor: pointer;
}
.visibility-switch input { display: none; }
.visibility-switch label:has(input:checked) {
  background: var(--text);
  color: #000;
}

/* Responsive */
@media (max-width: 640px) {
  .content { padding: 20px 14px 90px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .settings-panel { width: 100%; right: -100%; }

  .app-shell { flex-direction: column; }

  /* Bildergalerie auf Mobile: normales Grid mit fester Kachelgröße,
     bricht nach unten um (vertikaler Seiten-Scroll), keine Größenänderung */
  .image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 150px);
    gap: 8px;
    justify-content: start;
  }
  .image-grid .image-item { width: 150px; }
  .image-grid img { width: 150px; height: 150px; }

  .image-grid.portrait {
    grid-template-columns: repeat(3, 1fr);
  }
  .image-grid.portrait .image-item { width: auto; }
  .image-grid.portrait img { width: 100%; height: auto; aspect-ratio: 3 / 4; }

  /* Lightbox: Download-Button muss über der fixen Bottom-Nav-Bar (60px)
     bleiben, sonst ist er auf Mobile schwer erreichbar/verdeckt */
  .lightbox-download {
    bottom: max(80px, calc(60px + env(safe-area-inset-bottom, 0px) + 16px));
  }
  .lightbox-overlay { padding-bottom: 90px; }

  .nav-rail {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: 60px;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    padding: 0 4px;
    border-right: none;
    border-top: 1px solid var(--border);
    background: var(--bg);
    z-index: 50;
    gap: 0;
  }

  .nav-rail .brand { display: none; }
  .nav-rail .nav-spacer { display: none; width: 0; flex: 0; }
  .nav-rail .nav-item-profile { display: none; }
  .nav-rail .nav-item {
    flex: 1;
    height: 100%;
    width: auto;
    margin: 0;
  }

  .topbar-profile-mobile { display: inline-flex; }

  .main { padding-bottom: 0; }
}

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




/* Logo oben links in der Sidebar */
.nav-rail .brand { color: var(--text); text-decoration: none; }
.nav-rail .brand svg { width: 22px; height: 22px; }


/* ---------- Animationen ----------
   Dezent und kurz: Inhalte blenden beim Laden ein, Kacheln erscheinen
   leicht versetzt nacheinander, Dialoge und Vollbild zoomen weich auf,
   das Herz "poppt" beim Liken. Nur transform/opacity (flüssig auch auf iOS). */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes zoom-in {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: none; }
}
@keyframes heart-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.35); }
  70%  { transform: scale(0.92); }
  100% { transform: scale(1); }
}

.content { animation: fade-up 0.35s ease-out both; }
.auth-box { animation: fade-up 0.45s ease-out both; }
.welcome-logo svg { animation: zoom-in 0.5s ease-out 0.05s both; }
.feature-list li { animation: fade-up 0.4s ease-out both; }
.feature-list li:nth-child(1) { animation-delay: 0.10s; }
.feature-list li:nth-child(2) { animation-delay: 0.18s; }
.feature-list li:nth-child(3) { animation-delay: 0.26s; }

/* Kacheln (Sammlungen + Bilder) nacheinander einblenden */
.grid > *,
.image-grid > .image-item,
.person-row,
.admin-table-row,
.settings-block {
  animation: fade-up 0.35s ease-out both;
}
.grid > *:nth-child(2), .image-grid > .image-item:nth-child(2), .person-row:nth-child(2), .settings-block:nth-child(2) { animation-delay: 0.04s; }
.grid > *:nth-child(3), .image-grid > .image-item:nth-child(3), .person-row:nth-child(3), .settings-block:nth-child(3) { animation-delay: 0.08s; }
.grid > *:nth-child(4), .image-grid > .image-item:nth-child(4), .person-row:nth-child(4), .settings-block:nth-child(4) { animation-delay: 0.12s; }
.grid > *:nth-child(5), .image-grid > .image-item:nth-child(5), .person-row:nth-child(5), .settings-block:nth-child(5) { animation-delay: 0.16s; }
.grid > *:nth-child(6), .image-grid > .image-item:nth-child(6), .person-row:nth-child(6) { animation-delay: 0.20s; }
.grid > *:nth-child(7), .image-grid > .image-item:nth-child(7) { animation-delay: 0.24s; }
.grid > *:nth-child(8), .image-grid > .image-item:nth-child(8) { animation-delay: 0.28s; }
.grid > *:nth-child(n+9), .image-grid > .image-item:nth-child(n+9) { animation-delay: 0.32s; }

/* Hover nur auf Geräten mit Maus - auf dem Handy bleibt nichts "hängen" */
@media (hover: hover) {
  .collection-card { transition: border-color 0.15s, transform 0.2s ease; }
  .collection-card:hover { transform: translateY(-2px); }
  .image-grid img { transition: transform 0.2s ease, opacity 0.2s; }
  .image-item:hover img { transform: scale(1.02); }
}

/* Dialoge, Vollbild, Einstellungs-Panel */
.modal-overlay.open { animation: fade-in 0.18s ease-out both; }
.modal-overlay.open .modal-box { animation: zoom-in 0.22s ease-out both; }
.lightbox-overlay.open { animation: fade-in 0.2s ease-out both; }
.lightbox-overlay.open img { animation: zoom-in 0.25s ease-out both; }
.lightbox-overlay.open .icon-btn { animation: fade-in 0.3s ease-out 0.1s both; }
.settings-panel { transition: right 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Like-Herz */
#like-btn.pop svg { animation: heart-pop 0.4s ease-out; }

/* Fehlermeldungen kurz einblenden */
.error-msg, .success-msg { animation: fade-in 0.25s ease-out both; }

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


/* ---------- Fixes ---------- */

/* Auswahlknöpfe (Format/Sichtbarkeit): .field label setzte display:block und
   hat damit das Flex-Layout überschrieben -> Icons saßen schief über dem Text */
.radio-group .radio-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  min-height: 44px;
  font-size: 12px;
  line-height: 1;
}
.radio-group .radio-option svg { display: block; width: 18px; height: 18px; }

/* Avatare dürfen in Flex-Zeilen nie gestaucht werden (sonst oval) */
.avatar-preview, .avatar-lg, .avatar-sm, .person-row img.avatar-sm, .collection-owner-tag img {
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
}

/* Profilbild-Auswahl: Avatar ist selbst der Knopf, kein grauer Browser-Dateiknopf */
.avatar-picker {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  flex-shrink: 0;
}
.avatar-picker input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.avatar-picker .avatar-edit {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
}
.avatar-picker .avatar-edit svg { width: 12px; height: 12px; }
.avatar-hint { font-size: 12px; color: var(--text-faint); }

/* ---------- Impressum ---------- */
.legal-page {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 20px 0;
  width: 100%;
  flex: 1;
}
.auth-page:has(.legal-page) { justify-content: flex-start; }
.legal-page .back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-dim); margin-bottom: 28px;
}
.legal-page .back-link:hover { color: var(--text); }
.legal-page h1 { font-size: 18px; font-weight: 500; margin: 0 0 6px; }
.legal-page .legal-sub { font-size: 12px; color: var(--text-faint); margin: 0 0 24px; }
.legal-page h2 { font-size: 13px; font-weight: 500; color: var(--text-dim); margin: 24px 0 8px; }
.legal-page p { font-size: 14px; line-height: 1.7; margin: 0; color: var(--text); }
.legal-page p a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-hover); }

/* Längere Rechtstexte (Datenschutz) */
.legal-long p { margin: 0 0 10px; font-size: 14px; }
.legal-long h2 { margin-top: 32px; color: var(--text); font-size: 14px; }
.legal-page ul { margin: 0 0 10px; padding-left: 18px; }
.legal-page li { font-size: 14px; line-height: 1.7; color: var(--text); }
.legal-page li strong, .legal-page p strong { font-weight: 600; }
.legal-table-wrap { overflow-x: auto; margin: 0 0 12px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.legal-table th, .legal-table td {
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--border); vertical-align: top;
}
.legal-table th { color: var(--text-dim); font-weight: 500; font-size: 12px; }
.legal-table td { color: var(--text); }
.danger-block { border-color: rgba(217, 79, 79, 0.35); }

/* ---------- Sammlungskarten einheitlich ----------
   Alle Karten gleich groß, egal ob Quer- oder Hochformat. Vorher wurde eine
   Querformat-Karte neben einer Hochformat-Karte auf deren Höhe gestreckt
   (Bild oben, darunter leerer Raum). Das Cover füllt jetzt immer die volle
   Fläche, das Format zeigt ein kleines Symbol oben rechts. */
.grid { align-items: start; }
.collection-card { display: flex; flex-direction: column; }
.collection-card .cover,
.collection-card.portrait .cover {
  aspect-ratio: 4 / 5;
  position: relative;
}
.collection-card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.orient-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  z-index: 1;
  pointer-events: none;
}
.orient-badge svg { width: 13px; height: 13px; }

/* ---------- Wolfiku labs Badge (Home, Login) ---------- */

.labs-badge {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  z-index: 5;
  pointer-events: none;
  user-select: none;
}
.labs-badge svg { width: 18px; height: 22px; flex-shrink: 0; }
.labs-badge em { font-style: normal; color: #66d244; }
@media (max-width: 600px) {
  .auth-page { padding-bottom: 40px; }
}
