/* Thread — Polarity GPS skin (opened inward) */

:root {
  --gps-font: "Sohne", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, system-ui, sans-serif;
  --gps-font-mono: "Sohne Mono", ui-monospace, Menlo, monospace;
  --gps-void: #000000;
  --gps-surface: #0a0a0a;
  --gps-surface-raised: #0a0a0a;
  --gps-sheet: #0a0a0a;
  --gps-text: rgba(255, 255, 255, 0.92);
  --gps-text-secondary: rgba(255, 255, 255, 0.65);
  --gps-text-muted: rgba(255, 255, 255, 0.5);
  --gps-text-faint: rgba(255, 255, 255, 0.35);
  --gps-border: rgba(255, 255, 255, 0.08);
  --gps-border-strong: rgba(255, 255, 255, 0.15);
  --gps-accent: #7fedc7;
  --gps-accent-dim: rgba(127, 237, 199, 0.15);
  --gps-tint: rgba(255, 255, 255, 0.03);
  --gps-tint-hover: rgba(255, 255, 255, 0.06);
  --gps-tint-active: rgba(255, 255, 255, 0.1);
  --gps-overlay: rgba(0, 0, 0, 0.72);
  --gps-ease: cubic-bezier(0.32, 0.72, 0, 1);
}

html.thread-active,
body.thread-active {
  overscroll-behavior: none;
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

html.cosmos-authed-boot body.thread-active .scanlines,
html.cosmos-authed-boot body.thread-active .bg-shell,
html.cosmos-authed-boot body.thread-active .bg-shell::after {
  display: none !important;
}

html.cosmos-authed-boot body.thread-active main.me-life-main {
  padding: 0 !important;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
}

html.cosmos-authed-boot #signed-in.thread-page {
  display: flex !important;
  flex-direction: column;
  z-index: 70;
}

.thread-page {
  position: fixed;
  inset: 0;
  background: var(--gps-void);
  color: var(--gps-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--gps-font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/* ── Top chrome ── */

.thread-topbar {
  flex: 0 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  z-index: 12;
  background: transparent;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "brand nav actions";
  align-items: center;
  column-gap: 10px;
  row-gap: 0;
}

.thread-brand {
  grid-area: brand;
  justify-self: start;
  font-family: var(--gps-font);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-transform: lowercase;
  color: var(--gps-text);
}

.thread-topbar-nav {
  grid-area: nav;
  justify-self: center;
  min-width: 0;
  max-width: 100%;
  display: flex;
  justify-content: center;
}

.thread-topbar-nav[hidden] {
  display: none;
}

.thread-topbar-actions {
  grid-area: actions;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 4px;
}

.thread-topbar-btn {
  background: transparent;
  border: none;
  color: var(--gps-text-secondary);
  border-radius: 999px;
  padding: 8px 10px;
  min-height: 36px;
  font-family: var(--gps-font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
  white-space: nowrap;
}

.thread-topbar-btn:hover {
  background: var(--gps-tint-hover);
  color: var(--gps-text);
}

.thread-topbar-btn:active {
  background: var(--gps-tint-active);
  transform: scale(0.98);
}

.thread-topbar-btn.is-signal {
  color: var(--gps-accent);
  background: var(--gps-accent-dim);
  border: 1px solid rgba(127, 237, 199, 0.35);
  padding: 8px 12px;
}

.thread-topbar-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.thread-rooms {
  display: none;
}

/* ── Pager ── */

.thread-pager {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  max-width: 100%;
}

.thread-pager-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--gps-border);
  background: var(--gps-overlay);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--gps-text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.thread-pager-btn:hover:not(:disabled) {
  background: var(--gps-tint-hover);
  border-color: var(--gps-border-strong);
}

.thread-pager-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.thread-pager-btn:disabled {
  opacity: 0.28;
  cursor: default;
}

.thread-pager-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.thread-pager-name {
  font-family: var(--gps-font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gps-text-muted);
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-pager-name.is-group::after {
  content: ' · group';
  opacity: 0.7;
  letter-spacing: 0.08em;
}

.thread-pager-count {
  font-family: var(--gps-font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--gps-text-faint);
}

/* ── Deck + card ── */

.thread-deck {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 4px 14px 8px;
}

.thread-deck-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.thread-card-stack {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.thread-card-ghost {
  display: none;
}

.thread-card-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  will-change: transform, opacity;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.thread-card-wrap.is-dragging .thread-card {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.thread-card-wrap.is-vote-toward .thread-card {
  border-color: rgba(127, 237, 199, 0.55);
  box-shadow: 0 20px 50px rgba(127, 237, 199, 0.12);
}

.thread-card-wrap.is-vote-away .thread-card {
  border-color: rgba(251, 113, 133, 0.55);
  box-shadow: 0 20px 50px rgba(251, 113, 133, 0.1);
}

.thread-compose.is-hidden {
  display: none;
}

.thread-card-hint,
.thread-card-vote-prompt {
  margin: 0;
  font-family: var(--gps-font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.45;
  color: var(--gps-text-faint);
}

.thread-card-vote-prompt {
  color: var(--gps-accent);
  margin-top: 4px;
}

.thread-friction-face {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.thread-friction-face.is-collision {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(251, 113, 133, 0.28);
  background: rgba(251, 113, 133, 0.06);
}

.thread-friction-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--gps-font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--gps-text-muted);
}

.thread-friction-pill.is-toward {
  border-color: rgba(127, 237, 199, 0.35);
  color: var(--gps-accent);
  background: rgba(127, 237, 199, 0.1);
}

.thread-friction-pill.is-away {
  border-color: rgba(251, 113, 133, 0.35);
  color: rgba(251, 113, 133, 0.92);
  background: rgba(251, 113, 133, 0.08);
}

.thread-friction-pill.is-you {
  border-width: 1px;
}

.thread-card-hint.is-connect {
  color: var(--gps-accent);
}

.thread-card-pattern {
  margin: 10px 0 0;
  font-family: var(--gps-font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.45;
  color: var(--gps-accent);
}

.thread-card-recap {
  margin: 0;
  font-family: var(--gps-font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.45;
  color: var(--gps-text-muted);
  text-transform: lowercase;
}

.thread-card-sharpness {
  margin: 0 0 8px;
  font-family: var(--gps-font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.45;
  color: var(--gps-accent);
  opacity: 0.85;
}

.thread-card-vote-feedback {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--gps-accent);
}

.thread-vote-dock {
  flex: 0 0 auto;
  display: none;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 4px 14px 6px;
  box-sizing: border-box;
}

.thread-vote-dock.is-active {
  display: flex;
}

.thread-vote-dock-prompt {
  margin: 0;
  font-family: var(--gps-font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.45;
  color: var(--gps-accent);
  text-align: center;
}

.thread-vote-dock-hint {
  margin: 0;
  font-family: var(--gps-font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--gps-text-faint);
  text-align: center;
  text-transform: lowercase;
}

.thread-vote-rail {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
}

.thread-vote-btn {
  flex: 1;
  min-height: 48px;
  border-radius: 999px;
  border: 1px solid var(--gps-border-strong);
  background: var(--gps-tint-hover);
  font-family: var(--gps-font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.thread-vote-btn.is-toward {
  color: var(--gps-accent);
  border-color: rgba(127, 237, 199, 0.35);
  background: var(--gps-accent-dim);
}

.thread-vote-btn.is-away {
  color: rgba(251, 113, 133, 0.92);
  border-color: rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.08);
}

.thread-vote-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.thread-vote-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.thread-vote-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Read-check: cosmos stated its read, you confirm or correct it. */
.thread-readcheck {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.thread-readcheck-row {
  display: flex;
  gap: 10px;
}

.thread-readcheck-btn {
  flex: 1;
  min-height: 46px;
  border-radius: 999px;
  border: 1px solid var(--gps-border);
  background: var(--gps-surface-raised);
  color: var(--gps-text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}

.thread-readcheck-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.thread-readcheck-btn:active {
  transform: scale(0.97);
}

.thread-readcheck-btn.is-confirm {
  color: var(--gps-accent);
  border-color: rgba(127, 237, 199, 0.5);
  background: var(--gps-accent-dim);
  font-weight: 600;
}

.thread-readcheck-correct {
  display: flex;
  gap: 8px;
  align-items: center;
}

.thread-alignment-pill.is-you {
  border-width: 1px;
  font-weight: 400;
}

.thread-card {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  border-radius: 20px;
  background: var(--gps-surface-raised);
  border: 1px solid var(--gps-border);
  padding: clamp(22px, 5vw, 28px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 14px;
  box-sizing: border-box;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.thread-card-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.thread-card.is-weave {
  border-color: rgba(127, 237, 199, 0.22);
  background: linear-gradient(165deg, rgba(17, 17, 20, 1) 0%, rgba(10, 14, 18, 1) 100%);
  min-height: min(60vh, 460px);
}

.thread-card.is-anchor {
  border-color: rgba(127, 237, 199, 0.18);
  background: linear-gradient(165deg, rgba(12, 16, 20, 1) 0%, rgba(8, 10, 14, 1) 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(127, 237, 199, 0.08);
  align-items: center;
  text-align: center;
  padding-top: 30px;
  padding-bottom: 30px;
  gap: 20px;
}

.thread-anchor-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: rgba(127, 237, 199, 0.15);
  border: 1px solid rgba(127, 237, 199, 0.4);
}

.thread-anchor-star {
  font-size: 20px;
  line-height: 1;
  color: var(--gps-accent);
}

.thread-card.is-anchor .thread-card-body {
  font-size: clamp(20px, 5.4vw, 26px);
  font-weight: 400;
  line-height: 1.35;
  flex: 0 0 auto;
  overflow: visible;
}

.thread-card.is-anchor .thread-card-hint {
  text-align: center;
}

.thread-alignment-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--gps-font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--gps-text-muted);
}

.thread-alignment-pill.is-toward {
  border-color: rgba(127, 237, 199, 0.35);
  color: var(--gps-accent);
  background: rgba(127, 237, 199, 0.1);
}

.thread-alignment-pill.is-away {
  border-color: rgba(251, 113, 133, 0.35);
  color: rgba(251, 113, 133, 0.92);
  background: rgba(251, 113, 133, 0.08);
}

.thread-alignment-pill.is-mixed {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--gps-text-secondary);
}

.thread-card-heading {
  font-family: var(--gps-font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gps-text-faint);
  margin: 0;
}

.thread-card.is-weave .thread-card-body {
  max-height: none;
  flex: 0 0 auto;
}

.thread-card-body {
  font-family: var(--gps-font);
  font-size: clamp(17px, 4.4vw, 22px);
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--gps-text);
  margin: 0;
  flex: 1 1 auto;
  text-wrap: pretty;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.thread-card-proof {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.thread-card-proof-k {
  margin: 0;
  font-family: var(--gps-font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gps-text-faint);
}

.thread-card-proof-q {
  margin: 0;
  font-size: 14px;
  line-height: 1.48;
  color: var(--gps-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thread-card-meta {
  margin-top: 16px;
  padding-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.thread-card-sheet-btn {
  font-family: var(--gps-font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gps-text-secondary);
  background: var(--gps-surface, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--gps-border, rgba(255, 255, 255, 0.08));
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 32px;
  cursor: pointer;
  transition: background 160ms ease, transform 120ms ease;
}

.thread-card-sheet-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.thread-card-sheet-btn:active {
  transform: scale(0.98);
}

.thread-card-share-btn {
  font-family: var(--gps-font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gps-accent);
  background: var(--gps-accent-dim);
  border: 1px solid rgba(127, 237, 199, 0.28);
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 32px;
  cursor: pointer;
  transition: background 160ms ease, transform 120ms ease;
}

.thread-card-share-btn:hover {
  background: rgba(127, 237, 199, 0.22);
}

.thread-card-share-btn:active {
  transform: scale(0.98);
}

.thread-drift {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.thread-card.is-anchor .thread-drift {
  align-items: center;
}

.thread-drift-dots {
  display: flex;
  gap: 6px;
}

.thread-drift-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--gps-accent);
}

.thread-drift-dot.is-away {
  background: rgba(251, 113, 133, 0.85);
}

.thread-drift-summary {
  font-family: var(--gps-font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gps-text-muted);
  margin: 0;
  text-align: center;
}

/* Convergence: the longitudinal payoff on the compass card. */
.thread-convergence {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--gps-border);
  background: var(--gps-surface);
}

.thread-convergence.is-closing {
  border-color: rgba(127, 237, 199, 0.35);
}

.thread-convergence.is-widening {
  border-color: rgba(251, 113, 133, 0.35);
}

.thread-convergence-summary {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  color: var(--gps-text-secondary);
}

.thread-convergence.is-closing .thread-convergence-summary {
  color: var(--gps-accent);
}

.thread-convergence.is-widening .thread-convergence-summary {
  color: rgba(251, 113, 133, 0.95);
}

.thread-convergence-detail {
  margin: 0;
  font-family: var(--gps-font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gps-text-faint);
  text-align: center;
}

.thread-facet-convergence {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--gps-border);
  background: var(--gps-surface);
  align-self: stretch;
}

.thread-facet-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 12px;
  color: var(--gps-text-secondary);
}

.thread-facet-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex: 0 0 auto;
  background: var(--gps-text-faint);
}

.thread-facet-line.is-toward .thread-facet-dot {
  background: var(--gps-accent);
}

.thread-facet-line.is-away .thread-facet-dot {
  background: rgba(251, 113, 133, 0.95);
}

.thread-facet-line.is-away .thread-facet-text {
  color: rgba(251, 113, 133, 0.9);
}

.thread-commit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.thread-commit-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.thread-commit-input {
  flex: 1;
  font: inherit;
  font-size: 14px;
  color: var(--gps-text);
  background: var(--gps-surface-raised, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--gps-border, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}

.thread-commit-input:focus {
  border-color: rgba(127, 237, 199, 0.4);
}

.thread-commit-send {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  font-size: 16px;
  font-weight: 700;
  color: var(--gps-accent);
  background: var(--gps-accent-dim);
  border: 1px solid rgba(127, 237, 199, 0.35);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease;
}

.thread-commit-send:hover {
  background: rgba(127, 237, 199, 0.22);
}

.thread-commit-send:active {
  transform: scale(0.96);
}

.thread-card-move {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--gps-accent-dim);
  border: 1px solid rgba(127, 237, 199, 0.3);
}

.thread-card-move-arrow {
  color: var(--gps-accent);
  font-size: 13px;
}

.thread-card-move-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--gps-text);
}

.thread-card-recall {
  font-family: var(--gps-font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--gps-accent);
  background: var(--gps-accent-dim);
  border: 1px solid rgba(127, 237, 199, 0.3);
  border-radius: 999px;
  padding: 6px 12px;
  margin: 0;
  align-self: center;
}

.thread-card-compass-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  align-self: center;
}

.thread-card-compass-hint-text {
  font-size: 12px;
  line-height: 1.4;
  color: var(--gps-text-faint, rgba(255, 255, 255, 0.35));
  text-align: center;
  margin: 0;
  max-width: 32ch;
}

.thread-card-compass-draft {
  font-family: var(--gps-font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gps-accent);
  background: var(--gps-accent-dim);
  border: 1px solid rgba(127, 237, 199, 0.3);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 34px;
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.32, 0.72, 0, 1), background 160ms;
}

.thread-card-compass-draft:active {
  transform: scale(0.97);
}

.thread-card-compass-draft:disabled {
  opacity: 0.6;
  cursor: default;
}

.thread-deck-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  padding: 10px 0 4px;
}

.thread-deck-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  transition: background 160ms ease, transform 160ms ease;
}

.thread-deck-dot.is-active {
  width: 7px;
  height: 7px;
  background: var(--gps-accent);
}

.thread-sheet-lens {
  font-size: 13px;
  color: var(--gps-text-muted);
  margin-top: 8px;
}

.thread-receipt-supports {
  font-size: 12px;
  color: var(--gps-text-muted);
  margin: 0 0 6px;
  font-style: italic;
}

/* ── Compose dock ── */

.thread-compose {
  flex: 0 0 auto;
  margin: 0 12px max(10px, env(safe-area-inset-bottom));
  padding: 8px;
  border-radius: 16px;
  background: var(--gps-overlay);
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
  border: 1px solid var(--gps-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  z-index: 8;
}

.thread-compose.is-disabled textarea {
  opacity: 0.45;
}

.thread-compose.is-disabled button {
  opacity: 0.45;
}

.thread-compose textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  border-radius: 12px;
  border: 1px solid var(--gps-border);
  background: var(--gps-tint);
  color: var(--gps-text);
  padding: 12px 14px;
  font-family: var(--gps-font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
}

.thread-compose textarea::placeholder {
  color: var(--gps-text-faint);
}

.thread-compose textarea:focus {
  outline: none;
  border-color: rgba(127, 237, 199, 0.35);
  background: rgba(255, 255, 255, 0.05);
}

.thread-compose button {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  border: 1px solid rgba(127, 237, 199, 0.35);
  background: var(--gps-accent-dim);
  color: var(--gps-accent);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 120ms ease;
}

.thread-compose button:hover:not(:disabled) {
  background: rgba(127, 237, 199, 0.25);
}

.thread-compose button:active:not(:disabled) {
  transform: scale(0.96);
  background: var(--gps-accent);
  color: #000;
}

/* ── Bottom sheets ── */

.thread-sheet-scrim,
.thread-connect-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.thread-sheet-scrim.is-visible,
.thread-connect-scrim.is-visible {
  opacity: 1;
  pointer-events: auto;
}

body.thread-sheet-open {
  overflow: hidden;
}

.thread-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85vh;
  min-height: min(40vh, 360px);
  z-index: 501;
  background: var(--gps-sheet);
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--gps-border);
  border-bottom: none;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
  padding: 8px 18px 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 300ms var(--gps-ease);
}

.thread-sheet.is-open {
  transform: translateY(0);
}

.thread-sheet.is-dragging {
  transition: none;
}

.thread-connect-sheet.thread-sheet {
  z-index: 502;
}

.thread-sheet-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 2px 4px 0;
}

.thread-sheet-close {
  width: 44px;
  height: 44px;
  border: 1px solid var(--gps-border);
  border-radius: 999px;
  background: var(--gps-tint);
  color: var(--gps-text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, transform 120ms ease;
}

.thread-sheet-close:active {
  transform: scale(0.96);
  background: var(--gps-tint-hover);
}

.thread-topbar-btn.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

.thread-pull-indicator {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-family: var(--gps-font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gps-text-faint);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, color 160ms ease;
}

.thread-pull-indicator.is-active {
  opacity: 1;
}

.thread-pull-indicator.is-ready {
  color: var(--gps-accent);
}

.thread-sheet-handle {
  width: 40px;
  height: 28px;
  margin: 0 auto 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
}

.thread-sheet-handle::after {
  content: '';
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--gps-text-faint);
}

.thread-sheet-body,
.thread-connect-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.thread-sheet h3 {
  font-family: var(--gps-font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gps-text-faint);
  margin: 0 0 8px;
}

.thread-sheet p {
  font-size: 15px;
  line-height: 1.55;
  color: var(--gps-text-secondary);
  margin: 0 0 16px;
}

.thread-sheet-summary {
  margin: 4px 0 18px;
  padding: 16px 16px 14px;
  border-radius: 18px;
  border: 1px solid var(--gps-border);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.thread-sheet-summary-k {
  margin: 0 0 8px;
  font-family: var(--gps-font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gps-accent);
}

.thread-sheet-summary-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--gps-text);
}

.thread-receipt {
  border-left: 2px solid rgba(127, 237, 199, 0.35);
  padding: 0 0 14px 12px;
  margin-bottom: 14px;
}

.thread-receipt.is-lead {
  margin-bottom: 20px;
  padding: 14px 14px 16px;
  border-left-width: 0;
  border-radius: 18px;
  border: 1px solid rgba(127, 237, 199, 0.22);
  background: rgba(127, 237, 199, 0.06);
}

.thread-receipt-k {
  font-family: var(--gps-font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gps-text-faint);
  margin-bottom: 6px;
}

.thread-receipt-proof-meta {
  margin: 0 0 8px;
  font-family: var(--gps-font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(127, 237, 199, 0.88);
}

.thread-receipt-q {
  font-size: 15px;
  line-height: 1.5;
  color: var(--gps-text);
  margin: 0;
}

.thread-receipt-supports {
  margin: 0 0 8px;
  font-family: var(--gps-font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gps-accent);
}

.thread-sheet-why {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--gps-border);
}

.thread-graph-trail {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--gps-border);
}

.thread-graph-intro {
  font-size: 13px;
  line-height: 1.45;
  color: var(--gps-text-muted);
  margin: 0 0 14px;
}

.thread-graph-loading,
.thread-graph-empty {
  font-size: 13px;
  color: var(--gps-text-faint);
  margin: 0 0 12px;
}

.thread-graph-link {
  display: inline-block;
  font-size: 13px;
  color: var(--gps-accent);
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  margin-bottom: 8px;
}

.thread-receipt-graph {
  border-left-color: rgba(127, 237, 199, 0.35);
}

/* ── Connect sheet ── */

.thread-connect-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

.thread-connect-lead {
  font-size: 14px;
  line-height: 1.55;
  color: var(--gps-text-secondary);
  margin: 0 0 18px;
}

.thread-connect-status {
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--gps-tint);
  border: 1px solid var(--gps-border);
}

.thread-connect-k {
  color: var(--gps-text-faint);
}

.thread-connect-v.is-ok {
  color: var(--gps-accent);
}

.thread-connect-v.is-warn {
  color: #f59e0b;
}

.thread-connect-hint,
.thread-connect-note,
.thread-connect-step-note {
  font-size: 13px;
  line-height: 1.45;
  color: var(--gps-text-muted);
}

.thread-connect-step-label {
  font-family: var(--gps-font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gps-text-faint);
  margin: 12px 0 6px;
}

.thread-connect-cmd {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--gps-border);
  font-family: var(--gps-font-mono);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--gps-text-secondary);
}

.thread-connect-btn {
  align-self: flex-start;
  background: var(--gps-tint);
  border: 1px solid var(--gps-border);
  color: var(--gps-text);
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 44px;
  font-family: var(--gps-font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 160ms ease, transform 120ms ease;
}

.thread-connect-btn:active {
  transform: scale(0.98);
}

.thread-connect-btn-primary {
  background: var(--gps-accent-dim);
  border-color: rgba(127, 237, 199, 0.35);
  color: var(--gps-accent);
}

.thread-connect-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--gps-border);
}

.thread-connect-section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 10px;
}

.thread-connect-phone-input {
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  font-family: inherit;
  font-size: 17px;
  color: rgba(255, 255, 255, 0.92);
  box-sizing: border-box;
  margin-bottom: 10px;
}

.thread-connect-phone-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.thread-connect-section-primary {
  border-top-color: rgba(127, 237, 199, 0.2);
}

.thread-connect-minted {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(127, 237, 199, 0.35);
  background: var(--gps-accent-dim);
}

.thread-connect-link {
  color: var(--gps-accent);
  text-decoration: none;
}

.thread-connect-foot {
  font-size: 13px;
  color: var(--gps-text-faint);
  margin: 20px 0 0;
}

/* ── Empty + status ── */

.thread-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
  color: var(--gps-text-secondary);
  font-size: 15px;
  line-height: 1.55;
}

.thread-empty-mark {
  margin-bottom: 8px;
}

.thread-empty-wordmark {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--gps-text);
  margin: 0;
}

.thread-empty-tagline {
  font-size: 12px;
  color: var(--gps-text-faint);
  margin: 0;
}

.thread-empty-message {
  font-size: 13px;
  color: var(--gps-text-muted);
  margin: 8px 0 0;
  max-width: 320px;
}

.thread-empty-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--gps-accent);
  font-size: 14px;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.thread-status {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  font-family: var(--gps-font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gps-text-faint);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.thread-status.is-visible {
  opacity: 1;
}

/* ── Onboarding ── */

.thread-onboard {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  padding: max(32px, env(safe-area-inset-top)) 28px max(32px, env(safe-area-inset-bottom));
}

.thread-onboard-panel {
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.thread-onboard-progress {
  font-family: var(--gps-font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gps-text-faint);
  margin: 0;
}

.thread-onboard-question {
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.35;
  margin: 0;
  max-width: 20ch;
}

.thread-onboard-form textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 120px;
  background: var(--gps-tint);
  border: 1px solid var(--gps-border);
  border-radius: 16px;
  color: var(--gps-text);
  padding: 16px 18px;
  font-family: var(--gps-font);
  font-size: 16px;
  line-height: 1.5;
  resize: vertical;
}

.thread-onboard-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.thread-onboard-actions button {
  background: var(--gps-text);
  color: var(--gps-void);
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  min-height: 44px;
  font-family: var(--gps-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.thread-onboard-skip {
  background: transparent !important;
  color: var(--gps-text-muted) !important;
  border: 1px solid var(--gps-border) !important;
}

@media (min-width: 720px) {
  .thread-topbar {
    padding: max(10px, env(safe-area-inset-top)) 20px 10px;
    column-gap: 16px;
  }

  .thread-topbar-btn {
    padding: 8px 12px;
  }

  .thread-pager {
    gap: 10px;
  }

  .thread-pager-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .thread-pager-name {
    font-size: 10px;
    letter-spacing: 0.14em;
    max-width: 24ch;
  }

  .thread-deck {
    padding: 6px 24px 12px;
  }

  .thread-deck-stage {
    align-items: center;
  }

  .thread-card-stack {
    width: 100%;
    max-width: 520px;
    flex: 1 1 auto;
    min-height: 0;
  }

  .thread-card {
    width: 100%;
    max-width: none;
    margin: 0;
    min-height: min(68dvh, 680px);
  }

  .thread-compose {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    width: calc(100% - 24px);
  }
}

/* ── Cosmos.app shell (narrow WKWebView window) ── */

html.cosmos-mac-app .thread-vote-dock {
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}

html.cosmos-mac-app .thread-topbar {
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand actions"
    "nav nav";
  row-gap: 8px;
  column-gap: 8px;
  padding-left: 14px;
  padding-right: 14px;
}

html.cosmos-mac-app .thread-topbar-nav {
  justify-self: stretch;
  width: 100%;
}

html.cosmos-mac-app .thread-pager {
  width: 100%;
  max-width: none;
  justify-content: center;
  gap: 8px;
}

html.cosmos-mac-app .thread-pager-name {
  max-width: 18ch;
}

html.cosmos-mac-app .thread-topbar-actions {
  gap: 6px;
}

html.cosmos-mac-app .thread-topbar-btn {
  padding: 7px 10px;
  min-height: 32px;
}
