/* High Striker score reveal — full-screen overlay, scoped under .mks */
body.mks-open { overflow: hidden; }

.mks {
  --tower-h: clamp(260px, calc(100dvh - 250px), 560px);
  --hw: 208px;
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f6ecd6;
  font-family: var(--body-font);
  background: linear-gradient(to bottom, #0b1030 0%, #22194a 55%, #4a2a52 100%);
  color-scheme: dark;
}
@media (max-width: 480px) { .mks { --hw: 168px; } }

.mks-top {
  position: relative;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
}
.mks-brand h2 {
  margin: 0;
  font-family: var(--title-font);
  font-size: clamp(1.15rem, 3.4vw, 1.6rem);
  color: #ffd76a;
  text-shadow: 0 2px 10px rgba(255, 190, 70, 0.35);
}
.mks-brand p {
  margin: 2px 0 0;
  font: 600 0.78rem var(--head-font);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #c9b6e8;
}
.mks-controls { display: flex; gap: 8px; }
.mks-chip {
  font: 600 0.85rem var(--head-font);
  color: #ffd76a;
  background: rgba(20, 12, 40, 0.7);
  border: 1px solid rgba(255, 215, 106, 0.55);
  border-radius: 999px;
  padding: 0.5em 1em;
  cursor: pointer;
}
.mks-chip:hover:not(:disabled) { background: rgba(60, 40, 90, 0.85); }
.mks-chip:disabled { opacity: 0.35; cursor: default; }
.mks-chip[aria-pressed="false"] { color: #9b8fb5; border-color: rgba(155, 143, 181, 0.5); }

.mks-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
}
.mks-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 90px 80px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 160px 20px, #ffe9b0, transparent),
    radial-gradient(1px 1px at 130px 150px, #fff, transparent),
    radial-gradient(1px 1px at 40px 170px, #cfd8ff, transparent),
    radial-gradient(1.5px 1.5px at 190px 120px, #fff, transparent);
  background-size: 210px 200px;
  animation: mks-twinkle 4s ease-in-out infinite alternate;
}
@keyframes mks-twinkle { from { opacity: 0.55; } to { opacity: 1; } }
.mks-moon {
  position: absolute;
  top: 6%;
  right: 9%;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffbe6, #f1dfa6 60%, #d9c27f);
  box-shadow: 0 0 40px 10px rgba(255, 240, 190, 0.25);
}
.mks-castle { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 34%; pointer-events: none; }

/* Machine */
.mks .machine { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; width: 260px; }
.mks .machine.shake { animation: mks-shake 0.38s cubic-bezier(.36,.07,.19,.97); }
@keyframes mks-shake {
  10%, 90% { transform: translate(-2px, 1px); }
  20%, 80% { transform: translate(4px, -2px); }
  30%, 50%, 70% { transform: translate(-6px, 2px); }
  40%, 60% { transform: translate(6px, -1px); }
}
.mks .bell-wrap { position: relative; width: 130px; height: 82px; }
.mks .beam {
  position: absolute;
  top: 8px; left: 0; right: 0;
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(#8a5a2e, #3a2410);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}
.mks .flag {
  position: absolute;
  top: -14px;
  width: 26px;
  height: 16px;
  background: #c7352b;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  transform-origin: left center;
  animation: mks-flutter 1.6s ease-in-out infinite;
}
.mks .flag.l { left: 4px; }
.mks .flag.r { right: -18px; background: #2f6fd1; animation-delay: -0.8s; }
@keyframes mks-flutter { 50% { transform: skewY(-8deg) scaleX(0.9); } }
.mks .bell {
  position: absolute;
  top: 20px;
  left: 50%;
  width: 58px;
  height: 52px;
  margin-left: -29px;
  transform-origin: 50% 0;
}
.mks .bell::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 14% 14% / 72% 72% 16% 16%;
  background: radial-gradient(circle at 35% 30%, #fff4c2, #f0bf3d 45%, #a8700f 100%);
  box-shadow: inset -6px -6px 12px rgba(80, 45, 0, 0.45);
}
.mks .bell::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: #8a5a12;
}
.mks .bell[data-state="ring"] { animation: mks-ring 1.6s ease-out; }
.mks .bell[data-state="ring"], .mks .bell[data-state="glow"] { filter: drop-shadow(0 0 16px rgba(255, 215, 106, 0.95)); }
@keyframes mks-ring {
  10% { transform: rotate(24deg); }
  25% { transform: rotate(-20deg); }
  40% { transform: rotate(14deg); }
  55% { transform: rotate(-9deg); }
  70% { transform: rotate(5deg); }
  85% { transform: rotate(-2deg); }
}
.mks .tower {
  width: 100px;
  padding: 10px 12px 18px;
  border: 5px solid #3a2410;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 9px),
    linear-gradient(90deg, #5a3519, #8a5a2e 50%, #5a3519);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.mks .track { position: relative; height: var(--tower-h); border-radius: 4px; background: #1a110a; box-shadow: inset 0 0 0 2px #2a1a0d; }
.mks .cells { position: absolute; inset: 0; display: flex; flex-direction: column-reverse; gap: 3px; }
.mks .cell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  border: 1px solid #4b3220;
  background: #2b1c10;
  font: 700 clamp(0.6rem, 1.6vh, 0.75rem) var(--head-font);
  color: #7a5a3a;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.mks .cell.lit {
  background: hsl(var(--h) 95% 58%);
  border-color: hsl(var(--h) 100% 75%);
  color: #3a1e00;
  box-shadow: 0 0 12px hsl(var(--h) 100% 60% / 0.85);
}
.mks .cell.flash { animation: mks-cellflash 0.35s ease-out; }
@keyframes mks-cellflash { 0% { filter: brightness(2); transform: scaleX(1.12); } }
.mks .trail {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 1;
  width: 12px;
  height: calc(var(--p, 0) * 5%);
  transform: translateX(-50%);
  border-radius: 6px;
  background: linear-gradient(to top, rgba(255, 215, 106, 0), rgba(255, 236, 170, 0.85));
  opacity: 0;
  transition: opacity 0.5s;
}
.mks .orb {
  position: absolute;
  left: 50%;
  bottom: calc(var(--p, 0) * 5%);
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  transform: translate(-50%, 50%);
  background: radial-gradient(circle at 40% 35%, #fff, #ffe08a 35%, #f0a722 70%, #c26d08);
  box-shadow: 0 0 18px 7px rgba(255, 200, 80, 0.85), 0 0 40px 14px rgba(255, 170, 40, 0.35);
  opacity: 0;
  transition: opacity 0.4s, width 0.3s, height 0.3s;
}
.mks .track.live .orb, .mks .track.live .trail { opacity: 1; }
.mks .track.settled .trail { opacity: 0; }
.mks .track.settled .orb { width: 20px; height: 20px; }
.mks .track.fizzled .orb, .mks .track.gone .orb { opacity: 0; }
.mks .base {
  width: 250px;
  height: 46px;
  border-radius: 6px 6px 2px 2px;
  background:
    repeating-linear-gradient(90deg, transparent 0 48px, rgba(0, 0, 0, 0.25) 48px 50px),
    linear-gradient(#8d8a98, #57546a);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}
.mks .pad {
  position: absolute;
  bottom: 46px;
  left: 50%;
  z-index: 3;
  width: 84px;
  height: 14px;
  margin-left: -42px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(#e2564a, #8f1f17);
  box-shadow: 0 0 0 2px #3a0d09;
  transform-origin: 50% 100%;
  transition: transform 0.12s;
}
.mks .pad.hit { transform: scaleY(0.45); }
.mks .hammer {
  position: absolute;
  bottom: 60px;
  left: calc(50% - var(--hw) * 0.1394);
  z-index: 4;
  width: var(--hw);
  aspect-ratio: 208 / 56;
  transform-origin: 100% 50%;
  transform: rotate(35deg);
  transition: transform 0.6s cubic-bezier(.3,.7,.4,1);
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.45));
}
.mks .hammer svg { display: block; width: 100%; height: 100%; }
.mks .hammer[data-pose="windup"] { transform: rotate(82deg); transition: transform 0.5s cubic-bezier(.2,.8,.3,1); }
.mks .hammer[data-pose="strike"] { transform: rotate(-1deg); transition: transform 0.12s cubic-bezier(.7,0,1,.6); }

/* Result card */
.mks .veil {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: radial-gradient(ellipse at center, rgba(10, 6, 25, 0.55), rgba(10, 6, 25, 0.8));
  animation: mks-fade 0.4s ease-out;
}
@keyframes mks-fade { from { opacity: 0; } }
.mks .result {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  width: min(calc(100% - 32px), 440px);
  max-height: calc(100% - 24px);
  overflow-y: auto;
  transform: translate(-50%, -50%);
  padding: 22px 24px 18px;
  text-align: center;
  color: #4a240a;
  border-radius: 14px;
  background: radial-gradient(ellipse at 50% 20%, #fbf1d3, #f4e4bc 60%, #e3cb93);
  border: 3px double #a0702a;
  box-shadow: 0 0 0 6px rgba(60, 30, 5, 0.6), 0 24px 60px rgba(0, 0, 0, 0.6);
}
.mks .r-label { margin: 0; font: 700 0.75rem var(--head-font); letter-spacing: 0.25em; text-transform: uppercase; color: #8b5a1f; }
.mks .r-score { position: relative; z-index: 2; margin: 4px 0 2px; font-family: var(--title-font); font-size: clamp(3.4rem, 15vw, 5.2rem); line-height: 1.05; color: #5a2d0c; }
.mks .r-score small { font-size: 0.55em; color: #8b5a1f; }
.mks .result.perfect .r-score {
  background: linear-gradient(180deg, #ffe58a, #e3a020 55%, #a8650a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 #5a2d0c);
}
.mks .result.perfect .r-score small { color: transparent; }
.mks .r-emblem {
  width: 58px;
  height: 58px;
  margin: 6px auto 4px;
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  font-variant-emoji: text;
  color: #fff3c4;
  background: radial-gradient(circle at 40% 35%, #c9532f, #7a1d14);
  clip-path: polygon(50% 0, 100% 18%, 92% 70%, 50% 100%, 8% 70%, 0 18%);
}
.mks .r-title { margin: 6px 0 4px; font: 700 1.35rem var(--head-font); color: #6b2f0a; }
.mks .r-msg { margin: 0 auto 16px; max-width: 32ch; font-size: 0.98rem; line-height: 1.45; color: #5b3a1c; }
.mks .r-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.mks .r-btn {
  font: 700 0.9rem var(--head-font);
  border-radius: 999px;
  padding: 0.7em 1.4em;
  cursor: pointer;
  border: 2px solid #7a4a12;
}
.mks .r-btn.primary { color: #fff6da; background: linear-gradient(#b5651d, #7a3a0c); }
.mks .r-btn.primary:hover { background: linear-gradient(#c87425, #8a440f); }
.mks .r-btn.ghost { color: #7a3a0c; background: transparent; }
.mks .r-btn.ghost:hover { background: rgba(122, 58, 12, 0.1); }
.mks .countdown { margin-top: 14px; height: 4px; border-radius: 2px; overflow: hidden; background: rgba(90, 45, 12, 0.15); }
.mks .countdown i { display: block; width: 0; height: 100%; background: #8b5a1f; }
.mks .countdown.run i { animation: mks-fill var(--dur, 8s) linear forwards; }
.mks .result:hover .countdown i, .mks .result:focus-within .countdown i { animation-play-state: paused; }
@keyframes mks-fill { to { width: 100%; } }
.mks .countdown-note { margin: 6px 0 0; font-size: 0.72rem; color: #8b6a44; }

.mks .result.animate { animation: mks-cardIn 0.45s cubic-bezier(.2,1.4,.4,1) both; }
.mks .result.animate .r-score { animation: mks-scorePop 0.7s cubic-bezier(.2,1.6,.4,1) 0.1s both; }
.mks .result.animate .r-emblem { animation: mks-rise 0.5s ease-out 0.55s both; }
.mks .result.animate .r-title { animation: mks-rise 0.5s ease-out 0.75s both; }
.mks .result.animate .r-msg { animation: mks-rise 0.5s ease-out 0.95s both; }
.mks .result.animate .r-actions,
.mks .result.animate .countdown,
.mks .result.animate .countdown-note { animation: mks-rise 0.5s ease-out 1.2s both; }
.mks .result.animate.perfect .r-emblem { animation-delay: 1.9s; }
.mks .result.animate.perfect .r-title { animation-delay: 2.1s; }
.mks .result.animate.perfect .r-msg { animation-delay: 2.3s; }
.mks .result.animate.perfect .r-actions,
.mks .result.animate.perfect .countdown,
.mks .result.animate.perfect .countdown-note { animation-delay: 2.6s; }
@keyframes mks-cardIn { from { opacity: 0; transform: translate(-50%, -46%) scale(0.9); } }
@keyframes mks-scorePop { 0% { opacity: 0; transform: scale(0.2); } 60% { opacity: 1; transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes mks-rise { from { opacity: 0; transform: translateY(12px); } }

/* Treasure chest (20 / 20 only) */
.mks .chest { position: relative; width: 150px; height: 118px; margin: 34px auto 0; } /* room for the lid when it opens */
.mks .chest svg { position: relative; z-index: 1; display: block; width: 100%; height: 100%; overflow: visible; }
.mks .chest .lid { transform-box: fill-box; transform-origin: 0% 100%; transition: transform 0.6s cubic-bezier(.3,1.5,.5,1); }
.mks .chest.open .lid { transform: translate(-6px, -18px) rotate(-28deg); }
.mks .rays {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 280px;
  height: 280px;
  margin: -140px 0 0 -140px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 220, 110, 0.65) 0 10deg, transparent 10deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 70%);
  mask: radial-gradient(circle, #000 20%, transparent 70%);
  opacity: 0;
  transform: scale(0.3);
  transition: opacity 0.5s, transform 0.6s;
}
.mks .chest.open .rays { opacity: 1; transform: scale(1); animation: mks-spin 9s linear infinite; }
@keyframes mks-spin { to { rotate: 360deg; } }

.mks-fx { position: fixed; inset: 0; z-index: 1001; width: 100%; height: 100%; pointer-events: none; }
