/* Game HUD for /world, styled after anime open-world games:
   quest tracker top-left, HP bottom-centre, prompt on the right. */
.world-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  font-family: Inter, "Segoe UI", "Hiragino Sans", sans-serif;
  color: #fff;
}
.world-hud[hidden] {
  display: none;
}

.quest-tracker {
  position: absolute;
  top: 92px;
  left: 22px;
  max-width: min(320px, 70vw);
  text-shadow: 0 1px 3px #0009;
}
.quest-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f3dc9b;
}
.quest-tracker p {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.45;
}
.quest-compass {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  background: #10261ecc;
  font-size: 12px;
  font-weight: 600;
}
.quest-compass[hidden] {
  display: none;
}
#quest-arrow {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f3dc9b;
  color: #10261e;
  font-size: 10px;
  transition: transform 0.15s linear;
}

.hp-meter {
  position: absolute;
  left: 50%;
  bottom: 26px;
  width: min(340px, 60vw);
  transform: translateX(-50%);
  display: grid;
  gap: 3px;
  justify-items: center;
}
.hp-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: #0c1d17b3;
  box-shadow: 0 0 0 1px #ffffff40;
  overflow: hidden;
}
#hp-fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8fdc6d, #c4ef7a);
  transition: width 0.25s ease;
}
#hp-fill.low {
  background: linear-gradient(90deg, #f06b5b, #ff9a6b);
}
#hp-text {
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 1px 2px #000a;
}

.interaction-prompt {
  position: absolute;
  top: 52%;
  left: calc(50% + 90px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px 7px 7px;
  border-radius: 999px;
  background: #10261ee0;
  box-shadow: 0 4px 18px #0005;
  font-size: 14px;
  font-weight: 600;
  animation: prompt-in 0.18s ease-out;
}
.interaction-prompt[hidden] {
  display: none;
}
.interaction-prompt kbd {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f3dc9b;
  color: #10261e;
  font: 700 14px/1 inherit;
}
.interaction-prompt.sealed kbd {
  background: #c9a2ff;
}
@keyframes prompt-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
}

.companion-line {
  position: absolute;
  left: 50%;
  bottom: 74px;
  width: min(640px, calc(100vw - 32px));
  margin: 0;
  transform: translate(-50%, 8px);
  text-align: center;
  font-size: 16px;
  line-height: 1.5;
  text-shadow:
    0 1px 3px #000c,
    0 0 12px #0008;
  opacity: 0;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}
.companion-line.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.companion-line strong {
  margin-inline-end: 0.6em;
  color: #f3dc9b;
}

#damage-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 7;
}
.damage-number {
  position: absolute;
  transform: translate(-50%, -50%);
  font: 800 22px/1 Inter, "Segoe UI", sans-serif;
  color: #fff;
  -webkit-text-stroke: 1px #3a2a1a;
  text-shadow: 0 2px 4px #0008;
  animation: damage-float 0.95s ease-out forwards;
}
.damage-number.crit {
  font-size: 32px;
  color: #ffcf5a;
}
.damage-number.player {
  color: #ff6b5e;
}
.damage-number.heal {
  color: #9dff86;
}
@keyframes damage-float {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(0.6);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -70%) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -190%) scale(1);
  }
}

.downed-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  background: radial-gradient(circle, #0000 20%, #1a0d14d9 85%);
  color: #fff;
  animation: downed-in 0.6s ease-out;
}
.downed-overlay[hidden] {
  display: none;
}
.downed-overlay strong {
  font-size: 26px;
}
@keyframes downed-in {
  from {
    opacity: 0;
  }
}

#reward-dialog {
  --width: min(520px, calc(100vw - 30px));
}
.reward-email {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f3dc9b26;
  font-weight: 600;
  word-break: break-all;
}
.reward-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 760px) {
  .quest-tracker {
    top: 78px;
    left: 14px;
  }
  .quest-tracker p,
  .quest-name {
    font-size: 12px;
  }
  .hp-meter {
    bottom: auto;
    top: 78px;
    left: auto;
    right: 14px;
    width: 130px;
    transform: none;
  }
  .interaction-prompt {
    top: auto;
    bottom: 190px;
    left: auto;
    right: 16px;
    font-size: 13px;
  }
  .companion-line {
    bottom: 200px;
    font-size: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .damage-number,
  .interaction-prompt,
  .downed-overlay {
    animation-duration: 0.01s;
  }
}

/* Collectibles: yuzu counter, pickup feed (right side) and the bag. */
.yuzu-progress {
  margin: 4px 0 0;
  font-size: 12px;
  color: #ffe7a6;
}
.yuzu-progress[hidden] {
  display: none;
}
.pickup-feed {
  position: absolute;
  right: 22px;
  top: 38%;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  justify-items: end;
}
.pickup-feed li {
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #10261e00, #10261ee6 30%);
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 1px 2px #0008;
  animation: pickup-in 0.25s ease-out;
  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
}
.pickup-feed li.leaving {
  opacity: 0;
  transform: translateX(12px);
}
@keyframes pickup-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
}
.bag-items {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bag-items li {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f4efe2;
  color: #20352a;
}
.bag-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(160deg, #fff6d8, #e9d6a2);
  font-size: 24px;
}
.bag-items strong {
  font-size: 14px;
}
.bag-items p {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #5b6b5e;
}
.bag-items wa-button::part(base) {
  background: #315c40;
  border-color: #315c40;
  color: #fff;
}
.bag-empty {
  color: #71806e;
  font-size: 13px;
}
.bag-empty:empty {
  display: none;
}
@media (max-width: 760px) {
  .pickup-feed {
    top: 150px;
    right: 14px;
  }
}

/* Character creator */
#creator-drawer {
  --size: min(380px, 92vw);
}
.creator-form {
  display: grid;
  gap: 16px;
}
.creator-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}
.creator-form legend {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #5b6b5e;
}
.creator-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.creator-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--swatch);
  box-shadow: 0 0 0 1px #0002;
  cursor: pointer;
}
.creator-chip {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #c9cfc4;
  background: #fff;
  color: #20352a;
  font: 600 13px/1 inherit;
  cursor: pointer;
}
.creator-swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 3px #315c40;
}
.creator-chip[aria-pressed="true"] {
  border-color: #315c40;
  background: #315c40;
  color: #fff;
}
.creator-swatch:focus-visible,
.creator-chip:focus-visible {
  outline: 2px solid #d8bf7d;
  outline-offset: 2px;
}
.creator-footer {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  width: 100%;
}
#creator-done::part(base) {
  background: #315c40;
  border-color: #315c40;
  color: #fff;
}

.monument-logo {
  display: block;
  width: 64px;
  height: 64px;
  margin: 10px 0 4px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 4px 14px #0002;
}
.monument-logo[hidden] {
  display: none;
}

/* Keep the world visible while designing the traveler. */
#creator-drawer {
  --wa-color-overlay-modal: transparent;
}
#creator-drawer::part(dialog)::backdrop {
  background: transparent;
}

/* Weapon bar (bottom-left), challenge timer, boss bar */
.weapon-bar {
  position: absolute;
  left: 22px;
  bottom: 22px;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}
.weapon-bar button {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid #ffffff55;
  background: #10261ecc;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}
.weapon-bar button[aria-pressed="true"] {
  border-color: #f3dc9b;
  box-shadow: 0 0 0 3px #f3dc9b55, 0 0 16px #f3dc9b66;
}
.weapon-bar kbd {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 16px;
  padding: 1px 4px;
  border-radius: 6px;
  background: #f3dc9b;
  color: #10261e;
  font: 700 10px/1.3 Inter, sans-serif;
}
.weapon-bar button:focus-visible {
  outline: 2px solid #f3dc9b;
  outline-offset: 2px;
}
.challenge-timer {
  position: absolute;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  border-radius: 999px;
  background: #10261ee0;
  font-weight: 700;
  font-size: 15px;
}
.challenge-timer[hidden],
.boss-bar[hidden] {
  display: none;
}
.challenge-timer.urgent {
  color: #ffb4a8;
  animation: timer-pulse 0.5s ease-in-out infinite alternate;
}
@keyframes timer-pulse {
  to {
    transform: translateX(-50%) scale(1.08);
  }
}
.boss-bar {
  position: absolute;
  top: 128px;
  left: 50%;
  width: min(420px, 70vw);
  transform: translateX(-50%);
  display: grid;
  gap: 4px;
  justify-items: center;
  text-shadow: 0 1px 3px #000a;
}
.boss-bar strong {
  font-size: 14px;
  letter-spacing: 0.06em;
  color: #ffe3b0;
}
.boss-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #0c1d17c0;
  box-shadow: 0 0 0 1px #ffffff40;
  overflow: hidden;
}
.boss-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #e2563f, #f0a04b);
  transition: width 0.2s ease;
}

/* Bag tabs and project journal */
.bag-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.bag-tabs button {
  flex: 1;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid #c9cfc4;
  background: #fff;
  color: #20352a;
  font: 600 13px/1 inherit;
  cursor: pointer;
}
.bag-tabs button[aria-selected="true"] {
  background: #315c40;
  border-color: #315c40;
  color: #fff;
}
.bag-items[hidden] {
  display: none;
}
.bag-icon img {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
}
.bag-projects li.undiscovered {
  opacity: 0.6;
}
.bag-projects li.undiscovered .bag-icon {
  background: #d9d6cc;
  color: #6b6b62;
  font-weight: 800;
}
.journal-link {
  color: #315c40;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
@media (max-width: 760px) {
  .weapon-bar {
    left: 14px;
    bottom: auto;
    top: 190px;
    flex-direction: column;
  }
  .weapon-bar button {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
  .boss-bar {
    top: 150px;
  }
}

/* Status screen */
#status-drawer {
  --size: min(360px, 92vw);
  --wa-color-overlay-modal: transparent;
}
#status-drawer::part(dialog)::backdrop {
  background: transparent;
}
.status-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.status-head h3 {
  margin: 0;
  font-size: 20px;
  color: #20352a;
}
.status-level {
  padding: 2px 10px;
  border-radius: 999px;
  background: #315c40;
  color: #fff;
  font-weight: 800;
}
.status-xp-track {
  height: 6px;
  margin: 10px 0 2px;
  border-radius: 999px;
  background: #e4e0d4;
  overflow: hidden;
}
.status-xp-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #d8bf7d, #f3dc9b);
}
.status-section {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f4efe2;
}
.status-section h4 {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #5b6b5e;
}
.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  font-size: 13px;
  color: #20352a;
  border-bottom: 1px solid #00000010;
}
.status-row:last-child {
  border-bottom: 0;
}
.status-row.highlight strong {
  color: #a0542c;
  font-size: 15px;
}
.status-row.sub {
  font-size: 12px;
  color: #71806e;
}

/* Optional sign-up form */
#optin-dialog {
  --width: min(480px, calc(100vw - 24px));
}
.optin-form {
  display: grid;
  gap: 10px;
  color: #20352a;
}
.optin-title {
  margin: 0;
  font-size: 18px;
}
.optin-lead {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #5b6b5e;
}
.optin-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
}
.optin-field input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #c9cfc4;
  border-radius: 10px;
  font: 400 15px/1 inherit;
}
.optin-consent {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 12px;
  line-height: 1.55;
}
.optin-consent input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
}
.optin-privacy {
  font-size: 12px;
  color: #315c40;
}
.optin-status {
  min-height: 1em;
  margin: 0;
  font-size: 12px;
  color: #a0542c;
}
.optin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.optin-actions button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  font: 700 14px/1 inherit;
  cursor: pointer;
}
.optin-submit {
  border: 0;
  background: #315c40;
  color: #fff;
}
.optin-submit:disabled {
  opacity: 0.6;
}
.optin-skip {
  border: 1px solid #c9cfc4;
  background: #fff;
  color: #20352a;
}
.optin-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
}
.optin-reward {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #0000001a;
}
.optin-reward[hidden] {
  display: none;
}
