:root {
  color-scheme: dark;
  --bg-1: #0f1717;
  --bg-2: #1a2624;
  --panel: rgba(13, 20, 20, 0.86);
  --panel-border: rgba(243, 221, 176, 0.12);
  --text: #f7f1e5;
  --muted: #c6bba8;
  --accent: #efb64c;
  --accent-strong: #d97334;
  --danger: #e45757;
  --safe: #82c17d;
  --shadow: rgba(0, 0, 0, 0.32);
  --ink: #101112;
  --wall-gray: #6d7579;
  --wall-dark: #2d3338;
  --warm-light: rgba(244, 171, 76, 0.86);
  --jumpsuit: #f28128;
  --jumpsuit-deep: #c85f19;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(239, 182, 76, 0.12), transparent 28%),
    linear-gradient(180deg, #111818 0%, #070c0d 100%);
  color: var(--text);
}

body {
  padding: 16px;
}

button {
  font: inherit;
}

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.hud-card,
.panel-card,
.room-panel {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 40px var(--shadow);
}

.hud-card {
  border-radius: 24px;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.eyebrow,
.section-label,
.objective-label,
.overlay-tag {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.95;
}

.subtle {
  margin: 0;
  max-width: 72ch;
  color: var(--muted);
}

.compact {
  font-size: 0.95rem;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.alert-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-chip {
  min-width: 110px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(247, 241, 229, 0.04);
  border: 1px solid rgba(247, 241, 229, 0.08);
}

.heart-chip {
  min-width: 150px;
}

.heart-readout {
  display: flex;
  align-items: center;
  gap: 12px;
}

.heart-icon {
  position: relative;
  width: 18px;
  height: 18px;
  background: #ff6c6c;
  transform: rotate(45deg) scale(1);
  border-radius: 4px;
  box-shadow: 0 0 18px rgba(228, 87, 87, 0.24);
}

.heart-icon::before,
.heart-icon::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: inherit;
}

.heart-icon::before {
  left: -9px;
}

.heart-icon::after {
  top: -9px;
}

.heart-icon.live {
  animation: heart-thump var(--heart-speed, 1s) ease-in-out infinite;
}

.alert-pill,
.boost-pill {
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(247, 241, 229, 0.1);
  background: rgba(247, 241, 229, 0.05);
  transition: background 0.14s ease-out, border-color 0.14s ease-out, color 0.14s ease-out;
}

.alert-pill.danger {
  color: #ffe4de;
  border-color: rgba(228, 87, 87, 0.42);
  background: rgba(228, 87, 87, 0.2);
}

.alert-pill.warning {
  color: #ffecc3;
  border-color: rgba(239, 182, 76, 0.42);
  background: rgba(239, 182, 76, 0.16);
}

.boost-pill.live {
  color: #dcffd8;
  border-color: rgba(130, 193, 125, 0.48);
  background: rgba(130, 193, 125, 0.18);
}

.stat-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.meter-block {
  display: grid;
  gap: 8px;
}

.meter-label-row,
.objective-panel,
.readout-row,
.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.meter {
  position: relative;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.meter-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #9b4d29 0%, #d97334 45%, #efb64c 100%);
  box-shadow: inset 0 0 16px rgba(255, 255, 255, 0.16);
  transition: width 0.18s ease-out;
}

.objective-copy {
  margin: 4px 0 0;
  color: var(--text);
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
}

.room-panel {
  border-radius: 28px;
  padding: 18px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.safe {
  background: var(--safe);
}

.legend-dot.danger {
  background: var(--danger);
}

.status-banner {
  margin: 4px 0 0;
  color: var(--text);
}

.room {
  position: relative;
  margin-top: 16px;
  min-height: 620px;
  overflow: hidden;
  border-radius: 24px;
  background:
    radial-gradient(circle at 62% 22%, rgba(255, 255, 255, 0.12), transparent 22%),
    linear-gradient(180deg, #71797d 0%, #4a5156 36%, #1f2224 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  touch-action: none;
  user-select: none;
  box-shadow: inset 0 -30px 60px rgba(0, 0, 0, 0.3);
}

.room-texture,
.cell-light-rays,
.bar-shadow-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.room-texture {
  opacity: 0.28;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.08), transparent 26%),
    radial-gradient(circle at 72% 46%, rgba(255, 255, 255, 0.05), transparent 22%),
    repeating-linear-gradient(
      125deg,
      rgba(255, 255, 255, 0.035) 0,
      rgba(255, 255, 255, 0.035) 2px,
      transparent 2px,
      transparent 6px
    );
  mix-blend-mode: soft-light;
}

.cell-light-rays {
  left: 0;
  right: auto;
  width: 78%;
  background:
    linear-gradient(103deg, rgba(244, 171, 76, 0.46) 0%, rgba(244, 171, 76, 0.22) 20%, transparent 21%),
    linear-gradient(103deg, transparent 0%, transparent 12%, rgba(244, 171, 76, 0.2) 13%, transparent 17%),
    linear-gradient(103deg, transparent 0%, transparent 28%, rgba(244, 171, 76, 0.18) 29%, transparent 33%),
    linear-gradient(103deg, transparent 0%, transparent 44%, rgba(244, 171, 76, 0.14) 45%, transparent 49%);
  opacity: 0.78;
  transform: translateX(-2%);
}

.bar-shadow-grid {
  background:
    repeating-linear-gradient(
      99deg,
      rgba(0, 0, 0, 0.78) 0,
      rgba(0, 0, 0, 0.78) 8px,
      transparent 8px,
      transparent 64px
    ),
    linear-gradient(180deg, transparent 0%, transparent 56%, rgba(0, 0, 0, 0.18) 100%);
  transform: translate(-14%, 18%) skewY(-11deg);
  transform-origin: top left;
  opacity: 0.58;
}

.room-mini-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 4;
  display: none;
  gap: 8px;
  pointer-events: none;
}

.mini-stat-row,
.mini-alert-row {
  display: grid;
  gap: 8px;
}

.mini-stat-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini-alert-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-stat,
.mini-pill {
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(12, 18, 18, 0.74);
  border: 1px solid rgba(247, 241, 229, 0.11);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.16);
}

.mini-stat span,
.mini-pill {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mini-stat span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
}

.mini-stat strong {
  font-size: 0.95rem;
}

.mini-heart strong {
  color: #ffd3d3;
}

.mini-pill {
  color: var(--text);
  font-weight: 700;
  text-align: center;
}

.mini-pill.danger {
  color: #ffe4de;
  border-color: rgba(228, 87, 87, 0.42);
  background: rgba(120, 21, 21, 0.52);
}

.mini-pill.warning {
  color: #ffecc3;
  border-color: rgba(239, 182, 76, 0.42);
  background: rgba(116, 81, 20, 0.5);
}

.mini-pill.live {
  color: #dcffd8;
  border-color: rgba(130, 193, 125, 0.48);
  background: rgba(34, 89, 39, 0.54);
}

.cell-walls > div {
  position: absolute;
  background: rgba(8, 11, 13, 0.6);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.18);
}

.wall-top,
.wall-bottom {
  left: 12%;
  right: 0;
  height: 14px;
}

.wall-top {
  top: 0;
}

.wall-bottom {
  bottom: 0;
}

.wall-right {
  top: 0;
  right: 0;
  bottom: 0;
  width: 16px;
}

.guard-lane {
  position: absolute;
  inset: 0 auto 0 0;
  width: 13%;
  background:
    linear-gradient(180deg, rgba(255, 191, 91, 0.42) 0%, rgba(137, 76, 24, 0.42) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.2));
  border-right: 10px solid rgba(0, 0, 0, 0.62);
  box-shadow: inset -18px 0 24px rgba(0, 0, 0, 0.38);
}

.bars {
  position: absolute;
  inset: 0 12px 0 auto;
  width: 52px;
  display: flex;
  justify-content: space-between;
}

.bars span {
  width: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #adb2b4 0%, #757b81 100%);
  box-shadow:
    inset 0 0 0 2px rgba(16, 17, 18, 0.28),
    0 0 8px rgba(0, 0, 0, 0.26);
}

.guard {
  position: absolute;
  left: 24px;
  top: 120px;
  width: 44px;
  height: 124px;
  border-radius: 26px 20px 12px 12px;
  background: linear-gradient(180deg, #2b5ca6 0%, #244986 34%, #16273f 100%);
  border: 0;
  box-shadow:
    0 18px 30px rgba(0, 0, 0, 0.22),
    inset -12px 0 0 rgba(0, 0, 0, 0.24);
  transition: transform 0.18s ease-out;
  opacity: 0.22;
  filter: blur(0.2px);
}

.guard::before,
.guard::after {
  content: "";
  position: absolute;
  bottom: -12px;
  width: 12px;
  height: 26px;
  border-radius: 12px;
  background: linear-gradient(180deg, #1f2330 0%, #111317 100%);
}

.guard::before {
  left: 7px;
}

.guard::after {
  right: 7px;
}

.guard-face {
  position: absolute;
  top: 10px;
  left: 6px;
  right: 6px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f0c999 0%, #d9995f 100%);
  box-shadow: inset -6px 0 0 rgba(0, 0, 0, 0.18);
  opacity: 0.9;
}

.guard-face::before,
.guard-face::after {
  content: "";
  position: absolute;
  top: 11px;
  width: 13px;
  height: 7px;
  border-radius: 999px;
  background: rgba(16, 17, 18, 0.92);
}

.guard-face::before {
  left: 7px;
}

.guard-face::after {
  right: 7px;
}

.flashlight {
  position: absolute;
  left: 42px;
  top: 176px;
  width: 280px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 139, 0.46) 0%, rgba(255, 196, 105, 0.16) 42%, transparent 74%);
  opacity: 0;
  transition: opacity 0.14s ease-out;
  pointer-events: none;
  filter: blur(1px);
}

.guard-sign {
  position: absolute;
  left: 16px;
  bottom: 18px;
  color: rgba(247, 241, 229, 0.48);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.fixture {
  position: absolute;
  display: grid;
  place-items: center;
}

.fixture-label {
  position: absolute;
  bottom: -24px;
  font-size: 0.78rem;
  color: rgba(247, 241, 229, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.toilet {
  left: 4%;
  bottom: 8%;
  width: 126px;
  height: 148px;
  transform: perspective(400px) rotateY(12deg);
}

.toilet::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 20px;
  width: 68px;
  height: 88px;
  border-radius: 26px 26px 18px 18px;
  background: linear-gradient(180deg, #f0efe9 0%, #cfd6d6 46%, #9da8a9 100%);
  border: 3px solid rgba(16, 17, 18, 0.72);
  transform: rotate(-14deg);
}

.toilet::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 22px;
  width: 22px;
  height: 70px;
  border-radius: 10px;
  background: linear-gradient(180deg, #c3cbcd 0%, #8d989c 100%);
  border: 3px solid rgba(16, 17, 18, 0.72);
}

.tool-indicator {
  position: absolute;
  top: -20px;
  left: -4px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.4);
  color: var(--accent);
}

.bed {
  right: 10%;
  bottom: 20%;
  width: 46%;
  height: 18%;
  transform: perspective(700px) rotateY(-16deg);
}

.bed::before {
  content: "";
  position: absolute;
  inset: 18px 0 10px 0;
  border-radius: 24px;
  background: linear-gradient(180deg, #8d7b68 0%, #4b4037 100%);
  border: 3px solid rgba(16, 17, 18, 0.84);
  box-shadow:
    inset 0 -10px 16px rgba(0, 0, 0, 0.22),
    0 18px 30px rgba(0, 0, 0, 0.22);
}

.bed::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 4px;
  width: 36%;
  height: 36px;
  border-radius: 14px;
  background: linear-gradient(180deg, #eef2f2 0%, #c5cccc 100%);
  border: 3px solid rgba(16, 17, 18, 0.84);
}

.bed-safe {
  position: absolute;
  top: -18px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(130, 193, 125, 0.18);
  border: 1px solid rgba(130, 193, 125, 0.4);
  color: #d7f0d5;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.poster {
  right: 18%;
  top: 20%;
  width: 19%;
  height: 29%;
  border-radius: 10px;
  background: linear-gradient(180deg, #ede6da 0%, #beb3a3 100%);
  border: 3px solid rgba(16, 17, 18, 0.84);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.12),
    0 16px 28px rgba(0, 0, 0, 0.16);
}

.poster::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 4px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.5), transparent 24%),
    linear-gradient(180deg, rgba(164, 166, 168, 0.18), rgba(78, 82, 86, 0.12));
}

.poster-cracks,
.poster-hole {
  position: absolute;
  pointer-events: none;
}

.poster-cracks {
  inset: 18px;
  opacity: 0;
  background:
    linear-gradient(135deg, transparent 46%, rgba(27, 29, 31, 0.78) 47%, transparent 50%),
    linear-gradient(210deg, transparent 44%, rgba(27, 29, 31, 0.66) 45%, transparent 48%),
    linear-gradient(80deg, transparent 34%, rgba(27, 29, 31, 0.72) 35%, transparent 37%);
}

.poster-hole {
  left: 50%;
  top: 56%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(18, 11, 8, 0.98) 0%, rgba(18, 11, 8, 0.92) 56%, rgba(48, 27, 18, 0.22) 100%);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 22px rgba(0, 0, 0, 0.28);
  border: 4px solid rgba(16, 17, 18, 0.7);
}

.player {
  position: absolute;
  left: 61%;
  top: 71%;
  width: 70px;
  height: 122px;
  transform: translate(-50%, -50%);
  z-index: 3;
}

.player-pose {
  position: absolute;
  inset: 0;
}

.player-pose::before,
.player-pose::after {
  content: "";
  position: absolute;
}

.player-pose::before {
  left: 16px;
  top: 0;
  width: 34px;
  height: 34px;
  border-radius: 44% 44% 48% 48%;
  background: linear-gradient(180deg, #f1c995 0%, #d99d66 100%);
  border: 3px solid rgba(16, 17, 18, 0.92);
  box-shadow: inset -7px 0 0 rgba(0, 0, 0, 0.16);
}

.player-pose::after {
  left: 12px;
  top: 28px;
  width: 42px;
  height: 68px;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--jumpsuit) 0%, var(--jumpsuit-deep) 100%);
  border: 3px solid rgba(16, 17, 18, 0.92);
  box-shadow:
    inset -10px 0 0 rgba(0, 0, 0, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.28);
}

.player-pose.sleeping {
  transform: rotate(80deg) translate(18px, 2px);
}

.player-pose.running {
  animation: jog 0.35s linear infinite;
}

.player-pose.pulling::after {
  height: 70px;
  transform: rotate(-8deg);
}

.player-pose.hammering {
  animation: hammer 0.26s ease-in-out infinite;
}

.player-pose.caught::after {
  transform: rotate(8deg);
}

.player-pose.running::before,
.player-pose.hammering::before,
.player-pose.pulling::before {
  box-shadow:
    inset -7px 0 0 rgba(0, 0, 0, 0.16),
    0 0 0 3px rgba(16, 17, 18, 0.92);
}

.player-shadow {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 4px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.38);
  filter: blur(5px);
}

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

.dust {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(231, 220, 196, 0.82);
  box-shadow: 0 0 14px rgba(255, 214, 150, 0.22);
  animation: dust-fade 0.8s ease-out forwards;
}

.float-text {
  position: absolute;
  color: #ffe1a7;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  animation: float-up 1s ease-out forwards;
}

.danger-vignette,
.lights-overlay,
.overlay {
  position: absolute;
  inset: 0;
}

.danger-vignette {
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at center, transparent 55%, rgba(228, 87, 87, 0.12) 72%, rgba(228, 87, 87, 0.52) 100%);
  transition: opacity 0.12s linear;
  animation-duration: var(--danger-speed, 0.75s);
}

.danger-vignette.alert {
  animation: pulse-danger var(--danger-speed, 0.75s) linear infinite;
}

.lights-overlay {
  pointer-events: none;
  background: rgba(0, 0, 0, 0.36);
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.overlay {
  display: grid;
  place-items: center;
  background: rgba(7, 12, 13, 0.64);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out;
}

.panic-text {
  position: absolute;
  left: 50%;
  top: 10%;
  z-index: 2;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  color: #ffe4de;
  background: rgba(120, 21, 21, 0.46);
  border: 1px solid rgba(228, 87, 87, 0.4);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.12s linear, transform 0.12s linear;
  pointer-events: none;
}

.panic-text.live {
  opacity: 1;
  animation: panic-pop var(--danger-speed, 0.75s) linear infinite;
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay-card {
  width: min(90%, 460px);
  padding: 28px;
  border-radius: 24px;
  text-align: center;
  background: rgba(15, 23, 23, 0.96);
  border: 1px solid rgba(239, 182, 76, 0.24);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.38);
}

.overlay-card h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.overlay-card p {
  color: var(--muted);
}

.solid-button {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #17110b;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(217, 115, 52, 0.22);
}

.solid-button.large {
  min-width: 180px;
  padding: 14px 20px;
}

.solid-button:hover,
.upgrade-button:hover {
  transform: translateY(-1px);
}

.touch-hint {
  margin-top: 14px;
  color: var(--muted);
  text-align: center;
}

.side-panel {
  display: grid;
  gap: 16px;
}

.panel-card {
  border-radius: 22px;
  padding: 18px;
}

.readout {
  display: grid;
  gap: 10px;
}

.readout-row span {
  color: var(--muted);
}

.upgrade-list {
  display: grid;
  gap: 10px;
}

.upgrade-button {
  width: 100%;
  text-align: left;
  border-radius: 16px;
  padding: 14px;
  border: 1px solid rgba(247, 241, 229, 0.08);
  background: rgba(247, 241, 229, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.14s ease-out, border-color 0.14s ease-out, opacity 0.14s ease-out;
}

.upgrade-button small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.upgrade-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.loop-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

@keyframes jog {
  0%,
  100% {
    transform: rotate(-6deg) translateY(0);
  }
  50% {
    transform: rotate(6deg) translateY(-5px);
  }
}

@keyframes hammer {
  0%,
  100% {
    transform: rotate(-6deg) translateY(0);
  }
  50% {
    transform: rotate(14deg) translateY(-6px);
  }
}

@keyframes dust-fade {
  0% {
    opacity: 0.9;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--drift-x, 0px), var(--drift-y, -24px)) scale(1.8);
  }
}

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translate(-50%, 0);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -26px);
  }
}

@keyframes pulse-danger {
  0%,
  100% {
    opacity: 0.18;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes panic-pop {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.03);
  }
}

@keyframes heart-thump {
  0%,
  100% {
    transform: rotate(45deg) scale(1);
  }
  18% {
    transform: rotate(45deg) scale(1.2);
  }
  30% {
    transform: rotate(45deg) scale(0.96);
  }
  46% {
    transform: rotate(45deg) scale(1.12);
  }
  70% {
    transform: rotate(45deg) scale(1);
  }
}

@media (max-width: 980px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .room {
    min-height: 540px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 10px;
  }

  .hud-card,
  .room-panel,
  .panel-card {
    border-radius: 20px;
    padding: 16px;
  }

  .objective-panel,
  .room-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .hud-card .subtle,
  .hud-card .stat-row,
  .hud-card .alert-row,
  .hud-card .meter-block {
    display: none;
  }

  .objective-panel {
    width: 100%;
    align-items: center;
    flex-direction: row;
    justify-content: flex-end;
  }

  .objective-panel > div {
    display: none;
  }

  .legend {
    flex-wrap: wrap;
  }

  .room {
    min-height: 72vh;
  }

  .guard-lane {
    width: 18%;
  }

  .room-mini-hud {
    display: grid;
  }

  .panic-text {
    top: 92px;
    font-size: 0.72rem;
    padding: 8px 12px;
  }

  .touch-hint {
    font-size: 0.92rem;
  }
}
