:root {
  color-scheme: dark;
  --graphite: #24323A;
  --deep-graphite: #18252B;
  --gold: #D9B967;
  --paper: #F1EEE7;
  --mist: #AEB7B2;
  --line: rgb(241 238 231 / 22%);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--graphite);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--graphite);
  color: var(--paper);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  color: inherit;
  font: inherit;
}

.page-shell {
  display: grid;
  width: min(100%, 112rem);
  min-height: 100vh;
  min-height: 100svh;
  grid-template-rows: auto 1fr auto;
  margin: 0 auto;
  padding:
    max(0.75rem, env(safe-area-inset-top))
    max(1.2rem, env(safe-area-inset-right))
    max(0.85rem, env(safe-area-inset-bottom))
    max(1.2rem, env(safe-area-inset-left));
}

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

.brand {
  color: rgb(241 238 231 / 86%);
  font-size: 0.92rem;
  font-weight: 520;
  letter-spacing: 0.015em;
}

.info-button {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--gold);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.info-button:hover {
  border-color: var(--gold);
  background: rgb(217 185 103 / 9%);
}

.main {
  display: grid;
  min-height: 0;
  place-items: center;
}

.hero {
  display: flex;
  width: min(100%, 48rem);
  flex-direction: column;
  align-items: center;
  padding: clamp(0.4rem, 2svh, 1.2rem) 0;
  text-align: center;
}

.thread-art {
  width: min(100%, 34rem);
  height: clamp(8.7rem, 24svh, 13.8rem);
  margin: 0 auto clamp(0.2rem, 1.3svh, 0.9rem);
  overflow: visible;
}

.thread-art svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.thread-line {
  fill: none;
  stroke: url(#thread-light);
  stroke-linecap: round;
  stroke-width: 1.4;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw-thread 1700ms cubic-bezier(0.22, 0.8, 0.24, 1) forwards;
}

.line-two {
  animation-delay: 330ms;
  opacity: 0.82;
}

.line-three {
  animation-delay: 640ms;
  opacity: 0.72;
}

.line-four {
  animation-delay: 930ms;
  opacity: 0.68;
}

.node-halo {
  fill: var(--gold);
  opacity: 0;
  transform: scale(0.35);
  transform-box: fill-box;
  transform-origin: center;
  animation: node-arrive 700ms ease-out forwards;
}

.halo-two { animation-delay: 260ms; }
.halo-three { animation-delay: 520ms; }
.halo-four { animation-delay: 760ms; }
.halo-five { animation-delay: 920ms; }
.halo-six { animation-delay: 1150ms; }
.halo-seven { animation-delay: 1380ms; }
.halo-eight { animation-delay: 1590ms; }
.halo-nine { animation-delay: 1800ms; }
.halo-ten { animation-delay: 2010ms; }

.node {
  fill: var(--paper);
  opacity: 0;
  transform: scale(0.45);
  transform-box: fill-box;
  transform-origin: center;
  animation: node-arrive 600ms ease-out forwards;
}

.node-two { animation-delay: 180ms; }
.node-three { animation-delay: 400ms; }
.node-four { animation-delay: 630ms; }
.node-five { animation-delay: 820ms; }
.node-six { animation-delay: 1030ms; }
.node-seven { animation-delay: 1240ms; }
.node-eight { animation-delay: 1460ms; }
.node-nine { animation-delay: 1680ms; }
.node-ten { animation-delay: 1900ms; }

.pulse {
  fill: #FFF2C6;
  opacity: 0;
  animation: pulse-arrive 500ms ease 2.3s forwards;
}

.pulse-two {
  fill: var(--gold);
  animation-delay: 5.1s;
}

.pulse-three {
  fill: var(--paper);
  animation-delay: 6.8s;
}

h1 {
  max-width: 20ch;
  margin: 0;
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: clamp(1.85rem, 7.5vw, 3.55rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.1;
  text-wrap: balance;
}

.intro {
  max-width: 39ch;
  margin: 0.85rem 0 0;
  color: rgb(241 238 231 / 78%);
  font-size: clamp(0.93rem, 3.9vw, 1.08rem);
  font-weight: 400;
  line-height: 1.5;
  text-wrap: balance;
}

.beginning {
  margin: 0.7rem 0 0;
  color: var(--gold);
  font-size: 1rem;
  font-weight: 520;
  line-height: 1.35;
}

.actions {
  display: grid;
  width: min(100%, 27rem);
  gap: 0.65rem;
  margin-top: clamp(1.15rem, 3svh, 1.9rem);
}

.action {
  display: grid;
  min-height: 3.25rem;
  place-items: center;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  font-size: 0.96rem;
  font-weight: 610;
  letter-spacing: 0.004em;
  line-height: 1.28;
  text-align: center;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.action-primary {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--deep-graphite);
}

.action-primary:hover {
  border-color: #E8CF89;
  background: #E8CF89;
}

.action-secondary {
  border-color: rgb(241 238 231 / 44%);
  background: transparent;
  color: var(--paper);
}

.action-secondary:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.action-note {
  max-width: 38ch;
  margin: 0.65rem 0 0;
  color: var(--mist);
  font-size: 0.84rem;
  line-height: 1.4;
}

.action-note[hidden] {
  display: none;
}

.footer {
  display: flex;
  min-height: 2rem;
  align-items: flex-end;
  justify-content: center;
  padding-top: 0.4rem;
}

.footer p {
  margin: 0;
  color: rgb(241 238 231 / 64%);
  font-size: 0.83rem;
  letter-spacing: 0.025em;
}

.about-dialog {
  width: min(27rem, calc(100vw - 2rem));
  max-width: 27rem;
  padding: 0;
  border: 1px solid rgb(36 50 58 / 20%);
  border-radius: 0.7rem;
  background: var(--paper);
  color: var(--deep-graphite);
}

.about-dialog::backdrop {
  background: rgb(7 15 20 / 78%);
}

.about-content {
  position: relative;
  padding: 2.4rem 1.55rem 1.5rem;
}

.about-content h2 {
  margin: 0;
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.about-content p {
  max-width: 38ch;
  margin: 0.85rem 0 0;
  font-size: 0.96rem;
  line-height: 1.5;
}

.dialog-close {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--deep-graphite);
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.dialog-close:hover {
  border-color: rgb(36 50 58 / 18%);
  background: rgb(36 50 58 / 5%);
}

.skip-link {
  position: absolute;
  z-index: 3;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.65rem 0.85rem;
  transform: translateY(-160%);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--deep-graphite);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

@keyframes draw-thread {
  to { stroke-dashoffset: 0; }
}

@keyframes node-arrive {
  55% { opacity: 1; }
  to { opacity: 0.74; transform: scale(1); }
}

@keyframes pulse-arrive {
  to { opacity: 0.96; }
}

@media (min-width: 720px) {
  .page-shell {
    padding-right: clamp(2rem, 5vw, 5rem);
    padding-left: clamp(2rem, 5vw, 5rem);
  }

  .topbar {
    min-height: 3.1rem;
  }

  .brand {
    font-size: 1rem;
  }

  .hero {
    width: min(100%, 53rem);
    padding: 0.75rem 0 1.1rem;
  }

  .thread-art {
    width: min(76vw, 38rem);
    height: clamp(11rem, 29svh, 16rem);
    margin-bottom: 0.15rem;
  }

  h1 {
    font-size: clamp(3rem, 4.5vw, 4rem);
  }

  .intro {
    margin-top: 1rem;
    font-size: 1.08rem;
  }

  .beginning {
    margin-top: 0.8rem;
  }

  .actions {
    width: min(100%, 43rem);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 1.75rem;
  }

  .action {
    min-height: 3.8rem;
    padding: 0.85rem 1rem;
    font-size: 1rem;
  }

  .footer {
    min-height: 2.3rem;
  }
}

@media (max-height: 720px) and (max-width: 719px) {
  .thread-art {
    height: clamp(6.7rem, 21svh, 9.5rem);
  }

  .hero {
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
  }

  .intro {
    margin-top: 0.55rem;
    line-height: 1.42;
  }

  .beginning {
    margin-top: 0.5rem;
  }

  .actions {
    margin-top: 0.9rem;
  }

  .action {
    min-height: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thread-line,
  .node,
  .node-halo {
    animation: none !important;
  }

  .thread-line {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
  }

  .node,
  .node-halo {
    opacity: 0.78;
    transform: none;
  }

  .moving-pulses {
    display: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Public-thread prototype screens */
.screen[hidden] {
  display: none;
}

.flow-screen {
  display: flex;
  width: min(100%, 48rem);
  flex-direction: column;
  align-items: stretch;
  margin: auto;
  padding: clamp(1rem, 3svh, 2rem) 0;
  text-align: left;
}

.flow-title {
  max-width: 22ch;
  margin: 0;
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: clamp(2rem, 8vw, 3.35rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.08;
  text-wrap: balance;
}

.flow-intro {
  max-width: 43ch;
  margin: 0.85rem 0 0;
  color: rgb(241 238 231 / 78%);
  font-size: 1rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.footer .demo-note {
  text-align: center;
}

.create-screen {
  width: min(100%, 41rem);
  padding-block: 0.4rem 0.75rem;
}

@media (max-width: 719px) {
  .create-screen {
    margin-block: clamp(0rem, (100svh - 720px) / 4, 2rem) auto;
  }
}

.create-screen .flow-intro {
  margin-top: 0.55rem;
}

.thread-seed {
  width: 8rem;
  height: 2.875rem;
  margin-bottom: 0.3rem;
  overflow: visible;
  animation: seed-breathe 5s ease-in-out infinite alternate;
}

.seed-point {
  fill: var(--gold);
}

.seed-glow {
  fill: var(--gold);
  filter: blur(5px);
  opacity: 0.65;
}

@keyframes seed-breathe {
  from { opacity: 0.68; }
  to { opacity: 1; }
}

.thread-form {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.topic-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.topic-options button {
  min-height: 2rem;
  padding: 0.28rem 0.68rem;
  border: 1px solid rgb(241 238 231 / 24%);
  border-radius: 999px;
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.topic-options button[aria-pressed="true"] {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--deep-graphite);
}

.message-box {
  min-width: 0;
  border: 1px solid rgb(241 238 231 / 26%);
  border-radius: 0.7rem;
  background: var(--deep-graphite);
}

.message-box:focus-within {
  border-color: var(--gold);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.control {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 3rem;
  padding: 0.72rem 0.82rem;
  border: 1px solid rgb(241 238 231 / 26%);
  border-radius: 0.4rem;
  background: var(--deep-graphite);
  color: var(--paper);
  font: inherit;
  line-height: 1.4;
}

.control::placeholder {
  color: rgb(174 183 178 / 72%);
}

.control:focus-visible {
  border-color: var(--gold);
}

.text-control {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 8rem;
  padding: 0.85rem;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-size: max(1rem, 16px);
  line-height: 1.5;
  resize: vertical;
  overflow-wrap: anywhere;
}

.text-control:focus-visible {
  outline: none;
}

.text-control::placeholder {
  color: var(--mist);
}

.message-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0 0.75rem;
  margin-inline: 0.8rem;
  padding-block: 0.15rem;
  border-top: 1px solid rgb(241 238 231 / 13%);
}

.message-details {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 0 0.75rem;
  min-width: 0;
}

.detail-button,
.detail-secondary button {
  border: 0;
  background: transparent;
  color: var(--gold);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.detail-button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  max-width: 100%;
  min-height: 2.25rem;
  padding: 0;
  text-align: left;
}

.detail-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-button svg {
  flex: none;
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.character-count {
  margin: 0.25rem 0;
  color: var(--mist);
  font-size: 0.75rem;
  text-align: right;
}

.thread-form .screen-actions {
  grid-template-columns: minmax(0, 1fr);
  margin-top: 0;
}

.detail-dialog {
  position: fixed;
  inset: auto 0;
  top: clamp(
    calc(var(--visible-top, 0px) + 0.75rem),
    calc(var(--visible-top, 0px) + var(--visible-height, 100dvh) / 2 - 7rem),
    calc(var(--visible-top, 0px) + var(--visible-height, 100dvh) - 0.75rem)
  );
  width: min(calc(100% - 1.5rem), 23rem);
  max-height: calc(var(--visible-height, 100dvh) - 1.5rem);
  margin: 0 auto;
  padding: 1.15rem;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgb(217 185 103 / 38%);
  border-radius: 0.85rem;
  background: var(--graphite);
  color: var(--paper);
  box-shadow: 0 1rem 3rem rgb(0 0 0 / 40%);
}

.detail-dialog::backdrop {
  background: rgb(12 19 23 / 76%);
}

.detail-form {
  display: grid;
  gap: 0.85rem;
}

.detail-form h2 {
  margin: 0;
  font: 400 clamp(1.35rem, 6vw, 1.85rem) / 1.15 Georgia, serif;
}

.detail-form .control {
  font-size: max(1rem, 16px);
}

.detail-actions .action {
  width: 100%;
  min-height: 2.65rem;
}

.detail-secondary {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0 0.75rem;
}

.detail-secondary button {
  min-height: 2.5rem;
}

.screen-actions {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.screen-actions .action {
  width: 100%;
}

.action-quiet {
  border-color: rgb(241 238 231 / 24%);
  background: transparent;
  color: var(--mist);
}

.action-quiet:hover {
  border-color: var(--paper);
  color: var(--paper);
}

.preview-card {
  min-width: 0;
  margin-top: 1.25rem;
  padding: clamp(1rem, 4vw, 1.5rem);
  border: 1px solid rgb(241 238 231 / 20%);
  border-left: 3px solid var(--gold);
  border-radius: 0.45rem;
  background: rgb(24 37 43 / 72%);
}

.thread-copy {
  margin: 0;
  color: var(--paper);
  font-size: 1.03rem;
  line-height: 1.65;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.thread-meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.5rem 1rem;
  margin: 1.15rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid rgb(241 238 231 / 14%);
  font-size: 0.86rem;
  line-height: 1.4;
}

.thread-meta:empty {
  display: none;
}

.thread-meta dt {
  color: var(--mist);
}

.thread-meta dd {
  min-width: 0;
  margin: 0;
  color: var(--paper);
  overflow-wrap: anywhere;
}

.completion-screen {
  align-items: center;
  text-align: center;
}

.completion-screen .flow-title {
  max-width: 20ch;
}

.completion-screen .flow-intro {
  margin-top: 0.65rem;
}

.completion-art {
  width: min(100%, 14rem);
  height: 8rem;
  margin: 0 auto 0.65rem;
}

.completion-art svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.completion-line {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw-thread 1800ms cubic-bezier(0.22, 0.8, 0.24, 1) forwards;
}

.completion-node {
  fill: var(--paper);
  opacity: 0;
  transform: scale(0.35);
  transform-box: fill-box;
  transform-origin: center;
  animation: node-arrive 650ms ease-out forwards;
}

.node-b { animation-delay: 400ms; }
.node-c { animation-delay: 850ms; }
.node-d { animation-delay: 1250ms; }

.completion-screen .screen-actions {
  width: min(100%, 28rem);
}

.screen-status {
  width: min(100%, 38ch);
  margin: 0.8rem auto 0;
  color: var(--mist);
  font-size: 0.84rem;
  line-height: 1.45;
}

@media (min-width: 720px) {
  .flow-screen {
    width: min(100%, 53rem);
    padding: 1.25rem 0 1.75rem;
  }

  .create-screen {
    width: min(100%, 41rem);
    padding-block: 0.75rem 1rem;
  }

  .flow-title {
    font-size: clamp(2.6rem, 4.5vw, 3.7rem);
  }

  .flow-intro {
    font-size: 1.08rem;
  }

  .screen-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .completion-screen .screen-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .completion-screen .screen-actions .action-quiet {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thread-seed,
  .completion-line,
  .completion-node {
    animation: none !important;
  }

  .completion-line {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
  }

  .completion-node {
    opacity: 0.78;
    transform: none;
  }
}

/* Routed screens share the existing graphite and gold writing flow. */
[hidden] {
  display: none !important;
}

.back-button svg,
.space-control svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar:has(.back-button:not([hidden])) .info-button {
  border-color: transparent;
}

.footer:has(.demo-note:not([hidden])) {
  flex-wrap: wrap;
  gap: 0.15rem 1rem;
  align-items: center;
  text-align: center;
}

.about-content a,
.related-threads a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.about-philosophy {
  max-width: 44ch;
  line-height: 1.6;
}

.thread-label {
  margin: 0;
  color: var(--gold);
  font-size: 0.86rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.source-thought {
  min-width: 0;
  margin: 0;
  padding: 0.6rem 0 0.6rem 0.85rem;
  border-inline-start: 1px solid rgb(217 185 103 / 55%);
}

.source-thought blockquote {
  max-height: 9rem;
  overflow: auto;
  margin: 0.35rem 0 0;
  color: var(--mist);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-source {
  margin-top: 1rem;
}

.preview-weave {
  display: block;
  width: 2rem;
  height: 2.4rem;
  margin: 0.2rem auto;
  fill: var(--gold);
}

.preview-weave path {
  fill: none;
  stroke: var(--gold);
}

.preview-source:not([hidden]) + .preview-card {
  margin-top: 0;
}

.woven-art .weave-second {
  stroke-width: 1.15;
  opacity: 0.71;
  animation-delay: 160ms;
}

.woven-glow {
  fill: var(--gold);
  filter: blur(7px);
  opacity: 0;
  animation: weave-light 1.4s 650ms ease-out forwards;
}

@keyframes weave-light {
  to { opacity: 0.68; }
}

.completion-screen .flow-intro {
  white-space: pre-line;
}

.link-note {
  margin: 1rem 0 0;
  color: var(--mist);
  font-size: 0.8rem;
}

.action:disabled {
  opacity: 0.62;
  cursor: default;
}

.single-thread {
  max-width: 46rem;
}

#thread-relations {
  display: block;
  width: min(100%, 34rem);
  margin: 0 auto 0.65rem;
  overflow: visible;
  fill: var(--gold);
}

#thread-relations path {
  fill: none;
  stroke: var(--gold);
  stroke-opacity: 0.56;
  stroke-width: 1.35;
}

#thread-relations .potential-link {
  stroke-opacity: 0.38;
  stroke-dasharray: 3 6;
}

.relation-current {
  filter: drop-shadow(0 0 6px var(--gold));
}

.related-threads {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1rem;
  margin-bottom: 1.2rem;
  color: var(--gold);
  font-size: 0.79rem;
}

.related-threads a {
  padding: 0.35rem 0;
  color: inherit;
}

.thought,
.space-thought {
  margin: 0.55rem 0 0;
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: clamp(1.7rem, 5vw, 3.25rem);
  line-height: 1.24;
  letter-spacing: -0.02em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.single-thread .thread-meta {
  padding-top: 0;
  border: 0;
}

#thread-children {
  margin-top: 0.85rem;
}

.thread-invitation {
  margin: 1.6rem 0 0.65rem;
  color: var(--mist);
}

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

.thread-actions .action {
  flex: 1 1 max-content;
}

.share-panel {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
  color: var(--mist);
}

.space-page {
  background: #19262c;
}

.space-page .page-shell {
  width: 100%;
  height: 100svh;
  padding-inline: 0;
}

.space-page .topbar,
.space-page .footer {
  padding-inline: max(0.75rem, env(safe-area-inset-left)) max(0.75rem, env(safe-area-inset-right));
}

.space-screen {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 18rem;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(ellipse at 48% 42%, #293940 0%, #202e35 52%, #19262c 100%);
}

#space-board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#space-board:active {
  cursor: grabbing;
}

.space-edges line {
  stroke: var(--gold);
  stroke-opacity: 0.48;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.space-edges .is-linked {
  stroke-opacity: 0.95;
  stroke-width: 1.65;
}

.space-point {
  cursor: pointer;
}

.point-hit {
  fill: transparent;
  stroke: transparent;
  stroke-width: 12;
  vector-effect: non-scaling-stroke;
}

.point-halo {
  fill: url(#space-halo);
  opacity: 0.65;
  pointer-events: none;
}

.point-light {
  fill: #f0d182;
  pointer-events: none;
}

.point-ring {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: 0;
  pointer-events: none;
}

.space-point:focus-visible {
  outline: none;
}

.space-point:focus-visible .point-ring,
.space-point[aria-pressed="true"] .point-ring {
  opacity: 1;
}

.space-point[aria-pressed="true"] .point-halo {
  opacity: 1;
}

.space-controls,
.space-create,
.space-selection {
  position: absolute;
  z-index: 1;
}

.space-controls {
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: 0.65rem;
  display: flex;
  gap: 0.2rem;
}

.space-control {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid rgb(217 185 103 / 33%);
  border-radius: 0.5rem;
  background: var(--deep-graphite);
  color: var(--gold);
  font-size: 1.45rem;
  cursor: pointer;
}

.space-create.action {
  bottom: 0.65rem;
  left: max(0.75rem, env(safe-area-inset-left));
  min-height: 2.4rem;
  max-width: calc(100% - 9rem);
  padding: 0.42rem 0.63rem;
  background: var(--deep-graphite);
  font-size: clamp(0.75rem, 3.2vw, 0.95rem);
}

.space-selection {
  right: 0.75rem;
  bottom: 3.65rem;
  left: 0.75rem;
  max-height: min(55%, 28rem);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0.85rem;
  border: 1px solid rgb(217 185 103 / 36%);
  border-radius: 0.8rem;
  background: var(--graphite);
  box-shadow: 0 1rem 2.5rem rgb(0 0 0 / 35%);
}

.selection-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.selection-top .space-control {
  width: 2rem;
  height: 2rem;
  background: transparent;
}

.space-thought {
  font-size: clamp(1.2rem, 4vw, 1.55rem);
}

.space-selection .thread-meta {
  margin-top: 0.7rem;
  padding-top: 0.55rem;
}

.selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.selection-actions .action {
  flex: 1 1 max-content;
  min-height: 2.5rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.84rem;
}

@media (min-width: 600px) {
  .space-selection {
    top: 50%;
    right: clamp(1rem, 4vw, 4rem);
    bottom: auto;
    left: auto;
    width: min(38%, 24rem);
    transform: translateY(-50%);
  }

  .space-controls {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .woven-glow {
    animation: none;
    opacity: 0.68;
  }
}

.local-link {
  display: grid;
  width: min(100%, 28rem);
  gap: 0.4rem;
}

.local-link .control {
  text-align: center;
  font-size: 0.84rem;
  color: var(--mist);
}

a.action {
  text-decoration: none;
}

@media (max-width: 599px) {
  .completion-screen:has(.woven-art:not([hidden])) .completion-art {
    height: 5.65rem;
  }

  .completion-screen:has(.woven-art:not([hidden])) .screen-actions .action {
    min-height: 2.7rem;
    padding-block: 0.53rem;
  }
}
