:root {
  --ink: #202124;
  --paper: #f6f1db;
  --panel: #fff9df;
  --line: #2a2318;
  --shadow: #6d5130;
  --floor: #c98149;
  --wall: #8cc7b4;
  --safe: #54b96f;
  --warn: #f0bd3f;
  --danger: #d94d3c;
  --blue: #4c82c9;
  --purple: #8d6bc6;
  --muted: #6e654f;
  --radius: 8px;
  font-family:
    "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(42, 35, 24, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(42, 35, 24, 0.06) 1px, transparent 1px),
    #dce7d4;
  background-size: 12px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
}

button {
  color: inherit;
  font: inherit;
  touch-action: manipulation;
}

#app {
  width: 430px;
  max-width: 100%;
  justify-self: center;
}

.phone {
  width: auto;
  max-width: none;
  min-height: 100dvh;
  background: var(--paper);
  border: 3px solid var(--line);
  position: relative;
  overflow: hidden;
}

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
}

.micro,
.hint,
.small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.hero {
  min-height: calc(100dvh - 28px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
}

.hero-title {
  margin: 4px 0 0;
  font-size: 40px;
  line-height: 0.98;
  letter-spacing: 0;
}

.topline,
.report-meta,
.archive-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pixel-panel,
.home-card,
.report-card,
.archive-card {
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 4px 4px 0 var(--shadow);
}

.home-card {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.duty-card {
  min-height: 120px;
  display: grid;
  grid-template-columns: 106px 1fr;
  gap: 12px;
  align-items: center;
}

.agent-card {
  border: 0;
  border-top: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 8px 0;
  display: grid;
  gap: 4px;
}

.agent-card.is-ai,
.agent-review.is-ai,
.agent-memory {
  background: transparent;
}

.agent-card.is-preparing,
.agent-review.is-preparing {
  background: transparent;
}

.agent-card.is-local,
.agent-review.is-local {
  background: transparent;
}

.agent-card.is-ai .agent-status,
.agent-review.is-ai .agent-status,
.agent-memory .agent-status {
  background: #e9f7ec;
}

.agent-card.is-preparing .agent-status,
.agent-review.is-preparing .agent-status {
  background: #fff4b8;
}

.agent-card.is-local .agent-status,
.agent-review.is-local .agent-status {
  background: #f2eee0;
}

.agent-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.agent-card > strong {
  font-size: 14px;
  line-height: 1.2;
}

.agent-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.agent-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 1000;
  line-height: 1;
  white-space: nowrap;
}

.agent-retry {
  justify-self: start;
  border: 0;
  border-bottom: 2px solid currentColor;
  background: transparent;
  padding: 3px 0 1px;
  color: #8f2c1c;
  font-size: 12px;
  font-weight: 1000;
  cursor: pointer;
}

.dept-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.05;
}

.duration-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.duration-btn,
.primary,
.secondary,
.mini-btn {
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: #fff7c2;
  box-shadow: 3px 3px 0 var(--shadow);
  font-weight: 900;
  cursor: pointer;
}

.duration-btn {
  min-height: 58px;
  padding: 8px 6px;
}

.duration-btn.active {
  background: #ffcc4d;
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--shadow);
}

.duration-btn span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  margin-top: 2px;
}

.primary,
.secondary {
  min-height: 58px;
  padding: 13px 12px;
  font-size: 18px;
}

.primary {
  width: 100%;
  background: var(--danger);
  color: #fff;
}

.secondary {
  background: #fffdf1;
}

.mini-btn {
  min-height: 38px;
  padding: 7px 9px;
  background: #e9f7ec;
  font-size: 12px;
}

.primary:active,
.secondary:active,
.mini-btn:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.game {
  min-height: calc(100dvh - 28px);
  display: grid;
  grid-template-rows: auto minmax(430px, 1fr) auto;
  gap: 8px;
  position: relative;
}

.hud {
  padding: 8px 9px;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf1;
  box-shadow: 3px 3px 0 var(--shadow);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 8px;
  align-items: center;
}

.hud-title {
  min-width: 0;
}

.status-pills {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 5px;
}

.status-pills span {
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #e9f7ec;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 1000;
  line-height: 1.1;
  white-space: nowrap;
}

.status-pills .hot-pill {
  background: #ffe6a6;
  color: #8f2c1c;
}

.status-pills .urgent-pill {
  overflow: hidden;
  text-overflow: ellipsis;
  background: #fff4b8;
}

.timer {
  min-width: 92px;
  text-align: right;
  font-weight: 1000;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.timer.overtime {
  color: var(--danger);
}

.scene {
  position: relative;
  min-height: 430px;
  border: 4px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background:
    linear-gradient(#86c8b0 0 58%, #6fb39c 58% 60%, var(--floor) 60% 100%);
  image-rendering: pixelated;
}

.dom-office-visuals,
.pixi-office-host {
  position: absolute;
  inset: 0;
}

.dom-office-visuals {
  z-index: 1;
}

.pixi-office-host {
  z-index: 2;
  overflow: hidden;
  background-color: #153c38;
  background-image:
    linear-gradient(rgba(6, 26, 24, 0.42) 2px, transparent 2px),
    linear-gradient(90deg, rgba(6, 26, 24, 0.36) 2px, transparent 2px);
  background-size: 46px 30px;
  background-position: center top;
  opacity: 0;
  pointer-events: none;
}

.pixi-office-host canvas {
  display: block;
  width: 100%;
  height: auto;
  margin-inline: auto;
  image-rendering: pixelated;
  touch-action: manipulation;
}

.scene.renderer-ready .pixi-office-host {
  opacity: 1;
  pointer-events: auto;
}

.scene.renderer-ready .dom-office-visuals,
.scene.renderer-ready::before {
  visibility: hidden;
}

.scene.renderer-ready .incident-marker {
  position: absolute;
  width: 1px;
  min-width: 1px;
  max-width: 1px;
  height: 1px;
  min-height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.scene.renderer-ready .incident-marker:focus-visible {
  left: 12px;
  top: 48px;
  width: auto;
  min-width: 112px;
  max-width: 160px;
  height: auto;
  min-height: 44px;
  margin: 0;
  padding: 6px 8px;
  overflow: visible;
  clip: auto;
  clip-path: none;
  border: 3px solid var(--line);
  white-space: normal;
  opacity: 1;
  pointer-events: auto;
  z-index: 9;
}

.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(42, 35, 24, 0.12) 1px, transparent 1px),
    linear-gradient(rgba(42, 35, 24, 0.12) 1px, transparent 1px);
  background-size: 16px 16px;
  opacity: 0.45;
  pointer-events: none;
}

.scene.overtime {
  animation: overtime-pulse 900ms steps(2, end) infinite;
}

.scene.crisis {
  box-shadow: inset 0 0 0 5px rgba(217, 77, 60, 0.28);
}

.wall-title {
  position: absolute;
  left: 12px;
  top: 10px;
  z-index: 2;
  border: 3px solid var(--line);
  background: #fff4b8;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 1000;
}

.incident-marker {
  position: absolute;
  z-index: 5;
  min-width: 92px;
  max-width: 128px;
  min-height: 38px;
  border: 3px solid var(--line);
  background: #fffdf1;
  box-shadow: 3px 3px 0 rgba(42, 35, 24, 0.35);
  padding: 4px 5px;
  display: grid;
  grid-template-columns: 24px 1fr;
  grid-template-rows: 1fr auto;
  gap: 0 4px;
  align-items: center;
  appearance: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 1000;
  line-height: 1.05;
  text-align: left;
  touch-action: manipulation;
  overflow: visible;
  transform-origin: center;
}

.incident-marker b {
  position: relative;
  grid-row: 1 / 3;
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  background: #fff4b8;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.incident-marker span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.incident-marker em {
  color: var(--danger);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0;
}

.incident-marker.severity-2 {
  background: #ffe6a6;
}

.incident-marker.severity-3 {
  background: #ffd4cc;
  animation: incident-blink 800ms steps(2, end) infinite;
}

.incident-marker:active:not(:disabled) {
  box-shadow: 1px 1px 0 rgba(42, 35, 24, 0.35);
}

.incident-marker:disabled {
  cursor: default;
  filter: grayscale(0.5);
}

.incident-marker.ghost {
  pointer-events: none;
}

.incident-marker.fx-up {
  animation: incident-up 540ms steps(4, end);
}

.incident-marker.fx-up-urgent {
  animation: incident-up-urgent 640ms steps(5, end);
  outline: 4px solid rgba(217, 77, 60, 0.7);
}

.incident-marker.fx-chain-up {
  animation: incident-chain-up 520ms steps(4, end);
}

.incident-marker.fx-down {
  animation: incident-down 520ms steps(4, end);
  background: #e9f7ec;
}

.incident-marker.fx-handled {
  animation: incident-handled 420ms steps(3, end);
}

.incident-marker.fx-resolve {
  animation: incident-resolve 680ms steps(5, end) forwards;
}

.incident-marker.fx-resolve::before {
  content: "OK";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  border: 3px solid var(--safe);
  background: #fffdf1;
  color: var(--safe);
  padding: 2px 6px;
  font-size: 13px;
  font-weight: 1000;
  translate: -50% -50%;
  rotate: -10deg;
  animation: resolve-stamp 500ms steps(4, end);
}

.incident-ppt_bubble.fx-ppt-pop::after {
  content: "";
  position: absolute;
  inset: -8px;
  pointer-events: none;
  background:
    radial-gradient(circle at 35% 34%, rgba(255, 255, 255, 0.95) 0 4px, transparent 5px),
    radial-gradient(circle at 60% 60%, rgba(255, 232, 139, 0.95) 0 3px, transparent 4px),
    linear-gradient(45deg, transparent 42%, rgba(42, 35, 24, 0.8) 43% 47%, transparent 48%);
  animation: ppt-pop 560ms steps(5, end) forwards;
}

.incident-audit_lamp.fx-audit-flash b {
  animation: audit-card-flash 580ms steps(4, end);
}

.incident-audit_lamp.fx-audit-dim {
  animation: audit-card-dim 560ms steps(4, end);
}

.incident-file_pile.fx-file-grow b::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: -9px;
  height: 5px;
  border: 2px solid var(--line);
  background: #fff7db;
  box-shadow: 0 6px 0 #fff7db, 0 8px 0 var(--line);
  animation: file-grow 620ms steps(4, end);
}

.incident-marker.hot {
  z-index: 7;
  outline: 4px solid #9bd500;
  background: #fff4b8;
  box-shadow: 4px 4px 0 rgba(42, 35, 24, 0.48);
}

.incident-legs_slumped {
  left: 54px;
  top: 82px;
}

.incident-oxygen_red {
  right: 28px;
  top: 82px;
}

.incident-ppt_bubble {
  left: 42px;
  top: 132px;
}

.incident-audit_lamp {
  right: 32px;
  top: 132px;
}

.incident-stim_shake {
  left: 50%;
  top: 178px;
  transform: translateX(-50%);
}

.incident-file_pile {
  right: 32px;
  top: 178px;
}

.incident-clear {
  left: 50%;
  top: 112px;
  transform: translateX(-50%);
  background: #e9f7ec;
}

.meeting-table {
  position: absolute;
  left: 50%;
  top: 54%;
  width: 238px;
  height: 88px;
  transform: translate(-50%, -50%);
  border: 4px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.18), transparent 20% 80%, rgba(0,0,0,0.12)),
    #55795f;
  box-shadow: 0 9px 0 #2e5237;
  z-index: 2;
}

.paper {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 46px;
  transform: translate(-50%, -50%) rotate(-3deg);
  border: 3px solid var(--line);
  background: #fff7db;
}

.paper::before,
.paper::after {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  height: 3px;
  background: #c9aa72;
}

.paper::before {
  top: 12px;
}

.paper::after {
  top: 24px;
}

.stamp-mark {
  position: absolute;
  right: 10px;
  bottom: 5px;
  border: 3px solid var(--danger);
  color: var(--danger);
  width: 28px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 1000;
  opacity: 0;
}

.scene.stamped .stamp-mark {
  animation: stamp-pop 580ms steps(4, end);
}

.sprite {
  position: absolute;
  z-index: 3;
  width: 70px;
  height: 88px;
}

.duty-card .sprite {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
  width: 92px;
  height: 100px;
  transform: none;
  justify-self: center;
}

.sprite.legs {
  left: 30px;
  top: 122px;
}

.duty-card .sprite.legs {
  left: auto;
  top: auto;
}

.sprite.legs.slumped {
  transform: rotate(8deg) translateY(7px);
}

.sprite.legs.fx-legs-recover .pixel-leg {
  animation: legs-recover 620ms steps(5, end);
}

.sprite.heart {
  right: 28px;
  top: 122px;
  transform: scale(0.82);
}

.sprite.heart.red {
  filter: saturate(1.35) contrast(1.06);
}

.sprite.brain {
  left: 62px;
  bottom: 30px;
  transform: scale(0.78);
}

.sprite.brain.bubble {
  filter: saturate(1.25);
}

.sprite.audit {
  right: 62px;
  bottom: 30px;
  transform: scale(0.76);
}

.sprite.audit.alarm {
  animation: audit-alarm 900ms steps(2, end) infinite;
}

.sprite.audit.fx-audit-up .pixel-audit::before {
  animation: audit-light-up 620ms steps(4, end);
}

.sprite.audit.fx-audit-down .pixel-audit::before {
  animation: audit-light-down 620ms steps(4, end);
}

.pixel-leg,
.pixel-heart,
.pixel-brain,
.pixel-audit {
  position: absolute;
  inset: 10px 12px 14px;
}

.pixel-leg::before,
.pixel-heart::before,
.pixel-brain::before,
.pixel-audit::before {
  content: "";
  position: absolute;
  inset: 8px 7px 24px;
  border: 4px solid var(--line);
  border-radius: 10px;
  background: #f2b36d;
  box-shadow: inset 0 -10px 0 rgba(0,0,0,0.12);
}

.pixel-leg::after,
.pixel-heart::after,
.pixel-brain::after,
.pixel-audit::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 4px;
  height: 32px;
  background:
    linear-gradient(90deg, var(--line) 0 8px, transparent 8px 18px, var(--line) 18px 26px, transparent 26px),
    linear-gradient(#475a9a, #475a9a);
  border-bottom: 4px solid var(--line);
}

.pixel-heart::before {
  background: #e96f7c;
  border-radius: 50% 50% 12px 12px;
}

.pixel-brain::before {
  background:
    radial-gradient(circle at 30% 35%, #f5b8d4 0 10px, transparent 11px),
    radial-gradient(circle at 60% 32%, #f5b8d4 0 12px, transparent 13px),
    radial-gradient(circle at 44% 55%, #de7bab 0 16px, transparent 17px),
    #f5b8d4;
}

.pixel-audit::before {
  background: #d7d4c7;
  border-radius: 6px;
}

.eye {
  position: absolute;
  top: 28px;
  width: 7px;
  height: 7px;
  background: var(--line);
  z-index: 4;
}

.eye.left {
  left: 25px;
}

.eye.right {
  right: 25px;
}

.mouth {
  position: absolute;
  left: 29px;
  top: 43px;
  width: 18px;
  height: 5px;
  background: var(--line);
  z-index: 4;
}

.badge {
  position: absolute;
  left: 21px;
  top: 58px;
  width: 31px;
  height: 13px;
  border: 2px solid var(--line);
  background: #fff;
  z-index: 4;
}

.speech {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 70px;
  z-index: 5;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf1;
  padding: 8px 10px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.speech strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.speech .hint {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-row {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.device {
  min-height: 50px;
  border: 3px solid var(--line);
  background: #fff9df;
  border-radius: var(--radius);
  padding: 4px;
  display: grid;
  gap: 3px;
  align-content: center;
}

.device.hidden {
  opacity: 0.24;
  filter: grayscale(1);
}

.device.warn {
  background: #ffe6a6;
}

.device.danger {
  background: #ffd4cc;
}

.device-name {
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gauge {
  height: 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, #ffb3a8 0 40%, #aee7af 40% 68%, #ffd175 68% 100%);
}

.needle {
  position: absolute;
  top: -3px;
  width: 5px;
  height: 18px;
  background: var(--line);
  transform: translateX(-2px);
}

.round-actions {
  display: grid;
  gap: 8px;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 74px;
  background: rgba(32, 33, 36, 0.18);
}

.incident-modal {
  width: calc(100% - 12px);
  max-height: min(330px, 48dvh);
  overflow: auto;
  border: 4px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf1;
  box-shadow: 5px 5px 0 var(--shadow);
  padding: 9px;
  display: grid;
  gap: 7px;
}

.modal-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  align-items: center;
}

.modal-head .micro {
  grid-column: 1;
}

.modal-head h2 {
  grid-column: 1 / 2;
  margin: 0;
  font-size: 19px;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 7px;
}

.modal-head h2 b {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  background: #fff4b8;
  display: grid;
  place-items: center;
  font-size: 13px;
}

.modal-head em {
  grid-column: 2;
  color: var(--danger);
  font-style: normal;
  font-weight: 1000;
}

.modal-close {
  grid-column: 2;
  grid-row: 1 / 2;
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: #fff;
  box-shadow: 2px 2px 0 var(--shadow);
  font-size: 20px;
  font-weight: 1000;
  line-height: 1;
  cursor: pointer;
}

.modal-line,
.modal-detail {
  margin: 0;
  line-height: 1.32;
}

.modal-line {
  font-size: 15px;
  font-weight: 900;
}

.modal-detail {
  margin: -3px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.modal-action {
  min-height: 54px;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf1;
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 5px;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 1px 6px;
  align-items: center;
  text-align: left;
  font-weight: 1000;
  cursor: pointer;
}

.modal-action b {
  grid-row: 1 / 3;
  width: 28px;
  height: 28px;
  border: 3px solid currentColor;
  background: #fff;
  display: grid;
  place-items: center;
  transform: rotate(-5deg);
}

.modal-action small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
}

.modal-action:active,
.modal-close:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--shadow);
}

.modal-action:disabled {
  cursor: default;
  opacity: 0.58;
  filter: grayscale(0.6);
}

.modal-action.comfort {
  background: #ffe2ec;
}

.modal-action.push {
  background: #e4eeff;
}

.modal-action.vision {
  background: #fff0a3;
}

.modal-action.deflect {
  background: #e7f7ff;
}

.settle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.report,
.archive {
  min-height: calc(100dvh - 28px);
  display: grid;
  align-content: start;
  gap: 10px;
}

.report-card,
.archive-card {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.report-card h1,
.archive-card h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
}

.report-head,
.archive-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.report-head .micro,
.archive-head .micro {
  margin: 0 0 3px;
}

.result-stamp {
  flex: 0 0 auto;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--danger);
  color: #fff;
  padding: 4px 7px;
  box-shadow: 2px 2px 0 var(--shadow);
  font-size: 12px;
  font-weight: 1000;
  line-height: 1;
  transform: rotate(-2deg);
  white-space: nowrap;
}

.result-stamp.muted {
  background: #fff4b8;
  color: var(--line);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.result-tile {
  min-height: 53px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf1;
  padding: 6px 7px;
  display: grid;
  align-content: center;
  gap: 2px;
}

.result-tile span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
}

.result-tile strong {
  display: block;
  min-width: 0;
  font-size: 16px;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.result-tile.risk {
  background: #fff4b8;
}

.result-tile.culture {
  background: #e9f7ec;
}

.report-line {
  display: grid;
  gap: 3px;
  border-top: 2px solid var(--line);
  padding-top: 8px;
}

.report-line.compact {
  gap: 4px;
  padding-top: 7px;
}

.report-line span {
  line-height: 1.32;
}

.agent-review,
.agent-memory {
  margin-inline: 0;
  padding: 8px 0 0;
  border: 0;
  border-top: 2px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.agent-memory em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.3;
}

.next-preview {
  margin-top: 1px;
}

.next-preview span {
  font-weight: 900;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff7c2;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 900;
}

.report-actions {
  display: grid;
  gap: 8px;
}

.secondary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.report-actions .secondary,
.archive > .secondary {
  min-height: 50px;
  font-size: 16px;
}

.archive-grid {
  align-items: stretch;
  flex-wrap: wrap;
}

.archive-stat {
  flex: 1 1 46%;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf1;
  padding: 8px;
}

.archive-stat strong {
  display: block;
  font-size: 20px;
  line-height: 1.08;
}

.archive-report-list {
  display: grid;
  gap: 6px;
}

.archive-report {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf1;
  padding: 7px;
  display: grid;
  gap: 2px;
}

.archive-report strong {
  font-size: 15px;
  line-height: 1.15;
}

.archive-report span,
.archive-report em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.25;
}

.empty {
  color: var(--muted);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 10px;
}

@keyframes stamp-pop {
  0% {
    opacity: 0;
    transform: scale(2.2) rotate(-12deg);
  }
  40%,
  100% {
    opacity: 1;
    transform: scale(1) rotate(-12deg);
  }
}

@keyframes overtime-pulse {
  0%,
  100% {
    filter: saturate(1);
  }
  50% {
    filter: saturate(1.35) contrast(1.05);
  }
}

@keyframes incident-blink {
  0%,
  100% {
    filter: saturate(1);
  }
  50% {
    filter: saturate(1.45);
  }
}

@keyframes audit-alarm {
  0%,
  100% {
    filter: saturate(1);
  }
  50% {
    filter: saturate(1.7) hue-rotate(-14deg);
  }
}

@keyframes incident-up {
  0%,
  100% {
    scale: 1;
    translate: 0 0;
    filter: saturate(1);
  }
  25% {
    scale: 1.08;
    translate: 0 -2px;
    filter: saturate(1.45);
  }
  50% {
    translate: -3px 0;
    background: #ffd4cc;
  }
  75% {
    translate: 3px 0;
  }
}

@keyframes incident-up-urgent {
  0%,
  100% {
    scale: 1;
    translate: 0 0;
    filter: saturate(1);
  }
  18%,
  54% {
    scale: 1.1;
    translate: -4px 0;
    background: #ffb8ad;
    filter: saturate(1.65) contrast(1.08);
  }
  36%,
  72% {
    translate: 4px 0;
  }
}

@keyframes incident-chain-up {
  0%,
  100% {
    scale: 1;
    filter: saturate(1);
  }
  35% {
    scale: 1.06;
    background: #ffe6a6;
    filter: saturate(1.4);
  }
  58% {
    translate: 0 -3px;
  }
}

@keyframes incident-down {
  0%,
  100% {
    scale: 1;
    filter: saturate(1);
  }
  28% {
    scale: 0.94;
    translate: 0 2px;
    filter: saturate(0.82);
  }
  56% {
    scale: 1.05;
    background: #e9f7ec;
  }
}

@keyframes incident-handled {
  0%,
  100% {
    scale: 1;
  }
  45% {
    scale: 0.96;
    background: #e9f7ec;
  }
}

@keyframes incident-resolve {
  0% {
    opacity: 1;
    scale: 1;
    filter: saturate(1);
  }
  38% {
    opacity: 1;
    scale: 0.96;
    background: #e9f7ec;
  }
  100% {
    opacity: 0;
    scale: 0.78;
    translate: 0 -8px;
    filter: saturate(0.7);
  }
}

@keyframes resolve-stamp {
  0% {
    opacity: 0;
    scale: 1.9;
  }
  42%,
  100% {
    opacity: 1;
    scale: 1;
  }
}

@keyframes ppt-pop {
  0% {
    opacity: 0;
    scale: 0.5;
  }
  22% {
    opacity: 1;
    scale: 1.08;
    rotate: -8deg;
  }
  100% {
    opacity: 0;
    scale: 1.4;
    rotate: 12deg;
  }
}

@keyframes audit-card-flash {
  0%,
  100% {
    background: #fff4b8;
  }
  45% {
    background: #ff6b5b;
    color: #fff;
  }
}

@keyframes audit-card-dim {
  0% {
    filter: saturate(1.5);
  }
  55% {
    filter: saturate(0.55) brightness(0.92);
    background: #e9f7ec;
  }
  100% {
    filter: saturate(1);
  }
}

@keyframes file-grow {
  0% {
    opacity: 0;
    translate: 0 -8px;
  }
  35%,
  100% {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes legs-recover {
  0% {
    rotate: 8deg;
    translate: 0 7px;
  }
  45% {
    rotate: -3deg;
    translate: 0 -2px;
  }
  100% {
    rotate: 0deg;
    translate: 0 0;
  }
}

@keyframes audit-light-up {
  0%,
  100% {
    box-shadow: inset 0 -10px 0 rgba(0,0,0,0.12);
  }
  45% {
    background: #ff6b5b;
    box-shadow: 0 0 0 6px rgba(217, 77, 60, 0.24), inset 0 -10px 0 rgba(0,0,0,0.12);
  }
}

@keyframes audit-light-down {
  0% {
    background: #ff6b5b;
  }
  55% {
    background: #bfc4b8;
    filter: saturate(0.6);
  }
  100% {
    filter: saturate(1);
  }
}

@media (min-width: 720px) {
  body {
    min-height: 100vh;
    padding: 28px;
  }

  .phone {
    min-height: min(900px, calc(100vh - 56px));
    border-radius: 28px;
  }

  .screen {
    min-height: min(900px, calc(100vh - 56px));
  }
}

@media (max-height: 760px) {
  .scene {
    min-height: 396px;
  }

  .incident-marker {
    min-width: 82px;
    max-width: 108px;
  }

  .incident-ppt_bubble,
  .incident-audit_lamp {
    top: 124px;
  }

  .incident-stim_shake,
  .incident-file_pile {
    top: 164px;
  }

  .speech {
    bottom: 68px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene.overtime,
  .incident-marker.severity-3,
  .sprite.audit.alarm {
    animation: none;
  }
}
