@font-face {
  font-family: Manrope;
  src: url("assets/scene/manrope-cyrillic.woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0400-052F, U+2116;
}
@font-face {
  font-family: Manrope;
  src: url("assets/scene/manrope-latin.woff2");
  font-weight: 200 800;
  font-display: swap;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: #19394b;
  background: #adcddc;
  font:
    600 15px/1.4 Manrope,
    sans-serif;
}
button,
input {
  font: inherit;
}
button {
  border: 0;
  border-radius: 14px;
  background: #20786e;
  color: white;
  padding: 13px 20px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 12px #19394b2b;
}
button:disabled {
  opacity: 0.5;
}
button:focus-visible,
input:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid #ffb53e;
  outline-offset: 3px;
}
input {
  border: 1px solid #9bbcc8;
  background: #fffefa;
  color: #19394b;
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
}
::selection {
  background: #ffcf72;
  color: #19394b;
}
.game {
  height: 100dvh;
  min-height: 600px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.world {
  position: absolute;
  inset: 0;
  background: url("assets/scene/world.webp") center 52% / cover;
  z-index: -1;
}
.hud {
  position: absolute;
  left: 32px;
  right: 32px;
  top: 24px;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  pointer-events: none;
}
.mission,
.clock {
  background: #fffcf1f5;
  border-radius: 18px;
  box-shadow: 0 8px 24px #26315122;
}
.mission {
  padding: 16px 24px;
  max-width: 440px;
}
.brand {
  font-size: 11px;
  font-weight: 800;
  color: #397d7a;
}
h1 {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin: 3px 0;
}
#task {
  font-size: 14px;
  margin: 0;
  color: #426271;
}
.clock {
  text-align: center;
  padding: 14px 22px;
  min-width: 130px;
}
#timer {
  font-size: 30px;
  line-height: 1.1;
  display: block;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.clock small {
  display: block;
  color: #54717a;
  margin-top: 7px;
  font-size: 11px;
}
.chatbar {
  position: absolute;
  z-index: 5;
  right: 32px;
  top: 142px;
  width: 270px;
}
#messages {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: end;
}
#messages > span {
  background: #fffcf1ee;
  border-radius: 14px 14px 3px 14px;
  padding: 9px 13px;
  box-shadow: 0 4px 14px #26315117;
  font-size: 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
#messages strong {
  color: #246f65;
  margin-right: 7px;
}
#chat {
  display: flex;
  margin-top: 10px;
  gap: 5px;
}
#chat[hidden] {
  display: none;
}
#chat input {
  width: 100%;
  padding: 9px;
  font-size: 12px;
  background: #fffffff0;
}
#chat button {
  font-size: 10px;
  padding: 9px;
  border-radius: 10px;
}
.stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.tree {
  position: absolute;
  height: 57%;
  width: 38%;
  left: 31%;
  bottom: 27%;
  filter: drop-shadow(0 14px 12px #22474d30);
}
.tree > img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  transition:
    opacity 0.8s,
    clip-path 1.1s;
  transform-origin: center bottom;
}
#fir {
  opacity: 0;
  clip-path: inset(100% 0 0 0);
}
#players {
  position: absolute;
  left: 19%;
  right: 19%;
  bottom: 19%;
  height: 22%;
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 4px;
}
.player {
  position: relative;
  flex: 0 1 112px;
  max-width: 120px;
  min-width: 36px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.avatar {
  width: 110%;
  height: min(16vh, 150px);
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 7px 5px #27535d30);
  transform-origin: 50% 90%;
}
.player:nth-child(even) .avatar {
  transform: scaleX(-1);
}
.player:nth-child(3n) {
  margin-bottom: 20px;
}
.player > span {
  font-size: 12px;
  padding: 3px 10px;
  background: #fcfff9f5;
  border-radius: 9px;
  max-width: 120px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  box-shadow: 0 3px 8px #22474d18;
}
.player.mine > span {
  background: #ffcf74;
  color: #523c18;
}
.player small {
  font-size: 10px;
  margin-top: 2px;
  color: #184651;
  background: #e8f5f2e8;
  border-radius: 8px;
  padding: 1px 7px;
}
.player.working .avatar {
  animation: work 0.28s ease-out;
}
.console {
  position: absolute;
  z-index: 6;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  width: 420px;
  text-align: center;
}
#score {
  font-size: 13px;
  margin-bottom: 7px;
  text-shadow: 0 1px 6px white;
}
#controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
#controls form {
  width: 100%;
  background: #fffcf1f2;
  border-radius: 18px;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  box-shadow: 0 8px 24px #26315126;
}
#controls label {
  grid-column: 1/-1;
  text-align: left;
  font-size: 14px;
}
#controls input {
  min-width: 0;
}
#controls > input {
  width: 100%;
}
.tap {
  background: linear-gradient(#ffca65, #f7ac31);
  color: #4b341a;
  min-height: 72px;
  width: 100%;
  font-size: 26px;
  letter-spacing: -0.02em;
  border-radius: 22px;
  box-shadow:
    0 6px 0 #c07c24,
    0 12px 22px #76562d30;
  touch-action: manipulation;
  user-select: none;
}
.tap:active {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 #c07c24,
    0 5px 10px #76562d22;
}
.secondary {
  background: #fff9edeb;
  color: #264f5b;
  font-size: 11px;
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: 0 3px 10px #26315117;
}
#notice {
  font-size: 10px;
  margin: 9px 0 0;
  color: #234e5b;
  background: #f3f9f0eb;
  display: inline-block;
  border-radius: 8px;
  padding: 3px 8px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.settings {
  position: absolute;
  bottom: 22px;
  left: 25px;
  z-index: 8;
  font-size: 11px;
  color: #244954;
  background: #fff9edee;
  border-radius: 10px;
  padding: 7px 10px;
}
.settings a {
  display: block;
  color: #244954;
  margin: 8px 0;
}
.settings summary {
  cursor: pointer;
}
#quip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 43%;
  border-radius: 15px 15px 15px 2px;
  padding: 8px 16px;
  background: #fff9e9f2;
  color: #395869;
  font-size: 12px;
  box-shadow: 0 4px 14px #26315117;
  max-width: 280px;
  text-align: center;
}
#quip:empty {
  display: none;
}
#spark {
  position: absolute;
  left: 50%;
  top: 65%;
  font-size: 42px;
  color: #fff1aa;
  font-weight: 800;
  text-shadow: 0 3px 5px #c2751c;
  opacity: 0;
}
#spark.pop {
  animation: points 0.6s ease-out;
}
.qr {
  width: 84px;
  border-radius: 12px;
  background: white;
  padding: 5px;
}
.view-screen .console {
  left: 30px;
  bottom: 26px;
  transform: none;
  width: 190px;
  text-align: left;
}
.view-screen #controls {
  justify-content: start;
}
.view-screen #controls > span {
  display: block;
  width: 100%;
  font-size: 12px;
}
.view-screen .tree {
  height: 65%;
  bottom: 19%;
}
.view-screen #players {
  bottom: 11%;
}
.view-screen #quip {
  bottom: 37%;
}
.view-screen .settings {
  display: none;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
}
@keyframes work {
  0% {
    rotate: 0deg;
    translate: 0 0;
  }
  40% {
    rotate: -9deg;
    translate: 0 -9px;
  }
  100% {
    rotate: 0deg;
    translate: 0 0;
  }
}
@keyframes points {
  0% {
    opacity: 1;
    transform: translateY(0) scale(0.7);
  }
  40% {
    opacity: 1;
    transform: translateY(-25px) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px);
  }
}
@media (max-width: 700px) {
  .game {
    min-height: 590px;
  }
  .hud {
    left: 14px;
    right: 14px;
    top: max(12px, env(safe-area-inset-top));
    gap: 8px;
  }
  .mission {
    padding: 11px 13px;
    max-width: calc(100% - 98px);
    border-radius: 14px;
  }
  .brand {
    font-size: 8px;
  }
  h1 {
    font-size: 19px;
    line-height: 1.15;
    margin: 4px 0;
  }
  #task {
    font-size: 10px;
  }
  .clock {
    padding: 12px 8px;
    min-width: 88px;
    border-radius: 14px;
  }
  #timer {
    font-size: 23px;
  }
  .clock small {
    font-size: 8px;
    margin-top: 5px;
  }
  .chatbar {
    left: 14px;
    right: 14px;
    top: 119px;
    width: auto;
  }
  #messages {
    align-items: start;
    gap: 4px;
  }
  #messages > span {
    font-size: 10px;
    padding: 5px 9px;
    max-width: 85%;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }
  #messages > span:nth-last-child(n + 3) {
    display: none;
  }
  #chat {
    max-width: 270px;
    margin-top: 5px;
  }
  #chat input {
    font-size: 11px;
    padding: 7px;
  }
  #chat button {
    font-size: 9px;
    padding: 7px;
  }
  .tree {
    height: 39%;
    width: 70%;
    left: 15%;
    bottom: 32%;
  }
  #players {
    left: 8%;
    right: 8%;
    bottom: 25%;
    height: 15%;
    gap: 0;
  }
  .avatar {
    height: 100px;
  }
  .player {
    flex-basis: 77px;
    max-width: 87px;
  }
  .player > span {
    font-size: 10px;
    padding: 2px 7px;
    max-width: 82px;
  }
  .player small {
    font-size: 8px;
  }
  .player:nth-child(3n) {
    margin-bottom: 12px;
  }
  .console {
    bottom: max(16px, env(safe-area-inset-bottom));
    width: calc(100% - 38px);
    max-width: 420px;
  }
  #controls {
    gap: 7px;
  }
  #score {
    font-size: 11px;
    margin-bottom: 7px;
  }
  .tap {
    min-height: 64px;
    font-size: 23px;
    border-radius: 18px;
  }
  .secondary {
    font-size: 10px;
    padding: 7px 10px;
  }
  #notice {
    font-size: 8px;
    margin-top: 7px;
  }
  #controls form {
    padding: 12px;
    grid-template-columns: 1fr;
    gap: 7px;
  }
  #controls label {
    font-size: 12px;
  }
  #controls input {
    padding: 10px;
  }
  #controls form button {
    padding: 11px;
    font-size: 13px;
  }
  .settings {
    left: auto;
    right: 14px;
    bottom: 225px;
    font-size: 9px;
    padding: 5px 8px;
  }
  #quip {
    bottom: 45%;
    font-size: 10px;
    max-width: 180px;
    padding: 6px 10px;
  }
  .view-screen .console {
    left: 14px;
    width: 130px;
    bottom: 12px;
  }
  .view-screen .tree {
    height: 46%;
    bottom: 26%;
  }
  .view-screen #players {
    bottom: 17%;
  }
  .view-screen #quip {
    bottom: 39%;
  }
}
@media (max-height: 720px) and (max-width: 700px) {
  .tree {
    height: 34%;
    bottom: 35%;
  }
  #players {
    bottom: 29%;
  }
  .avatar {
    height: 76px;
  }
  .chatbar {
    top: 106px;
  }
  #quip {
    bottom: 45%;
  }
  .tap {
    min-height: 57px;
  }
  .secondary {
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
  #spark.pop {
    opacity: 1;
  }
}
#players.crowded {
  flex-wrap: wrap;
  align-content: end;
  overflow: auto;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: #3f7f80 transparent;
}
#players.crowded .player {
  flex-basis: 58px;
  max-width: 65px;
  min-width: 40px;
  margin-bottom: 0;
}
#players.crowded .avatar {
  height: 65px;
}
#players.crowded .player > span {
  font-size: 9px;
  max-width: 62px;
}
#players.crowded .player small {
  font-size: 8px;
}
@media (max-width: 700px) {
  #players.crowded {
    height: 21%;
    bottom: 25%;
  }
  #players.crowded .avatar {
    height: 42px;
  }
  #players.crowded .player {
    flex-basis: 47px;
    min-width: 36px;
  }
  #players.crowded .player > span {
    font-size: 8px;
    max-width: 47px;
  }
}
.view-screen .console{width:228px;padding:16px;background:#fffcf1f5;border-radius:20px;box-shadow:0 8px 24px #26315126}.view-screen .qr{width:176px;height:176px;display:block}.view-screen #score{font-size:17px;font-weight:800;text-shadow:none}.view-screen #controls>span{font-size:15px;margin-top:6px;font-weight:800}.view-screen #notice{font-size:10px}@media(max-width:700px){.view-screen .console{width:148px;padding:10px}.view-screen .qr{width:120px;height:120px}.view-screen #score{font-size:13px}.view-screen #controls>span{font-size:11px}}
@media(max-width:700px){.clock{min-width:98px}#timer{font-size:20px}}
