/* Gameplay feedback stays legible across all seven scene palettes. */
html[data-theme] .board-stats .stat-moves,
html[data-theme] .board-stats .target-stat { position: relative; overflow: visible; }
html[data-theme] .perfect-target {
  position: absolute; top: calc(100% + 3px); white-space: nowrap;
  color: #fff0cc; font-size: clamp(9px, calc(var(--stage-width) * .023), 12px);
  line-height: 1.1; text-shadow: 0 1px 3px #153b49;
}
#move-count { display: inline-block; font-variant-numeric: tabular-nums; }
.scoreboard-tick { animation: scoreboard-tick .42s cubic-bezier(.2,.8,.3,1); }
#move-delta {
  position: absolute; right: -8px; top: 30%; z-index: 5;
  padding: 3px 7px; border-radius: 12px; background: #ffe7a0;
  border: 2px solid #fff9de; color: #765015; font: 900 16px/1 system-ui;
  box-shadow: 0 2px 5px #55422444; pointer-events: none; opacity: 0;
}
#move-delta[data-direction="down"] { background: #d5f1e9; color: #205e55; }
#move-delta.step-feedback { animation: step-plus .95s ease-out forwards; }
@keyframes scoreboard-tick {
  0% { transform: translateY(7px) scale(.86); opacity: .4; }
  45% { transform: translateY(-3px) scale(1.24); opacity: 1; }
  100% { transform: none; }
}
@keyframes step-plus {
  0% { opacity: 0; transform: translateY(8px) scale(.7); }
  18%, 60% { opacity: 1; transform: translateY(-4px) scale(1.06); }
  100% { opacity: 0; transform: translateY(-23px) scale(1); }
}
html[data-theme] #undo-button,
html[data-theme] #hint-button { position: relative; overflow: visible; }
html[data-theme] #undo-button:disabled,
html[data-theme] #hint-button:disabled { opacity: 1; }
html[data-theme] .undo-credit-badge {
  position: absolute; top: 3%; right: 3%; min-width: 23px; height: 23px;
  display: grid; place-items: center; padding: 0 5px; border-radius: 99px;
  border: 2px solid #fff7de; background: #ebc56b; color: #493619;
  font: 900 12px/1 system-ui; box-shadow: 0 2px 3px #3a2d3144;
}
html[data-theme] .game-actions button[data-empty="true"] .undo-credit-badge { background: #c0cbd0; color: #42515b; }
html[data-theme] .undo-recharge {
  position: absolute; top: 100%; left: -15%; width: 130%; margin: 3px 0 0;
  text-align: center; white-space: nowrap; color: #fff5d7;
  font-size: clamp(9px, calc(var(--stage-width) * .025), 11px); line-height: 1.1;
  text-shadow: 0 1px 3px #173947, 0 0 4px #173947;
}
.celebration-banner {
  position: absolute; z-index: 14; left: 50%; top: 34%; translate: -50% 0;
  display: flex; align-items: center; flex-wrap: wrap; justify-content: center;
  gap: 6px; width: max-content; max-width: 92%; padding: 12px 18px;
  color: #314a42; background: #fff2da; border: 3px solid #fff9ed;
  border-radius: 20px; box-shadow: 0 4px 0 #b39d73, 0 7px 24px #162f3c66;
  text-align: center; animation: celebration-arrive .5s ease-out both;
}
.celebration-banner .icon { width: 25px; height: 25px; }
.celebration-banner strong { font-size: clamp(19px, 6vw, 28px); }
.celebration-banner small { flex-basis: 100%; font-size: 12px; letter-spacing: .05em; }
.celebration-banner.celebration-one { padding: 9px 15px; }
.celebration-banner.celebration-two { border-color: #cceee7; background: #e6f7ef; }
.celebration-banner.celebration-three { background: #fff0b9; border-color: #ffe6a1; color: #845b16; }
.celebration-banner.celebration-perfect {
  top: 28%; min-width: 76%; padding: 20px 22px; color: #704607;
  background: linear-gradient(135deg, #fff8dc, #ffd778 55%, #fff1ba);
  border: 4px solid #fff8d6; box-shadow: 0 5px 0 #b78836, 0 0 38px #ffe199aa;
}
.celebration-perfect .icon { width: 35px; height: 35px; fill: #efbd4d; }
.celebration-banner.celebration-perfect:before {
  content: ''; position: absolute; inset: -22px; z-index: -1; border-radius: 40%;
  border: 2px solid #ffe8a6; animation: perfect-halo 1.2s ease-out 3;
}
.board-celebration.celebration-perfect span {
  color: #ffdf7c; font-size: 28px; text-shadow: 0 0 9px #ffe9a1;
  animation-duration: 2.1s;
}
.board-celebration.celebration-three span { color: #ffd35d; }
.board-celebration.celebration-two span { font-size: 20px; color: #a9dec6; animation-duration: 1.2s; }
.board-celebration.celebration-one span { font-size: 18px; animation-duration: 1s; }
.result-grade {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: max-content; margin: 0 auto 10px; padding: 7px 14px; border-radius: 99px;
  background: #eee8d5; color: #6e765b; font-size: 14px; font-weight: 900;
}
.result-three .result-grade { background: #ffedb9; color: #926218; }
.result-two .result-grade { background: #dcefe5; color: #43735c; }
.result-perfect .result-grade {
  background: linear-gradient(110deg, #fff4cd, #ffd87a, #fff4cd);
  color: #7d4d0e; border: 2px solid #fff8de; box-shadow: 0 0 15px #e8ba5755;
}
.result-perfect .dialog-content { border-radius: 24px; }
.result-perfect h2 { color: #926318; }
.result-perfect .result-stars { filter: drop-shadow(0 0 8px #e2bc65); }
.result-rating-note { font-size: 12px; color: #8a7654; margin: 8px 0; }
.confetti i { left: var(--confetti-x, calc(var(--i) * 5%)); }
html[data-backgrounded="false"] .result-dialog .confetti i { animation-play-state: running !important; }
/* The selected cell stays visible behind the cat, including on a home tile. */
html[data-theme] .cell { position: relative; }
.cell-selection {
  position: absolute; inset: 2px; z-index: 4; border-radius: 9px;
  border: 3px solid #ffc54d; background: #ffd66630; opacity: 0;
  box-shadow: inset 0 0 0 2px #fff9dc, inset 0 0 14px #ffc54d77;
  pointer-events: none;
}
.selected-cell .cell-selection { opacity: 1; }
html[data-theme] .home-animating .cat-home { visibility: hidden; }
html[data-theme] .home-animating.home-cell:after { opacity: 0; }

/* Preview is an overlay: the real cats and board state remain untouched. */
#hint-guide { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.hint-origin, .hint-landing, .hint-ghost, .hint-arrow { position: absolute; pointer-events: none; }
.hint-origin { border: 3px dashed #fff5c2; border-radius: 12%; box-shadow: inset 0 0 0 2px #a56d26; }
.hint-landing {
  border: 3px dashed #32b7a4; border-radius: 12%; background: #b2ffe145;
  box-shadow: inset 0 0 0 2px #fffce2; animation: hint-landing-pulse 2.6s ease-in-out infinite;
}
.hint-landing.hint-primary { border-color: #fff4a1; background: #ffe8a64a; box-shadow: inset 0 0 0 2px #a56d26; }
.hint-landing small {
  position: absolute; bottom: 2px; left: 50%; translate: -50% 0; z-index: 2;
  padding: 2px 5px; border-radius: 9px; background: #fff8d6; color: #684712;
  font-size: clamp(9px, calc(var(--stage-width) * .023), 12px); font-weight: 900; white-space: nowrap;
}
.hint-ghost { opacity: .7; z-index: 1; }
.hint-ghost .cat-sprite {
  position: absolute; width: 104%; height: 104%; left: -2%; bottom: 0;
  filter: drop-shadow(0 0 5px #fff9c4); opacity: .65;
}
.hint-slide { animation: hint-cat-slide 2.6s ease-in-out infinite; }
.hint-jump { animation: hint-cat-jump 2.6s ease-in-out infinite; }
.hint-arrow { z-index: 3; translate: -50% -50%; rotate: var(--hint-angle); }
.hint-arrow svg { width: 100%; height: 100%; overflow: visible; animation: hint-arrow-cue 2.6s ease-in-out infinite; }
.hint-arrow path { fill: none; stroke: #fff4a1; stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; }
.hint-arrow path.hint-arrow-shadow { stroke: #775015; stroke-width: 16; }
@keyframes hint-cat-slide {
  0%, 12% { transform: none; opacity: 0; }
  22% { transform: none; opacity: .8; }
  60%, 76% { transform: translate(var(--hint-dx), var(--hint-dy)); opacity: .8; }
  90%, 100% { transform: translate(var(--hint-dx), var(--hint-dy)); opacity: 0; }
}
@keyframes hint-cat-jump {
  0%, 12% { transform: none; opacity: 0; }
  22% { transform: none; opacity: .8; }
  40% { transform: none; opacity: 0; }
  41%, 50% { transform: translate(var(--hint-dx), var(--hint-dy)); opacity: 0; }
  60%, 76% { transform: translate(var(--hint-dx), var(--hint-dy)); opacity: .8; }
  90%, 100% { transform: translate(var(--hint-dx), var(--hint-dy)); opacity: 0; }
}
@keyframes hint-arrow-cue { 0%, 100% { transform: translateX(-5%); } 50% { transform: translateX(5%); } }
@keyframes hint-landing-pulse { 0%, 100% { background-color: #ffe8a625; } 60% { background-color: #ffe8a680; } }
html[data-theme] .level-node.perfect .level-disc { border-color: #e6b13f; box-shadow: 0 0 0 3px #fff0b9, 0 4px 0 #ac8535; }
html[data-theme] .level-crown {
  left: calc(50% + 9px); top: -18px; rotate: 9deg; display: flex;
  align-items: center; gap: 2px; padding: 3px 6px; border: 2px solid #fff5ce;
  border-radius: 12px; background: linear-gradient(135deg, #fff2b7, #ffd365);
  box-shadow: 0 2px 0 #bc8d30, 0 2px 8px #c4933255; color: #8a580e;
}
html[data-theme] .level-crown .icon { width: 22px; height: 22px; fill: #edb843; }
html[data-theme] .level-crown small { position: static; translate: none; white-space: nowrap; font-size: 10px; font-weight: 900; color: #80520d; }
html[data-paused="true"] #hint-guide * { animation-play-state: paused; }
html[data-motion="off"] #hint-guide * { animation: none; }
html[data-motion="off"] #hint-guide .hint-ghost { transform: translate(var(--hint-dx), var(--hint-dy)); opacity: .65; }
@keyframes celebration-arrive { from { opacity: 0; transform: translateY(12px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes perfect-halo { from { opacity: .85; transform: scale(.84); } to { opacity: 0; transform: scale(1.22); } }
html[data-motion="off"] .scoreboard-tick,
html[data-motion="off"] .celebration-banner,
html[data-motion="off"] .celebration-banner:before { animation: none; }
html[data-motion="off"] .confetti { display: none; }
html[data-motion="off"] #move-delta.step-feedback { animation: step-still .9s linear; }
@keyframes step-still { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .scoreboard-tick, .celebration-banner, .celebration-banner:before { animation: none; }
  .confetti { display: none; }
  #move-delta.step-feedback { animation: step-still .9s linear; }
  #hint-guide * { animation: none; }
  #hint-guide .hint-ghost { transform: translate(var(--hint-dx), var(--hint-dy)); opacity: .65; }
}
