/* ─────────────────────────────────────────────────────────────
   MINDSMAN COMMUNITY — app shell + views
   Desktop: persistent left sidebar (Discord-style)
   Mobile:  top bar + slide-in drawer + bottom tab bar
   ───────────────────────────────────────────────────────────── */

html, body {
  height: 100%;
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100dvh;
}

/* While the keyboard is up, drop the bottom tabs so the composer sits right
   above the keyboard (instead of the tabs wedged between them). */
@media (max-width: 880px) {
  body.keyboard-open .bottom-nav { display: none; }
}

/* ── Sidebar ──────────────────────────────────────────────── */

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--navy-deep);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.sidebar-brand img { width: 34px; height: 34px; object-fit: contain; }

.sidebar-brand .word {
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bone);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 20px;
  min-height: 0;
}

.nav-section {
  margin-top: 18px;
}

.nav-section:first-child { margin-top: 4px; }

.nav-heading {
  padding: 0 10px 5px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bone-dim);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--bone-dim);
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  transition: background 0.14s ease, color 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-item:hover { background: rgba(232, 226, 212, 0.05); color: var(--bone); }

.nav-item.active {
  background: rgba(159, 42, 42, 0.16);
  color: var(--bone);
}

.nav-item.active .nav-flame { color: var(--crimson-bright); }

.nav-item .nav-flame {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--slate-soft);
}

.nav-item .lock {
  margin-left: auto;
  width: 13px;
  height: 13px;
  color: var(--slate);
  flex: none;
}

/* Exclusive sub-chat nested under its Fire. */
.nav-item.nav-sub {
  padding-left: 30px;
  font-size: 13.5px;
  color: var(--slate-soft);
}
.nav-item.nav-sub .nav-flame { width: 15px; height: 15px; }

/* Earned-but-unspent rank unlock prompt. */
.nav-item.nav-unlock {
  color: var(--gold);
  cursor: pointer;
  font-weight: 600;
}
.nav-item.nav-unlock .nav-flame { color: var(--gold); }
.nav-item.nav-unlock:hover { background: rgba(176, 138, 74, 0.12); color: var(--gold); }
.nav-unlock-count {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--gold);
  color: var(--navy-deep);
  font-size: 11px;
  font-weight: 700;
}

/* Unlock modal — choose a Fire / exclusive chat to unlock. */
.unlock-list { display: flex; flex-direction: column; gap: 7px; }
.unlock-opt {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--navy-rise);
  color: var(--bone);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.unlock-opt:hover { border-color: var(--gold); background: rgba(176, 138, 74, 0.1); }
.unlock-opt .nav-flame { width: 20px; height: 20px; flex: none; color: var(--crimson-bright); }

.sidebar-user {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.sidebar-user .who { min-width: 0; flex: 1; }

.sidebar-user .who .name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--bone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Rank + tier + role badges under the name, mirroring the profile card.
   Sized to keep all three credentials on a single row in the narrow menu. */
.sidebar-user .su-badges {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  margin-top: 5px;
}

.sidebar-user .su-badges .tier-badge {
  padding: 2px 4px;
  font-size: 8px;
  letter-spacing: 0.04em;
  gap: 3px;
  white-space: nowrap;
}

/* Fire Power level + progress bar */
.sidebar-user .su-power {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
  font-size: 10px;
  line-height: 1.2;
}

.sidebar-user .su-power-amt { color: var(--bone-dim); font-weight: 700; white-space: nowrap; }
.sidebar-user .su-power-next {
  color: var(--slate-soft);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The Fire Power total — bold, brighter gold, and tappable for an explanation.
   The surrounding "Fire Power — X to Rank" wording is bolded but keeps its own
   color (set on the containers above / .fp-line / .pc-power). */
.fp-number {
  font-weight: 800;
  color: var(--gold-bright, #efc24a);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fp-number:hover { text-decoration: underline; }
.fp-number:focus-visible { outline: 2px solid var(--gold-bright, #efc24a); outline-offset: 2px; border-radius: 3px; }
.fp-line { font-weight: 700; }

.sidebar-user .su-bar {
  margin-top: 6px;
  height: 5px;
}

/* ── Avatars ──────────────────────────────────────────────── */

.avatar {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  color: var(--paper);
  background: linear-gradient(150deg, var(--slate) 0%, var(--navy-rise) 100%);
  border: 1px solid var(--line-strong);
  text-transform: uppercase;
  user-select: none;
}

.avatar.tier-flame { background: linear-gradient(150deg, var(--crimson) 0%, var(--crimson-deep) 100%); }
.avatar.tier-forge { background: linear-gradient(150deg, var(--gold) 0%, #6e5426 100%); }

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-btn {
  border: 0;
  background: none;
  padding: 0;
  flex: none;
  cursor: pointer;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}

.avatar-btn:hover .avatar { border-color: var(--slate-soft); }

/* A member name rendered as a button that opens their profile card. Looks
   like the surrounding text; underlines on hover. (Defined before .inbox-author
   so that view's explicit weight/size still win for the author name.) */
.name-link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.name-link:hover { text-decoration: underline; }

.profile-card-avatar .avatar {
  width: 72px;
  height: 72px;
  font-size: 30px;
}

.msg .author:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Rank badges ──────────────────────────────────────────── */

.rank-shield { align-items: center; flex: none; }

.meta .rank-shield { transform: translateY(1.5px); }

.tier-badge .rank-shield { margin-right: 2px; }

/* Credential badges (rank/tier/role/status) are clickable for a brief
   explanation — but the Free/Paid and Draft labels (.is-label) are not. */
.tier-badge.tier-spark,
.tier-badge.tier-flame,
.tier-badge.tier-forge,
.tier-badge.role-moderator,
.tier-badge.role-admin,
.tier-badge.status-banned,
.tier-badge.status-muted,
.tier-badge:has(.rank-shield) { cursor: pointer; }
.tier-badge.is-label { cursor: default; }

/* The little explanation popover anchored to a clicked badge. */
.badge-pop {
  position: fixed;
  z-index: 95;
  width: 230px;
  max-width: calc(100vw - 16px);
  background: var(--navy-rise);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px 13px 13px;
  box-shadow: var(--shadow);
  animation: badge-pop-in 0.12s ease;
}
.badge-pop-kind {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--crimson-bright);
  margin-bottom: 3px;
}
.badge-pop-title {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  color: var(--bone);
  margin-bottom: 5px;
}
.badge-pop-body { font-size: 12.5px; line-height: 1.5; color: var(--bone-dim); margin: 0; }
@keyframes badge-pop-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

.progress-track {
  margin-top: 16px;
  height: 7px;
  border-radius: 999px;
  background: var(--navy-deep);
  border: 1px solid var(--line);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.rank-ladder {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.rank-step {
  flex: 1;
  min-width: 62px;
  min-height: 62px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* center the shield + name; the note floats below */
  gap: 3px;
  padding: 9px 4px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  opacity: 0.5;
  -webkit-tap-highlight-color: transparent;
}

.rank-step:hover { opacity: 0.85; }
.rank-step-shield { display: inline-flex; }

.rank-step.current {
  opacity: 1;
  border-color: var(--line-strong);
  background: rgba(232, 226, 212, 0.04);
}

.rank-step-name {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bone-dim);
}

/* "by application" sublabel on the Council rung; Council-application notes. */
/* The Council "Application" sublabel — floated at the bottom of the box so it
   doesn't shift the centered shield/name above it. */
.rank-step-note {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 7.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold, #b08a4a);
}
.council-note { color: var(--gold, #b08a4a); }
.profile-card .pc-council-note {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--gold, #b08a4a);
  margin-top: 8px;
  text-align: center;
}

/* ── Main column ──────────────────────────────────────────── */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--navy-deep);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 2; /* keep the menu button above an embedded iframe */
}

.topbar .title {
  flex: 1;
  min-width: 0;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Refresh button — far right of the top bar, opposite the menu/title. */
.topbar .refresh-btn { flex: none; margin-left: auto; }
.topbar .refresh-btn.spinning svg { animation: spin 0.7s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

/* On desktop the sidebar is always visible, so the drawer menu button is
   unnecessary — leave just the title and the refresh control. */
@media (min-width: 881px) {
  .topbar .menu-btn { display: none; }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--bone);
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover { background: rgba(232, 226, 212, 0.06); }

.icon-btn svg { width: 20px; height: 20px; }

.view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.view-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 32px clamp(20px, 4vw, 48px) 56px;
  -webkit-overflow-scrolling: touch;
}

.view-inner { max-width: 1180px; margin: 0 auto; width: 100%; }

.view-title { margin: 6px 0 4px; font-size: clamp(22px, 3vw, 32px); }
/* "Understanding the App" is the longest page title — condense it on mobile so
   it (with its back arrow) stays on one line instead of wrapping. */
@media (max-width: 880px) {
  .guide-view .view-title { font-size: 18px; }
}

.view-sub { color: var(--bone-dim); max-width: 62ch; margin-bottom: 26px; }

/* ── Demo banner ──────────────────────────────────────────── */

.demo-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 7px 14px;
  background: rgba(176, 138, 74, 0.12);
  border-bottom: 1px solid rgba(176, 138, 74, 0.3);
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: center;
}

/* ── Chat ─────────────────────────────────────────────────── */

.chat-header-wrap {
  border-bottom: 1px solid var(--line);
  flex: none;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px clamp(16px, 3vw, 28px) 12px;
}

.chat-header-main {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.dm-header-avatar { flex: none; display: flex; }
.dm-header-avatar .avatar-btn { padding: 0; border: 0; background: none; cursor: pointer; }
.dm-header-avatar .avatar { width: 34px; height: 34px; font-size: 13px; }

.chat-header h2 {
  font-size: 17px;
  letter-spacing: 0.12em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.chat-header .topic {
  font-size: 13px;
  color: var(--bone-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* + / − toggle that reveals the room's guidelines */
.guide-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--bone-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: border-color 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.guide-toggle:hover { border-color: var(--crimson-deep); color: var(--bone); }

.guide-toggle-sign {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--crimson);
  color: var(--paper);
  font-size: 13px;
  line-height: 1;
}

.room-guide {
  padding: 4px clamp(16px, 3vw, 28px) 18px;
  max-height: 60vh;
  overflow-y: auto;
  opacity: 1;
  transition: max-height 0.28s ease, opacity 0.2s ease, padding 0.28s ease;
}

.room-guide.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.room-guide .guide-head:first-child { margin-top: 4px; }

.room-rule {
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--crimson-deep);
  border-radius: var(--radius);
  background: rgba(159, 42, 42, 0.08);
}

.room-rule .guide-head { margin: 0 0 6px; color: var(--crimson-bright); }

.room-rule p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--bone);
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px clamp(12px, 2.5vw, 24px);
  -webkit-overflow-scrolling: touch;
}

/* Avatar sits in the left gutter, OUTSIDE the message box, lined up
   with the member's name. Only the message itself is boxed. */
.msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  position: relative;
}

.msg + .msg { margin-top: 5px; }

.msg > .avatar-btn,
.msg > .avatar { flex: none; margin-top: 2px; }

.msg .avatar { width: 30px; height: 30px; font-size: 13px; }

.msg .body {
  min-width: 0;
  flex: 1;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(232, 226, 212, 0.02);
  position: relative;
}

@media (hover: hover) {
  .msg:hover .body {
    background: rgba(232, 226, 212, 0.05);
    border-color: var(--line-strong);
  }
}

.msg .meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.msg .author {
  font-weight: 600;
  font-size: 13px;
  color: var(--bone);
}

.msg .author.is-mod { color: var(--slate-soft); }
.msg .author.is-admin { color: var(--gold); }

.msg .time {
  font-size: 10.5px;
  color: var(--slate-soft);
}

.msg .text {
  font-size: 13px;
  line-height: 1.35;
  margin-top: 1px;
  color: rgba(232, 226, 212, 0.9);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.msg .text.deleted {
  color: var(--slate);
  font-style: italic;
}

/* "(edited)" mark after a message's timestamp */
.edited-tag {
  color: var(--slate);
  font-style: italic;
}

/* Inline message editor */
.msg-editor {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-area {
  width: 100%;
  resize: vertical;
  min-height: 38px;
  max-height: 160px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--crimson);
  background: var(--navy-rise);
  color: var(--bone);
  font: inherit;
  line-height: 1.4;
  outline: none;
}

.edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Inline chat photo (a thumbnail that expands to a lightbox) */
.chat-image-btn {
  display: block;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  line-height: 0;
}

.chat-image {
  max-width: min(280px, 100%);
  max-height: 240px;
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--navy-deep);
  object-fit: cover;
}

.inbox-image { margin-top: 8px; }
.inbox-image .chat-image { max-width: min(320px, 100%); max-height: 280px; }

/* Full-screen image viewer */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 14, 24, 0.92);
  backdrop-filter: blur(2px);
  cursor: zoom-out;
}

.image-lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 10px;
  box-shadow: var(--shadow);
  object-fit: contain;
}

.image-lightbox-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(14, 27, 45, 0.7);
  color: var(--bone);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.image-lightbox-close:hover { color: var(--crimson-bright); border-color: var(--crimson); }

.msg-actions {
  position: absolute;
  top: 4px;
  right: 6px;
  display: none;
  gap: 6px;
}

.msg.actions-open .msg-actions, /* revealed by clicking/tapping the message */
.msg.picker-open .msg-actions, /* stay open while the emoji picker is up */
.msg-actions:focus-within { display: flex; }

/* Hover-to-reveal only on devices with a real pointer (desktop) — never on
   touch, where a tap would otherwise trigger a sticky :hover. */
@media (hover: hover) {
  .msg:hover .msg-actions { display: flex; }
}

.msg-act.react { display: inline-flex; align-items: center; gap: 4px; }
.msg-act.react svg { width: 12px; height: 12px; }

.msg-act {
  border: 1px solid var(--line-strong);
  background: var(--navy-deep);
  color: var(--bone-dim);
  border-radius: 6px;
  font-size: 11px;
  padding: 3px 8px;
  transition: color 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.msg-act:hover { color: var(--bone); border-color: var(--slate-soft); }
.msg-act:active { transform: scale(0.94); }
.msg-act.danger:hover { color: var(--crimson-bright); border-color: var(--crimson-deep); }

/* Quoted message above a reply — one dim, single-line bubble */
.reply-quote {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: min(100%, 520px);
  margin: 2px 0 4px;
  padding: 4px 10px;
  border: 0;
  border-left: 2px solid var(--crimson-deep);
  border-radius: 6px;
  background: rgba(232, 226, 212, 0.045);
  color: var(--slate-soft);
  font-size: 12.5px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}

.reply-quote:hover { background: rgba(232, 226, 212, 0.08); color: var(--bone-dim); }

.reply-quote .q-icon { width: 12px; height: 12px; flex: none; }

.reply-quote .q-author {
  font-weight: 600;
  color: var(--bone-dim);
  flex: none;
}

.reply-quote .q-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Brief highlight when a quote jumps you to the original */
.msg.flash { animation: msg-flash 1.4s ease; }

@keyframes msg-flash {
  0%, 60% { background: rgba(159, 42, 42, 0.16); }
  100% { background: transparent; }
}

/* "Replying to…" bar above the composer */
.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 clamp(16px, 3vw, 28px);
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--navy-rise);
  font-size: 12.5px;
  color: var(--slate-soft);
}

.reply-bar-icon { width: 13px; height: 13px; flex: none; color: var(--crimson); }

.reply-bar .rb-label { font-weight: 600; color: var(--bone-dim); flex: none; }

.reply-bar .rb-snippet {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reply-bar .rb-cancel {
  flex: none;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--bone-dim);
  font-size: 16px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.reply-bar .rb-cancel:hover { color: var(--crimson-bright); background: rgba(232, 226, 212, 0.06); }

/* ── Direct Messages — iMessage-style bubbles ─────────────────
   Your messages on the right, theirs on the left. */
.dm-scroll { padding: 12px clamp(12px, 2.5vw, 26px); }

.dm-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 3px 0;
  position: relative;
}
.dm-row.mine { flex-direction: row-reverse; }
.dm-row.theirs { justify-content: flex-start; }

.dm-avatar { width: 26px; height: 26px; flex: none; padding: 0; border: 0; background: none; cursor: pointer; }
.dm-avatar .avatar { width: 26px; height: 26px; font-size: 11px; }

.dm-bubble-wrap { display: flex; flex-direction: column; max-width: min(78%, 460px); min-width: 0; position: relative; }
.dm-row.mine .dm-bubble-wrap { align-items: flex-end; }

.dm-bubble {
  max-width: 100%;
  padding: 9px 13px;
  border-radius: 17px;
  font-size: 14.5px;
  line-height: 1.4;
  background: var(--navy-rise);
  color: var(--bone);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.dm-text { white-space: pre-wrap; }
.dm-row.theirs .dm-bubble { border-bottom-left-radius: 5px; }
.dm-row.mine .dm-bubble {
  background: var(--crimson);
  color: #fff;
  border-color: transparent;
  border-bottom-right-radius: 5px;
}

/* Quoted message inside a reply bubble. */
.dm-quote {
  display: block;
  margin: -1px 0 6px;
  padding: 4px 8px;
  border-radius: 9px;
  background: rgba(232, 226, 212, 0.08);
  font-size: 12.5px;
  line-height: 1.35;
}
.dm-row.mine .dm-quote { background: rgba(255, 255, 255, 0.16); }
.dm-quote-name { display: block; font-weight: 700; opacity: 0.95; }
.dm-quote-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0.8;
  overflow-wrap: anywhere;
}

/* Reaction pills under a bubble (tapbacks). */
.dm-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.dm-reactions .reaction-pill { font-size: 12px; padding: 1px 7px; }

/* React + Reply controls, revealed on hover / tap, on the inner side. */
.dm-acts {
  display: none;
  gap: 5px;
  align-self: center;
  flex: none;
}
.dm-row.acts-open .dm-acts,
.dm-row.picker-open .dm-acts { display: flex; }
@media (hover: hover) {
  .dm-row:hover .dm-acts { display: flex; }
}
.dm-act {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--navy-deep);
  color: var(--slate-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dm-act:hover { color: var(--bone); border-color: var(--slate-soft); }
.dm-act svg { width: 14px; height: 14px; }

/* The emoji picker, anchored above the bubble. */
.dm-picker { bottom: calc(100% + 7px); }
.dm-picker.left { left: 0; right: auto; }
.dm-picker.right { right: 0; left: auto; }

/* ── Reactions ────────────────────────────────────────────── */

.reaction-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  position: relative;
}

.commend-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 7px;
  border: 1px solid rgba(176, 138, 74, 0.55);
  background: rgba(176, 138, 74, 0.12);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: default;
}

.msg-act.commend {
  border-color: rgba(176, 138, 74, 0.55);
  color: var(--gold);
}

.msg-act.commend:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(176, 138, 74, 0.1);
}

.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--navy-deep);
  color: var(--bone-dim);
  font-size: 12.5px;
  line-height: 1.3;
  transition: border-color 0.15s ease, background 0.15s ease,
    transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.reaction-pill .count {
  font-size: 11px;
  font-weight: 600;
}

.reaction-pill:hover {
  border-color: var(--slate-soft);
  transform: translateY(-1px);
}

.reaction-pill:active { transform: scale(0.92); transition-duration: 0.08s; }

.reaction-pill.mine {
  border-color: var(--crimson);
  background: rgba(159, 42, 42, 0.16);
  color: var(--bone);
}

.reaction-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 23px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--navy-deep);
  color: var(--slate-soft);
  opacity: 0;
  transition: opacity 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.reaction-add svg { width: 13px; height: 13px; }

.msg:hover .reaction-add,
.reaction-add:focus-visible {
  opacity: 1;
}

.reaction-add:hover {
  border-color: var(--crimson);
  color: var(--crimson-bright);
}

.reaction-add:active { transform: scale(0.88); }

.reaction-picker {
  position: absolute;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  max-width: 190px;
  gap: 2px;
  padding: 7px 9px;
  background: var(--navy-deep);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 6;
  animation: picker-in 0.16s ease;
}

.reaction-picker.down { top: calc(100% + 6px); }
.reaction-picker.up { bottom: calc(100% + 6px); }

@keyframes picker-in {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.92);
  }
}

.reaction-picker button {
  background: none;
  border: 0;
  font-size: 19px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 8px;
  transition: transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.reaction-picker button:hover { transform: scale(1.25); }
.reaction-picker button:active { transform: scale(0.85); }

@media (max-width: 880px) {
  .reaction-add { opacity: 0.55; } /* no hover on touch — keep it visible */
}

.day-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 10px;
  color: var(--slate-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.day-divider::before,
.day-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.composer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end; /* photo / text box / send sit on one clean baseline */
  gap: 8px;
  padding: 12px clamp(16px, 3vw, 28px);
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--navy);
  position: relative;
}

/* Add-a-photo button in the composer */
.composer-attach {
  align-self: flex-end;
  flex: none;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--navy-rise);
  color: var(--bone-dim);
  cursor: pointer;
}

.composer-attach:hover { color: var(--bone); border-color: var(--crimson); }
.composer-attach svg { width: 20px; height: 20px; }

/* Pending-photo preview chip (sits on its own line above the input) */
.composer-image {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--navy-rise);
}

.composer-image img {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  object-fit: cover;
  flex: none;
}

.composer-image-label {
  font-size: 13px;
  color: var(--bone-dim);
  flex: 1;
  min-width: 0;
}

.composer-image-x {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--bone-dim);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.composer-image-x:hover { color: var(--crimson-bright); border-color: var(--crimson); }

/* @mention highlight inside messages */
.mention {
  color: var(--crimson-bright);
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  padding: 0 2px;
}

.mention:hover { text-decoration: underline; }

.mention.me {
  color: var(--gold);
  background: rgba(176, 138, 74, 0.14);
}

/* @mention autocomplete above the composer */
.mention-box {
  position: absolute;
  left: clamp(16px, 3vw, 28px);
  right: clamp(16px, 3vw, 28px);
  bottom: calc(100% - 6px);
  max-height: 246px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--navy-deep);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 8;
  padding: 6px;
}

.mention-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--bone);
  text-align: left;
  width: 100%;
}

.mention-opt .avatar { width: 28px; height: 28px; font-size: 12px; }
.mention-opt-name { font-size: 14px; font-weight: 600; }
.mention-opt.active,
.mention-opt:hover { background: rgba(159, 42, 42, 0.16); }

/* Red unread-mention notification badge */
.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--crimson);
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* On the bottom-nav tab and the menu button, float it over the icon */
.bottom-nav button,
.topbar .menu-btn { position: relative; }

.bottom-nav button .nav-badge,
.topbar .menu-btn .nav-badge {
  position: absolute;
  top: 4px;
  left: 50%;
  margin-left: 6px;
  min-width: 16px;
  height: 16px;
  font-size: 10px;
}

.topbar .menu-btn .nav-badge {
  top: 4px;
  left: auto;
  right: 4px;
  margin-left: 0;
}

.composer textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  box-sizing: border-box;
  min-height: 44px; /* same height as the photo/send buttons → clean row */
  max-height: 132px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--navy-rise);
  color: var(--bone);
  outline: none;
  /* Match the chat message text size (.msg .text) so the input and the
     "Speak into…" placeholder read at the same scale and don't clip.
     (On mobile both jump to 16px — see the iOS no-zoom rule below.) */
  font-size: 13px;
  line-height: 1.4;
}

.composer textarea:focus { border-color: var(--crimson); }

.composer textarea::placeholder {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer .send {
  align-self: flex-end;
  height: 44px;
  padding: 0 20px;
}

.composer-note {
  padding: 0 clamp(16px, 3vw, 28px) 10px;
  font-size: 12px;
  color: var(--slate-soft);
}

/* ── Locked / empty states ────────────────────────────────── */

.locked-state, .empty-state {
  margin: auto;
  max-width: 440px;
  text-align: center;
  padding: 48px 24px;
}

.locked-state .flame-mark, .empty-state .flame-mark {
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  color: var(--crimson);
  opacity: 0.85;
}

.locked-state h3, .empty-state h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.locked-state p, .empty-state p {
  color: var(--bone-dim);
  font-size: 14.5px;
  margin-bottom: 22px;
}

/* ── The Fires page (channel list) ────────────────────────── */

.fire-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 5px 14px;
  margin-top: 8px;
  text-decoration: none;
  color: inherit;
  background: var(--navy-rise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.16s ease, background 0.16s ease,
    transform 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}

/* The private Council room — a gold accent marks the seat at the top. */
.fire-row-council { border-color: rgba(176, 138, 74, 0.55); }
.fire-row-council .fire-row-icon { color: var(--gold, #b08a4a); }
.fire-row-council .fire-row-name { color: var(--gold, #b08a4a); }

/* An unlocked exclusive chat, nested beneath its parent Fire. */
.fire-row-sub {
  margin-top: 3px;
  margin-left: 26px;
  width: calc(100% - 26px);
  background: transparent;
  border-style: dashed;
}
.fire-row-sub .fire-row-icon { width: 18px; height: 18px; }
.fire-row-sub .fire-row-name { font-size: 13.5px; }

.fire-row-icon {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--crimson);
  transition: transform 0.18s ease, color 0.18s ease;
}

.fire-row-text { min-width: 0; flex: 1; }

.fire-row-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--bone);
}

.fire-row-topic {
  font-size: 12px;
  color: var(--bone-dim);
  line-height: 1.3;
}

.fire-row-lock {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--slate);
}

/* "Earn your way in" unlock note under the Fires list. */
.fires-unlock-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--navy-rise);
}
.fires-unlock-note .fires-unlock-icon { width: 20px; height: 20px; flex: none; color: var(--gold); margin-top: 1px; }
.fires-unlock-note p { font-size: 13.5px; line-height: 1.55; color: var(--bone-dim); margin: 0; }
.fires-unlock-note strong { color: var(--bone); }
.fires-unlock-note a { color: var(--crimson-bright); text-decoration: none; }
.fires-unlock-note a:hover { text-decoration: underline; }

.fire-row:hover {
  border-color: var(--crimson-deep);
  background: rgba(159, 42, 42, 0.07);
  transform: translateY(-1px);
}

.fire-row:hover .fire-row-icon {
  transform: scale(1.18);
  color: var(--crimson-bright);
}

.fire-row:active {
  transform: scale(0.985);
  transition-duration: 0.08s;
}

.fire-row:active .fire-row-icon {
  transform: scale(0.92);
  transition-duration: 0.08s;
}

/* ── Cards / grids (courses, podcast, pricing) ────────────── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}

/* Desktop: a fixed 3-up grid so cards line up evenly and each new card
   fills the next open slot. (Mobile keeps the responsive auto-fill above.) */
@media (min-width: 881px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
}

.content-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: left;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.content-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

/* Completed courses get a green outline so they stand apart from the rest. */
.content-card.completed { border-color: #4f9e6b; }
.content-card.completed:hover { border-color: #5cb37c; }
.content-card.completed .progress-line { color: #5cb37c; font-weight: 600; }

.content-card .thumb {
  aspect-ratio: 16 / 6;
  background: linear-gradient(160deg, var(--navy-rise), var(--navy-deep));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--crimson);
  border-bottom: 1px solid var(--line);
}

.content-card .thumb svg { width: 30px; height: 30px; opacity: 0.9; }

.content-card .pad { padding: 13px 16px 15px; }

.content-card h3 {
  font-size: 15px;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
}

.content-card p {
  font-size: 13px;
  line-height: 1.45;
  color: var(--bone-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.content-card .progress-line {
  margin-top: 10px;
  font-size: 12px;
  color: var(--slate-soft);
}

.video-embed {
  aspect-ratio: 16 / 9;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--navy-deep);
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ── Lessons ──────────────────────────────────────────────── */

.lesson-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  margin-top: 10px;
  text-align: left;
  color: inherit;
  background: var(--navy-rise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
}

.lesson-row:hover { border-color: var(--line-strong); }

.lesson-row .num {
  font-family: var(--display);
  font-weight: 700;
  color: var(--slate-soft);
  font-size: 13px;
  width: 26px;
  flex: none;
}

.lesson-row .lesson-title { flex: 1; font-size: 15px; font-weight: 500; min-width: 0; }

.lesson-row .check {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--slate);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
}

.lesson-row .check.done {
  border-color: var(--crimson);
  background: var(--crimson);
  color: var(--paper);
}

.lesson-row .check svg { width: 12px; height: 12px; }

.lesson-body {
  margin-top: 22px;
  font-size: 15.5px;
  line-height: 1.75;
  color: rgba(232, 226, 212, 0.88);
  max-width: 70ch;
  white-space: pre-wrap;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  border: 0;
  background: none;
  color: var(--slate-soft);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Pin the back arrow so the link never changes size between pages. */
.back-link svg { width: 13px; height: 13px; flex: none; }

.back-link:hover { color: var(--bone); }

/* Lesson navigation: Complete centered on its own line, then Prev/Next
   pinned to the edges on the line below — no overlap, nothing shifts. */
.lesson-nav { margin-top: 30px; }
.lesson-nav-complete-row { display: flex; justify-content: center; }
.lesson-nav-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}
.lesson-nav .btn { white-space: nowrap; }

/* Course-complete confirmation on the final lesson */
.course-complete {
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
  padding: 24px;
  border: 1px solid rgba(176, 138, 74, 0.6);
  border-radius: var(--radius);
  background: rgba(176, 138, 74, 0.08);
  text-align: center;
}
.course-complete-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}
.course-complete-msg svg { width: 20px; height: 20px; }

/* ── Fire Finder (embedded assessment) ────────────────────── */

.firefinder-card { border-color: var(--crimson-deep); }
.firefinder-card .thumb {
  background: radial-gradient(120% 120% at 50% 120%, rgba(159, 42, 42, 0.3), var(--navy-deep));
}

.firefinder-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  padding: 12px clamp(14px, 3vw, 26px);
  border-bottom: 1px solid var(--line);
}

.firefinder-title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The completion claim button / done badge sits at the far right of the bar.
   The slot stays in the layout (empty) until the quiz signals its final page. */
.firefinder-bar .firefinder-action {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
}
.firefinder-done {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5cb37c;
}
.firefinder-done svg { width: 15px; height: 15px; }

.firefinder-frame {
  flex: 1;
  min-height: 0;
  position: relative; /* anchor the absolutely-positioned iframe */
  background: var(--navy-deep);
}

/* Absolute-fill (not height:100%) so iOS Safari can't auto-expand the
   iframe to its content height and shove the bottom nav off-screen. */
.firefinder-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ── Inbox ────────────────────────────────────────────────── */

.inbox-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-top: 10px;
  position: relative;
}

.inbox-item.unread {
  border-color: var(--crimson-deep);
  background: rgba(159, 42, 42, 0.06);
}

.inbox-item.unread::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -1px;
  bottom: -1px;
  width: 3px;
  border-radius: 9px 0 0 9px;
  background: var(--crimson);
}

.inbox-item > .avatar-btn { margin-top: 2px; }

.inbox-body { flex: 1; min-width: 0; }

.inbox-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}

.inbox-author { font-weight: 600; font-size: 14px; }
.inbox-context { font-size: 12.5px; color: var(--slate-soft); }
.inbox-head .time { font-size: 11px; color: var(--slate-soft); margin-left: auto; }

.inbox-text {
  font-size: 14px;
  line-height: 1.45;
  color: rgba(232, 226, 212, 0.9);
  margin-top: 4px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.inbox-reactbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.inbox-reactbar:empty { display: none; }

/* Group headings: DMs on top, mentions below. */
.inbox-group + .inbox-group { margin-top: 24px; }
.inbox-group-head {
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--crimson);
  margin: 6px 0 2px;
}

.inbox-item { cursor: pointer; }

/* ── Inbox header row + Notifications button ─────────────────── */
.inbox-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.inbox-notif-btn { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.inbox-notif-btn svg { width: 16px; height: 16px; }
@media (max-width: 480px) {
  .inbox-notif-label { display: none; }
}

/* ── Pill on/off switch ──────────────────────────────────────── */
.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(232, 226, 212, 0.06);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--slate-soft);
  transition: transform 0.16s ease, background 0.16s ease;
}
.switch.on { background: var(--crimson); border-color: transparent; }
.switch.on .switch-knob { transform: translateX(18px); background: #fff; }
.switch.is-disabled { opacity: 0.4; cursor: default; }

/* ── Notification settings sheet ─────────────────────────────── */
.notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
}
.notif-row.is-disabled .notif-row-text { opacity: 0.5; }
.notif-row-label { font-size: 14px; font-weight: 600; }
.notif-row-sub { font-size: 12px; color: var(--slate-soft); margin-top: 1px; }
.notif-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.notif-group-head {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 2px;
}
.notif-note {
  font-size: 11.5px;
  color: var(--slate-soft);
  line-height: 1.45;
  margin-top: 14px;
}

/* Pull-to-refresh (mobile swipe at the top of the Inbox). The list content
   drags down with the finger; this indicator fades into the gap above it. */
.inbox-scroll { position: relative; }
.pull-refresh {
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  opacity: 0;
  color: var(--bone-dim);
  font-size: 13px;
  letter-spacing: 0.02em;
  pointer-events: none;
}
.pull-refresh .pr-icon { width: 18px; height: 18px; transition: transform 0.2s ease; }
.pull-refresh.ready .pr-icon { transform: rotate(180deg); }
.pull-refresh.refreshing .pr-icon { animation: spin 0.7s linear infinite; }

/* Corner "×" to clear an item from the Inbox. Hidden until the item is tapped
   (mobile) or hovered (desktop); it takes the timestamp's spot so they never
   overlap. */
.inbox-dismiss {
  position: absolute;
  top: 9px;
  right: 11px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--navy-deep);
  color: var(--bone-dim);
  border-radius: 6px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
}
.inbox-dismiss:hover { color: var(--crimson-bright); border-color: var(--crimson-deep); }
.inbox-dismiss:active { transform: scale(0.92); }
.inbox-item.acts-open .inbox-dismiss { display: inline-flex; }
.inbox-item.acts-open .inbox-head .time { visibility: hidden; }
@media (hover: hover) {
  .inbox-item:hover .inbox-dismiss { display: inline-flex; }
  .inbox-item:hover .inbox-head .time { visibility: hidden; }
}

/* Actions stay hidden until the item is tapped (mobile) or hovered (desktop),
   and stay on a single line — shrink the buttons rather than wrap. */
.inbox-actions {
  display: none;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.inbox-item.acts-open .inbox-actions { display: flex; }
@media (hover: hover) {
  .inbox-item:hover .inbox-actions { display: flex; }
}
.inbox-actions .btn {
  flex: 0 1 auto;
  min-width: 0;
  padding: 4px 8px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.inbox-actions .commend { border-color: rgba(176, 138, 74, 0.55); color: var(--gold); }

.inbox-reply {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.inbox-reply .field { resize: none; }

/* ── Daily checklist ──────────────────────────────────────── */

.accountability-note {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-left: 3px solid var(--crimson);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(159, 42, 42, 0.06);
}

.accountability-note p {
  font-family: var(--decorative);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--bone);
  max-width: 60ch;
}

.why-wrap { margin-bottom: 16px; }

.why-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--bone-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: border-color 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.why-toggle:hover { border-color: var(--crimson-deep); color: var(--bone); }

.why-sign {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--crimson);
  color: var(--paper);
  font-size: 13px;
  line-height: 1;
}

.why-body {
  max-height: 1200px;
  overflow: hidden;
  margin-top: 12px;
  transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.3s ease;
}

.why-body.collapsed {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
}

.why-point {
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.why-point-title {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--crimson-bright);
  margin-bottom: 4px;
}

.why-point-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--bone-dim);
}

.checklist-status {
  padding: 11px 14px;
  margin-bottom: 8px;
  font-size: 14px;
}

.checklist-status .cl-done {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font-weight: 600;
}

.checklist-status .cl-done svg { width: 18px; height: 18px; }

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-top: 6px;
  background: var(--navy-rise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.task-row .check {
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--slate);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.1s ease;
}

.task-row .check svg { width: 11px; height: 11px; }

.task-row .check:hover { border-color: var(--crimson); }
.task-row .check:active { transform: scale(0.9); }

.task-row .check.done {
  border-color: var(--crimson);
  background: var(--crimson);
  color: var(--paper);
}

.task-row .task-text {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.task-row.done .task-text {
  color: var(--slate-soft);
  text-decoration: line-through;
}

.task-act {
  flex: none;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--slate-soft);
  opacity: 0.65;
  transition: opacity 0.14s ease, color 0.14s ease, background 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}

.task-act svg { width: 15px; height: 15px; }
.task-act:hover { opacity: 1; background: rgba(232, 226, 212, 0.05); color: var(--bone); }
.task-act.danger:hover { color: var(--crimson-bright); }

.task-add {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.task-add .field { flex: 1; }
.task-add .btn { flex: none; align-self: stretch; }

/* ── Pricing ──────────────────────────────────────────────── */

.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.tier-card {
  display: flex;
  flex-direction: column;
  padding: 28px 26px;
  position: relative;
}

.tier-card.featured { border-color: var(--crimson-deep); }

.tier-card .flag {
  position: absolute;
  top: -11px;
  left: 24px;
  background: var(--crimson);
  color: var(--paper);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
}

.tier-card h3 {
  font-size: 19px;
  letter-spacing: 0.14em;
}

.tier-card .price {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  margin: 14px 0 4px;
  color: var(--bone);
}

.tier-card .price small {
  font-size: 13px;
  font-family: var(--sans);
  font-weight: 500;
  color: var(--slate-soft);
}

.tier-card ul {
  list-style: none;
  margin: 18px 0 26px;
  flex: 1;
}

.tier-card li {
  display: flex;
  gap: 10px;
  font-size: 14px;
  color: var(--bone-dim);
  padding: 6px 0;
}

.tier-card li::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--crimson);
  margin-top: 8px;
}

.tier-card li.off { opacity: 0.4; }
.tier-card li.off::before { background: var(--slate); }

/* ── Admin ────────────────────────────────────────────────── */

.tab-row {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab-row button {
  padding: 10px 16px;
  border: 0;
  background: none;
  color: var(--bone-dim);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab-row button.active {
  color: var(--bone);
  border-bottom-color: var(--crimson);
}

/* AI Moderator flag queue */
.flag-card { padding: 14px 16px; margin-top: 12px; }
.flag-card.is-hidden { border-color: var(--crimson-deep); }
.flag-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--bone-dim); }
.flag-sev { text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 6px; }
.flag-sev.sev-egregious { background: rgba(194, 58, 58, 0.26); color: #f0a3a3; }
.flag-sev.sev-serious { background: rgba(217, 180, 67, 0.20); color: #e8c766; }
.flag-sev.sev-minor { background: rgba(74, 142, 194, 0.20); color: #8fc4ef; }
.flag-rule { font-weight: 600; color: var(--bone); }
.flag-author { display: flex; align-items: center; gap: 8px; margin: 10px 0 8px; font-size: 13px; font-weight: 600; color: var(--bone); }
.flag-author .avatar { width: 24px; height: 24px; font-size: 11px; }
.flag-author .avatar-btn { padding: 0; border: 0; background: none; cursor: pointer; display: inline-flex; }
.flag-author-name { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.flag-author-name:hover { text-decoration: underline; }
.flag-content {
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--line-strong);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  line-height: 1.4;
  color: rgba(232, 226, 212, 0.92);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.flag-reason { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--bone-dim); }
.flag-reason-icon { width: 16px; height: 16px; flex: none; color: var(--crimson); margin-top: 1px; }
.flag-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.flag-status { margin-top: 10px; font-size: 12px; color: var(--slate-soft); text-transform: uppercase; letter-spacing: 0.08em; }
/* "View in chat" jump on a flag card. */
.flag-jump { margin-top: 12px; }
.flag-jump-icon { width: 15px; height: 15px; transform: rotate(180deg); margin-right: 2px; }

/* ── Back control beside a page / chat title (not the top bar) ── */
.title-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--bone);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.title-back:hover { background: rgba(232, 226, 212, 0.06); }
.title-back svg { width: 21px; height: 21px; }
.chat-header .title-back { margin: 0 -4px 0 -6px; }
/* Inline variant: sits to the left of a large .view-title heading. */
.title-back-inline {
  width: 30px;
  height: 30px;
  vertical-align: middle;
  margin: 0 6px 0 -5px;
}
.title-back-inline svg { width: 22px; height: 22px; }

/* ── Hidden (auto-moderated) message in a room — staff-only view ─ */
.msg.hidden-msg { opacity: 0.78; }
.msg.hidden-msg .body { border-left: 2px solid var(--crimson-deep); padding-left: 10px; }
.hidden-tag {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--crimson-bright);
  border: 1px solid var(--crimson-deep);
  border-radius: 5px;
  padding: 1px 5px;
}

/* ── Inbox: a Moderator notice item ──────────────────────────── */
.notice-item .notice-icon {
  width: 30px;
  height: 30px;
  flex: none;
  color: var(--crimson);
  padding: 3px;
}
.notice-item .inbox-author { color: var(--crimson-bright); }

/* ── App Specialist (Help) per-message timestamp ─────────────── */
.dm-time {
  font-size: 10.5px;
  color: var(--slate-soft);
  margin-top: 3px;
  padding: 0 4px;
}

/* ── Strike chip on a flag card + in a notice ────────────────── */
.flag-strike {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bone-dim);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
}
.flag-consequence {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--crimson-bright);
}

/* ── Excused (banned) screen — an otherwise empty page ───────── */
.excused-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  gap: 22px;
}
.excused-message {
  max-width: 30ch;
  font-family: var(--display);
  font-size: clamp(18px, 2.6vw, 24px);
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--bone-dim);
}
.excused-signout {
  border: 0;
  background: transparent;
  color: var(--slate-soft);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.admin-row .who { flex: 1; min-width: 140px; }

.admin-row .who .name { font-weight: 600; font-size: 14.5px; }

.admin-row .who .sub { font-size: 12px; color: var(--slate-soft); }

.admin-row .controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.select {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--navy-deep);
  color: var(--bone);
  font-size: 13px;
}

/* ── Modal ────────────────────────────────────────────────── */

.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(4, 9, 17, 0.72);
  backdrop-filter: blur(3px);
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: min(86dvh, 720px);
  overflow-y: auto;
  padding: 26px 26px 28px;
  box-shadow: var(--shadow);
}

.modal h3 { font-size: 17px; margin-bottom: 4px; }

.modal-actions {
  display: flex;
  flex-wrap: wrap; /* wrap rather than pushing buttons off-screen */
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

/* Keep the action buttons compact so a full row (e.g. DM · Mute · Ban
   · Close) fits on a narrow phone without clipping. */
.modal-actions .btn { padding: 8px 13px; }

/* ── Profile card: centered name/avatar/roles, full-width body ── */
.profile-modal h3 { text-align: center; margin-bottom: 0; }

/* Fire User earned — the one-time consistency pop-up. */
.fire-user-modal h3 { text-align: center; }
.fire-user-pop { text-align: center; }
.fire-user-pop-mark {
  font-size: 44px;
  line-height: 1;
  margin: 4px 0 12px;
}
.fire-user-pop p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--bone-dim);
}

.profile-card { text-align: center; }

.profile-card .pc-avatar {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}

.profile-card .pc-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.profile-card .pc-bio {
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  margin-bottom: 14px;
}

.profile-card .pc-power { font-size: 12px; color: var(--bone-dim); font-weight: 700; }
.profile-card .pc-bar { margin-top: 10px; }
.profile-card .mod-hint { text-align: center; }

/* Action buttons fill the card width in a single, non-wrapping row. */
.profile-modal .modal-actions { flex-wrap: nowrap; gap: 8px; }
.profile-modal .modal-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 6px;
  white-space: nowrap;
}

/* ── Understanding the App / FAQ ───────────────────────────── */
/* Keep the reading content at a comfortable, centered column (as it was),
   but let the ranks ladder span the full width of the page. */
.guide-view > :not(.guide-section),
.guide-view .guide-section > * {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.guide-view .guide-ladder {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.guide-section { margin-top: 28px; }

.guide-h2 {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--bone);
  margin-bottom: 10px;
}

.guide-p { font-size: 14.5px; line-height: 1.6; color: rgba(232, 226, 212, 0.88); margin-bottom: 12px; }
.guide-subhead {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--crimson-bright);
  margin: 18px 0 8px;
}
.guide-note { font-size: 13px; line-height: 1.6; color: var(--bone-dim); margin-top: 10px; }

.guide-list {
  list-style: none;
  padding: 0;
  margin: 0 0 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-list li {
  position: relative;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(232, 226, 212, 0.88);
}

.guide-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--crimson);
}

.guide-list li strong { color: var(--bone); font-weight: 700; }

/* Tier cards */
.guide-tier { padding: 16px 18px; margin-bottom: 12px; }
.guide-tier-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.guide-tier-name { font-family: var(--display); font-size: 17px; letter-spacing: 0.04em; color: var(--bone); }
.guide-tier-tag { font-size: 13px; color: var(--bone-dim); margin: 4px 0 12px; }

/* Rank ladder */
.guide-ladder {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.guide-rank {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--navy-rise);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.guide-rank:hover { border-color: var(--slate-soft); }

/* FAQ accordion (native details/summary) */
.faq-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--navy-rise);
  margin-bottom: 8px;
  overflow: hidden;
}

.faq-q {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--bone);
}

.faq-q::-webkit-details-marker { display: none; }

.faq-sign {
  flex: none;
  font-size: 18px;
  line-height: 1;
  color: var(--crimson-bright);
  transition: transform 0.2s ease;
}

.faq-item[open] .faq-sign { transform: rotate(45deg); }

.faq-a {
  padding: 0 15px 14px;
  font-size: 14px;
  line-height: 1.62;
  color: rgba(232, 226, 212, 0.85);
}

.faq-a p { margin: 0; }

.guide-footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--bone-dim);
  text-align: center;
}

/* ── Members roster (leadership) ──────────────────────────── */
.roster-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.roster-ticker {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--navy-rise);
  border: 1px solid var(--line-strong);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bone-dim);
}

.roster-ticker-num {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--crimson-bright);
}

.roster-group { margin-top: 22px; }

.roster-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bone-dim);
  margin-bottom: 8px;
}

.roster-count {
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--navy-rise);
  border: 1px solid var(--line-strong);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0;
}

/* Horizontal scroll on narrow screens keeps the columns intact */
.roster-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--navy-rise);
}

.roster-grid {
  display: grid;
  /* Member column hugs the longest name; the rest share the space. */
  grid-template-columns: max-content minmax(170px, 1.5fr) 120px minmax(190px, 1.6fr);
  min-width: 600px;
}

.rc {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 13px;
}

.roster-grid > .rc:nth-last-child(-n + 4) { border-bottom: 0; } /* last row */

.rc-head {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate-soft);
  border-bottom: 1px solid var(--line-strong);
}

.rc-member { gap: 9px; }

.status-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--slate);
}
.status-dot.online {
  background: #46c46a;
  box-shadow: 0 0 0 2px rgba(70, 196, 106, 0.18);
}

.roster-name {
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px; /* cap so an unusually long name can't widen the column */
}
.roster-name:hover { text-decoration: underline; text-underline-offset: 3px; }

.rc-cred { flex-wrap: wrap; gap: 5px; }
.rc-cred .tier-badge { padding: 2px 7px; font-size: 9px; letter-spacing: 0.1em; gap: 4px; }

/* Global "Online" panel for admins — floats over the right edge (just left
   of the quick-access rail), vertically centered, collapsible. Desktop only;
   shown on every page except Members. */
.online-panel {
  flex: 0 1 auto;
  min-height: 0; /* allow the inner list to scroll when the stack is tall */
  width: 206px;
  display: flex;
  flex-direction: column;
  background: var(--navy-rise);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 12px 14px;
  box-shadow: var(--shadow);
}
.online-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex: none;
}
.online-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.online-count { color: var(--bone); }
.online-toggle {
  display: flex;
  flex: none;
  padding: 3px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--slate-soft);
  cursor: pointer;
}
.online-toggle:hover { color: var(--bone); background: var(--navy-deep); }
.online-toggle svg { width: 16px; height: 16px; transform: rotate(180deg); } /* points right = collapse */

.online-list { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; min-height: 0; }
.online-row { display: flex; align-items: center; gap: 8px; padding: 4px 5px; border-radius: 8px; }
.online-row:hover { background: var(--navy-deep); }
.online-name {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.online-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.online-empty { font-size: 12px; color: var(--slate-soft); margin: 2px 0 0; }

/* Collapsed: a slim bar showing just the count + a chevron to reopen. */
.online-panel.collapsed { width: 48px; padding: 10px 6px; max-height: none; }
.online-panel.collapsed .online-head { flex-direction: column; gap: 8px; margin-bottom: 0; }
.online-panel.collapsed .online-title { flex-direction: column; gap: 4px; font-size: 13px; }
.online-panel.collapsed .online-word { display: none; }
.online-panel.collapsed .online-list { display: none; }
.online-panel.collapsed .online-toggle svg { transform: rotate(0deg); } /* points left = expand */

@media (max-width: 880px) {
  .online-panel { display: none; } /* desktop-only; mobile has no rail/panel */
}

.rc-power { flex-direction: column; align-items: flex-start; gap: 5px; }
.rc-power-amt { font-weight: 600; font-size: 13px; color: var(--bone); }
.rc-bar { width: 100%; height: 5px; margin: 0; }

.rc-email {
  font-size: 12.5px;
  color: var(--bone-dim);
  word-break: break-all;
}

/* ── The Code (community guidelines) ──────────────────────── */

.guidelines-modal { max-width: 540px; }

.guidelines-title {
  text-align: center;
  font-size: clamp(26px, 5vw, 34px);
  letter-spacing: 0.08em;
  margin: 6px 0 0;
}

.guidelines-intro {
  text-align: center;
  color: var(--bone-dim);
  font-size: 14px;
  line-height: 1.6;
  max-width: 42ch;
  margin: 12px auto 22px;
}

.guide-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--slate-soft);
  margin: 20px 0 10px;
}

.guide-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.guide-list li {
  position: relative;
  padding: 5px 0 5px 28px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--bone);
}

.guide-list li::before {
  position: absolute;
  left: 2px;
  top: 5px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.guide-yes li::before {
  content: "✓";
  color: var(--paper);
  background: var(--crimson);
}

.guide-no li {
  color: var(--bone-dim);
}

.guide-no li::before {
  content: "✕";
  color: var(--crimson-bright);
  background: rgba(159, 42, 42, 0.16);
  border: 1px solid var(--crimson-deep);
}

.guidelines-foot {
  margin: 24px 0 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--bone-dim);
}

/* Keep the accept/close button in view while the long Code scrolls. */
.guidelines-modal > .btn:last-child {
  position: sticky;
  bottom: 0;
  margin-top: 4px;
  box-shadow: 0 -14px 18px -8px var(--navy-rise), 0 0 0 10px var(--navy-rise);
}

/* ── Toast ────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  /* Drop in from the top so it never covers the bottom nav rail. */
  top: calc(64px + env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 80;
  background: var(--navy-deep);
  border: 1px solid var(--line-strong);
  color: var(--bone);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: var(--shadow);
  max-width: min(92vw, 480px);
  text-align: center;
  animation: toast-in 0.22s ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast.error { border-color: var(--crimson); }

/* ── Auth screens ─────────────────────────────────────────── */

.auth-wrap {
  margin: auto;
  width: 100%;
  max-width: 420px;
  padding: 40px 22px;
  position: relative;
}

/* Forge glow rising behind the sign-in card */
.auth-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    90% 55% at 50% 100%,
    rgba(159, 42, 42, 0.18) 0%,
    rgba(14, 27, 45, 0) 65%
  );
}

.auth-card {
  padding: 34px 30px 36px;
  position: relative;
  z-index: 2;
}

.auth-card .brand-mark {
  width: 56px;
  margin: 0 auto 16px;
}

.auth-card h1 {
  font-size: 20px;
  text-align: center;
  letter-spacing: 0.18em;
}

.auth-card .lead {
  text-align: center;
  color: var(--bone-dim);
  font-size: 14px;
  margin-top: 8px;
}

.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 13.5px;
  color: var(--bone-dim);
}

.auth-switch a { color: var(--crimson-bright); font-weight: 600; }

.persona-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  margin-top: 10px;
  text-align: left;
  background: var(--navy-deep);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--bone);
  transition: border-color 0.15s ease;
}

.persona-btn:hover { border-color: var(--crimson); }

.persona-btn .desc { font-size: 12px; color: var(--slate-soft); }

/* ── Mobile bottom nav + drawer ───────────────────────────── */

.bottom-nav {
  display: none;
  position: relative;
  z-index: 2; /* always tappable above an embedded iframe */
  background: var(--navy-deep);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px 8px;
  border: 0;
  background: none;
  color: var(--slate-soft);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav button.active { color: var(--crimson-bright); }

.bottom-nav svg { width: 21px; height: 21px; }

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(4, 9, 17, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* Right-side dock — holds the quick-access rail and (for admins, off the
   Members page) the Online panel stacked above it, as a pair. Fixed to the
   right edge and vertically centered. Hidden on mobile (bottom-nav takes over). */
.right-dock {
  position: fixed;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  max-height: calc(100vh - 24px);
}

/* Desktop quick-access rail — a compact capsule at the bottom of the dock. */
.desk-rail {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 2px;
  padding: 7px 6px;
  background: var(--navy-deep);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.desk-rail button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 56px;
  padding: 8px 4px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--slate-soft);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.desk-rail button:hover { color: var(--bone); background: var(--navy-rise); }
.desk-rail button.active { color: var(--crimson-bright); background: var(--navy-rise); }
.desk-rail svg { width: 20px; height: 20px; }

/* On desktop, inset views' right edge just enough that their content clears
   the floating quick-access rail (chat, DMs, Inbox, the Fires list, Admin). */
@media (min-width: 881px) {
  .chat-view,
  .rail-inset { padding-right: 90px; }
}

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(82vw, 320px);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: none;
    padding-top: env(safe-area-inset-top);
  }

  body.drawer-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }

  body.drawer-open .drawer-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar { display: flex; }
  .right-dock { display: none; } /* desktop-only; mobile uses the bottom-nav */

  /* Floating capsule that hovers above the app window, mirroring the desktop
     quick-access rail: detached from the edges, rounded, bordered, shadowed.
     Kept in the flex flow so the chat composer and scroll content stay above
     it without needing fixed-position clearance. */
  .bottom-nav {
    display: flex;
    margin: 2px 12px calc(8px + env(safe-area-inset-bottom));
    padding: 6px;
    background: var(--navy-deep);
    border: 1px solid var(--line-strong);
    border-radius: 22px;
    box-shadow: var(--shadow);
  }

  .bottom-nav button {
    border-radius: 15px;
    padding: 8px 4px;
    transition: color 0.15s ease, background 0.15s ease;
  }

  .bottom-nav button.active { background: var(--navy-rise); }

  .view-scroll { padding: 22px 18px 40px; }

  .chat-header { padding: 12px 16px 10px; }
  .chat-header .topic { display: none; }
  /* Tighter title on the phone so longer room names (e.g. exclusive chats)
     fit beside "The Code" without truncating; ellipsis stays as a fallback. */
  .chat-header h2 { font-size: 14.5px; letter-spacing: 0.06em; }

  /* No hover on touch — keep the actions hidden for density and reveal
     them in-flow below the message only when it's tapped (.actions-open). */
  .msg-actions {
    position: static;
    display: none;
    justify-content: flex-end;
    flex-wrap: nowrap; /* keep all actions on one line */
    gap: 5px;
    opacity: 1;
    margin-top: 7px;
  }

  .msg.actions-open .msg-actions { display: flex; }

  /* Quiet messages hide the (otherwise empty) reaction row until tapped. */
  .reaction-row.empty { display: none; }
  .msg.actions-open .reaction-row.empty { display: flex; margin-top: 7px; }

  /* Condensed so the full row (React · Commend · Reply · Edit · Remove) fits
     on one line without pushing a button onto a second row. */
  .msg-act { padding: 4px 9px; font-size: 11.5px; white-space: nowrap; }
  .msg-act.react span { display: none; } /* flame icon only on mobile, saves room */
  .msg-act.react { padding: 4px 8px; }
}

/* iOS Safari auto-zooms (and can stay stuck zoomed) when a focused input's
   font is under 16px. 16px on touch prevents the zoom; desktop keeps its
   smaller, denser sizing. Placed last so it wins over the base input rules. */
@media (max-width: 880px) {
  input,
  textarea,
  select,
  .composer textarea,
  .field,
  .edit-area {
    font-size: 16px;
  }

  /* The bottom tabs sit below the composer and already pad for the home
     indicator, so the composer must NOT add the safe-area inset too —
     otherwise it double-counts and leaves a gap above the tabs on a phone. */
  .composer { padding-bottom: 12px; }

  /* Icon-only Send on the narrow phone width so the text box keeps its full
     width and "Speak into this Fire…" isn't clipped. */
  .composer .send { padding: 0; width: 44px; }
  .composer .send span { display: none; }

  /* Message text condensed to 14px on the phone to fit more per screen.
     (The composer input stays 16px above — iOS auto-zooms inputs under 16px
     on focus, the stuck-zoom bug we fixed earlier.) */
  .msg .text { font-size: 14px; line-height: 1.3; }

  /* Condensed chat on the phone — fit more messages per screen. Tighter
     rows, smaller avatars/text; the input stays 16px (above) so iOS won't
     auto-zoom, and tap targets stay 44px. */
  .chat-scroll { padding-top: 8px; padding-bottom: 8px; }
  .msg { gap: 7px; }
  .msg + .msg { margin-top: 3px; }
  .msg .avatar { width: 24px; height: 24px; font-size: 11px; }
  .msg .body { padding: 4px 9px; border-radius: 8px; }
  .msg .author { font-size: 12px; }
  .msg .time { font-size: 10px; }
}
