/* ─── STUDIS — Apple-clean Designsystem ──────────────────────────── */
:root {
  --blue:        #0A4DFF;
  --blue-soft:   #E8EFFF;
  --blue-hover:  #083ECC;
  --bg:          #FFFFFF;
  --bg-alt:      #F5F5F7;
  --bg-card:     #FFFFFF;
  --line:        #E5E5EA;
  --line-strong: #D2D2D7;
  --text:        #1D1D1F;
  /* WCAG-AA on white-bg: 4.5:1+ für normalen Text. Vorige Werte
     (#6E6E73 / #86868B) waren bei 11-13px-Hinweisen nur 3.3-5.0:1. */
  --text-soft:   #595B61;
  --text-mute:   #6B6D72;
  --green:       #34C759;
  --orange:      #FF9500;
  --red:         #FF3B30;
  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.08), 0 16px 48px rgba(0,0,0,.12);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
/* User-controlled Theme via data-theme="dark|light|auto".
   Default ist auto → folgt System-Setting (prefers-color-scheme). */
:root[data-theme="dark"] {
  --bg:#000; --bg-alt:#0E0E10; --bg-card:#1C1C1E; --line:#2C2C2E; --line-strong:#3A3A3C;
  --text:#F5F5F7; --text-soft:#AEAEB2; --text-mute:#8E8E93; --blue-soft:#0A1F4D;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg:#000; --bg-alt:#0E0E10; --bg-card:#1C1C1E; --line:#2C2C2E; --line-strong:#3A3A3C;
    --text:#F5F5F7; --text-soft:#AEAEB2; --text-mute:#8E8E93; --blue-soft:#0A1F4D;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  font-family: var(--font);
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; font-size: 16px; line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ─── Topbar ─── */
.top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: rgba(255,255,255,.82); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}
:root[data-theme="dark"] .top { background: rgba(0,0,0,.7); }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .top { background: rgba(0,0,0,.7); } }

/* ─── iOS-Style Bottom-Tab-Bar (Mobile + Tablet) ───────────────── */
.bottom-bar {
  display: none;  /* Default aus, in @media wieder eingeblendet */
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 60;
  grid-template-columns: repeat(5, 1fr);
  align-items: stretch;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-top: 1px solid var(--line);
}
:root[data-theme="dark"] .bottom-bar { background: rgba(20,20,22,.82); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .bottom-bar { background: rgba(20,20,22,.82); }
}
.bb-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  min-height: 50px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color .15s cubic-bezier(0.32, 0.72, 0, 1), transform .12s;
  -webkit-tap-highlight-color: transparent;
}
.bb-item:active { transform: scale(0.92); }
.bb-item.active { color: var(--blue); }
/* Kein Anchor-Underline auf Bottom-Tabbar — sonst hat "Feed" als active link einen Strich, andere nicht */
.bb-item, .bb-item:hover, .bb-item:focus, .bb-item:active, .bb-item.active { text-decoration: none !important; }
.bb-item svg { width: 24px; height: 24px; flex-shrink: 0; }
.bb-badge {
  position: absolute;
  top: 4px;
  left: calc(50% + 6px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--bg-card);
}
/* Badge nur sichtbar wenn JS hidden=false setzt (n > 0).
   Ohne diesen Override schlägt .bb-badge{display:flex} das HTML-default-hidden. */
.bb-badge[hidden] { display: none !important; }

/* ─── Mobile + Tablet (≤ 1024 px): Faculty-Pills als horizontale Single-Row mit Scroll ───
   !important nötig, weil die Base-Regel .faculty-filter (Z1533) später im File steht
   und bei gleicher Specificity die Source-Order gewinnt.
   Pill-Größe = "alter" Mobile-Look (komfortabel, gut tap-bar — NICHT mini). */
@media (max-width: 1024px) {
  .feed-main .faculty-filter,
  .faculty-filter {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    gap: 6px !important;
    margin: 0 0 12px;
    padding-bottom: 4px;
  }
  .faculty-filter::-webkit-scrollbar { display: none; }
  .faculty-filter .fac-pill-wrap,
  .faculty-filter > .fac-pill { flex-shrink: 0 !important; scroll-snap-align: start; }
  .feed-main .faculty-filter .fac-pill,
  .faculty-filter .fac-pill {
    font-size: 12.5px !important;
    padding: 5px 12px !important;
    min-height: auto !important;
    box-sizing: border-box;
    line-height: 1.35;
    gap: 5px;
  }
  .faculty-filter .fac-pill.active,
  .faculty-filter .fac-pill.all.active { min-height: auto !important; box-sizing: border-box; }
  .faculty-filter .fac-pill-chev { font-size: 9px !important; margin-left: 1px; }
  .fac-mobile-trigger { display: none !important; }

  /* "Alle"-Pille IMMER am linken Rand sichtbar (sticky), egal wie weit gescrollt wird.
     Andere Pills scrollen drunter weg, "Alle" bleibt am Anker. */
  .feed-main .faculty-filter .fac-pill.all,
  .faculty-filter .fac-pill.all {
    position: sticky !important;
    left: 0 !important;
    z-index: 2;
    background: var(--bg-card) !important;          /* opaque, damit scrollende Pills NICHT durchscheinen */
    background-clip: padding-box;
    box-shadow: 6px 0 8px -4px rgba(0,0,0,0.08);    /* sanfte Trennung zur scrollbaren Reihe rechts */
  }
  /* Active-State: weiß + dunkler Text + BLAUER Strich rundherum,
     plus sanfter Schatten-Trennung von der scrollbaren Reihe rechts. */
  .feed-main .faculty-filter .fac-pill.all.active,
  .faculty-filter .fac-pill.all.active {
    background: #FFFFFF !important;
    color: #111 !important;
    border: 2px solid var(--blue) !important;
    padding: 3px 11px !important;
    box-shadow: 6px 0 8px -4px rgba(0,0,0,0.10), 0 1px 3px rgba(10,77,255,0.20);
  }
}

/* ─── Phone (≤ 640 px): leicht kompakter, aber NICHT mini ─── */
@media (max-width: 640px) {
  .feed-main .faculty-filter .fac-pill,
  .faculty-filter .fac-pill {
    font-size: 12px !important;
    padding: 5px 11px !important;
    gap: 4px;
  }
  .faculty-filter .fac-pill-chev { font-size: 8.5px !important; }
}

/* ─── Mobile + Tablet (≤ 1024 px): Bottom-Bar AN, Top-Nav AUS ─── */
@media (max-width: 1024px) {
  .bottom-bar { display: grid; }
  .top nav { display: none !important; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  footer { margin-bottom: 8px; }

  /* Mobile/Tablet: Invite-Button raus — Profile-Avatar ersetzt ihn (Instagram-Style) */
  .top .invite-btn { display: none !important; }

  /* ── Topbar Lang-Button + Profile-Avatar: gleiche Kreis-Form + Höhe ── */
  .top .lang-btn-label { display: none; }
  .top .lang-btn, .top .topbar-profile {
    width: 38px;
    height: 38px;
    padding: 0;
    gap: 0;
    border-radius: 50%;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    box-sizing: border-box;
  }
  .top .lang-btn svg { width: 20px; height: 20px; }

  /* ── Topbar-Reihenfolge auf Mobile/Tablet ──
     Reihenfolge per `order:` (überschreibt DOM-Order im Flex-Container):
     0  STUDIS-Logo            (ganz links)
     1  Sprach-Button (.lang)  (direkt neben Logo)
     2  Search-Bar             (auf Phone hidden, auf Tablet dazwischen)
     99 Profile-Avatar         (ganz rechts via margin-left:auto)
     Specificity .top .X (0,2,0) schlägt die Base-Regeln (0,1,0). */
  .top .logo           { order: 0; }
  .top .lang-wrap      { order: 1; margin-left: 8px; }
  .top .search         { order: 2; }
  .top .topbar-msgs    { order: 50; margin-left: auto; }
  .top .topbar-profile { order: 99; }

  /* Votings: langer Subtitle nur auf Desktop — auf Mobile/Tablet wird er
     stattdessen ins "Voting erstellen"-Modal als kleiner Hinweis gerendert */
  .votings-sub { display: none !important; }
}

/* Desktop: Topbar-Profile-Avatar + Topbar-Messages-Pill ausblenden (nur Mobile/Tablet) */
@media (min-width: 1025px) {
  .topbar-profile { display: none !important; }
  .topbar-msgs    { display: none !important; }
}

/* Mobile/Tablet — Messages-Icon (Papierflieger) in der oberen Leiste, Insta-Style.
   Reiner Icon-Button rund, kein Label-Text — bewusst minimal damit's neben
   Lang-Button + Profil-Avatar nicht aufträgt. */
.topbar-msgs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  color: var(--text);
  text-decoration: none;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  transition: background .12s, transform .08s, color .12s;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}
.topbar-msgs:hover { background: var(--bg-alt); text-decoration: none; }
.topbar-msgs:active { transform: scale(0.92); }
.topbar-msgs:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.topbar-msgs.active { color: var(--blue); }
.topbar-msgs-icon { color: currentColor; flex: 0 0 auto; }
.topbar-msgs-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 9px;
  background: #e0245e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
  box-sizing: border-box;
  line-height: 1;
}

/* Topbar-Profile-Avatar Styles (für Mobile/Tablet) */
.topbar-profile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--blue);
  background: var(--bg-card);
  color: var(--blue);
  text-decoration: none;
  overflow: hidden;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  transition: transform .08s, border-color .15s;
}
.topbar-profile:active { transform: scale(0.94); }
.topbar-profile:hover { border-color: var(--blue-hover); text-decoration: none; }
.topbar-profile-img {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  border-radius: inherit;
}
.topbar-profile-fb {
  font-weight: 700;
  font-size: 15px;
  color: var(--blue);
  z-index: 1;
  text-transform: uppercase;
  line-height: 1;
}
.topbar-profile.has-img .topbar-profile-fb { display: none; }
@media (max-width: 480px) {
  .top .topbar-profile { width: 36px; height: 36px; }
  .topbar-profile-fb { font-size: 14px; }
}

/* ─── Insta-Style Papierflugzeug in der Top-Bar (Mobile/Tablet ≤1024) ─── */
@media (min-width: 1025px) {
  .topbar-msg { display: none !important; }
}
.topbar-msg {
  display: none;                /* default hidden; Mobile-Media-Query unten zeigt es */
  position: relative;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text);
  text-decoration: none;
  transition: background .15s, transform .08s;
}
.topbar-msg:hover    { background: var(--bg-alt); }
.topbar-msg:active   { transform: scale(0.92); }
.topbar-msg svg      { display: block; }
.topbar-msg-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border: 2px solid var(--bg-card);
  box-sizing: content-box;
}
@media (max-width: 1024px) {
  /* Papierflugzeug RECHTS vom Profil-Avatar.
     profile order:99 + margin-left:auto → schiebt sich nach rechts.
     topbar-msg order:100 → kommt direkt nach profile mit kleinem Abstand. */
  .topbar-msg { display: inline-flex; order: 100; margin-left: 10px; }
  body:not(.signed-in) .topbar-msg { display: none !important; }   /* pre-login aus */
}
@media (max-width: 480px) {
  .top .topbar-msg { width: 36px; height: 36px; }
  .topbar-msg svg  { width: 20px; height: 20px; }
}

/* ─── Eng-Mobile (≤ 480 px): Topbar kompakter ─── */
@media (max-width: 480px) {
  .top { padding: 8px 14px; gap: 10px; }
  .search { flex: 1; min-width: 0; }
  .search input { padding: 8px 12px; font-size: 13px; }
  /* Buttons leicht kleiner, aber Form + Höhe bleiben identisch */
  .top .lang-btn { width: 36px; height: 36px; }
  .top .lang-btn svg { width: 19px; height: 19px; }
}

/* ─── Layout-Toggle — Apple Segmented Control ─── */
.layout-toggle {
  display: inline-flex; gap: 0; padding: 3px;
  background: var(--bg-alt); border-radius: 9px;
  border: 1px solid var(--line);
}
.layout-toggle button {
  background: transparent; border: 0; border-radius: 7px;
  padding: 6px 11px; color: var(--text-soft);
  font-size: 15px; line-height: 1;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease, transform .08s ease;
}
.layout-toggle button:hover { color: var(--text); }
.layout-toggle button.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 0 0 0.5px rgba(0,0,0,0.06);
  font-weight: 600;
}
.layout-toggle button:active { transform: scale(0.96); }

/* Markt 2-Spalten-Variante */
.market-grid.cols-2 { grid-template-columns: 1fr 1fr; gap: 12px; }
.market-grid.cols-2 .market-card .market-img { height: 120px; }
.market-grid.cols-2 .market-card .market-title { font-size: 14px; }
.market-grid.cols-2 .market-card .market-price { font-size: 16px; }

/* Vote-Pille im Feed (Reddit-style) */
.vote-bar {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--bg-alt); border: 1px solid var(--line);
}
.vote-btn {
  background: transparent; border: 0; padding: 2px 4px;
  color: var(--text-soft); font-size: 16px; line-height: 1;
}
.vote-btn.up.active { color: var(--blue); }
.vote-btn.down.active { color: var(--red); }
.vote-score { font-weight: 800; font-size: 13px; min-width: 18px; text-align: center; }
.vote-score.up { color: var(--blue); }
.vote-score.down { color: var(--red); }

/* ─── Share-Modal (YouTube/Insta-Style) ─── */
/* Share-Preview-Header — Apple-like Link-Card mit Logo */
.share-preview {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; margin-bottom: 16px;
  background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: 16px;
}
.share-preview-logo {
  width: 56px; height: 56px; border-radius: 14px;
  flex-shrink: 0; display: block;
  background: var(--blue);
}
.share-preview-meta { min-width: 0; flex: 1; }
.share-preview-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.share-preview-host {
  font-size: 12px; color: var(--text-soft); margin-top: 2px;
}

.share-link-row { display: flex; gap: 8px; margin-bottom: 16px; }
.share-link-row input {
  flex: 1; padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--bg); color: var(--text);
  font-size: 13px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.share-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 10px;
}
.share-target {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px; border-radius: var(--r);
  text-decoration: none; color: var(--text);
  background: var(--bg-alt); border: 1px solid var(--line);
  transition: transform .12s, background .12s, border-color .12s;
}
.share-target:hover { background: var(--bg-card); border-color: var(--blue); text-decoration: none; }
.share-target:active { transform: scale(.96); }
.share-target-icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.share-target-icon svg { width: 22px; height: 22px; }
.share-wa   .share-target-icon { background: #25D366; }
.share-tg   .share-target-icon { background: #229ED9; }
.share-sms  .share-target-icon { background: #34C759; }
.share-mail .share-target-icon { background: #5AC8FA; }
.share-x    .share-target-icon { background: #000; }
.share-fb   .share-target-icon { background: #1877F2; }
:root[data-theme="dark"] .share-x .share-target-icon { background: #fff; color: #000; }
.share-li   .share-target-icon { background: #0A66C2; }
.share-target-label { font-size: 12px; font-weight: 600; color: var(--text); text-align: center; line-height: 1.2; }
.share-native-row { display: flex; justify-content: center; margin-bottom: 14px; }
.share-native-row .btn { width: 100%; max-width: 320px; }

/* Mobile-Anpassung: Link-Row stack, kompaktere Tiles */
@media (max-width: 520px) {
  .share-link-row { flex-direction: column; gap: 8px; }
  .share-link-row input { width: 100%; }
  .share-link-row .btn { width: 100%; }
  .share-grid { grid-template-columns: repeat(auto-fit, minmax(68px, 1fr)); gap: 8px; }
  .share-target { padding: 10px 4px; gap: 4px; }
  .share-target-icon { width: 40px; height: 40px; }
  .share-target-icon svg { width: 20px; height: 20px; }
  .share-target-label { font-size: 11px; }
}

/* Generic Share-Button (zum platzieren auf Markt-Detail, Profile, etc.) */
.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-card);
  color: var(--text); font-weight: 600; font-size: 13px;
  cursor: pointer; transition: border-color .12s, background .12s, color .12s;
}
.share-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.share-btn svg { width: 16px; height: 16px; }

/* Instagram-Style "Gelesen" unter eigener letzter Chat-Nachricht */
.msg-read {
  font-size: 11px;
  color: var(--text-soft);
  text-align: right;
  margin: -4px 12px 6px 0;
  letter-spacing: .02em;
  opacity: 0;
  animation: msg-read-in .4s ease-out forwards;
}
@keyframes msg-read-in {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Apple-Settings-Style Hierarchie-Picker (Fakultät → Sub-Fächer) */
.tree-picker {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-card);
  padding: 4px 0;
}
/* spezifischer als .field label damit text-transform überschrieben wird */
.field label.tree-row,
.tree-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  margin-bottom: 0;
  cursor: pointer; user-select: none;
  font-size: 14px !important;
  color: var(--text); font-weight: 500;
  letter-spacing: 0 !important;
  text-transform: none !important;
  border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.tree-row:last-child { border-bottom: none; }
.tree-row:hover { background: var(--bg-alt); }
/* Custom-Checkbox: identisch auf Desktop + Tablet + Handy (iOS-Safari respektiert
   accent-color nur teilweise) — explizit blauer Background + weißer Haken bei :checked. */
.tree-row input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  margin: 0;
  flex-shrink: 0;
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
  transition: background .12s ease, border-color .12s ease;
}
.tree-row input[type="checkbox"]:hover { border-color: var(--blue); }
.tree-row input[type="checkbox"]:checked {
  background: var(--blue);
  border-color: var(--blue);
}
.tree-row input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 11px;
  border-right: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  /* translate(-50%,-55%) — -55% kompensiert den optischen Schwerpunkt des ✓
     (durch die L-Form wirkt das visuelle Center nicht exakt am geometrischen) */
  transform: translate(-50%, -55%) rotate(45deg);
  pointer-events: none;
}
.tree-row input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.tree-row-label { flex: 1; min-width: 0; }
.tree-row-label strong { font-weight: 600; }
.tree-row-meta {
  font-size: 12px; color: var(--text-soft); font-weight: 400;
  white-space: nowrap;
}
.tree-row-all { background: var(--blue-soft); border-bottom: 1px solid var(--line); }
.tree-row-all:hover { background: var(--blue-soft); filter: brightness(0.97); }

.tree-disc {
  background: transparent; border: 1px solid var(--line);
  width: 34px; height: 34px; border-radius: 8px;
  padding: 0; margin-left: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-soft); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s;
  flex-shrink: 0;
}
.tree-disc:hover { background: var(--bg-alt); border-color: var(--blue); color: var(--blue); }
.tree-disc-icon {
  display: inline-block; font-size: 14px; line-height: 1;
  transition: transform .2s cubic-bezier(0.32, 0.72, 0, 1);
}
.tree-group.open .tree-disc-icon { transform: rotate(90deg); color: var(--blue); }
.tree-group.open .tree-disc { border-color: var(--blue); color: var(--blue); }
.tree-disc-spacer { width: 34px; flex-shrink: 0; }

.tree-sub { background: var(--bg-alt); border-bottom: 1px solid var(--line); }
.tree-sub .tree-row { border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-soft); }
.tree-sub .tree-row:last-child { border-bottom: none; }
.tree-sub .tree-row:hover { color: var(--text); background: var(--bg-card); }

.tree-divider {
  height: 1px; background: var(--line); margin: 6px 0;
}

/* Inline-Checkbox-Feld (Checkbox + Label nebeneinander, nicht stacked wie .field) */
.field-check { margin-bottom: 14px; }
.field-check label {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  font-size: 14px; color: var(--text); font-weight: 500;
  letter-spacing: 0; text-transform: none;
}
.field-check input[type="checkbox"] {
  width: 18px; height: 18px; margin: 0; flex-shrink: 0;
  accent-color: var(--blue);
}

/* Favoriten-Overlay-Badge auf Markt-Detail-Bild (oben links, eBay-Stil) */
.fav-overlay-badge {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--green);
  color: #fff;
  font-weight: 700; font-size: 13px; line-height: 1;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(52, 199, 89, .35), 0 1px 3px rgba(0,0,0,.18);
  letter-spacing: .01em;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

/* Theme-Picker im Profile */
.theme-picker { display: flex; gap: 6px; padding: 4px; background: var(--bg-alt); border-radius: 10px; border: 1px solid var(--line); }
.theme-picker button {
  flex: 1; background: transparent; border: 0; border-radius: 7px;
  padding: 8px 12px; color: var(--text-soft); font-weight: 600; font-size: 13px;
}
.theme-picker button.active { background: var(--blue); color: #fff; }
.top .logo { font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif; font-weight: 900; font-size: 26px; letter-spacing: -1px; color: var(--blue); }
.top nav { display: flex; gap: 2px; }
.top nav a {
  padding: 7px 12px; border-radius: var(--r-sm);
  color: var(--text-soft); font-weight: 500; font-size: 14px;
}
.top nav a.active { background: var(--blue-soft); color: var(--blue); }
.top nav a:hover { text-decoration: none; background: var(--bg-alt); }
.top nav a.active:hover { background: var(--blue-soft); }

/* Topbar Suchfeld */
.search {
  position: relative; flex: 1; max-width: 360px;
}
.search input {
  width: 100%; padding: 9px 14px 9px 36px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-alt); color: var(--text);
  font-size: 14px; outline: none;
  transition: background .15s, border-color .15s;
}
.search input:focus { border-color: var(--blue); background: var(--bg-card); }
.search::before {
  content: ""; position: absolute; left: 12px; top: 50%;
  width: 16px; height: 16px; transform: translateY(-50%);
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><circle cx='7' cy='7' r='5' fill='none' stroke='%2386868B' stroke-width='1.5'/><line x1='11' y1='11' x2='14' y2='14' stroke='%2386868B' stroke-width='1.5' stroke-linecap='round'/></svg>") center/contain no-repeat;
}
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  max-height: 360px; overflow-y: auto;
  z-index: 60;
}
.search-results .res {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line);
}
.search-results .res:last-child { border-bottom: 0; }
.search-results .res:hover { background: var(--bg-alt); }
.search-results .res .av { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-alt) center/cover; }
.search-results .res .name { font-weight: 600; font-size: 14px; }
.search-results .res .meta { font-size: 12px; color: var(--text-soft); }
.search-results .empty { padding: 20px; color: var(--text-soft); text-align: center; font-size: 13px; }

.top .me { display:flex; align-items:center; gap:10px; padding: 4px 10px; border-radius: 999px; cursor:pointer; }
.top .me:hover { background: var(--bg-alt); }
.top .me img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--bg-alt); }
.top .me span { font-size: 13px; color: var(--text-soft); font-weight: 500; }

/* ─── Layout ─── */
.shell { max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; }
.h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; margin: 0 0 4px; }
.h1 + .sub { margin: 0 0 24px; color: var(--text-soft); font-size: 16px; }
.h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; margin: 24px 0 12px; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 0;
  background: var(--blue); color: #fff; font-weight: 600; font-size: 14px;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--blue-hover); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--blue); border: 1px solid var(--line-strong); }
.btn.ghost:hover { background: var(--blue-soft); }
/* Primary = ausdrücklich blau-akzentuiert (für Filter-Apply, "fertig" Buttons) */
.btn.primary { background: var(--blue); color: #fff; border: 1px solid var(--blue); box-shadow: 0 2px 6px rgba(10,77,255,0.22); }
.btn.primary:hover { background: var(--blue-hover); }
.btn.s { padding: 6px 12px; font-size: 13px; }

/* ─── Recovery-Code-Modal ─── responsive für Handy/Tablet/Desktop ─── */
.rec-modal { display: flex; flex-direction: column; gap: 18px; }
.rec-intro { font-size: 14px; line-height: 1.55; margin: 0; color: var(--text); }
.rec-card {
  background: var(--bg-alt);
  border: 2px dashed var(--blue);
  border-radius: 16px;
  padding: 22px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.rec-card-label {
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-soft);
  font-weight: 600;
}
.rec-card-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(20px, 5.5vw, 30px);   /* skaliert mit Viewport: 20px Mobile → 30px Desktop */
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--blue);
  user-select: all;
  cursor: text;
  word-break: break-all;
  line-height: 1.2;
  padding: 6px 8px;
  background: var(--bg-card);
  border-radius: 10px;
  width: 100%;
  box-sizing: border-box;
}
.rec-copy-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(10,77,255,0.20);
  transition: background .15s, transform .08s;
}
.rec-copy-btn:hover { background: var(--blue-hover); }
.rec-copy-btn:active { transform: scale(0.96); }
.rec-hint { font-size: 12.5px; color: var(--text-soft); margin: 0; line-height: 1.5; }

@media (max-width: 640px) {
  .rec-modal { gap: 14px; }
  .rec-intro { font-size: 13.5px; }
  .rec-card { padding: 18px 14px; }
  .rec-card-code { letter-spacing: 0.18em; }
  .rec-copy-btn { padding: 11px 18px; width: 100%; justify-content: center; }
  .rec-hint { font-size: 12px; }
}

/* ─── Admin: Recovery-Code-Anzeige pro User ─── */
.admin-user-recovery { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11.5px; color: var(--text-soft); flex-wrap: wrap; }
.admin-user-recovery .rec-mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.08em;
  background: var(--bg-alt);
  padding: 2px 8px;
  border-radius: 6px;
  user-select: all;
  cursor: text;
  border: 1px solid var(--line);
}
.admin-user-recovery .rec-mono.hidden { color: var(--text-soft); letter-spacing: 0.4em; font-family: inherit; }
.admin-user-recovery button {
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--blue);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
}
.admin-user-recovery button:hover { background: var(--blue-soft); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #D32F2F; }
.btn.green { background: var(--green); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Cards (Marktplatz, Crit, etc.) ─── */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.card .thumb { aspect-ratio: 4/3; background: var(--bg-alt) center/cover; }
.card .body { padding: 14px; }
.card .title { font-weight: 600; font-size: 15px; margin: 0 0 4px; }
.card .meta { font-size: 12px; color: var(--text-soft); }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { padding: 3px 10px; border-radius: 999px; font-size: 11px; background: var(--bg-alt); color: var(--text-soft); }
.tag.blue { background: var(--blue-soft); color: var(--blue); font-weight: 500; }
.tag.green { background: #E8F8EE; color: #1B7A3A; }
.tag.orange { background: #FFF3E0; color: #B85F00; }
.tag.red { background: #FFE5E5; color: #B71C1C; }

/* ─── Crit ─── */
.crit { display: grid; grid-template-columns: 1fr 280px; gap: 16px; padding: 16px; align-items: start; }
.crit .img { aspect-ratio: 4/3; border-radius: var(--r); background: var(--bg-alt) center/cover; }
.crit .info h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.crit .info .author { color: var(--text-soft); font-size: 13px; margin-bottom: 12px; cursor: pointer; }
.crit .info .author:hover { color: var(--blue); }
.crit .axes { display: grid; gap: 10px; }
.crit .axis { background: var(--bg-alt); border-radius: var(--r-sm); padding: 10px 12px; }
.crit .axis .label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-mute); margin-bottom: 4px; }
.crit .axis .val { font-size: 13px; }
.crit .actions { display: flex; gap: 6px; margin-top: 12px; }
.price { font-size: 17px; font-weight: 700; }
.timer { color: var(--red); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12px; }

/* ─── Projekte ─── */
.proj { padding: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-card); margin-bottom: 12px; transition: border-color .15s, box-shadow .15s; }
.proj:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.proj .title { font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.proj .author { color: var(--text-soft); font-size: 13px; cursor:pointer; }
.proj .author:hover { color: var(--blue); }
.proj .desc { margin: 12px 0; font-size: 14px; }

/* Apple-clean File-Picker: nativen Input verstecken, Label als Button stylen */
.file-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-soft, var(--bg-card));
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: border-color .18s cubic-bezier(0.32, 0.72, 0, 1), background .18s cubic-bezier(0.32, 0.72, 0, 1), color .18s, transform .12s;
  user-select: none;
  line-height: 1;
}
.file-pick:hover { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.file-pick:active { transform: scale(.97); }
.file-pick.drag-over {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
  transform: scale(1.02);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.file-pick svg { width: 16px; height: 16px; flex-shrink: 0; }
.file-pick-input { position: absolute; left: -9999px; opacity: 0; width: 0; height: 0; pointer-events: none; }
.file-pick-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-pick-name {
  color: var(--text-soft);
  font-size: 12px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-pick-name.has { color: var(--blue); font-weight: 500; }
/* Rote Verbindlichkeits-Warnung (Kaufanfrage etc.) */
.danger-note {
  background: color-mix(in srgb, #ef4444 10%, transparent);
  border: 1px solid color-mix(in srgb, #ef4444 28%, transparent);
  color: #b91c1c;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  margin: 6px 0 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.danger-note svg { flex-shrink: 0; margin-top: 1px; }
:root[data-theme="dark"] .danger-note { color: #fca5a5; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .danger-note { color: #fca5a5; }
}

/* Dezenter Pixel-Größen-Richtwert unter File-Pickern */
.img-hint {
  font-size: 11px;
  color: var(--text-soft);
  margin: 8px 0 0;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* Bilder in Projekt-Karten + Voting-Karten (Apple-clean: runde Ecken, dezente Border, kontrollierte Höhe) */
.proj-img, .voting-img {
  margin: 4px 0 12px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft, var(--bg-card));
  line-height: 0;
}
.proj-img img, .voting-img img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: cover;
}
.voting-img { margin: 10px 0 14px; }
.proj .roles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.proj .role { padding: 6px 12px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.proj .role.taken { background: var(--bg-alt); color: var(--text-mute); }
.proj .foot { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 8px; }

/* ─── Invite-Modal · Live-Suche ─── */
.inv-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-card);
  margin-top: 6px;
}
.inv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .15s cubic-bezier(0.32, 0.72, 0, 1);
}
.inv-row:last-child { border-bottom: none; }
.inv-row:hover { background: var(--blue-soft); }
.inv-av {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px;
  flex-shrink: 0;
}
.inv-meta { flex: 1; min-width: 0; }
.inv-name { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-empty { color: var(--text-soft); text-align: center; padding: 18px; font-size: 13px; }

/* ─── Einladungs-Karte im Chat-Thread ─── */
.invite-card {
  margin: 10px auto;
  max-width: 80%;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--blue-soft);
  border: 1px solid var(--line);
}
.invite-head { display: flex; align-items: flex-start; gap: 10px; }
.invite-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #fff;
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.invite-info { flex: 1; min-width: 0; }
.invite-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.35; }
.invite-sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.invite-actions { display: flex; gap: 8px; margin-top: 12px; }
.invite-actions .btn { flex: 1; }
.invite-status {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 500;
}
.invite-status.accepted { color: #18a957; }
.invite-status.declined { color: var(--text-soft); }

/* ─── Chat ─── */
.chat-shell { display: grid; grid-template-columns: 280px 1fr; gap: 0; height: calc(100vh - 220px); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.chat-list { border-right: 1px solid var(--line); overflow-y: auto; background: var(--bg-alt); }
.chat-list .item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.chat-list .item:hover { background: var(--bg-card); }
.chat-list .item.active { background: var(--blue-soft); }
.chat-item-body { flex: 1; min-width: 0; }
.chat-list .item .name { font-weight: 600; font-size: 14px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.chat-list .chat-group-icon { color: var(--text-soft); flex-shrink: 0; opacity: 0.85; }
.chat-list .item.is-group .name { color: var(--text); }
.chat-list .item .last { color: var(--text-soft); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Avatar — Insta-Style Kreis (Bild oder Initials-Fallback) */
.chat-av {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-alt) center / cover no-repeat;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px; color: var(--blue);
  letter-spacing: 0.3px;
}
.chat-av--sm { width: 34px; height: 34px; font-size: 12.5px; }
.chat-av--fallback { background: var(--blue-soft); }

/* Chat-Header — Avatar + Name + Aktionen + Back-Button (Mobile) */
.chat-header { display: flex; align-items: center; gap: 12px; }
.chat-header-name { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header-actions { display: inline-flex; gap: 6px; flex-shrink: 0; }
.chat-back {
  display: none; /* Desktop hidden, Mobile in open-View sichtbar */
  background: transparent; border: 0; padding: 4px;
  border-radius: 8px; cursor: pointer; color: var(--text);
  align-items: center; justify-content: center; line-height: 0;
}
.chat-back:hover { background: var(--bg-alt); }
.chat-window { display: flex; flex-direction: column; }
.chat-header { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.chat-msgs--empty { align-items: center; justify-content: center; gap: 0; }
.chat-msgs-hint {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  opacity: 0.6;
  letter-spacing: 0.1px;
  user-select: none;
  pointer-events: none;
}
.msg { max-width: 70%; padding: 10px 14px; border-radius: 18px; font-size: 14px; }
.msg.me { background: var(--blue); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.them { background: var(--bg-alt); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding: 14px; border-top: 1px solid var(--line); position: relative; align-items: center; }
.chat-input input[type="text"] { flex: 1; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-alt); font: inherit; }
.chat-input input[type="text"]:focus { outline: none; border-color: var(--blue); background: var(--bg-card); }

/* ─── Chat-Tools: Bild · Emoji · GIF ─── */
.chat-tools { display: inline-flex; gap: 4px; align-items: center; }
.chat-tool-btn {
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .18s cubic-bezier(0.32, 0.72, 0, 1), color .18s, border-color .18s, transform .12s;
  font-size: 13px; font-weight: 600;
  padding: 0;
}
.chat-tool-btn:hover { background: var(--blue-soft); color: var(--blue); }
.chat-tool-btn:active { transform: scale(.92); }
.chat-tool-btn.active { background: var(--blue-soft); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 25%, transparent); }
.chat-tool-btn svg { width: 18px; height: 18px; }

/* ─── Popup über Chat-Input (Emoji + GIF) ─── */
.chat-pop {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 12px; right: 12px;
  max-height: 340px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.emo-tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); background: var(--bg-alt); }
.emo-tab {
  flex: 1;
  padding: 6px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  transition: background .15s;
}
.emo-tab:hover { background: var(--bg-card); }
.emo-tab.active { background: var(--blue-soft); }
.emo-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 10px;
  overflow-y: auto;
  max-height: 260px;
}
.emo-btn {
  width: 100%; aspect-ratio: 1/1;
  border: none; background: transparent;
  font-size: 22px; line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s, transform .1s;
}
.emo-btn:hover { background: var(--bg-alt); }
.emo-btn:active { transform: scale(.85); }

.gif-search { padding: 10px; border-bottom: 1px solid var(--line); background: var(--bg-alt); }
.gif-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  font: inherit;
  font-size: 13px;
}
.gif-search input:focus { outline: none; border-color: var(--blue); }
.gif-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}
.gif-item {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: 8px;
  background: var(--bg-alt);
  aspect-ratio: 1/1;
  transition: transform .12s;
}
.gif-item:hover { transform: scale(0.98); }
.gif-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gif-empty { padding: 24px 18px; text-align: center; color: var(--text-soft); font-size: 12px; line-height: 1.5; }
.gif-empty code { background: var(--bg-alt); padding: 2px 6px; border-radius: 4px; font-size: 11px; }

/* ─── Media-Message (Bild / GIF) ─── */
.msg.media-msg {
  padding: 0 !important;
  background: transparent !important;
  border-radius: 16px !important;
  overflow: hidden;
  max-width: 240px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.msg.media-msg img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: cover;
  border-radius: 16px;
}
.msg.me.media-msg { align-self: flex-end; }
.msg.them.media-msg { align-self: flex-start; }

/* ─── Hero (landing) ─── */
.hero { text-align: center; padding: 72px 24px 56px; }
.hero .logo-big { font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif; font-weight: 900; font-size: 96px; letter-spacing: -4px; color: var(--blue); line-height: 1; margin: 0 0 16px; }
.hero .claim { font-size: 22px; color: var(--text-soft); max-width: 600px; margin: 0 auto 28px; line-height: 1.4; }
.hero .ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 56px 0; }
@media (max-width: 800px) { .features { grid-template-columns: 1fr 1fr; } }
.feature { padding: 24px 20px; border-radius: var(--r-lg); background: var(--bg-alt); }
.feature .icon { font-size: 32px; margin-bottom: 12px; }
.feature h3 { margin: 0 0 6px; font-size: 16px; }
.feature p { margin: 0; color: var(--text-soft); font-size: 13px; }

/* ─── Profil ─── */
.profile-head {
  position: relative;
  display: grid; grid-template-columns: 140px 1fr; gap: 24px;
  padding: 24px; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  margin-bottom: 24px;
  align-items: start;
}
/* Abmelden-Button — absolute unten rechts, gleiche Höhe wie Erscheinungsbild-Picker links */
.profile-logout-corner {
  position: absolute;
  bottom: 24px;
  right: 24px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  color: var(--blue);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .08s ease;
}
.profile-logout-corner:hover {
  background: var(--blue-soft);
  border-color: var(--blue);
}
.profile-logout-corner:active { transform: scale(0.96); }

/* Recovery-Code-Link im Profil — direkt neben Logout */
.profile-recovery-link {
  position: absolute;
  bottom: 24px;
  right: 110px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--blue);
  background: transparent;
  color: var(--blue);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, transform .08s ease;
}
.profile-recovery-link:hover { background: var(--blue-soft); }
.profile-recovery-link:active { transform: scale(0.96); }
@media (max-width: 640px) {
  .profile-recovery-link { position: static; margin: 10px auto 0; display: block; }
  .profile-logout-corner { position: static; margin: 6px auto; display: block; }
}

/* Persistent-Modal: Backdrop nicht klickbar (kein cursor:pointer) */
.modal-bg.persistent { cursor: default; }
@media (max-width: 640px) {
  .profile-logout-corner {
    position: static;
    align-self: center;
    margin: 14px auto 0;
    display: block;
  }
}
.profile-head .ava-col {
  display: flex; flex-direction: column; gap: 14px; align-items: center;
}
.profile-head .ava-wrap {
  position: relative;
  width: 140px; height: 140px;
  flex-shrink: 0;
}
.profile-head .ava {
  width: 140px; height: 140px; border-radius: 50%;
  background: var(--bg-alt) center/cover; border: 2px solid var(--line);
  display:flex; align-items:center; justify-content:center; font-size: 48px; color: var(--text-mute);
  overflow: hidden;
}
.profile-head .ava-edit {
  position: absolute; bottom: 2px; right: 2px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--blue); color: #fff; border: 3px solid var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer; padding: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  transition: transform .12s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.profile-head .ava-edit:hover { transform: scale(1.08); background: #0050d0; }
.profile-head .ava-edit:active { transform: scale(0.94); }
/* Größere Mobile-Tap-Area + Drag-Drop-Highlight */
@media (hover: none) and (pointer: coarse) {
  .profile-head .ava-edit { width: 52px; height: 52px; font-size: 22px; }
}
/* Theme-Picker kompakt unter Avatar */
.profile-head .ava-col .theme-picker {
  width: 140px;
  flex-direction: column;
  padding: 4px;
  gap: 2px;
}
.profile-head .ava-col .theme-picker button {
  font-size: 12px;
  padding: 6px 8px;
  white-space: nowrap;
}
.profile-head .ava-col .theme-block {
  width: 140px;
}
.profile-head .ava-col .theme-label {
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
  text-align: center;
}

/* Abmelden — eigene separate Sektion */
.profile-logout-row {
  display: flex;
  justify-content: center;
  margin: 24px 0 32px;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
}
.profile-logout-row .btn {
  min-width: 180px;
  justify-content: center;
}
.profile-head h2 { margin: 0; font-size: 24px; letter-spacing: -.3px; }
.profile-head .uni { color: var(--text-soft); margin: 2px 0 14px; font-size: 14px; }
.profile-head .bio { font-size: 15px; margin-bottom: 14px; }
.profile-head .keywords { display: flex; flex-wrap: wrap; gap: 6px; }
.kw { padding: 6px 14px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 13px; font-weight: 500; cursor: pointer; }
.kw.editable { border: 1px dashed var(--blue); }
/* Dark Mode: --blue-soft wird zu #0A1F4D (dunkles Blau).
   Blauer Text drauf wäre unlesbar → Text weiß, Dashed-Border bleibt blau. */
:root[data-theme="dark"] .kw { color: #fff; }
:root[data-theme="dark"] .kw.editable { border-color: rgba(255,255,255,0.55); }
.profile-projects-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.profile-projects-head .toggle { font-size: 12px; color: var(--text-soft); display: flex; align-items: center; gap: 6px; }

/* ─── Visibility-Button (Profil „Projekte zeigen") ──
   Blau wie die anderen Action-Buttons, GRÜNER Border = sichtbar,
   ROTER Border = ausgeblendet. Smooth Border-Color-Animation. */
.vis-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(10,77,255,0.18);
  transition: border-color .35s cubic-bezier(0.32, 0.72, 0, 1),
              background .15s ease,
              box-shadow .15s ease,
              transform .08s ease;
  -webkit-tap-highlight-color: transparent;
}
.vis-btn svg { width: 14px; height: 14px; flex-shrink: 0; opacity: .95; }
.vis-btn:hover { background: var(--blue-hover); box-shadow: 0 2px 6px rgba(10,77,255,0.26); }
.vis-btn:active { transform: scale(0.96); }
.vis-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.vis-btn.on  { border-color: #34C759; box-shadow: 0 1px 3px rgba(52,199,89,0.22); }
.vis-btn.off { border-color: #FF3B30; box-shadow: 0 1px 3px rgba(255,59,48,0.22); }

/* ─── Voting ─── */
.voting {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; margin-bottom: 14px; transition: border-color .15s, box-shadow .15s;
}
.voting:hover { border-color: var(--line-strong); }
.voting .v-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.voting .v-head h3 { margin: 0; font-size: 17px; }
.voting .v-status { font-size: 11px; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.voting .v-status.open   { background: #E8F8EE; color: #1B7A3A; }
.voting .v-status.closed { background: var(--bg-alt); color: var(--text-mute); }
.voting .v-meta { color: var(--text-soft); font-size: 13px; }
.voting .v-desc { margin: 12px 0; font-size: 14px; }
.bar-row { margin-bottom: 8px; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.bar-track { height: 8px; background: var(--bg-alt); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--blue); transition: width .3s; }
.bar-fill.green { background: var(--green); }
.bar-fill.red { background: var(--red); }
.bar-fill.orange { background: var(--orange); }
.vote-options { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.vote-options .opt { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg-card); cursor: pointer; font-size: 14px; }
.vote-options .opt:hover { border-color: var(--blue); color: var(--blue); }
.vote-options .opt.chosen { background: var(--blue); color: #fff; border-color: var(--blue); }
.voting .v-foot { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 14px; }

/* ─── Modal ─── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--bg-card); border-radius: var(--r-lg); max-width: 520px; width: 100%;
  box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto;
  animation: pop .15s ease-out;
}
@keyframes pop { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h3 { margin: 0 0 4px; font-size: 20px; }
.modal .x { float: right; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-soft); background: none; border: 0; padding: 0; }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-soft); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--bg);
  font: inherit; color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--blue); }
.field textarea { resize: vertical; min-height: 80px; }

/* ─── Auth ─── */
.auth-shell { max-width: 420px; margin: 60px auto; padding: 32px; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-lg); }
.auth-shell h2 { margin: 0 0 6px; font-size: 24px; }
.auth-shell p { color: var(--text-soft); margin: 0 0 24px; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 18px; padding: 4px; background: var(--bg-alt); border-radius: 999px; width: 100%; }
.auth-tabs button { flex: 1 1 0; min-width: 0; padding: 9px 8px; border: 0; background: transparent; border-radius: 999px; color: var(--text-soft); font-weight: 600; cursor: pointer; font-family: inherit; font-size: 14px; white-space: nowrap; }
.auth-tabs button.active { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow); }

/* ─── Hero (Pre-Login Start-Screen, Apple-clean) ─── */
.hero-shell,
.hero-shell * { box-sizing: border-box; }
.hero-shell {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 48px 16px 60px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 32px;
  min-height: calc(100vh - 120px);
}
.hero-brand { text-align: center; padding-top: 8px; max-width: 100%; overflow: hidden; }
.hero-logo {
  /* Sync mit .top .logo + .hero .logo-big — überall dasselbe STUDIS:
     Arial Black, weight 900, blau, gleiche tight letter-spacing-Proportion. */
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  font-weight: 900;
  font-size: 56px;
  letter-spacing: -2px;
  color: var(--blue);
  line-height: 1;
  margin: 0 0 16px;
  max-width: 100%;
}
@media (max-width: 380px) { .hero-logo { font-size: 48px; letter-spacing: -1px; } }
.hero-tag {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.25;
  padding: 0 4px;
}
.hero-sub {
  font-size: 13px;
  color: var(--text-soft);
  margin: 0;
  letter-spacing: .01em;
  padding: 0 4px;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 20px 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.04), 0 2px 6px rgba(0,0,0,0.02);
  box-sizing: border-box;
  width: 100%;
}
.auth-card * { box-sizing: border-box; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .field label { font-size: 12px; font-weight: 600; color: var(--text-soft); display: block; margin-bottom: 6px; letter-spacing: .02em; text-transform: uppercase; }
.auth-card .field input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, background .15s;
  -webkit-appearance: none;
  appearance: none;
}
.auth-card .field input:focus { border-color: var(--blue); background: var(--bg-card); }
.hero-cta {
  width: 100%;
  margin-top: 6px;
  padding: 14px 18px;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: filter .15s, transform .08s;
  letter-spacing: .01em;
}
.hero-cta:hover { filter: brightness(1.06); }
.hero-cta:active { transform: scale(0.98); }
.hero-foot {
  font-size: 11px;
  color: var(--text-soft);
  text-align: center;
  margin: 18px 0 0;
  letter-spacing: .02em;
}
@media (max-width: 480px) {
  .hero-shell { padding: 36px 16px 60px; gap: 28px; min-height: auto; }
  .hero-tag { font-size: 20px; }
  .auth-card { padding: 20px 16px 18px; border-radius: 18px; }
}
/* Globaler Overflow-Schutz für die Auth-View — nur body, nicht html.
   max-width: 100% auf html bricht macOS Safari Trackpad-Y-Scroll. */
body { overflow-x: clip; max-width: 100vw; }

/* ─── Comments-Modal (Instagram-Style Bottom-Sheet) ───────────────── */
.cmts-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: cmts-backdrop-in 240ms cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes cmts-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.cmts-modal-backdrop.cmts-modal-closing { animation: cmts-backdrop-out 240ms forwards; }
@keyframes cmts-backdrop-out { to { opacity: 0; } }
.cmts-modal {
  background: var(--bg-card);
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  height: 88vh;
  display: flex;
  flex-direction: column;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: cmts-modal-up 300ms cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes cmts-modal-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.cmts-modal-backdrop.cmts-modal-closing .cmts-modal { animation: cmts-modal-down 240ms forwards; }
@keyframes cmts-modal-down { to { transform: translateY(100%); } }
.cmts-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  position: relative;
  flex-shrink: 0;
}
.cmts-modal-head::before {
  content: "";
  position: absolute; left: 50%; top: 6px;
  transform: translateX(-50%);
  width: 38px; height: 4px;
  background: var(--line-strong); border-radius: 999px;
}
.cmts-modal-title { font-weight: 700; font-size: 15px; padding-top: 6px; }
.cmts-modal-close {
  background: transparent; border: 0; padding: 6px;
  border-radius: 999px; color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.cmts-modal-close:hover { background: var(--bg-alt); }
.cmts-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cmts-modal-body .cmt-thread { padding: 0; border: 0; }
.cmts-modal-empty {
  margin: auto; padding: 40px 16px; text-align: center;
}
.cmts-modal-empty-icon { font-size: 42px; margin-bottom: 10px; opacity: 0.6; }
.cmts-modal-empty-title { font-size: 15px; font-weight: 600; color: var(--text); }
.cmts-modal-empty-sub { font-size: 13px; color: var(--text-soft); margin-top: 4px; }
.cmts-modal-input {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-card);
  flex-shrink: 0;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.cmts-modal-input input {
  flex: 1;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.cmts-modal-input input:focus { border-color: var(--blue); background: var(--bg-card); }
.cmts-modal-send {
  width: 38px; height: 38px;
  border: 0; border-radius: 50%;
  background: var(--blue); color: #fff;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, transform .1s;
  flex-shrink: 0;
}
.cmts-modal-send:hover { background: var(--blue-hover, var(--blue)); }
.cmts-modal-send:active { transform: scale(0.94); }

@media (min-width: 700px) {
  .cmts-modal-backdrop { align-items: center; }
  .cmts-modal {
    height: auto; min-height: 460px; max-height: 78vh;
    border-radius: 20px;
    animation: cmts-modal-scale 240ms cubic-bezier(0.32, 0.72, 0, 1);
  }
  @keyframes cmts-modal-scale { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
  .cmts-modal-head::before { display: none; }
  .cmts-modal-head { padding: 16px 22px; }
  .cmts-modal-title { padding-top: 0; }
}

/* ─── Vote-Score Live-Animation (Apple-style float) ───────────────── */
@keyframes vote-pop-up {
  0%   { transform: translateY(10px); opacity: 0.3; }
  60%  { transform: translateY(-3px); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes vote-pop-down {
  0%   { transform: translateY(-10px); opacity: 0.3; }
  60%  { transform: translateY(3px); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}
.vote-score {
  transition: color .15s ease;
  display: inline-block;
  min-width: 24px;
  text-align: center;
}
.vote-score.animate-up   { animation: vote-pop-up   380ms cubic-bezier(0.32, 0.72, 0, 1); }
.vote-score.animate-down { animation: vote-pop-down 380ms cubic-bezier(0.32, 0.72, 0, 1); }
.vote-score.up   { color: #18a957; }
.vote-score.down { color: #f04438; }

/* Floating +1 / −1 Bubble bei Vote-Klick */
@keyframes vote-delta-fly-up {
  0%   { transform: translate(-50%, 0)   scale(0.7); opacity: 0; }
  20%  { transform: translate(-50%, -8px) scale(1.1); opacity: 1; }
  100% { transform: translate(-50%, -36px) scale(0.9); opacity: 0; }
}
@keyframes vote-delta-fly-down {
  0%   { transform: translate(-50%, 0)   scale(0.7); opacity: 0; }
  20%  { transform: translate(-50%, 8px)  scale(1.1); opacity: 1; }
  100% { transform: translate(-50%, 36px) scale(0.9); opacity: 0; }
}
.vote-delta-bubble {
  position: absolute;
  left: 50%; top: 50%;
  font-size: 14px; font-weight: 700;
  pointer-events: none;
  user-select: none;
  z-index: 5;
}
.vote-delta-bubble.up   { color: #18a957; animation: vote-delta-fly-up   900ms cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.vote-delta-bubble.down { color: #f04438; animation: vote-delta-fly-down 900ms cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* ─── Avatar-Editor: Profilbild-Crop mit Zoom + Pan ─────────────────── */
.ava-edit-stage {
  position: relative;
  width: 280px; height: 280px;
  margin: 0 auto 16px;
  overflow: hidden;
  border-radius: 14px;
  background: #000;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.ava-edit-stage.dragging { cursor: grabbing; }
.ava-edit-stage img {
  position: absolute;
  left: 50%; top: 50%;
  transform-origin: 0 0;
  max-width: none; max-height: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.ava-edit-ring {
  position: absolute; inset: 0;
  pointer-events: none;
  background: rgba(0,0,0,0.45);
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent 0 130px, #000 131px);
          mask: radial-gradient(circle at 50% 50%, transparent 0 130px, #000 131px);
}
.ava-edit-stage::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 260px; height: 260px;
  margin: -130px 0 0 -130px;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.9), 0 0 0 4px rgba(10,77,255,0.55);
}
.ava-edit-controls {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 4px;
}
.ava-edit-controls input[type="range"] {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 999px; background: var(--bg-alt);
  outline: none;
}
.ava-edit-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--blue); border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  cursor: pointer;
}
.ava-edit-controls input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--blue); border: 2px solid #fff;
  cursor: pointer;
}
.ava-edit-icon { font-weight: 700; font-size: 18px; color: var(--text-soft); user-select: none; min-width: 14px; text-align: center; }
@media (max-width: 480px) {
  .ava-edit-stage { width: 240px; height: 240px; }
  .ava-edit-stage::after { width: 220px; height: 220px; margin: -110px 0 0 -110px; }
  .ava-edit-ring { -webkit-mask: radial-gradient(circle at 50% 50%, transparent 0 110px, #000 111px); mask: radial-gradient(circle at 50% 50%, transparent 0 110px, #000 111px); }
}

/* Studiengang-Vorschläge im Registrierungs-Formular */
.course-chips { max-height: 140px; overflow-y: auto; }
.course-chip {
  display: inline-flex; align-items: center; padding: 6px 12px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-card); color: var(--text);
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.course-chip:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.course-chip:active { transform: scale(0.97); }

/* ─── Mobile ─── */
@media (max-width: 720px) {
  .top { padding: 8px 10px; gap: 8px; flex-wrap: wrap; }
  /* Logo: gleiche Größe wie Desktop (26px) — Cem-Wunsch konsistente Brand */
  .top .logo { font-size: 26px; }
  .top nav { order: 3; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .top nav a { white-space: nowrap; padding: 6px 10px; font-size: 13px; }
  /* Search bei < 720 ebenfalls hidden (Konsistenz mit 768-Breakpoint) */
  .search { display: none; }
  .top .me span { display: none; }
  .shell { padding: 18px 12px 100px; }
  .h1 { font-size: 22px; }
  .hero { padding: 36px 14px 32px; }
  .hero .logo-big { font-size: 56px; letter-spacing: -2px; }
  .hero .claim { font-size: 17px; }
  .crit { grid-template-columns: 1fr; }
  .profile-head { grid-template-columns: 100px 1fr; gap: 14px; padding: 16px; }
  .profile-head .ava { width: 100px; height: 100px; }
  .profile-head h2 { font-size: 20px; }
}

/* ─── Helper ─── */
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.muted { color: var(--text-soft); }
.spacer { height: 24px; }
.sep { height: 1px; background: var(--line); margin: 16px 0; }
input, select, textarea { font: inherit; }

/* ─── Crit Kommentare ─── */
.cmts { border-top: 1px solid var(--line); padding-top: 12px; }
.cmt { padding: 8px 0; font-size: 13px; border-bottom: 1px solid var(--line); }
.cmt:last-of-type { border-bottom: 0; }
.cmt-author { font-weight: 600; margin-right: 6px; color: var(--blue); cursor: pointer; }
.cmt-author:hover { text-decoration: underline; }
.cmt-input { display: flex; gap: 8px; margin-top: 10px; }
.cmt-input input { flex: 1; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg); font: inherit; }
.cmt-input input:focus { outline: none; border-color: var(--blue); }

/* ─── Print Style fuer PDF Export ─── */
@media print {
  body { background: #fff; color: #000; font-family: "Times New Roman", Times, serif; }
  .top, .modal-bg, footer, button, .btn { display: none !important; }
  .shell { padding: 0; max-width: none; }
  .pdf-doc { display: block !important; padding: 30mm 25mm; }
  .pdf-head { border-bottom: 2px solid #000; padding-bottom: 16px; margin-bottom: 24px; }
  .pdf-head h1 { font-size: 26px; margin: 0 0 4px; }
  .pdf-head .meta { font-size: 12px; color: #444; }
  .pdf-result { margin: 24px 0; padding: 16px; border: 1px solid #000; }
  .pdf-result h2 { margin: 0 0 8px; font-size: 16px; }
  .pdf-result .winner { font-size: 22px; font-weight: 700; }
  .pdf-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
  .pdf-table th, .pdf-table td { border: 1px solid #000; padding: 6px 10px; text-align: left; }
  .pdf-table th { background: #f0f0f0; }
  .pdf-foot { margin-top: 40px; font-size: 11px; color: #444; border-top: 1px solid #ccc; padding-top: 12px; }
}
.pdf-doc { display: none; }

/* ─── Anfragen Briefumschlag-Icon mit rotem Badge ─── */
.top nav a.req-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  color: var(--text-soft);
}
.top nav a.req-link:hover { background: var(--bg-alt); color: var(--text); }
.top nav a.req-link.active { background: var(--blue-soft); color: var(--blue); }
.req-icon { display: block; }
.req-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--bg);
}
.req-badge[hidden] { display: none; }

/* ─── Admin-Link in Topbar-Nav + Admin-View ─── */
.admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 8px;
  color: #FF3B30;
  text-decoration: none;
  transition: background .15s;
}
.admin-link:hover { background: rgba(255,59,48,0.10); text-decoration: none; }
.admin-link[hidden] { display: none !important; }
.admin-link.active { background: rgba(255,59,48,0.14); }

.admin-shell { max-width: 900px; }
.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-user-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .15s;
}
.admin-user-row.admin-banned { border-color: #FF3B30; background: rgba(255,59,48,0.04); }
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name {
  font-size: 15px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.admin-user-meta { font-size: 12px; color: var(--text-soft); margin-top: 3px; }
.admin-user-actions { display: flex; gap: 6px; flex-shrink: 0; }
.admin-tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 6px; border-radius: 4px; text-transform: uppercase;
}
.admin-tag-admin  { background: var(--blue); color: #fff; }
.admin-tag-banned { background: #FF3B30; color: #fff; }

/* Admin-Delete-Button auf Posts — nur sichtbar wenn body.is-admin */
.post-admin-del {
  display: none;
  margin-left: auto;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,59,48,0.08);
  color: #FF3B30;
  border: 1px solid rgba(255,59,48,0.3);
  border-radius: 6px;
  cursor: pointer;
}
.post-admin-del:hover { background: rgba(255,59,48,0.15); }
body.is-admin .post-admin-del { display: inline-block; }

/* Mobile (≤640): Admin-Row stacked */
@media (max-width: 640px) {
  .admin-user-row { flex-direction: column; align-items: stretch; }
  .admin-user-actions { justify-content: flex-end; }
}

/* ─── Profil-Edit-Modal (Bio + Tags + Farben — Apple-clean) ─── */
.edit-shell { display: flex; flex-direction: column; gap: 22px; }
.edit-section { display: flex; flex-direction: column; gap: 6px; }
.edit-label {
  font-size: 11px; font-weight: 700; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: .8px;
}
.edit-hint { font-size: 12px; color: var(--text-soft); margin: 0; line-height: 1.4; }
.edit-textarea, .edit-input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--bg-alt); color: var(--text);
  font-family: inherit; font-size: 15px; outline: none;
  transition: border-color .15s, background .15s;
  resize: vertical; min-height: 44px;
  box-sizing: border-box;
}
.edit-textarea:focus, .edit-input:focus { border-color: var(--blue); background: var(--bg-card); }
.tag-edit-list { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.tag-edit-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tag-edit-num {
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 50%; background: var(--bg-alt); color: var(--text-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.tag-edit-input {
  flex: 1 1 140px; min-width: 0; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg-alt);
  color: var(--text); font: inherit; font-size: 14px; outline: none;
  transition: border-color .15s, background .15s;
  box-sizing: border-box;
}
.tag-edit-input:focus { border-color: var(--blue); background: var(--bg-card); }
.tag-edit-colors { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tag-color-dot {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; padding: 0;
  transition: transform .12s, border-color .15s;
  touch-action: manipulation;
}
.tag-color-dot:active { transform: scale(0.88); }
.tag-color-dot.active { border-color: var(--text); transform: scale(1.10); }
.tag-c-blue   { background: #0A4DFF; }
.tag-c-pink   { background: #ff2d55; }
.tag-c-purple { background: #af52de; }
.tag-c-green  { background: #34c759; }
.tag-c-orange { background: #ff9500; }
.tag-c-gray   { background: #8e8e93; }

/* Tag-Colors auf den .kw Pills (Profile-View) */
.kw.kw-color-blue   { background: rgba(10,77,255,0.10);  color: #0A4DFF; border-color: rgba(10,77,255,0.25); }
.kw.kw-color-pink   { background: rgba(255,45,85,0.10);  color: #ff2d55; border-color: rgba(255,45,85,0.25); }
.kw.kw-color-purple { background: rgba(175,82,222,0.10); color: #af52de; border-color: rgba(175,82,222,0.25); }
.kw.kw-color-green  { background: rgba(52,199,89,0.10); color: #1b8a3a; border-color: rgba(52,199,89,0.30); }
.kw.kw-color-orange { background: rgba(255,149,0,0.12);  color: #c87100; border-color: rgba(255,149,0,0.30); }
.kw.kw-color-gray   { background: var(--bg-alt); color: var(--text-soft); border-color: var(--line); }
:root[data-theme="dark"] .kw.kw-color-green  { color: #4ed878; }
:root[data-theme="dark"] .kw.kw-color-orange { color: #ffb340; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .kw.kw-color-green  { color: #4ed878; }
  :root[data-theme="auto"] .kw.kw-color-orange { color: #ffb340; }
}

/* Phone: 3-Dot-Pickers in eigene Zeile damit Input voll Breite hat */
@media (max-width: 520px) {
  .tag-edit-row { gap: 8px; }
  .tag-edit-input { flex: 1 1 100%; order: 1; }
  .tag-edit-num { order: 0; }
  .tag-edit-colors { order: 2; flex: 1 1 100%; justify-content: center; gap: 10px; }
  .tag-color-dot { width: 26px; height: 26px; }
}

/* ─── Mobile Faculty-Picker (Cem-Pattern: 1 Button → Modal mit allen Fakultäten) ─── */
/* Mobile-Faculty-Btn ausgeblendet — Cem will altes Pill-Layout */
.fac-mobile-trigger { display: none !important; }
.fac-mobile-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .12s, border-color .12s, transform .08s;
}
.fac-mobile-btn:hover { border-color: var(--blue); color: var(--blue); }
.fac-mobile-btn:active { transform: scale(0.97); }
.fac-mobile-btn svg { opacity: 0.65; }
.fac-mobile-btn .fac-mobile-chev { font-size: 11px; opacity: 0.55; margin-left: 2px; }
/* Modal-Trigger ist auf Tablet+Mobile bewusst hidden (siehe oben im 1024-Block).
   Pills sind ab ≤1024 als horizontale Scroll-Row sichtbar — Cem-Pattern. */

/* Picker-Sheet (Modal-Body) — clean Apple-Liste */
.fac-pk-shell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.fac-pk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
  touch-action: manipulation;
}
.fac-pk-item:hover { background: var(--bg-alt); }
.fac-pk-item.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.fac-pk-item.all,
.fac-pk-item.parent { font-weight: 700; }
.fac-pk-item.sub {
  padding-left: 30px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-soft);
}
.fac-pk-item.sub.active { color: var(--blue); }
.fac-pk-mark {
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  min-width: 14px;
  text-align: right;
}
.fac-pk-group {
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  margin-bottom: 4px;
}
.fac-pk-group:last-child { border-bottom: 0; }
.fac-pk-sublist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 4px;
}

/* ─── Akkordeon-Layout für Faculty-Picker-Modal (Mobile) ───
   Fakultäten untereinander als Akkordeon-Items.
   Klick auf Bubble = Filter-Toggle. Klick auf Chevron = Subfächer-Slide.
   In-Place-Updates ohne Modal-Re-Render → kein UI-Flicker. */
.fac-pk-acc {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 8px;
}
.fac-pk-bubble-row,
.fac-pk-bubble-subrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.fac-pk-bubble-row { margin-bottom: 4px; }
.fac-acc-row {
  display: flex;
  flex-direction: column;
}
.fac-acc-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fac-acc-head .fac-pk-bubble.parent { flex: 1 1 auto; min-width: 0; text-align: left; justify-content: flex-start; }
.fac-acc-chev {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
  font-family: inherit;
  transition: transform .22s cubic-bezier(0.32, 0.72, 0, 1), background .12s, border-color .12s;
}
.fac-acc-chev:active { transform: scale(0.92); }
.fac-acc-chev.open { transform: rotate(180deg); background: var(--bg-alt); }
/* Slide-Animation: max-height + opacity Trick (smooth ohne JS-Höhenberechnung) */
.fac-acc-sub {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .28s cubic-bezier(0.32, 0.72, 0, 1), opacity .22s, padding .22s;
  padding: 0 0 0 14px;     /* Indent damit Sub-Fächer visuell zur Fakultät gehören */
}
.fac-acc-sub.open {
  max-height: 800px;       /* großzügig — Slide wirkt smooth */
  opacity: 1;
  padding: 20px 0 6px 14px;   /* mehr Luft (20 statt 12) zwischen Fakultät und erster Sub-Bubble-Reihe */
}
.fac-pk-bubble {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s, transform .08s;
  white-space: nowrap;
}
.fac-pk-bubble:active { transform: scale(0.96); }
.fac-pk-bubble:hover { background: var(--bg-alt); }
/* Parent (Fakultät) — bold, etwas kleiner damit lange Namen wie
   "Elektro-, Medien- und Informationstechnik" voll reinpassen ohne Cut. */
.fac-pk-bubble.parent {
  font-size: 13px;
  font-weight: 700;
  padding: 9px 14px;
  white-space: normal;       /* erlaubt Umbruch bei sehr langen Bezeichnungen */
  line-height: 1.25;
  text-align: left;
}
/* All (Top-Bubble) — extra prominent */
.fac-pk-bubble.all {
  font-size: 15px;
  font-weight: 800;
  padding: 11px 20px;
  border-color: var(--text);
}
/* Sub-Fächer — kompakter */
.fac-pk-bubble.sub {
  font-size: 12.5px;
  padding: 6px 12px;
  color: var(--text-soft);
}
/* Active-State — alles wird zum dunklen Pill mit weißer Schrift */
.fac-pk-bubble.active {
  background: var(--text);
  color: var(--bg-card);
  border-color: var(--text);
  font-weight: 700;
}
.fac-pk-bubble.all.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* ─── Empty-State (Apple-clean, in jedem Modul wiederverwendbar) ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
}
.empty-state .es-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--text-soft);
}
.empty-state .es-icon svg { width: 30px; height: 30px; }
.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0 0 4px;
  color: var(--text);
}
.empty-state .es-sub {
  font-size: 14px;
  color: var(--text-soft);
  margin: 0 0 22px;
  max-width: 340px;
  line-height: 1.5;
}
.empty-state .es-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 22px;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: filter .15s, transform .08s;
  text-decoration: none;
}
.empty-state .es-cta:hover { filter: brightness(1.06); text-decoration: none; }
.empty-state .es-cta:active { transform: scale(0.97); }

/* ─── Fakultäten-Filter — Apple-clean Top-Rail ─── */
.faculty-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 14px;
  padding: 0;
  background: transparent;
  border: none;
  position: relative;
}
.faculty-filter .filter-label {
  display: none;
}
.fac-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  font-family: inherit;
}
.fac-chip:hover { border-color: var(--blue); color: var(--blue); }
.fac-chip.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

/* ─── Kompakte Fakultäts-Pills mit Popover (Apple-Style) ─── */
.fac-pill-wrap {
  position: relative;
  display: inline-block;
}
.fac-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
  font-family: inherit;
  line-height: 1.4;
  white-space: nowrap;
}
.fac-pill:hover {
  background: var(--bg-alt);
  color: var(--text);
}
.fac-pill.all {
  font-weight: 600;
  color: var(--text);
}
.fac-pill.active {
  background: var(--text);
  color: var(--bg-card);
  border-color: var(--text);
  /* font-weight bewusst NICHT ändern — sonst wächst die Pill beim Aktivieren. */
}
.fac-pill.all.active {
  /* Hintergrund hardcoded weiß → Textfarbe muss auch hardcoded dunkel sein,
     damit's im Dark Mode nicht weiß-auf-weiß wird.
     font-weight wird NICHT geändert (bleibt 600 von .fac-pill.all) —
     sonst springt die Pill-Größe beim Aktivieren.
     BLAUER Strich rundherum → klares Active-Signal "Filter ist auf Alle". */
  background: #FFFFFF;
  color: #111;
  border: 2px solid var(--blue);
  padding: 3px 10px;    /* -1px Padding kompensiert +1px Border damit Pill-Größe stabil bleibt */
  box-shadow: 0 1px 3px rgba(10,77,255,0.18);
}
.fac-pill-chev {
  font-size: 9px;
  opacity: 0.5;
  margin-left: 1px;
  transition: transform .15s ease;
}
.fac-pill:hover .fac-pill-chev {
  opacity: 0.9;
}

/* Popover unter Pill — minimalistisch, Apple-clean */
.fac-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 240px;
  max-width: 320px;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: facPopIn 0.14s ease-out;
}
@keyframes facPopIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fac-pop-item {
  text-align: left;
  padding: 7px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  font-family: inherit;
  transition: background .1s ease;
  line-height: 1.35;
  white-space: normal;
}
.fac-pop-item:hover {
  background: var(--bg-alt);
}
.fac-pop-item.primary {
  font-weight: 600;
  color: var(--blue);
}
.fac-pop-item.active {
  background: var(--text);
  color: var(--bg-card);
}
.fac-pop-item.primary.active {
  background: var(--blue);
  color: #fff;
}
.fac-pop-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 6px;
}

/* ─── Postfach (Anfragen + Chats Inbox) ─── */
.ib-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ib-row:hover { background: var(--bg-alt); border-color: var(--line-strong); }
.ib-row.ib-unread {
  background: var(--blue-soft);
  border-color: rgba(10,77,255,0.25);
}
.ib-row.ib-unread:hover { background: var(--blue-soft); }
.ib-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
}
.ib-row.ib-unread .ib-icon { background: var(--bg-card); color: var(--blue); }
.ib-body { flex: 1 1 auto; min-width: 0; }
.ib-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
}
.ib-meta {
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.ib-preview {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ib-dot {
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  display: inline-block;
}
.ib-meta-tag {
  font-size: 11px;
  color: var(--text-mute);
  background: var(--bg-alt);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  border: 1px solid var(--line);
}
.ib-mute {
  flex: 0 0 auto;
  align-self: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.ib-mute:hover { background: var(--bg-card); border-color: var(--line); color: var(--text); }
.ib-mute.on { color: var(--red); }

/* ─── Marktplatz Mini-Stats auf Karten ─── */
.md-mini-stats {
  display: flex;
  gap: 12px;
  margin: 8px 0 4px;
  font-size: 12px;
  color: var(--text-soft);
}
.md-mini-stats span { white-space: nowrap; }

/* Favoriten-Button Highlight */
.btn.fav-on {
  color: var(--orange);
  border-color: var(--orange);
}
.btn.fav-on:hover { background: rgba(255,149,0,0.08); }

/* ─── Marktplatz-Detail-Seite ─── */
.market-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 32px;
  align-items: start;
}
@media (max-width: 820px) {
  .market-detail { grid-template-columns: 1fr; gap: 20px; }
}
.md-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-alt) center / cover no-repeat;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  position: sticky;
  top: 80px;
}
@media (max-width: 820px) {
  .md-img { position: relative; top: 0; }
}
.md-info { min-width: 0; }
.md-info .h1 { line-height: 1.15; }
.md-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.md-seller {
  font-size: 14px;
  color: var(--blue);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
}
.md-seller:hover { text-decoration: underline; }
.md-price-block {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-alt);
  border-radius: var(--r);
  border: 1px solid var(--line);
}
.md-price-label {
  font-size: 13px;
  color: var(--text-soft);
  font-weight: 500;
}
.md-price-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}
.md-desc {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  margin: 0 0 8px;
}
.md-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.md-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.md-stat .lbl {
  font-size: 11px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.md-stat .val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* Gebote-Log */
.bid-log {
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-card);
}
.bid-head, .bid-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.2fr;
  gap: 12px;
  padding: 12px 16px;
  align-items: center;
  font-size: 14px;
}
.bid-head {
  background: var(--bg-alt);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--line);
}
.bid-row { border-bottom: 1px solid var(--line); }
.bid-row:last-child { border-bottom: none; }
.bid-row.high { background: rgba(52,199,89,0.08); }
.bid-row.high .b-amt { color: var(--green); }
.bid-row .b-user {
  color: var(--blue);
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bid-row .b-user:hover { text-decoration: underline; }
.bid-row .b-amt {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.bid-row .b-time {
  color: var(--text-mute);
  font-size: 13px;
}
.b-tag {
  background: var(--green);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ─── Profil als runder Avatar (Insta-Style) rechts in der Nav ─── */
.top nav a.profile-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: transparent;
  margin-left: 8px;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  text-decoration: none !important;
  -webkit-tap-highlight-color: transparent;
}
.top nav a.profile-link:hover {
  background: transparent;
  text-decoration: none;
}
.top nav a.profile-link:hover .np-ava {
  transform: scale(1.06);
  box-shadow: 0 0 0 2px var(--blue-soft);
}
.top nav a.profile-link.active {
  background: transparent;
  border: 0;
}
.top nav a.profile-link.active .np-ava {
  box-shadow: 0 0 0 2.5px var(--blue), 0 0 0 4.5px var(--bg);
}
.np-ava {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue-soft) center / cover no-repeat;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.5px;
  transition: transform .18s cubic-bezier(0.32, 0.72, 0, 1),
              box-shadow .18s cubic-bezier(0.32, 0.72, 0, 1);
}
.np-ava-fallback { background: var(--blue-soft); color: var(--blue); }
/* Name-Text wird komplett ausgeblendet — Avatar reicht (Insta-Style) */
.np-name { display: none !important; }

/* alte meBox falls noch im DOM — versteckt */
.me { display: none !important; }

/* ─── Feed: Reddit-Style Posts ─── */
.feed-stream {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
  margin: 0 auto;
}
.post {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  transition: border-color .15s, box-shadow .15s;
}
.post:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.post-ava {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-soft) center / cover no-repeat;
  flex: 0 0 auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  font-weight: 700;
  font-size: 13px;
}
.post-ava.fallback { background: var(--blue-soft); color: var(--blue); }
.post-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  line-height: 1.3;
  min-width: 0;
}
.post-author {
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}
.post-author:hover { text-decoration: underline; }
.post-sep { color: var(--text-mute); }
.post-course { color: var(--text-soft); }
.post-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.25;
  color: var(--text);
  margin: 4px 0 14px;
}
.post-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-alt) center / cover no-repeat;
  border-radius: var(--r);
  border: 1px solid var(--line);
}
.post-axes {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.post-axis {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 14px;
}
.post-axis-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--blue);
  margin-bottom: 2px;
}
.post-axis-val {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.post-empty {
  margin: 14px 0 4px;
  font-size: 13px;
  font-style: italic;
}
.post-actions {
  display: flex;
  gap: 4px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.post-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: none;
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.post-btn:hover {
  background: var(--bg-alt);
  color: var(--text);
}
.post-btn svg { display: block; }
.post .cmts {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ─── Reddit-Style Erweiterungen: Faculty/Tags/Body ─── */
.post-faculty {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-soft);
  padding: 2px 9px;
  border-radius: 999px;
  cursor: pointer;
  margin-right: 4px;
  letter-spacing: 0.1px;
  border: 1px solid transparent;
}
.post-faculty:hover {
  border-color: var(--blue);
}
.post-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
}
.post-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-soft);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 999px;
}
.post-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  margin: 0 0 14px;
  white-space: pre-wrap;
}

/* ─── Threaded Comments (Reddit-Style) ─── */
.post .cmts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cmt-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;       /* Abstand zwischen Karte und ihren Children */
}
/* Nested Reply-Container: weitere Luft drumherum + zwischen Geschwister-Replies */
.cmt-children {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
  padding-left: 14px;
  border-left: 2px solid var(--line);
}
/* Top-level Geschwister-Threads (im .cmts-Container schon mit gap:10px) bekommen extra Luft */
.post .cmts > .cmt-thread + .cmt-thread { margin-top: 4px; }
.cmt-card {
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.cmt-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}
.cmt-ava {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue-soft) center / cover no-repeat;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  font-weight: 700;
  font-size: 11px;
  flex: 0 0 auto;
}
.cmt-ava.fallback { background: var(--blue-soft); color: var(--blue); }
.cmt-author {
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}
.cmt-author:hover { text-decoration: underline; }
.cmt-time {
  font-size: 12px;
  color: var(--text-mute);
}
.cmt-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  margin: 0 0 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.cmt-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cmt-reply-btn {
  background: transparent;
  border: none;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.cmt-reply-btn:hover { background: var(--bg-alt); color: var(--text); }
.cmt-reply-form {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-alt);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}
.cmt-reply-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
}
.cmt-reply-form textarea:focus {
  outline: none;
  border-color: var(--blue);
}
.cmt-children {
  margin-top: 8px;
  padding-left: 16px;
  border-left: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cmt-children .cmt-card { background: var(--bg-alt); }

/* Vote-Pill (Up/Down) */
.vote-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-alt);
  border-radius: 999px;
  padding: 2px;
  border: 1px solid var(--line);
}
.vote-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  transition: background .15s, color .15s;
}
.vote-btn:hover {
  background: var(--bg-card);
}
/* Orange-bg + white = ~2.2:1 — WCAG-FAIL. Dunkler Text auf orange = ~9:1 ✓. */
.vote-btn.on.up    { background: var(--orange); color: #1D1D1F; }
.vote-btn.on.down  { background: var(--blue);   color: #fff; }
.vote-btn.up:hover    { color: var(--orange); }
.vote-btn.down:hover  { color: var(--blue); }
.vote-btn.on.up:hover, .vote-btn.on.down:hover { color: #fff; }
.vote-score {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  min-width: 22px;
  text-align: center;
  padding: 0 4px;
}

/* ─── Back-Button (blau, prominent) ─── */
.btn.back-btn {
  background: var(--blue);
  color: #fff;
  border: none;
  font-weight: 600;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: var(--r-sm);
}
.btn.back-btn:hover {
  background: var(--blue-hover);
}

/* fac-chip cursor */
.fac-chip { font-family: inherit; }

/* ─── Mobile: Marktplatz 2-Spalten (Vinted-Style) + kleinere Fakultäts-UI ─── */
@media (max-width: 600px) {

  /* Marktplatz: 2 Karten pro Reihe */
  .market-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .market-grid .card {
    padding: 0;
    overflow: hidden;
    border-radius: var(--r);
  }
  .market-grid .card .thumb {
    aspect-ratio: 1 / 1;
    width: 100%;
    border-radius: 0;
    background-size: cover;
    background-position: center;
  }
  .market-grid .card .body {
    padding: 10px 10px 12px;
  }
  .market-grid .card .title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
  }
  .market-grid .card .meta {
    font-size: 11px;
    margin: 0 0 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .market-grid .card .row.between {
    margin-top: 6px !important;
  }
  .market-grid .card .price {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.2px;
  }
  .market-grid .card .timer {
    font-size: 10px;
  }
  .market-grid .card .tag.green,
  .market-grid .card .tags .tag {
    font-size: 10px;
    padding: 1px 6px;
  }
  .market-grid .card .tags {
    margin-top: 4px;
    flex-wrap: wrap;
    gap: 3px;
  }
  .market-grid .card .md-mini-stats {
    font-size: 10px;
    gap: 8px;
    margin: 6px 0 4px;
    flex-wrap: wrap;
  }
  .market-grid .card .row:last-child {
    flex-wrap: wrap;
    gap: 5px !important;
    margin-top: 8px !important;
  }
  .market-grid .card .btn.s {
    padding: 6px 9px;
    font-size: 12px;
    flex: 1;
    justify-content: center;
    min-width: 0;
  }
  .market-grid .card .btn.s[aria-label="Favorisieren"] {
    flex: 0 0 auto;
    padding: 6px 10px;
  }

  /* Phone (≤ 600): Pills nochmal eine Stufe kompakter, Single-Row bleibt aus dem 1024-Block */
  .faculty-filter { gap: 4px; margin-bottom: 10px; }
  .faculty-filter .fac-pill {
    font-size: 10px;
    padding: 2.5px 7px;
    min-height: auto;
  }
  .faculty-filter .fac-pill-chev { font-size: 7.5px; }
  .faculty-filter .filter-label {
    font-size: 10px;
    letter-spacing: 0.3px;
    margin-right: 2px;
  }
  .fac-chip {
    padding: 4px 10px;
    font-size: 11px;
  }

  /* Faculty-Badge im Post-Header — kleiner */
  .post-faculty {
    font-size: 10px;
    padding: 1px 7px;
  }

  /* Post-Tags auf Mobile kleiner */
  .post-tag {
    font-size: 10px;
    padding: 2px 7px;
  }
}

/* ─── Chat-Sidebar Sections (Anfragen + Nachrichten) ─── */
.chat-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-soft);
}
.chat-section .item .last.muted { font-size: 11.5px; opacity: 0.7; }

/* ═══════════════════════════════════════════════════════════════════
   VOLL-RESPONSIVE DESIGN — Phone < Tablet < Laptop < Desktop
   Breakpoints (Apple-Standard):
     -  640 px = Phone (iPhone, kleine Androids)
     -  768 px = Tablet portrait (iPad mini, iPad)
     - 1024 px = Tablet landscape / kleines Laptop
     - 1180 px = Standard Desktop (max-width Shell)
   ══════════════════════════════════════════════════════════════════ */

/* ─── Globale Defaults (greift auch Desktop) ─── */
.shell { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; }
img, video, .post-img { max-width: 100%; height: auto; }

/* ═══════ TABLET LANDSCAPE / SMALL LAPTOP (1024 px und drunter) ═══════ */
@media (max-width: 1024px) {
  .shell { padding: 24px 18px 80px; }
  .h1 { font-size: 26px; }
  .h2 { font-size: 18px; }
  .market-grid { grid-template-columns: repeat(2, 1fr); }

  /* Insta-Style Single-View für Chat — gilt Tablet + Mobile.
     Liste ODER Konversation, nie beides; Konversation öffnet sich erst per Klick. */
  .chat-shell {
    grid-template-columns: 1fr;
    height: calc(100vh - 240px);
    min-height: 460px;
    border-radius: 14px;
  }
  .chat-list { max-height: none; border-right: 0; }
  .chat-shell--list .chat-window { display: none; }
  .chat-shell--open .chat-list   { display: none; }
  .chat-shell--open .chat-back   { display: inline-flex; }
  .chat-page-title--open         { display: none; }
}

/* ═══════ TABLET PORTRAIT (768 px und drunter — iPad portrait) ═══════ */
@media (max-width: 768px) {
  .shell { padding: 20px 14px 100px; }

  /* Topbar kompakter */
  .top { padding: 8px 14px; gap: 8px; flex-wrap: wrap; }
  /* Logo: gleiche Größe wie Desktop (26px) */
  .top .logo { font-size: 26px; }
  .top nav { gap: 0; flex: 1; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .top nav::-webkit-scrollbar { display: none; }
  .top nav a {
    padding: 6px 10px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  /* Search-Bar im Mobile-View verstecken (sonst springt sie in 2. Zeile als leerer Streifen) */
  .top .search { display: none; }

  /* Profile-Head stacked vertical */
  .profile-head {
    grid-template-columns: 1fr;
    padding: 18px;
    gap: 16px;
    text-align: center;
  }
  .profile-head .ava-col { align-items: center; }
  .profile-head .ava-wrap { width: 120px; height: 120px; }
  .profile-head .ava { width: 120px; height: 120px; font-size: 42px; }
  .profile-head .keywords { justify-content: center; }
  .profile-head .row { justify-content: center; }

  /* Chat-Shell stacked: list on top, window unten — oder Toggle */
  /* Chat-Single-View ist im 1024-Block oben definiert — hier nichts mehr nötig */

  /* Market-Grid: 1 Spalte */
  .market-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Modals: full-width auf mobile */
  .modal {
    max-width: 100% !important;
    margin: 0;
    border-radius: 14px 14px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 90vh;
  }

  /* Faculty-Pills: kleinere Schrift */
  .fac-pill { font-size: 12px; padding: 4px 10px; }

  /* Popover als BOTTOM-SHEET auf Mobile/Tablet — unten zentriert,
     unabhängig von Pill-Position. Robust gegen iOS-Safari-Bugs:
     - transform: translateZ(0) erzwingt eigenen Compositing-Layer
     - z-index 9999 schlägt jede andere Schicht
     - slide-up Animation für klares visuelles Feedback */
  /* Template-Backdrop: lebt im DOM nur solange S.openFacPop truthy ist.
     Verschwindet automatisch beim Rerender wenn Popover zu — keine Race-Cond. */
  .fac-pop-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 998;
    cursor: pointer;
  }
  .fac-pop {
    position: fixed !important;
    width: auto;
    min-width: 240px;
    max-width: calc(100vw - 24px);
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--line);
    box-shadow: 0 16px 48px rgba(0,0,0,0.20), 0 4px 12px rgba(0,0,0,0.10);
    background: var(--bg-card);
    background-clip: padding-box;
    z-index: 9999;
    max-height: 55vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    animation: facPopSlide .18s cubic-bezier(0.32, 0.72, 0, 1);
  }
  @keyframes facPopSlide {
    from { transform: translate3d(0, -6px, 0); opacity: 0; }
    to   { transform: translate3d(0, 0, 0);    opacity: 1; }
  }
  .fac-pop-item {
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.3;
    min-height: 44px;
    box-sizing: border-box;
    border-radius: 10px;
  }
  .fac-pop-item.primary { font-size: 14px; font-weight: 600; }
  .fac-pop-divider { margin: 4px 6px; }
}

/* ═══════ PHONE (640 px und drunter — iPhone, kleines Android) ═══════ */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .shell { padding: 14px 12px 110px; }
  .h1 { font-size: 22px; }
  .h2 { font-size: 16px; }

  /* Topbar minimal */
  .top { padding: 6px 10px; }
  .top .logo { font-size: 18px; letter-spacing: -0.5px; }
  .top nav a { padding: 5px 8px; font-size: 12px; }

  /* Post-Cards kompakter */
  .post { padding: 14px; border-radius: 14px; }
  .post-title { font-size: 16px; }
  .post-body { font-size: 14px; }

  /* Buttons fat-finger-tauglich (min 44 px Tap-Target) */
  .btn { padding: 11px 18px; min-height: 44px; }
  .btn.s { padding: 8px 14px; min-height: 36px; }

  /* Inputs ohne iOS-Zoom (16px Mindestschrift) */
  input, textarea, select { font-size: 16px !important; }

  /* Profile-Head noch enger */
  .profile-head { padding: 14px; }
  .profile-head .ava-wrap { width: 96px; height: 96px; }
  .profile-head .ava { width: 96px; height: 96px; font-size: 34px; }
  .profile-head .ava-edit { width: 32px; height: 32px; font-size: 14px; }

  /* Chat-List höhe begrenzen damit Window mehr Platz hat */
  .chat-list .item { padding: 11px 14px; gap: 11px; }
  .chat-av { width: 42px; height: 42px; font-size: 14px; }
  .chat-msgs { padding: 12px; }
  .msg { font-size: 14px; padding: 8px 12px; }
  .chat-header { padding: 10px 12px; gap: 10px; }
  .chat-header-name { font-size: 14.5px; }
  .chat-input { padding: 10px 12px; transform: translateY(calc(var(--kb-offset, 0px) * -1)); transition: transform .12s ease; }
  body.kb-open .chat-msgs { padding-bottom: calc(12px + var(--kb-offset, 0px)); }

  /* Theme-Picker volle Breite */
  .profile-head .ava-col .theme-block { width: 100%; max-width: 280px; margin: 0 auto; }
  .profile-head .ava-col .theme-picker { width: 100%; flex-direction: row; }
  .profile-head .ava-col .theme-picker button { flex: 1; }

  /* Logout-Button breiter */
  .profile-logout-row .btn { min-width: 60%; }

  /* Toast oberhalb der Bottom-Safe-Area */
  /* Toast über Bottom-Tabbar stacken (Tabbar = ~64px + safe-area) */
  #toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ═══════ SAFE-AREA für iOS Notch + Home-Indicator ═══════ */
@supports (padding: max(0px)) {
  .top { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  .shell {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    padding-bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));
  }
}

/* ═══════ TOUCH-OPTIMIZATION ═══════ */
@media (hover: none) and (pointer: coarse) {
  /* Hover-States gibt's auf Touch nicht — Active-Press deutlicher machen */
  button:active, .btn:active, .fac-pill:active, .fac-pop-item:active {
    opacity: 0.7;
    transform: scale(0.97);
  }
  /* Kein Sticky-Hover */
  .btn:hover, .fac-pill:hover { background: initial; }
}

/* ═══════ LANDSCAPE PHONE — flacher Header ═══════ */
@media (max-height: 500px) and (orientation: landscape) {
  .top { padding: 4px 12px; }
  .shell { padding-top: 12px; }
}

/* ─── Reddit-Style Mini-Sidebar im Feed ─── */
/* ─── Feed-Layout: Feed bleibt exakt zentriert, Sidebar absolute LINKS daneben ─── */
.feed-layout {
  position: relative;
  max-width: 680px;     /* gleich wie Feed-Breite */
  margin: 0 auto;       /* Feed bleibt mittig in der Shell, wie vorher */
}
.feed-main { width: 100%; }
.feed-main .h1 { margin: 0 0 14px; }
.feed-grid { display: contents; }
.feed-stream { max-width: 680px; margin: 0 auto; }

/* Linke Sidebar-Schiene — out of flow, schiebt Feed NICHT zur Seite */
.feed-side-rail {
  position: absolute;
  right: calc(100% + 24px);  /* 24 px Abstand zur linken Feed-Kante */
  top: 0;
  bottom: 0;
  width: 200px;
}

.feed-side {
  /* Sticky innen — bleibt unter Topbar kleben, scrollt natürlich mit dem Layout-Container raus */
  position: sticky;
  top: 76px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.feed-side::-webkit-scrollbar { display: none; }
.feed-side-head { display: none; }
.feed-side-nav {
  display: flex;
  flex-direction: column;   /* vertikal in der Sidebar */
  gap: 2px;
}
.feed-side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.3;
  width: 100%;
}
.feed-side-item:hover { background: var(--bg-alt); }
.feed-side-item.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}
.feed-side-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.feed-side-label { flex: 1; }
.feed-side-meta {
  font-size: 11px;
  color: var(--text-soft);
  padding: 8px 10px 4px;
  border-top: 1px solid var(--line);
  margin-top: 6px;
}

.feed-side-meta { display: none; }

/* Default: Mobile-Sidebar versteckt (nur Desktop-Sidebar greift) */
.feed-side-mobile { display: none; }

/* Responsive: sobald nicht mehr genug Platz LINKS vom Feed → Sidebar geht in flow als Pill-Row */
@media (max-width: 1100px) {
  /* Desktop-Sidebar AUS, Mobile-Variante UNTER dem Feed-Header */
  .feed-side-desktop { display: none; }
  .feed-side-mobile {
    display: block;
    margin: 0 0 10px;
  }
  .feed-side-mobile .feed-side {
    position: relative;
    top: auto;
    display: flex;              /* volle Container-Breite, keine inline-Schrumpfung */
    flex-direction: row;
    overflow: hidden;
    scrollbar-width: none;
    padding: 2px;
    background: var(--bg-alt);
    border: 0;
    border-radius: 999px;
    width: 100%;                /* füllt linken bis rechten Rand des Feed-Containers */
    gap: 0;
  }
  .feed-side-mobile .feed-side::-webkit-scrollbar { display: none; }
  .feed-side-mobile .feed-side-nav {
    display: flex;              /* explizit — kein Default-Override-Risiko */
    flex-direction: row;
    gap: 2px;
    width: 100%;
  }
  .feed-side-mobile .feed-side-item {
    flex: 1 1 0;                /* 3 gleich breite Slots in der Leiste */
    display: inline-flex;
    flex-direction: row;
    padding: 8px 14px;
    white-space: nowrap;
    border: 0;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    width: auto;
    justify-content: center;    /* Icon+Text-Gruppe horizontal zentriert im Slot */
    align-items: center;        /* vertikal mittig */
    text-align: center;         /* belt & suspenders falls justify-content nicht greift */
    color: var(--text-soft);
    gap: 5px;
    min-height: 0;
  }
  .feed-side-mobile .feed-side-item .feed-side-icon { font-size: 11px; width: auto; line-height: 1; }
  .feed-side-mobile .feed-side-item.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  }
}

/* Tablet (≤ 900): noch eine Stufe schlanker */
@media (max-width: 900px) {
  .feed-side-mobile .feed-side { padding: 2px; }
  .feed-side-mobile .feed-side-item {
    padding: 7px 11px;
    font-size: 11.5px;
    line-height: 1.2;
    gap: 5px;
  }
  .feed-side-mobile .feed-side-icon { font-size: 10.5px; }
}

/* Phone (≤ 640): Sort-Pills + Fakultäten noch kompakter */
@media (max-width: 640px) {
  .feed-side-mobile .feed-side { padding: 2px; }
  .feed-side-mobile .feed-side-item {
    padding: 6px 9px;
    font-size: 11.5px;
    line-height: 1.2;
    gap: 4px;
    min-height: 0;
  }
  .feed-side-mobile .feed-side-icon { font-size: 10.5px; line-height: 1; }
  .faculty-filter .fac-pill {
    font-size: 11px;
    padding: 3px 9px;
  }
  .faculty-filter { gap: 4px; margin-bottom: 10px; }
  .feed-main .h1 { margin-bottom: 10px; }
}

/* ─── Unread-Dot (rot wie Topbar-Badge) ─── */
.unread-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(255,59,48,0.35);
}

/* ─── Invite-Button — solid blau, ganz rechts in Topbar ─── */
.invite-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(10,77,255,0.18), 0 0 0 0.5px rgba(255,255,255,0.04) inset;
  transition: background .12s ease, transform .08s ease, box-shadow .12s ease;
  flex-shrink: 0;
  margin-left: auto;  /* schluckt allen Restplatz → ganz rechts */
  order: 99;          /* sicherheitshalber ans Ende, auch beim flex-wrap */
}
.invite-btn:hover {
  background: var(--blue-hover);
  box-shadow: 0 2px 6px rgba(10,77,255,0.28);
}
.invite-btn:active { transform: scale(0.96); }
.invite-btn svg { display: block; }

/* Mobile-Icon-Only-Treatment für .invite-btn wird zentral im
   ≤1024-Block oben gehandhabt (Circle 38×38, ≤480: 36×36). */

/* ─── Language-Switcher — ganz rechts NEBEN Invite-Button ─── */
.lang-wrap {
  position: relative;
  flex-shrink: 0;
  order: 100;   /* nach .invite-btn (order: 99) */
  margin-left: 8px;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s, color .15s;
}
.lang-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.lang-btn:active { transform: scale(0.96); }
.lang-btn svg { display: block; opacity: 0.85; }

/* ─── Tablet + Mobile: BEIDE Buttons als perfekte Kreise erzwingen ──
   Höhere Specificity (.top > ...) + steht NACH den Base-Padding-Regeln,
   damit Source-Order-Konflikte mit padding/width/border-radius gewinnen. */
@media (max-width: 1024px) {
  .top .invite-btn,
  .top .lang-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px;
    min-height: 38px;
    padding: 0 !important;
    gap: 0;
    aspect-ratio: 1 / 1;
    border-radius: 50% !important;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    flex-shrink: 0;
  }
  .top .invite-btn svg,
  .top .lang-btn svg {
    width: 18px;
    height: 18px;
  }
}
@media (max-width: 480px) {
  .top .invite-btn,
  .top .lang-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px;
    min-height: 36px;
  }
  .top .invite-btn svg,
  .top .lang-btn svg {
    width: 17px;
    height: 17px;
  }
}
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  padding: 6px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* hidden-Attribut muss display:flex überschreiben können (sonst schließt das Menü nicht) */
.lang-menu[hidden] { display: none !important; }

/* ─── Tablet + Mobile: Lang-Menü mittig unter Topbar (statt rechts am Edge) ───
   Auf ≤1024px klebt der lang-btn als 38px-Kreis ganz rechts an der Bildkante.
   `right:0` würde das Menü direkt am Screen-Rand öffnen → Teil unsichtbar.
   Lösung: fixed + viewport-zentriert. */
@media (max-width: 1024px) {
  .lang-menu {
    position: fixed;
    top: calc(56px + 8px);   /* Topbar-Höhe (≤1024: ~56px) + Abstand */
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    min-width: 200px;
    max-width: calc(100vw - 32px);
  }
}

/* ─── SMOOTH SCROLLING (Mobile + Desktop) ───
   touch-action: auto auf html/body → MacBook-Trackpad 2-Finger-Pan + Pinch-Zoom
   funktionieren entspannt. Accessibility: User kann auf Mobile Pinch-Zoomen. */
html {
  touch-action: auto;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-overflow-scrolling: touch;   /* iOS momentum scroll */
  scroll-behavior: smooth;             /* CSS-Smooth-Scroll für Anchor-Klicks */
  overflow-y: auto;                    /* explizit Y-scrollbar */
  overflow-x: hidden;                  /* horizontalen Overflow blocken */
  height: auto;                        /* WICHTIG: keine height:100% — sonst lockt body in viewport */
  min-height: 100%;
}
body {
  touch-action: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: none;          /* nur horizontalen Bounce verhindern */
  /* overscroll-behavior-y absichtlich auto: Trackpad-Schwung bleibt. */
  min-height: 100vh;
  height: auto;
}
/* Scroll-Container innerhalb: smooth + momentum */
.modal, .chat-msgs, .fac-pop, .fac-pk-shell,
.shell, main, .feed-stream, .faculty-filter, .feed-side {
  -webkit-overflow-scrolling: touch;
}
/* iOS Safari zoomt auf <16px-Inputs beim Fokus → alle Inputs auf min 16px */
input, textarea, select {
  font-size: max(16px, 1em);
}
@media (max-width: 1024px) {
  input, textarea, select { font-size: 16px; }
}
/* Buttons + Links: kein double-tap-zoom (entfernt auch 300ms delay) */
a, button, .btn, .bb-item, .fac-pill, .lang-btn, .invite-btn,
.pre-login-cta, .hero-cta, .es-cta, .auth-tabs button, .layout-toggle button {
  touch-action: manipulation;
}

/* ─── Pre-Login-State (Topbar minimiert vor Login) ─── */
/* Wenn body NICHT .signed-in hat: Nav + Invite + Search + Profile/Req-Link weg, CTA an */
body:not(.signed-in) .top nav,
body:not(.signed-in) .invite-btn,
body:not(.signed-in) .top .search,
body:not(.signed-in) .top .req-link,
body:not(.signed-in) .top .profile-link {
  display: none !important;
}
body.signed-in .pre-login-cta { display: none !important; }

.pre-login-cta {
  margin-left: auto;
  padding: 9px 18px;
  background: var(--blue);
  color: #fff;
  border-radius: 999px;
  border: 0;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .15s, transform .08s;
}
.pre-login-cta:hover { filter: brightness(1.06); }
.pre-login-cta:active { transform: scale(0.97); }
@media (max-width: 520px) {
  .pre-login-cta { padding: 8px 14px; font-size: 13px; }
}
@media (max-width: 380px) {
  .pre-login-cta { padding: 7px 12px; font-size: 12px; }
}
.lang-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .15s;
}
.lang-menu button:hover { background: var(--bg-alt); }
.lang-menu button.active { background: var(--blue-soft); color: var(--blue); }
.lang-menu .flag { font-size: 16px; line-height: 1; }
.lang-menu .check { margin-left: auto; opacity: 0.85; }

/* ─── GENERELLE REGEL: alle Popover/Dropdown/Modal-Scroll-Container ─────
   Hintergrund bleibt 100% opaque/solide auch wenn drinnen gescrollt wird
   (kein "Cut" vom Page-Backdrop sichtbar). background-clip: padding-box
   sorgt zusätzlich dafür dass border-radius beim overflow:auto sauber
   greift — Items werden vor dem abgerundeten Rand geclippt, nicht hinter. */
.fac-pop,
.fac-pk-shell,
.lang-menu,
.fac-pop-item,
.lang-menu button,
.modal,
.modal-body,
.tree-picker {
  background-clip: padding-box;
}
.fac-pop,
.fac-pk-shell,
.lang-menu,
.modal,
.modal-body,
.tree-picker {
  background-color: var(--bg-card);   /* solide opake card-color, kein Bleed */
}
.fac-pop,
.fac-pk-shell,
.lang-menu,
.tree-picker {
  overscroll-behavior: contain;       /* scroll-chain bleibt im Container */
}

/* Mobile-Icon-Only-Treatment für .lang-btn wird zentral im
   ≤1024-Block oben gehandhabt (Circle 38×38, ≤480: 36×36).
   Hier nur noch das Lang-Menu schmaler ziehen. */
@media (max-width: 640px) {
  .lang-menu { min-width: 160px; }
}

/* ─── Theme-Switch Animation (Apple-clean smooth fade) ─── */
html, body,
.top, .shell,
.profile-head, .post, .market-card, .proj, .modal,
.chat-shell, .chat-list, .chat-window, .chat-list .item, .msg,
.fac-pill, .fac-pop, .fac-pop-item,
.btn, .btn.ghost,
.feed-side, .feed-side-item,
.search input,
.theme-picker, .theme-picker button,
.layout-toggle, .layout-toggle button,
.profile-logout-corner,
.invite-btn,
.unread-dot,
.req-badge,
.kw, .tag {
  transition:
    background-color 0.42s cubic-bezier(0.32, 0.72, 0, 1),
    color           0.42s cubic-bezier(0.32, 0.72, 0, 1),
    border-color    0.42s cubic-bezier(0.32, 0.72, 0, 1),
    box-shadow      0.42s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Schnellere Transitions auf Hover-States (sonst träge) */
.btn:hover, .fac-pill:hover, .feed-side-item:hover,
.layout-toggle button:hover, .invite-btn:hover {
  transition-duration: 0.15s, 0.15s, 0.15s, 0.15s;
}

/* ─── Markt-Layout View-Transition (Apple-clean) ─── */
::view-transition-old(market-grid),
::view-transition-new(market-grid) {
  animation-duration: 0.36s;
  animation-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
}
.market-grid {
  view-transition-name: market-grid;
}

/* Fallback: weiche Transitions auf Card-Größen wenn View Transitions nicht verfügbar */
.market-card,
.market-card .market-img,
.market-card .market-title,
.market-card .market-price,
.market-grid .card,
.market-grid .card .thumb,
.market-grid .card .title {
  transition:
    height 0.32s cubic-bezier(0.32, 0.72, 0, 1),
    font-size 0.32s cubic-bezier(0.32, 0.72, 0, 1),
    padding 0.32s cubic-bezier(0.32, 0.72, 0, 1),
    gap 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.market-grid {
  transition: gap 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Layout-Toggle: kleines Bouncing-Active beim Klick */
.layout-toggle button.active svg { transform: scale(1); }

/* ═══════════════════════════════════════════════════════════════ */
/* ─── BLOCK A · MOBILE-WEB iOS-APP-LIKE OPTIMIZATIONS ──────────── */
/* ═══════════════════════════════════════════════════════════════ */

/* ─── A1 · iOS-Input-Fix (kein Auto-Zoom beim Focus auf Mobile) ─── */
@media (max-width: 1024px) {
  input, textarea, select {
    font-size: 16px !important;  /* iOS zoomed sonst auf 16px-Standard */
    -webkit-appearance: none;
    appearance: none;
  }
}

/* ─── A2 · Tap-Highlight raus (kein grauer iOS-Touch-Flash) ─── */
* {
  -webkit-tap-highlight-color: transparent;
}

/* ─── A3 · Smooth iOS-Style Scrolling ─── */
html {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
body {
  overscroll-behavior-y: contain;  /* kein bounce am body-Rand auf iOS */
}
.chat-msgs, .chat-list, .modal {
  -webkit-overflow-scrolling: touch;
}

/* ─── A4 · Touch-Feedback (Press-Animation auf Touch-Devices) ─── */
@media (hover: none) and (pointer: coarse) {
  .btn, .market-card, .proj, .post, .fac-pill, .feed-side-item, .inv-row,
  .lang-btn, .invite-btn, .chat-tool-btn, .bb-item,
  .modal-foot button, .field input, .theme-picker button {
    transition: transform .12s cubic-bezier(0.32, 0.72, 0, 1), background .15s, opacity .15s;
  }
  .btn:active, .market-card:active, .proj:active, .post:active,
  .fac-pill:active, .feed-side-item:active, .inv-row:active,
  .lang-btn:active, .invite-btn:active {
    transform: scale(0.97);
    opacity: 0.92;
  }
  /* Hover-Effects deaktivieren — Touch hat keinen Hover-State */
  .btn:hover, .market-card:hover, .proj:hover { background: inherit; }
  .invite-btn:hover { background: var(--blue); }  /* solid bleibt solid */
}

/* ─── A5 · Min-Touch-Targets (Apple HIG 44×44 pt) ─── */
@media (hover: none) and (pointer: coarse) {
  .btn.s, .feed-side-item,
  .modal-foot button, .lang-btn, .chat-tool-btn {
    min-height: 44px;
  }
  .btn { min-height: 44px; padding-top: 11px; padding-bottom: 11px; }
  /* .fac-pill bewusst NICHT — Cem-Wunsch: Filter-Pills bewusst kompakt, Größe
     darf sich beim Aktivieren nicht ändern (siehe Faculty-Filter-Block). */
}

/* ─── Faculty-Picker: keine innere Scrollleiste auf Mobile/Tablet ───
   Modal scrollt eh (max-height: 92vh + overflow-y:auto auf .modal).
   Doppel-Scrollbar direkt neben den Chevrons verwirrt → inner Scroll off. */
@media (max-width: 1024px) {
  .fac-pk-shell {
    max-height: none;
    overflow: visible;
    overscroll-behavior: auto;
  }
}

/* ─── A6 · Modal als Bottom-Sheet (Mobile) — Apple-Style ─── */
@media (max-width: 760px) {
  .modal-bg {
    align-items: flex-end;  /* Sheet sliden von unten */
    padding: 0;
  }
  .modal {
    max-width: 100%;
    width: 100%;
    border-radius: 18px 18px 0 0;  /* nur oben rund, unten kantet sich zur Bottom-Bar */
    max-height: 92vh;
    animation: sheetUp .32s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    position: relative;
  }
  /* Drag-Handle oben — visueller Indikator */
  .modal::before {
    content: '';
    position: sticky;
    top: 0;
    display: block;
    width: 36px; height: 5px;
    margin: 8px auto 4px;
    background: var(--line-strong, #d0d4dc);
    border-radius: 999px;
    z-index: 2;
  }
  .modal-foot {
    padding: 12px 20px max(16px, env(safe-area-inset-bottom, 16px));
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--line);
  }
  .modal-foot button {
    flex: 1;  /* Buttons full-width nebeneinander, iOS-Sheet-Style */
    justify-content: center;
  }
  .modal-body { padding: 16px 20px 20px; }
}
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ─── A7 · Safe-Area-Insets erweitern (auch links/rechts, oben) ─── */
@media (max-width: 1024px) {
  .top {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    padding-top: max(10px, env(safe-area-inset-top, 10px));
  }
  .shell {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}

/* ─── A8 · iOS Large-Title-Look für Section-Headers auf Mobile ─── */
@media (max-width: 760px) {
  .h1 {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 8px 0 16px;
  }
  .h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
  .sub { font-size: 14px; color: var(--text-soft); margin-top: -8px; margin-bottom: 16px; }
}

/* ─── A9 · Status-Bar-Color Light/Dark synct mit Body ─── */
/* (theme-color meta wird via JS in applyTheme() umgestellt) */

/* ─── A10 · Body smooth font-rendering auf Mobile ─── */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ─── A11 · Faculty-Pill-Row: WRAP statt scroll auf Mobile,
   damit das .fac-pop Popover nicht von overflow:auto geclipped wird. ─── */
@media (max-width: 760px) {
  .faculty-filter {
    overflow: visible;
    flex-wrap: wrap;
    padding-bottom: 4px;
    scroll-snap-type: none;
  }
  .faculty-filter .fac-pill { flex-shrink: 0; scroll-snap-align: none; }
}

/* ═══════════════════════════════════════════════════════════════
   Cookie-/Storage-Consent-Banner
   ═══════════════════════════════════════════════════════════════ */
#consentBanner {
  position: fixed;
  bottom: 16px; left: 16px; right: 16px;
  z-index: 9999;
  background: var(--bg-card, #fff);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.15);
  padding: 14px 16px;
  max-width: 680px;
  margin: 0 auto;
  animation: consent-in .25s ease;
}
@keyframes consent-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
#consentBanner.consent-out { opacity: 0; transform: translateY(20px); transition: all .25s ease; }
.consent-inner {
  display: flex; gap: 14px; align-items: center;
}
.consent-text { flex: 1; font-size: 13.5px; line-height: 1.45; color: var(--text); }
.consent-text strong { font-weight: 600; }
.consent-text a { color: var(--blue, #007AFF); text-decoration: none; margin: 0 2px; }
.consent-text a:hover { text-decoration: underline; }
@media (max-width: 640px) {
  #consentBanner { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .consent-inner { flex-direction: column; align-items: stretch; gap: 10px; }
  .consent-inner .btn { width: 100%; }
}

/* DSGVO-Reihe im Profil + Mod-Reihe */
.profile-dsgvo-row, .profile-mod-row {
  display: flex; gap: 8px; align-items: center;
  margin-top: 12px; font-size: 13px;
  flex-wrap: wrap;
}
.link-btn {
  background: none; border: none; padding: 4px 8px;
  color: var(--text-soft, #595B61); cursor: pointer;
  font: inherit; font-size: 13px;
  border-radius: 6px;
}
.link-btn:hover { background: var(--bg-alt); color: var(--text); }
.link-danger { color: #B0000F; }
.link-danger:hover { background: rgba(215,0,21,.08); color: #B0000F; }

/* Post-More-Button (Melden) */
.post-more {
  background: none; border: none; padding: 6px 10px;
  font-size: 18px; color: var(--text-mute);
  cursor: pointer; border-radius: 6px; margin-left: auto;
}
.post-more:hover { background: var(--bg-alt); color: var(--text); }
.post-head { display: flex; align-items: center; gap: 10px; }

/* ═══════════════════════════════════════════════════════════════
   Form-Field-Validation (rote Border + Helper-Text unter Input)
   ═══════════════════════════════════════════════════════════════ */
input.input-invalid, textarea.input-invalid, select.input-invalid {
  border-color: #D70015 !important;
  box-shadow: 0 0 0 3px rgba(215,0,21,0.12) !important;
}
.field-error {
  color: #B0000F;
  font-size: 12.5px;
  line-height: 1.35;
  margin-top: 6px;
  padding-left: 2px;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.field-error::before {
  content: "⚠";
  font-size: 13px;
  line-height: 1.2;
  flex-shrink: 0;
}

/* Chat-Empty-State CTA */
.chat-empty-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-mute);
}
.chat-empty-cta .empty-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--bg-alt);
  display: grid; place-items: center;
  color: var(--text-soft);
}
.chat-empty-cta h3 {
  font-size: 16px; font-weight: 600;
  color: var(--text); margin: 0;
}
.chat-empty-cta p { margin: 0; max-width: 280px; font-size: 14px; }
.chat-empty-cta .btn { margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════
   Loading-Skeletons + a11y prefers-reduced-motion
   ═══════════════════════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--line) 0%, rgba(var(--line-rgb,200,200,200),0.6) 50%, var(--line) 100%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}
.skel-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.skel-line { height: 12px; margin: 6px 0; }
.skel-line.w-30 { width: 30%; }
.skel-line.w-60 { width: 60%; }
.skel-line.w-90 { width: 90%; }
.skel-avatar { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; }
.skel-row { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
@keyframes skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* reduce-motion: alle Animationen + transitions auf nahe 0 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .skeleton { animation: none; }
}

/* focus-visible global — keyboard users sehen wo sie sind */
*:focus-visible {
  outline: 2px solid var(--blue, #007AFF);
  outline-offset: 2px;
  border-radius: 4px;
}
