/*
 * TownSquare full-page chrome.
 *
 * Loaded only on TownSquare server pages (admin, map, dev tools). The shared
 * public foundation is independent from the embeddable widget.
 */
@import url("./design/tokens.css");
@import url("./design/base.css");
@import url("./design/components.css");

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background: radial-gradient(120% 80% at 50% -10%, #fdf8ee 0%, var(--cream) 46%, #f6edda 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.eyebrow {
  margin: 0 0 8px;
  color: #a96f40;
  font: 500 0.78rem var(--font-mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.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: var(--r-card);
  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 {
  position: relative;
  flex: none;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  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%),
    var(--cream-deep);
  background-size: 7px 7px, 7px 7px, auto;
  background-position: 0 0, 3.5px 3.5px, 0 0;
  color: var(--ink);
  font: inherit;
  box-shadow: inset 0 0 0 1px var(--hair-2);
  cursor: pointer;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

.hosted-color-none::before,
.hosted-color-none::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62%;
  height: 1.5px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--ink-faint) 72%, transparent);
  pointer-events: none;
}

.hosted-color-none::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.hosted-color-none::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.hosted-color-none:hover,
.hosted-color-none:focus-visible {
  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%),
    var(--surface-2);
  background-size: 7px 7px, 7px 7px, auto;
  background-position: 0 0, 3.5px 3.5px, 0 0;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink-faint) 28%, var(--hair-2));
}

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

.hosted-color-none[aria-pressed="true"] {
  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%),
    var(--surface);
  background-size: 7px 7px, 7px 7px, auto;
  background-position: 0 0, 3.5px 3.5px, 0 0;
  box-shadow:
    inset 0 0 0 1px color-mix(in oklab, var(--ink-faint) 34%, var(--hair-2)),
    0 1px 2px rgba(42, 41, 38, 0.08);
}

.hosted-color-none[aria-pressed="true"]::before,
.hosted-color-none[aria-pressed="true"]::after {
  background: color-mix(in oklab, var(--ink-soft) 78%, 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-form select,
.hosted-copy-row input,
.hosted-panel textarea {
  width: 100%;
  border: 1px solid var(--hair-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: 500 1rem var(--font);
}

.hosted-form input:not([type="color"]):not([type="hidden"]),
.hosted-form select,
.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,
.owner-editor__save,
.service-row-menu-panel button {
  min-height: 40px;
  border: 0;
  border-radius: var(--r-control);
  padding: 0 14px;
  background: var(--accent);
  color: var(--cream);
  font: 600 0.92rem var(--font-display);
  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,
.owner-editor__save,
.service-row-menu-panel button {
  display: inline-flex;
  align-items: center;
  flex: none;
  background: var(--cream-deep);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hair-2);
}

.hosted-form .hosted-color-none {
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  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%),
    var(--cream-deep);
  background-size: 7px 7px, 7px 7px, auto;
  background-position: 0 0, 3.5px 3.5px, 0 0;
  color: var(--ink);
  font: inherit;
  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;
}

/* Read-only feed of recent moderation actions under the Moderation section. */
.moderation-log {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  max-height: 200px;
  overflow-y: auto;
}

.moderation-log-entry {
  display: flex;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.moderation-log-entry time {
  flex: none;
  font-variant-numeric: tabular-nums;
}

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

/* Dedicated "Site owner" section: one card per owner with a persistent
   name + colour editor. */
.owner-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

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

.owner-row__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.owner-row__head strong {
  font-weight: 700;
}

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

.owner-editor {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hair-2);
}

.owner-editor__name {
  flex: 1 1 140px;
  min-height: 40px;
  min-width: 0;
  border-radius: 10px;
  border: 0;
  box-shadow: inset 0 0 0 1px var(--hair-2);
  padding: 0 12px;
  font: 600 0.92rem var(--font);
  background: var(--surface);
  color: var(--ink);
}

.owner-editor__swatch-label {
  flex: 0 0 100%;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.owner-editor__swatch--badge {
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 12%, transparent);
}

.owner-editor__swatches {
  display: flex;
  gap: 6px;
  /* Stay one indivisible row: the growing name field can't squeeze these into
     a vertical column, and a tight editor wraps the whole block to a new line. */
  flex: 0 0 auto;
}

.owner-editor__swatch {
  min-height: 26px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.owner-editor__swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink);
}

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

.map-editor__status {
  margin: 0;
  text-align: right;
}

.map-editor__toolbar,
.map-editor__tools,
.map-editor__brush-controls,
.map-editor__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.map-editor__brush-controls label {
  display: grid;
  gap: 3px;
  min-width: 130px;
  color: var(--ink-soft);
  font: 650 0.72rem var(--font);
}

.map-editor__brush-controls [hidden] {
  display: none;
}

.map-editor__brush-controls output {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.map-editor__brush-controls input[type="range"] {
  width: 130px;
  accent-color: var(--you);
}

.map-editor__toolbar {
  justify-content: space-between;
  margin: 14px 0 10px;
}

.map-editor__toolbar button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hair-2);
  font: 700 0.84rem var(--font);
  cursor: pointer;
}

.map-editor__toolbar button[aria-pressed="true"],
.map-editor__toolbar #map-save {
  background: var(--ink);
  color: var(--surface);
  box-shadow: none;
}

.map-editor__toolbar button:disabled {
  cursor: default;
  opacity: 0.45;
}

.map-editor__canvas {
  overflow: hidden;
  aspect-ratio: 3 / 2;
  min-height: 360px;
  border: 1px solid var(--hair-2);
  border-radius: 12px;
  background:
    radial-gradient(circle at 18% 12%, rgba(200, 100, 31, 0.08), transparent 26%),
    linear-gradient(180deg, var(--page), var(--scene-edge));
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.map-editor__svg {
  display: block;
  width: 100%;
  height: 100%;
}

.map-editor__svg .map-scenery,
.map-editor__svg .map-edges,
.map-editor__towns {
  pointer-events: none;
}

.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-supporter-star {
  color: #f0c020;
  font-weight: 700;
}

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

.map-page {
  min-height: 100vh;
  overflow-x: hidden;
}

.map-shell {
  display: grid;
  gap: 24px;
  width: min(1240px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 48px;
  align-content: start;
}

.map-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(240px, 430px);
  align-items: end;
  gap: 18px;
  padding: 0 4px;
}

.map-header h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3.5vw, 2.7rem);
  letter-spacing: -0.02em;
  line-height: 1;
}

.map-header p:not(.eyebrow) {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.45;
}

.map-supporter-note {
  margin: 0;
  max-width: 52ch;
  justify-self: center;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.map-supporter-note a {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

.map-supporter-note a:hover {
  text-decoration: underline;
}

.map-home {
  align-self: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

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

.map-stage {
  position: relative;
  width: 100%;
  height: min(72vh, 780px);
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--hair-2);
  border-radius: var(--r-card);
  background:
    radial-gradient(circle at 18% 12%, rgba(200, 100, 31, 0.08), transparent 26%),
    linear-gradient(180deg, var(--page), var(--scene-edge));
  box-shadow: var(--shadow);
}

.map-canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  outline: none;
}

.map-canvas.is-panning {
  cursor: grabbing;
}

.map-canvas:focus-visible {
  box-shadow: inset 0 0 0 3px var(--you-tint);
}

.map-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.map-mountain {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke: color-mix(in oklab, var(--ink) 58%, transparent);
  stroke-width: 4;
  opacity: 0.72;
}

.map-lake {
  fill: none;
  stroke: color-mix(in oklab, #79a9b5 58%, var(--surface) 42%);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-river,
.map-river__bank {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-river__bank {
  stroke: color-mix(in oklab, #527f8a 50%, var(--page) 50%);
  opacity: 0.55;
}

.map-river {
  stroke: color-mix(in oklab, #79a9b5 72%, var(--surface) 28%);
}

.map-tree__crown {
  fill: color-mix(in oklab, #5f7d55 84%, var(--surface) 16%);
  stroke: color-mix(in oklab, #5f7d55 76%, var(--ink) 24%);
  stroke-width: 3;
  stroke-linejoin: round;
  opacity: 0.88;
}

.map-tree__trunk {
  fill: none;
  stroke: color-mix(in oklab, #4a6342 80%, var(--ink) 20%);
  stroke-width: 4;
  stroke-linecap: round;
  opacity: 0.78;
}
.map-link {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-link--asphalt {
  stroke: color-mix(in oklab, #3a3835 78%, var(--ink) 22%);
  stroke-width: 5.5;
  opacity: 0.82;
}

.map-link--dirt {
  stroke: color-mix(in oklab, #9a7f5c 72%, var(--ink-soft) 28%);
  stroke-width: 3.5;
  stroke-dasharray: 7 11;
  opacity: 0.62;
}

.map-link--asphalt.is-active {
  stroke: color-mix(in oklab, var(--you-deep) 68%, #3a3835 32%);
  stroke-width: 6.5;
  opacity: 1;
}

.map-link--dirt.is-active {
  stroke: color-mix(in oklab, var(--you-deep) 52%, #9a7f5c 48%);
  stroke-width: 4.5;
  opacity: 0.92;
}

.map-node {
  cursor: pointer;
  outline: none;
}

.map-node__dot {
  fill: var(--you);
  stroke: var(--ink);
  stroke-width: 2;
  transition: stroke-width 120ms ease;
}

.map-node__activity {
  pointer-events: none;
}

.map-node__activity-dot {
  fill: color-mix(in oklab, #fff1b8 88%, var(--surface) 12%);
  filter: drop-shadow(0 0 3px rgba(255, 237, 164, 0.9));
  animation: map-activity-pulse 1.8s ease-in-out infinite alternate;
}

@keyframes map-activity-pulse {
  from { opacity: 0.48; }
  to { opacity: 1; }
}

.map-node__label {
  fill: var(--ink);
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 5;
  stroke-linejoin: round;
  font: 600 17px var(--font-body);
  text-anchor: middle;
  pointer-events: none;
}

.map-node__supporter-star {
  fill: #f0c020;
  stroke: var(--ink);
  stroke-width: 1.5;
  paint-order: stroke;
  font-family: var(--font);
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.18));
}

.map-node:hover .map-node__dot,
.map-node:focus-visible .map-node__dot,
.map-node.is-selected .map-node__dot {
  stroke-width: 5;
}

@media (prefers-reduced-motion: reduce) {
  .map-node__activity-dot {
    animation: none;
  }
}

.map-toolbar,
.map-status {
  position: absolute;
  z-index: 1;
}

.map-toolbar {
  top: 16px;
  left: 16px;
  display: flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--hair-2);
  border-radius: 12px;
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  box-shadow: var(--bshadow);
}

.map-toolbar button,
.map-detail__close {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--hair-2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: 700 0.92rem var(--font);
  cursor: pointer;
}

.map-toolbar button:hover,
.map-detail__close:hover {
  background: var(--surface-2);
}

.map-status {
  left: 16px;
  bottom: 16px;
  max-width: min(420px, calc(100% - 32px));
  padding: 9px 12px;
  border: 1px solid var(--hair-2);
  border-radius: 10px;
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--bshadow);
}

.map-detail {
  width: min(330px, calc(100% - 32px));
  margin: auto;
  padding: 18px;
  border: 1px solid var(--hair-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--tray-shadow);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.map-detail::backdrop {
  background: color-mix(in oklab, var(--ink) 38%, transparent);
}

.map-detail__close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.map-detail h2 {
  margin: 0 38px 7px 0;
  font-size: 1.25rem;
  line-height: 1.1;
}

.map-detail__origin {
  display: inline-block;
  max-width: 100%;
  color: var(--you-deep);
  font-size: 0.94rem;
  font-weight: 650;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.map-detail__visit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 18px;
  min-height: 40px;
  border-radius: var(--r-control);
  background: var(--accent);
  color: var(--cream);
  font: 600 1rem var(--font-display);
  text-decoration: none;
}

@media (max-width: 900px) {
  .map-shell {
    width: calc(100% - 32px);
  }
  .map-header {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }
  .map-header > p:not(.eyebrow) {
    grid-column: 1 / -1;
    max-width: 680px;
  }
  .map-stage {
    height: min(68vh, 620px);
    min-height: 460px;
  }
}

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

  .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;
  }
  .map-editor__status {
    text-align: left;
  }
  .map-editor__canvas {
    min-height: 260px;
  }
  .townsquare-host { margin-top: 32px; }
  .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;
  }
  .map-header {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
    padding: 0 2px;
  }
  .map-shell {
    gap: 16px;
    width: calc(100% - 24px);
    padding: 18px 0 28px;
  }
  .map-stage {
    height: min(68dvh, 520px);
    min-height: 380px;
    border-radius: 12px;
  }
  .map-toolbar {
    top: 10px;
    left: 10px;
  }
  .map-status {
    left: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
  }
  .map-detail { width: calc(100% - 20px); }
}
