:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --paper: #f7f3ef;
  --paper-deep: #eee5dc;
  --charcoal: #0e0e10;
  --graphite: #4f4842;
  --soft-graphite: #746a62;
  --gold: #c6a86a;
  --gold-dark: #8c713e;
  --linen: #e9ddd0;
  --clay: #e3d3c0;
  --sand: #dccab8;
  --cream: #f0e6d8;
  --line: rgba(65, 53, 43, 0.2);
  --line-dark: rgba(247, 243, 239, 0.18);
  --room-light: 0.5;
  background: var(--paper);
  color: var(--charcoal);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 72% 18%, rgba(227, 211, 192, calc(0.2 + var(--room-light) * 0.14)), transparent 30rem),
    radial-gradient(circle at 12% 48%, rgba(233, 221, 208, calc(0.18 + var(--room-light) * 0.1)), transparent 32rem),
    var(--paper);
  color: var(--charcoal);
}

body.motion-reduced {
  scroll-behavior: auto;
}

body.authenticated .arrival {
  min-height: auto;
  padding: 28px 0 24px;
  align-items: start;
  gap: clamp(24px, 4vw, 56px);
  grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.28fr);
}

body.authenticated .arrival .living-mark {
  font-size: clamp(1.2rem, 2.8vw, 2.8rem);
  line-height: 0.94;
}

body.authenticated .arrival .arrival-copy {
  max-width: 560px;
}

body.authenticated .arrival .arrival-copy h1 {
  font-size: clamp(1.6rem, 3vw, 2.8rem);
}

body.authenticated .arrival .arrival-copy p {
  max-width: 52ch;
  font-size: 0.98rem;
  line-height: 1.56;
}

button,
textarea,
input,
select {
  font: inherit;
}

button,
a,
textarea,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  min-height: 46px;
}

button {
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
[role="slider"]:focus-visible {
  outline: 3px solid var(--gold-dark);
  outline-offset: 4px;
}

.hidden {
  display: none !important;
}

.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;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
  transform: translateY(-180%);
  padding: 11px 16px;
  background: var(--charcoal);
  color: var(--paper);
  text-decoration: none;
}

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

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.045;
  background-image:
    repeating-linear-gradient(13deg, transparent 0 3px, rgba(14, 14, 16, 0.2) 4px, transparent 5px),
    repeating-linear-gradient(101deg, transparent 0 5px, rgba(112, 85, 55, 0.12) 6px, transparent 7px);
  background-size: 13px 17px, 19px 23px;
}

.ambient {
  position: fixed;
  z-index: -2;
  width: 38rem;
  height: 38rem;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  opacity: calc(0.22 + var(--room-light) * 0.18);
  animation: ambient-drift 24s ease-in-out infinite alternate;
}

.ambient-one {
  top: -15rem;
  right: -8rem;
  background: var(--clay);
}

.ambient-two {
  bottom: 4rem;
  left: -18rem;
  background: var(--linen);
  animation-delay: -11s;
}

@keyframes ambient-drift {
  from { transform: translate3d(-2%, -1%, 0) scale(0.98); }
  to { transform: translate3d(5%, 4%, 0) scale(1.08); }
}

.site-header,
main,
.site-footer {
  width: min(1240px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--charcoal);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}

.wordmark-mark {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 1px solid var(--charcoal);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.header-state {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--soft-graphite);
  font-size: 0.76rem;
}

.header-state a {
  color: var(--charcoal);
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-underline-offset: 4px;
}

.header-state p {
  margin: 0;
}

.arrival {
  min-height: min(650px, 72vh);
  padding: clamp(68px, 10vw, 136px) 0 clamp(54px, 8vw, 104px);
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(360px, 1.2fr);
  align-items: center;
  gap: clamp(40px, 8vw, 110px);
}

.living-mark {
  display: inline-grid;
  justify-items: start;
  gap: 0.1em;
  width: max-content;
  max-width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(1.6rem, 4.8vw, 4.6rem);
  font-weight: 760;
  line-height: 0.92;
  letter-spacing: -0.075em;
}

.living-word-wrap {
  min-width: 11ch;
  color: var(--gold-dark);
}

#living-word {
  display: inline-block;
  transform-origin: 35% 55%;
  animation: word-pulse 1.05s ease-in-out infinite;
  text-shadow: 0 0 calc(8px + var(--room-light) * 18px) rgba(198, 168, 106, 0.36);
  transition: opacity 240ms ease, transform 240ms ease;
}

#living-word.changing {
  opacity: 0;
  transform: translateY(5px) scale(0.99);
}

@keyframes word-pulse {
  0%, 100% { transform: scale(1); }
  46% { transform: scale(1.014); }
  58% { transform: scale(1.006); }
}

.room-state,
.kicker {
  margin: 0 0 10px;
  color: var(--gold-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.69rem;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.arrival-copy h1 {
  max-width: 720px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 7vw, 6.7rem);
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: -0.052em;
}

.arrival-copy > p:last-child {
  max-width: 600px;
  margin: 28px 0 0;
  color: var(--graphite);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.08rem, 1.7vw, 1.34rem);
  line-height: 1.55;
}

.access-panel {
  position: relative;
  margin-bottom: clamp(70px, 10vw, 130px);
  padding: clamp(28px, 5vw, 54px);
  display: grid;
  grid-template-columns: 0.9fr 1.4fr;
  gap: clamp(30px, 7vw, 90px);
  border: 1px solid var(--line-dark);
  background: var(--charcoal);
  color: var(--paper);
  box-shadow: 0 28px 80px rgba(36, 25, 16, 0.16);
}

.access-panel h2,
.composer-card h2,
.continuity h2,
.tactile-layer h2,
.routes h2,
.invite-card h2,
.map-panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.028em;
}

.access-panel h2 {
  max-width: 360px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
}

.access-panel p:not(.kicker) {
  color: #c9beb3;
  line-height: 1.6;
}

.access-panel .kicker {
  color: var(--gold);
}

.login-form,
.invite-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.login-form label,
.invite-form label {
  margin-top: 3px;
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(79, 72, 66, 0.42);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.7);
  color: var(--charcoal);
  padding: 14px 16px;
  line-height: 1.55;
}

.access-panel input {
  border-color: rgba(247, 243, 239, 0.3);
  background: rgba(247, 243, 239, 0.08);
  color: var(--paper);
}

input::placeholder,
textarea::placeholder {
  color: #897d73;
  opacity: 1;
}

.access-panel input::placeholder {
  color: #a99d92;
}

.primary-action,
.map-action,
.quiet-button {
  border-radius: 0;
  font-weight: 760;
}

.primary-action {
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--charcoal);
  padding: 13px 18px;
}

.primary-action:hover {
  background: #d2b77c;
}

.state-chip,
.ownership-badge {
  width: max-content;
  padding: 7px 10px;
  border: 1px solid currentColor;
  color: var(--gold-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.11em;
}

.access-panel > .state-chip {
  position: absolute;
  top: 20px;
  right: 20px;
  color: var(--gold);
}

.authenticated-room {
  padding-bottom: 84px;
}

.room-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.55fr);
  gap: 24px;
  align-items: start;
}

.room-channel {
  min-width: 0;
  display: grid;
  gap: 24px;
}

.session-strip {
  min-height: 74px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--line);
  background: rgba(247, 243, 239, 0.62);
}

.session-strip p {
  margin: 0;
}

.session-strip .kicker {
  margin-bottom: 4px;
}

.session-actions,
.motion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quiet-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--graphite);
  padding: 10px 14px;
}

.quiet-button:hover {
  border-color: var(--gold-dark);
  color: var(--charcoal);
}

.composer-card,
.continuity,
.tactile-layer,
.routes,
.invite-card {
  border: 1px solid var(--line);
  background: rgba(247, 243, 239, 0.78);
  box-shadow: 0 18px 60px rgba(56, 38, 22, 0.07);
}

.composer-card {
  padding: clamp(24px, 5vw, 52px);
}

.composer-heading,
.continuity-heading,
.tactile-heading,
.section-heading,
.map-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.composer-heading h2 {
  max-width: 610px;
  font-size: clamp(2.25rem, 5vw, 4.8rem);
  line-height: 0.98;
}

#composer-form {
  margin-top: 30px;
}

#native-input {
  min-height: 190px;
  resize: vertical;
  border-width: 0 0 1px;
  background: rgba(255, 255, 255, 0.42);
  padding: 22px 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.18rem, 2vw, 1.52rem);
}

.composer-actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.composer-actions button {
  min-height: 70px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.composer-actions button small {
  font-size: 0.65rem;
  font-weight: 650;
  opacity: 0.72;
  text-transform: none;
  letter-spacing: 0.02em;
}

#describe-page-button {
  grid-column: 1 / -1;
  justify-self: end;
  width: fit-content;
  min-height: 46px;
  padding-inline: 14px;
}

.map-action {
  border: 1px solid var(--charcoal);
  background: transparent;
  color: var(--charcoal);
}

.map-action:hover {
  background: var(--charcoal);
  color: var(--paper);
}

.composer-status {
  min-height: 1.5em;
  margin: 18px 0 0;
  color: var(--soft-graphite);
  font-size: 0.82rem;
}

.continuity,
.tactile-layer,
.routes,
.invite-card {
  padding: clamp(22px, 4vw, 38px);
}

.continuity h2,
.tactile-layer h2,
.routes h2,
.invite-card h2 {
  font-size: clamp(1.75rem, 3.4vw, 2.9rem);
}

.web-state {
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--gold-dark);
  color: var(--gold-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.11em;
}

.chat-log {
  min-height: 210px;
  max-height: 540px;
  margin-top: 24px;
  padding-top: 4px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 18px;
}

.chat-log.is-empty {
  min-height: 128px;
  margin-top: 14px;
  gap: 12px;
}

.empty-thread {
  max-width: 510px;
  margin: 16px 0;
  color: var(--soft-graphite);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  line-height: 1.55;
}

.chat-log.is-empty .empty-thread {
  margin: 0;
  max-width: 44ch;
  font-size: 0.98rem;
  line-height: 1.52;
}

.chat-entry {
  max-width: 88%;
  padding: 16px 18px;
  border-left: 2px solid var(--gold);
  background: rgba(240, 230, 216, 0.54);
}

.chat-entry.user {
  justify-self: end;
  border-left: 0;
  border-right: 2px solid var(--graphite);
  background: rgba(233, 221, 208, 0.38);
}

.chat-entry p {
  margin: 0;
  white-space: pre-wrap;
}

.chat-label {
  margin-bottom: 7px !important;
  color: var(--soft-graphite);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.chat-body {
  color: var(--graphite);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  line-height: 1.6;
}

.sources {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.sources ul {
  margin: 0;
  padding-left: 18px;
}

.sources a {
  color: var(--gold-dark);
  overflow-wrap: anywhere;
  text-underline-offset: 3px;
}

.tactile-grid {
  margin-top: 25px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.tactile-card {
  min-height: 220px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.5), rgba(227, 211, 192, 0.25));
}

.tactile-card h3 {
  margin: 0 0 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 400;
}

.tactile-card p,
.local-only-note,
.section-heading > p,
.invite-card p {
  margin: 0;
  color: var(--soft-graphite);
  font-size: 0.82rem;
  line-height: 1.5;
}

.pulse-orbit,
.twist-control {
  width: 92px;
  height: 92px;
  border-radius: 50%;
}

.pulse-orbit {
  display: grid;
  place-items: center;
  border: 1px solid rgba(140, 113, 62, 0.44);
  animation: orbit-breathe 1.05s ease-in-out infinite;
}

.pulse-orbit span {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(198, 168, 106, 0.46);
  box-shadow: 0 0 calc(15px + var(--room-light) * 26px) rgba(198, 168, 106, 0.45);
}

@keyframes orbit-breathe {
  0%, 100% { transform: scale(0.98); opacity: 0.72; }
  48% { transform: scale(1.03); opacity: 1; }
}

.twist-control {
  position: relative;
  flex: none;
  border: 1px solid rgba(140, 113, 62, 0.55);
  background: radial-gradient(circle, rgba(247, 243, 239, 0.92) 42%, rgba(198, 168, 106, 0.18) 44%, rgba(227, 211, 192, 0.46) 70%);
  touch-action: none;
  transform: rotate(calc((var(--room-light) - 0.5) * 240deg));
  transition: transform 120ms ease-out, box-shadow 180ms ease;
  box-shadow: 0 8px calc(15px + var(--room-light) * 24px) rgba(112, 78, 42, 0.14);
}

.twist-handle {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold-dark);
  transform: translateX(-50%);
}

.sort-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.sort-tokens button {
  min-height: 44px;
  border: 1px solid rgba(140, 113, 62, 0.46);
  border-radius: 999px;
  background: rgba(247, 243, 239, 0.7);
  color: var(--graphite);
  padding: 9px 13px;
  font-size: 0.74rem;
  font-weight: 720;
}

.sort-tokens button:hover {
  background: var(--cream);
}

.local-only-note {
  margin-top: 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.03em;
}

.routes .section-heading {
  align-items: end;
}

.route-grid {
  margin-top: 25px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.route-grid button {
  min-height: 112px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--charcoal);
  text-align: left;
}

.route-grid button:hover,
.route-grid button[aria-pressed="true"] {
  border-color: var(--gold-dark);
  background: var(--cream);
}

.route-grid strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.24rem;
  font-weight: 400;
}

.route-grid span {
  color: var(--soft-graphite);
  font-size: 0.8rem;
  line-height: 1.45;
}

.route-focus {
  margin: 20px 0 0;
  color: var(--graphite);
  line-height: 1.55;
}

.organ-stack {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.organ-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.organ-grid button {
  min-height: 126px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--charcoal);
  text-align: left;
}

.organ-grid button:hover,
.organ-grid button[aria-pressed="true"] {
  border-color: var(--gold-dark);
  background: var(--cream);
}

.organ-grid strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.14rem;
  font-weight: 400;
}

.organ-grid span {
  color: var(--soft-graphite);
  font-size: 0.8rem;
  line-height: 1.45;
}

.organ-detail {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.4);
}

.organ-detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.organ-detail h3 {
  margin: 0;
  font-size: 1.35rem;
}

.organ-detail p {
  margin: 10px 0 0;
  color: var(--graphite);
  line-height: 1.55;
}

.organ-detail-meta {
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
}

.organ-detail-meta dt {
  color: var(--soft-graphite);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.organ-detail-meta dd {
  margin: 4px 0 0;
  color: var(--charcoal);
  line-height: 1.45;
}

.organ-detail-points {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--graphite);
  line-height: 1.55;
}

.organ-detail-points li + li {
  margin-top: 6px;
}

.room-actions-list,
.linked-product-list {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.room-action-item,
.linked-product-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.44);
}

.room-action-item {
  display: grid;
  gap: 10px;
}

.linked-product-item {
  display: grid;
  gap: 10px;
}

.room-action-item button {
  justify-self: start;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--gold-dark);
  background: var(--cream);
  color: var(--charcoal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 760;
}

.room-action-item p,
.linked-product-item p {
  margin: 0;
  color: var(--soft-graphite);
  line-height: 1.45;
}

.room-action-meta,
.linked-product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--graphite);
  font-size: 0.78rem;
}

.room-action-meta span,
.linked-product-meta span {
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: rgba(247, 243, 239, 0.66);
}

.linked-product-subtitle {
  color: var(--gold-dark);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.linked-product-status {
  color: var(--charcoal);
}

.linked-product-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.linked-product-action-row button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--gold-dark);
  background: var(--cream);
  color: var(--charcoal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 760;
}

.linked-product-details {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.linked-product-details summary {
  cursor: pointer;
  list-style: none;
  color: var(--soft-graphite);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.linked-product-details summary::-webkit-details-marker {
  display: none;
}

.customs-preview-grid {
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.customs-preview-grid dt {
  color: var(--soft-graphite);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.customs-preview-grid dd {
  margin: 4px 0 0;
  color: var(--charcoal);
  line-height: 1.48;
  white-space: pre-wrap;
}

.invite-card {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 28px;
  background: var(--charcoal);
  color: var(--paper);
}

.invite-doorway {
  display: grid;
  gap: 16px;
}

.invite-doorway > summary {
  display: grid;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

.invite-doorway > summary::-webkit-details-marker {
  display: none;
}

.invite-doorway > summary strong {
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.75rem, 3vw, 2.4rem);
  font-weight: 400;
}

.invite-doorway > summary span {
  color: #c9beb3;
  line-height: 1.5;
}

.invite-doorway[open] > summary {
  margin-bottom: 6px;
}

.invite-doorway-body {
  display: grid;
  gap: 18px;
}

.invite-card .kicker {
  color: var(--gold);
}

.invite-card p {
  margin-top: 10px;
  color: #c9beb3;
}

.invite-card input {
  border-color: rgba(247, 243, 239, 0.3);
  background: rgba(247, 243, 239, 0.08);
  color: var(--paper);
}

.invite-result {
  grid-column: 1 / -1;
  padding-top: 20px;
  border-top: 1px solid var(--line-dark);
  color: #d8cec5;
  line-height: 1.5;
}

.invite-result code {
  display: block;
  margin-top: 8px;
  padding: 12px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line-dark);
  color: var(--gold);
}

.map-panel {
  position: sticky;
  top: 18px;
  padding: 25px;
  display: grid;
  gap: 0;
  border: 1px solid var(--line-dark);
  background:
    radial-gradient(circle at 85% 8%, rgba(198, 168, 106, calc(0.05 + var(--room-light) * 0.08)), transparent 14rem),
    var(--charcoal);
  color: var(--paper);
  box-shadow: 0 24px 70px rgba(14, 14, 16, 0.18);
}

.map-panel-highlight {
  outline: 2px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(198, 168, 106, 0.18), 0 24px 70px rgba(14, 14, 16, 0.18);
}

.organ-detail-focus {
  outline: 2px solid var(--gold-dark);
  outline-offset: 2px;
}

.map-panel .kicker {
  color: var(--gold);
}

.map-panel h2 {
  font-size: 2.25rem;
}

.ownership-badge {
  color: var(--gold);
}

.map-principle {
  margin: 15px 0 6px;
  color: #d0c5bb;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}

.map-panel section {
  margin-top: 17px;
  padding-top: 17px;
  border-top: 1px solid var(--line-dark);
}

.map-more {
  margin-top: 17px;
  padding-top: 17px;
  border-top: 1px solid var(--line-dark);
}

.map-more > summary {
  cursor: pointer;
  list-style: none;
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.map-more > summary::-webkit-details-marker {
  display: none;
}

.map-more[open] > summary {
  margin-bottom: 8px;
}

.map-panel h3 {
  margin: 0 0 8px;
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.67rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.map-panel p,
.map-panel li {
  color: #d0c5bb;
  font-size: 0.86rem;
  line-height: 1.55;
}

.map-panel p {
  margin-block: 0;
}

.map-panel ul {
  margin: 0;
  padding-left: 18px;
}

.map-panel li + li {
  margin-top: 6px;
}

.map-panel .quiet-button {
  margin-top: 12px;
  border-color: var(--line-dark);
  color: var(--paper);
}

.site-footer {
  min-height: 120px;
  padding: 30px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  border-top: 1px solid var(--line);
  color: var(--soft-graphite);
  font-size: 0.75rem;
  line-height: 1.5;
}

.site-footer p {
  margin: 0;
}

body.pulse-paused #living-word,
body.pulse-paused .pulse-orbit {
  animation-play-state: paused;
}

.calibration-card {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(140, 113, 62, 0.45);
  background: rgba(240, 230, 216, 0.48);
}

.calibration-card > p:not(.kicker) {
  margin: 0 0 14px;
  color: var(--graphite);
  line-height: 1.55;
}

.calibration-actions,
.room-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.calibration-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--charcoal);
  padding: 9px 12px;
}

.working-room,
.product-truth-card,
.customs-preview-card {
  margin-top: 0;
  padding: clamp(22px, 4vw, 38px);
  background: rgba(247, 243, 239, 0.82);
  box-shadow: 0 18px 60px rgba(56, 38, 22, 0.07);
}

.room-form {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}

.room-form label {
  color: var(--soft-graphite);
  font-size: 0.7rem;
  font-weight: 760;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.room-form select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(79, 72, 66, 0.42);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.7);
  color: var(--charcoal);
  padding: 12px 16px;
}

.two-column-form {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.two-column-form label,
.two-column-form .room-form-actions,
.two-column-form > button {
  grid-column: 1 / -1;
}

.candidate-list,
.local-note-list {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.candidate-item,
.local-note {
  margin: 0;
  padding: 14px 16px;
  border-left: 2px solid var(--gold-dark);
  background: rgba(255, 255, 255, 0.48);
}

.candidate-item p {
  white-space: pre-wrap;
}

.customs-technical {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.customs-technical summary,
.linked-product-details summary {
  cursor: pointer;
  color: var(--gold-dark);
  font-weight: 760;
}

@media (max-width: 980px) {
  .arrival {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .room-grid {
    grid-template-columns: 1fr;
  }

  .organ-grid {
    grid-template-columns: 1fr;
  }

  .map-panel {
    position: static;
  }

  .tactile-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sort-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 24px, 1240px);
  }

  .site-header {
    align-items: flex-start;
    padding: 14px 0;
  }

  .header-state {
    align-items: flex-end;
    flex-direction: column;
    gap: 5px;
    text-align: right;
  }

  .arrival {
    padding-top: 64px;
    gap: 45px;
  }

  .living-mark {
    font-size: clamp(1.55rem, 10vw, 3rem);
  }

  .access-panel,
  .invite-card {
    grid-template-columns: 1fr;
  }

  .access-panel > .state-chip {
    position: static;
  }

  .composer-heading,
  .continuity-heading,
  .tactile-heading,
  .section-heading {
    flex-direction: column;
  }

  .composer-actions,
  .route-grid,
  .tactile-grid,
  .two-column-form {
    grid-template-columns: 1fr;
  }

  .sort-card {
    grid-column: auto;
  }

  .session-strip,
  .site-footer {
    flex-direction: column;
  }

  .chat-entry {
    max-width: 96%;
  }
}

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

  .ambient,
  #living-word,
  .pulse-orbit {
    animation: none !important;
  }

  #living-word {
    transition: color 160ms ease, opacity 160ms ease;
  }

  .twist-control {
    transition: none;
  }
}

body.motion-reduced .ambient,
body.motion-reduced #living-word,
body.motion-reduced .pulse-orbit {
  animation: none !important;
}

body.motion-reduced #living-word {
  transform: none;
  transition: color 160ms ease, opacity 160ms ease;
}

body.motion-reduced .twist-control {
  transition: none;
}

/* Recovery: substantive Home doors stay ahead of optional room controls. */
.route-grid .route-link { display:flex; flex-direction:column; gap:8px; text-decoration:none; color:var(--charcoal); padding:20px; border:1px solid var(--line); border-radius:12px; background:var(--cream); }
.route-link span { font-size:.9rem; line-height:1.5; color:var(--graphite); }
.optional-room { margin:24px 0; border-top:1px solid var(--line); padding-top:14px; }
.optional-room > summary { cursor:pointer; color:var(--soft-graphite); }
.map-control-row { padding:12px 0; border-bottom:1px solid var(--line); }
.map-control-row label { display:block; font-size:.85rem; margin:8px 0; }
.map-control-row input { width:100%; border:1px solid var(--line); border-radius:6px; padding:8px; background:var(--paper); }
.map-control-row button { margin:8px 6px 0 0; }
.header-state a { white-space:nowrap; }
@media(max-width:600px) { .header-state { flex-wrap:wrap; } }
