:root {
  color-scheme: dark;
  font-family: "Courier New", Courier, monospace;
  --paper: #e5dfb5;
  --warning: #ddc33e;
  --blood: #9e2117;
  --ink: #10110c;
}

* { box-sizing: border-box; }

html,
body,
#game {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #080906;
}

body {
  user-select: none;
  touch-action: none;
}

button { font: inherit; }

#scene {
  display: block;
  width: 100%;
  height: 100%;
}

.is-hidden { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 6vw, 84px);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .86), rgba(0, 0, 0, .24)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 4px),
    #15150f;
}

.start-screen {
  align-items: flex-end;
  justify-content: space-between;
  background:
    linear-gradient(90deg, rgba(5, 5, 3, .97) 0%, rgba(8, 8, 5, .68) 49%, rgba(8, 8, 5, .22) 100%),
    radial-gradient(circle at 75% 40%, rgba(196, 178, 84, .19), transparent 24%),
    repeating-linear-gradient(90deg, transparent 0 112px, rgba(34, 33, 19, .8) 113px 120px),
    repeating-linear-gradient(0deg, #353321 0 92px, #242417 93px 98px);
}

.title-lockup {
  width: min(790px, 100%);
  padding-bottom: 4vh;
}

.eyebrow {
  display: block;
  color: var(--warning);
  font-size: 11px;
  font-weight: 900;
}

h1,
h2,
p { margin: 0; }

h1 {
  margin: 9px 0 18px;
  color: #e7e3bd;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(66px, 10.5vw, 150px);
  font-weight: 900;
  line-height: .79;
  text-shadow: 5px 5px 0 #3a361e;
}

h2 {
  margin: 7px 0 14px;
  color: var(--paper);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(48px, 8vw, 104px);
  line-height: .88;
}

.title-lockup p,
.end-screen p {
  max-width: 560px;
  color: #bdb99a;
  font-size: clamp(14px, 1.7vw, 18px);
  line-height: 1.55;
}

.primary-button {
  min-height: 50px;
  margin-top: 28px;
  padding: 0 24px;
  border: 1px solid #e5da86;
  border-radius: 2px;
  background: #d5c65d;
  color: #12130d;
  font-weight: 900;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: #f1e68d;
  outline: 2px solid rgba(241, 230, 141, .3);
  outline-offset: 3px;
  transform: translateY(-1px);
}

.case-file {
  display: grid;
  gap: 8px;
  align-self: flex-start;
  margin-top: 4vh;
  color: rgba(216, 212, 173, .54);
  font-size: 10px;
  text-align: right;
}

.pause-screen,
.end-screen {
  background: rgba(8, 9, 6, .93);
  text-align: center;
}

.final-time {
  display: block;
  margin-top: 22px;
  color: var(--warning);
  font-size: clamp(28px, 5vw, 54px);
}

.hud {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.timer-panel,
.status-panel {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  padding: 12px 14px;
  background: rgba(8, 9, 6, .48);
  text-shadow: 1px 1px 3px #000;
}

.timer-panel {
  left: max(16px, env(safe-area-inset-left));
  border-left: 2px solid var(--warning);
}

.timer-panel strong {
  display: block;
  margin: 2px 0;
  color: var(--paper);
  font-size: 24px;
  line-height: 1;
}

.timer-panel > span:last-child {
  color: #8f927c;
  font-size: 9px;
}

.status-panel {
  right: max(16px, env(safe-area-inset-right));
  width: 164px;
  border-right: 2px solid var(--warning);
}

.meter-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 9px;
  color: #d8d4ad;
  font-size: 9px;
}

.meter-row + .meter-row { margin-top: 9px; }

.meter {
  height: 5px;
  background: #34352c;
}

.meter i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--warning);
  transform-origin: left;
}

.danger-meter i { background: #a33a29; }

.threat-list {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  top: 102px;
  display: grid;
  gap: 7px;
  justify-items: end;
}

.threat {
  display: grid;
  grid-template-columns: 1fr 30px;
  align-items: center;
  gap: 9px;
  padding: 5px 5px 5px 10px;
  border-right: 2px solid var(--blood);
  background: rgba(28, 6, 4, .54);
  color: #e6d7bd;
  font-size: 9px;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity .15s ease, transform .15s ease;
}

.threat.visible {
  opacity: 1;
  transform: translateX(0);
}

.threat img {
  width: 30px;
  height: 30px;
  object-fit: cover;
  filter: grayscale(.3) contrast(1.2);
}

.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(230, 226, 191, .7);
  transform: translate(-50%, -50%);
}

.message {
  position: absolute;
  top: 20%;
  left: 50%;
  width: min(560px, calc(100% - 40px));
  color: #f0eccb;
  font-size: 13px;
  text-align: center;
  text-shadow: 0 2px 8px #000;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity .2s ease;
}

.message.visible { opacity: 1; }

.noise,
.vignette,
.danger {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.noise {
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
  animation: noise-shift .18s steps(2) infinite;
}

.vignette {
  z-index: 7;
  background: radial-gradient(circle, transparent 34%, rgba(0, 0, 0, .2) 62%, rgba(0, 0, 0, .8) 100%);
}

.danger {
  opacity: 0;
  background: radial-gradient(circle, transparent 18%, rgba(105, 0, 0, .85) 100%);
  mix-blend-mode: screen;
}

@keyframes noise-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -2%); }
  75% { transform: translate(2%, 2%); }
}

.touch-controls {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}

.move-zone {
  position: absolute;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: max(22px, env(safe-area-inset-left));
  width: 118px;
  height: 118px;
  border: 1px solid rgba(216, 212, 173, .2);
  border-radius: 50%;
  background: rgba(10, 10, 7, .2);
  pointer-events: auto;
}

.move-zone i {
  position: absolute;
  top: 38px;
  left: 38px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(216, 212, 173, .3);
}

.look-zone {
  position: absolute;
  inset: 0 0 0 39%;
  pointer-events: auto;
}

.touch-button {
  position: absolute;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(216, 212, 173, .3);
  border-radius: 50%;
  background: rgba(10, 10, 7, .45);
  color: rgba(240, 236, 203, .9);
  font-size: 23px;
  pointer-events: auto;
}

.light-button { right: 22px; bottom: 102px; }
.run-button { right: 82px; bottom: 40px; }
.crouch-button { right: 20px; bottom: 40px; }

@media (max-width: 700px) {
  .start-screen {
    align-items: flex-end;
    background:
      linear-gradient(0deg, rgba(5, 5, 3, .98) 0%, rgba(8, 8, 5, .58) 70%, rgba(8, 8, 5, .28) 100%),
      radial-gradient(circle at 70% 30%, rgba(196, 178, 84, .18), transparent 25%),
      repeating-linear-gradient(90deg, transparent 0 78px, rgba(34, 33, 19, .8) 79px 85px),
      repeating-linear-gradient(0deg, #353321 0 78px, #242417 79px 84px);
  }

  .case-file { display: none; }
  .title-lockup { padding-bottom: 2vh; }
  h1 { font-size: clamp(58px, 18vw, 92px); }
  .timer-panel, .status-panel { top: max(9px, env(safe-area-inset-top)); }
  .timer-panel { left: max(9px, env(safe-area-inset-left)); }
  .status-panel { right: max(9px, env(safe-area-inset-right)); width: 124px; }
  .timer-panel strong { font-size: 20px; }
  .threat-list { top: 90px; right: max(9px, env(safe-area-inset-right)); }
}
