@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap");
:root {
  color-scheme: dark;
  font-family: "DM Sans", sans-serif;
  color: #f8f3df;
  background: #101e26;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
}
canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
  border: 0;
}
header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 25px 32px;
  background: linear-gradient(#101e26d9, transparent);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  font:
    700 18px "Outfit",
    sans-serif;
  letter-spacing: 1.5px;
}
.star {
  font-size: 42px;
  color: #e9b969;
}
.brand small {
  display: block;
  font:
    10px "DM Sans",
    sans-serif;
  letter-spacing: 2px;
  margin-top: 6px;
  color: #8ba0a5;
}
.stats {
  display: flex;
  gap: 35px;
  margin: auto;
}
.stats small {
  display: block;
  font-size: 10px;
  letter-spacing: 1.8px;
  color: #a9b9b8;
}
.stats strong {
  display: block;
  font:
    600 25px "Outfit",
    sans-serif;
  margin-top: 5px;
}
.icon {
  background: #20353b99;
  border: 1px solid #49605e66;
  padding: 10px 13px;
  border-radius: 8px;
  font-size: 12px;
}
aside {
  position: absolute;
  left: 36px;
  top: 20%;
  width: 260px;
  pointer-events: none;
}
aside button {
  pointer-events: auto;
}
.tag {
  color: #e6b66c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
}
h1 {
  font:
    700 clamp(34px, 4vw, 57px)/1.05 "Outfit",
    sans-serif;
  letter-spacing: -2px;
  margin: 20px 0;
}
aside p {
  font-size: 13px;
  line-height: 1.8;
  color: #b6c5c4;
}
.phase {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e6c68c;
  margin-top: 28px;
  font-size: 13px;
}
.phase i {
  width: 7px;
  height: 7px;
  background: #eac17f;
  border-radius: 50%;
  box-shadow: 0 0 15px #eac17f;
}
.tip {
  font-size: 12px !important;
  color: #879e9f !important;
}
#start,
#again {
  background: #e8b56d;
  color: #17252b;
  border-radius: 6px;
  padding: 13px 24px;
  font-weight: 700;
  margin-top: 10px;
  box-shadow: 0 4px 0 #9b703d;
}
#start:disabled {
  opacity: 0.65;
  cursor: default;
}
.legend {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #93acab;
  font-size: 9px;
  letter-spacing: 1.3px;
}
.dot {
  background: #77d1bf;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.red {
  background: #ea826c;
  margin-left: 12px;
}
.toolbox {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  width: min(900px, calc(100% - 64px));
  background: #15292eea;
  backdrop-filter: blur(16px);
  border: 1px solid #68837955;
  padding: 17px;
  border-radius: 12px;
  box-shadow: 0 12px 45px #07101580;
}
.toolbox-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 4px 12px;
  font-size: 10px;
  letter-spacing: 1.8px;
  color: #bcd0c8;
}
.toolbox-title small {
  font-size: 11px;
  color: #809b99;
  letter-spacing: 0;
}
.traps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}
.trap {
  display: flex;
  gap: 9px;
  align-items: center;
  background: #253c3f;
  padding: 14px 10px;
  border: 1px solid #536a6044;
  border-radius: 7px;
  text-align: left;
}
.trap.selected {
  border-color: #eabd79;
  background: #455046;
  box-shadow: inset 0 0 0 1px #eabd7944;
}
.emoji {
  font-size: 28px;
}
.trap b {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.trap small {
  display: block;
  color: #a0b3ad;
  font-size: 10px;
  margin-top: 5px;
}
.trap strong {
  font-size: 12px;
  margin-left: auto;
  color: #f2c785;
}
kbd {
  font: 9px monospace;
  color: #abc0b7;
  margin-right: 4px;
}
footer {
  position: absolute;
  bottom: 18px;
  left: 33px;
  right: 33px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 2px;
  color: #7c9699;
}
footer button {
  background: none;
  color: #abc0ba;
  font-size: 12px;
  letter-spacing: 0;
}
#toast {
  position: absolute;
  bottom: 205px;
  left: 58%;
  transform: translateX(-50%);
  background: #12282de8;
  border: 1px solid #61797170;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 12px;
  transition: opacity 0.3s;
  pointer-events: none;
}
#modal {
  position: absolute;
  inset: 0;
  background: #0b1927b9;
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
}
#modal[hidden] {
  display: none;
}
#modal > div {
  text-align: center;
  background: #1d363b;
  border: 1px solid #68847d;
  border-radius: 18px;
  padding: 48px;
  max-width: 480px;
}
h2 {
  font:
    700 42px "Outfit",
    sans-serif;
}
#modal p {
  line-height: 1.7;
  color: #bbcec7;
}
@media (max-width: 850px) {
  header {
    padding: 16px;
    gap: 8px;
  }
  .brand {
    font-size: 12px;
  }
  .brand small {
    font-size: 8px;
  }
  .star {
    font-size: 26px;
  }
  .stats {
    gap: 15px;
  }
  .stats small {
    font-size: 8px;
  }
  .stats strong {
    font-size: 18px;
  }
  .icon {
    padding: 8px;
    font-size: 10px;
  }
  aside {
    left: 20px;
    top: 105px;
    width: 180px;
  }
  h1 {
    font-size: 32px;
  }
  aside p {
    font-size: 11px;
  }
  .toolbox {
    width: calc(100% - 24px);
    padding: 10px;
  }
  .traps {
    gap: 5px;
  }
  .trap {
    padding: 10px 5px;
    gap: 3px;
  }
  .emoji {
    font-size: 20px;
  }
  .trap b {
    font-size: 10px;
  }
  .trap small,
  kbd {
    display: none;
  }
  .toolbox-title small {
    font-size: 9px;
  }
  footer {
    left: 16px;
    right: 16px;
  }
  footer > span:first-child {
    display: none;
  }
}
@media (max-width: 560px) {
  .brand small,
  #sound {
    display: none;
  }
  .brand {
    max-width: 115px;
  }
  .stats {
    gap: 10px;
  }
  aside {
    top: 95px;
  }
  aside .tip,
  .legend {
    display: none;
  }
  h1 {
    font-size: 25px;
    margin: 10px 0;
  }
  aside p {
    font-size: 10px;
  }
  .phase {
    margin-top: 10px;
  }
  #start {
    padding: 9px 15px;
    font-size: 12px;
  }
  .traps {
    grid-template-columns: repeat(2, 1fr);
  }
  .trap small {
    display: block;
  }
  .toolbox-title small {
    display: none;
  }
  .toolbox {
    bottom: 45px;
  }
  #toast {
    bottom: 228px;
    left: 50%;
    white-space: nowrap;
  }
  .trap b {
    font-size: 12px;
  }
  footer {
    bottom: 13px;
    font-size: 8px;
  }
}

/* First-person HUD */
.first-person aside {
  top: 105px;
  left: 25px;
  width: 255px;
  padding: 18px;
  background: #10252bbd;
  border: 1px solid #68837933;
  border-radius: 10px;
}
.first-person h1 {
  font-size: 28px;
  letter-spacing: -0.7px;
  margin: 10px 0;
}
.first-person aside p {
  font-size: 12px;
  margin: 9px 0;
}
.first-person .phase {
  margin-top: 15px;
}
.first-person .legend {
  display: none;
}
.first-person .toolbox {
  bottom: 48px;
  padding: 12px;
}
.first-person .trap {
  padding: 10px;
}
.first-person #toast {
  bottom: 190px;
  left: 50%;
}
.first-person #game {
  touch-action: none;
  cursor: grab;
}
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border: 1px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff88;
  pointer-events: none;
  box-shadow: 0 1px 5px #000;
}
#crosshair.ready {
  border-color: #f8c67e;
  background: #f8c67e;
  box-shadow: 0 0 14px #f8c67e;
}
#interact {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translateX(-50%);
  background: #10252bd9;
  padding: 9px 15px;
  border-radius: 6px;
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
}
#look {
  position: absolute;
  right: 25px;
  top: 110px;
  padding: 11px 16px;
  background: #183137db;
  border: 1px solid #728d7b66;
  border-radius: 6px;
  font-size: 12px;
}
#touch {
  display: none;
}
button:focus-visible {
  outline: 2px solid #f6cb81;
  outline-offset: 3px;
}
@media (pointer: coarse) {
  #touch {
    display: block;
    position: absolute;
    bottom: 225px;
    left: 20px;
    text-align: center;
  }
  #touch button {
    background: #24434ac9;
    border: 1px solid #83988b66;
    padding: 13px 18px;
    border-radius: 7px;
    touch-action: none;
  }
  #touch #place {
    display: block;
    margin-top: 8px;
    width: 100%;
  }
  #look {
    display: none;
  }
}
@media (max-width: 650px) {
  .first-person aside {
    top: 80px;
    left: 12px;
    width: 180px;
    padding: 10px;
  }
  .first-person h1 {
    font-size: 20px;
  }
  .first-person #objective {
    display: none;
  }
  .first-person aside .tag {
    font-size: 8px;
  }
  .first-person .phase {
    font-size: 10px;
    margin-top: 5px;
  }
  #interact {
    font-size: 10px;
    max-width: 95%;
    white-space: normal;
    text-align: center;
  }
  .first-person #toast {
    bottom: 215px;
  }
  .first-person .toolbox {
    bottom: 42px;
  }
}
