/* Candy Cuddle Kids — Hidden Star Hunt (all rules scoped to .g-stars) */
.g-stars { --hs-gold: var(--gold, #ffc94d); }
.g-stars .hs-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.g-stars .btn-sm { min-height: 46px; }
.g-stars .hs-stat-star { color: var(--gold-dark, #d99a00); }
.g-stars .hs-hint-btn[disabled] { opacity: .5; }
.g-stars .hs-hint-btn.nudge { animation: hsNudge .7s ease 2; }
.g-stars .hs-zoom-btn[aria-pressed="true"] { background: var(--berry); box-shadow: none; }

/* layout */
.g-stars .hs-stage { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 22px; align-items: start; }
.g-stars .hs-main { min-width: 0; scroll-margin-top: 90px; }
.g-stars .hs-head { display: flex; align-items: center; gap: 10px; margin: 0 auto 12px; max-width: max(300px, calc(100vh - 210px)); }
.g-stars .hs-head-text { flex: 1; min-width: 0; text-align: center; }
.g-stars .hs-num { display: block; font-family: var(--head); font-weight: 600; font-size: .85rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--berry); }
.g-stars .hs-title { font-size: clamp(1.15rem, 2.6vw, 1.6rem); margin: 0; overflow-wrap: anywhere; }
.g-stars .hs-arrow { flex-shrink: 0; width: 50px; height: 50px; border-radius: 50%; font-size: 2rem; line-height: 1; padding-bottom: 4px; }

/* the picture */
.g-stars .hs-frame {
  position: relative; width: 100%; max-width: max(300px, calc(100vh - 210px)); margin: 0 auto; aspect-ratio: 1 / 1;
  border-radius: 22px; overflow: hidden; background: var(--sky); cursor: crosshair;
  box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--line), var(--shadow-sm);
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.g-stars .hs-frame:focus-visible { outline: 5px solid var(--gold); outline-offset: 6px; }
.g-stars .hs-frame.is-zoomed { touch-action: none; cursor: grab; }
.g-stars .hs-frame.is-dragging { cursor: grabbing; }
.g-stars .hs-frame.is-loading::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%) var(--sky);
  background-size: 250% 100%; animation: hsShimmer 1.2s linear infinite;
}
.g-stars .hs-canvas { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.g-stars .hs-canvas.is-anim { transition: transform .35s cubic-bezier(.3, .8, .3, 1); }
.g-stars .hs-img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.g-stars .hs-fx { position: absolute; inset: 0; pointer-events: none; }
.g-stars .hs-zoom-tip {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 3; pointer-events: none;
  background: rgba(60, 30, 35, .8); color: #fff; font-family: var(--head); font-weight: 600; font-size: .95rem;
  padding: 7px 16px; border-radius: 999px; white-space: nowrap; opacity: 0;
}
.g-stars .hs-zoom-tip.show { animation: hsTip 2.6s ease forwards; }

/* effects (positioned in % of the picture so they survive any resize / zoom) */
.g-stars .hs-ring {
  position: absolute; width: 12.5%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  border: 5px solid var(--hs-gold); box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(224, 36, 94, .55), 0 0 26px 10px rgba(255, 201, 77, .9), inset 0 0 18px 4px rgba(255, 201, 77, .6);
}
.g-stars .hs-ring.is-new { animation: hsRing .7s cubic-bezier(.2, 1.5, .4, 1) both, hsGlow 1.6s ease-in-out .7s 3; }
.g-stars .hs-burst { position: absolute; width: 0; height: 0; }
.g-stars .hs-burst span {
  position: absolute; left: 0; top: 0; font-size: clamp(14px, 2.6vw, 26px); line-height: 1; color: var(--c);
  text-shadow: 0 0 8px rgba(255, 201, 77, .9); opacity: 0; animation: hsBurst 1.1s ease-out forwards;
}
.g-stars .hs-ripple {
  position: absolute; width: 9%; aspect-ratio: 1; transform: translate(-50%, -50%) scale(.3); border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .95); box-shadow: 0 0 0 2px rgba(224, 36, 94, .35); opacity: 0; animation: hsRipple .75s ease-out forwards;
}
.g-stars .hs-hint {
  position: absolute; border-radius: 26%;
  background: radial-gradient(closest-side, rgba(255, 240, 170, .35), rgba(255, 201, 77, .12) 70%, rgba(255, 201, 77, 0));
  box-shadow: 0 0 0 9999px rgba(30, 24, 70, .42), inset 0 0 0 4px rgba(255, 214, 102, .95), inset 0 0 30px 8px rgba(255, 201, 77, .55);
  animation: hsHint 1.6s ease-in-out infinite, hsFadeIn .4s ease;
}
.g-stars .hs-hint.is-wide { border-radius: 12%; }
.g-stars .hs-cursor {
  position: absolute; width: 7%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; display: none;
  border: 3px solid #fff; box-shadow: 0 0 0 3px var(--berry), 0 2px 10px rgba(0, 0, 0, .4);
}
.g-stars .hs-cursor::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: var(--berry); }
.g-stars .hs-frame.kbd:focus .hs-cursor { display: block; }

/* buddy */
.g-stars .hs-side { display: flex; flex-direction: column; align-items: center; gap: 16px; position: sticky; top: 96px; }
.g-stars .hs-buddy { display: flex; flex-direction: column-reverse; align-items: center; gap: 6px; }
.g-stars .hs-buddy-img { width: auto; height: 190px; filter: drop-shadow(0 8px 10px rgba(60, 30, 35, .2)); transform-origin: 50% 90%; }
.g-stars .hs-buddy[data-mood="happy"] .hs-buddy-img { animation: hsHop .6s ease; }
.g-stars .hs-bubble {
  position: relative; margin: 0; background: var(--berry-soft); color: var(--ink); font-family: var(--head); font-weight: 600;
  font-size: 1.1rem; line-height: 1.3; text-align: center; padding: 12px 16px; border-radius: 20px; min-height: 3.2em; display: grid; place-items: center; width: 100%;
}
.g-stars .hs-bubble::after { content: ""; position: absolute; left: 50%; bottom: -10px; margin-left: -10px; border: 10px solid transparent; border-bottom: 0; border-top-color: var(--berry-soft); }
.g-stars .hs-bubble.pop { animation: hsPop .35s cubic-bezier(.2, 1.5, .4, 1); }
.g-stars .hs-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; width: 100%; }
.g-stars .hs-next.bounce { animation: hsPop .5s cubic-bezier(.2, 1.6, .4, 1); }
.g-stars [hidden] { display: none !important; }

/* thumbnail strip */
.g-stars .hs-strip-title { font-size: 1.1rem; margin: 26px 0 10px; color: var(--ink-soft); }
.g-stars .hs-strip { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; }
.g-stars .hs-thumb {
  position: relative; padding: 0; border: 0; border-radius: 14px; overflow: visible; cursor: pointer; background: var(--sky);
  aspect-ratio: 1; min-width: 44px; box-shadow: 0 0 0 3px var(--line); transition: transform .15s, box-shadow .15s;
}
.g-stars .hs-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }
.g-stars .hs-thumb:hover { transform: translateY(-3px); }
.g-stars .hs-thumb[aria-current="true"] { box-shadow: 0 0 0 4px var(--berry); transform: translateY(-3px); }
.g-stars .hs-thumb-n {
  position: absolute; left: 4px; bottom: 4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px;
  background: rgba(255, 255, 255, .9); font-family: var(--head); font-weight: 700; font-size: .8rem; line-height: 22px; color: var(--ink);
}
.g-stars .hs-badge {
  position: absolute; right: -7px; top: -7px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: #fff; font-size: 17px; line-height: 1; text-shadow: 0 1px 0 var(--gold-dark);
  box-shadow: 0 0 0 3px #fff, 0 3px 6px rgba(0, 0, 0, .2); transform: scale(0); transition: transform .3s cubic-bezier(.2, 1.6, .4, 1);
}
.g-stars .hs-thumb.is-found .hs-badge { transform: scale(1); }
.g-stars .hs-thumb.is-found:not([aria-current="true"]) img { filter: saturate(.8) brightness(1.04); }
.g-stars .hs-thumb.just .hs-badge { animation: hsSpin .9s ease; }

/* responsive */
@media (max-width: 900px) {
  .g-stars .hs-stage { grid-template-columns: 1fr; gap: 14px; }
  .g-stars .hs-side { position: static; flex-direction: row; align-items: center; justify-content: center; flex-wrap: wrap; }
  .g-stars .hs-buddy { flex-direction: row; gap: 4px; flex: 1 1 260px; max-width: 520px; }
  .g-stars .hs-buddy-img { height: 110px; }
  .g-stars .hs-bubble { text-align: left; place-items: center start; min-height: 0; }
  .g-stars .hs-bubble::after { left: -10px; top: 50%; bottom: auto; margin: -10px 0 0; border: 10px solid transparent; border-left: 0; border-right-color: var(--berry-soft); }
  .g-stars .hs-actions { width: auto; flex: 0 1 auto; flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .g-stars .hs-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .g-stars .hs-title { font-size: 1.05rem; }
  .g-stars .hs-num { font-size: .72rem; }
  .g-stars .hs-arrow { width: 46px; height: 46px; }
  .g-stars .hs-frame { border-radius: 16px; }
  .g-stars .hs-buddy-img { height: 88px; }
  .g-stars .hs-bubble { font-size: 1rem; padding: 10px 12px; }
  .g-stars .hs-strip { gap: 8px; }
  .g-stars .hs-thumb-n { display: none; }
  .g-stars .hs-badge { width: 22px; height: 22px; font-size: 13px; right: -5px; top: -5px; }
  .g-stars .game-bar { gap: 8px; }
}

@keyframes hsShimmer { to { background-position: -150% 0; } }
@keyframes hsRing { from { transform: translate(-50%, -50%) scale(2.4); opacity: 0; } }
@keyframes hsGlow { 50% { box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(224, 36, 94, .7), 0 0 40px 16px rgba(255, 201, 77, 1), inset 0 0 22px 6px rgba(255, 201, 77, .8); } }
@keyframes hsBurst {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--a)) translateY(0) scale(.4); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(var(--d) * -1.4)) scale(1.1); }
}
@keyframes hsRipple { 0% { opacity: .95; transform: translate(-50%, -50%) scale(.3); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); } }
@keyframes hsHint { 0%, 100% { box-shadow: 0 0 0 9999px rgba(30, 24, 70, .42), inset 0 0 0 4px rgba(255, 214, 102, .95), inset 0 0 30px 8px rgba(255, 201, 77, .55); }
  50% { box-shadow: 0 0 0 9999px rgba(30, 24, 70, .3), inset 0 0 0 4px rgba(255, 240, 170, 1), inset 0 0 44px 16px rgba(255, 201, 77, .8); } }
@keyframes hsFadeIn { from { opacity: 0; } }
@keyframes hsTip { 0% { opacity: 0; } 12%, 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes hsPop { from { transform: scale(.85); } }
@keyframes hsHop { 40% { transform: translateY(-14px) rotate(-4deg); } }
@keyframes hsNudge { 25% { transform: rotate(-5deg) scale(1.06); } 75% { transform: rotate(5deg) scale(1.06); } }
@keyframes hsSpin { 50% { transform: scale(1.5) rotate(180deg); } }

@media (prefers-reduced-motion: reduce) {
  .g-stars .hs-ripple { opacity: .8; transform: translate(-50%, -50%); }
  .g-stars .hs-zoom-tip.show { opacity: 1; }
  .g-stars .hs-frame.is-loading::before { background: var(--sky); }
}
