/* Ittosei stylesheet — stark, flat, shadowless editorial minimalism.
   Pure ground, 1px hairline structure, crisp monochrome pills, and surgical
   restraint across the gate, 3D prototype, social timeline, direct messages,
   and admin console. */

:root {
  --bg: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --surface: #ffffff;
  --subtle: #eff3f4;
  --subtle-hover: #e7ebec;
  --subtle-active: #dce1e3;
  --text: #0f1419;
  --text-2: #3d4852;
  --muted: #536471;
  --line: #eff3f4;
  --line-thread: #cfd9de;
  --line-strong: #0f1419;
  --hover: rgba(15, 20, 25, 0.03);
  --btn: #0f1419;
  --btn-hover: #272c30;
  --btn-text: #ffffff;
  --x-blue: #1d9bf0;
  --x-blue-hover: #1a8cd8;
  --danger: #f4212e;
  --rose: #f91880;
  --like: #f91880;
  --repost: #00ba7c;
  --save: var(--x-blue);
  --accent: #0f1419;
  --live: #00ba7c;
  --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
  --rail: 275px;
  --column: 600px;
  --aside: 350px;
  --chip: #f8f9fa;
  --chip-hover: #f1f3f4;
  --chip-active: #e8eaed;
  --chip-text: #3c4043;
  --field-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-glass: rgba(0, 0, 0, 0.65);
    --surface: #16181c;
    --subtle: #16181c;
    --subtle-hover: #202327;
    --subtle-active: #2a2e33;
    --text: #e7e9ea;
    --text-2: #c4c9ce;
    --muted: #71767b;
    --line: #2f3336;
    --line-thread: #333639;
    --line-strong: #e7e9ea;
    --hover: rgba(255, 255, 255, 0.03);
    --btn: #eff3f4;
    --btn-hover: #d7dbdc;
    --btn-text: #0f1419;
    --x-blue: #1d9bf0;
    --x-blue-hover: #1a8cd8;
    --danger: #f4212e;
    --rose: #f91880;
    --like: #f91880;
    --repost: #00ba7c;
    --save: var(--x-blue);
    --accent: #eff3f4;
    --live: #00ba7c;
    --chip: #232323;
    --chip-hover: #2e2e2e;
    --chip-active: #383838;
    --chip-text: #e8eaed;
    --field-bg: #0d0d0d;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Shared primitives ─────────────────────────────────────────────── */

.grow { flex: 1; }
.dim { color: var(--muted); }
.bad { color: var(--danger) !important; }

.solid,
#post-send {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 9px 18px;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), opacity 0.15s var(--ease);
}

.solid:hover, #post-send:hover { background: var(--btn-hover); }
.solid:disabled, #post-send:disabled { opacity: 0.35; cursor: default; }
.solid:focus-visible, #post-send:focus-visible { outline: 2px solid var(--line-strong); outline-offset: 2px; }
.solid.full { width: 100%; padding: 11px 18px; }

.pill-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  padding: 7px 14px;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.pill-btn:hover { background: var(--subtle); border-color: var(--muted); }
.pill-btn:disabled { opacity: 0.4; cursor: default; }
.pill-btn.sm { padding: 5px 12px; font-size: 12.5px; }
.pill-btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.pill-btn.danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); border-color: var(--danger); }
.pill-btn.danger-solid { background: var(--danger); color: #ffffff; border-color: var(--danger); }
.pill-btn.danger-solid:hover { opacity: 0.9; }

.pill-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--subtle);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.ai-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--subtle);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.news-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--btn);
  color: var(--btn-text);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.clean-input {
  width: 100%;
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--subtle);
  border: 1px solid transparent;
  border-radius: 999px;
  outline: none;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.clean-input::placeholder { color: var(--muted); }
.clean-input:focus { background: var(--bg); border-color: var(--line-strong); }

/* Minimal geometric 5-dot brand mark */
.brand-mark {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  position: relative;
  flex: 0 0 auto;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--bg);
}

/* ── the key gate (original first design) ──────────────────────────── */

#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

#gate {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  transition: opacity 0.26s var(--ease);
}

#gate.fading { opacity: 0; }

#key-form,
#proto-form {
  width: min(584px, 92vw);
  margin: 0;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: 52px;
  padding: 0 8px 0 20px;
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 26px;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.08);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.search-shell:hover,
.search-shell:focus-within {
  border-color: transparent;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.18);
}

.search-shell.shake {
  animation: shell-shake 0.34s var(--ease);
}

@keyframes shell-shake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-6px); }
  45% { transform: translateX(5px); }
  68% { transform: translateX(-3px); }
  85% { transform: translateX(2px); }
}

@media (prefers-color-scheme: dark) {
  .search-shell {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  }
  .search-shell:hover,
  .search-shell:focus-within {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
  }
}

.search-icon { flex: 0 0 auto; width: 20px; height: 20px; color: var(--muted); }

#key,
#proto-key {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

#key::placeholder,
#proto-key::placeholder { color: var(--muted); }
#key::-webkit-search-decoration,
#key::-webkit-search-cancel-button { -webkit-appearance: none; }

.go {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 19px;
  background: var(--chip);
  color: var(--chip-text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s var(--ease);
}

.go:hover { background: var(--chip-hover); }
.go:active { background: var(--chip-active); }
.go:disabled { opacity: 0.5; cursor: default; }
.go:focus-visible { outline: 2px solid var(--line-strong); outline-offset: 2px; }

#status,
.proto-status {
  min-height: 1.4em;
  margin: 16px 4px 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ── 3D Objects Prototype Pane ─────────────────────────────────────── */

#prototype {
  position: fixed;
  inset: 0;
  height: 100dvh;
  opacity: 0;
  transition: opacity 0.24s var(--ease);
}

#prototype.shown { opacity: 1; }

#proto-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  cursor: grab;
  touch-action: none;
}

#proto-canvas.grabbing { cursor: grabbing; }

.proto-bar {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
}

.proto-bar .pill-tag {
  background: var(--bg);
  border: 1px solid var(--line);
}

.proto-center {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
}

.proto-center > * { pointer-events: auto; }

/* ── Admin Console (clean flat studio layout) ──────────────────────── */

#admin {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

#admin.shown { opacity: 1; }

.admin-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 24px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

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

.pane-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.pane-meta {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.admin-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 24px max(56px, env(safe-area-inset-bottom));
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 24px;
}

.stat-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.stat-card.interactive {
  cursor: pointer;
  transition: background-color 0.14s var(--ease);
}

.stat-card.interactive:hover { background: var(--hover); }
.stat-card.interactive.on { background: var(--subtle); }

.stat-card:last-child { border-right: 0; }

.stat-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-label {
  font-size: 12.5px;
  color: var(--muted);
}

#admin-made {
  margin-bottom: 24px;
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--subtle);
}

.made-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.made-head {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.made-warn {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.made-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.made-key {
  display: block;
  padding: 14px 16px;
  font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  user-select: all;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.admin-col-side,
.admin-col-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  overflow: hidden;
}

.panel-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.panel-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.panel-count {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

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

.stack-form {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
}

.field input,
.input-prefix {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s var(--ease);
}

.field > input {
  padding: 10px 12px;
  outline: none;
}

.field > input:focus,
.input-prefix:focus-within {
  border-color: var(--line-strong);
}

.input-prefix {
  display: flex;
  align-items: center;
  padding-left: 12px;
}

.input-prefix span {
  color: var(--muted);
  font-size: 15px;
  user-select: none;
}

.input-prefix input {
  border: 0;
  outline: none;
  background: transparent;
  padding: 10px 12px 10px 4px;
  font-size: 16px;
  width: 100%;
}

.panel-foot {
  margin: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  background: var(--subtle);
}

.keys-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background: var(--subtle);
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.seg-btn.on {
  background: var(--bg);
  color: var(--text);
}

.keys-list,
.admin-people {
  display: flex;
  flex-direction: column;
}

.empty-row {
  margin: 0;
  padding: 28px 20px;
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
}

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

.admin-person-row:last-child { border-bottom: 0; }
.admin-person-info { min-width: 0; flex: 1; }
.admin-person-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }

.vault {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.vault:last-child { border-bottom: 0; }
.vault.revoked { opacity: 0.62; }

.vault-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.vault-main { flex: 1; min-width: 0; }

.vault-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.status-dot.live { background: var(--live); }
.status-dot.off { background: var(--danger); }
.status-dot.self { background: var(--rose); }

.vault-id {
  font: 600 14px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.vault-type {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: var(--subtle);
  border-radius: 999px;
}

.vault-type.mine { color: var(--rose); }
.vault-type.off { color: var(--danger); }

.vault-meta {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.vault-note-row { margin-top: 8px; }

.vault-note-btn {
  padding: 3px 8px;
  margin-left: -8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.vault-note-btn:hover { background: var(--subtle); }
.vault-note-btn.empty { color: var(--muted); }

.vault-note-edit {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.vault-note-edit .clean-input {
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13.5px;
}

.vault-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.vault-confirm {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Social Layout (flat 3-column editorial studio + Messages split) ─ */

/* #post-menu and #menu-scrim are position:fixed inside #social, so #social
   must never gain transform, filter, perspective, contain, or will-change. */
#social {
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, var(--column)) var(--aside);
  grid-template-rows: minmax(0, 100%);
  justify-content: center;
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

#social.shown { opacity: 1; }

/* Messages mode expands center column into a spacious split pane */
#social.dm-mode {
  grid-template-columns: var(--rail) minmax(0, 920px);
}

#social.dm-mode #aside { display: none; }

/* ── Left Rail ─────────────────────────────────────────────────────── */

#rail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 16px 14px max(16px, env(safe-area-inset-bottom));
  border-right: 1px solid var(--line);
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 18px;
}

.rail-wordmark {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

#rail-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.rail-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  max-width: 100%;
  padding: 11px 22px 11px 12px;
  font: inherit;
  font-size: 19px;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease);
}

.rail-item:hover { background: var(--subtle); }
.rail-item.on { color: var(--text); font-weight: 700; }
.rail-item svg { flex: 0 0 auto; width: 25px; height: 25px; }
.rail-item.on svg { stroke-width: 2.3; }

#rail-post {
  width: 90%;
  height: 52px;
  margin-top: 14px;
  padding: 0 24px;
  font-size: 17px;
  font-weight: 700;
}

#rail-me {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease);
}

#rail-me:hover { background: var(--subtle); }

.rail-me-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

#rail-me .who { font-size: 13.5px; font-weight: 600; }
#rail-me .handle { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Center Column (#timeline) ─────────────────────────────────────── */

#timeline {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
}

#tl-head {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

#tl-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 0 8px;
  min-height: 53px;
}

#tl-bar:has(#tl-title:empty):has(#tl-back[hidden]):has(#dm-new-btn[hidden]) {
  min-height: 0;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background-color 0.14s var(--ease);
}

.icon-btn:hover { background: var(--subtle); }
.icon-btn svg { width: 20px; height: 20px; }

#tl-title {
  padding: 12px 10px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#tl-title:empty { display: none; }

#tabs,
.profile-tabs {
  display: flex;
}

.tab {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 53px;
  padding: 0 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: color 0.14s var(--ease), background-color 0.14s var(--ease);
}

.tab:hover { color: var(--text); background: var(--hover); }
.tab.on { color: var(--text); font-weight: 700; }

.tab span {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 100%;
}

.tab.on span::after,
.tab.on:not(:has(span))::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-width: 56px;
  height: 4px;
  border-radius: 9999px;
  background: var(--x-blue);
}

.tab.on:not(:has(span))::after {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: 56px;
}

#social-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ── Composer ──────────────────────────────────────────────────────── */

#composer {
  border-bottom: 1px solid var(--line);
  padding: 12px 16px 10px;
}

#composer[hidden] { display: none !important; }
#composer-row { display: flex; gap: 12px; align-items: flex-start; }
#composer-main { position: relative; flex: 1; min-width: 0; }

.composer-input-wrap {
  position: relative;
  width: 100%;
}

.composer-backdrop {
  position: absolute;
  inset: 0;
  padding: 8px 0 4px;
  font: inherit;
  font-size: 19px;
  line-height: 1.4;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow: hidden;
  pointer-events: none;
}

.composer-backdrop .hl-token {
  color: var(--x-blue);
}

#post-body {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 52px;
  padding: 8px 0 4px;
  font: inherit;
  font-size: 19px;
  line-height: 1.4;
  color: transparent;
  caret-color: var(--text);
  background: transparent;
  border: 0;
  outline: none;
  resize: none;
  max-height: 40vh;
}

#post-body::placeholder { color: var(--muted); opacity: 1; }
#post-body::selection { background: rgba(29, 155, 240, 0.28); color: transparent; }

#composer-foot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.post {
  position: relative;
  display: block;
  padding: 12px 16px 6px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.12s var(--ease);
}

.post:hover { background: var(--hover); }
.post[data-post-id] { cursor: pointer; }

.post.focus { cursor: default; padding-bottom: 12px; }
.post.focus:hover { background: transparent; }
.post.focus .post-body { font-size: 17px; line-height: 1.45; margin-top: 8px; }
.post.focus .post-actions { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 12px; }

.post.ancestor { border-bottom: 0; padding-bottom: 0; }
.post.ancestor .post-row { position: relative; }
.post.ancestor .post-row::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 44px;
  bottom: -14px;
  width: 2px;
  background: var(--line-thread);
}
.post.ancestor .post-actions { margin: 4px 0 6px -8px; }

.post:focus { outline: none; }
.post:focus-visible { outline: 2px solid var(--x-blue); outline-offset: -2px; }

.who.plain { font-weight: 700; color: inherit; max-width: 100%; }

.repost-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px 36px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.repost-banner svg { width: 15px; height: 15px; }

.post-row { display: flex; gap: 10px; }
.post-main { flex: 1; min-width: 0; }

.post-head {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
  font-size: 15px;
  line-height: 20px;
  min-width: 0;
}

.who {
  font: inherit;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 0 1 auto;
  color: var(--text);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who:hover { text-decoration: underline; }
.post-head .sep, .post-head time { color: var(--muted); font-weight: 400; font-size: 15px; flex: 0 0 auto; }

.post-head .at {
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-head .at:hover { text-decoration: underline; }

.head-actions {
  display: flex;
  align-items: center;
  margin: -8px -8px -8px auto;
  flex: 0 0 auto;
}

.head-actions .act { width: 34.75px; height: 34.75px; padding: 0; justify-content: center; }
.head-actions .act svg { width: 18.75px; height: 18.75px; }
.head-actions .act .count { display: none; }

.post-body {
  font-size: 15px;
  line-height: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.post-body a,
.dm-bubble a { color: var(--x-blue); text-decoration: none; }
.post-body a:hover,
.dm-bubble a:hover { text-decoration: underline; }

.body-mention,
.body-tag {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--x-blue);
  cursor: pointer;
}
.body-mention:hover,
.body-tag:hover { text-decoration: underline; }

.post.has-thread-line { border-bottom-color: transparent; }
.post.has-thread-line .post-row { position: relative; }
.post.has-thread-line .post-row::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 44px;
  bottom: -22px;
  width: 2px;
  background: var(--line-thread);
}

.post-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: center;
  max-width: 100%;
  margin: 6px 0 0 -8px;
}

.post-actions .act { justify-self: start; }
.act-cluster { display: flex; align-items: center; gap: 2px; justify-self: end; }
.act.views { cursor: default; }
.act.views:hover { background: none; color: var(--muted); }

.act {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34.75px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 9999px;
  padding: 0 8px;
  cursor: pointer;
  transition: color 0.14s var(--ease), background-color 0.14s var(--ease);
}

.act svg { width: 18.75px; height: 18.75px; position: relative; z-index: 1; }
.act .count { min-width: 1ch; font-variant-numeric: tabular-nums; display: inline-block; }

/* Authentic X action micro-animations (Like heart burst, Repost spin-pop, Bookmark bounce) */
@keyframes x-heart-pop {
  0%   { transform: scale(0.55); }
  38%  { transform: scale(1.36); }
  62%  { transform: scale(0.9); }
  82%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes x-heart-ring {
  0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0.95; border-width: 4px; }
  70%  { transform: translate(-50%, -50%) scale(1.25); opacity: 0.55; border-width: 1.5px; }
  100% { transform: translate(-50%, -50%) scale(1.55); opacity: 0; border-width: 0; }
}

@keyframes x-heart-burst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.35);
    box-shadow:
      0 -10px 0 0 #f91880,
      7px -7px 0 0 #1d9bf0,
      10px 0 0 0 #ffd400,
      7px 7px 0 0 #00ba7c,
      0 10px 0 0 #a855f7,
      -7px 7px 0 0 #f91880,
      -10px 0 0 0 #1d9bf0,
      -7px -7px 0 0 #00ba7c;
  }
  75% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(1);
    box-shadow:
      0 -20px 0 -1px #f91880,
      14px -14px 0 -1px #1d9bf0,
      20px 0 0 -1px #ffd400,
      14px 14px 0 -1px #00ba7c,
      0 20px 0 -1px #a855f7,
      -14px 14px 0 -1px #f91880,
      -20px 0 0 -1px #1d9bf0,
      -14px -14px 0 -1px #00ba7c;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.18);
    box-shadow:
      0 -24px 0 -2px #f91880,
      17px -17px 0 -2px #1d9bf0,
      24px 0 0 -2px #ffd400,
      17px 17px 0 -2px #00ba7c,
      0 24px 0 -2px #a855f7,
      -17px 17px 0 -2px #f91880,
      -24px 0 0 -2px #1d9bf0,
      -17px -17px 0 -2px #00ba7c;
  }
}

@keyframes x-repost-pop {
  0%   { transform: rotate(0deg) scale(0.8); }
  55%  { transform: rotate(195deg) scale(1.24); }
  82%  { transform: rotate(174deg) scale(0.95); }
  100% { transform: rotate(180deg) scale(1); }
}

@keyframes x-save-pop {
  0%   { transform: scale(0.75) translateY(2px); }
  45%  { transform: scale(1.28, 1.18) translateY(-3px); }
  75%  { transform: scale(0.94, 1.04) translateY(0); }
  100% { transform: scale(1); }
}

@keyframes x-pulse-halo {
  0%   { transform: translate(-50%, -50%) scale(0.45); opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}

@keyframes x-count-bump {
  0%   { transform: translateY(5px); opacity: 0.3; }
  65%  { transform: translateY(-1.5px); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

.act.act-pop-like svg { animation: x-heart-pop 0.44s cubic-bezier(0.22, 1.2, 0.36, 1); }
.act.act-pop-like::before {
  content: "";
  position: absolute;
  left: 17.5px;
  top: 50%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--like);
  pointer-events: none;
  animation: x-heart-ring 0.42s ease-out forwards;
}
.act.act-pop-like::after {
  content: "";
  position: absolute;
  left: 17.5px;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: transparent;
  pointer-events: none;
  animation: x-heart-burst 0.52s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.act.act-pop-repost svg { animation: x-repost-pop 0.46s cubic-bezier(0.22, 1.2, 0.36, 1); }
.act.act-pop-repost::before {
  content: "";
  position: absolute;
  left: 17.5px;
  top: 50%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 186, 124, 0.28);
  pointer-events: none;
  animation: x-pulse-halo 0.4s ease-out forwards;
}

.act.act-pop-save svg { animation: x-save-pop 0.42s cubic-bezier(0.22, 1.2, 0.36, 1); }
.act.act-pop-save::before {
  content: "";
  position: absolute;
  left: 17.5px;
  top: 50%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(29, 155, 240, 0.28);
  pointer-events: none;
  animation: x-pulse-halo 0.4s ease-out forwards;
}

.act .count.count-bump { animation: x-count-bump 0.26s ease-out; }

.act[data-act="like"]:hover   { color: var(--like);   background: rgba(249, 24, 128, 0.1); }
.act[data-act="repost"]:hover { color: var(--repost); background: rgba(0, 186, 124, 0.1); }
.act[data-act="reply"]:hover,
.act[data-act="save"]:hover,
.act[data-act="share"]:hover,
.act[data-act="more"]:hover   { color: var(--x-blue); background: rgba(29, 155, 240, 0.1); }

.act[data-act="like"].on   { color: var(--like); }
.act[data-act="like"].on svg { fill: currentColor; }
.act[data-act="repost"].on { color: var(--repost); }
.act[data-act="save"].on   { color: var(--x-blue); }
.act[data-act="save"].on svg { fill: currentColor; }

.post.nested {
  padding-left: calc(18px + var(--indent, 0px));
  --indent: 0px;
}
.post.nested[data-depth="1"] { --indent: 22px; }
.post.nested[data-depth="2"] { --indent: 38px; }
.post.nested[data-depth="3"] { --indent: 50px; }
.post.nested[data-depth="4"] { --indent: 60px; }

.post.nested::before {
  content: "";
  position: absolute;
  left: calc(9px + var(--indent, 0px));
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: var(--line);
}

.thread-more {
  margin: 0;
  padding: 14px 18px;
  font-size: 13.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

#feed-more-wrap {
  padding: 20px;
  display: flex;
  justify-content: center;
}

.empty-card {
  padding: 56px 28px;
  text-align: center;
  max-width: 360px;
  margin: 0 auto;
}

.empty-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.empty-sub {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.empty-actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

/* ── Direct Messages (Split Pane) ──────────────────────────────────── */

#dm-view {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  grid-template-rows: minmax(0, 100%);
}

#dm-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
}

.dm-side-head {
  flex: 0 0 auto;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.dm-side-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0 16px;
}

.dm-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-right: 14px;
}

.dm-section-label {
  padding: 12px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.dm-budget-pill {
  margin-top: 6px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--subtle);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dm-budget-pill.warn { color: #d97a2b; border-color: color-mix(in srgb, #d97a2b 40%, var(--line)); }
.dm-budget-pill.low { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

.dm-list { display: flex; flex-direction: column; }

.dm-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s var(--ease);
}

.dm-row:hover { background: var(--hover); }
.dm-row.on { background: var(--subtle); }

.dm-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dm-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.dm-row-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-row-time {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  flex: 0 0 auto;
}

.dm-row-preview {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-row.unread .dm-row-preview { color: var(--text); font-weight: 500; }

.dm-unread-dot {
  flex: 0 0 auto;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--x-blue);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.dm-empty-hint {
  margin: 4px 16px;
  font-size: 13px;
  color: var(--muted);
}

#dm-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.dm-placeholder {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px;
}

.dm-placeholder-inner {
  max-width: 340px;
  text-align: center;
}

.dm-placeholder-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.dm-placeholder-sub {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

#dm-chat-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

#dm-chat-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

#dm-mobile-back { display: none; }

.dm-peer-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

div.dm-peer-btn { cursor: default; }
.dm-peer-meta { display: flex; flex-direction: column; }
.dm-peer-line { display: flex; align-items: center; gap: 6px; }
.dm-peer-name { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.dm-peer-sub { font-size: 12.5px; color: var(--muted); }

#dm-peer-actions { display: flex; align-items: center; gap: 6px; }

#dm-ai-notice {
  flex: 0 0 auto;
  margin: 0;
  padding: 9px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--subtle);
  border-bottom: 1px solid var(--line);
}

.ai-budget-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 12px;
}

.ai-budget-main {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.ai-budget-main.warn { color: #d97a2b; }
.ai-budget-main.low { color: var(--danger); }

.ai-budget-meta {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ai-budget-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.ai-budget-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--text);
  transition: width 0.25s var(--ease), background-color 0.2s var(--ease);
}

.ai-budget-fill.warn { background: #d97a2b; }
.ai-budget-fill.low { background: var(--danger); }

#dm-messages {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dm-thread-intro {
  margin: auto 0;
  padding: 24px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dm-intro-name { margin: 4px 0 0; font-size: 16px; font-weight: 600; letter-spacing: -0.015em; }
.dm-intro-sub { margin: 0; font-size: 13.5px; color: var(--muted); max-width: 320px; line-height: 1.5; }

.dm-starters {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 340px;
}

.dm-starter {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease), color 0.14s var(--ease);
}

.dm-starter:hover {
  background: var(--subtle);
  border-color: var(--muted);
  color: var(--text);
}

.dm-older-wrap {
  display: flex;
  justify-content: center;
  padding: 4px 0 12px;
}

.dm-inline-code {
  padding: 1px 5px;
  border-radius: 5px;
  background: color-mix(in srgb, currentColor 10%, transparent);
  font: 13px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.dm-text-seg {
  display: block;
}

.dm-code {
  margin: 8px 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

.dm-code:first-child { margin-top: 0; }
.dm-code:last-child { margin-bottom: 0; }

.dm-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--subtle);
  font-size: 11.5px;
  color: var(--muted);
}

.dm-code-copy {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 11.5px;
  color: var(--text-2);
  cursor: pointer;
}

.dm-code-copy:hover { color: var(--text); text-decoration: underline; }

.dm-code pre {
  margin: 0;
  padding: 10px 12px;
  max-width: 100%;
  overflow-x: auto;
  font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.dm-day {
  align-self: center;
  margin: 12px 0 4px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}

.dm-bubble-row {
  display: flex;
  width: 100%;
  min-width: 0;
}

.dm-bubble-row.me { justify-content: flex-end; }
.dm-bubble-row.them { justify-content: flex-start; }

.dm-bubble-wrap {
  max-width: min(78%, 480px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dm-bubble-row.me .dm-bubble-wrap { align-items: flex-end; }
.dm-bubble-row.them .dm-bubble-wrap { align-items: flex-start; }

.dm-bubble {
  max-width: 100%;
  min-width: 0;
  padding: 10px 14px;
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 18px;
}

.dm-bubble-row.me .dm-bubble {
  background: var(--x-blue);
  color: #ffffff;
  border-radius: 20px 20px 4px 20px;
}

.dm-bubble-row.me .dm-bubble a { color: #ffffff; text-decoration: underline; }

.dm-bubble-row.them .dm-bubble {
  background: var(--subtle);
  color: var(--text);
  border-radius: 20px 20px 20px 4px;
}

.dm-bubble.thinking {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 13px 16px;
}

.think-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: think-pulse 1.1s ease-in-out infinite;
}
.think-dot:nth-child(2) { animation-delay: 0.16s; }
.think-dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes think-pulse {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 0.9; }
}

.dm-bubble-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  font-size: 11px;
  color: var(--muted);
}

.dm-del-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.14s var(--ease), color 0.14s var(--ease);
}

.dm-bubble-row:hover .dm-del-btn,
.dm-bubble-row:hover .dm-meta-btn,
.dm-del-btn:focus-visible,
.dm-meta-btn:focus-visible { opacity: 1; }
.dm-del-btn:hover { color: var(--danger); }

.dm-meta-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.14s var(--ease), color 0.14s var(--ease);
}

.dm-meta-btn:hover { color: var(--text); }
.dm-retry-btn { opacity: 0.72; }
.dm-retry-btn:hover { opacity: 1; }

@media (hover: none) {
  .dm-meta-btn,
  .dm-del-btn { opacity: 0.72; }
}

.dm-list-md {
  margin: 6px 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dm-quote {
  margin: 6px 0;
  padding: 2px 0 2px 10px;
  border-left: 2px solid var(--line-strong);
  color: var(--text-2);
}

.dm-md-h {
  margin: 8px 0 3px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.dm-md-h:first-child { margin-top: 0; }

#dm-error {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--danger);
  border-top: 1px solid var(--line);
}

#dm-form {
  flex: 0 0 auto;
  padding: 12px 16px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.dm-composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 5px 8px 5px 10px;
  border: 1px solid transparent;
  border-radius: 20px;
  background: var(--subtle);
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}

.dm-composer:focus-within { border-color: var(--x-blue); background: var(--bg); }

#dm-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15.5px;
  line-height: 1.45;
  padding: 7px 4px;
  resize: none;
  max-height: 160px;
}

#dm-input::placeholder { color: var(--muted); }

#dm-send {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--x-blue);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: opacity 0.14s var(--ease), background-color 0.14s var(--ease);
}

#dm-send:hover:not(:disabled) { background: rgba(29, 155, 240, 0.12); }
#dm-send:disabled { opacity: 0.35; cursor: default; }
#dm-send svg { width: 19px; height: 19px; }

/* New message, Follows, & AI Model Selector modals */
#dm-modal-scrim,
#follows-modal-scrim,
#model-modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 24;
  background: rgba(0, 0, 0, 0.35);
}

#dm-modal,
#follows-modal,
#model-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  width: min(440px, 92vw);
  max-height: min(580px, 82dvh);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.dm-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.dm-modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.015em; }

.dm-modal-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 12px;
}

.dm-pick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dm-pick-row:hover { background: var(--subtle); }

/* ── Right Studio Sidebar (#aside) ─────────────────────────────────── */

#aside {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px 18px 28px;
  overflow-y: auto;
}

.aside-card {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.aside-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.aside-head h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.aside-sub { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.aside-sub.warn { color: #d97a2b; font-weight: 600; }
.aside-sub.low { color: var(--danger); font-weight: 600; }

.aside-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s var(--ease);
}

.aside-row:hover { background: var(--hover); }

.aside-person {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
}

.aside-person-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

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

.aside-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aside-meta {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aside-empty {
  margin: 0;
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
}

/* ── Avatars & Marks ───────────────────────────────────────────────── */

.avatar {
  flex: 0 0 auto;
  display: inline-block;
  width: var(--size, 40px);
  height: var(--size, 40px);
  background: var(--colour, #111114);
}

@media (prefers-color-scheme: dark) {
  .avatar:not(.mark) {
    background: color-mix(in srgb, var(--colour, #111114) 86%, #ffffff 14%);
  }
  .avatar.mark,
  .avatar[data-shape="circle"],
  .avatar[data-shape="square"],
  .avatar[data-shape="rounded"],
  .avatar[data-shape="flower"] {
    border: 1px solid rgba(255, 255, 255, 0.2);
  }
}

.avatar.mark {
  overflow: hidden;
  border: 1px solid var(--line);
}

.avatar.news-mark {
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: -0.03em;
  border: 1px solid var(--line);
}

.news-mark-glyph {
  font-size: calc(var(--size, 40px) * 0.38);
  line-height: 1;
}
.avatar.mark svg,
.avatar-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}
.avatar.clickable { cursor: pointer; }
.avatar[data-shape="circle"]  { border-radius: 50%; }
.avatar[data-shape="square"]  { border-radius: 6px; }
.avatar[data-shape="rounded"] { border-radius: 30%; }
.avatar[data-shape="diamond"] { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.avatar[data-shape="hex"]     { clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.avatar[data-shape="flower"]  { border-radius: 62% 38% 55% 45% / 45% 58% 42% 55%; }

/* ── Profile Header ────────────────────────────────────────────────── */

#profile-head { border-bottom: 1px solid var(--line); }

.profile-banner {
  position: relative;
  height: 185px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--banner-tint, var(--x-blue)), color-mix(in srgb, var(--banner-tint, var(--x-blue)) 55%, #0f1419));
  border-bottom: 1px solid var(--line);
}

.profile-banner-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-inner { padding: 0 16px 14px; }

.profile-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: -62px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.profile-avatar-ring {
  border-radius: 50%;
  padding: 4px;
  background: var(--bg);
  display: inline-flex;
}

.profile-top .avatar {
  outline: 0;
}

.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-name-row { display: flex; align-items: center; gap: 8px; }
.profile-meta h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.025em; }
.profile-handle { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.profile-bio { margin: 10px 0 0; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }

.profile-joined {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 13.5px;
  color: var(--muted);
}

.profile-joined svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.profile-stats {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--muted);
}

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

.profile-tabs {
  border-top: 1px solid var(--line);
}

/* ── Settings ──────────────────────────────────────────────────────── */

#settings-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 20px max(32px, env(safe-area-inset-bottom));
}

.settings-wrap { max-width: 480px; }
#settings-panel h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 12px; }

#settings-panel label {
  display: block;
  margin: 16px 0 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

#settings-panel input[type="text"],
#settings-panel textarea {
  width: 100%;
  padding: 10px 13px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s var(--ease);
}

#settings-panel input:focus,
#settings-panel textarea:focus { border-color: var(--line-strong); }

.hint { margin: 6px 2px 0; font-size: 12.5px; color: var(--muted); }
.settings-divider { height: 1px; background: var(--line); margin: 28px 0 22px; }

#shape-row, #colour-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
#colour-row { margin-top: 10px; }

.shape-pick, .colour-pick {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
}

.shape-pick.on { border-color: var(--line-strong); background: var(--subtle); }
.colour-pick { background: var(--colour); border-color: transparent; border-radius: 50%; width: 32px; height: 32px; }
.colour-pick.on { outline: 2px solid var(--line-strong); outline-offset: 2px; }

.settings-actions { display: flex; align-items: center; gap: 10px; margin-top: 22px; }
#set-note { font-size: 13px; color: var(--muted); }

/* ── Search, People, Notifications, Menus ──────────────────────────── */

#search-bar { padding: 10px 16px; border-bottom: 1px solid var(--line); }

#search-input {
  width: 100%;
  padding: 10px 16px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--subtle);
  border: 1px solid transparent;
  border-radius: 999px;
  outline: none;
}

#search-input:focus { background: var(--bg); border-color: var(--line-strong); }

#people { border-bottom: 1px solid var(--line); }

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

.person:last-child { border-bottom: 0; }

.person-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.person-meta { display: flex; flex-direction: column; min-width: 0; }
.person-line { display: flex; align-items: center; gap: 6px; }
.person-name { font-weight: 600; font-size: 14.5px; }
.person-handle { font-size: 13px; color: var(--muted); }
.person-bio { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.notif {
  display: flex;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.notif:hover { background: var(--hover); }
.notif.unread { background: var(--subtle); }
.notif-icon { flex: 0 0 auto; padding-top: 2px; }
.notif-icon svg { width: 19px; height: 19px; }
.notif-icon.like svg    { color: var(--like); fill: currentColor; }
.notif-icon.repost svg  { color: var(--repost); }
.notif-icon.quote svg   { color: var(--repost); }
.notif-icon.reply svg   { color: var(--save); }
.notif-icon.mention svg { color: var(--save); }
.notif-icon.follow svg  { color: var(--text); }
.notif-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.notif-head { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.notif-head time { font-size: 12.5px; }
.notif-snippet { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bb-item { position: relative; }

.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  color: #ffffff;
  background: var(--x-blue);
  border-radius: 999px;
}

.rail-item .badge {
  position: static;
  margin-left: auto;
}

.bb-item .badge {
  position: absolute;
  left: 50%;
  top: 3px;
  transform: translateX(3px);
}

#reply-context {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 18px 0;
  font-size: 13.5px;
  color: var(--muted);
}

.link-btn {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  text-decoration: underline;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.reply-line { font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.reply-line .who.plain { font-size: 13px; vertical-align: baseline; }

#menu-scrim { position: fixed; inset: 0; z-index: 20; }

#post-menu {
  position: fixed;
  z-index: 21;
  min-width: 210px;
  padding: 5px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.menu-heading {
  margin: 4px 0 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.menu-item:hover, .menu-item:focus-visible { background: var(--subtle); outline: none; }
.menu-item svg { width: 17px; height: 17px; flex: 0 0 auto; }
.menu-item.on { color: var(--save); }
.menu-item.danger { color: var(--danger); }

#toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-text);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}

/* ── Mobile Navigation & Drawer ────────────────────────────────────── */

#bottombar {
  display: none;
  position: sticky;
  bottom: 0;
  z-index: 3;
  justify-content: space-around;
  align-items: center;
  padding: 6px 4px max(6px, env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.bb-item {
  display: grid;
  place-items: center;
  min-width: 54px;
  min-height: 44px;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.bb-item.on { color: var(--text); }
.bb-item svg { width: 22px; height: 22px; }

#drawer-open {
  display: none;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-left: 8px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  flex: 0 0 auto;
}

#scrim {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(0, 0, 0, 0.35);
}

#drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 9;
  width: min(276px, 80vw);
  padding: 20px 0 max(20px, env(safe-area-inset-bottom));
  overflow-y: auto;
  background: var(--bg);
  border-right: 1px solid var(--line);
}

#drawer-me {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 0 20px 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-name { font-weight: 600; font-size: 16px; }
.drawer-handle { font-size: 13.5px; color: var(--muted); }

.drawer-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 14px 20px;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
}

.drawer-item:hover { background: var(--subtle); }
.drawer-item svg { width: 21px; height: 21px; flex: 0 0 auto; }

#compose-fab {
  display: none;
  position: fixed;
  right: 18px;
  bottom: calc(64px + max(10px, env(safe-area-inset-bottom)));
  z-index: 6;
  place-items: center;
  width: 52px;
  height: 52px;
  color: var(--btn-text);
  background: var(--btn);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

#compose-fab svg { width: 22px; height: 22px; }
#social.dm-mode #compose-fab,
#social.settings-mode #compose-fab,
#social.setup-mode #compose-fab { display: none !important; }

/* ── Compact solid button & optional labels ────────────────────────── */

.solid.sm {
  min-height: 30px;
  padding: 5px 12px;
  font-size: 12.5px;
}

.label-opt {
  font-weight: 400;
  color: var(--muted);
}

.vault-type.pending {
  color: var(--text);
  border: 1px solid var(--line-strong);
  background: var(--bg);
}

.hint.ok { color: #1b874b; }
.hint.bad { color: var(--danger); }
@media (prefers-color-scheme: dark) {
  .hint.ok { color: #4ade80; }
}

/* ── First-time Account Setup (choose required unique @handle) ─────── */

#social.setup-mode {
  display: block;
}

#social.setup-mode > :not(#social-setup) {
  display: none !important;
}

#social-setup {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

#social-setup[hidden] { display: none !important; }

.setup-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) 20px 12px;
  border-bottom: 1px solid var(--line);
}

.setup-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 28px 18px max(48px, env(safe-area-inset-bottom));
}

.setup-card {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setup-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.setup-sub {
  margin: -10px 0 2px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.setup-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--subtle);
}

.setup-preview-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.setup-preview-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-preview-handle {
  font-size: 13.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#setup-shape-row,
#setup-colour-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#setup-colour-row { margin-top: 10px; }

.setup-error {
  min-height: 1.2em;
  margin: 0;
  font-size: 13.5px;
  color: var(--danger);
}

/* ── Today's News (dedicated section + Explore + right sidebar) ────── */

#news-panel[hidden] { display: none !important; }

.news-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.news-head-info { min-width: 0; }

.news-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.news-meta {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}

.news-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.news-refresh-btn svg {
  width: 15px;
  height: 15px;
}

.news-empty {
  padding: 44px 24px;
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.news-list {
  display: flex;
  flex-direction: column;
}

.news-card {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.14s var(--ease);
}

.news-card:hover { background: var(--subtle); }

.news-card-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.news-cat {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--subtle);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
}

.news-headline {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.news-summary {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}

.news-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--save);
  text-decoration: none;
}

.news-link:hover { text-decoration: underline; }

.news-card-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.news-discuss-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.news-discuss-btn:hover { color: var(--text); text-decoration: underline; }

/* News category filter pills */
.news-cats {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.news-cats::-webkit-scrollbar { display: none; }

.news-cat-pill {
  flex: 0 0 auto;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease), color 0.14s var(--ease);
}

.news-cat-pill:hover { background: var(--subtle); color: var(--text); }
.news-cat-pill.on {
  background: var(--btn);
  color: var(--btn-text);
  border-color: var(--btn);
}

/* Quote cards (composer preview + feed/thread embed) */
#quote-context { margin: 8px 0 4px; }
#quote-context[hidden] { display: none !important; }

.quote-preview,
.quote-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--bg);
  min-width: 0;
}

.quote-card {
  margin-top: 10px;
  cursor: pointer;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease);
}

.quote-card:hover {
  background: var(--subtle);
  border-color: var(--muted);
}

.quote-card:focus-visible {
  outline: 2px solid var(--line-strong);
  outline-offset: 2px;
}

.quote-card.gone {
  cursor: default;
  color: var(--muted);
  font-size: 13.5px;
  background: var(--subtle);
}
.quote-card.gone:hover { border-color: var(--line); }

.quote-head,
.quote-preview-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  margin-bottom: 4px;
}

.quote-name {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-at,
.quote-head .sep,
.quote-head time {
  color: var(--muted);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-head .sep,
.quote-head time { flex: 0 0 auto; }

.quote-body,
.quote-preview-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quote-preview-body {
  color: var(--text-2);
  -webkit-line-clamp: 3;
}

.quote-remove {
  margin-left: auto;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: var(--subtle);
  color: var(--muted);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.quote-remove:hover { background: var(--subtle-hover); color: var(--text); }

/* Settings: Account age + Muted & Blocked manager */
.settings-joined {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -4px 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.settings-joined svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.safety-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.safety-list:empty { display: none; }

.safety-empty {
  margin: 0;
  padding: 16px 14px;
  font-size: 13.5px;
  color: var(--muted);
}

.safety-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.safety-row:last-child { border-bottom: 0; }

.safety-who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.safety-pill {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
  background: var(--subtle);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.safety-pill.block { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }

/* Edited tag, focused post detail stats, inline edit, @mention menu, notif tabs, DM jump */
.edited-tag {
  font-size: 12.5px;
  color: var(--muted);
  flex: 0 0 auto;
}

.focus-meta {
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--muted);
}

.focus-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
}

.focus-stats strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.edit-post-form {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-post-box {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  resize: vertical;
}

.edit-post-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.edit-post-count {
  margin-right: auto;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.mention-menu {
  margin: 4px 0 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
}

.mention-menu[hidden] { display: none !important; }

.mention-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mention-item:last-child { border-bottom: 0; }
.mention-item:hover,
.mention-item.on { background: var(--subtle); }

#notif-tabs {
  border-top: 0;
  border-bottom: 1px solid var(--line);
}

.dm-jump-btn {
  position: absolute;
  right: 18px;
  bottom: 76px;
  z-index: 4;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease);
}

.dm-jump-btn:hover { background: var(--subtle); border-color: var(--line-strong); }
.dm-jump-btn svg { width: 17px; height: 17px; }

/* AI DM model selector button & modal */
.dm-model-btn {
  align-self: flex-start;
  margin-top: 2px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--subtle);
  color: var(--text-2);
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease), color 0.14s var(--ease);
}

.dm-model-btn:hover {
  background: var(--bg);
  border-color: var(--line-strong);
  color: var(--text);
}

.model-modal-search {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.model-budget-summary {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.model-budget-summary.warn { color: #d97a2b; font-weight: 500; }
.model-budget-summary.low { color: var(--danger); font-weight: 600; }

.model-pick-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s var(--ease);
}

.model-pick-row:last-child { border-bottom: 0; }
.model-pick-row:hover { background: var(--hover); }
.model-pick-row.on { background: var(--subtle); }

.model-pick-right {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.model-price {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.model-check {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-text);
  font-size: 11px;
  font-weight: 600;
}

.model-custom-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--subtle);
}

.model-custom-form .clean-input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 16px;
}

/* Newsroom headline photography cards (Home feed + News tab) */
.post-media-card {
  display: block;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.14s var(--ease), background-color 0.14s var(--ease);
}

.post-media-card:hover {
  border-color: var(--muted);
  background: var(--subtle);
}

.post-media-img,
.news-card-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--subtle);
  overflow: hidden;
}

.news-card-img {
  margin: 8px 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.post-media-img img,
.news-card-img img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

.post-media-img.loaded img,
.news-card-img.loaded img {
  opacity: 1;
}

.post-media-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}

.post-media-card .post-media-foot:first-child { border-top: 0; }

.post-media-src {
  font-weight: 500;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-media-host {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-media-arrow {
  margin-left: auto;
  flex: 0 0 auto;
}

.news-acct-link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--save);
  cursor: pointer;
}

.news-acct-link:hover { text-decoration: underline; }

#new-posts-bar {
  display: block;
  width: 100%;
  padding: 11px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--subtle);
  color: var(--save);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.14s var(--ease);
}

#new-posts-bar:hover { background: var(--bg); }
#new-posts-bar[hidden] { display: none !important; }

#trending-strip {
  padding: 12px 18px 14px;
  border-bottom: 1px solid var(--line);
}

#trending-strip[hidden] { display: none !important; }

.trending-head {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.trending-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.trending-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease);
}

.trending-chip:hover {
  background: var(--subtle);
  border-color: var(--line-strong);
}

.trending-tag { font-weight: 500; color: var(--save); }
.trending-count { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.profile-stat-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.profile-stat-btn:hover { text-decoration: underline; }

.follows-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 12px;
}

.follows-row .dm-pick-row { flex: 1; min-width: 0; }

.admin-person-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.admin-person-btn:hover .person-name { text-decoration: underline; }

.proto-hint {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 3;
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
}

.proto-hint.faded { opacity: 0; }

.aside-link-btn {
  border: 0;
  background: none;
  padding: 4px 6px;
  margin: -4px -6px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--save);
  cursor: pointer;
}

.aside-link-btn:hover { text-decoration: underline; }
.aside-link-btn:disabled { opacity: 0.5; cursor: default; }

.aside-news-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s var(--ease);
}

.aside-news-item:hover { background: var(--subtle); }
.aside-news-cat { font-size: 11.5px; color: var(--muted); }
.aside-news-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }
.aside-news-src { font-size: 11.5px; color: var(--muted); }

.aside-show-more {
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--save);
  text-align: left;
  cursor: pointer;
}

.aside-show-more:hover { background: var(--subtle); }

/* ── X-Exact Upgrade: Filters, Verified, Grokbot, Polls, GIFs, AI Gen, Admin ── */

#post-meter {
  display: inline-flex;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}
#post-meter.visible { opacity: 1; }
.meter-svg { width: 20px; height: 20px; transform: rotate(-90deg); }
.meter-track { fill: none; stroke: var(--line); stroke-width: 2.2; }
.meter-fill { fill: none; stroke: var(--x-blue); stroke-width: 2.2; stroke-linecap: round; transition: stroke-dashoffset 0.12s linear; }
#post-meter.near .meter-fill { stroke: #ffd400; }
#post-meter.over .meter-fill { stroke: var(--danger); }
#post-count { font-size: 12.5px; font-variant-numeric: tabular-nums; }
#post-count.near { color: #d97a2b; }
#post-count.over { color: var(--danger); }

.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  color: var(--x-blue);
  vertical-align: middle;
}
.verified-badge.platform { color: #e2b719; }
.verified-badge svg { width: 17px; height: 17px; display: block; }

/* Cute Grokbot companion SVG avatars + custom uploaded photos */
.avatar.grokbot {
  background: transparent !important;
  border-radius: 50%;
  overflow: visible;
}
.avatar.photo-avatar {
  border-radius: 50%;
  overflow: hidden;
  background: var(--subtle);
}
.avatar-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sub-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

#setup-eyes-row,
#eyes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.eye-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.12s var(--ease), border-color 0.12s var(--ease);
}
.eye-pick:hover { background: var(--subtle); }
.eye-pick.on { border-color: var(--x-blue); background: rgba(29, 155, 240, 0.1); font-weight: 600; }

.colour-row-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* For You horizontal filter pills (All | People | News | Media) */
.feed-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  border-top: 1px solid var(--line);
}
.feed-filters::-webkit-scrollbar { display: none; }

.feed-filter-pill {
  flex: 0 0 auto;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease), border-color 0.14s var(--ease);
}
.feed-filter-pill:hover { background: var(--subtle); color: var(--text); }
.feed-filter-pill.on {
  background: var(--btn);
  color: var(--btn-text);
  border-color: transparent;
}

/* Live @ittosei announcement banner */
.site-announcement {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  background: rgba(29, 155, 240, 0.09);
  border-bottom: 1px solid var(--line);
}

/* X-exact composer toolbar */
.composer-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: -6px;
}

.x-tool-btn,
.dm-tool-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--x-blue);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease);
}
.x-tool-btn:hover,
.dm-tool-btn:hover { background: rgba(29, 155, 240, 0.12); }
.x-tool-btn.on { background: rgba(29, 155, 240, 0.16); }
.x-tool-btn svg,
.dm-tool-btn svg { width: 19px; height: 19px; }

.composer-sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 2px;
}

/* Composer attachment & DM attachment preview */
.composer-attach,
.dm-attach-preview {
  margin-top: 8px;
}
.dm-attach-preview { margin: 0 0 8px; }

.attach-thumb,
.dm-attach-thumb {
  position: relative;
  display: inline-block;
  max-width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.attach-thumb img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  object-fit: cover;
}
.dm-attach-thumb img {
  display: block;
  max-height: 120px;
  max-width: 220px;
  object-fit: cover;
}
.attach-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 20, 25, 0.78);
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.attach-remove:hover { background: rgba(15, 20, 25, 0.94); }

.gif-corner-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(15, 20, 25, 0.78);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Emoji Popover */
.emoji-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 18;
  display: grid;
  grid-template-columns: repeat(8, 34px);
  gap: 2px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
}
.emoji-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.emoji-btn:hover { background: var(--subtle); }

/* Poll Builder (Composer) & Interactive Poll Card (Feed) */
.poll-builder {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.poll-edit-row { display: flex; align-items: center; gap: 6px; }
.poll-edit-row .clean-input { flex: 1; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; font-size: 15px; }
.poll-opt-rm {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.poll-edit-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.clean-select {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.clean-select.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 999px; }

.poll-card {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.poll-vote-btn {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--x-blue);
  border-radius: 9999px;
  background: transparent;
  color: var(--x-blue);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.14s var(--ease);
}
.poll-vote-btn:hover { background: rgba(29, 155, 240, 0.1); }

.poll-result-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
}
.poll-result-bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--subtle);
  border-radius: 6px;
  transition: width 0.35s var(--ease);
}
.poll-result-row.win .poll-result-bar { background: rgba(29, 155, 240, 0.24); }
.poll-result-lbl,
.poll-result-pct { position: relative; z-index: 1; }
.poll-result-row.win .poll-result-lbl,
.poll-result-row.win .poll-result-pct,
.poll-result-row.mine .poll-result-lbl { font-weight: 700; }
.poll-result-pct { font-variant-numeric: tabular-nums; }
.poll-foot { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

/* Post photos, GIFs & DM bubble images */
.post-photo-wrap {
  position: relative;
  margin-top: 10px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--subtle);
  max-height: 510px;
}
.post-photo-img {
  display: block;
  width: 100%;
  max-height: 510px;
  object-fit: cover;
  cursor: zoom-in;
}
.dm-bubble-img {
  margin-bottom: 6px;
  border-radius: 14px;
  overflow: hidden;
}
.dm-bubble-img:last-child { margin-bottom: 0; }
.dm-bubble-img img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  object-fit: cover;
  cursor: zoom-in;
}

/* Modals: GIF Picker, AI Image Generator, Image Access, Shortcuts, Lightbox */
#gif-modal-scrim,
#imggen-modal-scrim,
#imgaccess-modal-scrim,
#shortcuts-modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 26;
  background: rgba(0, 0, 0, 0.45);
}

#gif-modal,
#imggen-modal,
#imgaccess-modal,
#shortcuts-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 27;
  width: min(500px, 94vw);
  max-height: min(640px, 86dvh);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.gif-modal-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.gif-cats {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.gif-cats::-webkit-scrollbar { display: none; }
.gif-cat-pill {
  flex: 0 0 auto;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--subtle);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.gif-cat-pill:hover { border-color: var(--x-blue); }

.gif-grid {
  flex: 1;
  min-height: 280px;
  max-height: 420px;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 148px;
  align-content: start;
  gap: 8px;
}
.gif-tile {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  background: var(--subtle);
  width: 100%;
  height: 148px;
  cursor: pointer;
}
.gif-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.imggen-body,
.imgaccess-body,
.shortcuts-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.imggen-body label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.imggen-body textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  resize: vertical;
}
.imggen-preview {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.imggen-preview img { display: block; width: 100%; max-height: 280px; object-fit: contain; background: var(--subtle); }
.imggen-actions { display: flex; gap: 8px; justify-content: flex-end; }

.imgaccess-copy { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.status-badge.pending {
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(217, 122, 43, 0.14);
  color: #d97a2b;
  font-size: 12.5px;
  font-weight: 700;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.shortcut-row:last-child { border-bottom: 0; }
.shortcut-row kbd {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--subtle);
  font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Full-screen Image Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 12px;
}
.lightbox img {
  max-width: min(94vw, 1100px);
  max-height: 82dvh;
  border-radius: 12px;
  object-fit: contain;
}
.lightbox-close {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.26); }
.lightbox-caption {
  margin: 0;
  max-width: 600px;
  text-align: center;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
}

/* Settings Photo Upload / Approval Card */
.set-photo-card {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.set-photo-top { display: flex; align-items: center; gap: 12px; }
.set-photo-info { flex: 1; min-width: 0; }
.set-photo-title { margin: 0; font-size: 14px; font-weight: 700; }
.set-photo-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Upgraded Admin Panel (Tabs, Grouped Account Keys, Image Approvals, Requests) */
.admin-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.on { color: var(--text); }
.admin-tab.on::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 3px;
  border-radius: 999px;
  background: var(--x-blue);
}
.tab-pill-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--x-blue);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}
.stat-card.alert .stat-value { color: var(--x-blue); }

.admin-toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-toolbar-row .clean-input { flex: 1; min-width: 180px; }

.admin-accounts-grouped,
.admin-review-list {
  display: flex;
  flex-direction: column;
}

.admin-acct-card {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-acct-card:last-child { border-bottom: 0; }
.admin-acct-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.admin-acct-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-acct-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.admin-avatar {
  display: grid;
  place-items: center;
  border-radius: 50% !important;
  font-size: 15px;
  font-weight: 700;
  flex: 0 0 auto;
}

.acct-keys-nest {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--subtle);
  overflow: hidden;
}
.acct-keys-empty { margin: 0; padding: 10px 14px; font-size: 12.5px; color: var(--muted); }
.acct-key-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.acct-key-row:last-child { border-bottom: 0; }
.acct-key-row.revoked { opacity: 0.6; }
.acct-key-left { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acct-key-date { font-size: 11.5px; color: var(--muted); }

.vault-type.verified-tag { color: var(--x-blue); background: rgba(29, 155, 240, 0.12); }
.vault-type.img-ok { color: var(--live); background: rgba(0, 186, 124, 0.12); }
.vault-type.req-status-pending { color: #d97a2b; background: rgba(217, 122, 43, 0.14); }
.vault-type.req-status-approved,
.vault-type.req-status-implemented { color: var(--live); background: rgba(0, 186, 124, 0.14); }
.vault-type.req-status-rejected { color: var(--danger); background: rgba(244, 33, 46, 0.14); }
.vault-type.req-verdict-ok { color: var(--live); }
.vault-type.req-verdict-rejected { color: var(--danger); }

.admin-subhead {
  padding: 12px 18px 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--subtle);
  border-bottom: 1px solid var(--line);
}

.admin-review-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.admin-review-row:last-child { border-bottom: 0; }

.admin-req-card {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-req-card:last-child { border-bottom: 0; }
.admin-req-summary { margin: 0; font-size: 14.5px; font-weight: 700; }
.admin-req-raw { margin: 0; font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; }
.admin-req-review { margin: 0; font-size: 12.5px; color: var(--muted); }

/* @ittosei green flower emblem, reply X-blue context, preview ribbon, and Admin Live Builds */
.avatar.ittosei-flower {
  background: var(--bg) !important;
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 12%;
  display: inline-grid;
  place-items: center;
}
.avatar.ittosei-flower .ittosei-flower-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.reply-ctx-handle { color: var(--x-blue); font-weight: 600; }
.reply-ctx-auto { color: var(--muted); font-size: 12.5px; }

.preview-ribbon {
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(90deg, #1d9bf0, #7c3aed);
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.admin-req-buildlog {
  margin: 0;
  font-size: 12.5px;
  color: var(--x-blue);
  font-weight: 500;
}
.vault-type.build-live { color: var(--live); background: rgba(0, 186, 124, 0.14); }
.vault-type.build-staging { color: #a855f7; background: rgba(168, 85, 247, 0.14); }
.vault-type.build-disabled,
.vault-type.build-rolled_back { color: var(--muted); background: var(--subtle); }
.vault-type.build-needs_repo { color: #d97a2b; background: rgba(217, 122, 43, 0.14); }
.vault-type.build-failed,
.vault-type.build-rejected { color: var(--danger); background: rgba(244, 33, 46, 0.14); }

.admin-code-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--subtle);
}
.admin-code-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.admin-code-pre {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-x: auto;
  max-height: 220px;
  white-space: pre;
}

/* X-style right-rail search pill & clickable rail brand */
button.rail-brand {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  transition: background-color 0.14s var(--ease);
}
button.rail-brand:hover { background: var(--subtle); }
.aside-search-shell { position: relative; }
.aside-search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.aside-search-shell .clean-input {
  height: 44px;
  padding-left: 42px;
  font-size: 15px;
}
.aside-search-shell:focus-within .aside-search-icon { color: var(--x-blue); }
.aside-search-shell .clean-input:focus { border-color: var(--x-blue); }
.aside-name-row { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.aside-name-row .verified-badge { width: 15px; height: 15px; }
.aside-name-row .verified-badge svg { width: 15px; height: 15px; }
.bb-item.on svg { stroke-width: 2.35; }

/* ── Responsive Breakpoints ────────────────────────────────────────── */

@media (max-width: 1240px) {
  #social { grid-template-columns: var(--rail) minmax(0, var(--column)); }
  #aside { display: none; }
}

@media (max-width: 1000px) {
  #social,
  #social.dm-mode { grid-template-columns: 78px minmax(0, 1fr); }
  .rail-wordmark,
  .rail-item .label,
  .rail-me-meta,
  #rail-post .label { display: none; }
  .rail-brand { padding: 6px 0 18px; width: 100%; justify-content: center; }
  .rail-item { justify-content: center; padding: 12px; width: 48px; height: 48px; margin: 0 auto; }
  .rail-item .badge { position: absolute; top: 4px; right: 4px; margin-left: 0; }
  #rail-post { width: 48px; height: 48px; padding: 0; margin: 12px auto 0; }
  #rail-post::before { content: "+"; font-size: 22px; line-height: 1; }
  #rail-me { justify-content: center; padding: 6px; }
}

@media (max-width: 820px) {
  .admin-grid { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-card { border-bottom: 1px solid var(--line); }

  /* Messages switches to single-pane drill-down */
  #dm-view { grid-template-columns: minmax(0, 1fr); }
  #dm-stage { display: none; min-width: 0; }
  #dm-view.chat-open #dm-sidebar { display: none; }
  #dm-view.chat-open #dm-stage { display: flex; }
  #dm-mobile-back { display: grid; }
}

@media (max-width: 700px) {
  #social,
  #social.dm-mode { grid-template-columns: minmax(0, 1fr); }
  #rail { display: none; }
  #timeline { border-right: 0; }
  #bottombar { display: flex; }
  #drawer-open { display: grid; }
  .act { min-height: 44px; padding-top: 0; padding-bottom: 0; }
  #compose-fab { display: grid; }
  #social.dm-mode #compose-fab { display: none; }
  .dm-bubble-wrap { max-width: 90%; }
  #dm-messages { padding: 14px 12px; }
  .news-head { flex-direction: column; align-items: stretch; }
  .news-refresh-btn { justify-content: center; min-height: 44px; }
  #toast { bottom: calc(124px + max(10px, env(safe-area-inset-bottom))); max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 600px) {
  .vault-top { flex-direction: column; align-items: stretch; gap: 10px; }
  .vault-controls { display: flex; justify-content: flex-start; }
  .vault-controls .pill-btn { min-height: 40px; padding: 8px 16px; }
  .vault-note-edit { flex-wrap: wrap; }
  .vault-note-edit .clean-input { flex: 1 1 100%; }
  .vault-note-edit .pill-btn { min-height: 40px; }
  .made-actions { width: 100%; display: flex; gap: 8px; }
  .made-actions > button { flex: 1; min-height: 44px; }
  .seg-btn { min-height: 36px; padding: 6px 12px; }
  .admin-person-row { flex-wrap: wrap; }
  .admin-person-row .pill-btn { min-height: 38px; padding: 6px 14px; }
  .keys-toolbar .row-between { flex-wrap: wrap; gap: 10px; }
}

@media (max-width: 480px) {
  #gate { padding: 20px; }
  .search-shell { height: 54px; padding: 0 5px 0 16px; gap: 10px; }
  .go { height: 44px; min-height: 44px; padding: 0 18px; }
  .admin-topbar { padding-left: 14px; padding-right: 14px; }
  .admin-wrap { padding: 16px 14px max(48px, env(safe-area-inset-bottom)); }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { padding: 14px 16px; }
  .stat-card:nth-child(2n) { border-right: 0; }
  .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
  .setup-card { padding: 22px 18px; }
  .post { padding: 12px 14px 4px; }
  #composer { padding: 10px 14px; }
  .post-actions { max-width: none; }
  .emoji-popover { grid-template-columns: repeat(6, 36px); max-width: calc(100vw - 24px); }
  #gif-search-input,
  #imggen-prompt,
  #imggen-model,
  .poll-edit-row .clean-input,
  #dm-input,
  #post-body,
  .composer-backdrop { font-size: 16px; }
  .admin-acct-card { padding: 14px; }
  .acct-key-row { flex-wrap: wrap; }
  .admin-tab { padding: 10px 10px; font-size: 13px; gap: 5px; }
}

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