:root {
  --glass: rgba(5, 8, 13, 0.68);
  --line: rgba(255, 255, 255, 0.12);
  --blue: #76b6ff;
  --amber: #f2b84b;
  --red: #ff626d;
  --green: #69e3a3;
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #030508;
  color: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

#game {
  position: fixed;
  inset: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#grade {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background:
    radial-gradient(circle at 50% 42%, transparent 30%, rgba(0, 0, 0, 0.12) 62%, rgba(0, 0, 0, 0.62) 100%),
    linear-gradient(180deg, rgba(4, 15, 27, 0.08), rgba(3, 5, 8, 0.1));
}

#rainGlass {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.16;
  background-image: linear-gradient(115deg, transparent 0 48%, rgba(255, 255, 255, 0.15) 49%, transparent 50%);
  background-size: 24px 70px;
  animation: rainUI 0.65s linear infinite;
}

@keyframes rainUI {
  to {
    background-position: -16px 70px;
  }
}

#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  text-shadow: 0 2px 5px #000;
}

#top {
  position: absolute;
  left: 12px;
  right: 12px;
  top: max(12px, env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.panel {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 7px 10px;
  min-width: 82px;
}

.label {
  font-size: 7px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: #8f9bae;
  text-align: center;
}

.value {
  font-size: 15px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.3px;
}

.bar {
  width: 92px;
  height: 6px;
  border-radius: 8px;
  background: #1b2431;
  overflow: hidden;
  margin-top: 5px;
}

.fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #3a83f4, #9ad5ff);
}

#detectFill {
  width: 0;
  background: linear-gradient(90deg, #efb24f, #ef4454);
}

#objective {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.25px;
  background: rgba(3, 5, 9, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 7px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

#objective b {
  color: var(--amber);
}

#rescuePrompt {
  display: none;
  position: absolute;
  left: 50%;
  top: 43%;
  transform: translate(-50%, -50%);
  background: rgba(236, 177, 65, 0.94);
  color: #171005;
  font-weight: 950;
  border-radius: 10px;
  padding: 10px 15px;
  font-size: 11px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

#feed {
  position: absolute;
  left: 12px;
  bottom: 91px;
  width: 240px;
  font: 10px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.feed-line {
  margin-top: 4px;
  padding: 4px 7px;
  border-left: 2px solid #5f86b9;
  background: rgba(0, 0, 0, 0.38);
  border-radius: 0 5px 5px 0;
}

.feed-line.bad {
  border-color: var(--red);
  color: #ffc1c6;
}

.feed-line.good {
  border-color: var(--green);
  color: #c7ffe0;
}

.feed-line.warn {
  border-color: var(--amber);
  color: #ffe3a4;
}

#chaseVignette {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  box-shadow: inset 0 0 110px 25px rgba(170, 5, 20, 0.42);
}

#bottom {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: auto;
}

#actions {
  display: flex;
  gap: 7px;
}

.btn {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(4, 7, 12, 0.76);
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
}

.btn small {
  display: block;
  font-size: 6px;
  letter-spacing: 0.65px;
  color: #b1bdcf;
  margin-top: 1px;
}

.btn.active {
  outline: 2px solid rgba(109, 177, 255, 0.75);
  filter: brightness(1.35);
}

#pauseBtn {
  width: 43px;
  height: 43px;
  border-radius: 14px;
}

#joyZone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48%;
  height: 58%;
  pointer-events: auto;
}

#lookZone {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 52%;
  height: 64%;
  pointer-events: auto;
}

#joyBase {
  display: none;
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.035);
  pointer-events: none;
}

#joyNub {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  left: 29px;
  top: 29px;
  background: rgba(99, 169, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 28px rgba(95, 165, 255, 0.2);
}

#overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 36%, rgba(24, 37, 56, 0.77), rgba(4, 7, 12, 0.96) 58%, #020305 100%);
  padding: 24px;
}

.card {
  max-width: 560px;
  text-align: center;
}

.eyebrow {
  font-size: 9px;
  letter-spacing: 3.4px;
  text-transform: uppercase;
  color: #78869b;
}

.card h1 {
  font-size: clamp(31px, 8vw, 48px);
  line-height: 0.95;
  letter-spacing: 2.8px;
  margin: 9px 0 13px;
}

.card p {
  font-size: 13px;
  line-height: 1.55;
  color: #b4becd;
}

.tips {
  font-size: 9px !important;
  color: #748198 !important;
}

.primary {
  margin-top: 13px;
  padding: 14px 30px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #4a96ff, #2e70d3);
  box-shadow: 0 12px 30px rgba(40, 104, 210, 0.24);
  color: #fff;
  font-weight: 950;
  letter-spacing: 0.8px;
}

.stats {
  display: none;
  justify-content: center;
  gap: 30px;
  margin: 16px 0;
}

.stats strong {
  display: block;
  font-size: 21px;
}

.stats span {
  font-size: 8px;
  color: #76849a;
  text-transform: uppercase;
}

#loadStatus {
  font-size: 10px;
  color: #8f9caf;
  margin-top: 12px;
}

.progress {
  height: 3px;
  width: 180px;
  background: #19202a;
  margin: 8px auto;
  border-radius: 4px;
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  width: 8%;
  background: #5fa8ff;
  transition: width 0.25s;
}

#letterTop,
#letterBottom {
  position: fixed;
  left: 0;
  right: 0;
  height: 0;
  background: #000;
  z-index: 20;
  pointer-events: none;
  transition: height 0.6s ease;
}

#letterTop {
  top: 0;
}

#letterBottom {
  bottom: 0;
}

.cinematic #letterTop,
.cinematic #letterBottom {
  height: 8vh;
}

@media (min-width: 900px) {
  #joyZone,
  #lookZone {
    display: none;
  }

  .btn {
    width: 55px;
    height: 55px;
  }
}

@media (max-width: 420px) {
  .panel {
    min-width: 0;
    padding: 6px 7px;
    flex: 1;
  }

  .bar {
    width: 100%;
  }

  #objective {
    max-width: calc(100% - 24px);
    white-space: normal;
    font-size: 8px;
    line-height: 1.4;
    text-align: center;
    padding: 6px 10px;
  }

  #feed {
    width: min(220px, 58vw);
  }
}
