.big-house aside {
  top: 105px;
  left: 22px;
  width: 235px;
  padding: 15px;
}
.big-house h1 {
  font-size: 25px;
}
.big-house aside p {
  font-size: 11px;
}
.big-house #look {
  right: 25px;
  top: 105px;
}
.big-house .toolbox {
  max-width: 850px;
}
.big-house #interact {
  top: 58%;
  font-size: 12px;
}
.big-house .toolbox-title small {
  font-size: 10px;
}
#floor-map {
  position: absolute;
  right: 25px;
  top: 155px;
  width: 222px;
  background: #11282fe8;
  border: 1px solid #75988b55;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 6px 24px #0003;
}
.map-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 0;
}
.map-heading strong {
  font:
    600 17px "Outfit",
    sans-serif;
}
.map-heading small {
  display: block;
  font-size: 11px;
  color: #a3bab3;
  margin-top: 3px;
}
#map-toggle {
  font-size: 11px;
  border: 1px solid #8aa38b55;
  border-radius: 5px;
  background: #2d4446;
  padding: 7px;
}
#map-canvas {
  position: static;
  display: block;
  width: 100%;
  height: auto;
}
.floor-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 0 10px;
}
.floor-level {
  font-size: 10px;
  border-radius: 4px;
  padding: 7px 5px;
  background: #243d42;
  color: #94afa8;
}
.floor-level.active {
  color: #f0d5a2;
  background: #53604d;
}
.map-key {
  display: block;
  text-align: center;
  padding: 12px 4px;
  font-size: 9px;
  color: #b2c3b9;
}
.area-note {
  border-top: 1px solid #73928344;
  text-align: center;
  padding: 10px 4px;
  letter-spacing: 1px;
  color: #d9b77f;
  font-size: 8px;
}
#floor-map.expanded {
  width: min(380px, 90vw);
  top: 110px;
}
.big-house footer {
  font-size: 9px;
}
@media (max-width: 900px) {
  .big-house aside {
    width: 180px;
    left: 12px;
    top: 90px;
    padding: 12px;
  }
  .big-house h1 {
    font-size: 21px;
  }
  .big-house #objective {
    display: none;
  }
  .big-house #floor-map {
    right: 12px;
    top: 145px;
    width: 170px;
  }
  .big-house #look {
    right: 12px;
    top: 92px;
    font-size: 10px;
  }
  .map-heading {
    padding: 8px 8px 0;
  }
  .map-heading strong {
    font-size: 14px;
  }
  .map-heading small {
    font-size: 10px;
  }
  .floor-level {
    font-size: 8px;
    padding: 5px 3px;
  }
  .map-key {
    font-size: 7px;
  }
  .area-note {
    font-size: 6px;
  }
  .big-house #floor-map.expanded {
    width: 320px;
    top: 145px;
  }
}
@media (max-width: 600px) {
  .big-house aside {
    width: 155px;
    top: 82px;
  }
  .big-house h1 {
    font-size: 18px;
  }
  .big-house .phase {
    font-size: 9px;
  }
  .big-house #floor-map {
    width: 135px;
    top: 130px;
  }
  .big-house .map-heading strong {
    font-size: 12px;
  }
  .big-house .map-heading small {
    font-size: 8px;
  }
  .big-house #map-toggle {
    font-size: 9px;
    padding: 5px;
  }
  .big-house .floor-list {
    grid-template-columns: 1fr;
    padding: 0 6px;
    gap: 2px;
  }
  .big-house .floor-level {
    padding: 3px;
  }
  .big-house .map-key,
  .big-house .area-note {
    display: none;
  }
  .big-house #floor-map.expanded {
    width: 280px;
  }
  .big-house #interact {
    font-size: 10px;
    top: 61%;
  }
  .big-house #touch {
    bottom: 225px;
  }
  .big-house #look {
    top: 85px;
  }
  .big-house .toolbox-title small {
    display: none;
  }
}

/* Avoid re-blurring the live 3D scene behind the HUD every frame. */
.big-house .toolbox {
  backdrop-filter: none;
  background: #15292ef5;
}
.big-house #modal {
  backdrop-filter: none;
  background: #0b1927ed;
}

.big-house .traps {
  grid-template-columns: repeat(5, 1fr);
}
.big-house .toolbox {
  max-width: 1040px;
}
.big-house .trap {
  padding: 10px 7px;
}
.big-house .trap b {
  font-size: 11px;
}
.big-house .trap .emoji {
  font-size: 23px;
}
.big-house #interact {
  max-width: 90%;
  white-space: normal;
  text-align: center;
}
@media (max-width: 950px) {
  .big-house .traps {
    grid-template-columns: repeat(3, 1fr);
  }
  .big-house .trap small {
    display: none;
  }
  .big-house #toast {
    bottom: 220px;
  }
  .big-house .toolbox-title small {
    display: none;
  }
}
@media (max-width: 600px) {
  .big-house .trap b {
    font-size: 10px;
  }
  .big-house .trap strong {
    font-size: 10px;
  }
  .big-house .trap .emoji {
    font-size: 17px;
  }
}

.big-house .traps {
  grid-template-columns: repeat(4, 1fr);
}
.big-house .trap {
  padding: 8px;
}
.big-house .trap strong {
  font-size: 10px;
  white-space: nowrap;
}
.big-house .toolbox {
  padding: 10px;
  bottom: 40px;
}
.big-house .toolbox-title {
  margin-bottom: 5px;
}
#recipe-summary {
  font-size: 11px;
  color: #d8c49d;
  margin: 5px 3px 9px;
}
.craft-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.craft-actions button {
  background: #43584c;
  color: #eee1c3;
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 11px;
}
#backpack {
  position: absolute;
  right: 20px;
  top: 90px;
  bottom: 45px;
  width: min(570px, calc(100% - 40px));
  z-index: 20;
  background: #142d33;
  border: 1px solid #738e7d;
  border-radius: 12px;
  padding: 22px;
  overflow: auto;
  box-shadow: 0 10px 60px #0009;
}
#backpack[hidden] {
  display: none;
}
.bag-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bag-heading h2 {
  font-size: 26px;
  margin: 0;
}
.bag-heading button {
  padding: 9px;
  background: #344f50;
  border-radius: 6px;
}
#backpack > p {
  font-size: 12px;
  line-height: 1.7;
  color: #afc4bb;
}
#inventory-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
#inventory-list span {
  font-size: 12px;
  background: #243e41;
  border-radius: 5px;
  padding: 8px;
}
#inventory-list b {
  float: right;
  color: #e4bd80;
}
#recipe-list article {
  border-top: 1px solid #6e8a7155;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 15px 0;
}
#recipe-list article > div {
  flex: 1;
}
#recipe-list b {
  font-size: 14px;
}
#recipe-list p {
  font-size: 11px;
  color: #e0c699;
  line-height: 1.6;
}
#recipe-list small {
  font-size: 10px;
  line-height: 1.7;
  color: #91ada4;
}
#recipe-list button {
  background: #deb57b;
  color: #173037;
  padding: 10px;
  border-radius: 5px;
  font-weight: bold;
}
#recipe-list button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.big-house #toast {
  bottom: 280px;
}
@media (max-width: 650px) {
  .big-house .traps {
    grid-template-columns: repeat(2, 1fr);
  }
  .big-house .trap {
    padding: 6px;
  }
  .big-house .trap .emoji {
    font-size: 16px;
  }
  .big-house .trap b {
    font-size: 10px;
  }
  .big-house #toast {
    bottom: 330px;
  }
  .big-house #interact {
    top: 50%;
  }
  .big-house #touch {
    bottom: 330px;
  }
  #recipe-summary {
    font-size: 9px;
  }
  .craft-actions button {
    font-size: 10px;
    padding: 6px;
  }
  .big-house .toolbox-title {
    display: none;
  }
}
#thief-health {
  position: fixed;
  top: 88px;
  left: 50%;
  transform: translateX(-50%);
  width: min(450px, 38vw);
  display: flex;
  gap: 12px;
  pointer-events: none;
  z-index: 4;
}
#thief-health article {
  flex: 1;
  background: #163238ed;
  border: 1px solid #8b8c6b66;
  border-radius: 9px;
  padding: 10px;
}
#thief-health b {
  color: #f1d3a0;
  font-size: 14px;
}
#thief-health small {
  display: block;
  font-size: 11px;
  margin: 4px 0 8px;
  color: #c3d0ca;
}
.health-track {
  height: 10px;
  background: #091c21;
  border-radius: 6px;
  overflow: hidden;
}
.health-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #c96f58, #e0b06f);
  transition: width 0.16s ease;
  border-radius: 6px;
}
@media (max-width: 800px) {
  #thief-health {
    top: 78px;
    width: 52vw;
    left: 48%;
    gap: 5px;
  }
  #thief-health article {
    padding: 6px;
  }
  #thief-health small {
    font-size: 10px;
  }
}

/* ---- Burglar speech bubbles ---- */
#speech-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.speech {
  position: absolute;
  left: 0;
  top: 0;
  max-width: 220px;
  padding: 7px 12px;
  border-radius: 14px;
  background: #fff8e8;
  color: #2a2420;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  box-shadow: 0 4px 14px #0006;
  will-change: transform, opacity;
}
.speech::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  margin-left: -7px;
  border: 7px solid transparent;
  border-bottom: 0;
  border-top-color: #fff8e8;
}
.speech.pop {
  animation: speech-pop 0.25s ease-out;
}
@keyframes speech-pop {
  from {
    scale: 0.4;
  }
  60% {
    scale: 1.15;
  }
  to {
    scale: 1;
  }
}

/* ---- Prep countdown ---- */
#stats-wave strong {
  font-variant-numeric: tabular-nums;
}
#stats-wave.urgent strong {
  color: #f17d68;
  animation: urgent-pulse 1s ease-in-out infinite;
}
@keyframes urgent-pulse {
  50% {
    opacity: 0.45;
  }
}

/* ---- Combo banner ---- */
#combo {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  text-align: center;
}
#combo[hidden] {
  display: none;
}
#combo strong {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffd56b;
  text-shadow:
    0 3px 0 #b5512f,
    0 6px 18px #000a;
}
#combo small {
  font-size: 13px;
  font-weight: 700;
  color: #fff8e8;
  background: #12282de8;
  padding: 5px 12px;
  border-radius: 20px;
}
#combo.pop strong {
  animation: combo-pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes combo-pop {
  from {
    scale: 0.3;
    rotate: -8deg;
  }
  to {
    scale: 1;
    rotate: 0deg;
  }
}

/* ---- Grabbed by a burglar ---- */
#grab-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  box-shadow: inset 0 0 160px 40px #c0392bcc;
}
#grab-flash.flash {
  animation: grab-flash 2s ease-out;
}
@keyframes grab-flash {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ---- Locked in a trunk ---- */
#locked {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  cursor: pointer;
  user-select: none;
  /* The dark inside of a trunk, with light leaking through the gaps in the boards. */
  background:
    repeating-linear-gradient(
      to bottom,
      #050302f2 0,
      #050302f2 22vh,
      #f3c78a40 calc(22vh + 1px),
      #050302f2 calc(22vh + 5px)
    ),
    radial-gradient(ellipse at center, #1a0f08 0%, #000 75%);
}
#locked[hidden] {
  display: none;
}
.locked-card {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 20px 26px;
  max-width: min(420px, 86vw);
  text-align: center;
  color: #f3e6cf;
  animation: locked-thump 0.9s ease-in-out infinite;
}
.locked-card strong {
  font-size: clamp(18px, 4vw, 24px);
}
.locked-hint {
  font-size: 14px;
  color: #d9c3a0;
}
.locked-track {
  width: min(320px, 70vw);
  height: 10px;
  border-radius: 6px;
  background: #ffffff22;
  overflow: hidden;
}
#locked-bar {
  width: 0;
  height: 100%;
  background: #e8b56d;
  transition: width 0.1s linear;
}
.locked-hint kbd {
  padding: 1px 6px;
  border: 1px solid #e8b56d88;
  border-radius: 4px;
  color: #f3e6cf;
}
#locked-left {
  font-variant-numeric: tabular-nums;
  color: #e8b56d;
  font-weight: 700;
}
@keyframes locked-thump {
  50% {
    transform: scale(1.02);
  }
}

/* ---- End-of-night score ---- */
.end-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 14px;
  margin: 6px 0 2px;
}
#end-stars {
  font-size: 30px;
  letter-spacing: 4px;
  color: #ffd56b;
}
#end-grade {
  font-size: 34px;
  font-weight: 900;
  color: #fff8e8;
}
#end-points {
  font-size: 15px;
  color: #bbcec7;
  font-variant-numeric: tabular-nums;
}
#end-breakdown {
  list-style: none;
  padding: 0;
  margin: 0 auto 18px;
  max-width: 300px;
  font-size: 13px;
  color: #bbcec7;
  text-align: left;
}
#end-breakdown li {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid #68847d40;
}
#end-breakdown b {
  font-variant-numeric: tabular-nums;
  color: #fff8e8;
}
.end-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
#end-seed {
  display: block;
  margin-top: 14px;
  color: #7c9699;
  font-size: 11px;
  letter-spacing: 1px;
}

/* Keep the end screen above every HUD panel. */
#modal {
  z-index: 50;
}
.end-actions button {
  border-radius: 6px;
  padding: 13px 20px;
  font-weight: 700;
  margin-top: 10px;
  background: #2b4a50;
  color: #e7efe9;
  box-shadow: 0 4px 0 #142b30;
}
/* The primary action: the next night after a win, otherwise a new layout. */
.end-actions #next-night,
.end-actions #next-night[hidden] + #again {
  background: #e8b56d;
  color: #17252b;
  box-shadow: 0 4px 0 #9b703d;
}
.end-actions #next-night:not([hidden]) + #again {
  background: #2b4a50;
  color: #e7efe9;
  box-shadow: 0 4px 0 #142b30;
}

/* ---- Screen vignette (sits under the HUD, over the 3D view) ---- */
#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, #050b16 140%);
}
