.cs-page {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, sans-serif;
}

.ci-sta,
.ci-sta *,
.cs-tests,
.cs-tests * {
  box-sizing: border-box;
}

.ci-sta,
.cs-tests {
  width: 100%;
  max-width: var(--prose);
  margin: 0 auto;
  padding: 1rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.ci-sta h1,
.cs-tests h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  line-height: 1.15;
}

.ci-sta p,
.ci-sta li {
  line-height: 1.55;
}

.cs-notice {
  padding: 1rem;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border: 2px solid var(--warn-line);
  border-radius: var(--radius);
}

.cs-result {
  padding: 1rem;
  border: 2px solid var(--brand);
  border-radius: var(--radius);
  background: var(--ok-bg);
  color: var(--ink);
  font-weight: 700;
}

.ci-sta[data-status="warning"] .cs-result {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-color: var(--accent-deep);
}

.ci-sta[data-status="no"] .cs-result {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger);
}

.cs-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
  margin: 1rem 0;
}

.cs-field {
  flex: 1 1 100%;
  min-width: 0;
}

.cs-field label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.ci-sta select,
.ci-sta button {
  max-width: 100%;
  min-height: 44px;
  padding: 0.7rem 0.8rem;
  border: 2px solid var(--brand);
  border-radius: var(--radius-field);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.ci-sta select {
  width: 100%;
}

.ci-sta button {
  flex: 1 1 8rem;
  cursor: pointer;
  font-weight: 700;
}

.ci-sta button:disabled,
.ci-sta select:disabled {
  cursor: default;
  border-color: var(--line);
  color: var(--ink-2);
}

.ci-sta button:hover:enabled {
  background: var(--brand-tint);
}

.ci-sta :focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

.cs-plan {
  display: block;
  width: 100%;
  height: auto;
  max-height: 75vh;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.cs-floor {
  fill: var(--surface);
}

.cs-wall {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
}

.cs-window {
  stroke: var(--brand);
  stroke-width: 4;
}

.cs-wall-label {
  fill: var(--ink);
  font-size: 8px;
  font-weight: 700;
}

.cs-door {
  fill: var(--warn-bg);
  stroke: var(--warn-ink);
  stroke-width: 0.7;
  stroke-dasharray: 3 2;
}

.cs-door-edge {
  stroke: var(--warn-ink);
  stroke-width: 2;
}

.cs-footprint {
  fill: none;
  stroke: var(--brand);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.cs-clearance {
  fill: var(--ok-bg);
  stroke: var(--brand);
  stroke-width: 1;
  stroke-dasharray: 3 2;
}

.cs-clearance-bad {
  fill: var(--warn-bg);
  stroke: var(--danger);
  stroke-width: 2;
  stroke-dasharray: 2 2;
}

.cs-piece-body {
  fill: var(--surface-2);
  stroke: var(--ink-2);
  stroke-width: 1;
}

.cs-piece[role="button"] {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.cs-piece[role="button"]:active {
  cursor: grabbing;
}

.cs-shower .cs-piece-body {
  fill: var(--brand-tint);
  stroke: var(--brand);
  stroke-width: 2;
}

.cs-mirror .cs-piece-body {
  fill: var(--surface);
  fill-opacity: 0.85;
  stroke-dasharray: 2 2;
}

.cs-front-mark {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 0.7;
  stroke-dasharray: 2 2;
}

.cs-piece-label,
.cs-piece-measure {
  fill: var(--ink);
  stroke: var(--surface-2);
  stroke-width: 1.5;
  paint-order: stroke;
  pointer-events: none;
}

.cs-piece-label {
  font-size: 6.5px;
  font-weight: 700;
}

.cs-piece-measure {
  font-size: 6px;
}

.cs-invalid .cs-piece-body {
  stroke: var(--danger);
  stroke-width: 2;
}

.cs-selected .cs-piece-body,
.cs-piece:focus .cs-piece-body {
  stroke: var(--brand);
  stroke-width: 3;
  stroke-dasharray: 4 2;
}

.cs-piece:focus {
  outline: none;
}

.cs-selection {
  font-weight: 700;
}

.cs-messages {
  padding-left: 1.4rem;
}

.cs-messages li + li {
  margin-top: 0.4rem;
}

.cs-legend {
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  background: var(--surface);
}

.cs-cta {
  display: block;
  margin: 1.25rem 0;
  padding: 1rem;
  background: var(--brand);
  color: var(--brand-deep);
  border-radius: var(--radius);
  text-align: center;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

@media (prefers-color-scheme: light) {
  .cs-cta {
    background: var(--brand-tint);
    color: var(--ink);
    border: 2px solid var(--brand);
  }
}

.cs-tests pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface);
  color: var(--ink);
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

@media (max-width: 400px) {
  .ci-sta,
  .cs-tests {
    padding: 0.75rem;
  }

  .cs-controls {
    gap: 0.5rem;
  }

  .ci-sta button {
    flex-basis: 100%;
  }
}

@media (forced-colors: active) {
  .cs-piece:focus .cs-piece-body,
  .cs-selected .cs-piece-body {
    stroke-width: 4;
    stroke-dasharray: 2 2;
  }
}