/* COGNATION — starter theme (baby pink)
 *
 * Brand rename (single source of truth): js/brand.js → window.SITE_BRAND
 * HTML uses [data-brand] / [data-brand-tagline].
 * Logo image: assets/logo.svg (swap that one file). Fallback mark: .logo-mark / [data-brand-mark].
 * --brand-name below is a documented mirror only; do not treat CSS as the rename source.
 */

/* Chomsky — COMMUNE masthead (SIL OFL 1.1; https://github.com/ctrlcctrlv/chomsky) */
@font-face {
  font-family: "Chomsky";
  src:
    url("../assets/fonts/chomsky/Chomsky.woff2") format("woff2"),
    url("../assets/fonts/chomsky/Chomsky.woff") format("woff"),
    url("../assets/fonts/chomsky/Chomsky.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}



:root {
  /* Display name lives in js/brand.js; token kept for theming hooks */
  --brand-name: "COGNATION";
  /* Baby pink theme */
  --color-bg: #fff5f9;
  --color-surface: #ffeaf3;
  --color-surface-2: #ffd6e8;
  --color-border: #f5b6d0;
  --color-text: #5a3a48;
  --color-muted: #9a6b7d;
  --color-heading: #4a2c3a;
  --color-accent: #f4a4c4;
  --color-accent-hover: #ef8bb4;
  --color-accent-dim: rgba(244, 164, 196, 0.28);
  --color-navy: #7a4a5c;
  --color-indigo: #d489b0;
  --focus-ring: 0 0 0 3px rgba(244, 164, 196, 0.45);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 40px rgba(210, 140, 170, 0.22);
  --max-width: 1100px;
  --header-h: 4rem;
  --topbar-h: 3.25rem;
  --font: Georgia, "Times New Roman", Times, serif;
  --font-display: Georgia, "Times New Roman", Times, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -100%;
  z-index: 1000;
  padding: 0.75rem 1.25rem;
  background: var(--color-accent);
  color: var(--color-navy);
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: 0.75rem;
  outline: none;
  box-shadow: var(--focus-ring);
}

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--color-accent-hover);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

img {
  max-width: 100%;
  height: auto;
}

/* Layout */
.container {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

main {
  flex: 1;
}

/* Header */
.site-header {
  position: sticky;
  top: var(--topbar-h);
  z-index: 100;
  background: rgba(255, 245, 249, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 1rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--color-heading);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.logo:hover {
  color: var(--color-accent-hover);
}

.logo-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--color-indigo), var(--color-accent));
  display: grid;
  place-items: center;
  color: white;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* Organization logo — swap assets/logo.svg (documented in README) */
.brand-logo {
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-logo--header {
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
}

.brand-logo--splash {
  width: 6rem;
  height: 6rem;
  border-radius: 22px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.nav-toggle {
  display: none;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font: inherit;
}

.nav-toggle[aria-expanded="true"] {
  border-color: var(--color-accent);
  background: var(--color-accent-dim);
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: block;
  padding: 0.5rem 0.85rem;
  color: var(--color-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--color-heading);
  background: var(--color-accent-dim);
}

.site-nav a[aria-current="page"] {
  color: var(--color-accent);
}

/* Hero */
.hero {
  padding: 4.5rem 0 3.5rem;
  background:
    radial-gradient(ellipse 80% 60% at 70% -10%, rgba(49, 46, 129, 0.55), transparent 55%),
    radial-gradient(ellipse 50% 40% at 10% 80%, rgba(34, 211, 238, 0.08), transparent 50%),
    var(--color-bg);
}

.hero-grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

@media (min-width: 800px) {
  .hero-grid {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
}

.hero h1 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--color-heading);
}

.lead {
  font-size: 1.15rem;
  color: var(--color-muted);
  max-width: 36rem;
  margin: 0 0 1.75rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.hero-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  color: var(--color-heading);
}

.hero-card ul {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--color-muted);
}

.hero-card li + li {
  margin-top: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-navy);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  color: var(--color-navy);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-hover);
  background: var(--color-accent-dim);
}

/* Sections */
.section {
  padding: 3.5rem 0;
}

.section-alt {
  background: var(--color-surface);
  border-block: 1px solid var(--color-border);
}

.section h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  color: var(--color-heading);
  letter-spacing: -0.02em;
}

.section-intro {
  color: var(--color-muted);
  max-width: 40rem;
  margin: 0 0 2rem;
}

.cards {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--color-heading);
}

.card p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.98rem;
}

.card-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: var(--color-accent-dim);
  color: var(--color-accent);
  display: grid;
  place-items: center;
  font-weight: 700;
  margin-bottom: 1rem;
  border: 1px solid rgba(34, 211, 238, 0.25);
}

/* Page banner (About / Contact) */
.page-banner {
  padding: 3rem 0 2rem;
  background:
    radial-gradient(ellipse 70% 80% at 90% 0%, rgba(49, 46, 129, 0.4), transparent 50%),
    var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.page-banner h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 3.5vw, 2.35rem);
  color: var(--color-heading);
  letter-spacing: -0.02em;
}

.page-banner p {
  margin: 0;
  color: var(--color-muted);
  max-width: 36rem;
}

.prose {
  max-width: 42rem;
}

.prose p {
  color: var(--color-muted);
}

.prose h2 {
  margin-top: 2rem;
  color: var(--color-heading);
}

.cta-band {
  background: linear-gradient(135deg, var(--color-indigo), #1e3a5f 60%, #0e7490);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  border: 1px solid rgba(34, 211, 238, 0.2);
}

.cta-band h2 {
  margin: 0 0 0.35rem;
  color: white;
  font-size: 1.35rem;
}

.cta-band p {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  max-width: 28rem;
}

/* Form */
.form-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 36rem;
}

.form-note {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--color-accent-dim);
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  color: var(--color-heading);
  font-size: 0.95rem;
}

.required {
  color: var(--color-accent);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
}

.form-group textarea {
  min-height: 8rem;
  resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #6b7a94;
}

.form-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 2rem 0;
  border-top: 1px solid var(--color-border);
  background: var(--color-navy);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-footer p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.footer-nav a {
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-nav a:hover {
  color: var(--color-accent);
}

/* Mobile nav */
@media (max-width: 719px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
  }

  .site-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1rem 1rem;
    display: none;
  }

  .site-nav.is-open {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
  }

  .site-nav a {
    padding: 0.75rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}


/* Accessible in-page tabs
 * Tab order on Home: TOWER · COMMUNE · WELL · MARKET.
 */
.tabs-section {
  padding-top: 3rem;
}

.tabs {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0.75rem;
  list-style: none;
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.tablist [role="tab"] {
  flex: 0 0 auto;
  appearance: none;
  margin: 0;
  padding: 0.65rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tablist [role="tab"]:hover {
  color: var(--color-heading);
  background: var(--color-accent-dim);
}

.tablist [role="tab"][aria-selected="true"] {
  color: var(--color-navy);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.tablist [role="tab"]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.tab-panels {
  padding: 1.5rem 1.35rem 1.75rem;
}

.tab-panels [role="tabpanel"] {
  color: var(--color-muted);
}

.tab-panels [role="tabpanel"][hidden] {
  display: none;
}

.tab-panels [role="tabpanel"] h3 {
  margin: 0 0 0.65rem;
  font-size: 1.2rem;
  color: var(--color-heading);
  letter-spacing: -0.02em;
}

.tab-panels [role="tabpanel"] p {
  margin: 0 0 0.85rem;
  max-width: 42rem;
}

.tab-panels [role="tabpanel"] p:last-child {
  margin-bottom: 0;
}

.tab-panels [role="tabpanel"] ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.tab-panels [role="tabpanel"] li + li {
  margin-top: 0.4rem;
}

.tab-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.15rem;
}

@media (max-width: 480px) {
  .tablist {
    flex-wrap: nowrap;
  }
}


/* Login UI gate (startup overlay — demo only, no real auth) */
body.login-gate-open {
  overflow: hidden;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.login-gate[hidden] {
  display: none;
}

.login-gate-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 20, 0.72);
  backdrop-filter: blur(6px);
  border: 0;
  padding: 0;
  cursor: pointer;
}

.login-gate-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 26rem);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: var(--shadow);
  background-image:
    radial-gradient(ellipse 90% 60% at 100% 0%, rgba(49, 46, 129, 0.45), transparent 55%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(34, 211, 238, 0.08), transparent 50%);
}

.login-gate-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.15rem;
  font-weight: 700;
  color: var(--color-heading);
  letter-spacing: -0.02em;
}

.login-gate-brand--splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

.login-gate-brand-name {
  font-size: 1.05rem;
}

.login-gate-brand--splash .login-gate-brand-name {
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
}

.login-gate-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  text-align: center;
}

.login-gate--splash .login-gate-panel {
  width: min(100%, 28rem);
  text-align: left;
  padding-top: 2rem;
}

.login-gate--splash .login-gate-panel h2,
.login-gate--splash .login-gate-desc {
  text-align: center;
}

.login-gate--splash .login-gate-backdrop {
  background:
    radial-gradient(ellipse 70% 50% at 50% 20%, rgba(49, 46, 129, 0.55), transparent 55%),
    radial-gradient(ellipse 50% 40% at 50% 90%, rgba(34, 211, 238, 0.12), transparent 50%),
    rgba(5, 10, 20, 0.88);
}

.login-gate-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  color: var(--color-heading);
  letter-spacing: -0.02em;
}

.login-gate-desc {
  margin: 0 0 1.35rem;
  color: var(--color-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.login-form .form-group:last-of-type {
  margin-bottom: 0.85rem;
}

.login-form-actions {
  margin-top: 1.15rem;
  flex-direction: column;
  align-items: stretch;
}

.login-form-actions .btn {
  width: 100%;
}

.login-status {
  margin: 0 0 0.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--color-accent-dim);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: var(--color-text);
  font-size: 0.92rem;
  line-height: 1.5;
}

.login-status[hidden] {
  display: none;
}

.login-status.is-error {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.4);
}

@media (max-width: 480px) {
  .login-gate {
    padding: 0.75rem;
    align-items: end;
  }

  .login-gate-panel {
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.5rem 1.15rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  }
}


/* —— COMMUNE messaging UI (demo / localStorage) —— */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.commune-messaging {
  margin-top: 1.25rem;
}

.commune-banner {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  background: var(--color-accent-dim);
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: none;
}

.commune-banner strong {
  color: var(--color-accent);
  font-weight: 700;
}

.commune-banner code {
  font-size: 0.85em;
  color: var(--color-heading);
  word-break: break-all;
}

.commune-layout {
  display: grid;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-bg);
  min-height: 22rem;
}

@media (min-width: 720px) {
  .commune-layout {
    grid-template-columns: minmax(11rem, 15rem) 1fr;
    min-height: 26rem;
  }
}

.commune-sidebar {
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  max-height: 12rem;
}

@media (min-width: 720px) {
  .commune-sidebar {
    border-bottom: 0;
    border-right: 1px solid var(--color-border);
    max-height: none;
  }
}

.commune-sidebar-heading,
.commune-thread-title {
  margin: 0;
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
  border-bottom: 1px solid var(--color-border);
}

.commune-thread-title {
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--color-heading);
}

.commune-conv-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.commune-conv-list li {
  margin: 0;
}

.commune-conv-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  width: 100%;
  margin: 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.commune-conv-btn:hover {
  background: var(--color-accent-dim);
}

.commune-conv-btn.is-active,
.commune-conv-btn[aria-selected="true"] {
  background: var(--color-accent-dim);
  border-color: rgba(34, 211, 238, 0.35);
}

.commune-conv-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.commune-conv-name {
  font-weight: 600;
  color: var(--color-heading);
  font-size: 0.95rem;
}

.commune-conv-preview {
  font-size: 0.82rem;
  color: var(--color-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.commune-thread {
  display: flex;
  flex-direction: column;
  min-height: 16rem;
  background: var(--color-surface);
}

.commune-thread-header {
  flex-shrink: 0;
}

.commune-empty {
  margin: 1.5rem 1rem;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.commune-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 10rem;
  max-height: 18rem;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 720px) {
  .commune-messages {
    max-height: none;
  }
}

.commune-msg {
  position: relative;
  max-width: min(100%, 28rem);
  align-self: flex-start;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}

.commune-msg--mine {
  align-self: flex-end;
  background: var(--color-accent-dim);
  border-color: rgba(34, 211, 238, 0.35);
}

.commune-msg-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.35rem;
}

.commune-msg-author {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--color-accent);
}

.commune-msg--mine .commune-msg-author {
  color: var(--color-heading);
}

.commune-msg-meta time {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.commune-msg-body {
  margin: 0;
  color: var(--color-text);
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: none;
}

/* —— Message emoji reactions (tapbacks) —— */
.commune-msg-reactbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.45rem;
  min-height: 1.5rem;
}

.commune-msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.commune-react-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: #fff5f9;
  color: var(--color-text);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.3;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(210, 140, 170, 0.12);
}

.commune-react-pill:hover {
  border-color: var(--color-accent-hover);
  background: var(--color-surface);
}

.commune-react-pill:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.commune-react-pill.is-mine {
  background: var(--color-accent-dim);
  border-color: rgba(244, 164, 196, 0.75);
}

.commune-react-pill-emoji {
  font-size: 0.95rem;
  line-height: 1;
}

.commune-react-pill-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-muted);
  min-width: 0.7em;
}

.commune-react-pill.is-mine .commune-react-pill-count {
  color: var(--color-heading);
}

.commune-react-controls {
  position: relative;
  margin-left: auto;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.commune-msg:hover .commune-react-controls,
.commune-msg:focus-within .commune-react-controls,
.commune-react-controls:focus-within,
.commune-react-controls.is-incoming {
  opacity: 1;
}

.commune-react-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-heading);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.commune-react-open:hover {
  background: #fff5f9;
  border-color: var(--color-accent);
}

.commune-react-open:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.commune-react-open[aria-expanded="true"] {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
}

.commune-react-picker {
  position: absolute;
  bottom: calc(100% + 0.35rem);
  right: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  max-width: 12.5rem;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: #fff8fb;
  box-shadow: var(--shadow);
}

.commune-react-picker[hidden] {
  display: none;
}

.commune-msg--mine .commune-react-picker {
  right: auto;
  left: 0;
}

.commune-react-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.commune-react-face:hover {
  background: var(--color-accent-dim);
}

.commune-react-face:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.commune-react-more {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-muted);
}

.commune-status {
  margin: 0 1rem 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--color-accent-dim);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--color-text);
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: none;
}

.commune-status[hidden] {
  display: none;
}

.commune-status.is-error {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.4);
}

.commune-compose {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-2);
  flex-shrink: 0;
}

.commune-compose[hidden] {
  display: none;
}

.commune-compose textarea {
  flex: 1 1 12rem;
  min-height: 2.75rem;
  max-height: 8rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  resize: vertical;
}

.commune-compose textarea::placeholder {
  color: #6b7a94;
}

.commune-compose textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--color-accent);
}

.commune-compose .btn {
  flex: 0 0 auto;
  min-width: 5.5rem;
}

@media (max-width: 479px) {
  .commune-compose {
    flex-direction: column;
    align-items: stretch;
  }

  .commune-compose .btn {
    width: 100%;
  }
}


/* —— COMMUNE newspaper edition (print-like, navy/cyan) —— */
.commune-paper {
  margin-top: 0.5rem;
}

.commune-banner--compact {
  margin-bottom: 1.15rem;
  font-size: 0.85rem;
}

.paper-masthead {
  text-align: center;
  padding: 1.75rem 0.75rem 1.85rem;
  border-block: 3px double var(--color-border);
  margin-bottom: 1.25rem;
  background:
    linear-gradient(180deg, rgba(49, 46, 129, 0.18), transparent 70%),
    var(--color-surface);
}

.paper-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.paper-title {
  margin: 0;
  font-family: "Chomsky", "Old English Text MT", Georgia, serif;
  font-size: clamp(3.5rem, 13vw, 7rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 0.92;
  color: var(--color-heading);
  text-wrap: balance;
}

.paper-subtitle {
  margin: 0.4rem 0 0.75rem;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--color-muted);
}

.paper-dateline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 1rem;
}

.paper-rule {
  display: inline-block;
  width: 1.25rem;
  height: 1px;
  background: var(--color-border);
}

.paper-edition-scope {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.paper-edition-scope-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.paper-edition-seg {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.paper-edition-opt {
  position: relative;
  margin: 0;
  cursor: pointer;
}

.paper-edition-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.paper-edition-opt span {
  display: block;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.paper-edition-opt:hover span {
  color: var(--color-heading);
  background: var(--color-accent-dim);
}

.paper-edition-opt input:checked + span {
  color: var(--color-navy);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.paper-edition-opt input:focus-visible + span {
  box-shadow: var(--focus-ring);
}

.paper-grid {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 900px) {
  .paper-grid {
    grid-template-columns: minmax(10rem, 13.5rem) minmax(0, 1fr) minmax(10rem, 13.5rem);
    gap: 1.5rem;
  }
}

.paper-col-heading {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 0.4rem;
}

.paper-index {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.paper-index li + li {
  margin-top: 0.35rem;
}

.paper-index-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.7rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.paper-index-btn:hover {
  background: var(--color-accent-dim);
}

.paper-index-btn.is-active,
.paper-index-btn[aria-current="true"] {
  background: var(--color-accent-dim);
  border-color: rgba(34, 211, 238, 0.35);
}

.paper-index-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.paper-index-label {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-heading);
}

.paper-index-desc {
  font-size: 0.8rem;
  color: var(--color-muted);
}

.paper-topics {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--color-muted);
  font-size: 0.92rem;
}

.paper-topics li + li {
  margin-top: 0.35rem;
}

.paper-rule-block {
  height: 0;
  border-top: 1px solid var(--color-border);
  margin: 1rem 0;
}

.paper-section-kicker {
  margin: 0 0 0.35rem;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--color-heading);
  letter-spacing: -0.02em;
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 0.35rem;
  display: inline-block;
}

.paper-dek {
  margin: 0.5rem 0 1rem;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-style: italic;
  color: var(--color-muted);
  max-width: 40rem;
}

.paper-brief {
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.paper-brief-title {
  margin: 0 0 0.25rem;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 0.95rem;
  color: var(--color-heading);
}

.paper-brief-body {
  margin: 0;
  font-size: 0.88rem;
  color: var(--color-muted);
  line-height: 1.45;
}

.paper-compose label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  color: var(--color-heading);
  font-size: 0.95rem;
}

.paper-compose textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  resize: vertical;
  min-height: 5rem;
}

.paper-compose textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--color-accent);
}

.commune-feed-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.commune-feed-item,
.paper-article {
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.commune-feed-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.4rem;
}

.commune-feed-author {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-accent);
}

.commune-feed-meta time {
  font-size: 0.75rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.commune-feed-body {
  margin: 0;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
  max-width: none;
}

/* Profile / correspondent */
.commune-profile-preview {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  margin-bottom: 1.25rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.commune-avatar {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--color-navy);
  background: linear-gradient(135deg, var(--color-accent), #67e8f9);
  border: 2px solid rgba(34, 211, 238, 0.45);
  overflow: hidden;
}

.commune-avatar.has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.commune-profile-name {
  margin: 0 0 0.25rem;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-heading);
}

.commune-profile-bio {
  margin: 0 0 0.5rem;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.commune-visibility-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.commune-vis-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #94a3b8;
}

.commune-visibility-badge.is-public .commune-vis-dot {
  background: var(--color-accent);
}

.commune-visibility-badge.is-public {
  color: var(--color-accent);
}

.commune-visibility-fieldset {
  margin: 0 0 1.15rem;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

.commune-visibility-fieldset legend {
  padding: 0 0.35rem;
  font-weight: 700;
  color: var(--color-heading);
  font-size: 0.95rem;
}

.commune-visibility-hint {
  margin: 0 0 0.85rem;
}

.commune-visibility-options {
  display: grid;
  gap: 0.65rem;
}

@media (min-width: 520px) {
  .commune-visibility-options {
    grid-template-columns: 1fr 1fr;
  }
}

.commune-vis-option {
  display: block;
  margin: 0;
  cursor: pointer;
}

.commune-vis-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.commune-vis-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  transition: border-color 0.15s, background 0.15s;
}

.commune-vis-option:hover .commune-vis-card {
  border-color: rgba(34, 211, 238, 0.45);
  background: var(--color-accent-dim);
}

.commune-vis-option input:checked + .commune-vis-card {
  border-color: var(--color-accent);
  background: var(--color-accent-dim);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.35);
}

.commune-vis-option input:focus-visible + .commune-vis-card {
  box-shadow: var(--focus-ring);
}

.commune-vis-title {
  font-weight: 700;
  color: var(--color-heading);
}

.commune-vis-desc {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.commune-profile-form .form-actions {
  margin-top: 0.75rem;
}

@media (max-width: 899px) {
  .paper-col--left {
    order: 2;
  }
  .paper-col--center {
    order: 1;
  }
  .paper-col--right {
    order: 3;
  }
  .paper-grid {
    display: flex;
    flex-direction: column;
  }
}

@media (max-width: 479px) {
  .paper-edition-seg {
    width: 100%;
  }
  .paper-edition-opt {
    flex: 1 1 calc(50% - 0.35rem);
  }
  .paper-edition-opt span {
    text-align: center;
  }
}


/* —— Screen break / cognitive unlock overlay —— */
body.screen-break-open {
  overflow: hidden;
}

.screen-break {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.screen-break[hidden] {
  display: none;
}

.screen-break-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 18%, rgba(49, 46, 129, 0.6), transparent 55%),
    radial-gradient(ellipse 50% 40% at 50% 92%, rgba(34, 211, 238, 0.14), transparent 50%),
    rgba(5, 10, 20, 0.92);
  backdrop-filter: blur(8px);
}

.screen-break-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 28rem);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: var(--shadow);
  background-image:
    radial-gradient(ellipse 90% 60% at 100% 0%, rgba(49, 46, 129, 0.45), transparent 55%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(34, 211, 238, 0.08), transparent 50%);
  outline: none;
  text-align: center;
}

.screen-break-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.screen-break-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  color: var(--color-heading);
  letter-spacing: -0.02em;
}

.screen-break-desc {
  margin: 0 0 1rem;
  color: var(--color-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.screen-break-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.screen-break-countdown {
  margin-top: 0.5rem;
}

.screen-break-ring {
  display: grid;
  place-items: center;
  width: 6.5rem;
  height: 6.5rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  border: 3px solid rgba(34, 211, 238, 0.35);
  box-shadow:
    0 0 0 6px rgba(34, 211, 238, 0.08),
    inset 0 0 24px rgba(49, 46, 129, 0.35);
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-accent);
  font-variant-numeric: tabular-nums;
}

.screen-break-hint {
  margin: 0;
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.5;
}

.screen-break-puzzle {
  margin-top: 0.35rem;
}

.screen-break-puzzle-lead {
  margin: 0 0 1rem;
  color: var(--color-muted);
  font-size: 0.92rem;
}

.screen-break-pads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  max-width: 16rem;
  margin: 0 auto 1rem;
}

.screen-break-pad {
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 2px solid var(--color-border);
  background: var(--color-surface-2);
  cursor: pointer;
  position: relative;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease,
    background 0.12s ease;
}

.screen-break-pad::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: var(--pad-color, var(--color-accent));
  opacity: 0.35;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.screen-break-pad:hover:not(:disabled),
.screen-break-pad:focus-visible:not(:disabled) {
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}

.screen-break-pad:active:not(:disabled) {
  transform: scale(0.96);
}

.screen-break-pad.is-lit {
  border-color: var(--pad-color, var(--color-accent));
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.35), 0 0 28px color-mix(in srgb, var(--pad-color) 45%, transparent);
  background: var(--color-navy);
}

.screen-break-pad.is-lit::after {
  opacity: 1;
  transform: scale(1.08);
}

.screen-break-pad:disabled {
  cursor: default;
  opacity: 0.85;
}

.screen-break-puzzle-status {
  margin: 0 0 0.85rem;
  min-height: 1.4em;
  color: var(--color-text);
  font-size: 0.92rem;
}

.screen-break-replay {
  width: 100%;
  max-width: 16rem;
}

@media (max-width: 480px) {
  .screen-break {
    padding: 0.75rem;
    align-items: end;
  }

  .screen-break-panel {
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.5rem 1.15rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  }
}


/* Fixed top: centered TOWER / COMMUNE / WELL / MARKET + whisper Grok link */
.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 250;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 0.75rem;
  background: rgba(255, 245, 249, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.app-topbar .tablist {
  grid-column: 2;
  justify-self: center;
  background: transparent;
  border-bottom: none;
  padding: 0.35rem;
  gap: 0.25rem;
  overflow: visible;
}

.app-topbar .tablist [role="tab"] {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.grok-whisper {
  grid-column: 3;
  justify-self: end;
  margin-right: 0.25rem;
  font-size: 8px;
  line-height: 1.2;
  color: var(--color-heading);
  opacity: 0.18;
  text-decoration: none;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.grok-whisper:hover,
.grok-whisper:focus-visible {
  opacity: 0.55;
  color: var(--color-accent-hover);
}

body {
  padding-top: var(--topbar-h);
}

/* When login gate is open, keep topbar under the modal */
body.login-gate-open .app-topbar {
  z-index: 40;
}

.tabs.tabs--chrome {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.tabs.tabs--chrome .tab-panels {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: 0.5rem;
}


/* COMMUNE Front Page — never-ending scroll option */
.commune-endless-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  cursor: pointer;
  user-select: none;
}

.commune-endless-toggle input {
  accent-color: var(--color-accent);
}

.commune-feed-list.is-endless {
  max-height: min(70vh, 36rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 0.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  background: rgba(0, 0, 0, 0.12);
}

.commune-feed-sentinel {
  height: 1px;
  width: 100%;
  pointer-events: none;
}

.commune-feed-loading {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--color-muted);
  font-style: italic;
}

/* —— International edition: B&W vintage broadsheet (local WIP)
   Either [data-edition="international"] OR .commune-paper--broadsheet */
.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) {
  --color-bg: #f4efe4;
  --color-surface: #faf8f2;
  --color-surface-2: #ebe4d4;
  --color-border: #1a1a1a;
  --color-text: #111111;
  --color-muted: #3a3a3a;
  --color-heading: #000000;
  --color-accent: #000000;
  --color-accent-hover: #222222;
  --color-accent-dim: rgba(0, 0, 0, 0.08);
  --color-navy: #111111;
  --focus-ring: 0 0 0 3px rgba(0, 0, 0, 0.35);
  color: #111;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.03), transparent 42%),
    #f4efe4;
  font-family: "Old Standard TT", Georgia, "Times New Roman", Times, serif;
  border: 2px solid #111;
  padding: 0.75rem 0.85rem 1.35rem;
  box-shadow: 4px 4px 0 #111;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-banner {
  background: #fffef8;
  border: 1px dashed #333;
  border-radius: 0;
  color: #222;
  font-family: "IM Fell English", Georgia, serif;
  font-style: italic;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-banner strong {
  color: #000;
  font-style: normal;
  font-family: "Special Elite", "Courier New", Courier, monospace;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-banner code {
  color: #111;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-masthead {
  background: #fff;
  border-block: 4px double #000;
  border-top: 6px solid #000;
  color: #000;
  background-image: none;
  padding: 1.45rem 0.75rem 1.4rem;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-eyebrow {
  color: #000;
  font-family: "Special Elite", "Courier New", Courier, monospace;
  letter-spacing: 0.2em;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-title {
  font-family: "Chomsky", "UnifrakturMaguntia", "IM Fell English", Georgia, serif;
  font-size: clamp(3.8rem, 15vw, 8rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 0.9;
  text-transform: none;
  color: #000;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.1);
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-subtitle {
  font-family: "IM Fell English", Georgia, serif;
  font-style: italic;
  color: #222;
  font-size: 1.12rem;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-dateline,
.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-volume,
.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-price {
  color: #111;
  font-family: "Special Elite", "Courier New", Courier, monospace;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-dateline {
  border-top: 1px solid #111;
  border-bottom: 1px solid #111;
  padding: 0.4rem 0.2rem;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-rule {
  background: #000;
  height: 2px;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-edition-scope-label {
  color: #000;
  font-family: "Special Elite", "Courier New", Courier, monospace;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-edition-seg {
  background: #fff;
  border: 2px solid #000;
  border-radius: 0;
  gap: 0;
  padding: 0;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-edition-opt span {
  border-radius: 0;
  border: none;
  border-right: 1px solid #111;
  color: #333;
  background: transparent;
  font-family: "Special Elite", "Courier New", Courier, monospace;
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-edition-opt:last-child span {
  border-right: none;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-edition-opt:hover span {
  color: #000;
  background: #ebe4d4;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-edition-opt input:checked + span {
  color: #f4efe4;
  background: #000;
  border-color: #000;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-edition-opt input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35);
}

@media (min-width: 900px) {
  .commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-grid {
    grid-template-columns: minmax(9.5rem, 12.5rem) minmax(0, 1fr) minmax(9.5rem, 12.5rem);
    gap: 0;
  }

  .commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-col--left {
    padding-right: 0.95rem;
    border-right: 2px solid #111;
  }

  .commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-col--center {
    padding: 0 1rem;
  }

  .commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-col--right {
    padding-left: 0.95rem;
    border-left: 2px solid #111;
  }
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-col-heading {
  color: #000;
  border-bottom: 3px double #000;
  font-family: "Special Elite", "Courier New", Courier, monospace;
  letter-spacing: 0.12em;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-index-btn {
  border-radius: 0;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-index-btn:hover {
  background: #ebe4d4;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-index-btn.is-active,
.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-index-btn[aria-current="true"] {
  background: #ebe4d4;
  border-color: #111;
  box-shadow: inset 3px 0 0 #000;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-index-label {
  font-family: "IM Fell English", Georgia, serif;
  color: #000;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-index-desc,
.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-topics {
  color: #3a3a3a;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-topics a {
  color: #000;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-rule-block {
  border-top: 2px solid #000;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-section-kicker {
  font-family: "IM Fell English", Georgia, serif;
  color: #000;
  letter-spacing: 0;
  text-transform: none;
  border-bottom: 3px solid #000;
  padding-bottom: 0.3rem;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-dek {
  color: #222;
  font-family: "IM Fell English", Georgia, serif;
  font-style: italic;
  border-bottom: 1px solid #111;
  padding-bottom: 0.75rem;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-brief {
  border: 1px solid #111;
  background: #fff;
  border-radius: 0;
  padding: 0.75rem;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-brief-title {
  font-family: "Special Elite", "Courier New", Courier, monospace;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-brief-body {
  color: #222;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-compose label {
  color: #000;
  font-family: "Special Elite", "Courier New", Courier, monospace;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-compose textarea,
.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-compose textarea,
.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) input[type="text"],
.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) input[type="url"],
.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) textarea {
  background: #fff;
  border: 1px solid #111;
  border-radius: 0;
  color: #111;
  font-family: "Old Standard TT", Georgia, serif;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-compose textarea:focus-visible,
.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-compose textarea:focus-visible {
  border-color: #000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35);
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-compose {
  background: #ebe4d4;
  border-top: 2px solid #000;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .btn {
  border-radius: 0;
  font-family: "Special Elite", "Courier New", Courier, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.8rem;
  background: #000;
  color: #f4efe4;
  border: 2px solid #000;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .btn:hover {
  background: #222;
  color: #f4efe4;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .btn-secondary {
  background: #fff;
  color: #000;
  border: 2px solid #000;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .btn-secondary:hover {
  background: #ebe4d4;
  color: #000;
  border-color: #000;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-feed-item,
.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .paper-article {
  border-bottom: 1px solid #1a1a1a;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-feed-author {
  font-family: "Special Elite", "Courier New", Courier, monospace;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.82rem;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-feed-meta time {
  color: #3a3a3a;
  font-family: "Special Elite", "Courier New", Courier, monospace;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-feed-body {
  font-family: "Old Standard TT", Georgia, "Times New Roman", Times, serif;
  color: #111;
  font-size: 1.02rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-feed-item.is-lead .commune-feed-body {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.4;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-feed-list.is-endless {
  background: #fff;
  border: 1px solid #111;
  border-radius: 0;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-endless-toggle {
  color: #333;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-endless-toggle input {
  accent-color: #000;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-profile-preview {
  background: #fff;
  border: 2px solid #000;
  border-radius: 0;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-avatar {
  color: #f4efe4;
  background: #000;
  border: 2px solid #000;
  border-radius: 0;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-profile-name {
  color: #000;
  font-family: "IM Fell English", Georgia, serif;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-profile-bio,
.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-visibility-badge {
  color: #3a3a3a;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-visibility-badge.is-public {
  color: #000;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-visibility-badge.is-public .commune-vis-dot {
  background: #000;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-visibility-fieldset {
  background: #fff;
  border: 1px solid #111;
  border-radius: 0;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-vis-option input:checked + .commune-vis-card {
  box-shadow: inset 0 0 0 2px #000;
  background: #ebe4d4;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-layout {
  border: 2px solid #000;
  border-radius: 0;
  background: #fff;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-msg {
  background: #ebe4d4;
  border: 1px solid #111;
  border-radius: 0;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-msg--mine {
  background: #fff;
  border-color: #000;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-msg-author {
  color: #000;
  font-family: "Special Elite", "Courier New", Courier, monospace;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) .commune-status {
  background: #ebe4d4;
  border: 1px solid #111;
  border-radius: 0;
  color: #111;
}

.commune-paper:is([data-edition="international"], .commune-paper--broadsheet) a {
  color: #000;
}


/* COMMUNE read-only AI conglomeration */
.commune-ai-note {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.commune-social-kind {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-muted);
  margin-right: 0.35rem;
}

.commune-feed-item.is-social .commune-social-kind,
.commune-social-card .commune-social-kind {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.commune-social-board,
.commune-profile-gallery {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.commune-social-card,
.commune-profile-card {
  padding: 0.85rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
}

.commune-profile-card {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.commune-social-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.4rem;
}

.commune-paper .commune-feed-compose,
.commune-paper .commune-compose,
.commune-paper .commune-profile-form {
  display: none !important;
}


/* TOWER — user feed with uploads */
.tower-app {
  max-width: 42rem;
}

.tower-header {
  margin-bottom: 1.25rem;
}

.tower-title {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  color: var(--color-heading);
}

.tower-lead {
  margin: 0;
  color: var(--color-muted);
  max-width: 40rem;
}

.tower-compose {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  margin-bottom: 1rem;
}

.tower-upload-row {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 640px) {
  .tower-upload-row {
    grid-template-columns: 1fr;
  }
}

.tower-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tower-post {
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.tower-post-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.tower-author {
  font-weight: 700;
  color: var(--color-accent);
}

.tower-post-body {
  margin: 0 0 0.5rem;
  color: var(--color-text);
}

.tower-attachments {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tower-attach {
  font-size: 0.8rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-muted);
}

.tower-attach-kind {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.65rem;
  margin-right: 0.25rem;
  color: var(--color-heading);
}


/* TOWER layout: profile+messages rail | feed */
.tower-layout {
  display: grid;
  grid-template-columns: minmax(15rem, 18rem) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 900px) {
  .tower-layout {
    grid-template-columns: 1fr;
  }
}

.tower-rail {
  position: sticky;
  top: calc(var(--topbar-h, 3.25rem) + 0.75rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(100vh - var(--topbar-h, 3.25rem) - 1.5rem);
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.tower-avatar-wrap {
  position: relative;
  width: 5.5rem;
  height: 5.5rem;
  margin: 0 auto 0.5rem;
}

.tower-avatar {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 2px solid var(--color-border);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--color-heading);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.tower-avatar-upload {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  cursor: pointer;
}

.tower-avatar-upload input {
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.tower-profile-name {
  text-align: center;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--color-heading);
}

.tower-profile-form .form-group {
  margin-bottom: 0.65rem;
}

.tower-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
  min-height: 1.25rem;
}

.tower-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-heading);
}

.tower-profile-html-preview {
  margin: 0.5rem 0 0.75rem;
  padding: 0.65rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-size: 0.9rem;
  overflow: auto;
  max-height: 12rem;
}

.tower-profile-html-preview:empty {
  display: none;
}

.tower-messages-heading {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

.tower-messages-hint {
  margin-top: 0;
}

.tower-conv-list {
  max-height: 6rem;
  overflow: auto;
  margin-bottom: 0.5rem;
}

.tower-thread {
  border-top: 1px solid var(--color-border);
  padding-top: 0.5rem;
}

.tower-thread .commune-messages {
  max-height: 10rem;
  overflow: auto;
}

.tower-main {
  min-width: 0;
}

.tower-app {
  max-width: none;
  --tower-font: Georgia, "Times New Roman", Times, serif;
  --tower-feed-bg: #fff5f9;
  font-family: var(--tower-font);
}

[data-tower-app] .tower-layout--scrapbook,
[data-tower-app] .tower-sticker--feed .tower-main,
[data-tower-app] .tower-feed {
  font-family: var(--tower-font);
}

[data-tower-app] .tower-layout--scrapbook {
  background-color: var(--tower-feed-bg);
}

[data-tower-app] .tower-sticker--feed .tower-main {
  background-color: var(--tower-feed-bg);
  border-radius: var(--radius);
}

.tower-site-customize label[for="tower-feed-bg"],
.tower-site-customize label[for="tower-font"] {
  display: block;
  margin-top: 0.55rem;
}

.tower-site-customize input[type="color"] {
  display: block;
  width: 3.5rem;
  height: 2.25rem;
  padding: 0.15rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
}


/* TOWER badges — 3D object shelf (imagery / custom fonts; not dropdowns) */
.tower-badge-shelf {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.6rem 0.7rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
}

.tower-badge-shelf-label {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.tower-badge-stage {
  min-height: 3.5rem;
  border-radius: var(--radius-sm);
  background:
    radial-gradient(ellipse at 50% 70%, rgba(255, 255, 255, 0.08), transparent 65%),
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.2));
  perspective: 600px;
}


/* Founder soda-cap + gifted award pins on the shelf */
.tower-badge-stage {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 0.75rem 1rem;
  min-height: 11rem;
  padding: 0.5rem 0.35rem 0.85rem;
}

.tower-bottle-cap {
  margin: 0;
  transform: rotate(-2deg);
  filter: drop-shadow(2px 6px 4px rgba(0, 0, 0, 0.35));
  transition: transform 0.2s ease;
  text-align: center;
  max-width: 7.5rem;
}

.tower-bottle-cap--founder {
  max-width: 11.5rem;
}

.tower-bottle-cap:hover {
  transform: rotate(0deg) scale(1.04);
  z-index: 1;
}

.tower-bottle-cap img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

.tower-bottle-cap--founder img {
  width: 11.5rem;
}

.tower-awarded-pin {
  max-width: 5.75rem;
}

.tower-awarded-pin img {
  width: 5.5rem;
}

.tower-awarded-pin--yearbook {
  max-width: 6rem;
}

.tower-awarded-pin--yearbook img {
  width: 5.75rem;
}

.tower-badge-caption {
  display: block;
  margin: 0.35rem 0 0;
  font-size: 0.65rem;
  line-height: 1.25;
  color: var(--color-muted);
  font-weight: 600;
}

.tower-badge-caption-title {
  display: block;
  color: var(--color-text);
}

.tower-badge-caption-from {
  display: block;
  font-weight: 500;
  opacity: 0.9;
}

/* MARKET — business profiles (brands that gift Tower awards) */
.market-shell {
  padding: 0.25rem 0 0.5rem;
}

.market-intro h3 {
  margin: 0 0 0.35rem;
}

.market-lede {
  margin: 0 0 0.35rem;
  max-width: 40rem;
  color: var(--color-text);
}

.market-grid {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.85rem;
}

.market-card {
  margin: 0;
  padding: 0.9rem 0.95rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow);
}

.market-card-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  margin-bottom: 0.55rem;
}

.market-card-mark--sport {
  background: linear-gradient(145deg, #ff6b7a, #c41e3a);
}

.market-card-mark--cafe {
  background: linear-gradient(145deg, #c4a484, #8b5a2b);
}

.market-card-mark--games {
  background: linear-gradient(145deg, #6b8fd4, #2d5aa0);
}

.market-card-name {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.market-card-blurb {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--color-text);
}

.market-card-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--color-muted);
  font-weight: 600;
}

.tower-app {
  position: relative;
}

.tower-page-pins {
  pointer-events: none;
}

.tower-page-pin {
  position: absolute;
  width: 3.25rem;
  height: auto;
  z-index: 2;
  filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.35));
}

.tower-page-pin--tl {
  top: -0.35rem;
  left: 0.35rem;
  transform: rotate(-18deg);
}

.tower-page-pin--tr {
  top: -0.2rem;
  right: 0.5rem;
  transform: rotate(22deg) scaleX(-1);
}


.commune-feed-source {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.commune-profile-link {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.commune-paper.commune-paper--broadsheet .commune-profile-link {
  color: #000;
}


.commune-at-link {
  font-weight: 700;
  color: var(--color-accent);
  text-decoration: none;
}

.commune-paper.commune-paper--broadsheet .commune-at-link {
  color: #000;
  text-decoration: underline;
}

.tower-post-likes {
  margin: 0.25rem 0 0.4rem;
  font-size: 0.8rem;
  color: var(--color-muted);
}


.commune-fof-note {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--color-muted);
  text-align: center;
}

.commune-paper.commune-paper--broadsheet .commune-fof-note {
  color: #333;
  font-family: "Caveat", cursive;
  font-size: 1.05rem;
}


/* Tower public featured friends */
.tower-friends-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0 0.5rem;
}

.tower-friend-chip {
  appearance: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.tower-friend-chip.is-selected,
.tower-friend-chip[aria-pressed="true"] {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #4a2c3a;
  font-weight: 700;
}

.tower-friends-public {
  margin-top: 0.5rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.tower-friends-public-label {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.tower-friends-public-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tower-friend-public-link {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: var(--color-surface-2);
  color: var(--color-heading);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
}

.tower-friends-empty {
  font-size: 0.75rem;
  color: var(--color-muted);
}


.tower-profile {
  display: flex;
  flex-direction: column;
}

.tower-profile .tower-friends-display {
  order: 99;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}

.tower-friends-public {
  margin-top: 0.65rem;
}


/* Tower profile music player */
.tower-music {
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
}

.tower-music-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tower-music-toggle {
  flex: 0 0 auto;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
}

.tower-music-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tower-music-fields .tower-music-url-label {
  display: block;
  margin-top: 0.5rem;
}

.tower-music-enable {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.45rem;
  font-size: 0.85rem;
}

.tower-music[data-music-mode="youtube"] {
  padding: 0.4rem;
  max-width: 280px;
}

.tower-music-youtube[hidden] {
  display: none !important;
}

.tower-music-youtube-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111;
  border-radius: 6px;
  overflow: hidden;
}

.tower-music-youtube-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.tower-music-youtube-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
  min-width: 0;
}

.tower-music-youtube-bar .tower-music-classic-line {
  flex: 1 1 auto;
  min-width: 0;
}


.paper-edition-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1rem;
  margin-bottom: 0.35rem;
}

.paper-refresh-btn {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
}

.commune-paper.commune-paper--broadsheet .paper-refresh-btn {
  background: #fff;
  color: #000;
  border: 2px solid #000;
}


/* Music player skins */
.tower-music-skin[hidden] { display: none !important; }

.tower-music-skin--classic {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0;
}

.tower-music-classic-line {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--color-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tower-music-skin--classic .tower-music-toggle {
  border: none;
  background: transparent;
  font-size: 1rem;
  cursor: pointer;
  color: var(--color-accent);
}

/* Radio */
.tower-radio-face {
  background: linear-gradient(180deg, #d4b896, #a67c52);
  border: 3px solid #5c3d22;
  border-radius: 10px;
  padding: 0.45rem 0.5rem 0.55rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 2px 3px 0 rgba(0,0,0,0.2);
}

.tower-radio-dial {
  height: 0.35rem;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #222 0 2px, #f5e6c8 2px 6px);
  margin-bottom: 0.35rem;
}

.tower-radio-marquee {
  overflow: hidden;
  background: #1a1a1a;
  color: #9cff9c;
  font-family: "Special Elite", monospace;
  font-size: 0.72rem;
  padding: 0.25rem 0.35rem;
  border-radius: 4px;
  margin-bottom: 0.35rem;
}

.tower-radio-marquee span {
  display: inline-block;
  padding-left: 100%;
  animation: tower-marquee 12s linear infinite;
  white-space: nowrap;
}

@keyframes tower-marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

.tower-radio-knobs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.tower-radio-knobs i {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #eee, #666);
  border: 2px solid #333;
  display: block;
}

.tower-radio-toggle {
  width: 100%;
  font-size: 0.7rem;
  padding: 0.25rem;
  border: 2px solid #333;
  background: #f5e6c8;
  cursor: pointer;
  border-radius: 4px;
}

/* Side-of-page radio scroll */
.tower-radio-side {
  position: fixed;
  left: 0;
  top: 35%;
  z-index: 240;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  background: #1a1a1a;
  color: #9cff9c;
  border: 2px solid #5c3d22;
  border-left: none;
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 0.35rem;
  max-height: 40vh;
  overflow: hidden;
  pointer-events: none;
}

.tower-radio-side-track {
  overflow: hidden;
  height: 100%;
}

.tower-radio-side-track span {
  display: inline-block;
  animation: tower-side-scroll 14s linear infinite;
  white-space: nowrap;
  font-family: "Special Elite", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

@keyframes tower-side-scroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

body.tower-radio-scroll .tower-radio-side { display: block; }

/* CD */
.tower-cd-face {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  background: #2a2a2a;
  border-radius: 10px;
  padding: 0.45rem;
  border: 2px solid #111;
}

.tower-cd-disc {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #111 0 18%, transparent 19%),
    conic-gradient(from 0deg, #ddd, #888, #ddd, #555, #ddd);
  border: 2px solid #111;
  flex: 0 0 auto;
}

.tower-cd-disc.is-spinning {
  animation: tower-cd-spin 2.8s linear infinite;
}

@keyframes tower-cd-spin {
  to { transform: rotate(360deg); }
}

.tower-cd-readout {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.tower-cd-title {
  color: #cde;
  font-size: 0.72rem;
  font-family: ui-monospace, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tower-cd-readout .tower-music-toggle,
.tower-mp3-face .tower-music-toggle {
  font-size: 0.68rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid #666;
  background: #444;
  color: #eee;
  border-radius: 4px;
  cursor: pointer;
  align-self: flex-start;
}

/* MP3 */
.tower-mp3-face {
  background: linear-gradient(160deg, #6b7c8a, #3d4650);
  border-radius: 12px;
  padding: 0.45rem;
  border: 2px solid #222;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}

.tower-mp3-screen {
  background: #9bbf6a;
  color: #1a2a10;
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  padding: 0.35rem;
  border-radius: 4px;
  margin-bottom: 0.35rem;
  min-height: 2rem;
  overflow: hidden;
}

.tower-mp3-screen span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tower-mp3-buttons {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}

.tower-mp3-buttons b {
  flex: 1;
  height: 0.45rem;
  border-radius: 2px;
  background: #222;
  display: block;
}


/* Primary Home/About/Contact nav removed from header */
.site-nav,
.nav-toggle {
  display: none !important;
}


/* Top-right people search */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.people-search {
  position: relative;
  margin-left: auto;
  width: min(16rem, 42vw);
}

.people-search input[type="search"] {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 0.9rem;
}

.people-search input[type="search"]:focus {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--color-accent);
}

.people-search-results {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  width: min(20rem, 92vw);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 300;
  max-height: 16rem;
  overflow: auto;
  padding: 0.35rem;
}

.people-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
}

.people-search-row:hover {
  background: var(--color-surface-2);
}

.people-search-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.people-search-name {
  font-weight: 700;
  color: var(--color-heading);
  font-size: 0.9rem;
}

.people-search-handle {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.people-search-add {
  flex: 0 0 auto;
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
}

.people-search-empty {
  margin: 0;
  padding: 0.65rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}


.tower-handle-badge {
  text-align: center;
  margin: -0.35rem 0 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: 0.02em;
}

.tower-handle-badge:not([hidden]) {
  display: block;
}


.tower-social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
}

.tower-social-links[hidden] {
  display: none !important;
}

.tower-social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 1.85rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-heading);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.tower-social-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.tower-social-btn--x { background: #111; color: #fff; border-color: #111; }
.tower-social-btn--meta { background: #1877f2; color: #fff; border-color: #166fe5; }
.tower-social-btn--instagram { background: linear-gradient(135deg, #f58529, #dd2a7b 50%, #8134af); color: #fff; border-color: transparent; }
.tower-social-btn--youtube { background: #ff0000; color: #fff; border-color: #e00; }
.tower-social-btn--tiktok { background: #010101; color: #fff; border-color: #010101; }
.tower-social-btn--linkedin { background: #0a66c2; color: #fff; border-color: #0a66c2; }

.tower-social-fields-label {
  display: block;
  font-weight: 700;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  color: var(--color-heading);
}

.tower-social-fields label {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.78rem;
}

/* ===== TOWER avatar photography frames ===== */
.tower-avatar-mat {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}
.tower-avatar-frame-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 3;
}
.tower-avatar-wrap .tower-avatar-upload {
  z-index: 4;
}

/* Default circle */
.tower-avatar-wrap[data-tower-avatar-frame="none"] {
  width: 5.5rem;
  height: 5.5rem;
}
.tower-avatar-wrap[data-tower-avatar-frame="none"] .tower-avatar {
  border-radius: 50%;
}

/* Ornate gold oval — hero overlay */
.tower-avatar-wrap[data-tower-avatar-frame="ornate-gold"] {
  width: 7.25rem;
  height: 9.5rem;
  margin-bottom: 0.75rem;
}
.tower-avatar-wrap[data-tower-avatar-frame="ornate-gold"] .tower-avatar-mat {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 22%;
  bottom: 18%;
  width: auto;
  height: auto;
}
.tower-avatar-wrap[data-tower-avatar-frame="ornate-gold"] .tower-avatar {
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: none;
  clip-path: ellipse(48% 50% at 50% 50%);
  -webkit-clip-path: ellipse(48% 50% at 50% 50%);
}
.tower-avatar-wrap[data-tower-avatar-frame="ornate-gold"] .tower-avatar-upload {
  border-radius: 50%;
  left: 18%;
  right: 18%;
  top: 22%;
  bottom: 18%;
  inset: auto;
  width: auto;
  height: auto;
}

/* Magenta baroque — rectangular opening overlay (asset is landscape with centered frame) */
.tower-avatar-wrap[data-tower-avatar-frame="baroque-magenta"] {
  width: 9.5rem;
  height: 7.25rem;
  margin-bottom: 0.75rem;
}
.tower-avatar-wrap[data-tower-avatar-frame="baroque-magenta"] .tower-avatar-mat {
  position: absolute;
  left: 32%;
  right: 32%;
  top: 22%;
  bottom: 22%;
  width: auto;
  height: auto;
}
.tower-avatar-wrap[data-tower-avatar-frame="baroque-magenta"] .tower-avatar {
  width: 100%;
  height: 100%;
  border-radius: 0.15rem;
  border: none;
}
.tower-avatar-wrap[data-tower-avatar-frame="baroque-magenta"] .tower-avatar-upload {
  border-radius: 0.15rem;
  left: 32%;
  right: 32%;
  top: 22%;
  bottom: 22%;
  inset: auto;
}

/* Squiggly blob silhouette */
.tower-avatar-wrap[data-tower-avatar-frame="squiggly"] {
  width: 6.5rem;
  height: 7.75rem;
  margin-bottom: 0.65rem;
}
.tower-avatar-wrap[data-tower-avatar-frame="squiggly"] .tower-avatar {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
  -webkit-mask-image: url("../assets/frames/squiggly-mask.svg");
  mask-image: url("../assets/frames/squiggly-mask.svg");
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  box-shadow: 0 0 0 3px #2a2a2a, 0 4px 10px rgba(74, 44, 58, 0.25);
}
.tower-avatar-wrap[data-tower-avatar-frame="squiggly"] .tower-avatar-upload {
  border-radius: 30% / 25%;
}

/* CSS frames */
.tower-avatar-wrap[data-tower-avatar-frame="gallery-gold"] {
  width: 6.4rem;
  height: 7.4rem;
  padding: 0.45rem;
  background:
    linear-gradient(145deg, #f8e7a0, #c9a227 40%, #8a6a12 70%, #f0d56a);
  border-radius: 0.2rem;
  box-shadow:
    inset 0 0 0 2px rgba(255, 240, 180, 0.55),
    inset 0 0 0 5px #a67c00,
    0 6px 14px rgba(74, 44, 58, 0.22);
}
.tower-avatar-wrap[data-tower-avatar-frame="gallery-gold"] .tower-avatar {
  width: 100%;
  height: 100%;
  border-radius: 0.1rem;
  border: 3px solid #fff8e8;
}

.tower-avatar-wrap[data-tower-avatar-frame="walnut"] {
  width: 6.35rem;
  height: 7.35rem;
  padding: 0.4rem;
  background: linear-gradient(160deg, #6b3f24, #3e2414 55%, #8a5632);
  border-radius: 0.15rem;
  box-shadow:
    inset 0 0 0 1px rgba(255, 220, 180, 0.25),
    inset 0 0 0 4px #2a160c,
    0 5px 12px rgba(74, 44, 58, 0.25);
}
.tower-avatar-wrap[data-tower-avatar-frame="walnut"] .tower-avatar {
  width: 100%;
  height: 100%;
  border-radius: 0.08rem;
  border: 2px solid #f3e6d4;
}

.tower-avatar-wrap[data-tower-avatar-frame="polaroid"] {
  width: 6.4rem;
  height: 7.6rem;
  padding: 0.4rem 0.4rem 1.35rem;
  background: #fff;
  border-radius: 0.12rem;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9),
    0 8px 18px rgba(74, 44, 58, 0.22);
  transform: rotate(-2deg);
}
.tower-avatar-wrap[data-tower-avatar-frame="polaroid"] .tower-avatar {
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: none;
  background-color: #eee;
}
.tower-avatar-wrap[data-tower-avatar-frame="polaroid"]::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.35rem;
  height: 0.7rem;
  background: repeating-linear-gradient(
    -12deg,
    transparent,
    transparent 3px,
    rgba(244, 164, 196, 0.35) 3px,
    rgba(244, 164, 196, 0.35) 5px
  );
  pointer-events: none;
}

.tower-avatar-wrap[data-tower-avatar-frame="matte-black"] {
  width: 6.2rem;
  height: 7.1rem;
  padding: 0.55rem;
  background: #1a1a1a;
  border-radius: 0.15rem;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 6px 14px rgba(74, 44, 58, 0.28);
}
.tower-avatar-wrap[data-tower-avatar-frame="matte-black"] .tower-avatar {
  width: 100%;
  height: 100%;
  border-radius: 0.05rem;
  border: 1px solid #333;
}

/* ===== TOWER avatar photo ornaments (above/below, not over face) ===== */
.tower-avatar-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 0.5rem;
  gap: 0.12rem;
}
.tower-avatar-stack > .tower-avatar-wrap {
  margin: 0;
  order: 1;
  flex: 0 0 auto;
}
.tower-avatar-ornament {
  display: block;
  width: 72%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  flex: 0 0 auto;
  z-index: 2;
  /* ~60–80% of avatar/frame width via parent max-content width */
}
.tower-avatar-stack[data-tower-avatar-ornament="none"] .tower-avatar-ornament,
.tower-avatar-ornament[hidden] {
  display: none !important;
}
.tower-avatar-stack[data-tower-avatar-ornament-pos="above"] .tower-avatar-ornament {
  order: 0;
}
.tower-avatar-stack[data-tower-avatar-ornament-pos="below"] .tower-avatar-ornament {
  order: 2;
}
.tower-ornament-pos-label {
  margin-top: 0.55rem;
}

/* Frame picker chips */
.tower-frame-fields-label {
  font-weight: 700;
  color: var(--color-heading);
  margin: 0 0 0.2rem;
}
.tower-frame-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.4rem 0 0.25rem;
}
.tower-frame-chip {
  appearance: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 999px;
  padding: 0.22rem 0.5rem 0.22rem 0.28rem;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
/* Frame picker: image-only tiles (no text labels) */
[data-tower-frame-chips] .tower-frame-chip {
  border-radius: 0.55rem;
  padding: 0.28rem;
  gap: 0;
}
[data-tower-frame-chips] .tower-frame-chip-swatch {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.35rem;
}
.tower-frame-chip.is-selected,
.tower-frame-chip[aria-pressed="true"] {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #4a2c3a;
  font-weight: 700;
}
.tower-frame-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.tower-frame-chip-swatch {
  width: 1rem;
  height: 1rem;
  border-radius: 0.2rem;
  border: 1px solid rgba(74, 44, 58, 0.2);
  flex: 0 0 auto;
}
.tower-frame-chip-swatch--none { background: var(--color-surface-2); border-radius: 50%; }
.tower-frame-chip-swatch--ornate-gold {
  background: url("../assets/frames/ornate-gold-oval-cutout.png") center/cover no-repeat, #f5e6b8;
}
.tower-frame-chip-swatch--baroque-magenta {
  background: url("../assets/frames/baroque-magenta-gold-cutout.png") center/cover no-repeat, #c2185b;
}
.tower-frame-chip-swatch--squiggly {
  background: #2a2a2a;
  border-radius: 40% 55% 45% 60% / 50% 40% 60% 45%;
}
.tower-frame-chip-swatch--gallery-gold { background: linear-gradient(135deg, #f8e7a0, #a67c00); }
.tower-frame-chip-swatch--walnut { background: linear-gradient(135deg, #6b3f24, #3e2414); }
.tower-frame-chip-swatch--polaroid { background: #fff; box-shadow: inset 0 -3px 0 #f4a4c4; }
.tower-frame-chip-swatch--matte-black { background: #1a1a1a; }
.tower-frame-chip-swatch--elegant-bow {
  background: url("../assets/frames/ornament-elegant-bow-320.png") center/contain no-repeat, #ffd0e4;
  border-radius: 50%;
}
.tower-frame-chip-swatch--bowtie {
  background: url("../assets/frames/ornament-bowtie-280.png") center/contain no-repeat, #222;
  border-radius: 50%;
}

/* ===== Scrapbook / iMessage-sticker widgets ===== */
.tower-scrapbook-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}
.tower-scrapbook-hint {
  margin: 0;
  flex: 1 1 12rem;
}
.tower-layout--scrapbook {
  position: relative;
  min-height: 70vh;
  display: block;
  /* stickers free over canvas; not a rigid grid */
}
.tower-layout--scrapbook > .tower-rail,
.tower-layout--scrapbook > .tower-sticker--feed {
  /* overridden when sticker mode positions them */
}

.tower-sticker {
  position: relative; /* flow until edit/placed */
  z-index: 1;
  touch-action: none;
}
.tower-layout--scrapbook.is-sticker-stage {
  position: relative;
  min-height: 1100px;
  width: 100%;
}
.tower-layout--scrapbook.is-sticker-stage > .tower-rail {
  position: static;
  max-height: none;
  overflow: visible;
  border: none;
  background: transparent;
  padding: 0;
  display: block;
}
.tower-layout--scrapbook.is-sticker-stage .tower-sticker {
  position: absolute;
  left: var(--sticker-x, 2%);
  top: var(--sticker-y, 2%);
  z-index: var(--sticker-z, 1);
  width: max-content;
  max-width: min(22rem, 92%);
  margin: 0;
  transform: rotate(var(--sticker-tilt, 0deg));
  transition: box-shadow 0.15s ease;
}
.tower-layout--scrapbook.is-sticker-stage .tower-sticker--feed {
  max-width: min(42rem, 96%);
  width: min(42rem, 58%);
}
/* ===== TOWER Edit profile dropdown (attached under avatar) ===== */
.tower-profile-edit {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0.15rem 0 0;
  z-index: 6;
}
.tower-edit-profile-btn {
  width: 100%;
  max-width: 11rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  gap: 0.35rem;
  background: rgba(255, 245, 249, 0.95);
  border: 1px solid var(--color-border);
  color: var(--color-heading);
  box-shadow: 0 2px 8px rgba(74, 44, 58, 0.08);
}
.tower-edit-profile-btn:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
}
.tower-edit-profile-chevron {
  display: inline-block;
  font-size: 0.65rem;
  line-height: 1;
  transition: transform 0.15s ease;
}
.tower-profile-edit.is-open .tower-edit-profile-chevron {
  transform: rotate(180deg);
}
.tower-profile-edit-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(18rem, 88vw);
  max-height: min(70vh, 32rem);
  overflow: auto;
  padding: 0.7rem 0.75rem 0.85rem;
  background: rgba(255, 245, 249, 0.98);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(74, 44, 58, 0.18);
  z-index: 40;
}
.tower-profile-edit-dropdown[hidden] {
  display: none !important;
}
.tower-layout--scrapbook.is-sticker-stage .tower-sticker--avatar {
  overflow: visible;
}
.tower-layout--scrapbook.is-sticker-stage .tower-sticker--avatar.is-edit-open {
  z-index: 50 !important;
}
.tower-profile-edit-dropdown .tower-profile-form .form-group {
  margin-bottom: 0.55rem;
}
.tower-profile-edit-dropdown .form-actions {
  margin-top: 0.35rem;
}

.tower-layout--scrapbook.is-sticker-stage .tower-sticker--messages {
  width: min(18rem, 90%);
  max-width: 20rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.55rem;
  max-height: 22rem;
  overflow: auto;
}
.tower-layout--scrapbook.is-sticker-stage .tower-sticker--badges,
.tower-layout--scrapbook.is-sticker-stage .tower-sticker--friends,
.tower-layout--scrapbook.is-sticker-stage .tower-sticker--html,
.tower-layout--scrapbook.is-sticker-stage .tower-sticker--music,
.tower-layout--scrapbook.is-sticker-stage .tower-sticker--social,
.tower-layout--scrapbook.is-sticker-stage .tower-sticker--identity,
.tower-layout--scrapbook.is-sticker-stage .tower-sticker--avatar {
  background: rgba(255, 234, 243, 0.92);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.4rem 0.5rem;
  box-shadow: 0 4px 14px rgba(74, 44, 58, 0.08);
}

.tower-sticker-handle {
  display: none;
  position: absolute;
  top: -0.45rem;
  right: -0.45rem;
  z-index: 5;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-accent);
  color: var(--color-heading);
  font-size: 0.7rem;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 2px 6px rgba(74, 44, 58, 0.2);
}
.tower-layout--scrapbook.is-editing .tower-sticker-handle {
  display: grid;
  place-items: center;
}
.tower-layout--scrapbook.is-editing .tower-sticker-handle[hidden] {
  display: grid !important;
}
.tower-sticker-handle:active {
  cursor: grabbing;
}
.tower-layout--scrapbook.is-editing .tower-sticker {
  outline: 1.5px dashed var(--color-accent);
  outline-offset: 3px;
}
.tower-layout--scrapbook.is-editing .tower-sticker.is-dragging {
  outline-color: var(--color-heading);
  box-shadow: 0 10px 28px rgba(74, 44, 58, 0.22);
  z-index: 999 !important;
}
.tower-layout--scrapbook .tower-sticker.is-dragging {
  opacity: 0.96;
}

.tower-profile-html-public:empty {
  display: none;
}
.tower-profile-html-public:not(:empty) {
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  max-width: 18rem;
}

@media (max-width: 900px) {
  .tower-layout--scrapbook.is-sticker-stage {
    min-height: 1200px;
  }
  .tower-layout--scrapbook.is-sticker-stage .tower-sticker--feed {
    width: 94%;
    max-width: 94%;
  }
}

/* ===== TOWER collage page backgrounds ===== */
.tower-collage-panel {
  margin: 0 0 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  padding: 0.35rem 0.7rem 0.55rem;
}
.tower-collage-summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--color-heading);
  padding: 0.35rem 0;
  list-style: none;
}
.tower-collage-summary::-webkit-details-marker { display: none; }
.tower-collage-body { padding: 0.25rem 0 0.35rem; }
.tower-collage-cells {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.45rem;
  margin: 0.5rem 0;
}
.tower-collage-cell-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.tower-collage-cell-field label {
  font-size: 0.72rem;
  color: var(--color-muted);
}
.tower-collage-cell-field input {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
}
.tower-collage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.tower-layout--scrapbook {
  isolation: isolate;
}
.tower-collage-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: var(--radius);
  background: transparent;
}
.tower-collage-stage[data-layout="none"],
.tower-collage-stage:empty {
  display: none;
}
.tower-collage-stage .tower-collage-grid {
  position: absolute;
  inset: 0;
  display: grid;
  gap: 0.35rem;
  padding: 0.35rem;
}
.tower-collage-stage[data-layout="grid-3x3"] .tower-collage-grid {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}
.tower-collage-stage[data-layout="grid-2x3"] .tower-collage-grid {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr);
}
.tower-collage-stage[data-layout="masonry"] .tower-collage-grid {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
}
.tower-collage-stage[data-layout="masonry"] .tower-collage-tile:nth-child(1) { grid-row: span 2; }
.tower-collage-stage[data-layout="masonry"] .tower-collage-tile:nth-child(4) { grid-row: span 2; }
.tower-collage-stage[data-layout="masonry"] .tower-collage-tile:nth-child(7) { grid-row: span 2; }
.tower-collage-stage[data-layout="hero-smalls"] .tower-collage-grid {
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.tower-collage-stage[data-layout="hero-smalls"] .tower-collage-tile:first-child {
  grid-row: 1 / span 2;
}
.tower-collage-stage[data-layout="polaroid-scatter"] .tower-collage-grid {
  display: block;
  position: relative;
}
.tower-collage-stage[data-layout="polaroid-scatter"] .tower-collage-tile {
  position: absolute;
  width: 28%;
  height: 32%;
  padding: 0.35rem 0.35rem 1rem;
  background: #fff;
  box-shadow: 0 6px 16px rgba(74, 44, 58, 0.18);
  border-radius: 0.12rem;
}
.tower-collage-stage[data-layout="polaroid-scatter"] .tower-collage-tile:nth-child(1) { left: 4%; top: 6%; transform: rotate(-6deg); }
.tower-collage-stage[data-layout="polaroid-scatter"] .tower-collage-tile:nth-child(2) { left: 36%; top: 10%; transform: rotate(4deg); }
.tower-collage-stage[data-layout="polaroid-scatter"] .tower-collage-tile:nth-child(3) { left: 66%; top: 5%; transform: rotate(-3deg); }
.tower-collage-stage[data-layout="polaroid-scatter"] .tower-collage-tile:nth-child(4) { left: 10%; top: 40%; transform: rotate(5deg); }
.tower-collage-stage[data-layout="polaroid-scatter"] .tower-collage-tile:nth-child(5) { left: 42%; top: 38%; transform: rotate(-4deg); }
.tower-collage-stage[data-layout="polaroid-scatter"] .tower-collage-tile:nth-child(6) { left: 70%; top: 42%; transform: rotate(7deg); }
.tower-collage-stage[data-layout="polaroid-scatter"] .tower-collage-tile:nth-child(7) { left: 6%; top: 68%; transform: rotate(-2deg); }
.tower-collage-stage[data-layout="polaroid-scatter"] .tower-collage-tile:nth-child(8) { left: 38%; top: 66%; transform: rotate(3deg); }
.tower-collage-stage[data-layout="polaroid-scatter"] .tower-collage-tile:nth-child(9) { left: 68%; top: 70%; transform: rotate(-5deg); }

.tower-collage-tile {
  border-radius: 0.35rem;
  background-size: cover;
  background-position: center;
  background-color: var(--tile-color, var(--color-surface-2));
  border: 1px solid rgba(245, 182, 208, 0.65);
  min-height: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.tower-collage-stage[data-layout="polaroid-scatter"] .tower-collage-tile > .tower-collage-tile-photo {
  width: 100%;
  height: 100%;
  border-radius: 0.08rem;
  background-size: cover;
  background-position: center;
  background-color: inherit;
}

/* Stickers above collage */
.tower-layout--scrapbook.is-sticker-stage .tower-sticker {
  z-index: var(--sticker-z, 2);
}
.tower-layout--scrapbook.is-sticker-stage .tower-rail {
  z-index: 1;
  position: relative;
}


/* Badge cutouts — never a white plate behind pins/patches */
.tower-bottle-cap,
.tower-awarded-pin,
.tower-badge-stage figure {
  background: transparent;
}
.tower-bottle-cap img,
.tower-awarded-pin img {
  background: transparent;
}

.tower-frame-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.55rem;
}

/* Full-page sticker canvas — widgets are free across the whole Tower */
.tower-layout--scrapbook.is-sticker-stage {
  position: relative;
  min-height: 1100px;
  width: 100%;
}
.tower-layout--scrapbook.is-editing .tower-sticker {
  cursor: grab;
}
.tower-layout--scrapbook.is-editing .tower-sticker.is-dragging {
  cursor: grabbing;
  opacity: 0.95;
}
.tower-layout--scrapbook.is-sticker-stage > .tower-profile,
.tower-layout--scrapbook.is-sticker-stage > .tower-rail {
  /* rail emptied after reparent; keep harmless */
  min-height: 0;
}

/* no blue C mark — wordmark only */
.brand-logo,
.logo-mark,
[data-brand-logo],
[data-brand-mark] {
  display: none !important;
}
