/* static/css/floor.css */

/* ==========================================
   1. TOKENS, RESET & BASE
   ========================================== */
@property --bg-core {
  syntax: '<color>';
  inherits: true;
  initial-value: #070b14;
}

@property --bg-ambient {
  syntax: '<color>';
  inherits: true;
  initial-value: #111b30;
}

:root {
  /* 100% Native System Font Stacks (zero cross-origin requests) */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Iowan Old Style', 'Palatino Linotype', 'URW Palladio L', P052, Georgia, serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;

  --bg-core: #070b14;
  --bg-ambient: #111b30;
  --ghost-color: #222f49;
  --primary-color: #f6f5f2;
  --text-bright: #f6f5f2;

  /* Unified Semantic Brand Colors (Red = Action/Verb, Blue = Structure/Noun/Draft) */
  --pos-verb: #e84a56;
  --pos-noun: #7fa7de;
  --aye-color: #3b9e76;
  --aye-glow: rgba(59, 158, 118, 0.2);
  --nay-color: #e84a56;
  --nay-glow: rgba(232, 74, 86, 0.22);
  /* High-opacity surface avoids needing heavy backdrop-filter blurs on iOS WKWebView */
  --surface-glass: rgba(13, 19, 34, 0.94);
  --border-subtle: rgba(255, 255, 255, 0.1);
}

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

button,
.roman-nav,
.swipe-cue {
  user-select: none;
}

body {
  background-color: var(--bg-core);
  background-image: radial-gradient(circle at 50% 42%, var(--bg-ambient) 0%, var(--bg-core) 75%);
  color: var(--text-bright);
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  transition: --bg-core 1.2s cubic-bezier(0.22, 1, 0.36, 1), --bg-ambient 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

/* ==========================================
   2. VIEW SWITCHING ARCHITECTURE
   ========================================== */
.view-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: transform 0.85s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.65s ease;
}

.view-layer.hidden-up {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.view-layer.hidden-down {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

/* Prevent iOS/Android pull-to-refresh from hijacking landing page swipe gestures */
#landing-view {
  touch-action: none;
  overscroll-behavior: none;
}

/* ==========================================
   3. PAGE 1: BRAND MONOLITH & ROMAN NAV
   ========================================== */
.stage-center {
  position: absolute;
  top: 43%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: max-content;
  max-width: 92vw;
}

.word-monolith {
  display: flex;
  justify-content: center;
  align-items: baseline;
  position: relative;
  padding: 0.75rem 0 1.25rem;
  font-kerning: normal;
  white-space: nowrap;
  cursor: pointer;
  width: 100%;
}

.char-slot {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
}

.char {
  font-size: clamp(1.15rem, 9.6vw, 5.8rem);
  font-weight: 700;
  line-height: 1;
  text-transform: lowercase;
  padding: 0 0.022em;
  color: var(--ghost-color);
  transition:
    color 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Pure SVG Rotating "o" Glyph (OS-independent geometry) */
.char-o-wrap {
  display: inline-block;
  line-height: 1;
}

.o-glyph-svg {
  width: 0.55em;
  height: 0.55em;
  display: inline-block;
  vertical-align: -0.02em;
  margin: 0 0.015em;
  overflow: visible;
  pointer-events: none;
}

.o-rotor-cutout {
  transform-origin: 50px 50px;
  animation: spinClockwise 8s linear infinite;
}

@keyframes spinClockwise {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.char-slot.active-primary .char {
  color: var(--primary-color);
  transform: translateY(-6px);
  opacity: 1;
}

.char-slot.active-primary.active-crimson .char {
  color: #e84a56; /* Crimson accent for "momentum" on finale step */
}

.char-slot.dormant .char {
  color: var(--ghost-color);
  transform: translateY(0);
  opacity: 0.48;
}

.char-slot.bridged-gap .char {
  color: var(--ghost-color);
  transform: translateY(2px) scale(0.96);
  opacity: 0.14;
}

.dictionary-card {
  margin-top: 1rem;
  width: 0;
  min-width: 100%;
  height: 8.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 1.2rem;
  padding-left: clamp(0.75rem, 2.5vw, 1.75rem);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.dict-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  margin-bottom: 0.45rem;
  width: 100%;
}

.dict-headword {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.22rem, 2.1vw, 1.55rem);
  color: var(--text-bright);
  letter-spacing: 0.02em;
}

.dict-phonetic {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #7c88a6;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.dict-pos {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.5s ease;
}

.dict-pos.pos-verb { color: var(--pos-verb); }
.dict-pos.pos-noun { color: var(--pos-noun); }

.dict-body {
  font-family: var(--font-serif);
  font-size: clamp(1.04rem, 1.65vw, 1.26rem);
  line-height: 1.45;
  color: #b8c2d6;
  width: 100%;
  padding-left: 0.85rem;
}

.dict-body strong {
  font-weight: 600;
  color: var(--text-bright);
  font-style: normal;
}

.landing-footer {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: max-content;
}

.roman-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
}

/* Contrast-safe muted navigation (>= 4.5:1 on #070b14) */
.roman-arrow,
.roman-numeral {
  background: none;
  border: none;
  color: rgba(246, 245, 242, 0.62);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  transition: color 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
  opacity: 0.75;
}

.roman-arrow {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  opacity: 0.6;
}

.roman-arrow:hover,
.roman-numeral:hover {
  color: #f6f5f2;
  opacity: 1;
}

.roman-numeral.active {
  color: var(--primary-color);
  font-weight: 700;
  opacity: 1;
  transform: translateY(-1px);
}

.nav-dot {
  background: none;
  border: none;
  color: rgba(246, 245, 242, 0.52);
  font-size: 1.15rem;
  line-height: 1;
  padding: 0 0.25rem;
  cursor: pointer;
  transition: color 0.35s ease, text-shadow 0.35s ease, transform 0.35s ease;
}

.nav-dot:hover {
  color: #f6f5f2;
}

.nav-dot.active {
  color: #7fa7de; /* Structural Blue */
  text-shadow: 0 0 10px rgba(127, 167, 222, 0.65);
  transform: scale(1.2);
}

.enter-floor-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #9ab0d1;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.5rem 1.15rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s ease, color 0.25s ease;
}

.enter-floor-btn:hover,
.enter-floor-btn:focus-visible {
  background: rgba(232, 74, 86, 0.12);
  border-color: rgba(232, 74, 86, 0.45);
  color: #ffffff;
  transform: translateY(3px);
}

.enter-floor-btn:active {
  transform: translateY(4px);
}

/* ==========================================
   4. PAGE 2: FLOOR HEADER & ACTIONS
   ========================================== */
.floor-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3.3rem;
  padding: 0 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
  background: linear-gradient(to bottom, rgba(7, 11, 20, 0.92) 0%, rgba(7, 11, 20, 0) 100%);
  pointer-events: none;
}

.floor-brand-btn {
  pointer-events: auto;
  background: none;
  border: none;
  color: var(--text-bright);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.06rem;
  line-height: 1;
  letter-spacing: -0.02em;
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  opacity: 0.94;
  transition: opacity 0.2s ease;
}

.floor-brand-btn:hover {
  opacity: 1;
}

.floor-brand-btn .red-accent {
  color: var(--nay-color);
  display: inline-flex;
  align-items: baseline;
}

.header-actions {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.floor-top-btn,
.floor-draft-btn,
.floor-login-btn,
.floor-search-btn {
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
}

.floor-top-btn {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 0 0.72rem;
  border-radius: 999px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.floor-top-btn:hover {
  background: rgba(232, 74, 86, 0.14);
  border-color: rgba(232, 74, 86, 0.5);
  color: #ffffff;
}

.floor-draft-btn {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--pos-noun);
  background: rgba(127, 167, 222, 0.1);
  border: 1px solid rgba(127, 167, 222, 0.34);
  padding: 0 0.75rem;
  border-radius: 999px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.floor-draft-btn:hover {
  background: rgba(127, 167, 222, 0.22);
  border-color: rgba(127, 167, 222, 0.65);
  color: #ffffff;
}

.floor-login-btn {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 0 0.78rem;
  border-radius: 999px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.floor-login-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
}

/* Tighten horizontal padding when showing the 4x4 Cipher Stamp */
.floor-login-btn:has(.cipher-stamp) {
  padding: 0 0.45rem;
}

.floor-search-btn {
  width: 30px;
  padding: 0;
  border-radius: 50%;
  color: #cbd4dd;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.floor-search-btn:hover {
  background: rgba(127, 167, 222, 0.16);
  border-color: rgba(127, 167, 222, 0.55);
  color: #ffffff;
}

.search-empty-state {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #8fa8cc;
  padding: 1.25rem 0;
  text-align: center;
}

/* Anchor search modal near the top so the input stays stationary as results expand */
#search-modal {
  align-items: flex-start;
  padding-top: 14vh;
}

.search-modal-box {
  max-width: 480px;
  max-height: min(76vh, 560px);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
}

.search-modal-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0;
  flex-shrink: 0;
}

.search-modal-input {
  flex: 1;
  margin-bottom: 0;
}

/* Mobile Header: uniform 28px height across all controls */
@media (max-width: 520px) {
  .floor-header {
    padding: 0 0.75rem;
  }

  .floor-brand-btn {
    font-size: 0.96rem;
  }

  .header-actions {
    gap: 0.35rem;
  }

  .floor-top-btn,
  .floor-draft-btn,
  .floor-login-btn,
  .floor-search-btn {
    height: 28px;
  }

  .floor-top-btn,
  .floor-login-btn {
    font-size: 0.65rem;
    padding: 0 0.62rem;
  }

  .floor-login-btn:has(.cipher-stamp) {
    padding: 0 0.4rem;
  }

  .floor-draft-btn,
  .floor-search-btn {
    width: 28px;
    padding: 0;
  }

  .floor-draft-btn {
    font-size: 0.9rem;
  }

  .floor-draft-btn .draft-label {
    display: none;
  }
}

/* ==========================================
   5. 4x4 GENOMIC CIPHER STAMP
   ========================================== */
.cipher-stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 11, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  padding: 2px;
  flex-shrink: 0;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.6);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.citizen-chip {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 6px;
}

.citizen-chip:hover .cipher-stamp {
  border-color: var(--pos-noun);
  transform: scale(1.06);
}

/* ==========================================
   6. VERTICAL SNAP FEED & DOSSIER CARD
   ========================================== */
.feed-scroller {
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.feed-scroller::-webkit-scrollbar {
  display: none;
}

.amendment-slide {
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.3rem 0.65rem 2.1rem;
  position: relative;
  /* Skip layout/paint for off-screen slides to prevent iOS WKWebView GPU OOM */
  content-visibility: auto;
  contain-intrinsic-size: 100vw 100dvh;
}

.dossier-stage {
  width: 100%;
  max-width: 650px;
  flex: 1;
  min-height: 0;
  max-height: 760px;
  position: relative;
}

.dossier-card {
  width: 100%;
  height: 100%;
  background: var(--surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.15rem 1.2rem 1.05rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  position: relative;
}

.dossier-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.6rem;
  margin-bottom: 0.7rem;
  flex-shrink: 0;
}

.dossier-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--nay-color);
  font-weight: 500;
  white-space: nowrap;
}

.dossier-chamber {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.94rem;
  color: #8fa8cc;
  text-align: right;
}

.dossier-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.45rem;
  padding-bottom: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.dossier-content::-webkit-scrollbar {
  width: 4px;
}

.dossier-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 4px;
}

.summary-headline {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.12rem, 1.9vw, 1.38rem);
  line-height: 1.3;
  color: #ffffff;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.section-block {
  margin-bottom: 0.75rem;
  font-family: var(--font-serif);
  font-size: clamp(0.98rem, 1.35vw, 1.12rem);
  line-height: 1.48;
  color: #d2daea;
}

.section-block p {
  margin-bottom: 0.75rem;
}

.section-block:last-child,
.section-block p:last-child {
  margin-bottom: 0.25rem;
}

.section-num {
  font-family: var(--font-serif);
  font-variant: small-caps;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 0.02em;
  margin-right: 0.35rem;
}

/* ==========================================
   7. VOTE BOX, FLOATING ACTIONS & SWIPE CUE
   ========================================== */
.vote-box {
  margin-top: 0.55rem;
  padding-top: 0.68rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.vote-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8fa8cc;
}

.vote-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.vote-btn {
  position: relative;
  padding: 0.65rem 0.9rem;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-bright);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.vote-btn-label {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  z-index: 2;
}

.vote-btn-pct {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  opacity: 0.8;
  z-index: 2;
}

.vote-btn-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}

.vote-btn.aye:hover {
  border-color: var(--aye-color);
  box-shadow: 0 0 18px var(--aye-glow);
  transform: translateY(-1px);
}

.vote-btn.nay:hover {
  border-color: var(--nay-color);
  box-shadow: 0 0 18px var(--nay-glow);
  transform: translateY(-1px);
}

/* Dark-left, leading-edge gauge gradient */
.vote-btn.aye .vote-btn-bar {
  background: linear-gradient(
    90deg,
    rgba(127, 167, 222, 0.03) 0%,
    rgba(127, 167, 222, 0.12) 60%,
    rgba(127, 167, 222, 0.38) 100%
  );
  border-right: 2px solid rgba(127, 167, 222, 0.9);
}

.vote-btn.nay .vote-btn-bar {
  background: linear-gradient(
    90deg,
    rgba(232, 74, 86, 0.03) 0%,
    rgba(232, 74, 86, 0.12) 60%,
    rgba(232, 74, 86, 0.38) 100%
  );
  border-right: 2px solid rgba(232, 74, 86, 0.9);
}

/* Selected ballot border & restrained glow */
.vote-btn.selected.aye {
  border-color: #7fa7de;
  box-shadow: 0 0 14px rgba(127, 167, 222, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.vote-btn.selected.nay {
  border-color: #e84a56;
  box-shadow: 0 0 14px rgba(232, 74, 86, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Crisp label + high-contrast percentage pop */
.vote-btn.selected .vote-btn-label {
  color: #f6f5f2;
  font-weight: 600;
}

.vote-btn.selected .vote-btn-pct {
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.vote-btn.selected.aye .vote-btn-pct {
  text-shadow: 0 0 10px rgba(127, 167, 222, 0.85);
}

.vote-btn.selected.nay .vote-btn-pct {
  text-shadow: 0 0 10px rgba(232, 74, 86, 0.85);
}

.floating-actions {
  position: absolute;
  right: 0.38rem;
  bottom: 6.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 15;
}

.floating-action-btn {
  background: rgba(10, 15, 28, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-bright);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
}

.floating-action-btn:hover {
  border-color: var(--pos-noun);
  background: rgba(18, 26, 46, 0.98);
  transform: scale(1.06);
}

.floating-action-btn.copied {
  border-color: var(--aye-color);
  color: #72f1b8;
}

.swipe-cue {
  margin-top: 0.28rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  opacity: 0.42;
  cursor: pointer;
  padding: 0.1rem 1rem;
  transition: opacity 0.25s ease;
  z-index: 10;
  flex-shrink: 0;
}

.swipe-cue:hover {
  opacity: 0.85;
}

.swipe-cue-line {
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(143, 168, 204, 0.7), transparent);
}

.swipe-cue svg {
  color: #8fa8cc;
  animation: gentleFloat 2.6s ease-in-out infinite;
}

@keyframes gentleFloat {
  0%, 100% { transform: translateY(0); opacity: 0.65; }
  50%      { transform: translateY(2.5px); opacity: 1; }
}

/* ==========================================
   8. SLIDE-UP COMMENT / DEBATE DRAWER
   ========================================== */
.comment-drawer {
  position: absolute;
  inset: auto 0 0 0;
  height: 74%;
  background: rgba(10, 15, 28, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px 14px 0 0;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  transform: translateY(104%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 30;
}

.comment-drawer.open {
  transform: translateY(0%);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.75rem;
}

.drawer-title {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-bright);
}

.drawer-close {
  background: none;
  border: none;
  color: #8fa8cc;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.1rem 0.4rem;
}

.comment-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding-right: 0.25rem;
}

.comment-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 9px;
  padding: 0.65rem 0.8rem;
}

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: #7c88a6;
}

.comment-meta-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.stance-badge {
  padding: 0.06rem 0.38rem;
  border-radius: 4px;
  font-weight: 500;
  text-transform: uppercase;
}

.stance-badge.aye {
  background: rgba(59, 158, 118, 0.18);
  color: #72f1b8;
}

.stance-badge.nay {
  background: rgba(232, 74, 86, 0.2);
  color: #ff858f;
}

.comment-text {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  line-height: 1.42;
  color: #d8e0ef;
}

.comment-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.comment-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  outline: none;
}

.comment-input:focus {
  border-color: #7fa7de;
}

.comment-submit {
  background: var(--text-bright);
  color: #070b14;
  border: none;
  border-radius: 8px;
  padding: 0 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
}

/* ==========================================
   9. SHARED MODAL SHELL & DRAFT MODAL
   ========================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.84);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  width: 92%;
  max-width: 420px;
  background: #0d1424;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 1.4rem 1.5rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  position: relative;
  overflow: hidden;
}

.modal-box h3 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  margin-bottom: 0.3rem;
  color: var(--text-bright);
}

.modal-box p {
  font-size: 0.8rem;
  color: #8fa8cc;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.modal-field {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.62rem 0.8rem;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  margin-bottom: 0.7rem;
  outline: none;
}

.modal-field:focus {
  border-color: var(--pos-noun);
}

textarea.modal-field {
  resize: vertical;
  min-height: 92px;
  font-family: var(--font-serif);
  font-size: 1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.auth-close-btn {
  position: absolute;
  top: 0.85rem;
  right: 0.95rem;
  z-index: 5;
}

/* ==========================================
   10. AUTH MODAL (LOGIN / REGISTER)
   ========================================== */
.auth-modal-box {
  max-width: 390px;
  padding: 1.6rem 1.65rem 1.4rem;
}

.auth-brand-logo {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  text-align: left;
  color: var(--text-bright);
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: flex-start;
  align-items: baseline;
}

.auth-brand-logo .red-accent {
  color: var(--nay-color);
  display: inline-flex;
  align-items: baseline;
}

.auth-error {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #ff858f;
  background: rgba(232, 74, 86, 0.12);
  border: 1px solid rgba(232, 74, 86, 0.35);
  border-radius: 7px;
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.9rem;
}

.auth-error.visible {
  display: block;
}

.auth-honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.auth-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8fa8cc;
  margin-bottom: 0.35rem;
}

.auth-field {
  margin-bottom: 0.95rem;
}

.auth-submit-btn {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.72rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(127, 167, 222, 0.45);
  background: rgba(127, 167, 222, 0.14);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-submit-btn:hover {
  background: rgba(127, 167, 222, 0.26);
  border-color: var(--pos-noun);
}

.auth-legal-note {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.7rem;
  color: #7c88a6;
  line-height: 1.4;
}

.auth-legal-note a {
  color: var(--pos-noun);
  text-decoration: none;
}

.auth-legal-note a:hover {
  text-decoration: underline;
}

.auth-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 1.15rem 0 0.85rem;
}

.auth-footer-link {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: #8fa8cc;
}

.auth-link-btn {
  background: none;
  border: none;
  color: var(--pos-noun);
  font-family: inherit;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-link-btn:hover {
  color: #ffffff;
}

/* ==========================================
   11. PROFILE MODAL (SWAYING TREE + 6x4 DNA BOX)
   ========================================== */
.profile-tree-modal {
  max-width: 540px;
  padding: 1.15rem 1.4rem 1.35rem;
  background: radial-gradient(circle at 26% 58%, #16223b 0%, #070b14 82%);
}

.profile-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.7rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-modal-title {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
}

.profile-brand {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  color: var(--text-bright);
}

.profile-brand .red-accent {
  color: var(--nay-color);
}

.profile-title-sep {
  color: #4f6082;
}

.profile-title-sub {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #8fa8cc;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.1rem;
  align-items: center;
}

.profile-tree-stage {
  position: relative;
  width: 100%;
  height: 275px;
}

.profile-tree-stage #profile-tree-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.profile-info-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding-right: 0.25rem;
}

.dna-matrix-box {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  width: fit-content;
  background: rgba(5, 9, 18, 0.92);
  border: 1px solid rgba(127, 167, 222, 0.42);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.65);
}

.dna-matrix-grid {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.96rem;
  line-height: 1.45;
  letter-spacing: 0.16em;
  color: #8cc2ff;
  text-shadow: 0 0 10px rgba(127, 167, 222, 0.45);
  user-select: all;
}

.dna-side-stack {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dna-stamp-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(127, 167, 222, 0.45);
  background: rgba(127, 167, 222, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dna-stamp-box .cipher-stamp {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.dna-copy-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid rgba(127, 167, 222, 0.45);
  background: rgba(127, 167, 222, 0.1);
  color: #8cc2ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dna-copy-btn:hover {
  background: rgba(127, 167, 222, 0.22);
  border-color: #8cc2ff;
  color: #ffffff;
}

.dna-copy-btn.copied {
  border-color: var(--aye-color);
  color: #72f1b8;
  background: rgba(59, 158, 118, 0.16);
}

.profile-sub-count {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: #8fa8cc;
  letter-spacing: 0.04em;
}

.profile-self-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.25rem;
}

.profile-self-actions form {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.profile-action-link {
  display: inline-flex;
  align-items: center;
  padding: 0;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7c88a6;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.profile-action-link:hover {
  color: var(--text-bright);
}

.profile-logout-btn:hover {
  color: var(--nay-color);
}

@media (max-width: 540px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
  .profile-tree-stage {
    height: 220px;
  }
}

/* ==========================================
   12. TOP LEADERBOARD MODAL
   ========================================== */
.top-modal-box {
  max-width: 480px;
  height: min(78vh, 580px);
  display: flex;
  flex-direction: column;
}

.top-period-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.28rem;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.85rem;
  flex-shrink: 0;
}

.top-tab {
  background: transparent;
  border: none;
  color: #8fa8cc;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.42rem 0.25rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.top-tab:hover {
  color: var(--text-bright);
}

.top-tab.active {
  background: rgba(127, 167, 222, 0.18);
  color: #ffffff;
  border: 1px solid rgba(127, 167, 222, 0.4);
}

.top-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-right: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.top-item {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  display: grid;
  grid-template-columns: 1.8rem 1fr auto;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-bright);
}

.top-item:hover {
  background: rgba(127, 167, 222, 0.08);
  border-color: rgba(127, 167, 222, 0.35);
  transform: translateX(2px);
}

.top-rank {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--nay-color);
  font-weight: 600;
}

.top-item-main {
  min-width: 0;
}

.top-item-chamber {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.85rem;
  color: #8fa8cc;
  margin-bottom: 0.12rem;
}

.top-item-summary {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.28;
  color: #ffffff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.top-item-stats {
  text-align: right;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.top-item-pct {
  font-size: 0.78rem;
  font-weight: 600;
  color: #72f1b8;
}

.top-item-ballots {
  font-size: 0.62rem;
  color: #7c88a6;
  margin-top: 0.15rem;
}

/* ==========================================
   12b. SEARCH MODAL
   ========================================== */
#search-modal {
  align-items: flex-start;
  padding-top: 14vh;
}

.search-modal-box {
  max-width: 480px;
  max-height: min(76vh, 560px);
  padding: 1.6rem 1.5rem 1.4rem;
  display: flex;
  flex-direction: column;
}

.search-brand-logo {
  margin-bottom: 1.15rem;
}

.search-modal-box .search-modal-input {
  width: 100%;
  margin-bottom: 0;
  flex-shrink: 0;
}

.search-empty-state {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #8fa8cc;
  padding: 1.25rem 0;
  text-align: center;
}

/* Collapse results container completely until results are populated */
#search-results-list:empty {
  display: none;
}

#search-results-list:not(:empty) {
  margin-top: 0.85rem;
}

/* ==========================================
   13. SHARED FOOTER
   ========================================== */
.floor-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2rem;
  padding: 0 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: #7c88a6;
  pointer-events: none;
}

.floor-footer-copy,
.floor-footer-links {
  pointer-events: auto;
}

.floor-footer-links {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.floor-footer-links a {
  color: #8fa8cc;
  text-decoration: none;
  transition: color 0.2s ease;
}

.floor-footer-links a:hover {
  color: var(--text-bright);
}

/* ==========================================
   14. ACCESSIBILITY (WCAG 2.1 AA)
   ========================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Crisp keyboard-only focus rings (hidden on mouse click) */
:is(button, a, input, textarea, [tabindex="0"]):focus-visible {
  outline: 2px solid #7fa7de;
  outline-offset: 3px;
  border-radius: 4px;
}

/* Respect OS-level Reduced Motion preferences */
@media (prefers-reduced-motion: reduce) {
  .o-rotor-cutout {
    animation: none !important;
  }
  .view-layer,
  .char,
  .dictionary-card,
  .nav-dot {
    transition-duration: 0.01ms !important;
  }
  .feed-scroller {
    scroll-behavior: auto !important;
  }
}