/* HUD additions for /world: level + EXP, next-area line, objective marker,
   weapon pickup toast, level-up and area banners, the bag's Weapons tab. */

/* ---------- level + EXP (next to the HP bar) ---------- */
.hp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.hp-row .hp-track {
  flex: 1;
}
.hp-level {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: #10261ee0;
  box-shadow: 0 0 0 1px #f3dc9b66;
  color: #f3dc9b;
  font: 800 12px/1.3 Inter, "Segoe UI", sans-serif;
  letter-spacing: 0.03em;
}
.hp-level[hidden],
.xp-track[hidden],
.quest-next[hidden] {
  display: none;
}
.xp-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: #0c1d17b3;
  box-shadow: 0 0 0 1px #ffffff26;
  overflow: hidden;
}
#xp-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d8b45c, #f3dc9b);
  box-shadow: 0 0 6px #f3dc9b88;
  transition: width 0.35s ease;
}

/* ---------- quest tracker: next area ---------- */
.quest-tracker .quest-next {
  margin-top: 2px;
  font-size: 13px;
  color: #e9f2e4;
}
.quest-rec {
  color: #f3dc9b;
  font-weight: 700;
}
.quest-rec.too-strong {
  color: #ff9a8a;
}

/* ---------- objective marker ---------- */
.objective-marker {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  will-change: transform;
}
.objective-marker[hidden] {
  display: none;
}
.objective-marker.visible {
  opacity: 1;
}
.objective-diamond {
  position: absolute;
  left: -9px;
  top: -9px;
  width: 18px;
  height: 18px;
  border: 2px solid #fff8e4;
  background: linear-gradient(135deg, #ffe9a8, #d8a842);
  transform: rotate(45deg);
  box-shadow:
    0 0 0 2px #10261e88,
    0 0 14px #f3dc9bcc;
}
.objective-distance {
  position: absolute;
  top: 15px;
  left: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  font: 700 12px/1 Inter, "Segoe UI", sans-serif;
  color: #fff;
  text-shadow:
    0 1px 2px #000c,
    0 0 6px #000a;
}
/* The arrow orbits the diamond: rotate around the centre, sit 22px out. */
.objective-arrow {
  position: absolute;
  left: -30px;
  top: -30px;
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  color: #f3dc9b;
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  text-shadow: 0 0 4px #000c;
}
.objective-marker.edge .objective-arrow {
  opacity: 1;
}

/* ---------- weapon bar: owned / not owned ---------- */
.weapon-bar button:disabled {
  opacity: 0.35;
  filter: grayscale(1);
  cursor: not-allowed;
}
.weapon-bar button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- weapon pickup toast ---------- */
.weapon-toast {
  --rarity: #b9c8b0;
  position: absolute;
  top: 31%;
  left: 50%;
  min-width: min(380px, calc(100vw - 40px));
  max-width: calc(100vw - 32px);
  padding: 12px 34px 14px;
  background: linear-gradient(90deg, #10261e00, #10261ef0 16%, #10261ef0 84%, #10261e00);
  border-top: 1px solid color-mix(in srgb, var(--rarity) 60%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--rarity) 60%, transparent);
  text-align: center;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.weapon-toast[hidden] {
  display: none;
}
.weapon-toast.show {
  opacity: 1;
  animation: toast-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.weapon-toast.rarity-3 {
  --rarity: #79b6ff;
}
.weapon-toast.rarity-4 {
  --rarity: #c79bff;
}
.weapon-toast.rarity-5 {
  --rarity: #ffcf5a;
}
.weapon-toast-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--rarity);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
}
.weapon-toast-kicker:empty,
.weapon-toast-note:empty,
.weapon-toast-stats:empty {
  display: none;
}
.weapon-toast-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: start;
}
.weapon-toast-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: radial-gradient(
    circle at 50% 35%,
    color-mix(in srgb, var(--rarity) 50%, #fff),
    color-mix(in srgb, var(--rarity) 65%, #10261e)
  );
  box-shadow: 0 0 18px color-mix(in srgb, var(--rarity) 60%, transparent);
  font-size: 28px;
}
.weapon-toast-name {
  display: block;
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 10px color-mix(in srgb, var(--rarity) 70%, transparent);
}
.weapon-toast-stars {
  display: block;
  color: var(--rarity);
  font-size: 14px;
  letter-spacing: 0.1em;
}
.weapon-toast-stats {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #dfe8da;
}
.weapon-toast-note {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #f3dc9b;
}
.weapon-toast.duplicate {
  min-width: 0;
  padding: 8px 28px;
  top: 34%;
}
.weapon-toast.duplicate .weapon-toast-icon {
  width: 34px;
  height: 34px;
  font-size: 18px;
}
.weapon-toast.duplicate .weapon-toast-name {
  font-size: 14px;
}
.weapon-toast.duplicate .weapon-toast-stars {
  font-size: 11px;
}
@keyframes toast-pop {
  from {
    opacity: 0;
    transform: translateX(-50%) scale(0.8);
  }
}

/* ---------- level-up banner ---------- */
.levelup-banner {
  position: absolute;
  top: 40%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: min(560px, 100vw);
  padding: 22px 0 20px;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, #10261ee0 0%, #10261e99 45%, #10261e00 72%);
  text-align: center;
  pointer-events: none;
}
.levelup-banner[hidden],
.area-banner[hidden] {
  display: none;
}
.levelup-banner.show {
  animation: levelup 2.6s ease forwards;
}
.levelup-title {
  font: italic 900 46px/1.05 Georgia, "Yu Mincho", serif;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff6d0, #f3dc9b 45%, #c99a3c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 6px #000a);
}
.levelup-level {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 4px #000a;
}
.levelup-hp {
  font-size: 13px;
  font-weight: 700;
  color: #c4ef7a;
  text-shadow: 0 1px 3px #000a;
}
.levelup-hp:empty {
  display: none;
}
@keyframes levelup {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
  20% {
    transform: translate(-50%, -50%) scale(1);
  }
  82% {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -58%);
  }
}

/* ---------- area banner ---------- */
.area-banner {
  position: absolute;
  top: max(96px, 12%);
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(620px, calc(100vw - 32px));
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  text-shadow:
    0 2px 6px #000b,
    0 0 18px #0007;
}
.area-banner.show {
  animation: area-fade 3.2s ease forwards;
}
.area-banner-name {
  font: 600 clamp(26px, 5vw, 42px)/1.15 Georgia, "Yu Mincho", "Hiragino Mincho ProN", serif;
  letter-spacing: 0.08em;
  color: #fffaf0;
}
.area-banner-level {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #f3dc9b;
}
.area-banner-level:empty {
  display: none;
}
.area-banner-line {
  position: relative;
  width: min(360px, 72%);
  height: 1px;
  background: linear-gradient(90deg, #f3dc9b00, #f3dc9bcc 30%, #fff 50%, #f3dc9bcc 70%, #f3dc9b00);
}
.area-banner-line::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  background: #f3dc9b;
  transform: translate(-50%, -50%) rotate(45deg);
}
@keyframes area-fade {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 0);
  }
}

/* ---------- EXP numbers ---------- */
.damage-number.xp {
  font-size: 15px;
  color: #f3dc9b;
  -webkit-text-stroke: 0;
  letter-spacing: 0.04em;
  text-shadow:
    0 1px 3px #000c,
    0 0 8px #d8a84288;
}

/* ---------- bag: weapons tab ---------- */
.bag-weapons li.weapon-row {
  --rarity: #9aa89a;
  border-inline-start: 4px solid var(--rarity);
}
.bag-weapons li.rarity-3 {
  --rarity: #5b9ae8;
}
.bag-weapons li.rarity-4 {
  --rarity: #a26ee8;
}
.bag-weapons li.rarity-5 {
  --rarity: #e2a92c;
}
.bag-weapons li.equipped {
  box-shadow: 0 0 0 2px #315c40;
}
.bag-icon.weapon-icon {
  background: linear-gradient(160deg, #fff, color-mix(in srgb, var(--rarity) 45%, #fff));
}
.weapon-stars {
  display: block;
  color: var(--rarity);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.bag-items p.weapon-stats {
  color: #20352a;
  font-weight: 700;
}
.bag-weapons wa-button[disabled] {
  opacity: 1;
}
.bag-weapons wa-button[disabled]::part(base) {
  background: #fff;
  color: #315c40;
  border-color: #315c40;
  opacity: 1;
}

/* ---------- journey drawer footer ---------- */
#journey-drawer [slot="footer"] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
#replay-guide::part(base) {
  border-color: #315c40;
  color: #315c40;
}

@media (prefers-reduced-motion: reduce) {
  .weapon-toast.show,
  .levelup-banner.show,
  .area-banner.show {
    animation: none;
  }
  .objective-marker {
    transition: none;
  }
}
