/* =========================================
   hudel – Authentic Jodel Web Experience
   ========================================= */

:root {
  color-scheme: dark;
  --bg-primary: #1a1a2e;
  --bg-secondary: #232342;
  --bg-card: #2a2a42;
  --text-primary: #ffffff;
  --text-secondary: #b8b8d0;
  --text-muted: #7a7a9a;
  --accent: #ff6b6b;
  --identity-anon: #6c5ce7;
  --identity-anon-deep: #4e3ec4;
  --identity-named: #3f6bfe;
  --identity-named-deep: #2749c9;
  --accent-gradient: linear-gradient(135deg, #ff6b6b, #ffb347, #4ecdc4);
  --border-radius: 16px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-elevated: 0 12px 48px rgba(0, 0, 0, 0.5);
  --transition: all 0.2s ease;
  --header-height: 60px;
  --footer-height: 60px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-primary);
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  overflow-x: clip;
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
input,
textarea {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

/* ---- HEADER ---- */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  box-sizing: border-box;
  background: linear-gradient(135deg, #1e1e38 0%, #2a1a3e 100%);
  backdrop-filter: blur(20px);
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
#footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: linear-gradient(180deg, #1a1a30 0%, #16162a 100%);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 100;
}
.footer-inner {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  height: var(--footer-height);
  max-width: 600px;
  margin: 0 auto;
  padding: 0 8px;
}
.footer-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.footer-action-btn:hover,
.footer-action-btn[aria-expanded="true"] {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}
.footer-star-btn,
.footer-channels-btn,
.footer-notify-btn {
  color: #fff;
}
.footer-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.footer-action-btn .notify-badge {
  position: absolute;
  top: -6px;
  right: -9px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  line-height: 14px;
  margin: 0;
}
/* Horizontal swipes belong to the channel drawer gesture, vertical ones to the page. */
#header,
#footer,
#main-content,
#channel-drawer,
#channel-drawer-overlay {
  touch-action: pan-y;
}

.header-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  height: var(--header-height);
  padding: 0 16px;
  max-width: 600px;
  margin: 0 auto;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.header-left {
  overflow: hidden;
}
.header-right {
  justify-self: end;
  flex: 0 0 auto;
}
.topbar-center-btn {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pin-post-btn {
  width: auto;
  min-width: 34px;
  padding: 0 10px;
  gap: 5px;
  border-radius: 999px;
  color: #fff;
  opacity: 0.4;
}
.pin-post-btn.is-pinned {
  opacity: 1;
  background: rgba(255,255,255,0.1);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.7);
}
.pin-post-btn svg {
  flex-shrink: 0;
}
.pin-post-count {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.notify-read-btn {
  color: #fff;
  opacity: 1;
  background: rgba(255,255,255,0.1);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.7);
}
.notify-read-btn:hover {
  background: rgba(255,255,255,0.16);
}
.notify-read-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.pin-post-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.header-mascot {
  display: block;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
  transition: transform 120ms ease;
}
#account-btn:hover .header-mascot {
  transform: scale(1.06);
}

#feed-title {
  display: flex;
  align-items: baseline;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}
.feed-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feed-title-text-button {
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.feed-title-text-button:hover {
  text-decoration: underline;
}
.feed-title-channel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  border: none;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.feed-title-channel:hover {
  text-decoration: underline;
}
.feed-title-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.feed-title-pill::after {
  content: '';
  width: 5px;
  height: 5px;
  margin-top: -2px;
  border-right: 1.5px solid rgba(255,255,255,0.65);
  border-bottom: 1.5px solid rgba(255,255,255,0.65);
  transform: rotate(45deg);
  flex: 0 0 auto;
}
.feed-title-pill:hover {
  background: rgba(255,255,255,0.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
  text-decoration: none;
}
.feed-title-suffix {
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .header-inner {
    padding: 0 12px;
    column-gap: 8px;
  }
  #feed-title {
    font-size: 15px;
  }
}
@media (max-width: 450px) {
  .feed-title-pill-compact {
    gap: 4px;
    padding: 0 6px;
    font-size: 13px;
  }
}
@media (max-width: 360px) {
  .feed-title-pill-compact {
    gap: 2px;
    padding: 0 3px;
    font-size: 11px;
  }
}
.channel-switcher-chevron {
  flex-shrink: 0;
  color: var(--text-secondary);
}
.notify-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  height: 34px;
  padding: 0 5px 0 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.55);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.notify-switch-state {
  min-width: 1.7em;
  text-align: center;
}
.notify-switch-track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(0,0,0,0.35);
}
.notify-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.72);
  transition: transform 0.16s ease;
}
.notify-switch.is-on {
  border-color: transparent;
  background: #1f9d55;
  color: #fff;
}
.notify-switch.is-on .notify-switch-track {
  background: rgba(0,0,0,0.22);
}
.notify-switch.is-on .notify-switch-knob {
  background: #fff;
  transform: translateX(16px);
}
.notify-switch:disabled {
  opacity: 0.55;
  cursor: default;
}
@media (prefers-reduced-motion: reduce) {
  .notify-switch-knob { transition: none; }
}
.channel-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(260px, calc(100vw - 32px));
  max-height: min(360px, 60vh);
  overflow-y: auto;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  box-shadow: var(--shadow-elevated);
  z-index: 20;
}
.channel-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.channel-menu-item:hover {
  background: rgba(255,255,255,0.06);
}
.channel-menu-item.active {
  background: rgba(255,255,255,0.1);
  font-weight: 700;
}
.channel-menu-item .channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hamburger */
.hamburger {
  width: 28px;
  height: 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 2px;
  border-radius: 6px;
  transition: var(--transition);
}
.hamburger:hover { background: rgba(255,255,255,0.08); }
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: rgba(255,255,255,0.6);
  border-radius: 2px;
  transition: var(--transition);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  flex-shrink: 0;
}
.logo h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #ff6b6b, #ffb347, #4ecdc4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Refresh */
.refresh-btn {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.refresh-btn:hover {
  background: rgba(255,255,255,0.1);
}
.refresh-btn svg {
  transform-origin: center;
  transition: transform 0.3s ease;
}
.refresh-btn:active svg {
  transform: rotate(90deg);
}
.account-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--account-color, var(--identity-anon));
  color: #1a1228;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
}
button.account-circle:hover {
  filter: brightness(1.08);
}
button.account-circle:active {
  filter: brightness(0.94);
}
.account-circle.is-anon {
  background: var(--identity-anon);
  color: #fff;
}
#account-btn {
  flex-basis: 28px;
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 0 0 1.5px var(--account-color, var(--identity-anon));
}
.account-row .account-circle {
  flex-basis: 32px;
  width: 32px;
  height: 32px;
  font-size: 14px;
  cursor: default;
}
.account-row .account-circle .ghost-icon {
  width: 18px;
  height: 18px;
}
.install-btn:active svg {
  transform: none;
}
.notify-badge {
  border-radius: 999px;
  background: #7dcea0;
  color: white;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.92);
}

/* ---- CHANNEL DRAWER (opened from the footer) ---- */
#channel-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  /* Keep the header and footer above the backdrop and drawer. */
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#channel-drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#channel-drawer {
  position: fixed;
  left: 50%;
  bottom: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px));
  width: min(600px, 100%);
  height: min(62vh, 620px);
  background: linear-gradient(180deg, #1a1a30 0%, #16162a 100%);
  /* Below the fixed header/footer: the drawer slides out from behind the footer. */
  z-index: 90;
  transform: translate(-50%, calc(100% + var(--footer-height) + 12px));
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
#channel-drawer.open {
  transform: translate(-50%, 0);
  pointer-events: auto;
}

#install-sheet {
  position: fixed;
  z-index: 320;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
  padding: 0 max(16px, calc((100vw - 600px) / 2 + 16px)) 0;
}
.install-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 16, 0.45);
  backdrop-filter: blur(4px);
}
.install-sheet-card {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-bottom: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  box-shadow: 0 -8px 28px rgba(0,0,0,0.28);
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  color: var(--text-primary);
}
.install-sheet-card p {
  font-size: 16px;
  font-weight: 650;
  margin-bottom: 12px;
}
.install-sheet-card ol {
  margin: 0 0 16px 1.2em;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
}
.install-sheet-card li + li {
  margin-top: 6px;
}
.install-sheet-card strong {
  color: var(--text-primary);
  font-weight: 650;
}
.install-sheet-card button {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 14px;
  color: white;
  background: linear-gradient(135deg, var(--identity-anon), var(--identity-anon-deep));
  cursor: pointer;
}

/* ---- Channel Drawer ---- */
.channel-drawer-search-row {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 4px 0 10px;
  background: #1a1a30;
}
.channel-drawer-create-btn {
  flex-shrink: 0;
  width: 100%;
  padding: 11px 16px;
  border: none;
  border-radius: 12px;
  background: var(--account-color, var(--identity-anon));
  color: #1a1228;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
body:not(.posting-named) .channel-drawer-create-btn {
  color: #fff;
}
.channel-drawer-create-btn:hover {
  filter: brightness(1.08);
}

.channel-drawer-search {
  position: relative;
  flex: 1;
  min-width: 0;
}
.channel-drawer-search svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.channel-drawer-search input {
  width: 100%;
  height: 34px;
  padding: 0 30px 0 33px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.channel-drawer-search input::placeholder {
  color: var(--text-muted);
}
.channel-drawer-search input:focus {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
}
.channel-drawer-search input::-webkit-search-decoration,
.channel-drawer-search input::-webkit-search-cancel-button,
.channel-drawer-search input::-webkit-search-results-button,
.channel-drawer-search input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}
.channel-drawer-empty {
  padding: 6px 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.channel-drawer-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 0;
  margin-top: 2px;
}

.channel-drawer-channel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-secondary);
}

.channel-drawer-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.channel-drawer-copy .channel-name {
  flex: none;
}
.channel-drawer-desc {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-drawer-channel:hover {
  background: rgba(255,255,255,0.06);
}
.channel-drawer-channel.active {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border-left: 3px solid var(--accent);
}

.channel-name {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}
.channel-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-right: -5px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.26);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, background 0.15s ease;
}
.channel-star:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.6);
}
.channel-star svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}
.channel-star.is-starred {
  color: #fff;
}
.channel-star.is-starred svg {
  fill: currentColor;
}
.channel-star.is-starred:hover {
  color: #fff;
}
.channel-star:disabled {
  cursor: default;
  opacity: 1;
}

/* ---- MAIN CONTENT ---- */
#main-content {
  padding-top: calc(var(--header-height) + env(safe-area-inset-top, 0px) + 20px);
  padding-bottom: calc(var(--footer-height) + 24px + env(safe-area-inset-bottom, 0px));
  padding-left: 16px;
  padding-right: 16px;
  max-width: 600px;
  margin: 0 auto;
}

/* ---- COMPOSE ---- */
#compose-section {
  margin-bottom: 24px;
}

.fab-post {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(var(--footer-height) + 18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: 64px;
  height: 64px;
  border: 5px solid rgba(244, 246, 251, 0.85);
  border-radius: 50%;
  background: rgba(18, 18, 28, 0.72);
  color: #f4f6fb;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fab-post:hover {
  transform: translateX(-50%) scale(1.05);
}
.fab-post:active {
  transform: translateX(-50%) scale(0.96);
}
.fab-post.hidden {
  display: none;
}
#feed-section {
  padding-bottom: 84px;
}

.compose-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255,255,255,0.05);
  position: relative;
}
/* The poll lives inside the colored post area, not in its own block below it. */
.compose-post {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  overflow: hidden;
  transition: var(--transition);
}
.compose-post:focus-within {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
}
.compose-post.has-color {
  border-color: rgba(255,255,255,0.28);
}
.compose-post #post-input {
  min-height: 140px;
  border: none;
  border-radius: 0;
  background: transparent;
}
.compose-post.has-poll #post-input {
  min-height: 0;
  field-sizing: content;
  overflow-y: auto;
}
.compose-post #post-input:focus {
  border-color: transparent;
  background: transparent;
}

.color-swatches-row {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
}
.compose-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
#post-settings-toggle[aria-expanded="true"] {
  background: rgba(63, 107, 254, 0.28);
  color: #e3ebff;
}
.color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.12s ease;
  outline: none;
  padding: 0;
  position: relative;
  flex-shrink: 0;
}
.color-swatch:hover {
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(255,255,255,0.2);
}
.color-swatch.selected {
  border-color: #fff;
}

.compose-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.anonymous-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.compose-channel-picker {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.compose-channel-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 5px 8px 5px 10px;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.72);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.compose-channel-btn:hover {
  background: rgba(255,255,255,0.14);
}
#compose-channel-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compose-channel-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 6;
  width: min(280px, calc(100vw - 64px));
  max-height: min(320px, 55vh);
  overflow-y: auto;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  box-shadow: var(--shadow-elevated);
}
.compose-channel-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compose-channel-item:hover {
  background: rgba(255,255,255,0.08);
}
.compose-channel-item.is-active {
  background: rgba(255,255,255,0.14);
  font-weight: 700;
}

.compose-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--text-primary);
  resize: none;
  outline: none;
  transition: var(--transition);
  min-height: 88px;
}
#post-input {
  min-height: 140px;
}
.compose-input.has-color,
.compose-input.has-color:focus {
  color: #fff;
  border-color: rgba(255,255,255,0.28);
}
.compose-input.has-color::placeholder {
  color: rgba(255,255,255,0.62);
}
.compose-input:focus {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
}
.compose-input::placeholder {
  color: var(--text-muted);
}
/* Comment composers should use the same type as the comments they sit with. */
#detail-comment-input,
#comment-input {
  min-height: 0;
  overflow-y: hidden;
  transition: background 0.2s ease, border-color 0.2s ease;
}
#detail-comment-input {
  font-size: 16px;
  font-weight: 450;
  line-height: 1.55;
}
#comment-input {
  font-size: 14px;
  line-height: 1.5;
}

.compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.compose-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
#compose-poll-toggle[aria-pressed="true"] {
  background: rgba(63, 107, 254, 0.28);
  color: #fff;
}
.compose-poll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 14px 14px;
}
.compose-post.has-color .compose-poll-title {
  color: rgba(255,255,255,0.72);
}
.compose-post.has-color .compose-poll-add {
  color: rgba(255,255,255,0.82);
}
.compose-post.has-color .compose-poll-input {
  border-color: rgba(255,255,255,0.26);
}
.compose-post.has-color .compose-poll-input::placeholder {
  color: rgba(255,255,255,0.62);
}
.compose-post.has-color .compose-poll-remove-option {
  color: rgba(255,255,255,0.8);
}
.compose-poll-title {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.compose-poll-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.compose-poll-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.compose-poll-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(0,0,0,0.18);
  color: var(--text-primary);
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.compose-poll-input::-webkit-search-decoration,
.compose-poll-input::-webkit-search-cancel-button,
.compose-poll-input::-webkit-search-results-button,
.compose-poll-input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}
.compose-poll-input:focus {
  border-color: rgba(255,255,255,0.25);
}
.compose-poll-input::placeholder {
  color: var(--text-muted);
}
@media (max-width: 360px) {
  .compose-poll-input {
    padding: 8px;
    font-size: 13px;
  }
}
.compose-poll-remove-option {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.compose-poll-remove-option:disabled {
  opacity: 0.3;
  cursor: default;
}
.compose-poll-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.compose-poll-add {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 2px 4px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.compose-poll-add:disabled {
  opacity: 0.4;
  cursor: default;
}

.char-counter {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.char-counter .char-count {
  font-weight: 600;
  color: var(--text-secondary);
}

/* Every send button follows the profile circle: purple with white text for the
   anonymous account, the account color with dark text for a named account. */
#post-btn,
#comment-btn,
#detail-comment-btn {
  background: var(--identity-anon);
  color: #fff;
}
body.posting-named #post-btn,
body.posting-named #comment-btn,
body.posting-named #detail-comment-btn {
  background: var(--account-color, var(--identity-named));
  color: #1a1228;
}
.send-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 16px;
  border: none;
  border-radius: 24px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
}
.send-as {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.send-who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 8em;
}
.send-btn .ghost-icon {
  width: 16px;
  height: 16px;
}
.send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.35);
}
body.posting-named .send-btn:hover {
  box-shadow: 0 4px 16px rgba(63, 107, 254, 0.35);
}
#post-btn:hover,
#comment-btn:hover,
#detail-comment-btn:hover {
  box-shadow: 0 4px 16px color-mix(in srgb, var(--identity-anon) 45%, transparent);
}
body.posting-named #post-btn:hover,
body.posting-named #comment-btn:hover,
body.posting-named #detail-comment-btn:hover {
  box-shadow: 0 4px 16px color-mix(in srgb, var(--account-color, var(--identity-named)) 45%, transparent);
}
.send-btn:active {
  transform: scale(0.97);
}

/* ---- New Post Indicator ---- */
#new-post-banner {
  position: fixed;
  left: max(16px, calc((100vw - 600px) / 2 + 16px));
  bottom: calc(var(--footer-height) + 18px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
  min-width: 40px;
  padding: 0 12px 0 10px;
  border: none;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  cursor: pointer;
  transition: var(--transition);
}
#new-post-banner:hover {
  background: var(--bg-secondary);
}
#new-post-banner svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ---- POSTS ---- */
#posts-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  display: flex;
  flex-direction: column;
  min-height: 160px;
  border-radius: var(--border-radius);
  padding: 15px;
  color: #fff;
  position: relative;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  overflow: hidden;
}
.post-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 100%);
  pointer-events: none;
}
.post-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.post-author-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.post-author-btn,
.post-anon-label {
  min-width: 0;
  overflow: hidden;
}
.post-author-label,
.post-anon-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post-card-header .post-anon-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  overflow: visible;
  opacity: 1;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.82);
}

.post-channel-badge,
.comment-badge,
.post-op-badge,
.me-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 1px 8px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.3px;
  background: rgba(255,255,255,0.24);
  color: rgba(255,255,255,0.95);
}
.post-channel-badge {
  border: none;
  cursor: pointer;
}
.post-channel-badge:hover {
  color: #fff;
}
.me-badge {
  pointer-events: none;
}

.post-card-content {
  font-size: 16px;
  line-height: 1.55;
  font-weight: 450;
  word-wrap: break-word;
  overflow-wrap: break-word;
  margin: 4px 0;
}
.post-poll {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.poll-option {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: 10px;
  background: rgba(0,0,0,0.22);
  color: #fff;
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.poll-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  background: rgba(255,255,255,0.16);
  transition: width 0.2s ease;
}
.poll-label {
  position: relative;
  z-index: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.poll-pct {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.poll-option.is-result {
  cursor: default;
}
.poll-option.is-mine {
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.85);
}
.poll-total,
.poll-hint {
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  font-weight: 600;
}

/* @channel and @name inside a post or comment. Inline, so the text keeps its flow. */
.channel-mention,
.user-mention {
  display: inline;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.channel-mention:hover,
.user-mention:hover {
  opacity: 0.8;
}
.anon-mention {
  font-weight: 700;
}
/* Plain external links inside post and comment text; no preview cards. */
.post-link {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.post-link:hover {
  opacity: 0.8;
}

.post-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  position: relative;
  z-index: 1;
}
.post-card-footer .reaction-bar {
  flex: 1 1 auto;
  margin-top: 0;
}
/* Feed card header: the typing hint sits inline with the author and channel. */
.post-typing-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.post-footer .reaction-bar {
  flex: 0 1 auto;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.post-time {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
}
.post-comment-btn {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.14);
  color: rgba(255,255,255,0.88);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.post-comment-btn {
  gap: 4px;
  border: none;
  cursor: pointer;
}
.post-comment-btn:hover {
  background: rgba(0,0,0,0.22);
}
.post-comment-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* ---- POST DETAIL VIEW ---- */
#detail-section {
  padding: 0 0 88px;
}
body:has(.detail-comment-input-area.is-open) #detail-section {
  padding-bottom: calc(280px + var(--keyboard-inset, 0px));
}
#detail-section:not(.hidden) {
  display: block;
}
.detail-split {
  height: 4px;
  margin: 10px 0;
  border-radius: 999px;
  background: #fff;
}
/* Keep the separator out of the loading frame; it appears with the post card. */
#detail-post-container:not(:has(.post-card)) + .detail-split {
  display: none;
}
#detail-post-container {
  margin-bottom: 0;
}
/* The top post sits directly on its coloured page instead of in a card. */
#detail-post-container .post-card {
  border-radius: 0;
  box-shadow: none;
}
#detail-post-container .post-card::before {
  display: none;
}
/* The opened post is already the focus of the page; don't animate it in. */
#detail-post-container .post-card.is-entering {
  animation: none;
}

.detail-comment-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.detail-comment-list:has(.detail-comment) {
  border-radius: 0;
  box-shadow: none;
}
.detail-comment {
  min-height: 160px;
  color: #fff;
  padding: 15px;
  position: relative;
}
.detail-comment .post-card-footer .reaction-bar {
  margin-top: 0;
}
.detail-comment {
  cursor: pointer;
}
/* Right swipe on a comment reveals a reply action. touch-action keeps vertical
   scrolling native while horizontal gestures reach the pointer handlers. */
.detail-comment[data-comment-id],
.comment-item[data-comment-id],
.profile-comment-card[data-comment-id] {
  touch-action: pan-y;
}
.swipe-reply-hint {
  position: fixed;
  z-index: 70;
  transform: translateY(-50%);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(20, 20, 24, 0.92);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}
.swipe-reply-hint.is-visible {
  opacity: 1;
}
.swipe-reply-hint.is-ready {
  background: #fff;
  color: #171d35;
}
@keyframes detail-comment-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.detail-comment.is-entering {
  animation: detail-comment-in 300ms ease;
}
@media (prefers-reduced-motion: reduce) {
  .detail-comment.is-entering {
    animation: none;
  }
}

.detail-comment-input-area {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: var(--keyboard-inset, 0px);
  box-sizing: border-box;
  margin: 0;
  padding: 0 max(16px, calc((100vw - 600px) / 2 + 16px)) 0;
  pointer-events: none;
}
.detail-input-status {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.detail-input-status:has(.detail-new-comments:not(.hidden)) {
  min-height: 46px;
}
.detail-new-comments {
  position: absolute;
  left: 0;
  bottom: 6px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
  min-width: 40px;
  padding: 0 12px 0 10px;
  border: none;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  cursor: pointer;
  pointer-events: auto;
  transition: var(--transition);
}
.detail-new-comments:hover {
  background: var(--bg-secondary);
}
.detail-new-comments svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}
.comment-compose {
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.18);
}
.detail-comment-input-area .compose-card {
  display: none;
  pointer-events: auto;
}
.detail-comment-input-area.is-open .compose-card {
  display: block;
}
.detail-comment-input-area.is-open .reply-reveal {
  display: none;
}
.reply-reveal {
  pointer-events: auto;
  display: block;
  width: 100%;
  border: 1px solid rgba(255,255,255,0.05);
  border-bottom: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom, 0px));
  cursor: pointer;
  box-shadow: 0 -8px 28px rgba(0,0,0,0.28);
}
.reply-reveal:hover {
  color: var(--text-primary);
}
/* The quoted comment that sits directly above the active composer. */
.reply-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  padding: 8px 10px 8px 12px;
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12), 0 4px 14px rgba(0,0,0,0.28);
  color: var(--text-secondary);
  pointer-events: auto;
}
.reply-preview-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}
.reply-preview-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
  text-shadow: 0 1px 2px rgba(0,0,0,0.28);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.reply-preview-close {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.reply-preview-close:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}
/* The parent quote attached to a reply reuses the profile "Im Beitrag" card. */
.comment-parent-ref {
  width: 100%;
  border: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.comment-parent-ref:hover {
  filter: brightness(1.08);
}
.comment-parent-ref:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.comment-parent-ref.is-missing {
  cursor: default;
}
.comment-jump-target {
  position: relative;
  z-index: 2;
  scroll-margin-top: calc(var(--header-height) + 12px);
  scroll-margin-bottom: 120px;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.9) !important;
}
body:has(#comment-modal:not(.hidden)) .detail-comment-input-area,
body:has(#reaction-chooser:not(.hidden)) .detail-comment-input-area,
body:has(#post-settings-sheet:not(.hidden)) .detail-comment-input-area,
body:has(#channel-settings-sheet:not(.hidden)) .detail-comment-input-area {
  display: none;
}
/* The footer steps aside for full-screen reading and sheet interactions. */
body:has(#detail-section:not(.hidden)) #footer,
body:has(#channel-modal:not(.hidden)) #footer,
body:has(#account-create-modal:not(.hidden)) #footer,
body:has(#comment-modal:not(.hidden)) #footer,
body:has(#reaction-chooser:not(.hidden)) #footer,
body:has(#post-settings-sheet:not(.hidden)) #footer,
body:has(#notify-settings-sheet:not(.hidden)) #footer,
body:has(#channel-settings-sheet:not(.hidden)) #footer,
body:has(#action-sheet:not(.hidden)) #footer,
body:has(#account-sheet:not(.hidden)) #footer,
body:has(#install-sheet:not(.hidden)) #footer {
  display: none;
}
/* The compose button belongs to the feed, not to post, profile or compose screens. */
body:has(#detail-section:not(.hidden)) #fab-post,
body:has(#profile-section:not(.hidden)) #fab-post,
body:has(#notify-section:not(.hidden)) #fab-post,
body:has(#compose-section:not(.hidden)) #fab-post {
  display: none;
}
/* Composing is its own screen: no favorites/channels/notifications bar. */
body:has(#compose-section:not(.hidden)) #footer {
  display: none;
}
body:has(#compose-section:not(.hidden)) #main-content {
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
#post-settings-sheet,
#notify-settings-sheet {
  position: fixed;
  z-index: 330;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
  padding: 0 max(16px, calc((100vw - 600px) / 2 + 16px)) 0;
}
#notify-settings-sheet #notify-push {
  padding: 0;
  background: transparent;
  border-radius: 0;
}
.push-prefs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.push-prefs:empty {
  display: none;
}
.push-prefs-heading {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-muted);
}
.push-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.push-pref-row:has(.notify-switch:disabled) .push-pref-label {
  opacity: 0.55;
}
.push-pref-label {
  font-size: 15px;
  font-weight: 650;
}
.post-settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 16, 0.45);
  backdrop-filter: blur(4px);
}
.post-settings-card {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-bottom: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  box-shadow: 0 -8px 28px rgba(0,0,0,0.28);
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
}
.post-settings-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
}
.post-settings-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.post-setting {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.post-setting-copy {
  min-width: 0;
  flex: 1;
}
.post-setting-label {
  font-size: 15px;
  font-weight: 650;
}
.post-setting-hint,
.post-settings-empty,
.post-settings-error {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
}
.post-settings-error {
  color: #ff8b94;
}
.post-setting-switch {
  width: 46px;
  height: 28px;
  margin-top: 2px;
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  position: relative;
  cursor: pointer;
}
.post-setting-switch::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
}
.post-setting-switch[aria-pressed="true"] {
  background: var(--identity-named, #3f6bfe);
}
.post-setting-switch[aria-pressed="true"]::after {
  transform: translateX(18px);
}
.post-setting-switch:disabled {
  cursor: default;
  opacity: 0.72;
}
@media (prefers-reduced-motion: reduce) {
  .post-setting-switch::after {
    transition: none;
  }
}
.post-setting-stack {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.policy-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.policy-option {
  border: none;
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.policy-option.active {
  background: rgba(255,255,255,0.22);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.85);
}
.policy-option:disabled {
  opacity: 0.6;
  cursor: default;
}
.policy-option.is-readonly {
  cursor: default;
}
.channel-settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.channel-settings-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.channel-settings-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.channel-settings-description {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.channel-settings-description.is-empty {
  color: var(--text-muted);
  font-style: italic;
}
.channel-notify-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
}
.channel-notify-row .channel-settings-label {
  flex: 1;
  min-width: 0;
  color: var(--text-primary);
  line-height: 1.35;
}
.channel-settings-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35em;
  margin: 0;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
}
.channel-settings-by {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}
.channel-creator-link {
  border: none;
  padding: 0;
  background: none;
  color: var(--text-primary);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.channel-creator-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.channel-settings-delete,
.post-delete-btn {
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255,107,107,0.1);
  color: #ff8b94;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.channel-settings-delete {
  align-self: stretch;
}
.channel-settings-delete:hover,
.post-delete-btn:hover {
  background: rgba(255,107,107,0.16);
}
.channel-settings-delete:disabled {
  opacity: 0.6;
  cursor: default;
}
#reaction-chooser {
  position: fixed;
  z-index: 320;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
  padding: 0 max(16px, calc((100vw - 600px) / 2 + 16px)) 0;
}
.reaction-chooser-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 16, 0.45);
  backdrop-filter: blur(4px);
  animation: reactionDim 0.18s ease both;
}
.reaction-chooser-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-bottom: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  box-shadow: 0 -8px 28px rgba(0,0,0,0.28);
  padding: 16px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  animation: reactionSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes reactionDim {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes reactionSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.reaction-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 64px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px;
  cursor: pointer;
}
.reaction-choice .reaction-emoji,
.reaction-choice .reaction-emoji svg {
  width: 36px;
  height: 36px;
}
.reaction-choice.is-mine {
  background: rgba(255,255,255,0.16);
  color: #fff;
}
@media (prefers-reduced-motion: reduce) {
  .reaction-chooser-backdrop,
  .reaction-chooser-card,
  .action-sheet-backdrop,
  .action-sheet-card,
  .account-sheet-backdrop,
  .account-sheet-card {
    animation: none;
  }
}
#action-sheet {
  position: fixed;
  z-index: 330;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
  padding: 0 max(16px, calc((100vw - 600px) / 2 + 16px)) 0;
}
.action-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 16, 0.45);
  backdrop-filter: blur(4px);
  animation: reactionDim 0.18s ease both;
}
.action-sheet-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-bottom: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  box-shadow: 0 -8px 28px rgba(0,0,0,0.28);
  padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  animation: reactionSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.action-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  padding: 14px;
  text-align: center;
  cursor: pointer;
}
.action-btn:hover {
  background: rgba(255,255,255,0.1);
}
.action-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  padding-top: 10px;
  padding-bottom: 10px;
}
.action-toggle .notify-switch {
  pointer-events: none;
}
.action-btn.danger {
  background: rgba(255,107,107,0.12);
  color: #ff8b94;
  font-weight: 700;
}
.action-btn.danger:hover {
  background: rgba(255,107,107,0.2);
}
#account-sheet {
  position: fixed;
  z-index: 340;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
  padding: 0 max(16px, calc((100vw - 600px) / 2 + 16px)) 0;
}
.account-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 16, 0.45);
  backdrop-filter: blur(4px);
  animation: reactionDim 0.18s ease both;
}
.account-sheet-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-bottom: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  box-shadow: 0 -8px 28px rgba(0,0,0,0.28);
  padding: 16px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  animation: reactionSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.account-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.account-row:hover {
  background: rgba(255,255,255,0.08);
}
.account-row.is-active {
  border-color: rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.1);
}
.account-row-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.account-row-name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-row-check {
  color: #7ee0b8;
  font-size: 15px;
  font-weight: 800;
}
.account-limit {
  margin: 2px 0;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}
.reaction-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.45);
  border-radius: 999px;
  padding: 4px 8px 4px 5px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.reaction-chip .reaction-emoji,
.reaction-chip .reaction-emoji svg {
  width: 18px;
  height: 18px;
}
.reaction-chip .reaction-count {
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.reaction-chip.is-mine {
  background: rgba(0,0,0,0.45);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
}

/* ---- COMMENT MODAL ---- */
#comment-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 300;
  transition: opacity 0.3s ease;
}
#comment-overlay:not(.hidden) {
  opacity: 1;
}

#comment-modal {
  position: fixed;
  bottom: var(--keyboard-inset, 0px);
  left: 0;
  right: 0;
  max-height: min(70vh, calc(var(--vv-height, 100vh) - 8px));
  background: var(--bg-secondary);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.4);
  z-index: 301;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}
#comment-modal:not(.hidden) {
  transform: translateY(0);
}
#comment-modal.hidden {
  transform: translateY(100%);
}

.comment-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.comment-modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}
.comment-close-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.comment-close-btn:hover {
  background: rgba(255,255,255,0.08);
}

.comment-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 16px;
}

.comment-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 96px;
  padding: 15px;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  margin-bottom: 8px;
  border-left: 3px solid rgba(255,255,255,0.08);
}
.system-author {
  color: rgba(255,255,255,0.58);
}
.verified-icon {
  width: 13px;
  height: 13px;
  display: block;
  flex-shrink: 0;
}
.detail-comment.is-system,
.comment-item.is-system {
  min-height: 0;
  padding-top: 8px;
  padding-bottom: 8px;
  background: rgba(0,0,0,0.1);
}
.comment-item.is-system {
  border-left: 2px solid rgba(110,198,255,0.4);
  border-radius: 8px;
  margin-bottom: 4px;
  background: rgba(110,198,255,0.06);
  cursor: pointer;
}
.detail-comment.is-system {
  cursor: pointer;
}
.detail-comment.is-system .post-card-header,
.comment-item.is-system .comment-item-header {
  margin-bottom: 2px;
}
.detail-comment.is-system .post-card-content,
.comment-item.is-system .comment-content {
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255,255,255,0.64);
}
.detail-comment.is-system .post-card-footer,
.comment-item.is-system .reaction-bar {
  display: none;
}
/* System notices stay to one line until they are opened. */
.detail-comment.is-system.is-collapsed,
.comment-item.is-system.is-collapsed {
  padding-top: 6px;
  padding-bottom: 6px;
}
.detail-comment.is-system.is-collapsed .post-card-content,
.comment-item.is-system.is-collapsed .comment-content {
  display: none;
}
.system-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.system-toggle:hover {
  color: rgba(255,255,255,0.8);
}
.system-toggle svg {
  transition: transform 0.15s ease;
}
.detail-comment.is-system:not(.is-collapsed) .system-toggle svg,
.comment-item.is-system:not(.is-collapsed) .system-toggle svg {
  transform: rotate(180deg);
}
.comment-item-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}
.comment-anon-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.4);
}
.comment-time-small {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  margin-left: auto;
}
.comment-content {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  word-wrap: break-word;
}

.empty-comments {
  text-align: center;
  padding: 24px;
  color: var(--text-primary);
  font-size: 14px;
}
.empty-comments svg {
  display: block;
  margin: 0 auto 12px;
  opacity: 0.4;
}

.comment-input-area {
  flex-shrink: 0;
  padding: 12px 0 0;
}
.typing-indicator {
  display: flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  pointer-events: none;
}
/* On a feed card the indicator sits in the header row with the author,
   channel, and time, rather than above an input. */
.post-typing {
  position: relative;
  z-index: 1;
  margin: 0;
  background: rgba(0,0,0,0.28);
}
.compose-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.send-btn:disabled,
.send-btn:disabled:hover {
  opacity: 0.5;
  cursor: default;
  transform: none;
  box-shadow: none;
}
.reply-reveal:disabled,
.reply-reveal:disabled:hover {
  color: var(--text-muted);
  cursor: default;
  opacity: 0.7;
}


/* ---- LOADING ---- */
.page-sentinel {
  width: 100%;
  height: 1px;
}
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  color: var(--text-muted);
  gap: 16px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,0.35);
  border-top: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.22), 0 2px 6px rgba(0,0,0,0.35);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Comment Post Preview ---- */
.comment-post-preview {
  padding: 10px 16px;
  margin: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
  border-left: 3px solid var(--accent);
}
.comment-post-preview:not(.hidden) {
  display: block;
}

/* ---- Create Channel Sheet ---- */
#channel-overlay,
#account-create-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 4, 16, 0.45);
  backdrop-filter: blur(4px);
  z-index: 320;
}
#channel-overlay:not(.hidden),
#account-create-overlay:not(.hidden) {
  animation: reactionDim 0.18s ease both;
}

#channel-modal,
#account-create-modal {
  position: fixed;
  z-index: 330;
  inset: 0;
  bottom: var(--keyboard-inset, 0px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
  padding: 0 max(16px, calc((100vw - 600px) / 2 + 16px)) 0;
  pointer-events: none;
}
#channel-modal.hidden,
#account-create-modal.hidden {
  display: none;
}
#channel-modal:not(.hidden),
#account-create-modal:not(.hidden) {
  display: flex;
}
.channel-modal-content {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(var(--vv-height, 100dvh) - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-bottom: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  box-shadow: 0 -8px 28px rgba(0,0,0,0.28);
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  animation: reactionSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@media (prefers-reduced-motion: reduce) {
  #channel-overlay:not(.hidden),
  #account-create-overlay:not(.hidden),
  .channel-modal-content {
    animation: none;
  }
}

/* Channel settings use the same bottom sheet as the post settings. */
#channel-settings-sheet {
  position: fixed;
  z-index: 330;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
  padding: 0 max(16px, calc((100vw - 600px) / 2 + 16px)) 0;
}
.channel-settings-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: reactionSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}
#channel-settings-sheet .post-settings-backdrop {
  animation: reactionDim 0.18s ease both;
}
@media (prefers-reduced-motion: reduce) {
  #channel-settings-sheet .post-settings-backdrop,
  .channel-settings-card {
    animation: none;
  }
}
.channel-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.channel-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.channel-close-btn:hover {
  background: rgba(255,255,255,0.08);
}

.channel-create-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.channel-create-input {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  transition: var(--transition);
}
.channel-create-input:focus-within {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
}
.channel-create-input.is-invalid,
.channel-create-input.is-invalid:focus-within {
  border-color: #ff6b6b;
  background: rgba(255,107,107,0.08);
}
.channel-create-input.is-invalid #channel-input,
.channel-create-input.is-invalid #account-create-handle {
  color: #ff8b94;
}
.channel-create-textarea {
  width: 100%;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  resize: none;
  outline: none;
  box-sizing: border-box;
  transition: var(--transition);
}
.channel-create-textarea:focus {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
}
#channel-input,
#account-create-handle {
  flex: 1;
  min-width: 0;
  width: auto;
  padding: 12px 0;
  border: none;
  background: transparent;
  font-size: 15px;
  font-family: var(--font);
  color: var(--text-primary);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
#channel-input::-webkit-search-decoration,
#channel-input::-webkit-search-cancel-button,
#channel-input::-webkit-search-results-button,
#channel-input::-webkit-search-results-decoration,
#account-create-handle::-webkit-search-decoration,
#account-create-handle::-webkit-search-cancel-button,
#account-create-handle::-webkit-search-results-button,
#account-create-handle::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}
.channel-create-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

#channel-create-btn,
#account-create-btn {
  width: 100%;
  padding: 12px 18px;
  border: none;
  border-radius: 12px;
  background: var(--identity-anon);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
}
#account-create-btn {
  background: var(--identity-named);
}
body.posting-named #channel-create-btn {
  background: var(--account-color, var(--identity-named));
  color: #1a1228;
}
#channel-create-btn:hover,
#account-create-btn:hover {
  filter: brightness(1.08);
}
#channel-create-btn:disabled,
#account-create-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ---- UTILITY ---- */
.hidden {
  display: none !important;
}

/* ---- ANIMATIONS ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.post-card.is-entering {
  animation: fadeIn 0.35s ease forwards;
}
.comment-item {
  animation: slideUp 0.25s ease forwards;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 480px) {
  #main-content {
    padding-left: 12px;
    padding-right: 12px;
  }
  .detail-comment-input-area {
    padding-left: 12px;
    padding-right: 12px;
  }
  .compose-card {
    padding: 12px;
  }
  .comment-compose {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

/* Utility to style the comment input row on desktop */
@media (min-width: 600px) {
  #comment-modal {
    max-width: 560px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    border-radius: 20px 20px 0 0;
    top: auto;
    bottom: var(--keyboard-inset, 0px);
  }
  #comment-modal:not(.hidden) {
    transform: translateX(-50%) translateY(0);
  }
  #comment-overlay {
    z-index: 300;
  }
}

/* Hide scrollbar on modal comment list in Webkit nicely */
.comment-list::-webkit-scrollbar {
  width: 4px;
}

/* ---- PROFILE / IDENTITY ---- */
.compose-header {
  flex-wrap: wrap;
}
.ghost-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.anon-word {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.anon-tag {
  margin-left: 0;
}
.ghost-icon {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}
.user-icon {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}
.post-anon-label .ghost-icon,
.post-author-btn .user-icon {
  width: 18px;
  height: 18px;
}
.send-btn .user-icon {
  width: 16px;
  height: 16px;
}

.post-author-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.post-author-label {
  font-size: 13px;
  font-weight: 700;
}
.post-author-btn:hover .post-author-label {
  text-decoration: underline;
}
.comment-item .post-author-label {
  font-size: 12px;
}

#profile-section:not(.hidden) {
  display: block;
}
.profile-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.profile-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.profile-handle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  word-break: break-all;
}
.profile-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.profile-edit-btn:hover {
  background: rgba(255,255,255,0.14);
  color: var(--text-primary);
}
.profile-edit-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.45);
  outline-offset: 2px;
}
.profile-handle .ghost-icon,
.profile-handle .user-icon {
  width: 25px;
  height: 25px;
}
.profile-handle span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.profile-since,
.profile-count {
  color: var(--text-muted);
  font-size: 13px;
}
.profile-description {
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.profile-description.is-empty {
  color: var(--text-muted);
  font-style: italic;
}
.profile-content-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  margin: 18px 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.profile-content-btn {
  margin-bottom: -1px;
  padding: 0 0 9px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.profile-content-btn.active {
  color: var(--text-primary);
  border-bottom-color: rgba(255,255,255,0.7);
}
.profile-content-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.45);
  outline-offset: 2px;
  border-radius: 4px;
}
.profile-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.profile-form-title {
  font-size: 18px;
  font-weight: 650;
}
.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}
.profile-field input,
.profile-field textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  font-family: var(--font);
  font-weight: 450;
  color: var(--text-primary);
  outline: none;
}
.profile-field textarea {
  resize: vertical;
  min-height: 72px;
}
.profile-field input:focus,
.profile-field textarea:focus {
  border-color: rgba(255,255,255,0.18);
}
.handle-input {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding-left: 14px;
}
.handle-input span {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 650;
}
.handle-input input {
  border: none !important;
  background: transparent !important;
  padding-left: 0;
  -webkit-appearance: none;
  appearance: none;
}
.handle-input.is-invalid,
.handle-input.is-invalid:focus-within {
  border-color: #ff6b6b;
  background: rgba(255,107,107,0.08);
}
.handle-input.is-invalid input {
  color: #ff8b94;
}
#profile-handle::-webkit-search-decoration,
#profile-handle::-webkit-search-cancel-button,
#profile-handle::-webkit-search-results-button,
#profile-handle::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}
#profile-handle,
#channel-input,
#account-create-handle {
  text-transform: lowercase;
}
.profile-error {
  color: #ff8b94;
  font-size: 13px;
  font-weight: 600;
}
.profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.profile-primary,
.profile-secondary {
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.profile-primary {
  background: linear-gradient(135deg, #ff6b6b, #e85555);
  color: white;
}
.profile-primary:disabled {
  opacity: 0.6;
  cursor: default;
}
.profile-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}
.profile-channels {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.profile-channel-row {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  text-align: left;
}
#profile-posts,
.profile-posts,
.profile-comments {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}
.profile-comment-card {
  cursor: pointer;
}
.profile-comment-context {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0,0,0,0.16);
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  line-height: 1.4;
  position: relative;
  z-index: 1;
}
.profile-comment-context-label {
  flex-shrink: 0;
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.profile-comment-context-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.profile-empty {
  color: var(--text-muted);
  font-size: 14px;
  padding: 8px 4px 16px;
}

.reaction-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin-top: 10px;
  position: relative;
  z-index: 1;
}
.reaction-bar .reaction-summary {
  flex: 0 1 auto;
  min-width: 0;
}
.reaction-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(0,0,0,0.18);
  color: rgba(255,255,255,0.88);
  cursor: pointer;
}
.reaction-open-btn:hover {
  background: rgba(0,0,0,0.3);
  color: #fff;
}
.reaction-open-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}
.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: rgba(0,0,0,0.14);
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 1;
  border-radius: 999px;
  padding: 4px 8px;
  cursor: pointer;
}
.reaction-btn.is-mine {
  background: rgba(255,255,255,0.32);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.55);
}
.reaction-emoji {
  display: inline-flex;
  width: 18px;
  height: 18px;
}
.reaction-emoji svg {
  width: 18px;
  height: 18px;
  display: block;
}
.reaction-count {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.reaction-count:empty {
  display: none;
}
.comment-item {
  cursor: pointer;
}
.profile-reactions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-reaction-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.profile-reaction-stat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.notify-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notify-push,
.notify-empty {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 16px;
}
.notify-push {
  display: flex;
  align-items: center;
  gap: 14px;
}
.notify-push-text {
  flex: 1;
  min-width: 0;
}
.notify-push-title {
  margin: 0 0 3px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
}
.notify-push-desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.35;
}
.notify-push.is-disabled .notify-push-desc {
  opacity: 0.8;
}
.notify-empty p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}
.notify-empty button {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 14px;
  color: white;
  background: linear-gradient(135deg, var(--identity-anon), var(--identity-anon-deep));
  cursor: pointer;
}
.notify-item {
  display: flex;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 14px;
  padding: 12px;
  background: var(--notify-color, var(--bg-card));
  color: var(--text-primary);
  font-family: var(--font);
  cursor: pointer;
  touch-action: pan-y;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
/* Use the post colour and the same white text treatment as post cards. */
.notify-item.has-post-color {
  background: var(--notify-color);
  color: #fff;
}
.notify-item.has-post-color .notify-text {
  color: #fff;
}
.notify-item.has-post-color .notify-excerpt {
  color: rgba(255,255,255,0.85);
}
.notify-item.has-post-color .notify-time {
  color: rgba(255,255,255,0.5);
}
@keyframes notify-arrive {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.notify-item.notify-new {
  animation: notify-arrive 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@media (prefers-reduced-motion: reduce) {
  .notify-item.notify-new {
    animation: none;
  }
}
.notify-spot {
  position: relative;
  z-index: 2;
  scroll-margin-top: calc(var(--header-height) + 12px);
  scroll-margin-bottom: 120px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9);
}
/* The detail post normally has no card shadow; keep the reaction highlight. */
#detail-post-container .post-card.notify-spot {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9);
}
.notify-icon {
  position: relative;
  flex: 0 0 auto;
  align-self: center;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
}
/* A white edge marks unread rows on every background colour. */
.notify-item.is-unread {
  box-shadow: inset 5px 0 0 #fff, inset -5px 0 0 #fff;
}
.notify-icon svg {
  width: 18px;
  height: 18px;
}
.notify-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.notify-text {
  font-size: 15px;
  font-weight: 650;
}
.notify-excerpt {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notify-time {
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 480px) {
  .reaction-bar { gap: 4px; }
  .reaction-btn { padding: 3px 5px; gap: 3px; }
  .reaction-emoji,
  .reaction-emoji svg { width: 16px; height: 16px; }
  .post-card-footer { gap: 6px; }
  .post-meta { gap: 6px; }
}

/* Light-DOM custom elements. div and article are block; an unknown tag is inline
   until a class sets display. .post-card and .detail-comment do not set it. */
hudel-post,
hudel-comment {
  display: block;
}