.star-field { position: absolute; inset: 0; pointer-events: none; }
.star-stop, .case-stage { position: relative; }
.star-target[hidden], .star-hud[hidden], .star-hunt [hidden] { display: none !important; }
.star-target {
  position: absolute;
  z-index: 9;
  display: grid;
  place-items: center;
  left: clamp(24px, var(--target-x), calc(100% - 24px));
  top: var(--target-y);
  width: max(44px, var(--target-size));
  height: max(44px, var(--target-size));
  box-sizing: border-box;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #ce3c30;
  cursor: crosshair;
  pointer-events: auto;
  touch-action: manipulation;
  transform: translate(-50%, -50%);
  animation: star-orbit var(--target-period) linear var(--target-phase) infinite;
}
.star-target img {
  display: block;
  width: var(--target-size);
  height: var(--target-size);
  max-width: none;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 1px 1px #32150f21);
  animation: star-spin var(--spin-period) linear var(--target-phase) infinite;
}
.star-target:is(:hover, :focus-visible), .star-target:is(:hover, :focus-visible) img,
.star-target.is-collected, .star-target.is-collected img { animation-play-state: paused; }
.star-target:is(:hover, :focus-visible)::before {
  content: '';
  position: absolute;
  z-index: 1;
  inset: -4px;
  border: 1px dashed currentColor;
  border-radius: 50%;
  pointer-events: none;
}
.star-target:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.star-target.is-collected { pointer-events: none; }
.star-target.is-collected img { scale: .25; opacity: 0; transition: scale .22s ease-in, opacity .22s ease-in; }
.star-target.is-collected::after {
  content: '';
  position: absolute;
  inset: 7px;
  background: #ed715f;
  clip-path: polygon(50% 0, 58% 33%, 87% 11%, 74% 42%, 100% 50%, 69% 59%, 88% 88%, 57% 72%, 50% 100%, 42% 70%, 12% 87%, 32% 59%, 0 50%, 32% 41%, 13% 12%, 42% 32%);
  animation: star-impact .26s ease-out both;
}
@keyframes star-orbit {
  0%,100% { translate: var(--target-rx) 0; }
  12.5% { translate: calc(var(--target-rx) * .707) calc(var(--target-ry) * .707); }
  25% { translate: 0 var(--target-ry); }
  37.5% { translate: calc(var(--target-rx) * -.707) calc(var(--target-ry) * .707); }
  50% { translate: calc(var(--target-rx) * -1) 0; }
  62.5% { translate: calc(var(--target-rx) * -.707) calc(var(--target-ry) * -.707); }
  75% { translate: 0 calc(var(--target-ry) * -1); }
  87.5% { translate: calc(var(--target-rx) * .707) calc(var(--target-ry) * -.707); }
}
@keyframes star-spin { to { rotate: 1turn; } }
@keyframes star-impact { from { scale: .45; opacity: 1; } to { scale: 1.65; opacity: 0; } }

.star-hud {
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  padding: 7px 11px;
  border: 1px solid #e3d9ca;
  border-radius: 999px;
  background: #fffcf6;
  color: #342820;
  box-shadow: 0 5px 18px #34282022;
  font: 600 .875rem/1.4 system-ui, sans-serif;
}
.star-clock { padding-left: 8px; border-left: 1px solid #ded1c1; font-variant-numeric: tabular-nums; }
.star-hud button { color: #a73029; background: none; border: 0; padding: 2px; font: inherit; cursor: pointer; text-decoration: underline; }

.star-hunt, .star-results {
  position: fixed;
  inset: 0;
  width: min(620px, calc(100% - 32px));
  max-width: none;
  max-height: 88dvh;
  margin: auto;
  padding: 0;
  border: 1px solid #b38366;
  border-radius: 15px;
  background: #fff5e7;
  color: #29211e;
  box-shadow: 0 18px 65px #1e100c70;
  font: 400 1rem/1.5 system-ui, sans-serif;
  overflow: auto;
}
.star-hunt[open], .star-results[open] { animation: hunt-arrive .3s cubic-bezier(.18,.8,.3,1) both; }
.star-hunt::backdrop, .star-results::backdrop { background: #261a16b8; }
.star-hunt {
  box-sizing: border-box;
  width: min(420px, calc(100% - 32px));
  border: 1px solid #e9e7e4;
  border-radius: 12px;
  background: #fff;
  color: #231e1d;
  box-shadow: 0 14px 54px #27171255;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}
.star-hunt::backdrop { background: #2117149e; }
.hunt-frame { padding: clamp(20px, 5vw, 32px); }
.hunt-art { width: 54px; margin-bottom: 16px; }
.hunt-star { display: block; width: 100%; height: auto; }
.star-hunt[open] .hunt-star { animation: star-reveal .62s cubic-bezier(.2,.78,.26,1) both; }
.star-hunt[open]:has(.hunt-countdown:not([hidden])) .hunt-star { animation: star-ready .42s ease-out both; }
.results-kicker { margin: 0 0 6px; color: #9d372b; font-size: .76rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.star-results h2 { margin: 0; color: inherit; font: 700 clamp(1.85rem, 6.8vw, 3.2rem)/.95 Georgia, serif; letter-spacing: -.045em; }
.star-hunt h2 { margin: 0; font-family: inherit; font-size: 1.85rem; font-weight: 650; line-height: 1.08; letter-spacing: -.04em; }
.hunt-kicker { margin: 0 0 6px; font-size: .8125rem; font-weight: 650; }
.hunt-text { margin: 10px 0 20px; color: #645c56; font-size: .9375rem; }
.star-hunt .hunt-actions button, .star-hunt .hunt-abort {
  min-height: 44px;
  border-radius: 8px;
  font-family: inherit;
}
.star-hunt button[value="start"] { border-color: #b63126; background: #b63126; }
.star-hunt button[value="start"]:hover { background: #95281e; }
.star-hunt button[value="cancel"], .star-hunt .hunt-abort { border-color: #e9e7e4; color: #231e1d; }
.star-hunt button[value="cancel"]:hover, .star-hunt .hunt-abort:hover { background: #f5f3f1; }
.hunt-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hunt-actions button, .hunt-abort {
  padding: 8px 12px;
  border: 1px solid #a6372b;
  border-radius: 6px;
  color: #fff;
  background: #a6372b;
  font: 650 .9rem/1.5 system-ui, sans-serif;
  cursor: pointer;
}
.hunt-actions button + button, .hunt-abort { color: #81382e; background: transparent; }
.hunt-actions button:focus-visible, .hunt-abort:focus-visible { outline: 2px solid #85362d; outline-offset: 3px; }
.hunt-abort { margin-top: 10px; padding: 4px 9px; }
.hunt-countdown { margin: 13px 0 0; min-height: 1.07em; color: #a6372b; font: 700 clamp(2rem, 8vw, 3.55rem)/1 Helvetica Neue, Arial, sans-serif; }
.hunt-countdown.is-ticking { animation: hunt-tick .26s cubic-bezier(.15,.7,.24,1); }

.star-results { width: min(420px, calc(100% - 32px)); padding: 24px; }
.results-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.results-stats div { padding: 9px 12px; border-radius: 8px; background: #f6e7d8; }
.results-stats dt { font-size: .84rem; color: #70554c; }
.results-stats dd { margin: 2px 0 0; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.star-results h3 { margin: 0; font-size: .95rem; }
.star-results ol, .star-results [data-empty-leaderboard] { margin: 6px 0 17px; font-size: .9rem; }
.star-results ol { padding-left: 1.25em; }
.star-results li { font-variant-numeric: tabular-nums; }
@keyframes hunt-arrive { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
@keyframes star-reveal { from { opacity: 0; transform: rotate(-40deg) scale(.3); } }
@keyframes star-ready { from { transform: rotate(16deg) scale(.78); } to { transform: rotate(-15deg) translate(2%, 6%); } }
@keyframes hunt-tick { from { opacity: .4; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
@media (max-width: 760px) {
  .star-target { left: clamp(23px, var(--target-mobile-x, var(--target-x)), calc(100% - 23px)); top: var(--target-mobile-y, var(--target-y)); }
}
@media (max-width: 480px) {
  .star-hud { gap: 7px; padding: 6px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .star-target, .star-target img, .star-target.is-collected::after,
  .star-hunt[open], .star-results[open], .star-hunt[open] .hunt-star,
  .star-hunt[open]:has(.hunt-countdown:not([hidden])) .hunt-star,
  .hunt-countdown.is-ticking { animation: none; transition: none; }
  .star-target.is-collected::after { display: none; }
}
