:root {
  --ink: #f3f0e8;
  --muted: #aeb6b0;
  --black: #030405;
  --wood: #24170f;
  --panel: rgba(13, 18, 17, 0.9);
  --line: rgba(233, 232, 210, 0.18);
  --brass: #c59b52;
  --green: #75c69a;
  --red: #e45858;
  --blue: #80a8bd;
  --amber: #e0be73;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(90deg, rgba(9, 16, 16, 0.94), rgba(32, 23, 19, 0.82)),
    repeating-linear-gradient(90deg, #15110e 0 80px, #1b1510 80px 86px);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.start-screen,
.result-screen {
  min-height: 100vh;
  padding: 20px;
}

.top-links {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  width: min(1180px, 100%);
  margin: 0 auto 16px;
}

.top-links a,
.nav-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: rgba(3, 4, 5, 0.62);
  color: var(--ink);
  font-weight: 850;
}

.start-scene,
.result-scene {
  position: relative;
  display: grid;
  align-items: end;
  width: min(1180px, 100%);
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  overflow: hidden;
  border: 3px solid var(--black);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(3, 4, 5, 0.92), rgba(3, 4, 5, 0.35) 66%, rgba(3, 4, 5, 0.66)),
    url("assets/hall-panorama.png") center / cover no-repeat;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.48), 8px 8px 0 var(--black);
}

.result-scene {
  background:
    linear-gradient(90deg, rgba(3, 4, 5, 0.9), rgba(3, 4, 5, 0.32) 64%, rgba(3, 4, 5, 0.72)),
    url("assets/attic-panorama.png") center / cover no-repeat;
}

.start-copy,
.result-copy {
  width: min(720px, 100%);
  padding: clamp(22px, 5vw, 52px);
}

.kicker {
  display: inline-flex;
  margin: 0 0 14px;
  padding: 7px 10px;
  border: 2px solid var(--black);
  border-radius: var(--radius);
  background: var(--brass);
  color: #171006;
  font-weight: 950;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 var(--black);
}

h1,
.result-copy h2 {
  max-width: 10ch;
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(3rem, 8vw, 7.4rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 5px 5px 0 var(--black), 0 0 26px rgba(224, 190, 115, 0.28);
}

.start-copy p,
.result-copy p {
  max-width: 38rem;
  margin: 18px 0 24px;
  color: #fff8e8;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 800;
  line-height: 1.45;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.65);
}

.quick-rules {
  display: grid;
  gap: 8px;
  max-width: 38rem;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.quick-rules li {
  padding: 9px 11px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(3, 4, 5, 0.62);
  color: #fff8e8;
  font-weight: 850;
  line-height: 1.25;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 3px solid var(--black);
  border-radius: var(--radius);
  background: var(--amber);
  color: #1d1408;
  font-weight: 950;
  box-shadow: 5px 5px 0 var(--black);
  cursor: pointer;
}

.primary-button:hover,
.secondary-button:hover,
.nav-button:hover,
.action-button:hover,
.map-room:hover {
  transform: translate(2px, 2px);
}

.game-screen {
  min-height: 100vh;
  padding: 14px;
}

.hud {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: min(1440px, 100%);
  margin: 0 auto 12px;
}

.night-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 58px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: rgba(3, 4, 5, 0.72);
}

.night-status span {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.night-status strong {
  color: #fff;
  font-family: "Courier New", monospace;
  font-size: clamp(1.6rem, 5vw, 3rem);
  line-height: 1;
}

.desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  width: min(1440px, 100%);
  margin: 0 auto;
}

.camera-shell,
.control-panel > section {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.34);
}

.camera-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 12px 14px;
  border-bottom: 2px solid var(--line);
}

.camera-top span,
.log-panel span,
.objective-panel span,
.threat-panel span,
.map-panel span,
.meter-head span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.camera-top strong {
  display: block;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.camera-warning {
  min-width: 108px;
  padding: 7px 9px;
  border-radius: var(--radius);
  background: rgba(117, 198, 154, 0.14);
  color: #b6ffd1;
  font-family: "Courier New", monospace;
  font-weight: 900;
  text-align: center;
}

.camera-warning.bad {
  background: rgba(228, 88, 88, 0.16);
  color: #ffc7c7;
}

.pan-controls {
  display: flex;
  gap: 8px;
}

.pan-controls button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--black);
  border-radius: var(--radius);
  background: #1d2523;
  color: var(--ink);
  font-size: 2rem;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--black);
}

.camera-view {
  position: relative;
  height: min(73vh, 720px);
  min-height: 500px;
  overflow: hidden;
  background: #030405;
  cursor: grab;
  touch-action: pan-y;
}

.camera-view:active {
  cursor: grabbing;
}

.panorama-layer {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  width: max-content;
  transform: translate3d(var(--pan-x, -1000px), 0, 0);
  will-change: transform;
}

.panorama-image {
  flex: 0 0 auto;
  height: 100%;
  width: auto;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}

.camera-view::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, transparent 26%, rgba(0, 0, 0, 0.14) 54%, rgba(0, 0, 0, 0.62)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.18));
  pointer-events: none;
}

.camera-view.light-on::before {
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 231, 169, 0.18), transparent 42%),
    radial-gradient(circle at 50% 45%, transparent 32%, rgba(0, 0, 0, 0.08) 58%, rgba(0, 0, 0, 0.42));
}

.camera-view.glitch {
  animation: camera-shake 180ms steps(2, end) 4;
  filter: contrast(1.25) saturate(0.8);
}

.static-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 6px);
  mix-blend-mode: screen;
}

.camera-view.glitch .static-layer {
  opacity: 0.38;
}

.shadow-shape {
  position: absolute;
  left: var(--shadow-x, 58%);
  top: var(--shadow-y, 55%);
  z-index: 2;
  width: var(--shadow-size, 190px);
  height: calc(var(--shadow-size, 190px) * 1.35);
  border-radius: 48% 52% 42% 58%;
  background: radial-gradient(circle at 50% 14%, #070707 0 24%, rgba(0, 0, 0, 0.86) 25% 100%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.82);
  filter: blur(1px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.hotspot-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.scene-hotspot {
  position: absolute;
  display: grid;
  grid-template-columns: 34px auto;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  max-width: min(210px, 42vw);
  padding: 5px 9px 5px 5px;
  border: 2px solid rgba(255, 248, 232, 0.42);
  border-radius: var(--radius);
  background: rgba(3, 4, 5, 0.64);
  color: #fff8e8;
  font-weight: 900;
  text-align: left;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.38);
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  transition: opacity 140ms ease, transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.scene-hotspot span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(224, 190, 115, 0.2);
  color: var(--amber);
  font-size: 1rem;
}

.scene-hotspot strong {
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  line-height: 1.05;
}

.scene-hotspot:hover,
.scene-hotspot:focus-visible {
  border-color: rgba(255, 248, 232, 0.86);
  background: rgba(3, 4, 5, 0.84);
  transform: translate(-50%, -50%) scale(1.04);
}

.scene-hotspot.active-hotspot {
  border-color: var(--red);
  background: rgba(74, 29, 29, 0.78);
  animation: danger-pulse 1.1s ease-in-out infinite;
}

.scene-hotspot.active-hotspot span {
  background: rgba(228, 88, 88, 0.28);
  color: #ffe2c2;
}

.scene-hotspot.exit-hotspot {
  border-color: rgba(128, 168, 189, 0.76);
  background: rgba(10, 25, 30, 0.72);
}

.scene-hotspot.exit-hotspot span {
  background: rgba(128, 168, 189, 0.26);
  color: #d9f4ff;
}

.scene-hotspot:disabled {
  opacity: 0.34;
  cursor: not-allowed;
}

.scene-hotspot.offscreen-hotspot {
  opacity: 0;
  pointer-events: none;
}

.shadow-shape.active {
  opacity: var(--shadow-opacity, 0.72);
  transform: translate(-50%, -50%) scale(1);
}

.event-marker {
  position: absolute;
  right: 22px;
  top: 22px;
  z-index: 5;
  display: none;
  min-height: 38px;
  padding: 8px 10px;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: var(--radius);
  background: rgba(3, 4, 5, 0.68);
  color: #fff5db;
  font-weight: 950;
  text-transform: uppercase;
}

.event-marker.active {
  display: inline-flex;
  align-items: center;
}

.room-hint {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 5;
  min-height: 46px;
  padding: 11px 12px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(3, 4, 5, 0.72);
  color: #fff8e8;
  font-weight: 850;
}

.control-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.control-panel > section {
  padding: 14px;
}

.objective-panel {
  border-color: rgba(224, 190, 115, 0.5) !important;
  background: rgba(39, 31, 19, 0.94) !important;
}

.objective-panel strong {
  display: block;
  margin-top: 8px;
  color: #fff8e8;
  font-size: 1.12rem;
  line-height: 1.25;
}

.objective-panel p {
  margin: 8px 0 0;
  color: #f2d99d;
  font-weight: 800;
  line-height: 1.35;
}

.meters {
  display: grid;
  gap: 14px;
}

.meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.meter-head strong {
  font-family: "Courier New", monospace;
}

.bar {
  height: 18px;
  overflow: hidden;
  border: 2px solid var(--black);
  border-radius: var(--radius);
  background: #090a0a;
}

.bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--amber));
}

.bar.panic span {
  width: 0%;
  background: linear-gradient(90deg, var(--amber), var(--red));
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-button,
.map-room {
  min-height: 48px;
  border: 2px solid var(--black);
  border-radius: var(--radius);
  background: #1d2523;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--black);
}

.action-button {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 6px;
  text-align: left;
}

.action-button span {
  display: grid;
  place-items: center;
  color: var(--amber);
  font-size: 1.2rem;
}

.action-button.correct-action {
  position: relative;
  background: #d8b86e;
  color: #171006;
  outline: 4px solid rgba(117, 198, 154, 0.7);
  outline-offset: 2px;
}

.action-button.correct-action::after {
  content: "Rigtigt valg";
  grid-column: 1 / -1;
  margin-top: 3px;
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.action-button.correct-action span {
  color: #171006;
}

.action-button:disabled,
.map-room:disabled {
  cursor: not-allowed;
  opacity: 0.38;
  transform: none;
}

.map-panel {
  overflow: hidden;
}

.house-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, 58px);
  gap: 10px;
  margin-top: 10px;
}

.house-map::before {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  top: 50%;
  height: 4px;
  background: rgba(224, 190, 115, 0.34);
  transform: translateY(-50%);
}

.house-map::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 10%;
  bottom: 10%;
  width: 4px;
  background: rgba(224, 190, 115, 0.34);
  transform: translateX(-50%);
}

.map-room {
  position: relative;
  z-index: 1;
  min-height: 58px;
  padding: 6px;
  font-size: 0.82rem;
  line-height: 1.05;
}

.map-room.active {
  background: var(--blue);
  color: #081015;
}

.map-room.active::after {
  content: "Du er her";
  display: block;
  margin-top: 3px;
  font-size: 0.64rem;
  font-weight: 950;
  text-transform: uppercase;
}

.map-room.reachable {
  outline: 2px solid rgba(224, 190, 115, 0.55);
  outline-offset: 1px;
}

.map-room.alert {
  background: #4a1d1d;
  color: #fff4e8;
  outline: 4px solid var(--red);
  outline-offset: 2px;
  animation: danger-pulse 1.1s ease-in-out infinite;
}

.map-room.alert::after {
  content: "Fare her";
  display: block;
  margin-top: 3px;
  font-size: 0.64rem;
  font-weight: 950;
  text-transform: uppercase;
}

.map-hall {
  grid-column: 2;
  grid-row: 2;
}

.map-kitchen {
  grid-column: 1;
  grid-row: 2;
}

.map-nursery {
  grid-column: 3;
  grid-row: 2;
}

.map-basement {
  grid-column: 2;
  grid-row: 3;
}

.map-attic {
  grid-column: 2;
  grid-row: 1;
}

.threat-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.threat-item {
  min-height: 42px;
  margin: 0;
  padding: 9px 10px;
  border: 2px solid rgba(224, 190, 115, 0.4);
  border-radius: var(--radius);
  background: rgba(3, 4, 5, 0.34);
  color: #f8e7ba;
  font-weight: 850;
  line-height: 1.25;
}

.threat-item.current-threat {
  border-color: rgba(228, 88, 88, 0.7);
  background: rgba(74, 29, 29, 0.72);
  color: #fff4e8;
}

.empty-threat {
  margin: 8px 0 0;
  color: #dce7dd;
  font-weight: 760;
  line-height: 1.35;
}

.log-panel p {
  min-height: 96px;
  margin: 8px 0 0;
  color: #fff8e8;
  font-weight: 760;
  line-height: 1.45;
}

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

@keyframes camera-shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-5px, 2px); }
  50% { transform: translate(4px, -2px); }
  75% { transform: translate(-2px, -3px); }
  100% { transform: translate(0, 0); }
}

@keyframes danger-pulse {
  0%,
  100% {
    box-shadow: 3px 3px 0 var(--black), 0 0 0 rgba(228, 88, 88, 0);
  }

  50% {
    box-shadow: 3px 3px 0 var(--black), 0 0 18px rgba(228, 88, 88, 0.8);
  }
}

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

  .camera-view {
    height: 56vh;
  }

  .control-panel {
    grid-template-columns: 1fr 1fr;
  }

  .log-panel {
    grid-column: 1 / -1;
  }

  .objective-panel,
  .threat-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .game-screen {
    padding: 10px;
  }

  .hud,
  .control-panel,
  .actions {
    grid-template-columns: 1fr;
  }

  .camera-top {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .camera-view {
    min-height: 430px;
  }

  h1,
  .result-copy h2 {
    font-size: clamp(3rem, 16vw, 5.2rem);
  }
}
