:root {
  color-scheme: light;
  font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #8eae8c;
}

* {
  box-sizing: border-box;
}

html,
body,
.app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app {
  position: relative;
  isolation: isolate;
  min-height: 560px;
  color: #26372f;
  touch-action: none;
  user-select: none;
}

#world {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #9ec49b;
  touch-action: none;
}

.glass {
  border: 1px solid rgb(255 255 255 / 66%);
  background:
    linear-gradient(135deg, rgb(255 255 255 / 72%), rgb(250 245 231 / 55%)),
    rgb(244 240 226 / 72%);
  box-shadow:
    0 16px 40px rgb(48 73 56 / 16%),
    inset 0 1px 0 #fff;
  backdrop-filter: blur(15px) saturate(1.08);
  -webkit-backdrop-filter: blur(15px) saturate(1.08);
}

.topbar {
  position: absolute;
  z-index: 10;
  top: max(14px, env(safe-area-inset-top));
  left: 16px;
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 285px;
  height: 58px;
  padding: 7px 13px 7px 8px;
  border-radius: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__mark {
  display: grid;
  width: 41px;
  height: 41px;
  place-items: center;
  border: 1px solid #ba8e61;
  border-radius: 13px 13px 5px;
  color: #fff9e9;
  background: linear-gradient(145deg, #e89591, #c97677);
  box-shadow: inset 0 0 0 3px rgb(255 255 255 / 18%);
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 900;
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
}

.brand small,
.wardrobe__heading small {
  color: #8a7662;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.brand strong {
  margin-top: 2px;
  font-family: "Noto Serif SC", Georgia, serif;
  font-size: 15px;
  letter-spacing: 0.06em;
}

.state {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 14px;
  border-left: 1px solid rgb(83 105 87 / 17%);
  color: #607267;
  font-size: 10px;
  font-weight: 700;
}

.state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d7a45e;
  box-shadow: 0 0 0 4px rgb(215 164 94 / 13%);
}

.state.is-ready i {
  background: #4eb58c;
  box-shadow: 0 0 0 4px rgb(78 181 140 / 13%);
}

.wardrobe {
  position: absolute;
  z-index: 10;
  top: 88px;
  left: 16px;
  width: 222px;
  padding: 12px;
  border-radius: 19px;
}

.wardrobe__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 2px 9px;
}

.wardrobe__heading > span {
  font-family: "Noto Serif SC", Georgia, serif;
  font-size: 14px;
  font-weight: 800;
}

.wardrobe__heading small {
  letter-spacing: 0;
}

.outfit {
  display: grid;
  width: 100%;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: #4e5f55;
  background: rgb(255 255 255 / 43%);
  text-align: left;
  transition: 160ms ease;
}

.outfit:hover {
  background: rgb(255 255 255 / 72%);
  transform: translateY(-1px);
}

.outfit.is-active {
  border-color: rgb(191 117 121 / 34%);
  background: #fffaf1;
  box-shadow: 0 7px 18px rgb(108 80 71 / 10%);
}

.outfit__swatch {
  width: 38px;
  height: 38px;
  border: 2px solid #fff;
  border-radius: 12px;
  box-shadow: 0 3px 9px rgb(60 72 65 / 15%);
}

.outfit__swatch--rose {
  background: linear-gradient(145deg, #fff5ed 20%, #f4a9a5 21% 65%, #fff 66%);
}

.outfit__swatch--mint {
  background: linear-gradient(145deg, #d7eadb 0 52%, #2d365c 53% 82%, #8d6348 83%);
}

.outfit > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.outfit b {
  font-size: 11px;
}

.outfit small {
  margin-top: 2px;
  color: #879087;
  font-size: 8px;
}

.rig-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 10px;
  color: #728078;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.rig-toggle input {
  accent-color: #c9787e;
}

.direction {
  position: absolute;
  z-index: 10;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 47px;
  padding: 5px 6px 5px 12px;
  border-radius: 15px;
}

.direction > span {
  color: #6f7a73;
  font-size: 9px;
  font-weight: 800;
}

.direction > div {
  display: flex;
  gap: 3px;
}

.direction button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: #516057;
  background: rgb(255 255 255 / 55%);
  font-size: 15px;
  font-weight: 900;
}

.direction button:hover,
.direction button.is-active {
  color: #fff;
  background: #c7797f;
}

.hint {
  position: absolute;
  z-index: 9;
  right: 16px;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  color: #64746a;
  font-size: 9px;
  font-weight: 700;
}

.hint i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #c67e7d;
}

.hint__mobile {
  display: none;
}

.joystick {
  position: absolute;
  z-index: 12;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 24px;
  display: none;
  width: 108px;
  height: 108px;
  place-items: center;
  touch-action: none;
}

.joystick__ring {
  position: relative;
  width: 90px;
  height: 90px;
  border: 1px solid rgb(255 255 255 / 58%);
  border-radius: 50%;
  background: rgb(247 240 222 / 55%);
  box-shadow:
    0 12px 30px rgb(35 57 41 / 14%),
    inset 0 0 0 8px rgb(255 255 255 / 16%);
  backdrop-filter: blur(8px);
}

.joystick__ring i {
  position: absolute;
  top: 25px;
  left: 25px;
  width: 40px;
  height: 40px;
  border: 2px solid rgb(255 255 255 / 64%);
  border-radius: 50%;
  background: linear-gradient(145deg, #dc9a9b, #bf727a);
  box-shadow: 0 6px 14px rgb(88 51 55 / 22%);
}

.loading {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: #56675d;
  background: linear-gradient(145deg, #b9d4ad, #e4d8b8);
  transition: opacity 280ms ease;
}

.loading.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.loading__sprite {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 3px solid #fff9ea;
  border-radius: 18px 18px 7px;
  color: #fff;
  background: #cf8386;
  box-shadow: 0 12px 30px rgb(62 83 62 / 18%);
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: 900;
  animation: breathe 1.2s ease-in-out infinite alternate;
}

.loading strong {
  font-family: "Noto Serif SC", Georgia, serif;
  font-size: 13px;
  letter-spacing: 0.08em;
}

@keyframes breathe {
  to {
    transform: translateY(-4px) scale(1.03);
  }
}

@media (pointer: coarse), (max-width: 740px) {
  .topbar {
    top: max(10px, env(safe-area-inset-top));
    left: 10px;
    min-width: 0;
    height: 52px;
    padding: 6px 10px 6px 6px;
  }

  .brand__mark {
    width: 38px;
    height: 38px;
  }

  .brand small,
  .state {
    display: none;
  }

  .brand strong {
    font-size: 13px;
  }

  .direction {
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    height: 42px;
    padding: 4px;
  }

  .direction > span {
    display: none;
  }

  .direction button {
    width: 32px;
    height: 32px;
  }

  .wardrobe {
    top: auto;
    right: 10px;
    bottom: calc(63px + env(safe-area-inset-bottom));
    left: auto;
    width: 176px;
    padding: 9px;
    border-radius: 16px;
  }

  .wardrobe__heading {
    margin-bottom: 5px;
  }

  .wardrobe__heading small,
  .rig-toggle {
    display: none;
  }

  .outfit {
    grid-template-columns: 31px 1fr;
    gap: 7px;
    padding: 5px;
  }

  .outfit__swatch {
    width: 31px;
    height: 31px;
    border-radius: 9px;
  }

  .joystick {
    display: grid;
  }

  .hint {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    justify-content: center;
  }

  .hint__desktop {
    display: none;
  }

  .hint__mobile {
    display: inline;
  }
}
