/* Communities (Etappe 2, 13.11.2026): Meine · Entdecken · Orbit · Kanal-Chat · Schublade. Look: tiefraum.css */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--tr-fg);
  font: 500 15px/1.45 var(--tr-font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--tr-cyan); }
.cx-planet, .cx-rein, .cx-kanal, .cx-row, .cx-umschalter a, .cx-faden { text-decoration: none; color: inherit; }
.cx-faden { color: var(--tr-cyan); }
html, body { overflow-x: clip; }
[hidden] { display: none !important; }

.cx-app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px calc(16px + var(--tr-safe-bottom));
}

/* Kopf */
.cx-top {
  position: sticky;
  top: calc(8px + var(--tr-safe-top));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: calc(8px + var(--tr-safe-top));
  padding: 6px;
  border-radius: 999px;
}
.cx-home img { border-radius: 50%; display: block; }
.cx-title {
  flex: 1;
  min-width: 0;
  display: grid;
  justify-items: start;
  gap: 1px;
  padding: 2px 8px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.cx-title-main {
  font-weight: 800;
  font-size: 17px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cx-title-sub { font-size: 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-title-sub:empty { display: none; }

/* Reiter */
.cx-tabs {
  display: flex;
  gap: 6px;
  margin: 14px 0 6px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--tr-bd-soft);
  background: rgba(2, 5, 13, .5);
  align-self: flex-start;
}
.cx-tab {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--tr-mu);
  font-weight: 800;
  text-decoration: none;
}
.cx-tab[aria-current="page"] { color: #02050d; background: var(--tr-grad); box-shadow: var(--tr-glow); }

.cx-main { flex: 1; display: flex; flex-direction: column; outline: none; }
.cx-view { display: grid; gap: 10px; padding-top: 8px; align-content: start; }

/* Zustaende */
.cx-state {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding: 48px 16px;
  color: var(--tr-mu);
}
.cx-state b { color: var(--tr-fg); font-size: 18px; }
.cx-sterne { display: grid; gap: 10px; }
.cx-skel {
  height: 78px;
  border-radius: 22px;
  background: linear-gradient(90deg, rgba(120,160,255,.05), rgba(120,160,255,.11), rgba(120,160,255,.05));
  background-size: 200% 100%;
  animation: cx-skel 1.4s linear infinite;
}
@keyframes cx-skel { to { background-position: -200% 0; } }

/* Gemeinschafts-Karte */
.cx-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  min-height: 76px;
  text-align: left;
  width: 100%;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.cx-row:hover { background: var(--tr-card-hover); }
.cx-row.hat-neues { border-color: rgba(0, 194, 255, .45); }
.cx-ava {
  position: relative;
  width: 50px;
  height: 50px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  color: #02050d;
  background: radial-gradient(circle at 35% 30%, #fff, var(--c, #00c2ff) 38%, color-mix(in srgb, var(--c, #00c2ff) 35%, #02050d));
  box-shadow: 0 0 0 2px var(--tr-bg), 0 0 0 3px color-mix(in srgb, var(--c, #00c2ff) 55%, transparent);
  background-size: cover;
  background-position: center;
}
.cx-ava.bild { color: transparent; }
/* Bild fehlt (404): Initialen bleiben sichtbar, Bild liegt nur darueber */
.cx-ava.bild { color: #02050d; text-shadow: none; }
.cx-ava .cx-da {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--tr-mint);
  box-shadow: 0 0 0 3px var(--tr-bg), 0 0 10px var(--tr-mint);
}
.cx-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cx-row { align-items: flex-start; }
.cx-row .cx-ava { margin-top: 2px; }
.cx-row-kopf { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.cx-row-name { font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.cx-row-zeit { color: var(--tr-mu); font-size: 12px; flex: none; }
.cx-row-text { color: var(--tr-mu); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-row.hat-neues .cx-row-text { color: var(--tr-fg); }
.cx-row-fuss { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.cx-row-fuss .cx-sprung { margin-left: auto; }
.cx-badge {
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
  color: #02050d;
  background: var(--tr-cyan);
  box-shadow: 0 0 12px rgba(0, 194, 255, .6);
  flex: none;
}
.cx-badge.gold { background: var(--tr-gold); box-shadow: 0 0 12px rgba(255, 210, 122, .6); }
.cx-row-seite { display: grid; justify-items: end; gap: 6px; flex: none; align-self: flex-start; padding-top: 2px; }
.cx-sprung {
  appearance: none;
  border: 1px solid var(--tr-bd);
  background: rgba(2, 5, 13, .55);
  color: var(--tr-cyan);
  border-radius: 999px;
  min-height: 32px;
  padding: 0 12px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cx-abschnitt { margin: 14px 4px 2px; }

/* Entdecken */
.cx-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--tr-mu);
}
.cx-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; color: var(--tr-fg); }
.cx-entdecken { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.cx-karte { display: grid; gap: 10px; padding: 14px; align-content: start; }
.cx-karte-kopf { display: flex; gap: 12px; align-items: center; min-width: 0; }
.cx-karte p { margin: 0; color: var(--tr-mu); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cx-karte-fuss { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cx-karte .tr-btn { min-height: 38px; padding: 0 16px; font-size: 14px; }

/* Orbit */
.cx-orbit-wrap {
  position: relative;
  width: min(100% - 40px, 400px);
  aspect-ratio: 1;
  margin: 18px auto 8px;
  touch-action: manipulation;
}
.cx-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.cx-ring.innen { width: 58%; height: 58%; border: 1px solid rgba(0, 194, 255, .45); box-shadow: 0 0 22px rgba(0, 194, 255, .12) inset; }
.cx-ring.aussen { width: 92%; height: 92%; border: 1px dashed rgba(130, 170, 255, .22); }
.cx-kern {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: clamp(14px, 4.4vw, 22px);
  color: #02050d;
  background: radial-gradient(circle at 35% 30%, #fff, color-mix(in srgb, var(--c, #00c2ff) 70%, #fff) 25%, var(--c, #3b5bff) 70%, #1a1f5a);
  box-shadow: 0 0 34px color-mix(in srgb, var(--c, #00c2ff) 65%, transparent);
  background-size: cover;
  background-position: center;
}
.cx-dreh { position: absolute; inset: 0; animation: cx-dreh 90s linear infinite; pointer-events: none; }
.cx-dreh .cx-planet { pointer-events: auto; }
.cx-dreh.gegen { animation-direction: reverse; animation-duration: 140s; }
@keyframes cx-dreh { to { transform: rotate(360deg); } }
.cx-planet {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  gap: 4px;
  appearance: none;
  border: 0;
  background: none;
  padding: 6px;
  cursor: pointer;
  color: inherit;
  min-width: 44px;
  min-height: 44px;
}
.cx-planet-gegen { display: grid; justify-items: center; gap: 4px; animation: cx-dreh 90s linear infinite reverse; }
.cx-dreh.gegen .cx-planet-gegen { animation-duration: 140s; animation-direction: normal; }
.cx-kugel {
  position: relative;
  width: var(--d);
  height: var(--d);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0, var(--c) 36%, color-mix(in srgb, var(--c) 30%, #02050d) 100%);
  box-shadow: 0 0 16px color-mix(in srgb, var(--c) 70%, transparent);
}
.cx-planet.ruhig .cx-kugel { opacity: .38; box-shadow: none; }
.cx-planet.ruhig .cx-plabel { color: var(--tr-mu); }
.cx-schwarm { position: absolute; inset: -7px; border-radius: 50%; border: 1.5px solid var(--c); animation: cx-puls 2s ease-out infinite; }
@keyframes cx-puls { 0% { opacity: .9; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.55); } }
.cx-plabel {
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(2, 5, 13, .78);
  padding: 2px 9px;
  border-radius: 999px;
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cx-pzahl {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #02050d;
  background: var(--tr-cyan);
  box-shadow: 0 0 10px rgba(0, 194, 255, .7);
}
.cx-orbit-info { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 6px; }
.cx-rein { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.cx-rein .cx-punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--tr-cyan); box-shadow: 0 0 10px var(--tr-cyan); flex: none; }
.cx-rein-text { flex: 1; min-width: 0; display: grid; }
.cx-rein-text b { color: var(--tr-fg); }
.cx-rein-text span { color: var(--tr-mu); font-size: 13px; }
.cx-liste { display: grid; gap: 6px; }
.cx-kanal {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 8px 14px;
  text-align: left;
  cursor: pointer;
}
.cx-kanal-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(2,5,13,.6); color: var(--tr-cyan); font-weight: 800; flex: none; }
.cx-kanal-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-kanal.ruhig .cx-kanal-name { color: var(--tr-mu); }
.cx-kat { margin: 10px 4px 0; }
.cx-umschalter { display: flex; justify-content: center; }

/* Chat */
.cx-chat { flex: 1; display: flex; flex-direction: column; padding-top: 6px; gap: 0; }
.cx-msgs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 2px 12px;
  min-height: 50vh;
}
.cx-msg { display: flex; gap: 10px; align-items: flex-end; max-width: 100%; }
.cx-msg.mine { flex-direction: row-reverse; }
.cx-msg .cx-ava { width: 32px; height: 32px; font-size: 12px; box-shadow: none; }
.cx-msg.folge .cx-ava { visibility: hidden; height: 0; }
.cx-blase {
  max-width: min(78%, 520px);
  padding: 8px 13px;
  border-radius: 20px;
  background: var(--tr-card);
  border: 1px solid var(--tr-bd-soft);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.cx-msg.mine .cx-blase {
  background: linear-gradient(135deg, rgba(0,194,255,.26), rgba(123,109,255,.26));
  border-color: rgba(0,194,255,.42);
}
.cx-msg.erwaehnt .cx-blase { box-shadow: var(--tr-glow); border-color: var(--tr-cyan); }
.cx-msg.wartet .cx-blase { opacity: .6; }
.cx-msg.fehler .cx-blase { border-color: var(--tr-rose); }
.cx-wer { display: flex; gap: 8px; align-items: baseline; font-size: 12px; margin: 10px 0 2px 42px; color: var(--tr-mu); }
.cx-wer b { color: var(--tr-fg); font-weight: 800; }
.cx-msg.mine + .cx-wer, .cx-wer.mine { justify-content: flex-end; margin: 10px 4px 2px 0; }
.cx-at { color: var(--tr-cyan); font-weight: 700; }
.cx-bild { display: block; max-width: 240px; max-height: 260px; border-radius: 14px; margin-top: 4px; }
.cx-reakt { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.cx-reakt span { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: rgba(2,5,13,.55); border: 1px solid var(--tr-bd-soft); }
.cx-faden { font-size: 12px; color: var(--tr-cyan); margin-top: 4px; }
.cx-tag { align-self: center; margin: 12px 0 4px; }
.cx-mehr { align-self: center; margin: 4px 0 8px; }
.cx-neu { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--tr-safe-bottom)); z-index: 15; box-shadow: var(--tr-glow); cursor: pointer; }
.cx-composer {
  position: sticky;
  bottom: calc(10px + var(--tr-safe-bottom));
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 18px;
  border-radius: 26px;
  z-index: 10;
}
.cx-composer textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  resize: none;
  max-height: 140px;
  padding: 10px 0;
  font-size: 16px;
  line-height: 1.35;
  color: var(--tr-fg);
}
.cx-send {
  appearance: none;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--tr-grad);
  color: #02050d;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--tr-glow);
}
.cx-send:disabled { opacity: .45; box-shadow: none; }
.cx-hinweis { text-align: center; color: var(--tr-mu); font-size: 13px; padding: 10px; }

/* Schublade */
.cx-drawer-shade, .cx-sheet-shade { position: fixed; inset: 0; z-index: 40; background: rgba(2, 5, 13, .6); }
.cx-drawer {
  position: fixed;
  z-index: 41;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(88vw, 360px);
  display: flex;
  border-radius: 0 28px 28px 0;
  border-left: 0;
  padding: calc(12px + var(--tr-safe-top)) 0 calc(12px + var(--tr-safe-bottom));
  transform: translateX(0);
  transition: transform .22s ease;
}
.cx-drawer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 2px;
  background: var(--tr-grad);
  box-shadow: 0 0 16px var(--tr-cyan);
  border-radius: 2px;
}
.cx-drawer.zu { transform: translateX(-105%); }
.cx-drawer-rail {
  width: 72px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  overflow-y: auto;
  border-right: 1px solid var(--tr-bd-soft);
}
.cx-drawer-rail button { appearance: none; border: 0; background: none; padding: 0; cursor: pointer; position: relative; border-radius: 50%; }
.cx-drawer-rail .cx-ava { width: 46px; height: 46px; font-size: 15px; }
.cx-drawer-rail button[aria-current="true"] .cx-ava { box-shadow: 0 0 0 2px var(--tr-bg), 0 0 0 4px var(--tr-cyan); }
.cx-drawer-rail .cx-badge { position: absolute; top: -4px; right: -6px; min-width: 20px; height: 20px; font-size: 11px; padding: 0 5px; }
.cx-drawer-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0 12px; }
.cx-drawer-head { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.cx-drawer-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.cx-drawer-list { flex: 1; overflow-y: auto; display: grid; gap: 4px; align-content: start; padding-bottom: 12px; }
.cx-drawer-list .cx-kanal { min-height: 44px; border-radius: 16px; }
.cx-drawer-list .cx-kanal[aria-current="true"] { background: var(--tr-card-hover); border-color: var(--tr-cyan); }

/* Blatt (Regeln, Hinweise) */
.cx-sheet {
  position: fixed;
  z-index: 41;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82dvh;
  overflow-y: auto;
  border-radius: 28px 28px 0 0;
  border-bottom: 0;
  padding: 10px 20px calc(20px + var(--tr-safe-bottom));
  display: grid;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
}
.cx-sheet::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--tr-grad);
  box-shadow: 0 0 16px var(--tr-cyan), 0 0 30px var(--tr-violet);
}
.cx-sheet-grab { width: 40px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.25); margin: 0 auto; }
.cx-sheet h2 { margin: 0; font-size: 20px; }
.cx-sheet-body { color: var(--tr-mu); white-space: pre-wrap; overflow-wrap: anywhere; }
.cx-sheet-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.cx-toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--tr-safe-bottom));
  transform: translateX(-50%);
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(10, 17, 36, .95);
  border: 1px solid var(--tr-bd);
  box-shadow: var(--tr-glow);
  font-weight: 700;
  text-align: center;
}

@media (min-width: 1024px) {
  .cx-app { padding-left: 24px; padding-right: 24px; }
}
