@font-face {
  font-family: Summer;
  src: url('./fonts/Stylish-Regular.ttf') format('truetype');
  font-display: swap;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  font-family: Summer, 'Malgun Gothic', sans-serif;
  color: #526159;
  background: #c4decb;
}
button {
  font: inherit;
  cursor: pointer;
}
button:focus-visible {
  outline: 3px solid #4f867a;
  outline-offset: 5px;
}
[hidden] {
  display: none !important;
}
#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
header {
  position: absolute;
  left: 36px;
  right: 36px;
  top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}
.brand {
  color: #fff7e3;
  text-shadow: 0 2px 0 #5b756a66;
}
.brand span {
  font-size: 15px;
  letter-spacing: 0.18em;
}
.brand h1 {
  font-size: 42px;
  line-height: 1;
  margin: 7px 0;
}
.paper {
  background: #fff7e5ed;
  box-shadow: 4px 5px 0 #6a736a44;
  border-radius: 4px;
}
.status {
  padding: 11px 19px;
  min-width: 170px;
  transform: rotate(1deg);
}
.status span {
  display: block;
  color: #77887b;
  font-size: 16px;
}
.status b {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  font-weight: 400;
}
.join {
  position: absolute;
  left: 36px;
  bottom: 116px;
  display: flex;
  gap: 18px;
  padding: 18px;
  align-items: center;
  transform: rotate(-0.6deg);
  transition: opacity 0.3s;
}
.qr-frame {
  width: 136px;
  height: 136px;
  background: white;
  display: grid;
  place-items: center;
  border-radius: 3px;
  flex: none;
}
.qr-frame img {
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
}
.qr-frame span {
  font-size: 18px;
  color: #879588;
}
.eyebrow {
  font-size: 13px;
  letter-spacing: 0.13em;
  color: #7a9183;
}
.join h2 {
  font-size: 29px;
  font-weight: 400;
  margin: 8px 0;
}
.join p {
  font-family: 'Malgun Gothic', sans-serif;
  font-size: 12px;
  max-width: 170px;
  line-height: 1.65;
  margin: 0 0 7px;
}
.join b {
  letter-spacing: 0.12em;
  font-size: 23px;
  font-weight: 400;
}
.race-stats {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 30px;
  padding: 12px 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}
.race-stats div > span {
  display: block;
  font-size: 16px;
  color: #7c8c80;
}
.race-stats b {
  font-size: 32px;
  font-weight: 400;
  white-space: nowrap;
}
em {
  font-style: normal;
}
small {
  font-size: 16px;
  margin-left: 5px;
}
footer {
  position: absolute;
  left: 36px;
  right: 36px;
  bottom: 28px;
  display: flex;
  align-items: flex-end;
  gap: 24px;
  justify-content: space-between;
}
.instructions {
  padding: 14px 20px;
  background: #fff7e5ed;
  border-radius: 4px;
  box-shadow: 3px 4px 0 #6a736a33;
}
.instructions strong {
  display: block;
  font-size: 24px;
  font-weight: 400;
}
.instructions span {
  display: block;
  font-size: 16px;
  margin-top: 4px;
  color: #7b8879;
}
#game-actions {
  display: flex;
  gap: 12px;
  flex: none;
  align-items: center;
  margin-left: auto;
}
#practice,
#audio-unlock {
  background: #fff7e5;
  color: #526159;
  border: 0;
  padding: 13px 20px;
  border-radius: 4px;
  box-shadow: 3px 4px 0 #6a736a55;
  font-size: 20px;
}
#audio-unlock {
  color: #fff7e5;
  background: #5b8376;
  white-space: nowrap;
}
#audio-status {
  position: fixed;
  z-index: 30;
  right: 36px;
  bottom: 90px;
  padding: 12px 18px;
  max-width: calc(100vw - 40px);
  background: #fff7e5;
  border-radius: 4px;
  box-shadow: 3px 4px 0 #6a736a55;
  font-size: 19px;
}
#practice span {
  margin-left: 20px;
}
.course-card {
  position: absolute;
  right: 36px;
  bottom: 112px;
  padding: 12px 14px;
  width: 143px;
  text-align: center;
  transform: rotate(1deg);
}
.course-card > span {
  font-size: 12px;
  letter-spacing: 0.07em;
}
.course-card i {
  font-style: normal;
  color: #c8956e;
}
.course-card svg {
  width: 100%;
  height: 130px;
  display: block;
}
.course-card b {
  font-size: 18px;
  font-weight: 400;
}
#map-track {
  fill: none;
  stroke: #b9c7b1;
  stroke-width: 3;
  stroke-linecap: round;
}
#map-start {
  fill: #8d9a83;
}
#map-finish {
  fill: #c78d71;
}
#map-runner {
  fill: #5c9083;
  stroke: #fff7e5;
  stroke-width: 2;
}
#map-peer {
  fill: #e68a54;
  stroke: #fff7e5;
  stroke-width: 2;
}
.player-view {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  pointer-events: none;
}
#player-1 {
  left: 0;
  border-right: 2px solid #fff7e5a0;
}
#player-2 {
  right: 0;
}
.player-summary {
  position: absolute;
  top: 112px;
  left: 24px;
  right: 24px;
  padding: 12px 18px;
  max-width: 330px;
}
.player-tag {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: #479cbe;
  margin-right: 12px;
}
#player-2 .player-tag {
  color: #d27640;
}
.player-name {
  font-size: 23px;
  font-weight: 400;
}
.player-summary div {
  font-size: 18px;
  margin: 6px 0;
}
.player-summary b {
  font-weight: 400;
}
.player-summary progress {
  width: 100%;
  height: 7px;
  accent-color: #479cbe;
}
#player-2 progress {
  accent-color: #d27640;
}
.player-message {
  position: absolute;
  bottom: 120px;
  left: 16px;
  right: 16px;
  text-align: center;
  font-size: 29px;
  font-weight: 400;
  color: #fff6df;
  text-shadow: 1px 2px 2px #456958;
}
[data-duo='true'] .race-stats,
[data-duo='true'] .course-card {
  display: none;
}
[data-duo='true'][data-mode='race'] .join,
[data-duo='true'][data-mode='countdown'] .join,
[data-duo='true'][data-mode='result'] .join {
  display: none;
}
[data-duo='true'] .instructions strong {
  font-size: 21px;
}
@media (orientation: portrait) {
  .player-view {
    width: 100%;
    height: 50%;
    bottom: auto;
  }
  #player-1 {
    border-right: 0;
    border-bottom: 2px solid #fff7e5a0;
  }
  #player-2 {
    top: 50%;
  }
  .player-summary {
    top: 18px;
    left: 14px;
    right: 14px;
    max-width: 290px;
    padding: 9px 12px;
  }
  #player-1 .player-summary {
    top: 85px;
  }
  .player-message {
    bottom: 24px;
    font-size: 24px;
  }
  #player-2 .player-message {
    bottom: 105px;
  }
  [data-duo='true'] .join {
    display: none;
  }
  [data-duo='true'] header {
    top: 12px;
  }
  [data-duo='true'] .brand h1 {
    font-size: 24px;
  }
  [data-duo='true'] .status {
    font-size: 12px;
    padding: 6px 10px;
  }
}
#countdown {
  position: absolute;
  top: 34%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 140px;
  color: #fff5d9;
  text-shadow: 4px 6px 0 #5e7b6b66;
  pointer-events: none;
}
#verdict {
  position: absolute;
  top: 24%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 44px;
  color: #fff5d9;
  text-shadow: 2px 3px 0 #58736399;
  pointer-events: none;
}
#verdict.show {
  animation: verdict 1.5s both;
}
@keyframes verdict {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.9);
  }
  15%,
  60% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}
#notice {
  position: absolute;
  top: 140px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff7e5;
  padding: 12px 20px;
  border-radius: 4px;
  font-size: 22px;
}
.result {
  position: absolute;
  width: min(460px, calc(100% - 40px));
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) rotate(-1deg);
  padding: 30px;
  text-align: center;
}
.result h2 {
  font-size: 34px;
  font-weight: 400;
  margin: 13px 0 4px;
}
.record {
  font-size: 72px;
  font-weight: 400;
}
.result-counts {
  display: flex;
  justify-content: space-around;
  font-size: 22px;
  margin: 18px 0;
  padding: 12px 0;
  border-top: 1px solid #52615922;
  border-bottom: 1px solid #52615922;
}
.result p {
  font-size: 17px;
  margin: 12px 0 0;
  color: #83907e;
}
#result-best {
  color: #b88e4c;
  font-size: 22px;
}
#loading,
#fatal {
  position: absolute;
  inset: 0;
  background: #fffaf0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
}
#loading span {
  letter-spacing: 0.2em;
  font-size: 16px;
}
#loading h1 {
  font-size: 62px;
  font-weight: 400;
  margin: 16px;
}
#loading p {
  font-size: 21px;
  color: #8c9a88;
}
#loading i {
  width: 30px;
  height: 30px;
  border: 3px solid #cbd4bf;
  border-top-color: #628c7d;
  border-radius: 100%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#loading.loaded {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s;
}
#fatal {
  z-index: 30;
}
#fatal button {
  padding: 12px 24px;
  background: #587d70;
  color: #fff7e5;
  border: 0;
  border-radius: 4px;
}
[data-mode='race'] .race-stats,
[data-mode='result'] .race-stats,
[data-mode='countdown'] .race-stats {
  opacity: 1;
}
[data-mode='race'] .brand,
[data-mode='countdown'] .brand,
[data-mode='result'] .brand {
  opacity: 0.45;
}
[data-mode='race'] .join,
[data-mode='countdown'] .join,
[data-mode='lobby'] .join {
  padding: 12px 16px;
  bottom: 116px;
}
[data-mode='race'] .qr-frame,
[data-mode='countdown'] .qr-frame,
[data-mode='lobby'] .qr-frame {
  display: none;
}
[data-mode='race'] .join h2,
[data-mode='countdown'] .join h2 {
  font-size: 23px;
}
[data-mode='race'] .join p,
[data-mode='countdown'] .join p {
  display: none;
}
#game:is([data-mode='countdown'], [data-mode='race']) :is(.join, .instructions, #practice) {
  display: none;
}
@media (max-width: 800px) {
  header {
    left: 20px;
    right: 20px;
    top: 20px;
  }
  .brand h1 {
    font-size: 32px;
  }
  .brand span {
    font-size: 12px;
  }
  .status {
    padding: 9px 12px;
    min-width: 125px;
  }
  .status b {
    font-size: 20px;
  }
  .status span {
    font-size: 14px;
  }
  .join {
    left: 20px;
    bottom: 130px;
    padding: 12px;
    gap: 12px;
  }
  .qr-frame {
    width: 104px;
    height: 104px;
  }
  .qr-frame img {
    width: 98px;
    height: 98px;
  }
  .join h2 {
    font-size: 23px;
  }
  .join p {
    font-size: 11px;
    max-width: 140px;
  }
  .eyebrow {
    font-size: 11px;
  }
  .course-card {
    right: 20px;
    bottom: 130px;
    width: 112px;
    padding: 10px;
  }
  .course-card svg {
    height: 100px;
  }
  .course-card > span {
    font-size: 9px;
  }
  footer {
    left: 20px;
    right: 20px;
    bottom: 20px;
    align-items: stretch;
    gap: 8px;
  }
  .instructions {
    padding: 12px 15px;
    flex: 1;
  }
  .instructions strong {
    font-size: 21px;
  }
  .instructions span {
    font-size: 14px;
  }
  #practice,
  #audio-unlock {
    font-size: 16px;
    padding: 10px;
  }
  #practice span {
    display: none;
  }
  #audio-status {
    right: 20px;
    bottom: 100px;
  }
  .race-stats {
    top: 105px;
    padding: 8px 18px;
    gap: 28px;
  }
  .race-stats b {
    font-size: 26px;
  }
  .race-stats div > span {
    font-size: 13px;
  }
}
@media (max-width: 560px) {
  .join {
    bottom: 170px;
    left: 18px;
    right: 18px;
    max-width: 330px;
  }
  .course-card {
    bottom: 278px;
    right: 18px;
    width: 98px;
    background: #fff7e5d9;
    pointer-events: none;
  }
  .course-card svg {
    height: 86px;
  }
  .course-card b {
    font-size: 15px;
  }
  .brand h1 {
    font-size: 29px;
  }
  .status {
    min-width: 112px;
  }
  .status b {
    font-size: 17px;
  }
  .status span {
    font-size: 12px;
  }
  footer {
    flex-wrap: wrap;
    bottom: 18px;
  }
  .instructions {
    flex-basis: 100%;
    text-align: center;
  }
  .instructions strong {
    font-size: 20px;
  }
  .instructions span {
    font-size: 13px;
  }
  #practice {
    margin-left: auto;
    font-size: 16px;
  }
  .race-stats {
    gap: 22px;
    top: 103px;
    width: max-content;
  }
  #countdown {
    font-size: 110px;
  }
  #verdict {
    top: 27%;
    font-size: 35px;
  }
  [data-mode='race'] .join,
  [data-mode='countdown'] .join,
  [data-mode='lobby'] .join {
    bottom: 158px;
    right: auto;
    max-width: 225px;
  }
  [data-mode='race'] .join-copy .eyebrow {
    display: none;
  }
  .result {
    top: 42%;
    padding: 24px;
  }
  .result h2 {
    font-size: 29px;
  }
}
