:root {
  color-scheme: dark;
  --bg: #070b12;
  --bg-alt: #0b1220;
  --card: #11192a;
  --card-2: #0e1627;
  --text: #e7edf7;
  --muted: #9aa8c1;
  --border: rgba(158, 181, 216, 0.2);
  --accent: #5b8cff;
  --ok: #28c184;
  --danger: #f16262;
  --shadow: 0 20px 50px rgba(1, 6, 16, 0.5);
  --ring: rgba(91, 140, 255, 0.55);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% -12%, rgba(91, 140, 255, 0.22), transparent 42%),
    radial-gradient(circle at 88% -4%, rgba(40, 193, 132, 0.12), transparent 32%),
    linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
  color: var(--text);
}

body.pwa-standalone {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

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

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(100%, 48rem);
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

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

.topbar {
  flex-direction: column;
  align-items: stretch;
  padding: 0.5rem 0 1rem;
}

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.topbar-username-link {
  font-weight: 700;
  text-decoration: none;
}

.topbar-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 1.15rem;
  font-weight: 600;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--text);
}

.page {
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  backdrop-filter: blur(8px);
}

.inset-card {
  background: var(--card-2);
  box-shadow: none;
}

.hero h1,
.viewer-card h1,
.admin-card h1,
.prose-card h1 {
  margin: 0.25rem 0 0.75rem;
  line-height: 1.1;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.lede,
.prose-card p,
.prose-card li {
  color: var(--muted);
  line-height: 1.6;
}

.tab-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem;
  margin-bottom: 1rem;
}

@media (min-width: 720px) {
  .tab-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.tab-button,
.primary-button,
.destructive-button,
.status-button,
.blur-card,
.icon-button,
.link-button {
  border: 1px solid transparent;
  border-radius: 0.9rem;
  padding: 0.78rem 0.9rem;
  font-weight: 600;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.tab-button {
  background: rgba(152, 175, 211, 0.12);
  color: var(--muted);
  border-color: rgba(152, 175, 211, 0.2);
}

.tab-button.is-active {
  background: rgba(91, 140, 255, 0.2);
  border-color: rgba(91, 140, 255, 0.35);
  color: #fff;
  box-shadow: 0 8px 24px rgba(91, 140, 255, 0.18);
}

#tab-btn-send {
  background: rgba(91, 140, 255, 0.16);
  border-color: rgba(91, 140, 255, 0.32);
  color: rgba(218, 230, 255, 0.95);
}

#tab-btn-send.is-active {
  background: rgba(91, 140, 255, 0.3);
  border-color: rgba(91, 140, 255, 0.5);
  color: #fff;
  box-shadow: 0 8px 24px rgba(91, 140, 255, 0.22);
}

#tab-btn-check {
  background: rgba(246, 196, 71, 0.2);
  border-color: rgba(246, 196, 71, 0.4);
  color: rgba(255, 247, 209, 0.95);
}

#tab-btn-check.is-active {
  background: rgba(246, 196, 71, 0.32);
  border-color: rgba(246, 196, 71, 0.52);
  color: #fff9e6;
  box-shadow: 0 8px 24px rgba(246, 196, 71, 0.24);
}

.stack-form {
  display: grid;
  gap: 0.9rem;
}

.tab-descriptions {
  display: grid;
  gap: 0.4rem;
  margin: 0.15rem 0 1rem;
}

.tab-descriptions p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.95rem;
  padding: 0.9rem 0.95rem;
  background: rgba(6, 12, 22, 0.58);
  color: var(--text);
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.input-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.icon-button {
  width: 3.15rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(91, 140, 255, 0.14);
  border-color: rgba(91, 140, 255, 0.28);
  color: var(--accent);
}

.icon-button svg {
  width: 1.5rem;
  height: 1.5rem;
}

.icon-button span {
  font-size: 1.25rem;
  line-height: 1;
}

textarea {
  resize: vertical;
  min-height: 6.5rem;
}

.status-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.status-button,
.primary-button,
.destructive-button,
.icon-button,
.link-button {
  cursor: pointer;
  min-height: 3.15rem;
}

.compact-button {
  min-height: 2.55rem;
  padding-top: 0.56rem;
  padding-bottom: 0.56rem;
}

.status-button.ok {
  background: rgba(40, 193, 132, 0.15);
  border-color: rgba(40, 193, 132, 0.38);
  color: #fff;
}

.status-button.not-ok,
.destructive-button {
  background: rgba(241, 98, 98, 0.15);
  border-color: rgba(241, 98, 98, 0.38);
  color: #fff;
}

.primary-button {
  background: rgba(91, 140, 255, 0.16);
  border-color: rgba(91, 140, 255, 0.34);
  color: #fff;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.text-link-button {
  border: none;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  padding: 0;
  min-height: unset;
  cursor: pointer;
  text-decoration: underline;
}

.auth-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.field-with-action .input-action-row {
  position: relative;
}

.input-inline-action {
  width: 2.55rem;
  min-height: 2.55rem;
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  box-shadow: none;
}

.field-with-action .input-action-row input {
  padding-right: 3.15rem;
}

.input-inline-action:hover:not(:disabled),
.input-inline-action:active:not(:disabled) {
  transform: translateY(-50%);
  box-shadow: none;
  background: transparent;
}

.verification-link {
  min-width: 6.5rem;
  text-transform: lowercase;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  justify-self: end;
}

.verification-link[data-state='verified'] {
  color: var(--ok);
  background: rgba(25, 135, 84, 0.12);
  cursor: default;
}

.verification-link[data-state='unverified'] {
  color: var(--danger);
  background: rgba(192, 50, 33, 0.12);
}

.turnstile-shell {
  min-height: 4.1rem;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 1rem;
  color: var(--muted);
  padding: 0.5rem;
  background: rgba(8, 15, 27, 0.38);
}

#turnstile-global-widget {
  display: flex;
  justify-content: center;
}

.feedback {
  min-height: 1.5rem;
  margin-top: 0.75rem;
  color: var(--muted);
}

.feedback[data-tone='error'] {
  color: var(--danger);
}

.feedback[data-tone='success'] {
  color: var(--ok);
}

.hidden {
  display: none !important;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(91, 140, 255, 0.14);
  font-weight: 800;
}

.status-pill[data-state='ok'] {
  background: rgba(25, 135, 84, 0.12);
  color: var(--ok);
}

.status-pill[data-state='not-ok'] {
  background: rgba(192, 50, 33, 0.12);
  color: var(--danger);
}

.timestamp-copy {
  margin: 1rem 0;
  color: var(--muted);
}

.blur-card {
  width: 100%;
  border-color: rgba(91, 140, 255, 0.24);
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.22), rgba(18, 28, 45, 0.72));
  color: var(--text);
  backdrop-filter: blur(10px);
  margin-bottom: 1rem;
}

button:hover:not(:disabled),
.link-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(3, 10, 24, 0.35);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

input:hover,
textarea:hover {
  border-color: rgba(158, 181, 216, 0.35);
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--ring);
  outline: none;
}

#user-dashboard {
  border-color: rgba(162, 184, 219, 0.24);
  display: grid;
  gap: 1.4rem;
}

#user-dashboard .eyebrow,
#user-dashboard h2 {
  margin: 0;
}

#user-dashboard .stack-form {
  gap: 0.72rem;
}

#user-dashboard .primary-button,
#user-dashboard .destructive-button,
#user-dashboard .status-button,
#user-dashboard .link-button,
#user-dashboard .icon-button,
#user-dashboard .blur-card {
  min-height: 2.45rem;
  padding: 0.55rem 0.8rem;
  border-radius: 0.72rem;
  font-size: 0.92rem;
  font-weight: 600;
}

#user-dashboard .status-actions {
  gap: 1.15rem;
}

#user-dashboard > .primary-button {
  margin-top: 0.2rem;
}

.metric {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 800;
}

.footer {
  flex-direction: column;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  margin-top: 1.5rem;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.prose-card h2 {
  margin-top: 1.4rem;
}

#send-panel-codewords .codewords-heading {
  margin: 1.25rem 0 0.5rem;
}

#send-panel-codewords > .card {
  margin-top: 0;
}


  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.6rem;
}

#user-codeword-list li {
  display: grid;
  gap: 0.4rem;
}

.codeword-actions {
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pinger-register-note {
  margin-top: 0.75rem;
  color: var(--muted);
}

#follows-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.65rem;
}

.follows-row {
  display: grid;
  gap: 0.45rem;
}

.follows-row .status-pill {
  width: fit-content;
}

.toast-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 0.75rem 0.9rem;
  border-radius: 0.8rem;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  max-width: min(34rem, calc(100vw - 2rem));
}

.toast-popup button {
  min-height: unset;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

@media (min-width: 768px) {
  .shell {
    padding: 1.5rem 1.5rem 3rem;
  }

  .card {
    padding: 1.5rem;
  }
}

/* ── Accessibility & interactive state ─────────────────────────────────────── */

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Reset generic input styles for checkboxes so they don't get
   width:100% / padding / border-radius from the input rule above. */
input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  accent-color: var(--danger);
}

.confirm-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
}

.confirm-label input[type="checkbox"] {
  margin-top: 0.15rem;
}

.ip-share-prompt {
  border: 1px solid rgba(192, 50, 33, 0.28);
  border-radius: 0.8rem;
  padding: 0.7rem 0.8rem;
  background: rgba(192, 50, 33, 0.08);
}

.ip-share-prompt .confirm-label small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
}

.pinger-ip-caveat {
  margin: 0.45rem 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.char-count {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
  text-align: right;
}

.char-count.near-limit {
  color: var(--danger);
}

/* ── Tab panel animation ───────────────────────────────────────────────────── */

@keyframes panel-reveal {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tab-panel.is-active {
  animation: panel-reveal 200ms ease forwards;
}

/* ── Turnstile inside home-tabs card ───────────────────────────────────────── */

.home-tabs-verify {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .shell {
    width: min(100%, 40rem);
    padding:
      max(0.75rem, env(safe-area-inset-top))
      0.8rem
      max(1.4rem, env(safe-area-inset-bottom) + 0.6rem);
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    margin: -0.25rem 0 0.8rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: rgba(12, 18, 32, 0.78);
    backdrop-filter: blur(12px);
  }

  .topbar-main {
    align-items: flex-start;
    gap: 0.85rem;
  }

  .topbar-actions {
    margin-left: auto;
  }
}

/* ── Pitch / marketing card ────────────────────────────────────────────────── */

.pitch-card {
  border-color: rgba(91, 140, 255, 0.28);
  background: linear-gradient(145deg, rgba(17, 26, 45, 0.95), var(--card));
}

.pitch-headline {
  margin: 0.4rem 0 0.7rem;
  font-size: clamp(1.35rem, 4vw, 1.8rem);
  line-height: 1.2;
  font-weight: 800;
}

.pitch-lede {
  margin: 0 0 1.4rem;
  color: var(--muted);
  line-height: 1.65;
}

.pitch-features {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: grid;
  gap: 1rem;
}

@media (min-width: 600px) {
  .pitch-features {
    grid-template-columns: repeat(2, 1fr);
  }
}

.pitch-feature {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.9rem;
}

.pitch-icon {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.pitch-feature strong {
  display: block;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.pitch-feature p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.pitch-cta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  font-size: 1rem;
  font-weight: 700;
  background: rgba(91, 140, 255, 0.22);
  border-color: rgba(91, 140, 255, 0.48);
  letter-spacing: 0.01em;
}

.pitch-columns {
  display: grid;
  gap: 0.9rem;
  margin: 0 0 1.4rem;
}

@media (min-width: 700px) {
  .pitch-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.pitch-subcard {
  margin: 0;
  padding: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: rgba(8, 15, 27, 0.38);
}

.pitch-subcard h3 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
}

.pitch-subcard ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  display: grid;
  gap: 0.45rem;
}

.pitch-compare {
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: rgba(8, 15, 27, 0.42);
  padding: 0.95rem;
  margin: 0 0 1.2rem;
}

.pitch-compare h3 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
}

.pitch-compare > p {
  margin: 0 0 0.75rem;
  color: var(--muted);
  line-height: 1.55;
}

.pitch-compare-grid {
  display: grid;
  gap: 0.7rem;
}

@media (min-width: 720px) {
  .pitch-compare-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.pitch-compare-item {
  margin: 0;
  padding: 0.75rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(158, 181, 216, 0.24);
  background: rgba(255, 255, 255, 0.025);
}

.pitch-compare-item strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.pitch-compare-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.update-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
}

.update-banner button {
  padding: 0.3rem 0.75rem;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 6px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.update-banner button:hover {
  background: rgba(255,255,255,0.35);
}
