/* =========================================================
   TIMBANGAN AJAIB RAJA — stylesheet
   Palet: emas kerajaan, ungu tua, marun, krem.
   ========================================================= */

@font-face {
  font-family: "Fredoka";
  src: url("../assets/fonts/fredoka-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("../assets/fonts/nunito-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --purple-950: #15081f;
  --purple-900: #1e0c2a;
  --purple-800: #2b123a;
  --purple-700: #3b1a4d;
  --purple-600: #4a235a;
  --plum: #5d2a5f;
  --maroon: #6b1f2a;
  --maroon-deep: #45101a;
  --gold: #f5b041;
  --gold-light: #ffe29a;
  --gold-pale: #fff3cf;
  --gold-dark: #8a5a00;
  --gold-deep: #5c3a00;
  --cream: #fff8e7;
  --cream-2: #f9eacb;
  --parchment: #fff3d8;
  --ink: #2e1a12;
  --ink-soft: #684c3a;
  --green: #2ecc71;
  --green-dark: #147a44;
  --green-pale: #d8f7e5;
  --red: #d95050;
  --red-dark: #8e2a2a;
  --silver: #dbe2e8;
  --silver-dark: #8492a0;
  --font-display: "Fredoka", "Trebuchet MS", sans-serif;
  --font-body: "Nunito", "Segoe UI", sans-serif;
  --shadow-lg: 0 24px 60px rgba(6, 2, 10, 0.55);
  --shadow-md: 0 14px 30px rgba(6, 2, 10, 0.4);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--purple-950);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--cream);
  background: var(--purple-950);
  font-family: var(--font-body);
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

strong {
  font-weight: 800;
}

::selection {
  color: var(--ink);
  background: var(--gold);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}

/* ============================ BACKGROUND ============================ */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(245, 176, 65, 0.16), transparent 42%),
    radial-gradient(ellipse at 50% 105%, rgba(107, 31, 42, 0.55), transparent 55%),
    linear-gradient(170deg, #331540 0%, #24102f 42%, #15081f 100%);
}

.bg-arches {
  position: absolute;
  inset: 4% 7% 16%;
  border: 2px solid rgba(245, 176, 65, 0.1);
  border-radius: 46% 46% 0 0 / 26% 26% 0 0;
  box-shadow:
    inset 0 0 0 18px rgba(245, 176, 65, 0.028),
    inset 0 0 0 20px rgba(245, 176, 65, 0.07),
    0 0 80px rgba(245, 176, 65, 0.04);
}

.bg-arches::before,
.bg-arches::after {
  content: "";
  position: absolute;
  background: linear-gradient(180deg, rgba(245, 176, 65, 0.08), transparent);
  width: 1px;
  top: 4%;
  bottom: 0;
}
.bg-arches::before { left: 18%; }
.bg-arches::after { right: 18%; }

.bg-column {
  position: absolute;
  top: 8%;
  bottom: 7%;
  width: clamp(48px, 6vw, 92px);
  background:
    linear-gradient(90deg, rgba(0,0,0,.28), transparent 28%, rgba(255,255,255,.06) 48%, transparent 72%, rgba(0,0,0,.3)),
    linear-gradient(180deg, #3c1a48, #271132 50%, #1d0c27);
  border: 1px solid rgba(245, 176, 65, 0.14);
  box-shadow: inset 0 0 30px rgba(0,0,0,.45), 0 0 40px rgba(0,0,0,.2);
}
.bg-column-l { left: 2.4%; }
.bg-column-r { right: 2.4%; }
.bg-column::before,
.bg-column::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  height: 12px;
  background: linear-gradient(180deg, #8a5a00, #f5b041 45%, #7a4d00);
  border-radius: 3px;
  opacity: 0.55;
}
.bg-column::before { top: 4%; }
.bg-column::after { bottom: 3%; }
.col-cap {
  position: absolute;
  left: -18%;
  right: -18%;
  top: -14px;
  height: 26px;
  background: linear-gradient(180deg, #a16a0b, #5a3500);
  border: 1px solid rgba(255, 226, 154, 0.3);
  border-radius: 4px;
}

.bg-banner {
  position: absolute;
  top: -2%;
  width: clamp(70px, 8vw, 128px);
  height: clamp(180px, 27vh, 300px);
  background:
    linear-gradient(180deg, rgba(245, 176, 65, 0.95) 0 6px, transparent 6px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 1px, transparent 1px 12px),
    linear-gradient(180deg, #78281f, #52141d 70%, #3d0d17);
  clip-path: polygon(0 0, 100% 0, 100% 86%, 50% 100%, 0 86%);
  box-shadow: inset 0 0 30px rgba(0,0,0,.5);
  opacity: 0.65;
}
.banner-l { left: 10%; }
.banner-r { right: 10%; }
.bg-banner::before {
  content: "✦";
  position: absolute;
  top: 24%;
  left: 50%;
  transform: translateX(-50%);
  color: var(--gold);
  font-size: clamp(16px, 2vw, 26px);
  text-shadow: 0 0 16px rgba(245,176,65,.4);
}

.bg-rays {
  position: absolute;
  left: 50%;
  top: -30%;
  width: 150vmax;
  height: 120vmax;
  transform: translateX(-50%);
  background: conic-gradient(
    from 180deg at 50% 45%,
    transparent 0deg,
    rgba(245, 176, 65, 0.045) 8deg,
    transparent 17deg,
    transparent 26deg,
    rgba(255, 226, 154, 0.035) 34deg,
    transparent 43deg,
    transparent 54deg,
    rgba(245, 176, 65, 0.03) 62deg,
    transparent 72deg
  );
  opacity: 0.85;
  animation: raysDrift 44s linear infinite;
  pointer-events: none;
}

.bg-carpet {
  position: absolute;
  left: -6%;
  right: -6%;
  bottom: -1%;
  height: 27vh;
  background:
    linear-gradient(90deg, transparent 2.8%, rgba(245,176,65,.5) 3%, transparent 3.4%),
    linear-gradient(90deg, transparent 96.6%, rgba(245,176,65,.5) 97%, transparent 97.4%),
    radial-gradient(ellipse at 50% 100%, rgba(245,176,65,.12), transparent 55%),
    repeating-linear-gradient(90deg, rgba(255, 226, 154, 0.035) 0 2px, transparent 2px 46px),
    linear-gradient(180deg, #4b111c, #6b1f2a 40%, #3d0d17);
  clip-path: polygon(7% 0, 93% 0, 100% 100%, 0 100%);
  box-shadow: 0 -25px 60px rgba(0,0,0,.3);
}
.bg-carpet::before,
.bg-carpet::after {
  content: "";
  position: absolute;
  top: 6%;
  bottom: 0;
  width: 12px;
  background: linear-gradient(180deg, rgba(245,176,65,.85), rgba(138,90,0,.3));
  opacity: 0.4;
}
.bg-carpet::before { left: 15%; transform: skewX(5deg); }
.bg-carpet::after { right: 15%; transform: skewX(-5deg); }

.bg-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 44%, transparent 35%, rgba(9, 3, 15, 0.45) 78%, rgba(9, 3, 15, 0.8) 100%),
    linear-gradient(180deg, rgba(9, 3, 15, 0.2), transparent 25%, transparent 75%, rgba(9, 3, 15, 0.35));
  pointer-events: none;
}

.bg-noise {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  pointer-events: none;
}

.motes {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ============================ SCREENS ============================ */

.screen {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.36s ease, visibility 0.36s ease;
}
.screen.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.title-screen,
.victory-screen {
  overflow-y: auto;
  overflow-x: hidden;
}
.game-screen {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--gold-light);
  font-family: var(--font-body);
  font-size: clamp(10px, 1.05vw, 13px);
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.9;
}
.kicker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
  flex: none;
}

/* ============================ BUTTONS ============================ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border: 2px solid var(--gold-dark);
  border-radius: 14px;
  color: #3a2106;
  background: linear-gradient(180deg, #fff0b5 0%, #ffd568 28%, #f5b041 62%, #dfa02c 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    0 5px 0 #7a4d00,
    0 12px 22px rgba(0, 0, 0, 0.28);
  font-family: var(--font-display);
  font-size: clamp(15px, 1.25vw, 19px);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn-primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(3px);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.4), 0 2px 0 #7a4d00;
}
.btn-primary:disabled {
  opacity: 0.45;
  filter: saturate(0.4);
  transform: none;
  box-shadow: none;
  cursor: not-allowed;
}
.btn-scale {
  width: 24px;
  height: 24px;
  flex: none;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid rgba(245, 176, 65, 0.42);
  border-radius: 12px;
  color: var(--gold-light);
  background: rgba(255, 255, 255, 0.045);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.btn-ghost:hover {
  background: rgba(245, 176, 65, 0.14);
  border-color: var(--gold);
  transform: translateY(-1px);
}
.ghost-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  padding: 0;
  border: 1px solid rgba(245, 176, 65, 0.28);
  border-radius: 50%;
  color: var(--gold-light);
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.icon-btn:hover {
  background: rgba(245, 176, 65, 0.15);
  border-color: rgba(245, 176, 65, 0.65);
  transform: translateY(-1px);
}
.icon-btn svg {
  width: 22px;
  height: 22px;
}
.icon-glyph {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1;
}
.icon-btn .slash { opacity: 0; transition: opacity .15s ease; }
.icon-btn.is-muted .wave { opacity: 0; }
.icon-btn.is-muted .slash { opacity: 1; }
.icon-btn.is-muted { color: rgba(255, 248, 231, 0.5); }

/* ============================ TITLE ============================ */

.title-wrap {
  position: relative;
  z-index: 3;
  width: min(1210px, 100% - clamp(28px, 6vw, 80px));
  min-height: 100%;
  margin: 0 auto;
  padding: 18px 0 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 248, 231, 0.74);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--gold);
  border: 1px solid rgba(245, 176, 65, 0.4);
  border-radius: 50%;
  background: rgba(36, 16, 47, 0.55);
}
.brand-mark svg { width: 20px; height: 20px; }

.title-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(320px, 0.94fr);
  align-items: center;
  gap: clamp(16px, 4vw, 60px);
  flex: 1;
  padding: clamp(8px, 2vh, 26px) 0 clamp(6px, 2vh, 24px);
}

.title-copy {
  position: relative;
  z-index: 4;
  max-width: 660px;
}

.title-copy > * {
  opacity: 0;
}
.title-screen.is-active .title-copy > * {
  animation: titleRise 0.8s var(--ease-spring) both;
}
.title-screen.is-active .title-copy > *:nth-child(1) { animation-delay: 0.04s; }
.title-screen.is-active .title-copy > *:nth-child(2) { animation-delay: 0.1s; }
.title-screen.is-active .title-copy > *:nth-child(3) { animation-delay: 0.16s; }
.title-screen.is-active .title-copy > *:nth-child(4) { animation-delay: 0.22s; }
.title-screen.is-active .title-copy > *:nth-child(5) { animation-delay: 0.28s; }

.title-copy h1 {
  margin: 10px 0 2px;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 0.86;
  letter-spacing: -0.015em;
}
.title-sm {
  display: block;
  color: var(--cream);
  font-size: clamp(40px, 5.3vw, 76px);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}
.title-lg {
  display: block;
  margin-top: 4px;
  padding: 0 0 8px;
  color: var(--gold);
  background: linear-gradient(180deg, #fff6c9 0%, #ffe29a 24%, #ffd05a 46%, #f5b041 65%, #b9770e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: clamp(62px, 8.4vw, 124px);
  font-weight: 600;
  filter:
    drop-shadow(0 3px 0 rgba(92, 58, 0, 0.55))
    drop-shadow(0 14px 26px rgba(0, 0, 0, 0.4));
}

.title-flourish {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(360px, 80%);
  margin: 8px 0 18px;
  color: var(--gold);
  opacity: 0.72;
}
.title-flourish span {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 176, 65, 0.65));
}
.title-flourish span:last-child {
  background: linear-gradient(90deg, rgba(245, 176, 65, 0.65), transparent);
}
.title-flourish svg { width: 34px; height: 24px; flex: none; }

.title-sub {
  max-width: 520px;
  color: rgba(255, 248, 231, 0.84);
  font-size: clamp(15px, 1.35vw, 19px);
  line-height: 1.62;
}
.title-sub strong {
  color: var(--gold-light);
}

.title-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.title-badges span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid rgba(245, 176, 65, 0.22);
  border-radius: 999px;
  color: rgba(255, 248, 231, 0.75);
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
}
.title-badges b {
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}

/* Vault stage on title */
.vault-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 520px;
  padding-bottom: 6px;
  z-index: 3;
}
.vault-stage-glow {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 115%;
  height: 60%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(245, 176, 65, 0.22), transparent 62%);
  filter: blur(14px);
  pointer-events: none;
}
.vault-slot {
  position: relative;
  width: min(372px, 80%);
  z-index: 2;
}
.title-cat {
  position: absolute;
  left: 0;
  bottom: 6px;
  width: clamp(120px, 13vw, 168px);
  z-index: 5;
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.45));
}
.title-bubble {
  position: absolute;
  left: 40%;
  bottom: 26%;
  width: min(230px, 46%);
  z-index: 6;
}

.speech-bubble {
  position: relative;
  padding: 10px 14px 11px;
  border: 2px solid var(--gold-dark);
  border-radius: 16px;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fffaf0, #fbeccd);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3), inset 0 1px 0 #fff;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}
.speech-bubble::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: -10px;
  width: 16px;
  height: 16px;
  border-right: 2px solid var(--gold-dark);
  border-bottom: 2px solid var(--gold-dark);
  background: #fbeccd;
  transform: rotate(45deg);
}
.bubble-name {
  display: block;
  margin-bottom: 2px;
  color: var(--gold-dark);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* Vault */
.vault {
  position: relative;
  width: 100%;
  aspect-ratio: 360 / 540;
  filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.48));
}
.vault-light {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 11%;
  bottom: 8%;
  border-radius: 48% 48% 6% 6% / 34% 34% 4% 4%;
  background:
    radial-gradient(ellipse at 50% 74%, #fff7cf 0%, #ffd86f 24%, rgba(245, 176, 65, 0.45) 48%, transparent 72%),
    linear-gradient(180deg, rgba(255, 232, 155, 0.4), rgba(107, 31, 42, 0.2));
  opacity: 0.48;
  filter: blur(4px);
  z-index: 1;
  transition: opacity 1.2s ease 0.7s;
}
.vault.is-open .vault-light { opacity: 1; }

.vault-treasure {
  position: absolute;
  left: 13%;
  right: 13%;
  bottom: 9%;
  height: 42%;
  z-index: 1;
  opacity: 0;
  transform: translateY(12px) scale(0.92);
  transition: opacity 0.9s ease 0.85s, transform 1.1s var(--ease-spring) 0.85s;
}
.vault.is-open .vault-treasure {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.treasure-crown {
  position: absolute;
  left: 50%;
  bottom: 40%;
  width: 110px;
  height: 72px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #fff0a8, #f5b041 45%, #b9770e);
  clip-path: polygon(0 100%, 4% 28%, 27% 58%, 50% 0, 73% 58%, 96% 28%, 100% 100%);
  filter: drop-shadow(0 0 16px rgba(255, 226, 154, 0.6));
}
.treasure-crown span {
  position: absolute;
  bottom: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d84d67;
  box-shadow: 0 0 8px #ff8aa2;
}
.treasure-crown span:nth-child(1) { left: 26%; }
.treasure-crown span:nth-child(2) { left: 46%; background: #2ecc71; box-shadow: 0 0 8px #6fffa7; }
.treasure-crown span:nth-child(3) { right: 26%; background: #8e6bff; box-shadow: 0 0 8px #b9a6ff; }
.treasure-coins {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 62%;
}
.tcoin {
  position: absolute;
  left: 50%;
  bottom: calc(30% + var(--y));
  width: 40px;
  height: 24px;
  margin-left: var(--x);
  border-radius: 50%;
  border: 2px solid #8a5a00;
  background: radial-gradient(ellipse at 40% 30%, #fff6c9, #ffd25a 46%, #d9960f 78%);
  box-shadow: 0 3px 0 #8a5a00, 0 0 12px rgba(255, 210, 90, 0.4);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity .3s ease var(--d), transform .5s var(--ease-spring) var(--d);
}
.vault.is-open .tcoin { opacity: 1; transform: scale(1); }
.treasure-gems { position: absolute; inset: 0; }
.tgem {
  position: absolute;
  width: 20px;
  height: 20px;
  transform: rotate(45deg);
  border: 2px solid rgba(255, 248, 231, 0.55);
  box-shadow: 0 0 18px currentColor;
  opacity: 0;
  transition: opacity .6s ease 1.15s, transform .6s var(--ease-spring) 1.15s;
}
.vault.is-open .tgem { opacity: 1; transform: rotate(45deg) scale(1); }
.gem-a { left: 16%; bottom: 42%; color: #4de2a1; background: #20b878; }
.gem-b { right: 14%; bottom: 30%; color: #ff8aa2; background: #d84d67; }
.gem-c { left: 30%; bottom: 20%; color: #b9a6ff; background: #8e6bff; }
.treasure-ray {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 80%;
  height: 110%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 80%, rgba(255, 246, 200, 0.45), transparent 66%);
  filter: blur(8px);
}

.vault-frame {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 47% 47% 7% 7% / 33% 33% 5% 5%;
  background: transparent;
}
.vault-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 15px;
  background:
    linear-gradient(100deg, #8a5a00 0%, #ffe29a 13%, #f5b041 30%, #a16a0b 48%, #ffd76b 62%, #b9770e 80%, #5c3a00 100%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  box-shadow: inset 0 0 0 1px rgba(92, 58, 0, 0.5);
  pointer-events: none;
}
.vault-frame::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 47% 47% 7% 7% / 33% 33% 5% 5%;
  border: 2px solid rgba(255, 240, 181, 0.32);
  pointer-events: none;
}

.vault-door {
  position: absolute;
  inset: 17px;
  border-radius: 46% 46% 5% 5% / 33% 33% 4% 4%;
  overflow: hidden;
  display: flex;
  perspective: 1200px;
  z-index: 1;
}
.vault-half {
  position: relative;
  width: 50%;
  height: 100%;
  background:
    linear-gradient(103deg, rgba(255, 255, 255, 0.06), transparent 28%),
    radial-gradient(ellipse at 30% 20%, rgba(142, 68, 173, 0.22), transparent 50%),
    linear-gradient(180deg, #3f1b4d 0%, #2b1137 45%, #34152f 100%);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
  transition: transform 1.65s cubic-bezier(0.66, 0, 0.34, 1) 0.55s, filter 1.3s ease 0.55s;
  will-change: transform;
}
.half-left {
  border-right: 2px solid rgba(255, 226, 154, 0.35);
  box-shadow: inset -14px 0 30px rgba(0, 0, 0, 0.35), inset 0 0 40px rgba(0, 0, 0, 0.5);
}
.half-right {
  border-left: 2px solid rgba(255, 226, 154, 0.35);
  box-shadow: inset 14px 0 30px rgba(0, 0, 0, 0.35), inset 0 0 40px rgba(0, 0, 0, 0.5);
}
.vault.is-open .half-left {
  transform: translateX(-104%) rotateY(-8deg);
  filter: brightness(0.7);
}
.vault.is-open .half-right {
  transform: translateX(104%) rotateY(8deg);
  filter: brightness(0.7);
}

.vault-panel {
  position: absolute;
  left: 12%;
  right: 12%;
  border: 2px solid rgba(245, 176, 65, 0.24);
  border-radius: 10px;
  box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.1), inset 0 0 24px rgba(0, 0, 0, 0.22);
}
.vault-panel.p1 { top: 16%; height: 28%; }
.vault-panel.p2 { top: 50%; height: 22%; }
.vault-panel::after {
  content: "✦";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: rgba(245, 176, 65, 0.22);
  font-size: 20px;
}
.vault-rivets {
  position: absolute;
  inset: 7%;
  border: 1px dashed rgba(245, 176, 65, 0.16);
  border-radius: 8px;
  pointer-events: none;
}
.vault-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 57%;
  height: 9px;
  background: linear-gradient(180deg, #5c3a00, #f5b041 40%, #8a5a00);
  opacity: 0.55;
}
.vault-handle {
  position: absolute;
  top: 64%;
  width: 9px;
  height: 20%;
  border-radius: 6px;
  background: linear-gradient(90deg, #6f4600, #ffe29a 45%, #8a5a00);
  box-shadow: 0 0 0 2px rgba(92, 58, 0, 0.35);
}
.half-left .vault-handle { right: 8%; }
.half-right .vault-handle { left: 8%; }

.vault-crest {
  position: absolute;
  left: 50%;
  top: 31%;
  width: 92px;
  height: 92px;
  transform: translate(-50%, -50%);
  z-index: 4;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
  transition: opacity .5s ease, transform .6s var(--ease-spring);
}
.vault-crest svg { width: 100%; height: 100%; }
.vault.is-open .vault-crest {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6) rotate(-15deg);
}

.vault-seals {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 57%;
  height: 42px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 5;
}
.vault-seals::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 7px;
  transform: translateY(-50%);
  border-radius: 4px;
  background: linear-gradient(180deg, #ffe29a, #b9770e);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.seal {
  position: relative;
  width: 23px;
  height: 23px;
  flex: none;
  transform: rotate(45deg);
  border: 2px solid #ffe9ad;
  background: linear-gradient(135deg, #58e6a0, #148f55);
  box-shadow:
    0 0 0 3px #8a5a00,
    0 0 0 4px rgba(255, 240, 181, 0.3),
    0 0 16px rgba(46, 204, 113, 0.65);
  animation: sealPulse 3.6s ease-in-out infinite;
}
.seal.s2 { background: linear-gradient(135deg, #ff9aaa, #b02b4b); box-shadow: 0 0 0 3px #8a5a00, 0 0 0 4px rgba(255,240,181,.3), 0 0 16px rgba(217,80,80,.6); animation-delay: .4s; }
.seal.s3 { background: linear-gradient(135deg, #b9a6ff, #6a44d9); box-shadow: 0 0 0 3px #8a5a00, 0 0 0 4px rgba(255,240,181,.3), 0 0 16px rgba(142,107,255,.6); animation-delay: .8s; }
.seal.s4 { background: linear-gradient(135deg, #ffe29a, #d9960f); box-shadow: 0 0 0 3px #8a5a00, 0 0 0 4px rgba(255,240,181,.3), 0 0 16px rgba(245,176,65,.7); animation-delay: 1.2s; }
.seal.s5 { background: linear-gradient(135deg, #58e6a0, #148f55); animation-delay: 1.6s; }

.vault.is-open .seal {
  animation: sealBurst 0.8s ease forwards;
}
.vault.is-open .seal.s2 { animation-delay: 0.08s; }
.vault.is-open .seal.s3 { animation-delay: 0.16s; }
.vault.is-open .seal.s4 { animation-delay: 0.24s; }
.vault.is-open .seal.s5 { animation-delay: 0.32s; }

.vault-plinth {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -1.4%;
  height: 5%;
  z-index: 3;
  border-radius: 10px 10px 4px 4px;
  background:
    linear-gradient(180deg, #ffe29a, #b9770e 55%, #5c3a00);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.45);
}
.vault-plinth::before {
  content: "";
  position: absolute;
  left: -9%;
  right: -9%;
  top: 38%;
  height: 44%;
  border-radius: 5px;
  background: linear-gradient(180deg, #7a4d00, #f5b041 50%, #5c3a00);
}

/* ============================ SESSION CARDS ============================ */

.session-panel {
  position: relative;
  z-index: 4;
  margin-top: 6px;
  padding: clamp(18px, 2.4vw, 28px);
  border: 1px solid rgba(245, 176, 65, 0.24);
  border-radius: 26px;
  background:
    linear-gradient(150deg, rgba(74, 35, 90, 0.65), rgba(30, 12, 42, 0.88));
  box-shadow: 0 24px 50px rgba(5, 2, 9, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
}
.session-panel::before {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 226, 154, 0.65), transparent);
}
.session-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.session-head h2 {
  margin-top: 4px;
  font-family: var(--font-display);
  color: var(--cream);
  font-size: clamp(22px, 2.3vw, 31px);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.session-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 16px);
}

.session-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 188px;
  padding: 18px 18px 16px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 18px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255,255,255,.85), transparent 46%),
    linear-gradient(160deg, #fffaf0 0%, #faeccd 62%, #f1d8a5 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.65),
    0 6px 0 #8a5a00,
    0 14px 26px rgba(0, 0, 0, 0.28);
  text-align: left;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s ease, border-color 0.2s ease;
}
.session-card::before {
  content: "";
  position: absolute;
  top: -40%;
  left: -50%;
  width: 40%;
  height: 180%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: rotate(20deg);
  transition: left 0.55s ease;
  pointer-events: none;
}
.session-card:hover {
  transform: translateY(-5px);
  border-color: var(--gold-light);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.65),
    0 10px 0 #8a5a00,
    0 24px 34px rgba(0, 0, 0, 0.35),
    0 0 30px rgba(245, 176, 65, 0.18);
}
.session-card:hover::before { left: 120%; }
.session-card:active {
  transform: translateY(1px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.65), 0 3px 0 #8a5a00;
}
.session-card::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(138, 90, 0, 0.16);
  border-radius: 13px;
  pointer-events: none;
}
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.card-grade {
  font-family: var(--font-display);
  color: var(--maroon);
  font-size: clamp(28px, 2.6vw, 37px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}
.card-diff {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #fff8e7;
  background: var(--green-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.card-diff.diff-sedang { background: #b9770e; }
.card-diff.diff-tantangan { background: var(--maroon); }
.card-title {
  margin-top: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}
.card-subjects {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.45;
}
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}
.card-locks {
  display: flex;
  gap: 3px;
}
.card-lock {
  width: 13px;
  height: 11px;
  border-radius: 3px;
  background: #c9a35a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
  position: relative;
}
.card-lock::before {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: -5px;
  height: 6px;
  border: 1.5px solid #a37b2a;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}
.card-play {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--maroon);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
}
.card-play span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--gold-pale);
  background: var(--maroon);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1;
  transition: transform .18s ease;
}
.session-card:hover .card-play span { transform: translateX(3px); }

.session-foot {
  margin-top: 14px;
  color: rgba(255, 248, 231, 0.45);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

.title-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 0 2px;
  color: rgba(255, 248, 231, 0.34);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.foot-gem { color: rgba(245, 176, 65, 0.45); font-size: 8px; }

/* ============================ CAT ============================ */

.cat {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.32));
}
.cat-all {
  transform-origin: 50% 92%;
  animation: catBreathe 4.4s ease-in-out infinite;
}
.cat-shadow { fill: rgba(0, 0, 0, 0.28); }
.cat-tail {
  transform-box: fill-box;
  transform-origin: 10% 92%;
  animation: catTail 5.2s ease-in-out infinite;
}
.cat-ear { transform-box: fill-box; transform-origin: 50% 100%; }
.cat-ear.ear-left { animation: catEarL 7s ease-in-out infinite; }
.cat-ear.ear-right { animation: catEarR 7s ease-in-out infinite; }
.eye-happy,
.mouth-flat,
.mouth-oops,
.mouth-big,
.cat-think-dots,
.cat-sparkles,
.cat-sweat {
  display: none;
}
.eye-open {
  transform-box: fill-box;
  transform-origin: center;
  animation: catBlink 5.6s infinite;
}
.crown-glint { animation: crownGlint 4s ease-in-out infinite; }

.cat.mood-happy .eye-open { display: none; }
.cat.mood-happy .eye-happy { display: block; }
.cat.mood-happy .mouth-smile { display: none; }
.cat.mood-happy .mouth-big { display: block; }
.cat.mood-happy .cat-sparkles { display: block; animation: sparklePop 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.cat.mood-happy .cat-all { animation: catHappy 0.7s var(--ease-spring); }
.cat.mood-happy .cat-head { transform-box: fill-box; transform-origin: 50% 100%; animation: catHeadHappy 1.2s ease-in-out infinite; }
.cat.mood-happy .cat-tail { animation-duration: 1.7s; }

.cat.mood-think .pupil { transform: translate(2.5px, -3px); }
.cat.mood-think .brow-l { transform: translateY(-3px) rotate(-8deg); transform-box: fill-box; transform-origin: center; }
.cat.mood-think .mouth-smile { display: none; }
.cat.mood-think .mouth-flat { display: block; }
.cat.mood-think .cat-think-dots { display: block; animation: thinkFloat 2.4s ease-in-out infinite; transform-box: fill-box; }
.cat.mood-think .cat-head { transform-box: fill-box; transform-origin: 50% 100%; animation: catHeadThink 2.4s ease-in-out infinite; }

.cat.mood-oops .pupil { transform: scale(0.68); transform-box: fill-box; transform-origin: center; }
.cat.mood-oops .mouth-smile { display: none; }
.cat.mood-oops .mouth-oops { display: block; }
.cat.mood-oops .cat-sweat { display: block; animation: sweatDrop 2s ease-in-out infinite; }
.cat.mood-oops .ear-left { transform: rotate(-4deg); }
.cat.mood-oops .ear-right { transform: rotate(4deg); }
.cat.mood-oops .brow-l { transform: translateY(-4px); }

.cat.mood-wow .mouth-smile { display: none; }
.cat.mood-wow .mouth-oops { display: block; }
.cat.mood-wow .cat-sparkles { display: block; animation: sparklePop 1.2s ease-in-out infinite; }
.cat.mood-wow .pupil { transform: scale(0.8); transform-box: fill-box; transform-origin: center; }

/* ============================ HUD ============================ */

.hud {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(210px, auto) minmax(220px, 1fr) auto;
  align-items: center;
  gap: clamp(8px, 1.4vw, 22px);
  flex: none;
  padding: 9px clamp(12px, 2.4vw, 30px);
  background:
    linear-gradient(180deg, rgba(24, 9, 34, 0.97), rgba(37, 16, 48, 0.93));
  border-bottom: 1px solid rgba(245, 176, 65, 0.28);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(10px);
}
.hud::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 226, 154, 0.55), transparent);
}
.hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.hud-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border: 1.5px solid rgba(245, 176, 65, 0.42);
  border-radius: 50%;
  color: var(--gold);
  background: radial-gradient(circle at 35% 25%, rgba(245,176,65,.22), rgba(30,12,42,.7));
  box-shadow: inset 0 0 14px rgba(245, 176, 65, 0.1), 0 0 18px rgba(245,176,65,.08);
}
.hud-mark svg { width: 30px; height: 30px; }
.hud-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.hud-round {
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: clamp(13px, 1.15vw, 16px);
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.hud-session {
  color: rgba(255, 248, 231, 0.48);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-progress {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.2vw, 16px);
  min-width: 0;
}
.hud-progress::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, rgba(245, 176, 65, 0.22), transparent);
}

.lock-token {
  position: relative;
  width: 34px;
  height: 40px;
  flex: none;
  color: rgba(219, 226, 232, 0.35);
  transition: color 0.25s ease, transform 0.25s var(--ease-spring);
}
.lock-token .lock-shackle {
  position: absolute;
  left: 50%;
  top: 2px;
  width: 17px;
  height: 15px;
  transform: translateX(-50%);
  border: 3px solid currentColor;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  transition: transform 0.3s var(--ease-spring), border-color 0.3s ease;
}
.lock-token .lock-body {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 27px;
  height: 23px;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: linear-gradient(160deg, #3b1d4a, #25102f);
  border: 1.5px solid currentColor;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.lock-token .lock-face {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: currentColor;
}
.lock-token .lock-keyhole {
  position: absolute;
  width: 5px;
  height: 8px;
  top: 6px;
  border-radius: 3px;
  background: currentColor;
  opacity: 0.55;
}
.lock-token.is-done {
  color: var(--gold);
  transform: translateY(-1px);
}
.lock-token.is-done .lock-body {
  background: linear-gradient(160deg, #43c97c, #147a44);
  border-color: #8ef0b7;
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.55), inset 0 1px 0 rgba(255,255,255,.35);
  color: #fff8e7;
}
.lock-token.is-done .lock-shackle {
  transform: translate(-9px, -3px) rotate(-34deg);
  border-color: #ffe29a;
}
.lock-token.is-done .lock-keyhole { display: none; }
.lock-token.is-done .lock-face::before { content: "✓"; }
.lock-token.is-done .lock-face { font-size: 14px; }
.lock-token.is-current {
  color: var(--gold-light);
  animation: lockActive 2s ease-in-out infinite;
}
.lock-token.is-current .lock-body {
  background: linear-gradient(160deg, #7a4d00, #4a2b00);
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(245, 176, 65, 0.45), inset 0 1px 0 rgba(255,255,255,.25);
}
.lock-token.is-current .lock-keyhole { opacity: 1; background: var(--gold-light); }

.hud-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 10px 4px 7px;
  border: 1px solid rgba(245, 176, 65, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  transition: transform 0.2s var(--ease-spring), background .2s ease;
}
.coin-pill.is-bumped { animation: coinBump 0.55s var(--ease-spring); }
.coin-pill-silver {
  border-color: rgba(219, 226, 232, 0.22);
  color: #e8eef3;
}
.coin {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff6c9 0%, #ffd25a 38%, #e09a1f 72%, #a16a0b 100%);
  box-shadow: inset 0 0 0 1.5px rgba(92, 58, 0, 0.55), 0 2px 3px rgba(0, 0, 0, 0.35);
}
.coin::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(92, 58, 0, 0.55);
  border-radius: 50%;
}
.coin::after {
  content: "◆";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(92, 58, 0, 0.75);
  font-size: 7px;
  line-height: 1;
}
.coin-silver {
  background: radial-gradient(circle at 35% 28%, #ffffff 0%, #e6edf3 38%, #b3c0ca 72%, #7c8b98 100%);
  box-shadow: inset 0 0 0 1.5px rgba(70, 85, 98, 0.55), 0 2px 3px rgba(0, 0, 0, 0.35);
}
.coin-silver::before { border-color: rgba(70, 85, 98, 0.55); }
.coin-silver::after { color: rgba(70, 85, 98, 0.75); }

/* ============================ GAME STAGE ============================ */

.game-main {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: clamp(6px, 1.2vh, 14px) clamp(10px, 3vw, 40px) 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(245,176,65,.35) transparent;
}
.game-main::-webkit-scrollbar { width: 6px; }
.game-main::-webkit-scrollbar-thumb { background: rgba(245,176,65,.35); border-radius: 3px; }

.dial-tilt-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: clamp(280px, 36vw, 400px);
  margin-bottom: -4px;
  color: rgba(255, 248, 231, 0.44);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.tilt-left, .tilt-right { color: rgba(255, 200, 200, 0.5); }
.tilt-center { color: rgba(168, 255, 197, 0.66); }

.dial {
  position: relative;
  width: clamp(232px, 25vw, 306px);
  height: auto;
  aspect-ratio: 2 / 1;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.35));
}
.dial-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.needle {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 5px;
  height: 80%;
  margin-left: -2.5px;
  transform-origin: 50% 100%;
  transform: rotate(0deg);
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #fff7c8 0%, #ffe29a 24%, #f5b041 62%, #b9770e 100%);
  box-shadow: 0 0 10px rgba(245, 176, 65, 0.55), 0 0 2px #5c3a00;
  z-index: 3;
  will-change: transform;
}
.needle::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 20%;
  width: 11px;
  height: 11px;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
  background: #f5b041;
  box-shadow: inset 0 0 0 2px #8a5a00;
  opacity: 0.8;
}
.needle-tip {
  position: absolute;
  left: 50%;
  top: -7px;
  width: 13px;
  height: 13px;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
  background: linear-gradient(135deg, #fff7c8, #f5b041);
  border: 1.5px solid #8a5a00;
  box-shadow: 0 0 12px rgba(255, 226, 154, 0.6);
}
.pivot-gem {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 28px;
  height: 28px;
  transform: translate(-50%, 50%) rotate(45deg);
  border-radius: 6px;
  background: linear-gradient(135deg, #fff3b0, #f5b041 45%, #a16a0b);
  border: 2px solid #5c3a00;
  box-shadow:
    0 0 0 3px rgba(30, 12, 42, 0.7),
    0 0 0 4px rgba(245, 176, 65, 0.3),
    0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 4;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.scale-scene.is-balanced .pivot-gem {
  background: linear-gradient(135deg, #b5ffd4, #2ecc71 45%, #147a44);
  box-shadow: 0 0 0 3px rgba(30, 12, 42, 0.7), 0 0 0 5px rgba(46, 204, 113, 0.32), 0 0 28px rgba(46, 204, 113, 0.85);
  animation: gemGlow 1.6s ease-in-out infinite;
}
.scale-scene.is-wrong .pivot-gem {
  background: linear-gradient(135deg, #ffb5b5, #d95050 45%, #8e2a2a);
  box-shadow: 0 0 0 3px rgba(30, 12, 42, 0.7), 0 0 0 5px rgba(217, 80, 80, 0.22), 0 0 20px rgba(217, 80, 80, 0.55);
}

/* Balance */
.beam-bar::before,
.beam-bar::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 15px;
  height: 30px;
  transform: translateY(-50%);
  border-radius: 4px;
  background: linear-gradient(90deg, #6c4500, #ffe29a 38%, #f5b041 62%, #7a4d00);
  border: 1px solid #5c3a00;
}
.beam-bar::before { left: 3.4%; }
.beam-bar::after { right: 3.4%; }
.pan {
  position: relative;
  width: 100%;
  min-height: clamp(164px, 23vh, 226px);
  display: flex;
  flex-direction: column;
  padding: clamp(14px, 1.6vw, 20px);
  border: 3px solid var(--gold);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(92, 58, 0, 0.25),
    0 16px 34px rgba(0, 0, 0, 0.4);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s var(--ease-spring);
}
.pan-question {
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.9), transparent 52%),
    linear-gradient(160deg, #fffaf0 0%, #fbeccd 68%, #efd5a2 100%);
  border-color: #d29a2d;
}
.pan-question::before,
.pan-answer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: linear-gradient(90deg, #8a5a00, #ffe29a 25%, #f5b041 50%, #ffe29a 75%, #8a5a00);
}
.pan-answer {
  color: var(--cream);
  background:
    radial-gradient(ellipse at 50% 20%, rgba(245, 176, 65, 0.14), transparent 52%),
    linear-gradient(160deg, #3a1a4d 0%, #2b1137 58%, #24102f 100%);
  border-color: var(--gold);
  box-shadow:
    inset 0 0 28px rgba(245, 176, 65, 0.08),
    inset 0 0 0 1px rgba(255, 226, 154, 0.18),
    0 16px 34px rgba(0, 0, 0, 0.46),
    0 0 24px rgba(245, 176, 65, 0.12);
  animation: answerPanGlow 3.2s ease-in-out infinite;
}
.pan-answer.is-correct {
  border-color: var(--green);
  box-shadow:
    inset 0 0 30px rgba(46, 204, 113, 0.2),
    0 0 0 4px rgba(46, 204, 113, 0.18),
    0 0 34px rgba(46, 204, 113, 0.35);
  animation: none;
}
.pan-answer.is-wrong {
  border-color: var(--red);
  box-shadow:
    inset 0 0 24px rgba(217, 80, 80, 0.16),
    0 0 0 4px rgba(217, 80, 80, 0.12),
    0 0 24px rgba(217, 80, 80, 0.22);
  animation: panWrong 0.4s ease;
}
.pan-answer.is-drop-ready {
  transform: scale(1.025);
  border-color: var(--gold-light);
  box-shadow:
    inset 0 0 30px rgba(255, 226, 154, 0.16),
    0 0 0 5px rgba(245, 176, 65, 0.2),
    0 0 36px rgba(245, 176, 65, 0.35);
}
.pan-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: rgba(178, 118, 14, 0.55);
  pointer-events: none;
}
.pan-answer .pan-corner { border-color: rgba(255, 226, 154, 0.45); }
.pan-corner.tl { top: 10px; left: 10px; border-top: 2px solid; border-left: 2px solid; border-radius: 4px 0 0 0; }
.pan-corner.tr { top: 10px; right: 10px; border-top: 2px solid; border-right: 2px solid; border-radius: 0 4px 0 0; }
.pan-corner.bl { bottom: 10px; left: 10px; border-bottom: 2px solid; border-left: 2px solid; border-radius: 0 0 0 4px; }
.pan-corner.br { bottom: 10px; right: 10px; border-bottom: 2px solid; border-right: 2px solid; border-radius: 0 0 4px 0; }

.pan-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 24px;
}
.subject-chip {
  display: inline-flex;
  align-items: center;
  max-width: 70%;
  padding: 4px 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 226, 154, 0.34);
  border-radius: 999px;
  color: var(--gold-pale);
  background: linear-gradient(160deg, #78281f, #531721);
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pan-label {
  color: rgba(104, 76, 58, 0.7);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.pan-answer .pan-label { color: rgba(255, 226, 154, 0.55); }
.answer-state {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 226, 154, 0.35);
  border-radius: 50%;
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 1;
}
.question-text {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  margin: 8px 0 6px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(23px, 2.6vw, 38px);
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.question-text.is-long { font-size: clamp(20px, 1.85vw, 27px); line-height: 1.3; }
.question-text.is-very-long { font-size: clamp(20px, 1.5vw, 22px); line-height: 1.32; }
.question-note {
  color: rgba(104, 76, 58, 0.75);
  font-size: clamp(10px, 0.95vw, 12px);
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}
.pan-ornament {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(178, 118, 14, 0.25);
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}
.pan-answer .pan-ornament {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  color: rgba(255, 226, 154, 0.045);
  font-family: var(--font-display);
  font-size: clamp(100px, 12vw, 150px);
  font-weight: 600;
}
.answer-display {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  margin: 6px 0 4px;
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: clamp(34px, 4.2vw, 58px);
  font-weight: 500;
  line-height: 1.12;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 0 0 22px rgba(245, 176, 65, 0.35);
  position: relative;
  z-index: 2;
}
.answer-display.is-long { font-size: clamp(20px, 2.35vw, 33px); line-height: 1.2; }
.answer-display.is-very-long { font-size: clamp(17px, 1.8vw, 25px); line-height: 1.25; }
.pan-answer.is-empty .answer-display { color: rgba(255, 226, 154, 0.55); }
.drop-hint {
  color: rgba(255, 226, 154, 0.42);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1.35;
  text-align: center;
  text-transform: uppercase;
  transition: opacity .2s ease;
}
.pan-answer.is-filled .drop-hint { opacity: 0; }

.column-shaft::before,
.column-shaft::after { bottom: 12%; }
.scale-status {
  position: relative;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 92%;
  min-height: 32px;
  padding: 6px 16px;
  border: 1px solid rgba(245, 176, 65, 0.22);
  border-radius: 999px;
  color: rgba(255, 248, 231, 0.75);
  background: rgba(24, 9, 34, 0.75);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  transition: background 0.25s ease, border-color 0.25s ease;
}
.status-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(245, 176, 65, 0.7);
}

/* ============================ MASCOT ============================ */

.mascot {
  position: absolute;
  left: clamp(4px, 1.4vw, 24px);
  bottom: 0;
  width: clamp(92px, 9.5vw, 138px);
  z-index: 8;
  pointer-events: none;
}
.mascot-figure {
  width: 100%;
  filter: drop-shadow(0 16px 16px rgba(0, 0, 0, 0.35));
}
.mascot-bubble {
  position: absolute;
  left: 84%;
  bottom: 72%;
  width: max-content;
  max-width: clamp(160px, 17vw, 235px);
  transform-origin: bottom left;
  animation: bubbleIn 0.35s var(--ease-spring);
  font-size: clamp(10px, 0.9vw, 13px);
}
.mascot-bubble::after { left: 12px; }
.mascot-bubble.is-pop { animation: bubblePop 0.4s var(--ease-spring); }

/* ============================ ANSWER DOCK ============================ */

.answer-dock {
  position: relative;
  z-index: 18;
  flex: none;
  width: 100%;
  padding: 0 clamp(10px, 2.4vw, 30px) clamp(8px, 1.4vh, 14px);
  background: linear-gradient(180deg, rgba(21, 8, 31, 0.2), rgba(21, 8, 31, 0.75));
}
.dock-panel {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(10px, 1.2vw, 16px) clamp(12px, 1.8vw, 22px);
  border: 1px solid rgba(245, 176, 65, 0.38);
  border-top: 3px solid var(--gold);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(245, 176, 65, 0.1), transparent 55%),
    linear-gradient(180deg, rgba(61, 29, 75, 0.97), rgba(31, 13, 42, 0.99));
  box-shadow:
    0 -16px 40px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 226, 154, 0.18);
  animation: dockIn 0.35s ease;
}
.dock-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 9px;
}
.dock-kicker {
  color: var(--gold);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}
.dock-head h2 {
  margin-top: 1px;
  color: var(--cream);
  font-family: var(--font-display);
  font-size: clamp(16px, 1.45vw, 21px);
  font-weight: 500;
  line-height: 1.2;
}
.dock-hint {
  max-width: 40%;
  color: rgba(255, 248, 231, 0.45);
  font-size: clamp(9px, 0.8vw, 11px);
  font-weight: 700;
  text-align: right;
  line-height: 1.35;
}
.dock-hint.is-warn {
  color: #ffb6a6;
}
.dock-hint.is-good { color: #a9f5c5; }

.dock-fill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 30%);
  grid-template-areas:
    "head head"
    "fill pad";
  gap: 10px clamp(12px, 2vw, 24px);
}
.dock-fill .dock-head { grid-area: head; }
.fill-row {
  grid-area: fill;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}
.input-wrap {
  position: relative;
  min-width: 0;
}
.answer-input {
  width: 100%;
  height: clamp(52px, 6vh, 60px);
  padding: 0 48px 0 16px;
  border: 2px solid var(--gold-dark);
  border-radius: 13px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 0%, #fffdf7, transparent 60%),
    linear-gradient(180deg, #fffdf7, #faeccd);
  box-shadow: inset 0 3px 8px rgba(92, 58, 0, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.7);
  font-family: var(--font-display);
  font-size: clamp(23px, 2.2vw, 31px);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: center;
  outline: none;
}
.answer-input::placeholder {
  color: rgba(104, 76, 58, 0.4);
  font-size: 0.72em;
  letter-spacing: 0;
}
.answer-input:focus {
  border-color: var(--gold);
  box-shadow:
    0 0 0 4px rgba(245, 176, 65, 0.22),
    inset 0 3px 8px rgba(92, 58, 0, 0.1);
}
.answer-input.is-text { font-family: var(--font-body); font-weight: 800; font-size: clamp(19px, 1.8vw, 25px); }
.input-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 32px;
  height: 32px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: rgba(104, 76, 58, 0.55);
  background: rgba(104, 76, 58, 0.09);
  font-size: 21px;
  line-height: 1;
}
.input-clear:hover { color: var(--maroon); background: rgba(107, 31, 42, 0.12); }

.btn-weigh {
  min-height: clamp(52px, 6vh, 60px);
  padding: 0 clamp(14px, 1.8vw, 24px);
  white-space: nowrap;
  font-size: clamp(13px, 1.15vw, 17px);
  letter-spacing: 0.05em;
}
.btn-weigh span { white-space: nowrap; }

.numpad {
  grid-area: pad;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 5px;
  align-self: stretch;
}
.numkey {
  min-width: 0;
  min-height: 38px;
  padding: 0;
  border: 1px solid rgba(245, 176, 65, 0.26);
  border-radius: 9px;
  color: var(--cream);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(0, 0, 0, 0.1)),
    #2b1238;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 0 rgba(0, 0, 0, 0.25);
  font-family: var(--font-display);
  font-size: clamp(15px, 1.3vw, 19px);
  font-weight: 500;
  line-height: 1;
  transition: background 0.12s ease, transform 0.1s ease, border-color 0.12s ease;
}
.numkey:hover {
  border-color: rgba(245, 176, 65, 0.7);
  background: linear-gradient(180deg, rgba(245, 176, 65, 0.24), rgba(245, 176, 65, 0.08)), #3b1a48;
}
.numkey:active {
  transform: translateY(2px);
  box-shadow: none;
}
.numkey-del { color: #ffb0a8; }
.dock-fill.is-text-mode .numpad { display: none; }
.dock-fill.is-text-mode {
  grid-template-columns: 1fr;
  grid-template-areas: "head" "fill";
}

.dock-mc .dock-head { margin-bottom: 8px; }
.stones {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(7px, 1vw, 12px);
}
.stone {
  position: relative;
  min-height: clamp(58px, 7.2vh, 78px);
  padding: 10px 12px;
  border: 2px solid var(--gold-dark);
  border-radius: 14px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 25% 0%, rgba(255, 255, 255, 0.8), transparent 50%),
    linear-gradient(160deg, #fffaf0 0%, #f7e9ca 60%, #e9cd98 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.6),
    0 5px 0 #7a4d00,
    0 9px 16px rgba(0, 0, 0, 0.24);
  font-family: var(--font-display);
  font-size: clamp(14px, 1.35vw, 19px);
  font-weight: 500;
  line-height: 1.22;
  text-align: center;
  transition: transform 0.16s var(--ease-spring), box-shadow 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
  touch-action: none;
  user-select: none;
}
.stone::before {
  content: "◆";
  position: absolute;
  top: 5px;
  left: 8px;
  color: rgba(138, 90, 0, 0.38);
  font-size: 8px;
}
.stone::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(138, 90, 0, 0.12);
  border-radius: 9px;
  pointer-events: none;
}
.stone:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  filter: brightness(1.02);
}
.stone:active {
  transform: translateY(1px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6), 0 2px 0 #7a4d00;
}
.stone.is-selected {
  border-color: var(--gold);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 246, 200, 0.95), transparent 60%),
    linear-gradient(160deg, #ffe8a8, #f5c25a 70%, #d99a2b);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.7),
    0 0 0 4px rgba(245, 176, 65, 0.22),
    0 0 24px rgba(245, 176, 65, 0.45);
}
.stone.is-dimmed {
  opacity: 0.4;
  filter: grayscale(0.6);
  pointer-events: none;
}
.stones.is-locked .stone { pointer-events: none; }
.stone-drag {
  position: fixed;
  z-index: 250;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-4deg) scale(1.04);
  opacity: 0.94;
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.45);
}

.dock-result {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  border-color: rgba(46, 204, 113, 0.55);
  border-top-color: #8ef0b7;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(46, 204, 113, 0.16), transparent 55%),
    linear-gradient(180deg, rgba(32, 83, 55, 0.96), rgba(20, 44, 38, 0.99));
  animation: resultIn 0.45s var(--ease-spring);
}
.result-burst {
  display: grid;
  place-items: center;
  width: clamp(46px, 5vw, 62px);
  height: clamp(46px, 5vw, 62px);
  flex: none;
  border: 2px solid rgba(168, 255, 197, 0.7);
  border-radius: 50%;
  color: #b5ffd4;
  background: radial-gradient(circle at 35% 30%, #4dea92, #147a44);
  box-shadow: 0 0 24px rgba(46, 204, 113, 0.45), inset 0 2px 0 rgba(255,255,255,.35);
  font-size: clamp(24px, 2.6vw, 34px);
  text-shadow: 0 2px 0 #147a44;
}
.result-copy { flex: 1; min-width: 0; }
.result-eyebrow {
  color: #a9f5c5;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.result-copy h2 {
  margin-top: 1px;
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 29px);
  font-weight: 500;
  line-height: 1.1;
}
.result-explanation {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(11px, 0.95vw, 13px);
  font-weight: 600;
  line-height: 1.4;
}
.result-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.reward-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid rgba(245, 176, 65, 0.4);
  border-radius: 999px;
  color: var(--gold-light);
  background: rgba(0, 0, 0, 0.16);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.btn-next { min-height: 46px; padding: 0 18px; font-size: 15px; }
.btn-next span:last-child { font-size: 19px; }

/* ============================ VICTORY ============================ */

.victory-wrap {
  position: relative;
  z-index: 3;
  width: min(1160px, 100% - clamp(28px, 6vw, 80px));
  min-height: 100%;
  margin: 0 auto;
  padding: clamp(20px, 4vh, 40px) 0 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.victory-head {
  text-align: center;
  margin-bottom: clamp(8px, 2vh, 18px);
}
.victory-head .kicker { justify-content: center; }
.victory-head h1 {
  margin: 6px 0 4px;
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: clamp(34px, 5.2vw, 68px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.01em;
  text-shadow: 0 4px 0 rgba(92, 58, 0, 0.35), 0 14px 30px rgba(0, 0, 0, 0.35);
}
.victory-head h1 span {
  color: var(--gold);
  background: linear-gradient(180deg, #fff6c9, #f5b041 60%, #b9770e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.victory-head > p:last-child {
  color: rgba(255, 248, 231, 0.66);
  font-size: clamp(13px, 1.2vw, 16px);
  line-height: 1.5;
}
.victory-body {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(0, 1.18fr);
  align-items: center;
  gap: clamp(18px, 3vw, 40px);
}
.victory-vault-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 440px;
}
.victory-vault { width: min(330px, 82%); }
.victory-cat {
  position: absolute;
  left: 2%;
  bottom: 2px;
  width: clamp(110px, 12vw, 150px);
  z-index: 5;
}
.victory-bubble {
  position: absolute;
  left: 54%;
  bottom: 22%;
  width: min(195px, 46%);
  z-index: 6;
}
.victory-card {
  border: 2px solid var(--gold-dark);
  border-radius: 22px;
  padding: clamp(16px, 2vw, 26px);
  color: var(--ink);
  background:
    radial-gradient(ellipse at 10% 0%, rgba(255, 255, 255, 0.9), transparent 45%),
    linear-gradient(160deg, #fffdf6 0%, #faeccd 68%, #f3dbb0 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.6),
    0 8px 0 #7a4d00,
    0 24px 50px rgba(0, 0, 0, 0.4);
}
.victory-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.stat {
  padding: 8px 6px;
  border: 1px solid rgba(138, 90, 0, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.38);
  text-align: center;
}
.stat-label {
  display: block;
  color: var(--ink-soft);
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.stat-value {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 2px;
  color: var(--maroon);
  font-family: var(--font-display);
  font-size: clamp(16px, 1.7vw, 23px);
  font-weight: 600;
  line-height: 1;
}
.stat .coin { width: 15px; height: 15px; }
.stat .coin::before { inset: 3px; }
.stat .coin::after { font-size: 5px; }
.recap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 15px 0 7px;
}
.recap-head h2 {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(15px, 1.4vw, 19px);
  font-weight: 500;
}
.recap-count {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.recap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: min(31vh, 276px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(138,90,0,.35) transparent;
}
.recap::-webkit-scrollbar { width: 5px; }
.recap::-webkit-scrollbar-thumb { background: rgba(138,90,0,.35); border-radius: 3px; }
.recap-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(138, 90, 0, 0.14);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.36);
}
.recap-num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--gold-pale);
  background: var(--green-dark);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
}
.recap-main { min-width: 0; }
.recap-prompt {
  overflow: hidden;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recap-answer {
  overflow: hidden;
  color: var(--green-dark);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recap-meta {
  color: var(--ink-soft);
  font-size: 8.5px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}
.recap-meta .star {
  display: block;
  color: #b9770e;
  font-size: 10px;
  letter-spacing: 1px;
}
.victory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.victory-actions .btn-primary { flex: 1 1 auto; }
.victory-card .btn-ghost {
  flex: 0 1 auto;
  color: var(--maroon);
  border-color: rgba(107, 31, 42, 0.28);
  background: rgba(107, 31, 42, 0.06);
}
.victory-card .btn-ghost:hover { background: rgba(107, 31, 42, 0.12); border-color: var(--maroon); }
.victory-foot {
  padding-top: 18px;
  color: rgba(255, 248, 231, 0.32);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
}

.victory-screen.is-active .victory-head > * {
  animation: titleRise 0.7s var(--ease-spring) both;
}
.victory-screen.is-active .victory-head > *:nth-child(2) { animation-delay: .08s; }
.victory-screen.is-active .victory-head > *:nth-child(3) { animation-delay: .16s; }
.victory-screen.is-active .victory-card { animation: titleRise 0.8s var(--ease-spring) .25s both; }
.victory-screen.is-active .victory-vault-stage { animation: titleRise 0.9s var(--ease-spring) both; }

/* ============================ OVERLAYS ============================ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 28px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.overlay.is-open {
  opacity: 1;
  visibility: visible;
}
.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(24, 9, 34, 0.68), rgba(7, 2, 12, 0.88));
  backdrop-filter: blur(7px);
}
.guide-card,
.pause-card {
  position: relative;
  z-index: 2;
  width: min(880px, 100%);
  max-height: calc(100dvh - clamp(24px, 6vw, 56px));
  overflow-y: auto;
  padding: clamp(18px, 2.8vw, 32px);
  border: 3px solid var(--gold-dark);
  border-radius: 24px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 15% 0%, rgba(255, 255, 255, 0.95), transparent 45%),
    linear-gradient(155deg, #fffdf6 0%, #faeece 65%, #f2d8a4 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.7),
    0 12px 0 #6c4500,
    0 30px 70px rgba(0, 0, 0, 0.55);
  scrollbar-width: thin;
  scrollbar-color: rgba(138, 90, 0, 0.35) transparent;
}
.guide-card::-webkit-scrollbar,
.pause-card::-webkit-scrollbar { width: 6px; }
.guide-card::-webkit-scrollbar-thumb,
.pause-card::-webkit-scrollbar-thumb { background: rgba(138, 90, 0, 0.35); border-radius: 3px; }
.guide-card::before,
.pause-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(138, 90, 0, 0.16);
  border-radius: 17px;
  pointer-events: none;
}
.overlay-close {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 3;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(107, 31, 42, 0.2);
  border-radius: 50%;
  color: var(--maroon);
  background: rgba(107, 31, 42, 0.06);
  font-size: 23px;
  line-height: 1;
}
.overlay-close:hover { background: rgba(107, 31, 42, 0.14); }
.guide-heading { padding-right: 40px; }
.guide-heading .kicker { color: var(--gold-dark); }
.guide-heading h2 {
  margin: 4px 0 3px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 500;
  line-height: 1.05;
}
.guide-heading > p:last-child {
  color: var(--ink-soft);
  font-size: clamp(12px, 1.1vw, 14px);
  line-height: 1.45;
}
.guide-body {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(18px, 3vw, 32px);
  margin: 15px 0 12px;
}
.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.guide-steps li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.step-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  color: var(--gold-pale);
  background: linear-gradient(160deg, #78281f, #4d101a);
  box-shadow: 0 2px 0 #2e0a10;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
}
.guide-steps strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
}
.guide-steps p {
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}
.guide-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid rgba(138, 90, 0, 0.22);
  border-radius: 12px;
  background: rgba(255, 244, 208, 0.7);
}
.tip-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  color: var(--gold-pale);
  background: var(--maroon);
  font-size: 15px;
}
.guide-tip p {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.45;
}
.guide-tip strong { color: var(--ink); }
.guide-done {
  display: flex;
  width: 100%;
  margin-top: 14px;
}

/* Demo mini scale */
.demo {
  position: relative;
  height: clamp(216px, 26vw, 270px);
  overflow: hidden;
  border: 2px solid rgba(92, 58, 0, 0.22);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(245, 176, 65, 0.18), transparent 55%),
    linear-gradient(160deg, #3b1a4d, #1e0c2a 70%);
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.4);
}
.demo-dial {
  position: absolute;
  left: 50%;
  top: 14px;
  width: 160px;
  height: 78px;
  transform: translateX(-50%);
}
.demo-arc {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 150px;
  height: 72px;
  transform: translateX(-50%);
  border: 7px solid rgba(245, 176, 65, 0.28);
  border-bottom: 0;
  border-radius: 80px 80px 0 0;
}
.demo-arc::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  width: 16px;
  height: 8px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: #2ecc71;
  box-shadow: 0 0 10px rgba(46, 204, 113, 0.8);
}
.demo-needle {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 3px;
  height: 62px;
  margin-left: -1.5px;
  transform-origin: 50% 100%;
  background: linear-gradient(180deg, #fff8cf, #f5b041);
  border-radius: 2px;
  animation: demoNeedle 4.6s ease-in-out infinite;
}
.demo-pivot {
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 16px;
  height: 16px;
  transform: translateX(-50%) rotate(45deg);
  border: 2px solid #5c3a00;
  border-radius: 3px;
  background: linear-gradient(135deg, #fff3b0, #f5b041);
}
.demo-beam {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 100px;
  height: 8px;
  border-radius: 5px;
  background: linear-gradient(180deg, #ffe29a, #b9770e);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.demo-chain {
  position: absolute;
  top: 8px;
  width: 2px;
  height: 32px;
  background: repeating-linear-gradient(180deg, #ffe29a 0 3px, #a16a0b 3px 6px);
}
.demo-chain.l { left: 18%; }
.demo-chain.r { right: 18%; }
.demo-pan {
  position: absolute;
  top: 40px;
  width: 35%;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px;
  border: 2px solid var(--gold);
  border-radius: 10px;
  color: var(--ink);
  background: linear-gradient(160deg, #fffaf0, #f2d9a5);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.3);
}
.demo-left { left: 2%; }
.demo-right { right: 2%; background: linear-gradient(160deg, #3a1a4d, #24102f); color: var(--gold-light); border-color: var(--gold-light); }
.demo-pan small {
  color: rgba(104, 76, 58, 0.7);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.1em;
}
.demo-right small { color: rgba(255, 226, 154, 0.55); }
.demo-pan strong {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.1;
  text-align: center;
}
.demo-q,
.demo-a { position: absolute; }
.demo-q { animation: demoQuestion 4.6s ease-in-out infinite; }
.demo-a { opacity: 0; color: var(--gold-light); animation: demoAnswer 4.6s ease-in-out infinite; }
.demo-check {
  position: absolute;
  right: 12px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #eafff3;
  background: linear-gradient(160deg, #3ee286, #147a44);
  box-shadow: 0 0 16px rgba(46, 204, 113, 0.6);
  font-family: var(--font-display);
  font-size: 18px;
  opacity: 0;
  animation: demoCheck 4.6s ease-in-out infinite;
}
.demo-spark {
  position: absolute;
  color: var(--gold-light);
  opacity: 0;
  animation: demoSpark 4.6s ease-in-out infinite;
}
.demo-spark.s1 { left: 12%; top: 24%; font-size: 14px; animation-delay: .1s; }
.demo-spark.s2 { right: 14%; top: 18%; font-size: 19px; animation-delay: .2s; }
.demo-spark.s3 { right: 22%; top: 52%; font-size: 12px; animation-delay: .3s; }

/* Pause */
.pause-card {
  width: min(440px, 100%);
  text-align: center;
}
.pause-seal {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  border: 2px solid var(--gold-dark);
  border-radius: 50%;
  color: var(--gold-pale);
  background: linear-gradient(160deg, #78281f, #4d101a);
  box-shadow: 0 4px 0 #2e0a10, 0 10px 20px rgba(0,0,0,.2);
  font-size: 22px;
}
.pause-card .kicker { justify-content: center; color: var(--gold-dark); }
.pause-card h2 {
  margin: 4px 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 500;
}
.pause-sub {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
}
.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}
.pause-actions .btn-ghost {
  color: var(--maroon);
  border-color: rgba(107, 31, 42, 0.24);
  background: rgba(107, 31, 42, 0.06);
}
.pause-actions .btn-ghost:hover { background: rgba(107, 31, 42, 0.13); border-color: var(--maroon); }
.pause-sound {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.pause-sound .icon-btn {
  width: 36px;
  height: 36px;
  color: var(--maroon);
  border-color: rgba(107, 31, 42, 0.22);
  background: rgba(107, 31, 42, 0.06);
}
.pause-sound .icon-btn svg { width: 18px; height: 18px; }

/* ============================ FX ============================ */

.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  overflow: hidden;
}
.fx-coin {
  position: fixed;
  z-index: 201;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff6c9 0%, #ffd25a 38%, #e09a1f 72%, #a16a0b 100%);
  box-shadow: inset 0 0 0 1px rgba(92, 58, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
  will-change: transform, opacity;
}
.fx-spark {
  position: fixed;
  z-index: 201;
  width: 8px;
  height: 8px;
  background: var(--gold-light);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  will-change: transform, opacity;
}
.fx-confetti {
  position: fixed;
  z-index: 201;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  will-change: transform, opacity;
}
.fx-float {
  position: fixed;
  z-index: 202;
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  text-shadow: 0 2px 0 #5c3a00, 0 0 16px rgba(245, 176, 65, 0.6);
  white-space: nowrap;
  will-change: transform, opacity;
}
.flash-layer {
  position: fixed;
  inset: 0;
  z-index: 190;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255, 244, 190, 0.7), rgba(245, 176, 65, 0.1) 45%, transparent 70%);
}
.flash-layer.is-on { animation: goldFlash 0.7s ease-out; }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--cream);
  background: var(--purple-900);
  font-size: 18px;
  text-align: center;
}

/* ============================ ANIMATIONS ============================ */

@keyframes raysDrift {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(6deg); }
}
@keyframes titleRise {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dockIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes resultIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes sealPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}
@keyframes sealBurst {
  0% { opacity: 1; transform: rotate(45deg) scale(1); }
  35% { opacity: 1; transform: rotate(45deg) scale(1.6); filter: brightness(2.2); }
  100% { opacity: 0; transform: rotate(45deg) scale(0.1); }
}
@keyframes lockActive {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(245, 176, 65, 0.2)); }
  50% { filter: drop-shadow(0 0 12px rgba(245, 176, 65, 0.65)); }
}
@keyframes coinBump {
  0% { transform: scale(1); }
  35% { transform: scale(1.18); background: rgba(245, 176, 65, 0.2); }
  70% { transform: scale(0.96); }
  100% { transform: scale(1); }
}
@keyframes answerPanGlow {
  0%, 100% { box-shadow: inset 0 0 28px rgba(245, 176, 65, 0.08), inset 0 0 0 1px rgba(255, 226, 154, 0.18), 0 16px 34px rgba(0, 0, 0, 0.46), 0 0 24px rgba(245, 176, 65, 0.1); }
  50% { box-shadow: inset 0 0 32px rgba(245, 176, 65, 0.13), inset 0 0 0 1px rgba(255, 226, 154, 0.26), 0 16px 34px rgba(0, 0, 0, 0.46), 0 0 34px rgba(245, 176, 65, 0.2); }
}
@keyframes gemGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35) drop-shadow(0 0 10px rgba(46, 204, 113, 0.8)); }
}
@keyframes scaleShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-0.6deg); }
  45% { transform: translateX(5px) rotate(0.5deg); }
  70% { transform: translateX(-3px); }
}
@keyframes panWrong {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(6px) scale(0.86); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes bubblePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.05) rotate(-1deg); }
  100% { transform: scale(1); }
}
@keyframes goldFlash {
  0% { opacity: 0; }
  16% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes catBreathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.006); }
}
@keyframes catTail {
  0%, 100% { transform: rotate(0deg); }
  35% { transform: rotate(4deg); }
  70% { transform: rotate(-3deg); }
}
@keyframes catBlink {
  0%, 93%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.08); }
  97% { transform: scaleY(1); }
}
@keyframes catEarL {
  0%, 90%, 100% { transform: rotate(0deg); }
  93% { transform: rotate(-4deg); }
  96% { transform: rotate(2deg); }
}
@keyframes catEarR {
  0%, 88%, 100% { transform: rotate(0deg); }
  91% { transform: rotate(4deg); }
  94% { transform: rotate(-2deg); }
}
@keyframes catHappy {
  0% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-10px) scale(1.03, 0.98); }
  55% { transform: translateY(0) scale(0.98, 1.02); }
  80% { transform: translateY(-3px) scale(1.01); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes catHeadHappy {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-2deg); }
}
@keyframes catHeadThink {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(2deg); }
}
@keyframes thinkFloat {
  0%, 100% { opacity: 0.35; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}
@keyframes sparklePop {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.08); }
}
@keyframes sweatDrop {
  0%, 100% { opacity: 0; transform: translateY(-3px); }
  40% { opacity: .9; transform: translateY(1px); }
  70% { opacity: 0; transform: translateY(6px); }
}
@keyframes crownGlint {
  0%, 86%, 100% { opacity: 0; }
  91% { opacity: 1; }
  95% { opacity: 0.2; }
}
@keyframes demoNeedle {
  0%, 26% { transform: rotate(-11deg); }
  44%, 78% { transform: rotate(0deg); }
  90%, 100% { transform: rotate(-11deg); }
}
@keyframes demoQuestion {
  0%, 30% { opacity: 1; }
  36%, 90% { opacity: 0; }
  97%, 100% { opacity: 1; }
}
@keyframes demoAnswer {
  0%, 30% { opacity: 0; transform: scale(0.5); }
  38% { opacity: 1; transform: scale(1.12); }
  46%, 90% { opacity: 1; transform: scale(1); }
  97%, 100% { opacity: 0; transform: scale(0.5); }
}
@keyframes demoCheck {
  0%, 34% { opacity: 0; transform: scale(0.4) rotate(-20deg); }
  45% { opacity: 1; transform: scale(1.15) rotate(4deg); }
  52%, 78% { opacity: 1; transform: scale(1) rotate(0); }
  86%, 100% { opacity: 0; }
}
@keyframes demoSpark {
  0%, 40% { opacity: 0; transform: scale(0.4); }
  48% { opacity: 1; transform: scale(1.1); }
  60%, 100% { opacity: 0; transform: scale(0.7) translateY(-8px); }
}

/* ============================ RESPONSIVE ============================ */

@media (max-width: 1180px) {
  .title-hero { grid-template-columns: minmax(0, 1fr) minmax(290px, 0.78fr); }
  .vault-stage { min-height: 460px; }
  .title-bubble { left: 36%; bottom: 24%; width: 42%; }
  .mascot { width: 112px; }
}

@media (max-width: 1020px) {
  .title-wrap { width: calc(100% - 44px); }
  .title-hero { grid-template-columns: minmax(0, 1fr) minmax(270px, 0.7fr); gap: 18px; }
  .vault-stage { min-height: 410px; }
  .title-cat { width: 126px; }
  .title-bubble { display: none; }
  .session-card { min-height: 174px; padding: 15px; }
  .card-grade { font-size: 29px; }
  .hud { grid-template-columns: minmax(190px, auto) 1fr auto; }
  .hud-mark { width: 40px; height: 40px; }
  .lock-token { width: 30px; height: 36px; }
  .lock-token .lock-body { width: 24px; height: 21px; }
  .lock-token .lock-shackle { width: 15px; height: 13px; }
  .hud-right { gap: 5px; }
  .coin-pill { font-size: 13px; min-height: 32px; padding: 4px 8px 4px 6px; }
  .coin { width: 18px; height: 18px; }
  .icon-btn { width: 38px; height: 38px; }
  .icon-btn svg { width: 20px; height: 20px; }
  .mascot { width: 92px; }
  .mascot-bubble { display: none; }
  .dock-fill { grid-template-columns: minmax(0, 1fr) minmax(230px, 30%); }
  .answer-input { font-size: 24px; }
  .btn-weigh { font-size: 12px; padding: 0 12px; }
  .btn-scale { display: none; }
  .stones { gap: 7px; }
  .stone { font-size: 14px; padding: 8px; }
}

@media (max-width: 860px) {
  .hud { grid-template-columns: auto 1fr auto; }
  .hud-mark { display: none; }
  .hud-session { display: none; }
  .hud-round { font-size: 13px; }
  .hud-progress { gap: 7px; }
  .dial-tilt-labels { font-size: 8px; }
  .pan { min-height: 170px; }
  .answer-display { font-size: clamp(30px, 4vw, 44px); }
  .question-text { font-size: clamp(21px, 2.4vw, 30px); }
  .game-main { padding-left: 8px; padding-right: 8px; }
  .mascot { display: none; }
  .victory-body { grid-template-columns: minmax(260px, 0.75fr) minmax(0, 1.25fr); gap: 14px; }
  .victory-vault-stage { min-height: 380px; }
  .victory-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .victory-actions { flex-direction: column; }
  .victory-actions .btn-primary, .victory-actions .btn-ghost { width: 100%; }
}

@media (max-width: 720px) {
  .title-wrap { width: calc(100% - 28px); padding-top: 12px; justify-content: flex-start; }
  .title-bar { min-height: 42px; }
  .brand { font-size: 9px; letter-spacing: .14em; }
  .brand-mark { width: 28px; height: 28px; }
  .title-hero {
    grid-template-columns: 1fr;
    gap: 4px;
    padding-top: 12px;
  }
  .title-copy { max-width: 100%; text-align: left; }
  .title-sm { font-size: clamp(36px, 10vw, 52px); }
  .title-lg { font-size: clamp(54px, 15.5vw, 82px); }
  .title-sub { font-size: 14px; max-width: 100%; }
  .title-badges { margin-top: 12px; gap: 5px; }
  .title-badges span { font-size: 10px; padding: 6px 9px; }
  .title-badges b { font-size: 13px; }
  .title-flourish { margin: 5px 0 12px; width: 60%; }
  .vault-stage { min-height: 270px; margin-top: -6px; }
  .vault-slot { width: min(220px, 60%); }
  .title-cat { width: 88px; left: 14%; bottom: 2px; }
  .title-copy .kicker { font-size: 9px; }
  .session-panel { padding: 14px; border-radius: 18px; }
  .session-head { align-items: center; margin-bottom: 10px; }
  .session-head h2 { font-size: 20px; }
  .session-head .btn-ghost { min-height: 36px; font-size: 12px; padding: 0 10px; }
  .session-grid { grid-template-columns: 1fr; gap: 9px; }
  .session-card { min-height: 0; padding: 13px 15px 11px; }
  .card-grade { font-size: 23px; }
  .card-title { margin-top: 2px; font-size: 12px; }
  .card-subjects { display: none; }
  .card-bottom { margin-top: 6px; padding-top: 8px; }
  .session-foot { font-size: 10px; }
  .title-foot { display: none; }

  .game-screen { overflow: hidden; }
  .hud {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "left right"
      "progress progress";
    gap: 6px 10px;
    padding: 7px 10px 6px;
  }
  .hud-left { grid-area: left; gap: 7px; }
  .hud-mark { display: none; }
  .hud-round { font-size: 12px; }
  .hud-session { display: block; font-size: 8px; }
  .hud-progress { grid-area: progress; justify-content: center; gap: 12px; }
  .hud-progress::before { left: 8%; right: 8%; }
  .hud-right { grid-area: right; gap: 3px; }
  .coin-pill { min-height: 29px; font-size: 12px; padding: 3px 7px 3px 5px; gap: 4px; }
  .coin { width: 16px; height: 16px; }
  .coin::before { inset: 3px; }
  .coin::after { font-size: 5px; }
  .icon-btn { width: 34px; height: 34px; }
  .icon-btn svg { width: 18px; height: 18px; }
  .icon-glyph { font-size: 18px; }
  .lock-token { width: 27px; height: 32px; }
  .lock-token .lock-body { width: 22px; height: 19px; }
  .lock-token .lock-shackle { width: 14px; height: 12px; border-width: 2.5px; }
  .lock-token .lock-face { font-size: 9px; }
  .lock-token.is-done .lock-face { font-size: 11px; }
  .lock-token .lock-keyhole { top: 5px; width: 4px; height: 7px; }

  .game-main {
    flex: 1;
    min-height: 0;
    align-items: flex-start;
    padding: 4px 10px 0;
    overflow-y: auto;
  }
.dial-tilt-labels { width: min(290px, 90%); font-size: 7.5px; margin-bottom: 0; }
  .dial { width: min(250px, 76vw); height: 108px; }
.beam-bar, .beam-end, .chain, .balance-column, .balance-base { display: none; }
.pan {
    width: 100%;
    min-height: 0;
    padding: 10px 13px;
    border-radius: 14px;
    border-width: 2px;
  }
  .pan-question { min-height: 104px; }
  .pan-answer { min-height: 96px; }
  .pan-topline { min-height: 19px; }
  .subject-chip { padding: 3px 8px; font-size: 8px; }
  .pan-label { font-size: 8px; }
  .answer-state { width: 19px; height: 19px; font-size: 10px; }
  .question-text { margin: 5px 0 3px; font-size: clamp(18px, 5.2vw, 24px); }
  .question-text.is-long { font-size: clamp(20px, 4.3vw, 22px); }
  .question-text.is-very-long { font-size: clamp(20px, 3.9vw, 20px); }
  .question-note { font-size: 9px; }
  .pan-ornament { display: none; }
  .answer-display { margin: 3px 0 1px; font-size: clamp(28px, 9vw, 38px); }
  .answer-display.is-long { font-size: clamp(18px, 5.4vw, 25px); }
  .answer-display.is-very-long { font-size: clamp(15px, 4.4vw, 20px); }
  .drop-hint { font-size: 8px; }
  .scale-status { min-height: 28px; font-size: 10px; padding: 5px 11px; margin-top: 4px; }
  .mascot { display: none; }

  .answer-dock { padding: 0 8px 8px; }
  .dock-panel { padding: 8px 10px; border-radius: 14px; }
  .dock-head { margin-bottom: 5px; gap: 8px; align-items: center; }
  .dock-kicker { font-size: 8px; }
  .dock-head h2 { font-size: 14px; }
  .dock-hint { max-width: 42%; font-size: 8px; }
  .dock-fill {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "fill"
      "pad";
    gap: 6px;
  }
  .fill-row { grid-template-columns: 1fr; gap: 6px; }
  .answer-input { height: 44px; font-size: 22px; }
  .btn-weigh { min-height: 42px; font-size: 13px; }
  .btn-scale { display: none; }
  .numpad { grid-template-columns: repeat(6, minmax(0,1fr)); gap: 4px; }
  .numkey { min-height: 34px; font-size: 14px; border-radius: 7px; }
  .dock-fill.is-text-mode { grid-template-areas: "head" "fill"; }
  .stones { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .stone { min-height: 44px; font-size: 12px; padding: 6px; border-width: 1.5px; }
  .stone::before { display: none; }
  .result-burst { width: 38px; height: 38px; font-size: 20px; }
  .result-copy h2 { font-size: 17px; }
  .result-explanation { font-size: 10px; }
  .result-side { flex-direction: column; align-items: stretch; gap: 4px; }
  .reward-chip { justify-content: center; font-size: 10px; min-height: 24px; }
  .btn-next { min-height: 38px; font-size: 13px; }
  .dock-result { gap: 8px; }

  .victory-wrap { width: calc(100% - 24px); padding-top: 16px; }
  .victory-head h1 { font-size: clamp(30px, 9vw, 44px); }
  .victory-head > p:last-child { font-size: 12px; }
  .victory-body { grid-template-columns: 1fr; gap: 0; }
  .victory-vault-stage { min-height: 260px; order: 2; }
  .victory-vault { width: min(210px, 60%); }
  .victory-cat { width: 82px; left: 17%; }
  .victory-bubble { display: none; }
  .victory-card { order: 1; padding: 13px; border-radius: 16px; }
  .victory-stats { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .stat { padding: 6px 3px; }
  .stat-label { font-size: 7px; }
  .stat-value { font-size: 14px; }
  .stat .coin { width: 11px; height: 11px; }
  .recap { max-height: 190px; }
  .victory-actions { flex-direction: row; }
  .victory-actions .btn-primary, .victory-actions .btn-ghost { width: auto; flex: 1; min-height: 42px; }
  .victory-foot { display: none; }

  .guide-card, .pause-card { padding: 16px; border-radius: 18px; }
  .guide-heading h2 { font-size: 24px; }
  .guide-body { grid-template-columns: 1fr; gap: 12px; margin: 10px 0; }
  .demo { height: 200px; }
  .demo-dial { top: 8px; transform: translateX(-50%) scale(0.82); transform-origin: top center; }
  .demo-beam { top: 84px; }
  .demo-chain { height: 24px; }
  .demo-pan { top: 30px; min-height: 78px; }
  .guide-steps { gap: 7px; }
  .guide-steps strong { font-size: 12px; }
  .guide-steps p { font-size: 10px; }
  .guide-tip { padding: 8px 10px; }
  .guide-tip p { font-size: 9.5px; }
  .guide-done { min-height: 44px; font-size: 14px; }
  .overlay { padding: 8px; }
  .pause-card { max-width: 380px; }
}

@media (max-width: 420px) {
  .hud-session { display: none; }
  .hud-progress { gap: 8px; }
  .title-lg { font-size: 56px; }
  .title-sm { font-size: 38px; }
  .vault-stage { min-height: 230px; }
  .vault-slot { width: 190px; }
  .title-cat { width: 76px; left: 12%; }
  .session-head .btn-ghost { font-size: 11px; }
  .session-head .ghost-icon { display: none; }
  .dock-hint { display: none; }
  .numkey { min-height: 31px; font-size: 13px; }
  .answer-input { height: 41px; font-size: 20px; }
  .btn-weigh { min-height: 39px; font-size: 12px; }
  .stat-label { letter-spacing: 0; }
  .recap-row { grid-template-columns: 20px minmax(0,1fr) auto; gap: 5px; padding: 5px 6px; }
  .recap-num { width: 19px; height: 19px; font-size: 9px; }
  .recap-prompt { font-size: 9px; }
  .recap-answer { font-size: 8.5px; }
}

@media (max-height: 780px) and (min-width: 721px) {
  .title-wrap { padding-top: 10px; padding-bottom: 12px; }
  .title-hero { padding-top: 2px; padding-bottom: 4px; }
  .vault-stage { min-height: 390px; }
  .vault-slot { width: min(300px, 88%); }
  .title-lg { font-size: clamp(56px, 7.4vw, 102px); }
  .title-sm { font-size: clamp(36px, 4.7vw, 64px); }
  .title-sub { font-size: 14px; }
  .title-badges { margin-top: 10px; }
  .session-panel { padding: 16px; }
  .session-card { min-height: 158px; padding: 14px; }
  .dial { height: 110px; }
.pan { min-height: 148px; }
  .answer-dock { padding-bottom: 6px; }
  .dock-panel { padding-top: 8px; padding-bottom: 8px; }
  .dock-head { margin-bottom: 5px; }
  .answer-input { height: 46px; }
  .btn-weigh { min-height: 46px; }
  .numkey { min-height: 30px; }
  .dock-fill { gap: 5px 14px; }
  .stones { margin-top: 0; }
  .stone { min-height: 54px; }
  .dock-mc .dock-head { margin-bottom: 4px; }
  .mascot { width: 92px; }
  .scale-status { margin-top: 2px; }
}

@media (max-height: 660px) {
  .dial-tilt-labels { display: none; }
  .scale-status { display: none; }
  .dial { height: 96px; }
.pan { min-height: 126px; }
  .question-text { font-size: 22px; }
  .answer-display { font-size: 30px; }
  .mascot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
  .bg-rays,
  .cat-all,
  .cat-tail,
  .cat-ear,
  .eye-open,
  .crown-glint,
  .seal,
  .pan-answer,
  .lock-token.is-current {
    animation: none !important;
  }
  .screen { transition: none; }
}

/* =========================================================
   THREE.JS GAME STAGE � mode 3D + compact fallback
   ========================================================= */

[hidden] { display: none !important; }

.game-main {
  display: block;
  padding: 0;
  overflow: hidden;
  background: transparent;
}
.game-main.is-compact {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px 10px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 176, 65, 0.35) transparent;
}
.game-main.is-compact::-webkit-scrollbar { width: 6px; }
.game-main.is-compact::-webkit-scrollbar-thumb { background: rgba(245, 176, 65, 0.35); border-radius: 3px; }

.stage-3d {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(245, 176, 65, 0.1), transparent 55%),
    linear-gradient(180deg, #24102f, #15081f);
}
.stage-3d.is-3d {
  position: absolute;
  inset: 0;
  height: auto;
  overflow: hidden;
}
.stage-3d.is-compact {
  position: relative;
  height: auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding-bottom: 6px;
  overflow: visible;
  background:
    radial-gradient(ellipse at 50% 10%, rgba(245, 176, 65, 0.1), transparent 50%),
    linear-gradient(180deg, #24102f, #15081f);
}

.three-host {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.three-host canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.stage-3d.is-compact .three-host,
.stage-3d.is-compact .scene-vignette { display: none; }

.scene-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 42%, rgba(9, 3, 15, 0.35) 78%, rgba(9, 3, 15, 0.65) 100%),
    linear-gradient(180deg, rgba(9, 3, 15, 0.3), transparent 16%, transparent 80%, rgba(9, 3, 15, 0.48));
}

.pan-layer {
  position: relative;
  z-index: 6;
  pointer-events: none;
}
.stage-3d.is-3d .pan-layer {
  position: absolute;
  inset: 0;
}
.pan-float {
  pointer-events: none;
}
.pan-float .pan { pointer-events: auto; }
.stage-3d.is-3d .pan-float {
  position: absolute;
  top: 0;
  left: 0;
  width: 34%;
  opacity: 0;
  transform: translate3d(0, 0, 0);
  will-change: transform, width;
}
.stage-3d.is-3d.has-anchors .pan-float {
  opacity: 1;
  transition: opacity 0.28s ease;
}
.pan-hook {
  position: absolute;
  top: -9px;
  left: 50%;
  z-index: 5;
  width: 18px;
  height: 18px;
  transform: translateX(-50%);
  border: 3px solid #d29a2d;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #ffe29a, #a16a0b 60%, #4a2b00);
  box-shadow:
    0 0 0 2px rgba(30, 12, 42, 0.7),
    0 0 14px rgba(245, 176, 65, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  pointer-events: none;
}
.stage-3d.is-compact .pan-hook { display: none; }

.stage-3d.is-3d .pan {
  min-height: clamp(164px, 23vh, 226px);
  box-shadow:
    inset 0 0 0 1px rgba(92, 58, 0, 0.25),
    0 22px 45px rgba(0, 0, 0, 0.48);
}
.stage-3d.is-3d .pan-answer {
  box-shadow:
    inset 0 0 30px rgba(245, 176, 65, 0.08),
    inset 0 0 0 1px rgba(255, 226, 154, 0.18),
    0 22px 45px rgba(0, 0, 0, 0.5),
    0 0 28px rgba(245, 176, 65, 0.13);
}
.stage-3d.is-3d .scale-status {
  position: absolute;
  left: 50%;
  bottom: 9px;
  z-index: 9;
  transform: translateX(-50%);
  max-width: min(92%, 640px);
}
.stage-3d.is-compact .pan-layer {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 8px;
}
.stage-3d.is-compact .pan-float {
  position: relative;
  left: auto !important;
  top: auto !important;
  width: 100% !important;
  opacity: 1 !important;
  transform: none !important;
}
.stage-3d.is-compact .pan {
  width: 100%;
  min-height: 0;
  padding: 10px 14px;
  border-width: 2px;
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}
.stage-3d.is-compact .pan-question { min-height: 104px; }
.stage-3d.is-compact .pan-answer { min-height: 92px; }
.stage-3d.is-compact .pan-topline { min-height: 19px; }
.stage-3d.is-compact .subject-chip { padding: 3px 8px; font-size: 8px; }
.stage-3d.is-compact .pan-label { font-size: 8px; }
.stage-3d.is-compact .answer-state { width: 19px; height: 19px; font-size: 10px; }
.stage-3d.is-compact .question-text {
  margin: 5px 0 3px;
  font-size: clamp(20px, 3.1vw, 27px);
}
.stage-3d.is-compact .question-text.is-long { font-size: clamp(20px, 2.5vw, 24px); }
.stage-3d.is-compact .question-text.is-very-long { font-size: clamp(20px, 2.2vw, 21px); }
.stage-3d.is-compact .question-note { font-size: 10px; }
.stage-3d.is-compact .answer-display { margin: 3px 0 1px; font-size: clamp(28px, 4.6vw, 40px); }
.stage-3d.is-compact .answer-display.is-long { font-size: clamp(19px, 3.2vw, 28px); }
.stage-3d.is-compact .answer-display.is-very-long { font-size: clamp(16px, 2.6vw, 23px); }
.stage-3d.is-compact .drop-hint { font-size: 8px; }
.stage-3d.is-compact .pan-ornament { display: none; }
.stage-3d.is-compact .scale-status {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  margin: 2px auto 0;
}

.compact-dial {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  flex: none;
  z-index: 5;
}
.stage-3d.is-compact .compact-dial { display: flex; }
.stage-3d.is-3d .compact-dial { display: none; }
.stage-3d.is-compact .dial {
  width: min(250px, 76vw);
  height: auto;
  aspect-ratio: 2 / 1;
}
.stage-3d.is-compact .dial-tilt-labels {
  width: min(300px, 90%);
  font-size: 8px;
  margin-bottom: 0;
}

.stage-3d.is-3d .mascot {
  position: absolute;
  left: 1.5%;
  top: 11%;
  bottom: auto;
  width: min(248px, 22vw);
  z-index: 8;
  display: block;
  pointer-events: none;
}
.stage-3d.is-3d .mascot-figure { display: none; }
.stage-3d.is-3d .mascot-bubble {
  display: block;
  position: relative;
  left: auto;
  bottom: auto;
  width: 100%;
  max-width: none;
  font-size: clamp(11px, 0.95vw, 13px);
}
.stage-3d.is-3d .mascot-bubble::after { left: 18px; bottom: -10px; }
.stage-3d.is-compact .mascot { display: none; }

.stage-3d.is-balanced .scale-status {
  border-color: rgba(46, 204, 113, 0.55);
  background: rgba(10, 55, 31, 0.88);
  box-shadow: 0 0 22px rgba(46, 204, 113, 0.2);
}
.stage-3d.is-balanced .status-dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.stage-3d.is-wrong .scale-status {
  border-color: rgba(217, 80, 80, 0.5);
  background: rgba(69, 16, 24, 0.88);
}
.stage-3d.is-wrong .status-dot { background: var(--red); box-shadow: 0 0 10px var(--red); }
.stage-3d.is-wrong .dial { animation: scaleShake 0.4s ease; }
.stage-3d.is-balanced .pivot-gem {
  background: linear-gradient(135deg, #b5ffd4, #2ecc71 45%, #147a44);
  box-shadow:
    0 0 0 3px rgba(30, 12, 42, 0.7),
    0 0 0 5px rgba(46, 204, 113, 0.32),
    0 0 28px rgba(46, 204, 113, 0.85);
  animation: gemGlow 1.6s ease-in-out infinite;
}
.stage-3d.is-wrong .pivot-gem {
  background: linear-gradient(135deg, #ffb5b5, #d95050 45%, #8e2a2a);
  box-shadow:
    0 0 0 3px rgba(30, 12, 42, 0.7),
    0 0 0 5px rgba(217, 80, 80, 0.22),
    0 0 20px rgba(217, 80, 80, 0.55);
}

/* Kartu sedikit lebih rapat di layar pendek mode 3D */
@media (max-height: 780px) and (min-width: 900px) {
  .stage-3d.is-3d .pan {
    min-height: 148px;
    padding: 11px 15px;
  }
  .stage-3d.is-3d .question-text { font-size: clamp(20px, 2.2vw, 30px); }
  .stage-3d.is-3d .question-text.is-long { font-size: clamp(20px, 1.7vw, 24px); }
  .stage-3d.is-3d .question-text.is-very-long { font-size: clamp(20px, 1.5vw, 21px); }
  .stage-3d.is-3d .answer-display { font-size: clamp(28px, 3.2vw, 44px); }
  .stage-3d.is-3d .answer-display.is-long { font-size: clamp(19px, 2vw, 28px); }
  .stage-3d.is-3d .answer-display.is-very-long { font-size: clamp(16px, 1.7vw, 23px); }
  .stage-3d.is-3d .scale-status { font-size: 11px; min-height: 28px; }
  .stage-3d.is-3d .mascot { top: 6%; }
  .stage-3d.is-3d .mascot-bubble { font-size: 11px; padding: 8px 11px; }
}

@media (max-height: 650px) and (min-width: 900px) {
  .stage-3d.is-3d .pan { min-height: 124px; padding: 8px 12px; }
  .stage-3d.is-3d .question-text { font-size: clamp(17px, 1.9vw, 24px); }
  .stage-3d.is-3d .answer-display { font-size: clamp(24px, 2.8vw, 36px); }
  .stage-3d.is-3d .scale-status { bottom: 4px; min-height: 24px; padding: 4px 12px; font-size: 10px; }
  .stage-3d.is-3d .mascot { display: none; }
}

@media (max-width: 1050px) and (min-width: 900px) {
  .stage-3d.is-3d .mascot { width: min(200px, 21vw); top: 9%; }
}

/* Compact untuk ponsel / tablet portrait: kartu ditumpuk, dial HTML */
@media (max-width: 899px) {
  .stage-3d.is-compact .dial { width: min(246px, 74vw); }
  .stage-3d.is-compact .dial-tilt-labels { width: min(286px, 88%); }
  .stage-3d.is-compact .game-main { overflow-y: auto; }
}

@media (max-width: 560px) {
  .stage-3d.is-compact .question-text { font-size: clamp(19px, 5.1vw, 24px); }
  .stage-3d.is-compact .question-text.is-long { font-size: clamp(20px, 4.2vw, 22px); }
  .stage-3d.is-compact .question-text.is-very-long { font-size: clamp(20px, 3.8vw, 21px); }
  .stage-3d.is-compact .answer-display { font-size: clamp(27px, 8.4vw, 36px); }
  .stage-3d.is-compact .answer-display.is-long { font-size: clamp(18px, 5.2vw, 24px); }
  .stage-3d.is-compact .answer-display.is-very-long { font-size: clamp(15px, 4.3vw, 20px); }
  .stage-3d.is-compact .scale-status { font-size: 10px; padding: 5px 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .stage-3d.is-3d.has-anchors .pan-float { transition: none; }
}

/* Urutan tata letak ringkas: dial di atas, lalu soal, jawaban, status */
.stage-3d.is-compact .compact-dial { order: 1; }
.stage-3d.is-compact .pan-layer { order: 2; }
.stage-3d.is-compact .scale-status { order: 3; }

/* Perbaikan posisi dialog Raja Kucing di layar judul */
.vault-stage .title-bubble {
  position: absolute;
  left: 47%;
  bottom: 4%;
  width: min(210px, 42%);
  z-index: 6;
}

/* Maskot html di mode ringkas (tablet portrait / ponsel) */
.stage-3d.is-compact .mascot {
  position: relative;
  left: auto;
  bottom: auto;
  width: 100%;
  order: 4;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 4px 0 8px;
  margin-top: -2px;
  pointer-events: none;
}
.stage-3d.is-compact .mascot-figure {
  display: block;
  width: 82px;
  flex: none;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.3));
}
.stage-3d.is-compact .mascot-bubble {
  position: relative;
  left: auto;
  bottom: auto;
  width: auto;
  max-width: 250px;
  margin-bottom: 8px;
  padding: 8px 11px;
  font-size: 11px;
  animation: bubbleIn 0.35s var(--ease-spring);
}
.stage-3d.is-compact .mascot-bubble::after { left: 14px; bottom: -10px; }

/* Target sentuh lebih nyaman di layar kecil */
@media (max-width: 899px) {
  .answer-input { min-height: 48px; }
  .btn-weigh { min-height: 48px; font-size: 14px; }
  .numkey { min-height: 42px; }
  .stone { min-height: 52px; }
  .input-clear { width: 36px; height: 36px; }
}

/* Hadiah di balik pintu harta */
.treasure-chest {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 190px;
  height: 104px;
  transform: translateX(-50%);
  z-index: 1;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.35));
}
.chest-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 68px;
  border: 3px solid var(--gold-dark);
  border-radius: 5px 5px 9px 9px;
  background:
    linear-gradient(90deg, transparent 0 14%, rgba(255,226,154,.5) 14% 17%, transparent 17% 83%, rgba(255,226,154,.5) 83% 86%, transparent 86%),
    linear-gradient(180deg, #7a2c1c, #4d160f);
  box-shadow: inset 0 0 16px rgba(0,0,0,.35);
}
.chest-lid {
  position: absolute;
  left: -3px;
  right: -3px;
  top: 0;
  height: 48px;
  border: 3px solid var(--gold);
  border-radius: 50% 50% 5px 5px / 92% 92% 5px 5px;
  background:
    linear-gradient(90deg, transparent 0 14%, rgba(255,226,154,.55) 14% 17%, transparent 17% 83%, rgba(255,226,154,.55) 83% 86%, transparent 86%),
    linear-gradient(180deg, #9a3c25, #5a1d12);
  box-shadow: inset 0 4px 8px rgba(255,255,255,.14);
}
.chest-lock {
  position: absolute;
  left: 50%;
  top: 36px;
  width: 24px;
  height: 27px;
  transform: translateX(-50%);
  border: 2px solid var(--gold-dark);
  border-radius: 4px 4px 7px 7px;
  background: linear-gradient(180deg, #ffe29a, #c9953f);
  z-index: 2;
}
.chest-lock::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 7px;
  width: 7px;
  height: 9px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: #5c3a00;
}
.treasure-crown {
  width: 158px;
  height: 98px;
  bottom: 45%;
  z-index: 3;
}
.vault .treasure-crown span { bottom: 16px; width: 12px; height: 12px; }
.vault .treasure-crown span:nth-child(1) { left: 25%; }
.vault .treasure-crown span:nth-child(2) { left: 46%; }
.vault .treasure-crown span:nth-child(3) { right: 25%; }
.treasure-coins { z-index: 2; }

/* Teks rekapitulasi lebih ramah dibaca */
.stat-label { font-size: 9.5px; }
.recap-prompt { font-size: 11.5px; }
.recap-answer { font-size: 10.5px; }
.recap-meta { font-size: 9.5px; }
.recap-row { padding: 7px 9px; }

.stage-3d.is-compact .mascot-bubble { display: block; }

@media (max-width: 560px) {
  .stage-3d.is-compact .dial { width: min(230px, 72vw); }
  .stage-3d.is-compact .dial-tilt-labels { width: min(286px, 88%); }
  .stage-3d.is-compact .mascot-figure { width: 70px; }
  .stage-3d.is-compact .mascot-bubble {
    max-width: 238px;
    padding: 7px 10px;
    font-size: 10.5px;
  }
}

.stage-3d.is-compact .mascot-bubble::after {
  left: auto;
  right: 18px;
}

/* Tablet portrait: kolom tengah yang lebih lega, tidak melebar penuh */
@media (min-width: 600px) {
  .stage-3d.is-compact {
    justify-content: center;
    padding-top: 4px;
    gap: 10px;
  }
  .stage-3d.is-compact .compact-dial { flex: none; }
  .stage-3d.is-compact .dial { width: min(330px, 48vw); }
  .stage-3d.is-compact .dial-tilt-labels { width: min(360px, 90%); font-size: 9px; }
  .stage-3d.is-compact .pan-layer {
    width: min(600px, 100%);
    margin: 0 auto;
    gap: 10px;
  }
  .stage-3d.is-compact .pan {
    padding: 13px 18px;
    border-radius: 16px;
  }
  .stage-3d.is-compact .pan-question { min-height: 132px; }
  .stage-3d.is-compact .pan-answer { min-height: 112px; }
  .stage-3d.is-compact .question-text { font-size: clamp(21px, 3.2vw, 28px); }
  .stage-3d.is-compact .question-text.is-long { font-size: clamp(20px, 2.7vw, 24px); }
  .stage-3d.is-compact .question-text.is-very-long { font-size: clamp(20px, 2.4vw, 22px); }
  .stage-3d.is-compact .answer-display { font-size: clamp(30px, 4.8vw, 42px); }
  .stage-3d.is-compact .answer-display.is-long { font-size: clamp(21px, 3.4vw, 30px); }
  .stage-3d.is-compact .answer-display.is-very-long { font-size: clamp(17px, 2.8vw, 24px); }
  .stage-3d.is-compact .scale-status { margin-top: 2px; }
  .stage-3d.is-compact .mascot {
    width: min(600px, 100%);
    margin: 0 auto;
    padding-left: 4px;
  }
  .stage-3d.is-compact .mascot-figure { width: 100px; }
  .stage-3d.is-compact .mascot-bubble { max-width: 300px; font-size: 12px; }
  .stage-3d.is-compact .mascot-bubble::after { left: auto; right: 18px; }
}

@media (max-height: 780px) and (min-width: 900px) {
  .numkey { min-height: 38px; }
}

/* Demo panduan: jawaban tidak menimpa label */
.demo-answer {
  position: relative;
  display: block;
  width: 100%;
  height: 24px;
}
.demo-answer .demo-q,
.demo-answer .demo-a {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  text-align: center;
}

/* Panel hasil di ponsel: beri ruang untuk pembahasan */
@media (max-width: 560px) {
  .dock-result {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .result-burst {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  .result-copy { flex: 1 1 calc(100% - 48px); }
  .result-copy h2 { font-size: 18px; }
  .result-explanation { font-size: 11px; line-height: 1.35; }
  .result-side {
    flex: 1 0 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .reward-chip { min-height: 28px; }
  .btn-next { min-height: 44px; padding: 0 14px; font-size: 14px; }
}

/* Label kelas/mapel tetap terlihat di layar kecil */
.hud-session { display: block; }

/* Jaga rasio dial compact di layar pendek */
.stage-3d.is-compact .dial { height: auto; }

/* Gambar soal opsional (prompt_image) */
.question-image {
  display: block;
  max-width: 100%;
  max-height: 76px;
  margin: 4px auto 0;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.35);
}
.stage-3d.is-3d .question-image { max-height: 64px; }
.stage-3d.is-compact .question-image { max-height: 56px; }
