/* Интерактивный макет сцены. Требует ../tokens.css и ../styles.css. */

/* office.css загружается только на странице офиса. В preview оба класса висят
   на одном узле, а в base.html office-preview-content вложен в .content. */
.content {
  padding: 0;
  overflow: hidden;
}

.office-preview-content {
  box-sizing: border-box;
  height: 100%;
  padding: 18px 20px 20px;
  overflow: hidden;
}

.office-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  color: var(--fg);
}

.office-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 8px;
  background: var(--paper-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-nav);
  flex: none;
}

.office-toolbar-spacer { flex: 1; }

.office-build-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--fg-soft);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
}

.office-build-toggle:hover { border-color: var(--fg-label); color: var(--fg); }

.office-build-toggle.is-active {
  border-color: var(--info);
  background: var(--info-bg);
  color: var(--info);
}

.office-build-toggle span:first-child {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
}

.office-space,
.office-mode {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  gap: 2px;
  background: var(--paper-mute);
  border-radius: var(--radius);
}

.office-space-button,
.office-mode-button {
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  cursor: pointer;
}

.office-space-button:hover,
.office-mode-button:hover { color: var(--fg); }

.office-space-button.is-active,
.office-mode-button.is-active {
  background: var(--paper-card);
  color: var(--fg);
  box-shadow: var(--shadow-nav);
}

.office-space-button:focus-visible,
.office-mode-button:focus-visible,
.office-build-toggle:focus-visible,
.office-build-bar button:focus-visible,
.office-build-dialog button:focus-visible,
.office-build-dialog input:focus-visible,
.office-build-slot:focus-visible,
.office-agent:focus-visible,
.office-toolbar select:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

.office-room-picker,
.office-scenario {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--fg-label);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.office-toolbar select {
  min-height: 32px;
  max-width: 180px;
  padding: 5px 28px 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--fg-soft);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.office-toolbar select:disabled { opacity: .45; }

.office-state-test-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-top: 8px;
  padding: 7px 9px 7px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-mute);
  color: var(--fg-label);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.office-state-test-title {
  color: var(--fg-soft);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.office-state-test-bar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.office-state-test-bar select {
  min-height: 30px;
  max-width: 170px;
  padding: 4px 25px 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--fg-soft);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
}

.office-state-test-bar select:disabled { opacity: .45; }

.office-state-test-bar select:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

.office-state-test-note {
  margin-left: auto;
  color: var(--fg-faint);
}

.office-build-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  margin-top: 8px;
  padding: 7px 9px 7px 12px;
  border: 1px solid var(--info);
  border-radius: var(--radius);
  background: var(--info-bg);
  color: var(--fg-soft);
  font-size: var(--fs-xs);
}

.office-build-bar[hidden] { display: none; }
.office-build-bar-spacer { flex: 1; }

.office-build-bar-mark {
  color: var(--info);
  font-family: var(--font-mono);
  font-weight: 700;
}

.office-build-manage,
.office-build-close {
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-card);
  color: var(--fg-soft);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.office-build-manage { text-decoration: none; }

.office-build-manage:hover,
.office-build-close:hover { border-color: var(--fg-label); color: var(--fg); }

.office-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  margin-top: 12px;
  overflow: hidden;
  background: var(--paper-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.office-stage[hidden] { display: none; }

.office-frame {
  position: relative;
  min-height: 520px;
  height: clamp(520px, calc(100vh - 188px), 720px);
  overflow: auto;
  /* Небо с облаками: здание офиса висит в воздухе. Облака медленно плывут. */
  background-color: #a9d8f5;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1100' height='640'%3E%3Cg fill='%23fff'%3E%3Cg%3E%3Cellipse cx='120' cy='96' rx='62' ry='22'/%3E%3Ccircle cx='96' cy='80' r='26'/%3E%3Ccircle cx='140' cy='70' r='34'/%3E%3C/g%3E%3Cg%3E%3Cellipse cx='860' cy='90' rx='54' ry='18'/%3E%3Ccircle cx='840' cy='76' r='22'/%3E%3Ccircle cx='878' cy='68' r='28'/%3E%3C/g%3E%3Cg%3E%3Cellipse cx='240' cy='560' rx='80' ry='24'/%3E%3Ccircle cx='205' cy='540' r='30'/%3E%3Ccircle cx='258' cy='528' r='40'/%3E%3C/g%3E%3Cg%3E%3Cellipse cx='700' cy='590' rx='46' ry='16'/%3E%3Ccircle cx='690' cy='578' r='20'/%3E%3Ccircle cx='716' cy='572' r='22'/%3E%3C/g%3E%3Cg%3E%3Cellipse cx='1010' cy='520' rx='64' ry='20'/%3E%3Ccircle cx='990' cy='504' r='24'/%3E%3Ccircle cx='1030' cy='496' r='30'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(#8fcbf2, #cdeafb 70%, #e6f5fd);
  background-size: 1100px 640px, 100% 100%;
  background-repeat: repeat, no-repeat;
  animation: office-clouds 180s linear infinite;
  scrollbar-gutter: stable;
  transition: background-color 600ms ease;
}

@keyframes office-clouds {
  from { background-position: 0 0, 0 0; }
  to { background-position: 1100px 0, 0 0; }
}

/* Небо по часам (sky.js) и корпоратив (party.js): поверх облаков лежат
   закат (::before) и ночь с луной (::after). Днём ставит класс час на
   компьютере — is-dusk на закате и рассвете, is-dusk + is-night ночью;
   на корпоративе те же слои наплывают по расписанию, свет в кабинетах
   гаснет, при моргании ночь на миг светлеет (is-lights-out / is-blink —
   только party.js). */
.office-frame::before,
.office-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
}
.office-frame::before {
  background: linear-gradient(#2b1a4a 0%, #6b3d7a 30%, #ff8a5c 58%, #ffd27a 78%, #f7e6c4 100%);
  transition: opacity 1.8s ease;
}
.office-frame::after {
  /* Ночь в плоском стиле HTF: синее небо без обводок, круглая пастельная
     луна в правом верхнем углу рамки, где кабинеты её не закрывают, звёзды-точки, те же пухлые облака, что днём, в
     ночном тоне — плывут своей анимацией, дневная на закате стоит. */
  background-color: #1f2a6b;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1100' height='640'%3E%3Cg fill='%23334391'%3E%3Cg%3E%3Cellipse cx='120' cy='96' rx='62' ry='22'/%3E%3Ccircle cx='96' cy='80' r='26'/%3E%3Ccircle cx='140' cy='70' r='34'/%3E%3C/g%3E%3Cg%3E%3Cellipse cx='860' cy='90' rx='54' ry='18'/%3E%3Ccircle cx='840' cy='76' r='22'/%3E%3Ccircle cx='878' cy='68' r='28'/%3E%3C/g%3E%3Cg%3E%3Cellipse cx='240' cy='560' rx='80' ry='24'/%3E%3Ccircle cx='205' cy='540' r='30'/%3E%3Ccircle cx='258' cy='528' r='40'/%3E%3C/g%3E%3Cg%3E%3Cellipse cx='700' cy='590' rx='46' ry='16'/%3E%3Ccircle cx='690' cy='578' r='20'/%3E%3Ccircle cx='716' cy='572' r='22'/%3E%3C/g%3E%3Cg%3E%3Cellipse cx='1010' cy='520' rx='64' ry='20'/%3E%3Ccircle cx='990' cy='504' r='24'/%3E%3Ccircle cx='1030' cy='496' r='30'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Ccircle cx='70' cy='70' r='66' fill='%23fff3bd' opacity='0.22'/%3E%3Ccircle cx='70' cy='70' r='48' fill='%23fff6cc'/%3E%3Ccircle cx='54' cy='58' r='9' fill='%23f3e7a8'/%3E%3Ccircle cx='84' cy='84' r='6' fill='%23f3e7a8'/%3E%3Ccircle cx='80' cy='50' r='4' fill='%23f3e7a8'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='20' cy='30' r='2.5'/%3E%3Ccircle cx='90' cy='14' r='1.8'/%3E%3Ccircle cx='160' cy='48' r='2.2'/%3E%3Ccircle cx='210' cy='20' r='1.5'/%3E%3Ccircle cx='60' cy='90' r='1.6'/%3E%3Ccircle cx='130' cy='110' r='2.6'/%3E%3Ccircle cx='220' cy='130' r='1.8'/%3E%3Ccircle cx='30' cy='150' r='2'/%3E%3Ccircle cx='100' cy='190' r='1.6'/%3E%3Ccircle cx='180' cy='200' r='2.4'/%3E%3Ccircle cx='50' cy='220' r='1.5'/%3E%3Cpath d='M200 80 l2.5 6 6 2.5 -6 2.5 -2.5 6 -2.5 -6 -6 -2.5 6 -2.5z' opacity='0.9'/%3E%3Cpath d='M70 160 l2 5 5 2 -5 2 -2 5 -2 -5 -5 -2 5 -2z' opacity='0.85'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(#1a2260 0%, #2b3a8c 60%, #4a5bb0 100%);
  background-size: 1100px 640px, 140px 140px, 240px 240px, 100% 100%;
  background-position: 0 0, calc(100% + 14px) -10px, 0 0, 0 0;
  background-repeat: repeat, no-repeat, repeat, no-repeat;
  animation: office-night-clouds 180s linear infinite;
  transition: opacity 2.2s ease;
}
@keyframes office-night-clouds {
  from { background-position: 0 0, calc(100% + 14px) -10px, 0 0, 0 0; }
  to { background-position: 1100px 0, calc(100% + 14px) -10px, 0 0, 0 0; }
}
.office-world-shell { z-index: 1; }
.office-page.is-dusk .office-frame { animation-play-state: paused; }
.office-page.is-dusk .office-frame::before { opacity: 1; }
.office-page.is-night .office-frame::after { opacity: 1; }
.office-page.is-blink .office-frame::after { opacity: 0.35; transition: none; }

.office-room-walls,
.office-room-floor { transition: filter 900ms ease; }
.office-page.is-lights-out .office-room-walls { filter: brightness(0.5) saturate(0.8); }
.office-page.is-lights-out .office-room-floor { filter: brightness(0.62); }
.office-page.is-party .office-room-walls { filter: brightness(0.62); }

@media (prefers-reduced-motion: reduce) {
  .office-frame { animation: none; }
  .office-frame::after { animation: none; }
  .office-frame::before,
  .office-frame::after,
  .office-room-walls,
  .office-room-floor { transition: none; }
}


.office-frame:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: -3px;
}

.office-world-shell {
  position: relative;
  margin: 0 auto;
}

.office-world {
  position: absolute;
  inset: 0 auto auto 0;
  transform-origin: left top;
}

.office-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Глобальный порядок всей сцены. Мебель и герои живут в одном
   actor-слое, чтобы их порядок внутри комнаты решала общая глубина. */
.office-layer--floors { z-index: 1; }
.office-layer--walls { z-index: 2; }
.office-layer--actors { z-index: 3; }
.office-layer--tooltips { z-index: 4; }
.office-layer--build { z-index: 5; }

.office-room-node {
  --office-ink: #3b2f2a;
  --room-width: 400px;
  --room-half-width: 200px;
  --room-floor-height: 225px;
  --room-half-height: 112.5px;
  --room-floor-top: 96px;
  --room-wall-rise: 96px;
  position: absolute;
  width: var(--room-width);
  height: calc(var(--room-floor-top) + var(--room-floor-height) + 18px);
  transform-origin: 50% 50%;
  pointer-events: none;
}

.office-room-node[hidden] { display: none; }

.office-room.is-built .office-room-floor {
  background-color: var(--paper-mute);
  background-image:
    linear-gradient(29deg, transparent 49%, var(--border) 50%, transparent 51%),
    linear-gradient(-29deg, transparent 49%, var(--border) 50%, transparent 51%);
}

.office-room-node.is-focused {
  left: 50% !important;
  top: 50% !important;
  z-index: 50 !important;
  /* Стены торчат над узлом на (rise − floorTop); центрируем видимую
     комнату, а не узел. 1.35 — тот же множитель, что в scale ниже. */
  margin-top: calc((var(--room-wall-rise) - var(--room-floor-top)) / 2 * 1.35);
  transform: translate(-50%, -50%) scale(1.35);
}

.office-room-floor {
  position: absolute;
  left: 0;
  top: var(--room-floor-top);
  z-index: 2;
  width: var(--room-width);
  height: var(--room-floor-height);
  /* Лавандовая плитка-ромб в пропорции 16:9 — ложится по сетке изометрии.
     Шаг 120×67.5: в полтора раза крупнее прежних 80×45 (владелец, 19.09.2026);
     в SVG уложены 2×2 плитки, чтобы размер фона был целым. Тона спокойные:
     светлый ромб d8dbe9, тёмный d3d6e6, шов c8ccdc (владелец, 19.09.2026). */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='135' shape-rendering='crispEdges'%3E%3Crect width='240' height='135' fill='%23c8ccdc'/%3E%3Cpolygon points='0,-15.675 27.9,0 0,15.675 -27.9,0' fill='%23d8dbe9'/%3E%3Cpolygon points='120,-15.675 147.9,0 120,15.675 92.1,0' fill='%23d8dbe9'/%3E%3Cpolygon points='0,51.825 27.9,67.5 0,83.175 -27.9,67.5' fill='%23d8dbe9'/%3E%3Cpolygon points='120,51.825 147.9,67.5 120,83.175 92.1,67.5' fill='%23d8dbe9'/%3E%3Cpolygon points='60,18.075 87.9,33.75 60,49.425 32.1,33.75' fill='%23d8dbe9'/%3E%3Cpolygon points='60,-15.675 87.9,0 60,15.675 32.1,0' fill='%23d3d6e6'/%3E%3Cpolygon points='0,18.075 27.9,33.75 0,49.425 -27.9,33.75' fill='%23d3d6e6'/%3E%3Cpolygon points='120,18.075 147.9,33.75 120,49.425 92.1,33.75' fill='%23d3d6e6'/%3E%3Cpolygon points='60,51.825 87.9,67.5 60,83.175 32.1,67.5' fill='%23d3d6e6'/%3E%3Cpolygon points='0,51.825 27.9,67.5 0,83.175 -27.9,67.5' fill='%23d8dbe9'/%3E%3Cpolygon points='120,51.825 147.9,67.5 120,83.175 92.1,67.5' fill='%23d8dbe9'/%3E%3Cpolygon points='0,119.325 27.9,135 0,150.675 -27.9,135' fill='%23d8dbe9'/%3E%3Cpolygon points='120,119.325 147.9,135 120,150.675 92.1,135' fill='%23d8dbe9'/%3E%3Cpolygon points='60,85.575 87.9,101.25 60,116.925 32.1,101.25' fill='%23d8dbe9'/%3E%3Cpolygon points='60,51.825 87.9,67.5 60,83.175 32.1,67.5' fill='%23d3d6e6'/%3E%3Cpolygon points='0,85.575 27.9,101.25 0,116.925 -27.9,101.25' fill='%23d3d6e6'/%3E%3Cpolygon points='120,85.575 147.9,101.25 120,116.925 92.1,101.25' fill='%23d3d6e6'/%3E%3Cpolygon points='60,119.325 87.9,135 60,150.675 32.1,135' fill='%23d3d6e6'/%3E%3Cpolygon points='120,-15.675 147.9,0 120,15.675 92.1,0' fill='%23d8dbe9'/%3E%3Cpolygon points='240,-15.675 267.9,0 240,15.675 212.1,0' fill='%23d8dbe9'/%3E%3Cpolygon points='120,51.825 147.9,67.5 120,83.175 92.1,67.5' fill='%23d8dbe9'/%3E%3Cpolygon points='240,51.825 267.9,67.5 240,83.175 212.1,67.5' fill='%23d8dbe9'/%3E%3Cpolygon points='180,18.075 207.9,33.75 180,49.425 152.1,33.75' fill='%23d8dbe9'/%3E%3Cpolygon points='180,-15.675 207.9,0 180,15.675 152.1,0' fill='%23d3d6e6'/%3E%3Cpolygon points='120,18.075 147.9,33.75 120,49.425 92.1,33.75' fill='%23d3d6e6'/%3E%3Cpolygon points='240,18.075 267.9,33.75 240,49.425 212.1,33.75' fill='%23d3d6e6'/%3E%3Cpolygon points='180,51.825 207.9,67.5 180,83.175 152.1,67.5' fill='%23d3d6e6'/%3E%3Cpolygon points='120,51.825 147.9,67.5 120,83.175 92.1,67.5' fill='%23d8dbe9'/%3E%3Cpolygon points='240,51.825 267.9,67.5 240,83.175 212.1,67.5' fill='%23d8dbe9'/%3E%3Cpolygon points='120,119.325 147.9,135 120,150.675 92.1,135' fill='%23d8dbe9'/%3E%3Cpolygon points='240,119.325 267.9,135 240,150.675 212.1,135' fill='%23d8dbe9'/%3E%3Cpolygon points='180,85.575 207.9,101.25 180,116.925 152.1,101.25' fill='%23d8dbe9'/%3E%3Cpolygon points='180,51.825 207.9,67.5 180,83.175 152.1,67.5' fill='%23d3d6e6'/%3E%3Cpolygon points='120,85.575 147.9,101.25 120,116.925 92.1,101.25' fill='%23d3d6e6'/%3E%3Cpolygon points='240,85.575 267.9,101.25 240,116.925 212.1,101.25' fill='%23d3d6e6'/%3E%3Cpolygon points='180,119.325 207.9,135 180,150.675 152.1,135' fill='%23d3d6e6'/%3E%3C/svg%3E") 0 0 / 240px 135px;
  border: 2px solid var(--office-ink);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  cursor: pointer;
  font: inherit;
  pointer-events: auto;
}

.office-room.is-focused .office-room-floor {
  border-color: var(--fg-muted);
}

.office-room-floor:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--info);
}

.office-page.is-building .office-room-floor { cursor: default; }

.office-build-slot {
  --slot-width: 360px;
  --slot-height: 203px;
  position: absolute;
  z-index: 45;
  display: grid;
  place-items: center;
  width: var(--slot-width);
  height: var(--slot-height);
  padding: 0;
  border: 2px dashed var(--info);
  background-color: color-mix(in srgb, var(--info-bg) 72%, transparent);
  background-image:
    linear-gradient(29deg, transparent 49%, var(--info) 50%, transparent 51%),
    linear-gradient(-29deg, transparent 49%, var(--info) 50%, transparent 51%);
  background-size: 54px 31px;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  color: var(--info);
  cursor: pointer;
  pointer-events: auto;
  opacity: .56;
  transition: opacity var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out);
}

.office-build-slot:hover,
.office-build-slot:focus-visible {
  opacity: .92;
  filter: drop-shadow(0 8px 0 var(--border));
}

.office-build-slot span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--info);
  border-radius: var(--radius-pill);
  background: var(--paper-card);
  font-size: var(--fs-xs);
  font-weight: 700;
  box-shadow: var(--shadow-nav);
}

.office-build-slot strong {
  font-family: var(--font-mono);
  font-size: 15px;
}

.office-room-back-left,
.office-room-back-right {
  position: absolute;
  top: calc(var(--room-floor-top) - var(--room-wall-rise));
  z-index: 3;
  width: var(--room-half-width);
  height: calc(var(--room-half-height) + var(--room-wall-rise));
  /* Обои = панель снизу с планкой + узор + основной цвет. Панель идёт
     параллельно линии пола: угол 29.36° = atan(225 / 400); от угла бокса
     до линии пола 98 px (112.5 · cos 29.36°), панель высотой 36 px. */
  background:
    linear-gradient(-29.36deg, var(--wall-low) 0 134px, var(--wall-trim) 134px 140px,
      var(--office-ink) 140px 142px, transparent 142px),
    var(--wall-pattern), var(--wall);
  pointer-events: none;
}

.office-room-back-left {
  left: 0;
  border-left: 2px solid var(--office-ink);
  border-right: 2px solid var(--office-ink);
  clip-path: polygon(
    100% 0,
    100% var(--room-wall-rise),
    0 100%,
    0 var(--room-half-height)
  );
}

.office-room-back-right {
  right: 0;
  background:
    linear-gradient(29.36deg, var(--wall-low) 0 134px, var(--wall-trim) 134px 140px,
      var(--office-ink) 140px 142px, transparent 142px),
    var(--wall-pattern-right, var(--wall-pattern)), var(--wall);
  /* Правая стена в тени: свет сверху слева. */
  box-shadow: inset 0 0 0 999px rgba(80, 60, 50, .07);
  border-right: 2px solid var(--office-ink);
  clip-path: polygon(
    0 0,
    0 var(--room-wall-rise),
    100% 100%,
    100% var(--room-half-height)
  );
}

.office-room-back-left::before,
.office-room-back-left::after,
.office-room-back-right::before,
.office-room-back-right::after {
  content: "";
  position: absolute;
  left: 0;
  width: calc(var(--room-half-width) * 1.15);
  height: 2px;
  transform-origin: 0 50%;
  background: var(--office-ink);
}

.office-room-back-left::before {
  top: var(--room-half-height);
  transform: rotate(-29deg);
}

.office-room-back-left::after {
  top: calc(100% - 2px);
  transform: rotate(-29deg);
}

.office-room-back-right::before {
  top: 0;
  transform: rotate(29deg);
}

.office-room-back-right::after {
  top: var(--room-wall-rise);
  transform: rotate(29deg);
}

/* Обои в духе Happy Tree Friends, пастель. `--wall-*` задаются на узле
   стен комнаты; комната без своих обоев остаётся светлой. */
.office-room-walls {
  --wall: #efe9f3;
  --wall-low: #d4cadb;
  --wall-trim: #f6f1f8;
  --wall-pattern: linear-gradient(transparent, transparent);
}

/* Приёмная: пудровые ромбы, как гобелен. */
.office-room-walls[data-room="reception"] {
  --wall: #f4c4b3;
  --wall-low: #c9a38c;
  --wall-trim: #fbe8d8;
  --wall-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' shape-rendering='crispEdges'%3E%3Cpolygon points='14,7 21,14 14,21 7,14' fill='%23fbe3cf'/%3E%3Cpolygon points='0,-4 4,0 0,4 -4,0' fill='%23eeb3a3'/%3E%3Cpolygon points='28,-4 32,0 28,4 24,0' fill='%23eeb3a3'/%3E%3Cpolygon points='0,24 4,28 0,32 -4,28' fill='%23eeb3a3'/%3E%3Cpolygon points='28,24 32,28 28,32 24,28' fill='%23eeb3a3'/%3E%3C/svg%3E") 0 0 / 28px 28px;
}

/* Бухгалтерия: розовый горох. */
.office-room-walls[data-room="accounting"] {
  --wall: #f5cddb;
  --wall-low: #c8b5e0;
  --wall-trim: #fbeec0;
  --wall-pattern: radial-gradient(circle, #fdf0f4 0 3.5px, transparent 4px) 0 0 / 20px 20px,
    radial-gradient(circle, #fdf0f4 0 3.5px, transparent 4px) 10px 10px / 20px 20px;
}

/* Креатив: сиреневые обои с ромашками. */
.office-room-walls[data-room="creative"] {
  --wall: #dccdf0;
  --wall-low: #a9dcd6;
  --wall-trim: #f6c1cc;
  --wall-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36'%3E%3Ccircle cx='9' cy='5.5' r='2.6' fill='%23ffffff'/%3E%3Ccircle cx='12.3' cy='7.9' r='2.6' fill='%23ffffff'/%3E%3Ccircle cx='11.1' cy='11.9' r='2.6' fill='%23ffffff'/%3E%3Ccircle cx='6.9' cy='11.9' r='2.6' fill='%23ffffff'/%3E%3Ccircle cx='5.7' cy='7.9' r='2.6' fill='%23ffffff'/%3E%3Ccircle cx='9' cy='9' r='1.9' fill='%23f7d774'/%3E%3Ccircle cx='27' cy='23.5' r='2.6' fill='%23ffffff'/%3E%3Ccircle cx='30.3' cy='25.9' r='2.6' fill='%23ffffff'/%3E%3Ccircle cx='29.1' cy='29.9' r='2.6' fill='%23ffffff'/%3E%3Ccircle cx='24.9' cy='29.9' r='2.6' fill='%23ffffff'/%3E%3Ccircle cx='23.7' cy='25.9' r='2.6' fill='%23ffffff'/%3E%3Ccircle cx='27' cy='27' r='1.9' fill='%23f7d774'/%3E%3Ccircle cx='27' cy='9' r='1.3' fill='%23b99bd8'/%3E%3Ccircle cx='9' cy='27' r='1.3' fill='%23b99bd8'/%3E%3C/svg%3E") 0 0 / 36px 36px;
}

/* IT: мятная «плата». */
.office-room-walls[data-room="it"] {
  --wall: #cfe8c4;
  --wall-low: #9dbba8;
  --wall-trim: #e6f6c8;
  --wall-pattern: repeating-linear-gradient(90deg, transparent 0 18px, #bddcb0 18px 20px, transparent 20px 30px, #e1f2d8 30px 31px),
    radial-gradient(circle, #a9cc9b 0 2px, transparent 2.5px) 9px 6px / 30px 24px;
}

/* Академия: голубые обои со звёздами. */
.office-room-walls[data-room="academy"] {
  --wall: #c9dff3;
  --wall-low: #dcc1a0;
  --wall-trim: #efdcc0;
  --wall-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpolygon points='10.0,5.0 8.7,8.2 5.2,8.5 7.9,10.7 7.1,14.0 10.0,12.2 12.9,14.0 12.1,10.7 14.8,8.5 11.3,8.2' fill='%23ffffff'/%3E%3Cpolygon points='30.0,25.0 28.7,28.2 25.2,28.5 27.9,30.7 27.1,34.0 30.0,32.2 32.9,34.0 32.1,30.7 34.8,28.5 31.3,28.2' fill='%23ffffff'/%3E%3Ccircle cx='30' cy='10' r='1.4' fill='%23f7d774'/%3E%3Ccircle cx='10' cy='30' r='1.4' fill='%23f7d774'/%3E%3C/svg%3E") 0 0 / 40px 40px;
  --wall-pattern-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpolygon points='10.0,5.0 8.7,8.2 5.2,8.5 7.9,10.7 7.1,14.0 10.0,12.2 12.9,14.0 12.1,10.7 14.8,8.5 11.3,8.2' fill='%23ffffff'/%3E%3Cpolygon points='30.0,25.0 28.7,28.2 25.2,28.5 27.9,30.7 27.1,34.0 30.0,32.2 32.9,34.0 32.1,30.7 34.8,28.5 31.3,28.2' fill='%23ffffff'/%3E%3Ccircle cx='30' cy='10' r='1.4' fill='%23f7d774'/%3E%3Ccircle cx='10' cy='30' r='1.4' fill='%23f7d774'/%3E%3C/svg%3E") 0 0 / 40px 40px;
}

/* Кухня: жёлтые обои с вишнями. */
.office-room-walls[data-room="kitchen"] {
  --wall: #fbeebc;
  --wall-low: #f7f4ec;
  --wall-trim: #efaaa4;
  --wall-pattern: radial-gradient(circle at 50% 60%, #efaaa4 0 4px, transparent 4.5px) 0 0 / 26px 26px,
    radial-gradient(circle at 50% 60%, #efaaa4 0 4px, transparent 4.5px) 13px 13px / 26px 26px;
}

/* Зал: голубой зигзаг. */
.office-room-walls[data-room="health"] {
  --wall: #bfe3ee;
  --wall-low: #a9aec4;
  --wall-trim: #f8c7a8;
  --wall-pattern: linear-gradient(135deg, #dcf0f6 25%, transparent 25%) -12px 0 / 24px 24px,
    linear-gradient(225deg, #dcf0f6 25%, transparent 25%) -12px 0 / 24px 24px,
    linear-gradient(315deg, #dcf0f6 25%, transparent 25%) 0 0 / 24px 24px,
    linear-gradient(45deg, #dcf0f6 25%, transparent 25%) 0 0 / 24px 24px;
}

/* Администрация — кабинет Дэйва: пастельный жёлтый с белыми коронами, та же
   гамма, что у соседей (владелец, 26.09.2026). */
.office-room-walls[data-room="administration"] {
  --wall: #fbe6a8;
  --wall-low: #b9c8f2;
  --wall-trim: #fff6dc;
  --wall-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34' shape-rendering='crispEdges'%3E%3Cpolygon points='5,12 5,6 8,9 10,4 12,9 15,6 15,12' fill='%23ffffff'/%3E%3Ccircle cx='27' cy='26' r='1.6' fill='%23f3c95a'/%3E%3C/svg%3E") 0 0 / 34px 34px;
}

.office-room-wall-left,
.office-room-wall-right {
  position: absolute;
  top: calc(var(--room-floor-top) + var(--room-half-height));
  z-index: 1;
  width: var(--room-half-width);
  /* Толстое основание: здание висит в небе. */
  height: calc(var(--room-half-height) + 16px);
  background: #c9a98a;
  border-bottom: 2px solid var(--office-ink);
  pointer-events: none;
}

.office-room-wall-left {
  left: 0;
  clip-path: polygon(0 0, 100% 90%, 100% 100%, 0 10%);
  transform: translateY(1px);
}

.office-room-door {
  position: absolute;
  top: calc(var(--room-floor-top) + 40px);
  z-index: 4;
  width: 38px;
  height: 14px;
  border-left: 2px solid var(--office-ink);
  border-right: 2px solid var(--office-ink);
  background: #d9d6e8;
  pointer-events: none;
}

.office-room-door--left {
  left: 16.25%;
  transform: rotate(-29deg);
}

.office-room-door--right {
  right: 16.25%;
  transform: rotate(29deg);
}


.office-room-wall-right {
  right: 0;
  background: #b08e70;
  clip-path: polygon(0 90%, 100% 0, 100% 10%, 0 100%);
  transform: translateY(1px);
}

.office-room-tooltip {
  position: absolute;
  left: 50%;
  top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 245px;
  padding: 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-card);
  color: var(--fg-soft);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-nav);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 4px);
  transition-property: opacity, transform;
  transition-duration: var(--dur-fast);
  transition-timing-function: var(--ease-out);
}

.office-room-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.office-room-kind {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--info);
  flex: none;
}

.office-room[data-kind="personal"] .office-room-kind { background: var(--warn-dot); }

.office-room-count {
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.office-room-empty {
  position: absolute;
  left: 50%;
  top: calc(var(--room-floor-top) + var(--room-half-height));
  z-index: 8;
  transform: translate(-50%, -50%);
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  white-space: nowrap;
}

.office-room-actors { isolation: isolate; }

/* Each prop gets its own clipped actor so it can join the room stacking context
   next to the agents. A prop is cut by the surface it belongs to, not by the
   silhouette of the whole room: a floor prop keeps the six-sided shell above the
   floor diamond, while a wall prop is cut by the slanted plane of its own wall.
   Clipping by the shell alone let a poster drift onto the ceiling unnoticed. */
.office-room-furniture {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Верх оболочки — верхняя кромка стен, поэтому считается от высоты стены,
     а не берётся нулём: при стене выше пола вершина уходит за верх узла. */
  clip-path: polygon(
    50% calc(var(--room-floor-top) - var(--room-wall-rise)),
    100% calc(var(--room-floor-top) + var(--room-half-height) - var(--room-wall-rise)),
    100% calc(var(--room-floor-top) + var(--room-half-height)),
    50% calc(var(--room-floor-top) + var(--room-floor-height)),
    0 calc(var(--room-floor-top) + var(--room-half-height)),
    0 calc(var(--room-floor-top) + var(--room-half-height) - var(--room-wall-rise))
  );
}

/* Back corner top → back corner floor → outer corner floor → outer corner top. */
.office-room-furniture--wall-left {
  clip-path: polygon(
    50% calc(var(--room-floor-top) - var(--room-wall-rise)),
    50% var(--room-floor-top),
    0 calc(var(--room-floor-top) + var(--room-half-height)),
    0 calc(var(--room-floor-top) + var(--room-half-height) - var(--room-wall-rise))
  );
}

.office-room-furniture--wall-right {
  clip-path: polygon(
    50% calc(var(--room-floor-top) - var(--room-wall-rise)),
    50% var(--room-floor-top),
    100% calc(var(--room-floor-top) + var(--room-half-height)),
    100% calc(var(--room-floor-top) + var(--room-half-height) - var(--room-wall-rise))
  );
}

.office-prop {
  position: absolute;
  z-index: 5;
  width: 44px;
  height: 25px;
  transform: translate(-50%, -100%);
  border: 2px solid var(--fg-label);
  background: var(--paper-mute);
  box-shadow: 5px 5px 0 var(--border-strong);
}

.office-prop::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  width: 25px;
  height: 3px;
  background: var(--border-strong);
}

.office-prop--board { width: 92px; height: 82px; }
.office-prop--bed { width: 84px; height: 28px; }
.office-prop--cabinet { width: 38px; height: 64px; }
.office-prop--server,
.office-prop--rack { width: 70px; height: 134px; background: var(--fg-soft); }
.office-prop--counter,
.office-prop--table,
.office-prop--desk { width: 122px; height: 89px; }
.office-prop--console { width: 58px; height: 42px; }
.office-prop--coffee { width: 78px; height: 56px; }
.office-prop--sofa { width: 192px; height: 118px; }
.office-prop--printer { width: 40px; height: 33px; }
.office-prop--files { width: 40px; height: 59px; }
.office-prop--shelf { width: 78px; height: 128px; }
.office-prop--poster { width: 44px; height: 52px; background: var(--info-bg); box-shadow: 3px 3px 0 var(--border-strong); }
.office-prop--easel { width: 46px; height: 94px; background: var(--paper-card); }
.office-prop--monitor { width: 34px; height: 34px; background: var(--fg-soft); }
.office-prop--stool { width: 20px; height: 34px; border-radius: 50%; }
.office-prop--globe { width: 16px; height: 25px; border-radius: 50%; background: var(--info-bg); }
.office-prop--fridge { width: 60px; height: 124px; }
.office-prop--sink { width: 48px; height: 36px; }
.office-prop--yoga { width: 154px; height: 60px; background: var(--info-bg); box-shadow: 4px 4px 0 var(--border-strong); }
.office-prop--ball { width: 32px; height: 32px; border-radius: 50%; background: var(--info-bg); }
.office-prop--water { width: 30px; height: 71px; }
.office-prop--bench { width: 130px; height: 69px; }

.office-prop--plant,
.office-prop--coat {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.office-prop--plant { width: 46px; height: 53px; }
.office-prop--plant::before {
  left: 7px;
  top: 25px;
  width: 16px;
  height: 16px;
  background: var(--warn-bg);
  border: 2px solid var(--fg-label);
  clip-path: polygon(10% 0, 90% 0, 74% 100%, 26% 100%);
}
.office-prop--plant::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 20px;
  height: 25px;
  background: var(--ok-bg);
  border: 2px solid var(--ok);
  clip-path: polygon(50% 0, 65% 38%, 100% 16%, 76% 58%, 100% 70%, 58% 72%, 50% 100%, 40% 72%, 0 75%, 26% 55%, 0 25%, 38% 40%);
}

.office-prop--coat { width: 28px; height: 96px; }
.office-prop--coat::before {
  left: 12px;
  top: 8px;
  width: 4px;
  height: 66px;
  background: var(--fg-label);
}
.office-prop--coat::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 10px;
  width: 22px;
  height: 4px;
  background: var(--fg-label);
  box-shadow: 4px 8px 0 -1px var(--fg-label), -4px 8px 0 -1px var(--fg-label);
}

.office-prop--sofa::before {
  left: 9px;
  top: 7px;
  width: 67px;
  height: 20px;
  border-left: 2px solid var(--border-strong);
  border-right: 2px solid var(--border-strong);
  background: transparent;
}

.office-prop--poster::before {
  left: 7px;
  top: 7px;
  width: 26px;
  height: 34px;
  background: var(--info);
  opacity: .35;
}

.office-prop--files::before,
.office-prop--shelf::before,
.office-prop--rack::before,
.office-prop--fridge::before {
  left: 6px;
  top: 14px;
  width: calc(100% - 12px);
  height: 3px;
  background: var(--border-strong);
  box-shadow: 0 13px 0 var(--border-strong), 0 26px 0 var(--border-strong);
}

.office-prop--rack::before,
.office-prop--monitor::before {
  background: var(--info);
  box-shadow: 0 13px 0 var(--ok-dot), 0 26px 0 var(--warn-dot);
}

.office-prop--easel::before {
  left: 7px;
  top: 7px;
  width: 34px;
  height: 36px;
  background: var(--info-bg);
  border: 2px solid var(--info);
}

.office-prop--yoga::before,
.office-prop--ball::before,
.office-prop--stool::before { display: none; }

.office-prop--water::before {
  left: 2px;
  top: -14px;
  width: 22px;
  height: 28px;
  border: 2px solid var(--info);
  border-radius: 45% 45% 35% 35%;
  background: var(--info-bg);
}

.office-prop-image {
  position: absolute;
  left: 0;
  top: 0;
  display: none;
  width: 100%;
  height: 100%;
  max-width: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.office-prop.has-sprite {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.office-prop.has-sprite::before,
.office-prop.has-sprite::after {
  content: none;
  display: none;
}

.office-prop.has-sprite > .office-prop-image { display: block; }

/* The rack art is drawn for the opposite wall. Mirroring only its directional
   projection turns the equipment fronts into the room while preserving the
   native pixel grid and bottom-centre anchor. */
.office-prop--rack.has-sprite[data-facing="wall-left"] > .office-prop-image {
  transform: scaleX(-1);
}

/* Постер нарисован под одну стену; на противоположной его зеркалят. */
.office-prop.has-sprite[data-facing="flip"] > .office-prop-image {
  transform: scaleX(-1);
}

/* Размер коробки предмета со спрайтом задаётся не здесь: его ставит office.js
   по таблице `furnitureArt`, то есть по настоящему размеру PNG. Правки размеров
   в CSS растягивали пиксельную мебель — стол ехал в 2× при спрайте 86×34. */

.office-agent {
  position: absolute;
  width: 96px;
  height: 150px;
  padding: 0;
  transform: translate(-50%, -100%);
  border: 0;
  background: transparent;
  color: var(--fg);
  cursor: default;
  pointer-events: auto;
}

.office-agent-shadow {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 38px;
  height: 10px;
  transform: translateX(-50%);
  border: 2px solid var(--border-strong);
  background: var(--border);
  border-radius: 50%;
}

.office-agent-figure {
  position: absolute;
  left: 15px;
  bottom: 11px;
  width: 66px;
  height: 118px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transform: scaleX(var(--office-facing, 1));
  transform-origin: 50% 100%;
}

.office-agent.has-walk-route { will-change: transform; }

.office-agent-image {
  position: absolute;
  inset: 0;
  display: none;
  width: 66px;
  height: 118px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.office-agent-image.is-active-frame { display: block; }

.office-agent.has-generated-gait .office-agent-gait-source {
  clip-path: inset(0 0 16px 0);
}

.office-agent-gait-slice {
  position: absolute;
  inset: 0;
  display: block;
  width: 66px;
  height: 118px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.office-agent-gait-slice--left {
  clip-path: inset(calc(100% - 18px) 50% 0 0);
  animation: office-gait-left 640ms step-end var(--office-motion-delay, 0ms) infinite;
}

.office-agent-gait-slice--right {
  clip-path: inset(calc(100% - 18px) 0 0 50%);
  animation: office-gait-right 640ms step-end var(--office-motion-delay, 0ms) infinite;
}

.office-agent.has-walk-pair .office-agent-gait-slice--left[data-frame="walk-a"] {
  animation:
    office-walk-frame-a 560ms step-end var(--office-walk-frame-delay, 0ms) infinite,
    office-gait-left 560ms step-end var(--office-walk-frame-delay, 0ms) infinite;
}

.office-agent.has-walk-pair .office-agent-gait-slice--right[data-frame="walk-a"] {
  animation:
    office-walk-frame-a 560ms step-end var(--office-walk-frame-delay, 0ms) infinite,
    office-gait-right 560ms step-end var(--office-walk-frame-delay, 0ms) infinite;
}

.office-agent.has-walk-pair .office-agent-gait-slice--left[data-frame="walk-b"] {
  animation:
    office-walk-frame-b 560ms step-end var(--office-walk-frame-delay, 0ms) infinite,
    office-gait-left 560ms step-end var(--office-walk-frame-delay, 0ms) infinite;
}

.office-agent.has-walk-pair .office-agent-gait-slice--right[data-frame="walk-b"] {
  animation:
    office-walk-frame-b 560ms step-end var(--office-walk-frame-delay, 0ms) infinite,
    office-gait-right 560ms step-end var(--office-walk-frame-delay, 0ms) infinite;
}

.office-agent-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.office-agent.has-art .office-agent-placeholder { display: none; }

.office-agent-placeholder::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 22px;
  width: 32px;
  height: 30px;
  border: 4px solid var(--fg-label);
  background: var(--paper-mute);
  box-shadow:
    -8px -8px 0 -2px var(--fg-label),
    8px -8px 0 -2px var(--fg-label),
    0 33px 0 7px var(--fg-label);
}

.office-agent-placeholder-mark {
  position: relative;
  z-index: 1;
  margin-top: -36px;
  color: var(--fg-label);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
}

.office-agent-placeholder-leg {
  position: absolute;
  bottom: 0;
  width: 10px;
  height: 18px;
  background: var(--fg-label);
}

.office-agent-placeholder-leg--left { left: 19px; }
.office-agent-placeholder-leg--right { right: 19px; }

.office-agent[data-state="walk"] .office-agent-placeholder-leg--left {
  animation: office-gait-left 640ms step-end var(--office-motion-delay, 0ms) infinite;
}

.office-agent[data-state="walk"] .office-agent-placeholder-leg--right {
  animation: office-gait-right 640ms step-end var(--office-motion-delay, 0ms) infinite;
}

.office-agent-action {
  position: absolute;
  z-index: 31;
  display: none;
  pointer-events: none;
}

.office-agent-action::before,
.office-agent-action::after {
  content: "";
  position: absolute;
}

.office-agent[data-state="idle"] .office-agent-figure {
  animation: office-idle 2400ms steps(2, end) var(--office-motion-delay, 0ms) infinite;
}

.office-agent[data-state="work"] .office-agent-figure {
  animation: office-work 760ms steps(2, end) var(--office-motion-delay, 0ms) infinite;
}

.office-agent[data-state="work"] .office-agent-action {
  display: block;
  right: 1px;
  bottom: 43px;
  width: 18px;
  height: 20px;
  border: 2px solid var(--ok);
  background: var(--ok-bg);
}

.office-agent[data-state="work"] .office-agent-action::before {
  left: 3px;
  top: 3px;
  width: 3px;
  height: 3px;
  background: var(--ok-dot);
  box-shadow: 0 5px 0 var(--ok-dot), 0 10px 0 var(--ok-dot);
}

.office-agent[data-state="work"] .office-agent-action::after {
  left: 8px;
  top: 4px;
  width: 6px;
  height: 2px;
  background: var(--ok);
  box-shadow: 0 5px 0 var(--ok), 0 10px 0 var(--ok);
}

.office-agent[data-state="sleep"] .office-agent-figure {
  animation: office-sleep 2800ms steps(2, end) var(--office-motion-delay, 0ms) infinite;
}

.office-agent[data-state="sleep"] .office-agent-action {
  display: block;
  right: 0;
  top: 16px;
  width: 22px;
  height: 24px;
  color: var(--warn);
  font-family: var(--font-mono);
  font-weight: 700;
  line-height: 1;
}

.office-agent[data-state="sleep"] .office-agent-action::before {
  content: "z";
  left: 1px;
  top: 12px;
  font-size: 9px;
}

.office-agent[data-state="sleep"] .office-agent-action::after {
  content: "Z";
  right: 0;
  top: 0;
  font-size: 13px;
}

.office-agent[data-state="talk"] .office-agent-figure {
  animation: office-talk 680ms steps(2, end) var(--office-motion-delay, 0ms) infinite;
}

.office-agent[data-state="talk"] .office-agent-action {
  display: block;
  right: -1px;
  top: 34px;
  width: 18px;
  height: 14px;
  border: 2px solid var(--info);
  background: var(--info-bg);
}

.office-agent[data-state="talk"] .office-agent-action::before {
  left: 3px;
  top: 4px;
  width: 2px;
  height: 2px;
  background: var(--info);
  box-shadow: 4px 0 0 var(--info), 8px 0 0 var(--info);
}

.office-agent[data-state="walk"]:not(.has-walk-pair) .office-agent-figure {
  animation: office-walk 640ms steps(2, end) var(--office-motion-delay, 0ms) infinite;
}

.office-agent[data-state="walk"] .office-agent-action {
  display: block;
  right: 5px;
  bottom: 13px;
  width: 18px;
  height: 13px;
}

.office-agent[data-state="walk"] .office-agent-action::before,
.office-agent[data-state="walk"] .office-agent-action::after {
  width: 4px;
  height: 7px;
  border: 1px solid var(--fg-label);
  background: var(--paper-card);
}

.office-agent[data-state="walk"] .office-agent-action::before {
  left: 2px;
  bottom: 0;
}

.office-agent[data-state="walk"] .office-agent-action::after {
  right: 2px;
  top: 0;
}

/* Движение поверх состояния (life.js, party.js): любой data-motion снимает
   анимацию состояния с фигуры; 'walk' — походка, 'pause' — дыхание, остальные
   манеры описаны в party.css. Префикс .office-page держит вес 0,3,0: правило
   состояния walk выше (:not(.has-walk-pair)) иначе перебивало бы снятие. */
.office-page .office-agent[data-motion] .office-agent-figure { animation: none; }

/* Поза из agent_spots (spots.js) поверх idle/sleep: тот же кадр и та же
   анимация, что у одноимённого состояния; data-state при этом серверный. */
.office-page .office-agent[data-motion="idle"] .office-agent-figure {
  animation: office-idle 2400ms steps(2, end) var(--office-motion-delay, 0ms) infinite;
}

.office-page .office-agent[data-motion="work"] .office-agent-figure {
  animation: office-work 760ms steps(2, end) var(--office-motion-delay, 0ms) infinite;
}

.office-page .office-agent[data-motion="sleep"] .office-agent-figure {
  animation: office-sleep 2800ms steps(2, end) var(--office-motion-delay, 0ms) infinite;
}

.office-agent[data-motion="pause"] .office-agent-figure {
  animation: office-idle 2400ms steps(2, end) var(--office-motion-delay, 0ms) infinite;
}

.office-agent[data-motion="walk"]:not(.has-walk-pair) .office-agent-figure {
  animation: office-walk 640ms steps(2, end) var(--office-motion-delay, 0ms) infinite;
}

.office-agent[data-motion="walk"] .office-agent-placeholder-leg--left {
  animation: office-gait-left 640ms step-end var(--office-motion-delay, 0ms) infinite;
}

.office-agent[data-motion="walk"] .office-agent-placeholder-leg--right {
  animation: office-gait-right 640ms step-end var(--office-motion-delay, 0ms) infinite;
}

.office-agent.has-walk-pair .office-agent-image[data-frame="walk-a"] {
  animation: office-walk-frame-a 560ms step-end var(--office-walk-frame-delay, 0ms) infinite;
}

.office-agent.has-walk-pair .office-agent-image[data-frame="walk-b"] {
  animation: office-walk-frame-b 560ms step-end var(--office-walk-frame-delay, 0ms) infinite;
}

.office-page.is-motion-paused .office-agent-figure,
.office-page.is-motion-paused .office-agent-image,
.office-page.is-motion-paused .office-agent-gait-slice,
.office-page.is-motion-paused .office-agent-placeholder-leg,
.office-agent.is-route-paused .office-agent-figure,
.office-agent.is-route-paused .office-agent-image,
.office-agent.is-route-paused .office-agent-gait-slice,
.office-agent.is-route-paused .office-agent-placeholder-leg {
  animation-play-state: paused !important;
}

.office-agent-tooltip {
  position: absolute;
  z-index: 1000;
  display: grid;
  gap: 4px;
  min-width: 112px;
  max-width: 190px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-card);
  color: var(--fg);
  box-shadow: var(--shadow-nav);
  pointer-events: none;
  opacity: 0;
  transform: scale(.96);
  transition-property: opacity, transform;
  transition-duration: 120ms;
  transition-timing-function: var(--ease-out);
}

.office-agent-tooltip[hidden] { display: none; }

.office-agent-tooltip.is-visible {
  opacity: 1;
  transform: scale(1);
}

.office-agent-tooltip strong {
  overflow: hidden;
  font-size: var(--fs-xs);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.office-agent-tooltip-state {
  justify-self: start;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--idle-bg);
  color: var(--idle);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
}

.office-agent-tooltip[data-state="work"] .office-agent-tooltip-state {
  background: var(--ok-bg);
  color: var(--ok);
}

.office-agent-tooltip[data-state="talk"] .office-agent-tooltip-state {
  background: var(--info-bg);
  color: var(--info);
}

.office-agent-tooltip[data-state="sleep"] .office-agent-tooltip-state {
  background: var(--warn-bg);
  color: var(--warn);
}

.office-agent-tooltip[data-state="walk"] .office-agent-tooltip-state {
  background: var(--paper-mute);
  color: var(--fg-soft);
}

@keyframes office-idle {
  50% { transform: translateY(-1px) scaleX(var(--office-facing, 1)); }
}

@keyframes office-work {
  50% { transform: translate(1px, -1px) scaleX(var(--office-facing, 1)); }
}

@keyframes office-sleep {
  0%, 100% { transform: rotate(-3deg) scaleX(var(--office-facing, 1)); }
  50% { transform: rotate(-3deg) translateY(-1px) scaleX(var(--office-facing, 1)); }
}

@keyframes office-talk {
  50% { transform: translateX(1px) scaleX(var(--office-facing, 1)); }
}

@keyframes office-walk {
  50% { transform: translate(1px, -3px) scaleX(var(--office-facing, 1)); }
}

@keyframes office-gait-left {
  0%, 49.999% { transform: translate(-6px, -4px); }
  50%, 100% { transform: translate(6px, 0); }
}

@keyframes office-gait-right {
  0%, 49.999% { transform: translate(6px, 0); }
  50%, 100% { transform: translate(-6px, -4px); }
}

@keyframes office-walk-frame-a {
  0%, 49.999% { visibility: visible; }
  50%, 100% { visibility: hidden; }
}

@keyframes office-walk-frame-b {
  0%, 49.999% { visibility: hidden; }
  50%, 100% { visibility: visible; }
}

.office-stage-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-height: 36px;
  padding: 9px 13px;
  border-top: 1px solid var(--border);
  background: var(--paper-card);
  color: var(--fg-label);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.office-stage-message {
  min-width: 0;
  max-width: 58%;
  overflow: hidden;
  color: var(--fg-soft);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.office-stage-message[hidden] { display: block; visibility: hidden; }
.office-stage-count { color: var(--fg-muted); }

.office-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 180px;
  margin-top: 12px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--paper-card);
  color: var(--fg-muted);
  font-size: var(--fs-sm);
}

.office-notice[hidden] { display: none; }

.office-notice-mark {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-strong);
  background: var(--paper-mute);
  color: var(--fg-label);
  font-family: var(--font-mono);
  font-weight: 700;
}

.office-notice-error { color: var(--fg-soft); }
.office-notice-error .office-notice-mark { color: var(--err); }
.office-notice-error .btn { margin-left: 8px; }
.office-notice-error > span:nth-child(2) { display: inline; }
.office-notice-error strong { color: var(--fg); }

.office-build-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--paper-card);
  color: var(--fg);
  box-shadow: var(--shadow-modal);
}

.office-build-dialog::backdrop {
  background: color-mix(in srgb, var(--fg) 24%, transparent);
}

.office-build-form {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 24px;
}

.office-build-dialog-mark {
  color: var(--info);
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
}

.office-build-form h2 {
  margin: 0;
  font-size: var(--fs-h2);
}

.office-build-form p {
  margin: -6px 0 3px;
  color: var(--fg-muted);
  font-size: var(--fs-sm);
}

.office-build-form label {
  color: var(--fg-label);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.office-build-form input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--fg);
  font: inherit;
}

.office-build-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--paper-mute);
  color: var(--fg-muted);
  font-size: 20px;
  cursor: pointer;
}

.office-build-form .office-build-error {
  margin: 0;
  color: var(--err);
}

.office-build-error[hidden] { display: none; }

.office-build-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

@media (max-width: 1100px) {
  .office-toolbar { flex-wrap: wrap; }
  .office-toolbar-spacer { display: none; }
  .office-scenario { margin-left: auto; }
  .office-state-test-bar { flex-wrap: wrap; }
  .office-state-test-note { width: 100%; margin-left: 0; }
  .office-frame { height: calc(100vh - 240px); }
}

@media (max-width: 720px) {
  .office-preview-content { padding: 10px; overflow-y: auto; }
  .office-toolbar { align-items: stretch; }
  .office-space { flex: 1 1 100%; }
  .office-space-button { flex: 1; }
  .office-mode { flex: 1; }
  .office-mode-button { flex: 1; }
  .office-room-picker { order: 3; flex: 1 1 100%; }
  .office-room-picker select { flex: 1; max-width: none; }
  .office-build-toggle { order: 4; flex: 1; justify-content: center; }
  .office-scenario { order: 5; width: 100%; margin-left: 0; }
  .office-scenario select { flex: 1; max-width: none; }
  .office-state-test-title { width: 100%; }
  .office-state-test-bar label { width: 100%; }
  .office-state-test-bar label span { width: 72px; flex: none; }
  .office-state-test-bar select { min-width: 0; max-width: none; flex: 1; }
  .office-build-bar { align-items: flex-start; flex-wrap: wrap; }
  .office-build-bar-spacer { display: none; }
  .office-build-manage { margin-left: auto; }
  .office-frame { min-height: 520px; height: 62vh; }
  .office-stage-footer { flex-direction: column; gap: 2px; }
  .office-notice-error { flex-wrap: wrap; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .office-room,
  .office-world { scroll-behavior: auto; }
  .office-room-tooltip,
  .office-agent-tooltip { transition-duration: 0ms; }
  .office-agent-figure,
  .office-agent-image,
  .office-agent-gait-slice,
  .office-agent-placeholder-leg { animation: none !important; }
  .office-agent.has-generated-gait .office-agent-gait-source { clip-path: none; }
  .office-agent-gait-slice { display: none; }
  .office-agent[data-state="sleep"] .office-agent-figure {
    transform: rotate(-3deg) scaleX(var(--office-facing, 1));
  }
  .office-agent.has-walk-pair .office-agent-image[data-frame="walk-b"] { display: none; }
}

/* ── Звуки сцены: кнопка и громкость в тулбаре (sound.js) ─────────────── */
.office-sound {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.office-sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--fg-soft);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  cursor: pointer;
}

.office-sound-toggle:hover { background: var(--paper-mute); color: var(--fg); }
.office-sound-toggle[aria-pressed="true"] { border-color: var(--fg); color: var(--fg); }
.office-sound-toggle:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

.office-sound-icon { width: 14px; height: 14px; display: none; }
.office-sound-toggle[aria-pressed="true"] .office-sound-icon--on,
.office-sound-toggle[aria-pressed="false"] .office-sound-icon--off { display: block; }

.office-sound-volume {
  -webkit-appearance: none;
  appearance: none;
  width: 84px;
  height: 3px;
  border-radius: 2px;
  background: var(--border-strong);
  outline: none;
}

.office-sound-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--fg);
  border: 0;
  cursor: pointer;
}

.office-sound-volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--fg);
  border: 0;
  cursor: pointer;
}

.office-sound-volume:disabled { opacity: .35; }
.office-sound-volume:focus-visible { outline: 2px solid var(--info); outline-offset: 3px; }

@media (max-width: 720px) {
  .office-sound-volume { display: none; }
}
