/* Hero Medal Calculator v1.2.1 — game-style card. All classes prefixed lz-medal-*.
   Surfaces/text follow the Z Route theme tokens (--zr-*) when present, so the card
   matches dark and light mode; the original dark-gold values are the fallbacks.
   Star fills and the blue portrait frame are game art and stay fixed. */
.lz-medal-card {
  --lz-medal-bg: var(--zr-surface, #1a1510);
  --lz-medal-bg-2: var(--zr-surface-2, #221c15);
  --lz-medal-gold: var(--zr-gold-text, #ffc861);
  --lz-medal-gold-deep: var(--zr-accent, #f0a51c);
  --lz-medal-muted: var(--zr-muted, #a39b91);
  --lz-medal-text: var(--zr-text, #dcd6cf);
  --lz-medal-border: var(--zr-border, rgba(255, 236, 200, 0.08));
  --lz-medal-shadow: var(--zr-shadow, 0 10px 28px rgba(0, 0, 0, 0.45));
  --lz-medal-btn-bg: var(--zr-surface-2, rgba(0, 0, 0, 0.55));
  --lz-medal-btn-border: var(--zr-border-strong, #6b5420);
  --lz-medal-btn-text: var(--zr-text, #fff);
  --lz-medal-btn-hover: var(--zr-accent-soft, rgba(240, 165, 28, 0.12));
  --lz-medal-check-bg: var(--zr-surface, #fff);
  --lz-medal-check-border: var(--zr-border-strong, #9a9a9a);
  --lz-medal-red: #6e0d0d;
  --lz-medal-pad: 24px;
  --lz-medal-radius: 20px;

  box-sizing: border-box;
  width: 100%;
  max-width: 560px;
  margin: 0 auto 1.25rem;
  padding: var(--lz-medal-pad);
  border-radius: var(--lz-medal-radius);
  background: linear-gradient(180deg, var(--lz-medal-bg-2) 0%, var(--lz-medal-bg) 100%);
  border: 1px solid var(--lz-medal-border);
  box-shadow: var(--lz-medal-shadow);
  color: var(--lz-medal-text);
  font-family: var(--zr-font-body, Roboto), "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  text-align: left;
  line-height: 1.3;
}

.lz-medal-card *,
.lz-medal-card *::before,
.lz-medal-card *::after {
  box-sizing: border-box;
}

.lz-medal-card p {
  margin: 0;
}

/* ---- recruit checkbox (top right) ---- */
.lz-medal-top {
  display: flex;
  justify-content: flex-end;
  margin: -6px -4px 4px 0;
}

.lz-medal-recruit {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0 0.35rem;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  font-size: var(--zr-fs-base, 0.9375rem);
  color: var(--lz-medal-muted);
  transition: color 0.15s ease;
}

.lz-medal-recruit:hover {
  color: var(--lz-medal-text);
}

.lz-medal-recruit__input {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin: 0;
  flex: none;
  border-radius: 5px;
  border: 2px solid var(--lz-medal-check-border);
  background: var(--lz-medal-check-bg);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.lz-medal-recruit__input::after {
  content: "";
  width: 11px;
  height: 6px;
  border-left: 3px solid #1a1510;
  border-bottom: 3px solid #1a1510;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}

.lz-medal-recruit__input:checked {
  background: var(--lz-medal-gold);
  border-color: var(--lz-medal-gold);
}

.lz-medal-recruit__input:checked::after {
  opacity: 1;
}

.lz-medal-recruit__input:focus-visible {
  outline: 2px solid var(--lz-medal-gold);
  outline-offset: 2px;
}

.lz-medal-recruit.is-active .lz-medal-recruit__text {
  color: var(--lz-medal-gold);
}

/* ---- − stars + row ---- */
.lz-medal-controls {
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 6px;
}

.lz-medal-btn {
  flex: none;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid var(--lz-medal-btn-border);
  background: var(--lz-medal-btn-bg);
  color: var(--lz-medal-btn-text);
  font-size: var(--zr-fs-2xl, 1.375rem);
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.lz-medal-btn:hover:not(:disabled) {
  border-color: var(--lz-medal-gold-deep);
  background: var(--lz-medal-btn-hover);
}

.lz-medal-btn:active:not(:disabled) {
  transform: scale(0.93);
}

.lz-medal-btn:focus-visible {
  outline: 2px solid var(--lz-medal-gold);
  outline-offset: 3px;
}

.lz-medal-btn:disabled {
  color: var(--lz-medal-muted);
  border-color: var(--lz-medal-border);
  opacity: 0.55;
  cursor: not-allowed;
}

.lz-medal-stars {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
}

.lz-medal-star {
  appearance: none;
  -webkit-appearance: none;
  flex: 1 1 0;
  min-width: 44px;
  max-width: 100px;
  aspect-ratio: 1 / 1;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}

.lz-medal-star:hover {
  transform: translateY(-1px) scale(1.03);
}

.lz-medal-star:active {
  transform: scale(0.96);
}

.lz-medal-star:focus-visible {
  outline: 2px solid var(--lz-medal-gold);
  outline-offset: 0;
}

.lz-medal-star__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0 1.5px rgba(110, 0, 0, 0.6)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
  transition: filter 0.25s ease;
}

.lz-medal-star__edge {
  fill: none;
  stroke: var(--lz-medal-red);
  stroke-width: 4.5;
  stroke-linejoin: round;
}

.lz-medal-star__fl { fill: #a4a4a4; transition: fill 160ms ease-out; }
.lz-medal-star__fd { fill: #838383; transition: fill 160ms ease-out; }
.lz-medal-star__arm.is-on .lz-medal-star__fl { fill: #ffd54a; }
.lz-medal-star__arm.is-on .lz-medal-star__fd { fill: #f3a516; }

.lz-medal-star__seams {
  fill: none;
  stroke: rgba(40, 30, 20, 0.45);
  stroke-width: 1.4;
  stroke-linecap: round;
}

.lz-medal-star__outline {
  fill: none;
  stroke: #3d0606;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.lz-medal-star.is-complete .lz-medal-star__svg {
  filter: drop-shadow(0 0 2px rgba(150, 0, 0, 0.8)) drop-shadow(0 0 6px rgba(255, 190, 60, 0.35));
}

.lz-medal-star.is-pulse .lz-medal-star__svg {
  animation: lz-medal-pulse 300ms ease-out;
}

@keyframes lz-medal-pulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.1); filter: drop-shadow(0 0 2px rgba(150, 0, 0, 0.8)) drop-shadow(0 0 12px rgba(255, 200, 80, 0.9)); }
  100% { transform: scale(1); }
}

/* ---- readouts ---- */
.lz-medal-progress {
  margin: 0 0 18px !important;
  text-align: center;
  font-size: var(--zr-fs-2xl, 1.375rem);
  font-weight: 400;
  color: var(--lz-medal-gold);
  font-variant-numeric: tabular-nums;
}

.lz-medal-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0 0 14px;
}

/* puzzle-piece style blue portrait frame */
.lz-medal-hero__frame {
  position: relative;
  flex: none;
  width: 72px;
  height: 72px;
  display: block;
}

.lz-medal-hero__frame::before {
  content: "";
  position: absolute;
  inset: 9px;
  transform: rotate(45deg);
  border-radius: 9px;
  background: linear-gradient(135deg, #9cc4ff 0%, #3d74e6 45%, #1c3d9e 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.lz-medal-hero__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 22% 22%, #6f9cf2 0 6px, #1c3d9e 6.5px 8px, transparent 8.5px),
    radial-gradient(circle at 78% 22%, #6f9cf2 0 6px, #1c3d9e 6.5px 8px, transparent 8.5px),
    radial-gradient(circle at 50% 92%, #4f80e8 0 4px, transparent 4.5px);
}

.lz-medal-hero__img,
.lz-medal-hero__placeholder {
  position: absolute;
  z-index: 1;
  inset: 14px;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  border-radius: 6px;
  object-fit: cover;
  object-position: center 15%;
  background: #27323c;
  border: 0;
}

.lz-medal-hero__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--zr-fs-xl, 1.25rem);
  font-weight: 700;
  color: var(--lz-medal-gold);
}

.lz-medal-hero__title {
  font-size: var(--zr-fs-xl, 1.25rem);
  color: var(--lz-medal-text);
  font-weight: 400;
}

.lz-medal-hero__label,
.lz-medal-hero__name {
  color: inherit;
  font-weight: inherit;
}

.lz-medal-stats {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.6rem;
  row-gap: 4px;
  margin: 0 0 10px;
}

.lz-medal-stat {
  font-size: var(--zr-fs-xl, 1.25rem);
  color: var(--lz-medal-text);
}

.lz-medal-stat__label {
  margin-right: 0.3em;
}

.lz-medal-stat__value {
  color: var(--lz-medal-gold);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lz-medal-skill {
  font-size: var(--zr-fs-lg, 1.0625rem);
  color: var(--lz-medal-muted);
}

.lz-medal-debug {
  margin: 12px 0 0 !important;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed var(--zr-border-strong, rgba(255, 200, 97, 0.35));
  background: var(--zr-surface-2, rgba(255, 200, 97, 0.06));
  color: var(--zr-muted, #d9c9a4);
  font: 0.75rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.lz-medal-debug[hidden] {
  display: none !important;
}

@media (max-width: 560px) {
  .lz-medal-card {
    --lz-medal-pad: 16px;
  }

  .lz-medal-recruit {
    font-size: var(--zr-fs-base, 0.9375rem);
  }

  .lz-medal-btn {
    width: 44px;
    height: 44px;
    font-size: var(--zr-fs-xl, 1.25rem);
  }

  .lz-medal-controls {
    gap: 2px;
  }

  .lz-medal-stars {
    gap: 0;
  }

  .lz-medal-star {
    min-width: 0;
  }

  .lz-medal-progress {
    font-size: var(--zr-fs-xl, 1.25rem);
  }

  .lz-medal-hero {
    gap: 12px;
  }

  .lz-medal-hero__frame {
    width: 60px;
    height: 60px;
  }

  .lz-medal-hero__img,
  .lz-medal-hero__placeholder {
    inset: 12px;
    width: calc(100% - 24px);
    height: calc(100% - 24px);
  }

  .lz-medal-hero__title,
  .lz-medal-stat {
    font-size: var(--zr-fs-lg, 1.0625rem);
  }

  .lz-medal-skill {
    font-size: var(--zr-fs-base, 0.9375rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lz-medal-card *,
  .lz-medal-card *::before,
  .lz-medal-card *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Real hero shard icon: the image carries its own frame. */
.lz-medal-card .lz-medal-hero__frame--shard::before,
.lz-medal-card .lz-medal-hero__frame--shard::after { content: none; display: none; }
.lz-medal-card .lz-medal-hero__frame--shard .lz-medal-hero__img { inset: 0; width: 100%; height: 100%; border-radius: 0; object-fit: contain; background: none; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45)); }
