/*
 * TownSquare full-page chrome.
 *
 * Loaded only on TownSquare host pages (demo, admin, dev tools). Not part of
 * the embed snippet — external sites should load widget.css only.
 */
@import url("./tokens.css");

:root {
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: linear-gradient(180deg, var(--bg), color-mix(in oklab, var(--bg) 92%, black 8%));
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.page-shell {
  padding: 24px 16px 0;
}

.page-card {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.page-card h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 0.98;
}

.page-card p,
.page-card li {
  font-size: 1rem;
  line-height: 1.6;
  color: color-mix(in oklab, var(--text) 88%, var(--muted) 12%);
}

.page-card ul {
  margin: 16px 0 0;
  padding-left: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.page-cta a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border-radius: 10px;
  padding: 0 16px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
}

.page-cta a:nth-child(n + 2) {
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hair-2);
}

.page-hint {
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.92rem;
}

.page-hint a {
  color: var(--you-deep);
  font-weight: 650;
}

.page-support {
  display: flex;
  justify-content: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--hair-2);
}

.support-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font: 500 0.8rem var(--font);
  text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--hair-2);
}

.support-link:hover {
  color: var(--ink);
  background: var(--surface);
}

.townsquare-host {
  width: min(1100px, 100%);
  margin: 48px auto 0;
  padding: 0 12px 18px;
}

:root {
  --hosted-preview-dock-height: 13.75rem;
  --hosted-preview-dock-chrome: 2rem;
}

.hosted-shell:has(#register-view:not([hidden]) .hosted-preview-dock),
.hosted-shell:has(#admin-view:not([hidden]) .hosted-preview-dock) {
  padding-bottom: calc(
    var(--hosted-preview-dock-height) + env(safe-area-inset-bottom, 0px) + 12px
  );
}

.hosted-preview-dock.hosted-section {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  height: calc(var(--hosted-preview-dock-height) + env(safe-area-inset-bottom, 0px));
  margin: 0;
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  border-top: 1px solid var(--hair-2);
  background: color-mix(in oklab, var(--surface) 94%, transparent);
  box-shadow: 0 -12px 36px -18px rgba(42, 41, 38, 0.34);
  backdrop-filter: blur(14px);
}

.hosted-preview-dock .hosted-section-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 8px 16px 0;
}

.hosted-preview-dock .hosted-section-head h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hosted-preview-dock .townsquare-host {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  min-height: 0;
  margin: 0 auto;
  padding: 4px 12px 10px;
}

.hosted-preview-dock #townsquare-root {
  flex: 1;
  min-height: 0;
}

.hosted-preview-dock .townsquare {
  height: calc(var(--hosted-preview-dock-height) - var(--hosted-preview-dock-chrome) - 14px);
  min-height: 0;
}

.hosted-preview-dock .townsquare__stage {
  height: 100%;
  min-height: 120px;
}

.dev-page {
  min-height: 100vh;
}

.dev-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px 14px 24px;
}

.dev-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 0 4px 18px;
}

.dev-toolbar h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1;
}

.dev-controls {
  display: flex;
  align-items: end;
  gap: 10px;
}

.dev-field {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.83rem;
  font-weight: 600;
}

.dev-field input {
  width: 116px;
  height: 38px;
  border: 1px solid var(--hair-2);
  border-radius: 10px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
  font: 600 1rem var(--font);
}

.dev-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 650;
  user-select: none;
}

.dev-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--you);
}

.dev-button {
  height: 38px;
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  background: var(--ink);
  color: var(--surface);
  font: 650 0.92rem var(--font);
  cursor: pointer;
}

.dev-tuning {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px 26px;
  margin: 0 4px 18px;
  padding: 14px 16px;
  border: 1px solid var(--hair-2);
  border-radius: 14px;
  background: var(--surface);
}

.dev-tuning__group {
  display: grid;
  gap: 10px;
}

.dev-tuning__group--wide {
  flex: 1 1 360px;
}

.dev-tuning__title {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dev-frames,
.dev-tuning__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dev-chip {
  height: 30px;
  border: 1px solid var(--hair-2);
  border-radius: 8px;
  padding: 0 11px;
  background: var(--surface);
  color: var(--ink-soft);
  font: 650 0.82rem var(--font);
  cursor: pointer;
}

.dev-chip[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.dev-sliders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 16px;
}

.dev-slider {
  display: grid;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.dev-slider span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.dev-slider em {
  font-style: normal;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.dev-slider input[type="range"] {
  width: 100%;
  accent-color: var(--you);
}

.dev-readout {
  margin: 0;
  min-width: 168px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2, rgba(0, 0, 0, 0.04));
  color: var(--ink-soft);
  font: 500 0.74rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre;
}

.dev-host {
  margin-top: 0;
  padding-inline: 0;
}

.dev-host--framed {
  margin-inline: auto;
  border: 1px dashed var(--hair-2);
  border-radius: 16px;
  overflow: hidden;
}

.dev-host .townsquare {
  min-height: 420px;
}

.dev-host .townsquare__stage {
  height: 360px;
}

.walk-page {
  min-height: 100vh;
}

.walk-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px 14px 28px;
}

.walk-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 0 4px 18px;
}

.walk-toolbar h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1;
}

.walk-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.walk-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--hair-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: 650 1.4rem/1 var(--font);
  cursor: pointer;
}

.walk-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(68vh, 680px);
  border-top: 1px solid var(--line);
  border-radius: var(--r) var(--r) 0 0;
  background: linear-gradient(
    180deg,
    var(--scene) 0%,
    var(--scene) 72%,
    var(--scene-edge) 72%,
    var(--page) 72.4%,
    var(--page) 100%
  );
  overflow: hidden;
}

.walk-preview {
  position: relative;
  z-index: 1;
  width: min(300px, 54vw);
  aspect-ratio: 20 / 44;
  color: var(--you);
  filter: drop-shadow(0 16px 18px rgba(0,0,0,0.12));
}

.walk-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 27.6%;
  height: 1px;
  background: var(--ground);
}

.walk-timeline {
  display: grid;
  gap: 12px;
  padding: 16px 4px 0;
}

.walk-slider {
  display: grid;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 650;
}

.walk-slider input {
  width: 100%;
  accent-color: var(--you);
}

.walk-readout {
  min-height: 40px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.hosted-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 36px 16px;
}

.hosted-shell--wide {
  width: min(1120px, 100%);
}

/* Tighter layout for the registration flow only. */
.hosted-shell--compact {
  padding: 20px 16px 28px;
}

.hosted-shell--compact .hosted-panel {
  padding: 20px 22px;
}

.hosted-shell--compact .hosted-panel h1 {
  margin-bottom: 6px;
  font-size: clamp(1.65rem, 4.5vw, 2.35rem);
}

.hosted-shell--compact .eyebrow {
  margin-bottom: 4px;
  font-size: 0.78rem;
}

.hosted-shell--compact .hosted-copy {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.45;
}

.hosted-shell--compact .hosted-form {
  gap: 10px;
  margin-top: 14px;
}

.hosted-shell--compact .hosted-form label:not(.scene-count) {
  grid-template-columns: minmax(6.5rem, 8.75rem) minmax(0, 1fr);
  align-items: center;
  gap: 8px 10px;
  font-size: 0.86rem;
}

.hosted-shell--compact .hosted-grid label {
  grid-template-columns: minmax(4.25rem, 5.75rem) minmax(0, 1fr);
  gap: 6px 8px;
}

.hosted-shell--compact .hosted-form > label input {
  height: 38px;
  padding: 0 10px;
  font-size: 0.94rem;
  min-width: 0;
}

.hosted-shell--compact .hosted-grid input[type="number"] {
  max-width: 5.5rem;
  justify-self: end;
}

.hosted-shell--compact .hosted-form .hosted-color-control {
  justify-content: stretch;
}

.hosted-shell--compact .scene-counts {
  font-size: 0.92rem;
  line-height: 1.7;
}

.hosted-shell--compact .hosted-section {
  margin-top: 14px;
  padding-top: 12px;
}

.hosted-shell--compact .hosted-form > .hosted-section {
  margin-top: 0;
}

.hosted-shell--compact .hosted-panel h2 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.hosted-shell--compact .hosted-grid,
.hosted-shell--compact .hosted-grid--compact {
  gap: 8px;
}

.hosted-shell--compact .hosted-position-groups {
  gap: 0.45rem;
  margin-top: 8px;
}

.hosted-shell--compact .hosted-position-hint {
  font-size: 0.8rem;
}

.hosted-shell--compact .scene-placements {
  font-size: 0.9rem;
  line-height: 1.65;
}

.hosted-shell--compact .hosted-footnote {
  margin-top: 16px;
  padding-top: 12px;
}

.hosted-shell--compact .hosted-steps {
  margin-top: 16px;
  gap: 16px;
}

.hosted-shell--compact .hosted-panel textarea {
  min-height: 132px;
  margin-top: 8px;
}

.hosted-shell--compact .hosted-copy-row {
  margin-top: 8px;
}

.hosted-panel {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hosted-panel h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
}

.hosted-panel h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.hosted-copy,
.hosted-note,
.hosted-status {
  color: var(--muted);
  line-height: 1.5;
}

.hosted-status--error {
  color: #a8431f;
}

.hosted-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hosted-quiet-button {
  min-height: 34px;
  border: 0;
  border-radius: 10px;
  padding: 0 12px;
  background: transparent;
  color: var(--ink-soft);
  font: 650 0.86rem var(--font);
  box-shadow: inset 0 0 0 1px var(--hair-2);
  cursor: pointer;
}

.hosted-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.hosted-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hosted-grid--compact {
  gap: 12px;
}

.hosted-style-hint {
  margin: -2px 0 12px;
  font-size: 0.86rem;
}

.hosted-style-matrix {
  display: grid;
  gap: 0;
  border: 1px solid var(--hair-2);
  border-radius: 12px;
  overflow: hidden;
  background: color-mix(in oklab, var(--surface) 72%, transparent);
}

.hosted-style-matrix__head,
.hosted-style-matrix__row {
  display: grid;
  grid-template-columns: minmax(6.75rem, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 12px;
  align-items: center;
  padding: 10px 14px;
}

.hosted-style-matrix__head {
  padding-block: 7px;
  border-bottom: 1px solid var(--hair-2);
  background: color-mix(in oklab, var(--surface-2) 55%, transparent);
  color: var(--ink-faint);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.hosted-style-matrix__head span:not(.hosted-style-matrix__token) {
  text-align: center;
}

.hosted-style-matrix__row + .hosted-style-matrix__row {
  border-top: 1px solid var(--hair-2);
}

.hosted-style-matrix__label {
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 600;
}

.hosted-style-matrix__cell {
  min-width: 0;
}

.hosted-preview-modes {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--hair-2);
  border-radius: 999px;
  background: color-mix(in oklab, var(--surface) 80%, transparent);
}

.hosted-preview-mode {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 3px 12px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.hosted-preview-mode.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(42, 41, 38, 0.12);
}

.hosted-form label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 650;
}

.hosted-form label small {
  font-weight: 500;
  color: var(--ink-faint);
}

.hosted-color-control {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.hosted-color-swatch {
  position: relative;
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--hair-2);
  overflow: hidden;
  cursor: pointer;
  background:
    linear-gradient(45deg, color-mix(in oklab, var(--ink-faint) 18%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in oklab, var(--ink-faint) 18%, transparent) 75%),
    linear-gradient(45deg, color-mix(in oklab, var(--ink-faint) 18%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in oklab, var(--ink-faint) 18%, transparent) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
  box-shadow: inset 0 1px 2px rgba(42, 41, 38, 0.05);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hosted-color-swatch:hover {
  border-color: color-mix(in oklab, var(--ink-faint) 42%, var(--hair-2));
}

.hosted-color-swatch:focus-within {
  outline: 2px solid color-mix(in oklab, var(--you) 42%, transparent);
  outline-offset: 1px;
}

.hosted-form .hosted-color-swatch input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.hosted-form .hosted-color-swatch input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.hosted-form .hosted-color-swatch input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}

.hosted-form .hosted-color-swatch input[type="color"]::-moz-color-swatch {
  border: 0;
  border-radius: 6px;
}

.hosted-color-swatch__state {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.hosted-color-none {
  flex: none;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--hair-2);
  border-radius: 999px;
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  color: var(--ink-faint);
  font: 650 0.67rem/1 var(--font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: none;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.hosted-color-none:hover,
.hosted-color-none:focus-visible {
  color: var(--ink-soft);
  border-color: color-mix(in oklab, var(--ink-faint) 36%, var(--hair-2));
  background: color-mix(in oklab, var(--surface-2) 90%, transparent);
}

.hosted-color-none:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--you) 42%, transparent);
  outline-offset: 1px;
}

.hosted-color-none[aria-pressed="true"] {
  color: var(--you-deep);
  border-color: color-mix(in oklab, var(--you) 34%, var(--hair-2));
  background: var(--you-tint);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--you) 20%, transparent);
}

.hosted-color-control--transparent .hosted-color-swatch {
  border-style: dashed;
  border-color: color-mix(in oklab, var(--ink-faint) 34%, var(--hair-2));
  cursor: pointer;
}

.hosted-color-control--transparent .hosted-color-swatch__state {
  opacity: 1;
}

.hosted-color-control--transparent .hosted-color-swatch input[type="color"] {
  opacity: 0;
  pointer-events: none;
}

.scene-counts {
  display: grid;
  gap: 0.2rem;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.75;
}

.scene-counts__lead {
  color: var(--muted);
}

.scene-counts__run {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.45rem;
}

.scene-counts__chunk {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}

.scene-count {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  white-space: nowrap;
  vertical-align: baseline;
}

.scene-counts__chunk--last {
  display: inline-flex;
  align-items: baseline;
  gap: 0.22em;
}

.scene-count__slot,
.scene-inline__slot {
  color: var(--ink-faint);
  font-weight: 500;
  user-select: none;
}

.scene-counts__sep,
.scene-counts__and,
.scene-counts__end,
.scene-placements__sep,
.scene-placements__and,
.scene-placements__end {
  color: var(--ink-faint);
}

.scene-counts__sep,
.scene-placements__sep {
  margin-right: 0.22em;
}

.scene-counts__and,
.scene-placements__and {
  margin-inline: 0 0.22em;
}

.scene-count__noun {
  color: var(--ink);
  font-weight: 550;
  margin-left: 0.22em;
}

.scene-placements {
  display: grid;
  gap: 0.2rem;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.7;
}

.scene-placements__run {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.45rem;
}

.scene-placements__chunk {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
  gap: 0.22em;
}

.scene-placements__chunk--last {
  display: inline-flex;
  align-items: baseline;
  gap: 0.22em;
}

.scene-placement {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  white-space: nowrap;
}

.scene-placement__label {
  color: var(--ink);
  font-weight: 550;
}

.scene-placement__at,
.scene-placement__unit {
  color: var(--ink-soft);
  font-weight: 500;
}

.hosted-form input,
.hosted-copy-row input,
.hosted-panel textarea {
  width: 100%;
  border: 1px solid var(--hair-2);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: 500 1rem var(--font);
}

.hosted-form input:not([type="color"]):not([type="hidden"]),
.hosted-copy-row input {
  height: 44px;
  padding: 0 12px;
}

.hosted-form .scene-count input[type="number"],
.hosted-form .scene-placement input[type="number"] {
  width: 2.1rem;
  min-width: 2.1rem;
  max-width: 2.1rem;
  flex: none;
  height: 1.55rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1.5px solid var(--hair-2);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 650 0.92rem/1 var(--font);
  font-variant-numeric: tabular-nums;
  text-align: center;
  vertical-align: baseline;
  -moz-appearance: textfield;
  appearance: textfield;
}

.hosted-form .scene-count input[type="number"]::-webkit-inner-spin-button,
.hosted-form .scene-count input[type="number"]::-webkit-outer-spin-button,
.hosted-form .scene-placement input[type="number"]::-webkit-inner-spin-button,
.hosted-form .scene-placement input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.hosted-form .scene-count input[type="number"]:hover:not(:focus),
.hosted-form .scene-placement input[type="number"]:hover:not(:focus) {
  border-bottom-color: color-mix(in oklab, var(--ink) 28%, var(--hair-2));
}

.hosted-form .scene-count input[type="number"]:focus,
.hosted-form .scene-placement input[type="number"]:focus {
  outline: none;
  border-bottom-color: var(--you);
  background: color-mix(in oklab, var(--you-tint) 72%, transparent);
  border-radius: 3px 3px 0 0;
}

.hosted-form .scene-count input[type="number"]:focus-visible,
.hosted-form .scene-placement input[type="number"]:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--you) 42%, transparent);
  outline-offset: 2px;
}

.hosted-copy-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.hosted-copy-row input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
}

.hosted-panel textarea {
  min-height: 170px;
  margin-top: 12px;
  padding: 12px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}

.hosted-form button,
.hosted-actions button,
.hosted-button,
.hosted-copy-row button,
.visitor-row button,
.service-row-menu-panel button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  background: var(--ink);
  color: var(--surface);
  font: 700 0.92rem var(--font);
  text-decoration: none;
  cursor: pointer;
}

.hosted-form button[disabled] {
  opacity: 0.6;
  cursor: default;
}

.hosted-button,
.hosted-actions button:nth-child(n + 2),
.hosted-copy-row button,
.visitor-row button,
.service-row-menu-panel button {
  display: inline-flex;
  align-items: center;
  flex: none;
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hair-2);
}

.hosted-connections {
  display: grid;
  gap: 10px;
  margin: 4px 0 14px;
}

.hosted-connection-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.4fr) auto;
  gap: 8px;
  align-items: center;
}

.hosted-connection-row select,
.hosted-connection-row input {
  min-height: 38px;
  border-radius: 9px;
  border: 1px solid var(--hair-2);
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font: 400 0.9rem var(--font);
}

.hosted-connection-row input:focus-visible,
.hosted-connection-row select:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--you) 48%, transparent);
  outline-offset: 1px;
}

.hosted-connection-remove {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hair-2);
  font: 500 0.85rem var(--font);
  cursor: pointer;
}

@media (max-width: 540px) {
  .hosted-connection-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .hosted-connection-row .hosted-connection-url {
    grid-column: 1 / -1;
  }
}

.hosted-steps {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: hosted-step;
  display: grid;
  gap: 22px;
}

.hosted-steps li {
  counter-increment: hosted-step;
  position: relative;
  padding: 0 0 0 44px;
}

.hosted-steps li::before {
  content: counter(hosted-step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--you-tint);
  color: var(--you-deep);
  font-weight: 750;
  font-size: 0.92rem;
}

.hosted-steps h2 {
  margin: 0 0 6px;
}

.hosted-steps .hosted-note {
  margin: 0 0 4px;
}

.hosted-footnote {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--hair-2);
  font-size: 0.92rem;
}

.hosted-footnote a {
  color: var(--you-deep);
  font-weight: 650;
}

.hosted-section,
.hosted-meta {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--hair-2);
}

.hosted-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.hosted-position-groups {
  display: grid;
  gap: 0.55rem;
  margin-top: 10px;
}

.hosted-position-hint {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.35;
}

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

.hosted-meta div {
  min-width: 0;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
}

.hosted-meta dt {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.hosted-meta dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.hosted-section-head,
.hosted-toggle,
.visitor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hosted-toggle {
  justify-content: flex-start;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 650;
}

.hosted-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--you);
}

/* Inside a form, `.hosted-form label`/`input` defaults would stack the box
   above the text and stretch it into a full-width 44px pill — keep the toggle
   a tidy inline row with a real checkbox. */
.hosted-form .hosted-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
}

.hosted-form .hosted-toggle input[type="checkbox"] {
  flex: none;
  width: 18px;
  min-width: 18px;
  height: 18px;
  padding: 0;
  cursor: pointer;
}

.visitor-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.visitor-row {
  padding: 12px;
  border: 1px solid var(--hair-2);
  border-radius: 10px;
}

.visitor-row div {
  display: grid;
  gap: 3px;
}

.visitor-row span {
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.hosted-subhead {
  margin: 22px 0 0;
  font-size: 0.92rem;
  font-weight: 750;
  color: var(--ink-soft);
}

.chat-thread {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--hair-2);
  border-radius: 10px;
  background: var(--surface-2);
}

.chat-message {
  display: grid;
  gap: 2px;
}

.chat-message-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.chat-author {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--author-color, var(--ink));
}

.chat-time {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.chat-mod-button {
  margin-left: auto;
  border: 0;
  border-radius: 8px;
  padding: 2px 10px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--hair-2);
  color: var(--ink-soft);
  font: 650 0.76rem var(--font);
  cursor: pointer;
}

.chat-mod-button + .chat-mod-button {
  margin-left: 0;
}

.chat-mod-button:hover {
  color: var(--ink);
}

.chat-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.service-sites {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.service-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.service-filter {
  display: grid;
  gap: 6px;
  flex: 1 1 280px;
  min-width: 0;
}

.service-filter-label {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.service-filter input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--hair-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: 500 0.92rem var(--font);
}

.service-filter-meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.service-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hair-2);
  border-radius: 10px;
}

.service-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.service-table th,
.service-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--hair-2);
  text-align: left;
  vertical-align: middle;
}

.service-table tbody tr:last-child td {
  border-bottom: 0;
}

.service-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.service-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.service-sort-button::after {
  content: "↕";
  opacity: 0.35;
  font-size: 0.72rem;
}

.service-sort-button--active::after {
  opacity: 1;
  color: var(--ink);
}

.service-sort-button[aria-sort="ascending"]::after {
  content: "↑";
}

.service-sort-button[aria-sort="descending"]::after {
  content: "↓";
}

.service-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.service-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.service-status-badge--off {
  background: color-mix(in srgb, #a8431f 12%, transparent);
  color: #a8431f;
}

.service-table-actions-head,
.service-table-actions-cell {
  width: 1%;
  white-space: nowrap;
}

.service-row-menu {
  position: relative;
}

.service-row-menu > summary {
  display: inline-flex;
  align-items: center;
  list-style: none;
  min-height: 34px;
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hair-2);
  font: 700 0.86rem var(--font);
  cursor: pointer;
  user-select: none;
}

.service-row-menu > summary::-webkit-details-marker {
  display: none;
}

.service-row-menu > summary::after {
  content: "▾";
  margin-left: 8px;
  font-size: 0.72rem;
}

.service-row-menu[open] > summary::after {
  content: "▴";
}

.service-row-menu-panel {
  position: absolute;
  right: 0;
  z-index: 2;
  display: grid;
  gap: 6px;
  min-width: 180px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--hair-2);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.service-row-menu-panel button {
  width: 100%;
  min-height: 36px;
  justify-content: flex-start;
  padding: 0 10px;
  font-size: 0.86rem;
}

.service-row-menu-panel .service-danger {
  color: #a8431f;
}

/* Docs page — long-form usage + deployment guide. */
.docs-page {
  min-height: 100vh;
}

.docs-shell {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 32px 16px 64px;
  display: grid;
  gap: 32px;
  grid-template-columns: 1fr;
}

@media (min-width: 880px) {
  .docs-shell {
    grid-template-columns: 13.5rem minmax(0, 1fr);
    gap: 44px;
  }
}

.docs-home {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.docs-home:hover {
  color: var(--ink);
}

.docs-nav {
  display: grid;
  gap: 2px;
}

/* Collapsible "On this page" toggle — shown on mobile, hidden on desktop. */
.docs-toc__summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--hair-2);
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.docs-toc__summary::-webkit-details-marker {
  display: none;
}

.docs-toc__summary::after {
  content: "▾";
  font-size: 0.75em;
  transition: transform 0.15s ease;
}

.docs-toc__details[open] .docs-toc__summary::after {
  transform: rotate(180deg);
}

.docs-toc__details .docs-nav {
  margin-top: 12px;
}

@media (min-width: 880px) {
  .docs-toc {
    position: sticky;
    top: 24px;
    align-self: start;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* On desktop the nav is always open; show the label as a plain heading. */
  .docs-toc__summary {
    padding: 0;
    border: 0;
    color: var(--ink-faint);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: default;
    pointer-events: none;
  }

  .docs-toc__summary::after {
    content: none;
  }

  .docs-toc__details > .docs-nav {
    display: grid;
    margin-top: 12px;
  }
}

.docs-nav__group {
  margin: 18px 0 6px;
  color: var(--ink-faint);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-nav__group:first-child {
  margin-top: 0;
}

.docs-nav a {
  display: block;
  padding: 4px 10px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.35;
  text-decoration: none;
}

.docs-nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}

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

.docs-article {
  width: min(720px, 100%);
}

.docs-article > .eyebrow {
  margin-bottom: 6px;
}

.docs-article h1 {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  line-height: 1.02;
}

.docs-lead {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 1.08rem;
  line-height: 1.55;
}

.docs-section {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--hair);
  scroll-margin-top: 24px;
}

.docs-section h2 {
  margin: 0 0 12px;
  font-size: 1.45rem;
  line-height: 1.15;
}

.docs-section--lead h2 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}

.docs-section--lead .eyebrow {
  margin-bottom: 8px;
}

.docs-section h3 {
  margin: 24px 0 8px;
  font-size: 1.05rem;
  font-weight: 650;
}

.docs-article p {
  margin: 0 0 14px;
  color: color-mix(in oklab, var(--text) 90%, var(--muted) 10%);
  font-size: 1rem;
  line-height: 1.65;
}

.docs-article ul,
.docs-article ol {
  margin: 0 0 14px;
  padding-left: 22px;
}

.docs-article li {
  margin: 4px 0;
  color: color-mix(in oklab, var(--text) 90%, var(--muted) 10%);
  font-size: 1rem;
  line-height: 1.6;
}

.docs-article a {
  color: var(--you-deep);
  font-weight: 600;
  text-decoration: none;
}

.docs-article a:hover {
  text-decoration: underline;
}

.docs-article code {
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
}

.docs-article pre {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--hair-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  overflow-x: auto;
}

.docs-article pre code {
  padding: 0;
  border-radius: 0;
  background: none;
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.55;
}

.docs-note {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--you);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--you-tint);
}

.docs-article .docs-note {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.docs-table {
  width: 100%;
  margin: 0 0 16px;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.docs-table th,
.docs-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--hair-2);
  text-align: left;
  vertical-align: top;
}

.docs-table thead th {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.docs-table td:first-child {
  white-space: nowrap;
  font-weight: 600;
}

.docs-table code {
  white-space: nowrap;
}

.docs-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--hair-2);
}

@media (max-width: 640px) {
  :root {
    --hosted-preview-dock-height: min(42dvh, 13.75rem);
    --hosted-preview-dock-chrome: 1.75rem;
  }

  .hosted-preview-dock .hosted-section-head {
    padding-inline: 12px;
  }

  .hosted-preview-dock .townsquare-host {
    padding-inline: 8px;
  }

  .page-card { padding: 20px; border-radius: 20px; }
  .hosted-panel { padding: 20px; }
  .hosted-shell--compact {
    padding: 16px 12px 24px;
  }
  .hosted-shell--compact .hosted-panel {
    padding: 16px;
  }
  .hosted-shell--compact .hosted-form label:not(.scene-count),
  .hosted-shell--compact .hosted-grid label {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 4px;
  }
  .hosted-shell--compact .hosted-grid input[type="number"] {
    width: 100%;
    max-width: none;
    justify-self: stretch;
  }
  .hosted-shell--compact .hosted-form .hosted-color-control {
    justify-content: stretch;
  }
  .hosted-style-matrix__head {
    display: none;
  }
  .hosted-style-matrix__row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 14px;
  }
  .hosted-style-matrix__cell::before {
    content: attr(data-mode);
    display: block;
    margin-bottom: 5px;
    color: var(--ink-faint);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .hosted-grid,
  .hosted-meta dl {
    grid-template-columns: 1fr;
  }
  .hosted-copy-row {
    flex-wrap: wrap;
  }
  .hosted-section-head,
  .visitor-row {
    align-items: stretch;
    flex-direction: column;
  }
  .townsquare-host { margin-top: 32px; }
  .docs-shell { padding: 24px 14px 48px; gap: 8px; }
  .docs-footer {
    flex-direction: column;
    align-items: flex-start;
  }
  .dev-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .dev-controls {
    align-items: end;
  }
  .dev-host .townsquare__stage {
    height: 300px;
  }
  .walk-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .walk-controls {
    flex-wrap: wrap;
  }
  .walk-stage {
    min-height: 58vh;
  }
}
