:root {
  --red: #e4002b;
  --red-deep: #9b0018;
  --red-mid: #c8102e;
  --ink: #2a1618;
  --gray: #6b4a4e;
  --line: #ead4d6;
  --card: #fff;
  --wash: #f7ecee;
  --amber: #b86a1a;
  --font: ui-sans-serif, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  max-width: 100%;
  background: linear-gradient(180deg, #fff 0%, var(--wash) 55%, #f3e4e6 100%);
  color: var(--ink);
  font-family: var(--font);
}
.top {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px 8px 16px;
  pointer-events: none;
}
.brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--red-deep);
}
.asof { margin: 2px 0 0; font-size: 12px; color: var(--gray); }
.logo {
  height: 28px;
  width: auto;
  max-width: 38vw;
  object-fit: contain;
  pointer-events: auto;
  background: #9b0018;
  padding: 5px 8px;
}
#stage {
  position: fixed;
  inset: 52px 0 96px;
  perspective: 900px;
  perspective-origin: 50% 45%;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
#stage.grabbing { cursor: grabbing; }
#world {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform-origin: 0 0;
  will-change: transform;
}
.load-err {
  position: absolute;
  left: 16px; right: 16px; top: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 12px 14px;
  font-size: 14px;
  z-index: 5;
}
.ground {
  position: absolute;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.5), rgba(234,212,214,0.85));
  border: 1px solid var(--line);
  transform: translate(-50%, -50%) rotateX(0deg);
  transform-style: preserve-3d;
}
.wing-label {
  position: absolute;
  background: var(--card);
  color: var(--red-deep);
  border: 1px solid var(--line);
  font-size: 13px;
  letter-spacing: 0.08em;
  padding: 4px 9px;
  white-space: nowrap;
  pointer-events: none;
}
.box {
  position: absolute;
  transform-style: preserve-3d;
  transform-origin: 50% 50% 0;
  cursor: pointer;
}
.face {
  position: absolute;
  left: 0; top: 0;
  background: #fff;
  border: 1px solid #d9b8bb;
  backface-visibility: hidden;
}
.face.fl { background: #f6eaea; }
.face.ce { background: rgba(255,248,248,0.55); }
.face.so { background: linear-gradient(180deg, #fff, #f0d6d9); }
.face.no { background: #ebd3d6; }
.face.ea { background: #f3e0e3; }
.face.we { background: #ead0d3; }
.plate {
  position: absolute;
  left: 50%;
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 11px;
  line-height: 1.25;
  padding: 2px 5px;
  white-space: normal;
  text-align: center;
  max-width: 94%;
  pointer-events: none;
}
.plate.sideways { transform: translate(-50%, -50%) rotate(90deg); }
.plate { top: 50%; bottom: auto; }
.box.is-unknown .plate { border-style: dashed; color: var(--gray); }
.lamp {
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: 10px; height: 10px;
  border-radius: 50%;
  transform: translate(-50%, 0) translateZ(4px);
  background: #e6d0d2;
  box-shadow: none;
  pointer-events: none;
}
.box.is-working .face.so {
  background: linear-gradient(180deg, #ffe8eb, #f7d3d7);
}
.box.is-working .lamp {
  background: var(--red);
  box-shadow: 0 0 10px 3px rgba(228,0,43,0.45);
  animation: pulse 1.6s ease-in-out infinite;
}
.box.is-queued .lamp {
  background: var(--red-mid);
  box-shadow: 0 0 8px 2px rgba(200,16,46,0.25);
  animation: glow 2.8s ease-in-out infinite;
}
.box.is-hold .lamp {
  background: var(--amber);
  box-shadow: 0 0 8px 2px rgba(184,106,26,0.45);
}
.box.is-unknown .lamp {
  background: transparent;
  border: 1px dashed var(--gray);
}
.sil {
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: 8px;
  height: 18px;
  border-radius: 6px 6px 2px 2px;
  background: #5a3538;
  transform: translate(-50%, 0) translateZ(5px);
  pointer-events: none;
  opacity: 0.85;
}
.box.is-working .sil { animation: pace 2.2s ease-in-out infinite; }
.box.is-idle .sil, .box.is-unknown .sil { opacity: 0.35; }
.box.is-hold .sil { opacity: 0.5; }
@keyframes pulse {
  0%,100% { opacity: 1; box-shadow: 0 0 8px 2px rgba(228,0,43,0.35); }
  50% { opacity: 0.7; box-shadow: 0 0 14px 5px rgba(228,0,43,0.55); }
}
@keyframes glow {
  0%,100% { opacity: 0.55; }
  50% { opacity: 1; }
}
@keyframes pace {
  0%,100% { transform: translate(calc(-50% - 10px), 0) translateZ(5px); }
  50% { transform: translate(calc(-50% + 10px), 0) translateZ(5px); }
}

.floors {
  position: fixed;
  left: 0; right: 0;
  bottom: 44px;
  z-index: 20;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 8px;
}
.floors button, .strip button, .back, .door-link {
  font-family: var(--font);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.floors button.is-on, .strip button.is-on { background: var(--red); color: #fff; border-color: var(--red); }
.strip {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 8px 8px;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.strip button { flex: 0 0 auto; white-space: nowrap; }
.hint {
  position: fixed;
  left: 12px;
  bottom: 96px;
  z-index: 18;
  margin: 0;
  font-size: 11px;
  color: var(--gray);
  background: rgba(255,255,255,0.86);
  padding: 4px 8px;
  max-width: 46vw;
  pointer-events: none;
}
.foot {
  display: none;
}
.room-view {
  position: fixed;
  inset: 52px 0 0;
  z-index: 30;
  background: rgba(42,22,24,0.28);
}
.interior {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  perspective: 700px;
}
.iw {
  position: absolute;
  background: #fff;
}
.iw.wall-l, .iw.wall-r {
  top: 0; width: 18%; height: 58%;
  background: linear-gradient(180deg, #fff, var(--wash));
  border: 1px solid var(--line);
}
.iw.wall-l { left: 0; transform: perspective(500px) rotateY(28deg); transform-origin: left center; }
.iw.wall-r { right: 0; transform: perspective(500px) rotateY(-28deg); transform-origin: right center; }
.iw.wall-b {
  left: 10%; right: 10%; top: 0; height: 52%;
  background: linear-gradient(180deg, #fff8f8, #f4e4e6);
  border: 1px solid var(--line);
  border-bottom: 0;
}
.iw.floor {
  left: 0; right: 0; top: 52%; bottom: 0;
  background: linear-gradient(180deg, #ead4d6, #f7ecee);
}
.back {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
}
.interior-body {
  position: absolute;
  z-index: 1;
  left: 18%;
  right: 18%;
  top: 56px;
  height: 42%;
  overflow: auto;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--line);
  padding: 12px 14px 14px;
}
.desk {
  position: absolute;
  z-index: 1;
  left: 12%;
  right: 12%;
  top: 62%;
  height: 22%;
  background: linear-gradient(180deg, #e8c9cc, #d9b4b8);
  border: 1px solid #c9a3a7;
  transform: perspective(500px) rotateX(55deg);
  transform-origin: top center;
}
.interior-body h2 {
  margin: 0 0 4px;
  font-size: 20px;
  color: var(--red-deep);
}
.meta { margin: 0 0 10px; font-size: 12px; color: var(--gray); }
.duty, .focus, .person, .task, .learn-track, .cost-row {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.55;
}
.k { color: var(--gray); font-size: 12px; margin-bottom: 2px; }
.person {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.person-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.person .name { font-weight: 600; }
.badge {
  font-size: 12px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}
.badge.working { border-color: var(--red); color: var(--red-deep); }
.badge.hold { border-color: var(--amber); color: var(--amber); }
.badge.unknown { border-style: dashed; color: var(--gray); }
.person.is-working .name::after {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.6s ease-in-out infinite;
  vertical-align: middle;
}
.walk-fig {
  display: inline-block;
  width: 8px; height: 16px;
  margin-left: 6px;
  background: #5a3538;
  border-radius: 4px 4px 1px 1px;
  animation: pace 2.2s ease-in-out infinite;
  vertical-align: middle;
}
.learn-track { padding: 6px 0; border-top: 1px solid var(--line); }
.learn-track b { display: block; font-size: 13px; }
.muted { color: var(--gray); }
@media (min-width: 900px) {
  .strip { display: none; }
  .hint { bottom: 56px; }
  .floors { bottom: 12px; }
  #stage { bottom: 52px; }
}
@media (max-width: 899px) {
  .brand h1 { font-size: 18px; }
  .hint { display: none; }
}

.bill {
  position: absolute;
  left: 0; top: 0;
  transform-origin: center center;
  background: #fff;
  color: #9b0018;
  border: 1px solid #ead4d6;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  padding: 2px 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}
