:root {
  color-scheme: light;
  font-family: "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --bg: #f0f0f0;
  --header: #153e60;
  --unmeasured: #8a93a3;
  --header-text: #ffffff;
  --surface: #f0f0f0;
  --field: #ffffff;
  --text: #1a1a1a;
  --muted: #4a5568;
  --border: #c9ced6;
  --select-bg: #cfe0f5;
  --select-fg: #10233a;
  --danger: #8b1e1e;
  --danger-bg: #fbdedb;
  --danger-border: #d9aca5;
  --measured: #2f8a45;
  /* The wall whose thickness is asked: violet, apart from the red of a length being asked (Bolat, 10.10.2026). */
  --thickness-ask: #a389c9;
  --busy: #1e7a45;
  --busy-bg: #e7f3eb;
  --button: #285778;
  --button-bg: #e5edf5;
  --button-hover: #d3e3f1;
  --button-pressed: #bdd3e6;
  --button-border: #aebecb;
  --nav-selected: #c5dced;
  --nav-text: #153e60;
  --nav-border: #7898b4;
  --moon: #6f7787;
  --canvas-grid: rgba(74, 85, 104, 0.08);
  background: var(--bg);
  color: var(--text);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1f2228;
  --header: #15181d;
  --unmeasured: #a1a9b6;
  --header-text: #e8ecf3;
  --surface: #272b33;
  --field: #2c313a;
  --text: #dfe3ea;
  --muted: #98a1b0;
  --border: #3a4049;
  --select-bg: #3c5a7a;
  --select-fg: #f2f5f9;
  --danger: #f0a99f;
  --danger-bg: #452c29;
  --danger-border: #c0453c;
  --measured: #5cc27a;
  --thickness-ask: #8b5cf6;
  --busy: #7fc79a;
  --busy-bg: #263b30;
  --button: #a9c7e4;
  --button-bg: #2c3a49;
  --button-hover: #384b60;
  --button-pressed: #243444;
  --button-border: #526171;
  --nav-selected: #385775;
  --nav-text: #f0f5fc;
  --nav-border: #7596b6;
  --moon: #8b93a3;
  --canvas-grid: rgba(223, 227, 234, 0.06);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}
button, input, select { font: inherit; }
button {
  min-height: 3rem;
  border: 1px solid var(--button-border);
  border-radius: 0.72rem;
  padding: 0.68rem 0.9rem;
  color: var(--button);
  background: var(--button-bg);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
button:hover:not(:disabled) { background: var(--button-hover); }
button:active:not(:disabled) { background: var(--button-pressed); }
button:disabled { opacity: 0.42; cursor: not-allowed; }
.shell {
  width: min(100%, 48rem);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 0.8rem calc(5.4rem + env(safe-area-inset-bottom));
}
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  margin: 0 -0.8rem 0.65rem;
  padding: calc(env(safe-area-inset-top) + 0.45rem) 0.8rem 0.45rem;
  color: var(--header-text);
  background: var(--header);
}
.brand { display: flex; flex: 1; align-items: center; min-width: 0; gap: 0.65rem; }
.brand h1 { overflow: hidden; margin: 0; font-size: clamp(1.05rem, 4.6vw, 1.3rem); text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; flex: 0 0 auto; gap: 0.1rem; }
.topbar .icon-button { width: 2.9rem; min-height: 2.9rem; border: 0; border-radius: 50%; color: var(--header-text); background: transparent; }
.topbar .icon-button:hover:not(:disabled), .topbar .icon-button:active:not(:disabled) { background: rgba(255, 255, 255, 0.16); }
.topbar .icon-button:disabled { opacity: 0.38; }
.icon-button { display: grid; width: 2.75rem; min-height: 2.75rem; padding: 0; place-items: center; font-size: 1.25rem; }
#installButton { width: 100%; min-height: 2.7rem; margin-bottom: 0.6rem; }
h1, h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 0.7rem; font-size: clamp(1.25rem, 5vw, 1.65rem); }
.eyebrow, .step { margin-bottom: 0.2rem; color: var(--button); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.design-link { display: none; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: clamp(0.85rem, 3.5vw, 1.35rem);
  box-shadow: 0 0.35rem 1.2rem rgba(16, 35, 58, 0.07);
}
label { display: grid; gap: 0.36rem; margin-top: 0.9rem; color: var(--text); font-size: 0.88rem; font-weight: 650; }
input, select {
  width: 100%;
  min-height: 3.15rem;
  border: 1px solid var(--border);
  border-radius: 0.68rem;
  padding: 0.7rem 0.82rem;
  background: var(--field);
  color: var(--text);
  font-size: 1.04rem;
}
input:focus, select:focus { outline: 3px solid color-mix(in srgb, var(--nav-border) 24%, transparent); border-color: var(--nav-border); }
.primary { width: 100%; margin-top: 1rem; color: var(--nav-text); background: var(--nav-selected); border-color: var(--nav-border); }
.secondary { width: 100%; margin-top: 0.85rem; }
.quiet { color: var(--button); background: transparent; border-color: var(--button-border); }
.danger { color: var(--danger); background: transparent; border-color: var(--danger-border); }
.wide { width: 100%; margin-top: 0.6rem; }
.hint, .lead, .save-status { color: var(--muted); line-height: 1.42; }
.hint { margin: 0.6rem 0 0; font-size: 0.86rem; }
.lead { margin-bottom: 0.85rem; }
.save-status { min-height: 1.2rem; margin: 0 0 0.5rem; font-size: 0.78rem; }
.message { padding: 0.72rem 0.85rem; border-radius: 0.7rem; margin-bottom: 0.65rem; }
.error { color: var(--danger); background: var(--danger-bg); border: 1px solid var(--danger-border); }
.notice { color: var(--busy); background: var(--busy-bg); border: 1px solid color-mix(in srgb, var(--busy) 45%, var(--border)); }
.measure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.preview { position: relative; margin: 0.9rem 0 0; padding: 0.45rem; background: var(--field); border: 1px solid var(--border); border-radius: 0.85rem; overflow: hidden; }
canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  border-radius: 0.55rem;
  background-color: var(--field);
  background-image: linear-gradient(var(--canvas-grid) 1px, transparent 1px), linear-gradient(90deg, var(--canvas-grid) 1px, transparent 1px);
  background-size: 42px 42px;
  touch-action: manipulation;
}
figcaption { display: flex; flex-wrap: wrap; gap: 0.75rem; padding: 0.6rem 0.2rem 0; color: var(--muted); font-size: 0.76rem; }
figcaption span { display: inline-flex; align-items: center; gap: 0.3rem; }
figcaption i { width: 1.4rem; border-top: 3px solid var(--measured); }
figcaption i.inferred { border-top-style: solid; border-color: var(--measured); }
.actions { display: grid; grid-template-columns: 1fr 2fr; gap: 0.65rem; }
.actions .primary { margin-top: 1rem; }
.type-tabs, .presets { display: flex; flex-wrap: wrap; gap: 0.42rem; }
.type-tabs { margin: 0.7rem 0; }
.type { flex: 1; color: var(--button); background: transparent; }
.type.active { color: var(--nav-text); background: var(--nav-selected); border-color: var(--nav-border); }
.preset { min-height: 2.5rem; padding: 0.4rem 0.72rem; background: var(--field); }
.preset.active { color: var(--nav-text); border-color: var(--nav-border); background: var(--nav-selected); }
.opening-list, .survey-list { display: grid; gap: 0.5rem; margin-top: 0.85rem; }
.opening-row, .survey-card { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; padding: 0.7rem; border: 1px solid var(--border); border-radius: 0.72rem; background: var(--field); }
.opening-row button, .compact { width: auto; min-height: 2.3rem; margin-top: 0; padding: 0.3rem 0.62rem; }
.summary { padding: 0.85rem; border: 1px solid var(--border); border-radius: 0.78rem; background: var(--field); line-height: 1.5; }
.summary strong { display: block; font-size: 1.08rem; }
[hidden] { display: none !important; }
.voice-status {
  position: sticky;
  z-index: 18;
  top: 4.5rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  margin: 0 0 0.65rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--busy) 62%, var(--border));
  border-radius: 0.9rem;
  color: var(--busy);
  background: color-mix(in srgb, var(--busy-bg) 94%, transparent);
  box-shadow: 0 0.5rem 1.6rem rgba(30, 122, 69, 0.14);
}
.voice-status.is-error { color: var(--danger); border-color: var(--danger-border); background: var(--danger-bg); }
.voice-orb { position: relative; display: grid; width: 3.25rem; height: 3.25rem; place-items: center; border-radius: 50%; color: white; background: var(--busy); font-size: 1.45rem; }
.voice-status.listening .voice-orb::before, .voice-status.listening .voice-orb::after { content: ""; position: absolute; inset: -0.38rem; border: 2px solid color-mix(in srgb, var(--busy) 45%, transparent); border-radius: 50%; animation: mic-breathe 1.35s ease-out infinite; }
.voice-status.listening .voice-orb::after { animation-delay: 0.55s; }
.voice-copy { min-width: 0; }
.voice-copy strong, .voice-copy span { display: block; }
.voice-copy strong { font-size: 1rem; }
.voice-copy span { margin-top: 0.12rem; color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-levels { display: inline-flex; height: 0.9rem; align-items: end; gap: 0.16rem; margin-left: 0.45rem; }
.voice-levels i { width: 0.2rem; border-radius: 999px; background: currentColor; animation: level 0.72s ease-in-out infinite alternate; }
.voice-levels i:nth-child(1) { height: 42%; }
.voice-levels i:nth-child(2) { height: 90%; animation-delay: 0.18s; }
.voice-levels i:nth-child(3) { height: 62%; animation-delay: 0.34s; }
.voice-stop { width: auto; min-height: 2.55rem; margin: 0; white-space: nowrap; }
/* "Остановить" exists only while the microphone listens. */
.voice-status:not(.listening) .voice-stop { display: none; }
.context-mic { position: fixed; z-index: 24; right: max(1rem, calc((100vw - 48rem) / 2 + 1rem)); bottom: calc(10rem + env(safe-area-inset-bottom)); display: grid; width: 3.6rem; min-height: 3.6rem; padding: 0; place-items: center; border-radius: 50%; color: white; background: var(--busy); border-color: color-mix(in srgb, var(--busy) 68%, #000); box-shadow: 0 0.55rem 1.5rem rgba(30, 122, 69, 0.24); font-size: 1.45rem; }
.context-mic:hover:not(:disabled) { background: var(--busy); filter: brightness(1.05); }
/* Held to speak: no text selection or call-out menu under the finger, and the button grows while it hears. */
.context-mic { touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.context-mic.held { transform: scale(1.18); box-shadow: 0 0 0 0.5rem color-mix(in srgb, var(--busy) 28%, transparent); }
.context-mic[hidden] { display: none; }
html, body { overscroll-behavior: none; }
/* The first-room screen is one plan that fits the screen: nothing scrolls or bounces. */
html[data-screen="room"], html[data-screen="room"] body { height: 100%; overflow: hidden; }
#roomScreen { touch-action: none; }
#roomScreen .plan-stage canvas { height: max(12rem, calc(100dvh - 14.8rem - env(safe-area-inset-top) - env(safe-area-inset-bottom))); }
[data-mic-host] { position: relative; }
/* Wall thickness at the entrance door: red "Толщина ?" until named, then green with the value for a few seconds. */
.thickness-chip { position: absolute; z-index: 3; top: 0.6rem; left: 0.6rem; width: auto; min-height: 2.9rem; margin: 0; padding: 0.4rem 1rem; border: 2px solid #e5252a; border-radius: 999px; color: #fff; background: #c81e24; font-size: 1.05rem; font-weight: 700; box-shadow: 0 0 0 0 rgba(229, 37, 42, 0.6); animation: chip-pulse 1.1s ease-out infinite; }
.thickness-chip:hover:not(:disabled), .thickness-chip:active:not(:disabled) { background: #c81e24; }
.thickness-chip.done, .thickness-chip.done:hover:not(:disabled) { border-color: var(--busy); background: var(--busy); color: var(--busy-bg); animation: none; }
@keyframes chip-pulse { to { box-shadow: 0 0 0 0.7rem rgba(229, 37, 42, 0); } }
[data-mic-host] .context-mic.docked { position: absolute; top: 0.6rem; right: 0.6rem; bottom: auto; z-index: 3; margin: 0; }
.address-field { position: relative; }
.address-field input { padding-right: 3.6rem; }
.address-field .context-mic.docked { position: absolute; top: 50%; right: 0.3rem; bottom: auto; margin: 0; transform: translateY(-50%); }
/* Docked, the microphone scrolls with the page and goes under the header: z-index 24 of the floating one works in a
   flex row too, and it was drawn over the header next to ↶ ↷ (Bolat, 14.10.2026: «сильно криво стоит микро»). */
.context-mic.docked { z-index: auto; position: static; width: 2.75rem; min-height: 2.75rem; margin-left: auto; flex: 0 0 auto; box-shadow: 0 0.3rem 0.85rem rgba(30, 122, 69, 0.2); font-size: 1.05rem; }
@keyframes mic-breathe { from { opacity: 0.58; transform: scale(0.88); } to { opacity: 0; transform: scale(1.3); } }
@keyframes level { from { transform: scaleY(0.55); } to { transform: scaleY(1); } }
.voice-field { display: contents; }
.voice-button { display: none; }
.anchor-panel { margin-top: 0.85rem; padding: 0.75rem; border: 2px solid var(--danger-border); border-radius: 0.78rem; background: var(--danger-bg); }
.anchor-panel .lead { margin-bottom: 0; color: var(--danger); font-weight: 700; }
.anchor-panel.complete { border-color: var(--measured); background: var(--busy-bg); }
.anchor-panel.complete .lead { color: var(--busy); }
.preview.needs-anchor { border-color: var(--danger-border); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent); animation: anchor-pulse 0.9s ease-in-out infinite alternate; }
@keyframes anchor-pulse { from { box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 12%, transparent); } to { box-shadow: 0 0 0 8px color-mix(in srgb, var(--danger) 34%, transparent); } }
.catalog-block { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.catalog-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; }
.catalog-heading h3 { margin: 0; }
.counter { min-width: 1.9rem; padding: 0.15rem 0.45rem; border-radius: 999px; color: var(--nav-text); background: var(--nav-selected); text-align: center; font-weight: 700; }
.survey-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.survey-card strong, .survey-card span { display: block; }
.survey-card strong { overflow-wrap: anywhere; }
.survey-card span { margin-top: 0.18rem; color: var(--muted); font-size: 0.82rem; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.35rem; }
.summary-room { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; padding: 0.68rem 0; border-bottom: 1px solid var(--border); }
.summary-room:last-child { border-bottom: 0; }
.summary-room span { display: block; color: var(--muted); font-size: 0.84rem; }
.bottom-nav { position: fixed; z-index: 22; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: min(100%, 48rem); margin: auto; padding: 0 0 env(safe-area-inset-bottom); border-top: 1px solid var(--border); background: var(--surface); }
.nav-button { display: grid; min-width: 0; min-height: 3.6rem; padding: 0.4rem 0.2rem 0.35rem; place-items: center; align-content: center; gap: 0.18rem; border: 0; border-radius: 0; color: var(--muted); background: transparent; font-size: 0.72rem; font-weight: 600; }
.nav-button svg { width: 1.55rem; height: 1.55rem; }
/* The selected tab is a soft rounded highlight, no line; a tapped tab never keeps a hover colour on iPhone. */
.bottom-nav { padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom)); gap: 0.3rem; }
.nav-button { border-radius: 0.95rem; transition: background-color 0.18s ease, color 0.18s ease; -webkit-tap-highlight-color: transparent; }
.nav-button:hover:not(:disabled), .nav-button:active:not(:disabled), .nav-button:focus { background: transparent; outline: none; }
.nav-button.active, .nav-button.active:hover:not(:disabled), .nav-button.active:active:not(:disabled) { color: var(--nav-text); background: var(--nav-selected); box-shadow: none; }
.nav-button.active svg { stroke-width: 2.4; }
dialog { width: min(calc(100% - 2rem), 28rem); padding: 0; border: 1px solid var(--border); border-radius: 0.95rem; color: var(--text); background: var(--surface); box-shadow: 0 1.2rem 4rem rgba(0, 0, 0, 0.24); }
dialog::backdrop { background: rgba(10, 15, 22, 0.48); backdrop-filter: blur(2px); }
.dialog-body { padding: 1rem; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; margin-bottom: 0.8rem; }
.dialog-head h2 { margin: 0; }
.dialog-close { width: 2.6rem; min-height: 2.6rem; padding: 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 0.85rem; border: 1px solid var(--border); border-radius: 0.7rem; background: var(--field); cursor: pointer; }
/* Groups of settings: a title, then each setting a plate of its own (Bolat, 15.10.2026: they ran together). */
.settings-group { display: grid; gap: 0.5rem; margin: 0 0 1rem; padding: 0.75rem; border: 1px solid var(--nav-border); border-radius: 0.95rem; }
.settings-group .settings-title { margin: 0 0 0.15rem; color: var(--button); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.settings-group.setting-block { padding: 0.75rem; border: 1px solid var(--nav-border); }
.admin-group > summary { min-height: 2.2rem; display: flex; align-items: center; cursor: pointer; }
.admin-group[open] > summary { margin-bottom: 0.3rem; }
.admin-group > summary::-webkit-details-marker { display: none; }
.admin-group > summary::after { content: "▾"; margin-left: auto; font-size: 1.1rem; transition: transform 0.15s; }
.admin-group:not([open]) > summary::after { transform: rotate(-90deg); }
.admin-group .setting-block { padding: 0; border-top: 0; }
.setting-row input { width: 1.25rem; min-height: 1.25rem; }
.setting-row select { width: auto; min-width: 6.5rem; flex: none; }
.setting-block { display: grid; gap: 0.5rem; padding: 0.75rem 0; border-top: 1px solid var(--border); }
.setting-block .hint { margin: 0; }
.setting-block input { width: 100%; box-sizing: border-box; font-family: ui-monospace, monospace; }
.phrase-drill .drill-text { margin: 0; padding: 0.7rem 0.9rem; border-radius: 0.7rem; background: var(--field); font-size: 1.15rem; font-weight: 700; }
.phrase-drill .drill-result { margin: 0; }
.phrase-drill .drill-result.good { color: var(--busy); }
.phrase-drill .drill-result.bad { color: #d93025; }
.phrase-drill input { font-family: inherit; }
.phrase-drill .drill-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 0.5rem; }
.phrase-drill .lesson-list { display: grid; gap: 0.35rem; }
.phrase-drill .lesson-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0 0.3rem 0.6rem; border-radius: 0.5rem; background: var(--field); overflow-wrap: anywhere; }
.phrase-drill .lesson-row button { flex: 0 0 auto; width: 2.6rem; min-height: 2.6rem; padding: 0; }
.phrase-drill .drill-actions.even { grid-template-columns: 1fr 1fr; }
.phrase-drill .drill-result { white-space: pre-line; }
.phrase-drill .own-choice { display: grid; gap: 0.45rem; }
.phrase-drill textarea { width: 100%; box-sizing: border-box; font: inherit; }
.report-block textarea { width: 100%; box-sizing: border-box; font: inherit; }
.phrase-drill .own-choice .hint { margin: 0; }
.phrase-drill .drill-examples > * + * { margin-top: 0.5rem; }
.phrase-drill .drill-examples > summary { min-height: 2.6rem; padding: 0.6rem 0; color: var(--button); font-weight: 700; cursor: pointer; }
@media (max-width: 430px) {
  .measure-grid { grid-template-columns: 1fr; gap: 0; }
  .actions { grid-template-columns: 1fr; }
  .actions .quiet { order: 2; }
  .actions .primary { margin-top: 0.7rem; }
  .survey-card { grid-template-columns: 1fr; }
  .survey-card .row-actions { justify-content: stretch; }
  .survey-card .row-actions button { flex: 1; }
  .voice-status { grid-template-columns: auto minmax(0, 1fr); }
  .voice-stop { grid-column: 1 / -1; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}
/* План остаётся главным рабочим элементом; поля ниже доступны клавиатуре, но не занимают экран. */
.plan-screen { padding: 0.7rem; }
.plan-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; }
.dimension-chip { width: auto; min-height: 2.75rem; padding-inline: 0.85rem; }
.dimension-chip strong { font-variant-numeric: tabular-nums; }
.dimension-chip.needs-value { color: var(--danger); border-color: var(--danger-border); background: var(--danger-bg); animation: anchor-pulse 0.9s ease-in-out infinite alternate; }
.canvas-data-inputs { position: fixed; left: 50%; bottom: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.canvas-data-inputs input { width: 1px; min-height: 1px; padding: 0; border: 0; opacity: 0.01; }
.plan-stage { margin-top: 0.65rem; padding: 0.2rem; border: 0; background: var(--field); }
.plan-stage canvas { height: clamp(20rem, 46dvh, 28rem); min-height: 0; aspect-ratio: auto; touch-action: pan-y; transform-origin: center center; }
.plan-stage canvas.zoomed { touch-action: none; cursor: grab; }
.plan-stage figcaption { position: relative; z-index: 2; background: var(--field); }
.plan-tip { justify-content: center; padding: 0.35rem 0.2rem; text-align: center; }
.object-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.55rem; margin-top: 0.65rem; }
.tool-button { display: grid; min-width: 0; min-height: 3.6rem; margin: 0; padding: 0.5rem 0.35rem; place-items: center; gap: 0.1rem; font-size: 0.78rem; }
.tool-button span { font-size: 1.35rem; line-height: 1; }
.tool-button.primary { width: auto; margin: 0; }
@media (max-width: 390px) {
  .plan-screen { padding-inline: 0.45rem; }
  .object-tools { gap: 0.35rem; }
  .tool-button { font-size: 0.72rem; }
}
.opening-stage canvas { height: clamp(16rem, 34dvh, 22rem); }
.interior-stage canvas { height: clamp(15rem, 32dvh, 20rem); }
.interior-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.6rem; }
.interior-form label { min-width: 0; }
.storage-fields { display: contents; }
.interior-types .type { white-space: nowrap; font-size: 0.72rem; }
.interior-edit-actions, .opening-edit-actions { display: grid; grid-template-columns: 1fr auto; gap: 0.55rem; }
.interior-edit-actions button, .opening-edit-actions button { margin-top: 0.6rem; }
.compact-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0.6rem 0 0; }
.interior-types.compact-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#openingsScreen .compact-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#openingsScreen .compact-tabs .type { white-space: nowrap; font-size: 0.72rem; }
.compact-tabs .type { display: grid; min-height: 3.25rem; padding: 0.42rem 0.25rem; place-items: center; gap: 0.1rem; font-size: 0.76rem; }
.compact-tabs .type span { font-size: 1.2rem; line-height: 1; }
.opening-readout { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.55rem; }
.opening-readout .dimension-chip { width: 100%; padding-inline: 0.45rem; font-size: 0.8rem; }
.thickness-prompt { display: flex; width: 100%; margin-top: 0.6rem; align-items: center; justify-content: space-between; color: var(--danger); border-color: var(--danger-border); background: var(--danger-bg); animation: anchor-pulse 0.9s ease-in-out infinite alternate; }
.adjacent-size-entry { display: grid; gap: 0.3rem; margin-top: 0.65rem; }
.adjacent-size-entry label { font-size: 0.82rem; color: var(--muted); }
.adjacent-size-entry input { width: 100%; min-height: 2.75rem; }
.adjacent-stage canvas { height: clamp(22rem, 52dvh, 32rem); }
.adjacent-stage.needs-anchor { animation: none; }
#adjacentStatus { margin: 0.55rem 0 0; font-size: 0.82rem; }
#adjacentAnchorPanel { margin-top: 0.55rem; }
#adjacentAnchorPanel .lead { font-size: 0.84rem; }
.plan-stage canvas.overview-inset { position: absolute; z-index: 3; top: 0.65rem; left: 0.65rem; width: 10.5rem; height: 7rem; min-height: 0; border: 1px solid var(--nav-border); border-radius: 0.55rem; background: var(--field); box-shadow: 0 0.3rem 0.9rem rgba(16, 35, 58, 0.14); cursor: pointer; touch-action: manipulation; }
/* Two fingers on the small plan open it over the drawing; the room's own zoom puts it aside, keeping its place. */
.plan-stage canvas.overview-inset { touch-action: none; }
.plan-stage canvas.room-flip-blocked { animation: room-flip-blocked 0.6s ease-out; }
@keyframes room-flip-blocked {
  0%, 55% { outline: 4px solid var(--danger); }
  25%, 80%, 100% { outline: 4px solid transparent; }
}
.plan-stage canvas.overview-inset.expanded { top: 0.2rem; left: 0.2rem; width: calc(100% - 0.4rem); height: calc(100% - 0.4rem); z-index: 5; cursor: grab; }
.plan-stage.room-zoomed canvas.overview-inset:not(.expanded) { visibility: hidden; pointer-events: none; }
.final-plan-stage canvas { height: clamp(18rem, 44dvh, 30rem); touch-action: pan-y; }
.final-plan-stage canvas.zoomed { touch-action: none; cursor: grab; }
.validation-panel { margin-top: 0.65rem; padding: 0.8rem 0.9rem; border: 1px solid var(--border); border-radius: 0.75rem; line-height: 1.4; }
.validation-panel.ready { color: var(--busy); border-color: color-mix(in srgb, var(--busy) 55%, var(--border)); background: var(--busy-bg); }
.validation-panel.needs-work { color: var(--nav-text); border-color: var(--nav-border); background: var(--nav-selected); }
.validation-panel ul { margin: 0.4rem 0 0; padding-left: 0; list-style: none; }
.validation-panel ul:empty { display: none; }
.final-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; margin-top: 0.55rem; }
.final-actions button { min-width: 0; }
.shape-stage canvas { height: clamp(17rem, 38dvh, 24rem); }
.shape-lead { margin: 0.65rem 0 0; font-size: 0.86rem; }
.shape-count { display: flex; align-items: center; gap: 0.7rem; margin-top: 0.65rem; }
.shape-count span { color: var(--muted); }
.shape-count strong { min-width: 1.6rem; text-align: center; font-variant-numeric: tabular-nums; }
.shape-count button { width: 2.75rem; min-height: 2.75rem; margin-top: 0; padding: 0; font-size: 1.25rem; }
.shape-count #shapeMirrorButton { width: auto; margin-left: auto; padding: 0 0.9rem; font-size: 0.95rem; }
/* "Готово" stands by the count, in sight above the drawing (Bolat, 13.10.2026: at the bottom it was too low). */
/* With "Отразить" beside it on a narrow phone it goes under, to the right — still above the drawing. */
.shape-count { flex-wrap: wrap; row-gap: 0.5rem; }
.shape-count button { flex-shrink: 0; }
.shape-count #shapeDoneButton { width: auto; margin-left: auto; padding: 0 1.1rem; font-size: 0.95rem; }.shape-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.6rem; margin-top: 0.4rem; }
.shape-fields label { min-width: 0; }
.shape-fields select { width: 100%; }
.shape-fields .shape-wide { grid-column: 1 / -1; }
.shape-fields h3 { grid-column: 1 / -1; margin: 0.7rem 0 0.1rem; font-size: 0.95rem; color: var(--muted); }
.shape-fields input.active { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger-border); }
/* A curved wall: its sagitta and the three words under it (half a circle, into the room, straight again). */
.shape-fields .arc-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; }
.shape-fields .arc-actions button { flex: 1 1 auto; min-height: 2.6rem; padding: 0.3rem 0.6rem; }
#shapeStatus { margin: 0.55rem 0 0; font-size: 0.82rem; }
#adjacentShapeNote { margin: 0.35rem 0 0; }
@media (max-width: 360px) {
  .interior-form { grid-template-columns: 1fr; }
  .interior-edit-actions, .opening-edit-actions { grid-template-columns: 1fr; }
  .shape-fields { grid-template-columns: 1fr; }
}

/* Errors and voice status float over the screen so they never push the plan around. */
.toasts { position: fixed; z-index: 30; top: calc(env(safe-area-inset-top) + 3.9rem); right: 0; left: 0; display: grid; gap: 0.4rem; width: min(calc(100% - 1.6rem), 46rem); margin: 0 auto; pointer-events: none; }
.toasts > * { position: static; margin: 0; pointer-events: auto; box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.25); }
.toasts > [hidden] { display: none; }
/* Сообщение микрофона остаётся ниже дополнительной строки шапки. */
.shell.issues-returning .toasts { top: calc(env(safe-area-inset-top) + 7rem); }

#startScreen[data-mode="new"] #catalogBlock, #startScreen[data-mode="list"] #newObjectBlock { display: none; }
#startScreen #newObjectBlock h2 { margin-bottom: 0.9rem; }
/* Step hint: yellow, unlike any button or state colour, so it reads as advice and not as something to press. */
.hint-card { display: flex; align-items: flex-start; gap: 0.65rem; margin: 0 0 0.65rem; padding: 0.7rem 0.85rem; border: 1px solid #e0b100; border-left-width: 5px; border-radius: 0.85rem; color: var(--text); background: color-mix(in srgb, #ffd23f 16%, var(--surface)); font-size: 0.98rem; line-height: 1.38; }
/* The card keeps the height of four lines: a shorter hint must not pull the drawing up under the finger. */
.hint-card p { margin: 0; min-height: calc(4 * 1.38em); }
.undo-toast { font-weight: 600; }
.help-text h3 { margin: 1.1rem 0 0.3rem; font-size: 1.02rem; }
.help-text p { margin: 0 0 0.4rem; line-height: 1.45; }
.hint-badge { display: grid; flex: none; width: 1.7rem; height: 1.7rem; place-items: center; border-radius: 50%; color: #1a1a1a; background: #ffd23f; font-weight: 800; }
/* The room hint lives in the card; the small caption under the drawing would repeat it. */
#roomTip { display: none; }
:root[data-hint="on"] #roomScreen .plan-stage canvas { height: max(12rem, calc(100dvh - 18.6rem - env(safe-area-inset-top) - env(safe-area-inset-bottom))); }
:root[data-hint="on"] #openingsScreen .plan-tip, :root[data-hint="on"] #doneScreen .plan-tip, :root[data-hint="on"] #interiorScreen .plan-tip { display: none; }
/* Under the next-room drawing only a binding warning is shown; the step itself is in the hint. */
#adjacentScreen .plan-tip:has(#adjacentBindingHint[hidden]) { display: none; }
/* "Что в этой стене?": the four kind buttons pulse until one is chosen. */
.type-tabs.ask .type { border-color: #e5252a; animation: kind-ask 1.1s ease-in-out infinite alternate; }
@keyframes kind-ask { from { box-shadow: 0 0 0 0 rgba(229, 37, 42, 0.5); } to { box-shadow: 0 0 0 0.3rem rgba(229, 37, 42, 0.12); } }
.step-label { margin: 0 0 0.2rem; color: var(--button); font-size: 0.95rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
/* The address in the header is a button: a tap opens step 1 to change it. */
.header-address { overflow: hidden; max-width: 100%; min-height: 0; padding: 0; border: 0; color: inherit; background: none; font: inherit; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.header-address::after { content: " ✎"; opacity: 0.7; font-size: 0.85em; }
:root[data-screen="start"] .header-address::after { content: none; }
.validation-panel .issue-link { width: 100%; min-height: 2.6rem; margin: 0.15rem 0; padding: 0.55rem 0.7rem; border: 0; border-radius: 0.6rem; color: inherit; background: transparent; font-weight: 600; text-align: left; text-decoration: underline; }

/* Remarks after "Закончить замер": numbers said again on the spot, fixed ones struck through, a way back. */
.validation-panel li { margin: 0.35rem 0; }
.validation-panel .issue-text { margin: 0.2rem 0; font-weight: 600; }
.validation-panel li.resolved { opacity: 0.75; font-weight: 400; }
.fix-numbers { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.35rem 0; }
.fix-number { min-height: 2.6rem; padding: 0.4rem 0.8rem; border: 2px solid #d93025; border-radius: 999px; color: inherit; background: var(--field); font-weight: 700; }
.fix-input { width: 7rem; min-height: 2.6rem; padding: 0.3rem 0.6rem; border: 2px solid #d93025; border-radius: 0.6rem; color: var(--text); background: var(--field); font-size: 1.1rem; }
.issues-return { position: static; flex: 0 0 100%; width: 100%; min-height: 2.7rem; margin: 0; padding: 0.4rem 0.8rem; border: 0; border-radius: 0.6rem; color: #fff; background: #b72420; font-weight: 700; }
.issues-return[hidden] { display: none; }
.wall-fix { display: flex; align-items: center; gap: 0.6rem; margin: 0.5rem 0; font-weight: 600; }
.wall-fix[hidden] { display: none; }
.toolbar-end { margin-left: auto; }
.toolbar-room { display: block; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.toolbar-room:empty { display: none; }
.balcony-actions { display: flex; align-items: center; gap: 0.6rem; }
.balcony-actions[hidden] { display: none; }
.balcony-actions .thickness-prompt { flex: 1; }
.balcony-actions .thickness-prompt:not(.asking) { animation: none; }
.balcony-actions .compact { margin-top: 0.6rem; }
.wall-fix input, .balcony-actions #balconySize { min-height: 2.6rem; padding: 0.3rem 0.6rem; border: 2px solid #d93025; border-radius: 0.6rem; color: var(--text); background: var(--field); font-size: 1.1rem; }
.wall-fix input { width: 7rem; }
.wall-fix button { flex: 0 0 auto; width: auto; margin-top: 0; min-height: 2.6rem; padding: 0.3rem 0.9rem; }
.wall-fix { flex-wrap: wrap; }
#wallFixLabel { flex-basis: 100%; }
.balcony-actions #balconySize { flex: 1; min-width: 0; }
.opening-row .fix-number { min-height: 2.2rem; padding: 0.2rem 0.6rem; border-color: var(--nav-border); font-weight: 600; }
.remove-room { margin-top: 1.4rem; }
.clear-wall { display: block; margin: 0.45rem 0 0 auto; }
.summary-height { display: flex; align-items: center; gap: 0.5rem; margin: 0.6rem 0 0; font-weight: 600; }
.summary-height[hidden] { display: none; }
.summary-height .fix-number { min-height: 2.2rem; padding: 0.2rem 0.7rem; border-color: var(--nav-border); }


.room-note-trigger { margin-left: auto; white-space: nowrap; }
.room-note-dialog[open] { position: fixed; z-index: 23; inset: auto 0 calc(4.4rem + env(safe-area-inset-bottom)) 0; width: min(calc(100% - 1rem), 30rem); margin: 0 auto; border-color: var(--nav-border); box-shadow: 0 -0.4rem 1.6rem rgba(0, 0, 0, 0.28); }
.room-note-dialog .dialog-body { max-height: 42dvh; overflow: auto; padding: 0.75rem 0.85rem; }
.room-note-dialog .dialog-head { margin-bottom: 0.4rem; }
.room-note-dialog .dialog-head h2 { font-size: 1.05rem; }
.room-note-dialog .hint { margin: 0 0 0.5rem; font-size: 0.85rem; }
.room-note-list { display: grid; gap: 0.65rem; margin-top: 0.75rem; }
.room-note-row { display: grid; gap: 0.35rem; padding: 0.65rem; border: 1px solid var(--border); border-radius: 0.7rem; }
.room-note-row audio { width: 100%; }
.room-note-row .quiet { justify-self: end; }
.summary-notes { margin: 0.8rem 0; padding: 0.75rem; border: 1px solid var(--border); border-radius: 0.7rem; }
.summary-notes p { margin: 0.4rem 0; color: var(--muted); }
.summary-note-room { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.25rem 0; }
.summary-note-room button { width: auto; }

.balcony-side-choice { display: block; min-height: 6.25rem; margin: 0.65rem 0; padding: 0.35rem; touch-action: manipulation; }
.balcony-side-choice svg { display: block; width: 100%; height: 5.3rem; fill: none; stroke: var(--text); stroke-linecap: square; stroke-linejoin: miter; }
.balcony-side-choice .symbol-wall { stroke-width: 4; }
.balcony-side-choice .symbol-frame { stroke-width: 2; }
.balcony-side-choice .symbol-door { stroke-width: 1.8; }
.balcony-side-choice .symbol-glass { stroke-width: 1.1; }
.balcony-side-mirror { transform: scaleX(-1); }

/* A held wall on the doors screen: "Толщина" pops up over the finger (Bolat, 10.10.2026). */
#openingCanvas, #roomCanvas, #adjacentCanvas { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.press-bubble { position: fixed; z-index: 50; transform: translate(-50%, -150%); padding: 0.35rem 0.8rem; border-radius: 1rem;
  background: var(--thickness-ask); color: #fff; font-weight: 700; pointer-events: none; box-shadow: 0 0.3rem 0.9rem rgba(0, 0, 0, 0.3);
  animation: press-bubble 0.9s ease-out forwards; }
@keyframes press-bubble { 0% { opacity: 0; } 15% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }

/* What the object is, under the address (Bolat, 11.10.2026). */
.object-type { margin-top: 0.75rem; }
.object-type-sure { margin: 0; color: var(--muted); }
.object-type-sure strong { color: var(--text); }
.link-button { margin-left: 0.4rem; padding: 0; border: 0; background: none; color: var(--button); font: inherit; text-decoration: underline; cursor: pointer; }
.object-type-question { margin: 0 0 0.5rem; font-weight: 700; color: #b3261e; }
:root[data-theme="dark"] .object-type-question { color: var(--danger); }
.object-type-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.object-type-choices button { min-height: 2.8rem; margin: 0; }
.object-type-choices button.active { color: var(--nav-text); background: var(--nav-selected); border-color: var(--nav-border); font-weight: 700; }
#objectTypeText { width: 100%; margin-top: 0.5rem; }

.survey-problem { color: var(--danger, #d33); font-size: 0.9rem; overflow-wrap: anywhere; }

.finish-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; margin-bottom: 0.65rem; }
.finish-tools button, .finish-tools input { width: 100%; min-height: 3.2rem; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.finish-tools .active { background: var(--busy); color: var(--busy-bg); border-color: var(--busy); }
.finish-break-choices { display: grid; gap: 0.4rem; }
.finish-break-list button { text-align: left; overflow-wrap: anywhere; }

.finish-tools button, .finish-tools input { scroll-margin-top: 6rem; scroll-margin-bottom: 6rem; }

.finish-tools .is-set .fix-number { border-color: var(--nav-border); }
