/* =========================================================
   TIMBANGAN AJAIB RAJA — UI theme
   Warm cream / brown / gold · chunky cartoon buttons
   ========================================================= */

:root {
  --purple-950: #1B120D;
  --purple-900: #241710;
  --purple-800: #332116;
  --purple-700: #4A2E18;
  --purple-600: #5A3A1E;
  --plum: #7A4A22;
  --maroon: #7A2F22;
  --maroon-deep: #4A1A12;
  --gold: #F6C84C;
  --gold-light: #FFE39A;
  --gold-pale: #FFF4D0;
  --gold-dark: #8A5A1E;
  --gold-deep: #4A2E18;
  --cream: #FDF0C8;
  --cream-2: #F5E3B4;
  --parchment: #FFF1C9;
  --ink: #2B1E16;
  --ink-soft: #6B4E33;
  --green: #52B765;
  --green-dark: #2F7D46;
  --green-pale: #DDF3D9;
  --red: #E56B5B;
  --red-dark: #A84338;
  --silver: #E7E0D2;
  --silver-dark: #8B8172;
  --outline: #2B1E16;
  --font-display: "Fredoka", "Trebuchet MS", sans-serif;
  --font-body: "Nunito", "Segoe UI", sans-serif;
  --font-hand: "Patrick Hand", "Comic Sans MS", cursive;
}

html,
body {
  background: #1B120D;
}

body {
  color: var(--ink);
}

/* global warm background for screens that still use .bg */
.bg {
  background:
    radial-gradient(ellipse at 50% 20%, rgba(246, 200, 76, 0.14), transparent 45%),
    radial-gradient(ellipse at 50% 110%, rgba(122, 47, 34, 0.55), transparent 58%),
    linear-gradient(170deg, #332116 0%, #241710 48%, #1B120D 100%);
}
.bg-arches {
  border-color: rgba(246, 200, 76, 0.13);
  box-shadow: inset 0 0 0 18px rgba(246, 200, 76, 0.03), inset 0 0 0 20px rgba(246, 200, 76, 0.07);
}
.bg-column,
.bg-banner,
.bg-rays,
.bg-carpet {
  opacity: 0.25;
}
.bg-rays {
  opacity: 0.18;
}
.bg-noise {
  opacity: 0.07;
}

/* 3D canvas: bring the old purple stage into the warm wooden room */
#threeHost canvas {
  filter: sepia(0.55) hue-rotate(-18deg) saturate(0.75) brightness(1.06) contrast(1.02);
}

.icon-btn {
  color: var(--ink);
  border: 3px solid var(--ink);
  background: var(--cream);
  box-shadow: 0 4px 0 #B9772E;
}
.icon-btn:hover {
  background: var(--gold);
  border-color: var(--ink);
}
.icon-btn.is-muted {
  color: var(--ink-soft);
  background: #D8C9AA;
}
.kicker {
  color: var(--gold-dark);
}
.kicker-dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}
.btn-primary {
  border: 3px solid var(--ink);
  border-radius: 16px;
  color: #FFF8E4;
  background: var(--green);
  box-shadow: 0 6px 0 #1E5A33, 0 10px 18px rgba(0, 0, 0, 0.18);
  font-family: var(--font-display);
}
.btn-primary:hover {
  filter: brightness(1.05);
}
.btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #1E5A33;
}
.btn-primary:disabled {
  color: #71695E;
  background: #D5CBB7;
  border-color: #A89D8B;
  box-shadow: 0 4px 0 #A89D8B;
  opacity: 1;
}
.btn-ghost {
  color: var(--ink);
  border: 3px solid var(--ink);
  background: var(--cream);
  box-shadow: 0 4px 0 #B9772E;
  font-family: var(--font-display);
}
.btn-ghost:hover {
  background: var(--gold);
  border-color: var(--ink);
}
.btn-ghost:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #B9772E;
}

/* =========================================================
   SHARED FANTASY BUTTON (main menu / select / pause / win)
   ========================================================= */

.fantasy-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 62px;
  padding: 0 24px;
  border: 4px solid var(--ink);
  border-radius: 18px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 7px 0 #B9772E, 0 11px 20px rgba(0, 0, 0, 0.22);
  font-family: var(--font-display);
  font-size: clamp(16px, 1.35vw, 23px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fantasy-btn:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}
.fantasy-btn:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 #B9772E, 0 5px 10px rgba(0, 0, 0, 0.18);
}
.fantasy-btn.primary {
  color: #FFF8E4;
  background: var(--green);
  box-shadow: 0 7px 0 #1E5A33, 0 11px 22px rgba(0, 0, 0, 0.25), inset 0 3px 0 rgba(255, 255, 255, 0.22);
}
.fantasy-btn.primary:active {
  box-shadow: 0 2px 0 #1E5A33;
}
.fantasy-btn.cream {
  background: var(--cream);
}
.fantasy-btn.exit {
  color: #FFF8E4;
  background: var(--red);
  box-shadow: 0 7px 0 #8A2F26, 0 11px 22px rgba(0, 0, 0, 0.22);
}
.fantasy-btn.exit:active {
  box-shadow: 0 2px 0 #8A2F26;
}
.fantasy-btn.nav {
  width: auto;
  min-height: 46px;
  padding: 0 17px;
  font-size: 15px;
  box-shadow: 0 4px 0 #B9772E;
}
.fantasy-btn.nav:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #B9772E;
}
.fantasy-btn.small {
  min-height: 44px;
}
.btn-leaf {
  position: absolute;
  left: 16px;
  top: -11px;
  width: 18px;
  height: 12px;
  transform: rotate(-28deg);
  border: 2px solid var(--ink);
  border-radius: 100% 0 100% 0;
  background: #83D58D;
  box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.24);
}
.btn-play-icon {
  font-family: var(--font-body);
  font-size: 0.72em;
}
.text-btn {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-hand);
  font-size: 20px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* =========================================================
   MAIN MENU
   ========================================================= */

.menu-screen {
  overflow: hidden !important;
  background: #1B120D;
}
.menu-scene {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: #1B120D;
}
.menu-wall {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 32%, rgba(246, 200, 76, 0.2), transparent 47%),
    repeating-linear-gradient(0deg, rgba(20, 12, 7, 0.34) 0 3px, transparent 3px 58px),
    repeating-linear-gradient(90deg, rgba(20, 12, 7, 0.3) 0 3px, transparent 3px 104px),
    linear-gradient(180deg, #3A2A1F 0%, #2A1C12 52%, #1B120D 100%);
}
.menu-wall::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image: radial-gradient(rgba(255, 244, 208, 0.09) 1px, transparent 1.5px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
}
.menu-wall-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 48%, transparent 26%, rgba(10, 5, 3, 0.65) 88%),
    linear-gradient(180deg, rgba(10, 5, 3, 0.4), transparent 26%, transparent 76%, rgba(10, 5, 3, 0.55));
  pointer-events: none;
}
.menu-warm-light {
  position: absolute;
  left: 50%;
  top: 14%;
  width: 80%;
  height: 75%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 45%, rgba(246, 200, 76, 0.2), transparent 62%);
  pointer-events: none;
}
.menu-door-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(520px, 56vh, 72vw);
  transform: translate(-50%, -48%);
  z-index: 2;
}
.menu-door-arch {
  position: absolute;
  inset: -32px -28px 10px;
  z-index: -1;
  border: 22px solid #4D392A;
  border-bottom: 0;
  border-radius: 48% 48% 0 0 / 38% 38% 0 0;
  background: linear-gradient(180deg, #5E4634, #3A2A1F);
  box-shadow:
    inset 0 0 0 5px rgba(246, 200, 76, 0.12),
    0 22px 40px rgba(0, 0, 0, 0.45);
}
.menu-door-arch::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px dashed rgba(253, 240, 200, 0.14);
  border-bottom: 0;
  border-radius: 48% 48% 0 0 / 38% 38% 0 0;
}
.menu-door-steps {
  position: absolute;
  left: -12%;
  right: -12%;
  bottom: -22px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 30%, #6B4A2F, #2B1A10 70%);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}
.menu-vault {
  position: relative;
  width: 100%;
}
.menu-screen .vault {
  filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.5));
}
/* wooden door for both menu and victory */
.menu-screen .vault-half,
.victory-screen .vault-half {
  background:
    repeating-linear-gradient(90deg, rgba(255, 244, 208, 0.06) 0 2px, transparent 2px 28px),
    linear-gradient(180deg, #7A4A24 0%, #5A3419 44%, #3F2311 100%);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.48);
}
.menu-screen .vault-panel,
.victory-screen .vault-panel {
  border-color: rgba(246, 200, 76, 0.32);
}
.menu-screen .vault-crest svg circle:nth-child(1),
.victory-screen .vault-crest svg circle:nth-child(1) {
  fill: #F6C84C;
}
.menu-screen .vault-crest svg circle:nth-child(2),
.victory-screen .vault-crest svg circle:nth-child(2) {
  fill: #4A2E18;
}
.menu-screen .vault-frame::before,
.victory-screen .vault-frame::before {
  background: linear-gradient(100deg, #4A2E18 0%, #C98A2C 22%, #F6C84C 43%, #8A5A1E 67%, #E2B34A 82%, #4A2E18 100%);
}
.menu-screen .seal,
.victory-screen .seal {
  box-shadow:
    0 0 0 3px #4A2E18,
    0 0 0 4px rgba(255, 244, 208, 0.2),
    0 0 16px rgba(246, 200, 76, 0.55);
}
.menu-screen .vault-light,
.victory-screen .vault-light {
  background:
    radial-gradient(ellipse at 50% 74%, #FFF4C9 0%, #F6C84C 24%, rgba(246, 200, 76, 0.35) 48%, transparent 72%),
    linear-gradient(180deg, rgba(246, 200, 76, 0.25), rgba(122, 47, 34, 0.15));
}
.menu-screen .vault-plinth,
.victory-screen .vault-plinth {
  background: linear-gradient(180deg, #C98A2C, #6B431E 55%, #3A2413);
}

.hanging-padlock {
  position: absolute;
  z-index: 2;
  width: 54px;
  height: 68px;
  filter: drop-shadow(0 7px 0 rgba(0, 0, 0, 0.22));
}
.padlock-shackle {
  position: absolute;
  left: 14px;
  top: 0;
  width: 26px;
  height: 28px;
  border: 7px solid #4D392A;
  border-bottom: 0;
  border-radius: 15px 15px 0 0;
}
.padlock-body {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 0;
  height: 45px;
  border: 4px solid #2B1E16;
  border-radius: 9px;
  background: linear-gradient(180deg, #7A6350, #4D392A);
  box-shadow: inset 0 2px 0 rgba(255, 244, 208, 0.18);
}
.padlock-body::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 14px;
  width: 8px;
  height: 15px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: #1B120D;
}
.hp1 { left: 9%; top: 18%; transform: rotate(-9deg); }
.hp2 { right: 11%; top: 15%; transform: rotate(8deg) scale(0.85); }
.hp3 { left: 14%; top: 53%; transform: rotate(7deg) scale(0.8); }
.hp4 { right: 15%; top: 51%; transform: rotate(-8deg) scale(0.92); }
.menu-spark {
  position: absolute;
  z-index: 2;
  color: var(--gold);
  font-family: var(--font-display);
  line-height: 1;
  opacity: 0.75;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.menu-spark.sp1 { left: 25%; top: 14%; font-size: 27px; }
.menu-spark.sp2 { right: 28%; top: 25%; font-size: 18px; }
.menu-spark.sp3 { left: 19%; top: 42%; font-size: 17px; opacity: 0.5; }
.menu-spark.sp4 { right: 21%; top: 64%; font-size: 26px; opacity: 0.6; }
.menu-spark.sp5 { left: 30%; bottom: 13%; font-size: 14px; opacity: 0.45; }
.menu-paw {
  position: absolute;
  z-index: 2;
  width: 40px;
  height: 40px;
  color: #8A6A4F;
  opacity: 0.5;
}
.menu-paw.mp1 { right: 8%; top: 34%; transform: rotate(18deg); }
.menu-paw.mp2 { left: 10%; bottom: 17%; transform: rotate(-22deg) scale(0.8); }

.menu-layer {
  position: relative;
  z-index: 3;
  width: min(1280px, 100% - 48px);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 18px 0 14px;
  color: var(--cream);
}
.menu-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex: none;
}
.menu-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(253, 240, 200, 0.82);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.menu-brand-crest {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(43, 30, 22, 0.44);
}
.menu-brand-crest svg { width: 21px; height: 21px; }
.menu-top-actions { display: flex; gap: 8px; }
.menu-icon {
  width: 42px;
  height: 42px;
  border-width: 2px;
  box-shadow: 0 4px 0 #6B431E;
}
.menu-icon svg { width: 21px; height: 21px; }

.menu-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
}
.menu-plaque {
  position: absolute;
  left: 50%;
  top: clamp(4px, 2.3vh, 26px);
  z-index: 6;
  width: min(700px, 66vw);
  transform: translateX(-50%) rotate(-0.4deg);
  padding: clamp(18px, 2.4vh, 28px) 40px clamp(20px, 2.6vh, 32px);
  border: 5px solid var(--ink);
  border-radius: 26px 26px 44px 44px / 26px 26px 58px 58px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 244, 208, 0.26), transparent 52%),
    linear-gradient(180deg, #8A5A2B 0%, #6B3F1C 56%, #4E2B15 100%);
  box-shadow:
    inset 0 0 0 4px rgba(246, 200, 76, 0.7),
    inset 0 0 0 7px rgba(43, 30, 22, 0.22),
    0 9px 0 #2B1E16,
    0 22px 38px rgba(0, 0, 0, 0.4);
  text-align: center;
}
.menu-plaque::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 2px dashed rgba(255, 244, 208, 0.35);
  border-radius: 20px 20px 35px 35px / 20px 20px 46px 46px;
  pointer-events: none;
}
.plaque-crown {
  position: absolute;
  left: 50%;
  top: -37px;
  transform: translateX(-50%) rotate(-2deg);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: clamp(42px, 5vw, 68px);
  line-height: 1;
  text-shadow:
    0 3px 0 #4A2E18,
    0 0 18px rgba(246, 200, 76, 0.6);
  z-index: 7;
}
.menu-plaque h1 {
  position: relative;
  z-index: 2;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.015em;
  text-shadow: 0 4px 0 #2B1E16;
}
.plaque-line1 {
  display: block;
  color: var(--cream);
  font-size: clamp(38px, 5.2vw, 72px);
  font-weight: 500;
}
.plaque-line2 {
  display: block;
  margin-top: 2px;
  color: var(--gold);
  font-size: clamp(48px, 6.6vw, 92px);
}
.plaque-star {
  position: absolute;
  color: var(--gold);
  font-family: var(--font-display);
  line-height: 1;
  opacity: 0.8;
}
.plaque-star.ps1 { left: 11%; top: 24%; font-size: 23px; }
.plaque-star.ps2 { right: 10%; bottom: 20%; font-size: 17px; opacity: 0.55; }

.menu-actions {
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 8;
  width: min(348px, 52vw);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.menu-actions .fantasy-btn { width: 100%; }
.menu-actions .fantasy-btn.primary { min-height: 66px; font-size: clamp(22px, 2vw, 29px); }

.menu-side {
  position: absolute;
  right: 1.5%;
  bottom: 0;
  z-index: 7;
  width: min(300px, 27vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.name-card {
  position: relative;
  z-index: 3;
  width: min(226px, 100%);
  padding: 13px 13px 11px;
  border: 3px solid var(--ink);
  border-radius: 15px;
  background: var(--cream);
  box-shadow: 0 6px 0 #B9772E, 0 12px 20px rgba(0, 0, 0, 0.28);
  transform: rotate(-1deg);
  pointer-events: auto;
}
.name-card label {
  display: inline-block;
  padding: 3px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px 8px 0 0;
  color: var(--cream);
  background: #6B4E33;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.03em;
}
.name-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: -2px;
  border-bottom: 2px dashed rgba(107, 78, 51, 0.3);
}
.name-card input {
  width: 100%;
  min-width: 0;
  padding: 4px 2px 6px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-family: var(--font-hand);
  font-size: clamp(25px, 2.6vw, 34px);
  line-height: 1;
}
.name-pencil {
  flex: none;
  color: var(--ink-soft);
  font-size: 22px;
  transform: rotate(-10deg);
}
.menu-cat {
  position: relative;
  z-index: 4;
  width: min(255px, 100%);
  margin-top: -18px;
  filter: drop-shadow(0 14px 14px rgba(0, 0, 0, 0.35));
}
.menu-cat svg { display: block; width: 100%; height: auto; }
.menu-foot {
  flex: none;
  padding: 8px 0 0;
  color: rgba(253, 240, 200, 0.58);
  font-family: var(--font-hand);
  font-size: 18px;
  text-align: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}
.menu-foot span { color: rgba(246, 200, 76, 0.55); padding: 0 4px; }

/* =========================================================
   CLASS & SUBJECT SELECT
   ========================================================= */

.select-screen {
  overflow-y: auto !important;
  background: #1B120D;
}
.select-wall {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(246, 200, 76, 0.2), transparent 52%),
    repeating-linear-gradient(0deg, rgba(20, 12, 7, 0.33) 0 3px, transparent 3px 62px),
    repeating-linear-gradient(90deg, rgba(20, 12, 7, 0.3) 0 3px, transparent 3px 118px),
    linear-gradient(180deg, #3A2A1F 0%, #2A1C12 58%, #1B120D 100%);
  pointer-events: none;
}
.select-wall::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%, transparent 22%, rgba(10, 5, 3, 0.62) 88%);
}
.select-layer {
  position: relative;
  z-index: 2;
  width: min(1120px, 100% - 44px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(14px, 3vh, 30px) 0 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.select-top {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: clamp(12px, 2vh, 20px);
  color: var(--cream);
}
.select-top .fantasy-btn.nav {
  flex: none;
}
.select-heading {
  flex: 1;
  text-align: center;
}
.select-heading .kicker {
  justify-content: center;
  color: var(--gold);
  font-size: 10px;
}
.select-heading h1 {
  margin: 4px 0 0;
  color: var(--cream);
  font-family: var(--font-display);
  font-size: clamp(27px, 3.4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.04;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
}
.select-player {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  max-width: 210px;
  margin-left: auto;
  color: var(--cream);
  font-family: var(--font-hand);
  font-size: 22px;
  white-space: nowrap;
}
.select-avatar {
  display: block;
  width: 46px;
  height: 46px;
  flex: none;
  overflow: hidden;
  border: 3px solid var(--gold);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 3px 0 #2B1E16;
}
.select-avatar svg { display: block; width: 100%; height: 100%; }
.select-board {
  position: relative;
  z-index: 2;
  padding: clamp(16px, 2.4vw, 28px);
  border: 4px solid var(--ink);
  border-radius: 26px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.45), transparent 46%),
    linear-gradient(160deg, #FFF4D6 0%, #F5E3B4 72%, #E8D19B 100%);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.25),
    0 9px 0 #2B1E16,
    0 22px 36px rgba(0, 0, 0, 0.38);
  color: var(--ink);
}
.select-board::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1.5px dashed rgba(107, 78, 51, 0.23);
  border-radius: 18px;
  pointer-events: none;
}
.class-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  padding-bottom: clamp(12px, 2vh, 18px);
  border-bottom: 2px dashed rgba(107, 78, 51, 0.22);
}
.class-tab {
  min-height: 42px;
  padding: 0 17px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 4px 0 #B9772E;
  font-family: var(--font-display);
  font-size: clamp(13px, 1.2vw, 17px);
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.class-tab:hover { transform: translateY(-2px); background: var(--gold-light); }
.class-tab.is-selected {
  color: var(--ink);
  background: var(--gold);
  box-shadow: 0 4px 0 #6B431E, 0 0 0 3px rgba(246, 200, 76, 0.28);
}
.subject-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 15px);
  margin: clamp(12px, 2vh, 18px) 0;
}
.subject-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 86px;
  padding: 11px 14px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 247, 222, 0.7);
  box-shadow: 0 5px 0 #C98A2C;
  text-align: left;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}
.subject-card:hover {
  transform: translateY(-2px);
  background: #FFF8E5;
}
.subject-card.is-selected {
  background: var(--gold);
  box-shadow: 0 5px 0 #6B431E, 0 0 0 3px rgba(246, 200, 76, 0.28);
}
.subject-card.is-selected::after {
  content: "★";
  position: absolute;
  top: 8px;
  right: 11px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1;
}
.subject-icon {
  display: grid;
  place-items: center;
  width: clamp(50px, 5.4vw, 64px);
  height: clamp(50px, 5.4vw, 64px);
  flex: none;
  border: 2px solid var(--ink);
  border-radius: 13px;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.35);
}
.subject-icon svg { width: 60%; height: 60%; }
.icon-math { background: #FFD8A0; }
.icon-ipa { background: #D6F0C9; }
.icon-bindo { background: #E3D6F7; }
.icon-ips { background: #CDE9F6; }
.icon-pancasila { background: #F8D2D2; }
.subject-copy { min-width: 0; }
.subject-copy strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(15px, 1.4vw, 20px);
  font-weight: 600;
  line-height: 1.08;
}
.subject-copy span {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.3;
}
.select-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: clamp(12px, 2vh, 18px);
  border-top: 2px dashed rgba(107, 78, 51, 0.22);
}
.select-summary {
  color: var(--ink);
  font-family: var(--font-hand);
  font-size: clamp(19px, 2vw, 27px);
  line-height: 1.05;
}
.select-summary span { color: var(--gold-dark); padding: 0 3px; }
.select-bottom .fantasy-btn {
  width: min(250px, 34vw);
  min-height: 56px;
  flex: none;
}
.select-note {
  margin: 12px auto 0;
  max-width: 760px;
  color: rgba(253, 240, 200, 0.62);
  font-family: var(--font-hand);
  font-size: 17px;
  line-height: 1.25;
  text-align: center;
}
.select-cat {
  position: fixed;
  right: 1.5%;
  bottom: -10px;
  z-index: 1;
  width: min(200px, 18vw);
  opacity: 0.9;
  filter: drop-shadow(0 12px 12px rgba(0, 0, 0, 0.33));
  pointer-events: none;
}
.select-cat svg { display: block; width: 100%; height: auto; }

/* =========================================================
   GAME HUD / STAGE / DOCK
   ========================================================= */

.game-screen {
  background: #1B120D;
}
.hud {
  background: linear-gradient(180deg, #3A2716 0%, #2A1A10 100%);
  border-bottom: 3px solid #C98A2C;
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.4);
}
.hud::after {
  background: linear-gradient(90deg, transparent, rgba(246, 200, 76, 0.7), transparent);
}
.hud-mark {
  color: var(--gold);
  border: 2px solid var(--gold-dark);
  background: radial-gradient(circle at 35% 25%, rgba(246, 200, 76, 0.26), rgba(43, 30, 22, 0.7));
  box-shadow: inset 0 0 14px rgba(246, 200, 76, 0.12);
}
.hud-round {
  color: var(--cream);
  font-family: var(--font-display);
}
.hud-session {
  display: inline-block;
  width: fit-content;
  margin-top: 2px;
  padding: 2px 7px;
  border: 1px solid rgba(246, 200, 76, 0.35);
  border-radius: 999px;
  color: var(--gold-light);
  background: rgba(246, 200, 76, 0.08);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lock-token { color: #8E7A62; }
.lock-token .lock-body {
  background: linear-gradient(160deg, #5C452F, #332116);
  border-color: currentColor;
}
.lock-token.is-current {
  color: var(--gold);
  animation: lockActiveWarm 2s ease-in-out infinite;
}
.lock-token.is-current .lock-body {
  background: linear-gradient(160deg, #8A5A1E, #4A2E18);
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(246, 200, 76, 0.45);
}
.lock-token.is-current .lock-keyhole { background: var(--gold-light); }
.lock-token.is-done { color: var(--green); }
.lock-token.is-done .lock-body {
  background: linear-gradient(160deg, #68CC7A, #2F7D46);
  border-color: #B9F2C1;
  box-shadow: 0 0 12px rgba(82, 183, 101, 0.55);
}
.lock-token.is-done .lock-shackle { border-color: var(--gold-light); }
.coin-pill {
  color: var(--cream);
  border-color: rgba(246, 200, 76, 0.45);
  background: rgba(43, 30, 22, 0.5);
}
.coin-pill-silver { color: var(--silver); border-color: rgba(231, 224, 210, 0.28); }
.coin {
  background: radial-gradient(circle at 35% 28%, #FFF4C9 0%, #F6C84C 38%, #C98A2C 72%, #8A5A1E 100%);
  border-color: #6B431E;
}
.coin::before { color: #6B431E; }
.coin-silver {
  background: radial-gradient(circle at 35% 28%, #FFFFFF 0%, #E7E0D2 38%, #B9B1A0 72%, #8B8172 100%);
  border-color: #6F6759;
}
.coin-silver::before { color: #6F6759; }
.hud .icon-btn {
  width: 38px;
  height: 38px;
  border-width: 2px;
  background: rgba(253, 240, 200, 0.1);
  color: var(--cream);
  box-shadow: none;
}
.hud .icon-btn:hover { background: var(--gold); color: var(--ink); }

.stage-3d {
  background: #1B120D;
}
.scene-vignette {
  background:
    radial-gradient(ellipse at 50% 42%, transparent 38%, rgba(14, 8, 4, 0.35) 78%, rgba(14, 8, 4, 0.72) 100%),
    linear-gradient(180deg, rgba(14, 8, 4, 0.35), transparent 16%, transparent 78%, rgba(14, 8, 4, 0.5));
}
.pan-hook {
  border-color: var(--gold-dark);
  background: radial-gradient(circle at 40% 30%, #FFF4C9, #F6C84C 55%, #8A5A1E);
  box-shadow: 0 0 0 2px rgba(43, 30, 22, 0.7), 0 0 12px rgba(246, 200, 76, 0.35);
}
.pan {
  border-color: var(--ink);
  border-radius: 18px;
  box-shadow:
    inset 0 0 0 2px rgba(201, 138, 44, 0.48),
    0 16px 34px rgba(0, 0, 0, 0.42);
}
.pan-question {
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.9), transparent 52%),
    linear-gradient(160deg, #FFF8E3 0%, #FDF0C8 68%, #EFD9A8 100%);
}
.pan-question::before,
.pan-answer::before {
  background: linear-gradient(90deg, #6B431E, #F6C84C 25%, #FFE39A 50%, #F6C84C 75%, #6B431E);
}
.pan-answer {
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255, 255, 255, 0.5), transparent 55%),
    linear-gradient(160deg, #FFF8E3 0%, #FDF0C8 58%, #EFD9A8 100%);
  border-color: var(--ink);
  box-shadow:
    inset 0 0 0 2px rgba(201, 138, 44, 0.48),
    0 16px 34px rgba(0, 0, 0, 0.42);
  animation: none;
}
.pan-answer.is-correct {
  border-color: var(--green-dark);
  box-shadow: inset 0 0 0 3px var(--green), 0 0 30px rgba(82, 183, 101, 0.4);
}
.pan-answer.is-wrong {
  border-color: var(--red-dark);
  box-shadow: inset 0 0 0 3px var(--red), 0 0 26px rgba(229, 107, 91, 0.3);
}
.pan-answer.is-drop-ready {
  border-color: var(--gold-dark);
  box-shadow: inset 0 0 0 3px var(--gold), 0 0 34px rgba(246, 200, 76, 0.45);
}
.pan-corner { border-color: rgba(138, 90, 30, 0.65); }
.pan-answer .pan-corner { border-color: rgba(138, 90, 30, 0.6); }
.subject-chip {
  color: var(--cream);
  border-color: rgba(246, 200, 76, 0.4);
  background: linear-gradient(160deg, #6B4E33, #4A2E18);
}
.pan-label { color: rgba(107, 78, 51, 0.72); }
.pan-answer .pan-label { color: rgba(107, 78, 51, 0.72); }
.answer-state {
  color: var(--ink);
  border-color: rgba(107, 78, 51, 0.35);
}
.question-text { color: var(--ink); }
.question-note { color: rgba(107, 78, 51, 0.8); }
.answer-display {
  color: var(--gold-dark);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.55);
}
.pan-answer.is-empty .answer-display { color: rgba(138, 90, 30, 0.62); }
.drop-hint { color: rgba(107, 78, 51, 0.6); }
.pan-ornament { color: rgba(138, 90, 30, 0.28); }
.pan-answer .pan-ornament { color: rgba(138, 90, 30, 0.1); }
.scale-status {
  color: var(--ink);
  border-color: rgba(107, 78, 51, 0.35);
  background: rgba(253, 240, 200, 0.92);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.status-dot { background: var(--gold-dark); box-shadow: 0 0 8px rgba(201, 138, 44, 0.6); }
.scale-scene.is-balanced .scale-status,
.stage-3d.is-balanced .scale-status {
  border-color: var(--green-dark);
  background: var(--green);
  color: #FFF8E4;
}
.stage-3d.is-balanced .status-dot { background: #FFF8E4; }
.stage-3d.is-wrong .scale-status {
  border-color: var(--red-dark);
  background: var(--red);
  color: #FFF8E4;
}
.stage-3d.is-wrong .status-dot { background: #FFF8E4; }
.stage-3d.is-balanced .pivot-gem {
  background: linear-gradient(135deg, #D8FFDF, #52B765 45%, #2F7D46);
}
.stage-3d.is-wrong .pivot-gem {
  background: linear-gradient(135deg, #FFD8D2, #E56B5B 45%, #A84338);
}

/* mascot speech in the stage */
.stage-3d.is-3d .mascot-bubble {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--cream);
}
.stage-3d.is-3d .mascot-bubble::after { background: var(--cream); border-color: var(--ink); }
.stage-3d.is-3d .mascot-bubble .bubble-name { color: var(--gold-dark); }

/* answer dock */
.answer-dock {
  background: linear-gradient(180deg, rgba(27, 18, 13, 0.4), rgba(27, 18, 13, 0.9));
}
.dock-panel {
  border: 3px solid var(--ink);
  border-top: 4px solid var(--gold);
  border-radius: 20px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(246, 200, 76, 0.13), transparent 55%),
    linear-gradient(180deg, #3E2A18 0%, #241710 100%);
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.3), inset 0 0 0 2px rgba(246, 200, 76, 0.12);
}
.dock-kicker { color: var(--gold); }
.dock-head h2 { color: var(--cream); }
.dock-hint { color: rgba(253, 240, 200, 0.52); }
.dock-hint.is-warn { color: #FFB7A6; }
.dock-hint.is-good { color: #B8F3C4; }
.answer-input {
  color: var(--ink);
  border: 3px solid var(--ink);
  background: var(--cream);
  box-shadow: inset 0 4px 8px rgba(107, 78, 51, 0.12), 0 3px 0 rgba(107, 78, 51, 0.18);
  font-family: var(--font-display);
}
.answer-input::placeholder { color: rgba(107, 78, 51, 0.48); }
.answer-input:focus {
  border-color: var(--gold-dark);
  box-shadow: 0 0 0 4px rgba(246, 200, 76, 0.32);
}
.answer-input.has-error { border-color: var(--red); box-shadow: 0 0 0 4px rgba(229, 107, 91, 0.18); }
.input-clear { color: var(--ink-soft); background: rgba(107, 78, 51, 0.1); }
.input-clear:hover { color: var(--red-dark); background: rgba(229, 107, 91, 0.14); }
.btn-weigh {
  color: #FFF8E4;
  border-color: var(--ink);
  background: var(--green);
  box-shadow: 0 5px 0 #1E5A33;
}
.btn-weigh:hover { filter: brightness(1.06); }
.btn-weigh:disabled {
  color: #6E665B;
  background: #C5BBA7;
  border-color: #8E8474;
  box-shadow: 0 4px 0 #8E8474;
}
.numpad .numkey {
  color: var(--ink);
  border: 2px solid var(--ink);
  background: var(--cream);
  box-shadow: 0 3px 0 #B9772E;
  font-family: var(--font-display);
}
.numpad .numkey:hover { background: var(--gold); border-color: var(--ink); }
.numpad .numkey:active { transform: translateY(2px); box-shadow: 0 1px 0 #B9772E; }
.numpad .numkey:disabled { color: #8D8373; background: #D8CEBA; box-shadow: 0 2px 0 #A89D8B; }
.numkey-del { color: var(--red-dark); }
.stones .stone {
  color: var(--ink);
  border: 3px solid var(--ink);
  background: var(--cream);
  box-shadow: 0 5px 0 #B9772E;
  font-family: var(--font-display);
}
.stones .stone::before { color: rgba(138, 90, 30, 0.4); }
.stones .stone::after { border-color: rgba(138, 90, 30, 0.16); }
.stones .stone:hover { background: var(--gold-light); }
.stones .stone.is-selected {
  background: var(--gold);
  border-color: var(--ink);
  box-shadow: 0 5px 0 #6B431E, 0 0 0 3px rgba(246, 200, 76, 0.25);
}
.stones .stone.is-selected::after { content: "★"; position: absolute; top: 4px; right: 6px; border: 0; color: var(--ink); font-size: 12px; }
.stones.is-locked .stone { opacity: 0.65; }

/* compact */
.stage-3d.is-compact {
  background:
    radial-gradient(ellipse at 50% 12%, rgba(246, 200, 76, 0.16), transparent 52%),
    linear-gradient(180deg, #3A2A1F, #1B120D);
}
.stage-3d.is-compact .dial-tilt-labels { color: rgba(253, 240, 200, 0.5); }
.stage-3d.is-compact .needle { background: linear-gradient(180deg, #FFF4C9, #F6C84C 62%, #8A5A1E); }
.stage-3d.is-compact .pivot-gem {
  background: linear-gradient(135deg, #FFF4C9, #F6C84C 45%, #8A5A1E);
  border-color: var(--ink);
}
.stage-3d.is-compact .pan-question,
.stage-3d.is-compact .pan-answer { color: var(--ink); }
.stage-3d.is-compact .answer-display { color: var(--gold-dark); }
.stage-3d.is-compact .mascot-bubble {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--cream);
}
.stage-3d.is-compact .mascot-bubble::after { background: var(--cream); border-color: var(--ink); }
.stage-3d.is-compact .mascot-bubble .bubble-name { color: var(--gold-dark); }
.stage-3d.is-compact .pivot-gem { box-shadow: 0 0 0 3px rgba(43, 30, 22, 0.6), 0 0 0 4px rgba(246, 200, 76, 0.28); }
.stage-3d.is-balanced .pivot-gem { background: linear-gradient(135deg, #D8FFDF, #52B765 45%, #2F7D46); }
.stage-3d.is-wrong .pivot-gem { background: linear-gradient(135deg, #FFD8D2, #E56B5B 45%, #A84338); }

/* =========================================================
   ROUND SUCCESS OVERLAY
   ========================================================= */

.round-overlay { z-index: 120; }
.round-overlay .overlay-backdrop {
  background: rgba(20, 12, 7, 0.72);
  backdrop-filter: blur(3px);
}
.round-card {
  position: relative;
  z-index: 2;
  width: min(470px, 92vw);
  max-height: calc(100dvh - 30px);
  overflow-y: auto;
  padding: clamp(18px, 2.8vw, 28px);
  border: 4px solid var(--ink);
  border-radius: 26px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.5), transparent 50%),
    linear-gradient(160deg, #FFF8E5 0%, #FDF0C8 64%, #EFD9A8 100%);
  box-shadow: inset 0 0 0 4px rgba(246, 200, 76, 0.35), 0 10px 0 #6B431E, 0 28px 50px rgba(0, 0, 0, 0.45);
  color: var(--ink);
  text-align: center;
  animation: roundIn 0.42s var(--ease-spring);
}
.round-burst {
  position: relative;
  width: 150px;
  height: 140px;
  margin: -4px auto 0;
}
.round-rays {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 190px;
  height: 190px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(246, 200, 76, 0.38) 0deg 12deg, transparent 12deg 38deg, rgba(246, 200, 76, 0.32) 38deg 50deg, transparent 50deg 76deg, rgba(246, 200, 76, 0.38) 76deg 88deg, transparent 88deg 114deg, rgba(246, 200, 76, 0.32) 114deg 126deg, transparent 126deg 152deg, rgba(246, 200, 76, 0.38) 152deg 164deg, transparent 164deg 190deg, rgba(246, 200, 76, 0.32) 190deg 202deg, transparent 202deg 228deg, rgba(246, 200, 76, 0.38) 228deg 240deg, transparent 240deg 266deg, rgba(246, 200, 76, 0.32) 266deg 278deg, transparent 278deg 304deg, rgba(246, 200, 76, 0.38) 304deg 316deg, transparent 316deg 342deg, rgba(246, 200, 76, 0.32) 342deg 354deg, transparent 354deg 360deg);
  opacity: 0.7;
}
.round-lock {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 88px;
  height: 78px;
  transform: translate(-50%, -50%) rotate(-5deg);
  border: 4px solid var(--ink);
  border-radius: 15px;
  background: linear-gradient(180deg, #FFE17C, #F6C84C 58%, #C98A2C);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.45), 0 7px 0 #6B431E;
  z-index: 2;
}
.round-lock::before {
  content: "";
  position: absolute;
  left: 20px;
  top: -35px;
  width: 42px;
  height: 42px;
  border: 10px solid #F6C84C;
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  transform: rotate(-30deg);
  transform-origin: bottom right;
  filter: drop-shadow(0 3px 0 #6B431E);
}
.round-lock::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 26px;
  width: 12px;
  height: 26px;
  transform: translateX(-50%);
  border-radius: 6px;
  background: var(--ink);
}
.round-spark {
  position: absolute;
  color: var(--gold-dark);
  font-family: var(--font-display);
  line-height: 1;
}
.round-spark.rs1 { left: 5px; top: 24px; font-size: 24px; }
.round-spark.rs2 { right: 4px; top: 53px; font-size: 17px; }
.round-spark.rs3 { right: 27px; top: 5px; font-size: 13px; }
.round-spark.rs4 { left: 22px; bottom: 12px; font-size: 12px; }
.round-kicker {
  margin: 2px 0 0;
  color: var(--gold-dark);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.round-card h2 {
  margin: 4px 0 6px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(26px, 3.3vw, 38px);
  font-weight: 600;
  line-height: 1;
}
.round-reward {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(14px, 1.4vw, 18px);
  font-weight: 500;
}
.round-reward .coin { width: 22px; height: 22px; }
.round-reward b { color: var(--green-dark); }
.round-bullet { color: var(--gold-dark); }
.round-explanation {
  margin: 10px 0 16px;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}
.round-card .fantasy-btn { min-height: 52px; font-size: 19px; }
@keyframes roundIn {
  from { opacity: 0; transform: scale(0.86); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes lockActiveWarm {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(246, 200, 76, 0.2)); }
  50% { filter: drop-shadow(0 0 12px rgba(246, 200, 76, 0.7)); }
}

/* =========================================================
   PAUSE
   ========================================================= */

.pause-card {
  position: relative;
  z-index: 2;
  width: min(590px, 94vw);
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  padding: clamp(18px, 2.4vw, 26px);
  border: 4px solid var(--ink);
  border-radius: 26px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.55), transparent 48%),
    linear-gradient(160deg, #FFF8E5 0%, #FDF0C8 64%, #EFD9A8 100%);
  box-shadow: inset 0 0 0 4px rgba(246, 200, 76, 0.3), 0 10px 0 #6B431E, 0 28px 55px rgba(0, 0, 0, 0.45);
  animation: roundIn 0.35s var(--ease-spring);
}
.pause-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 17px;
}
.pause-symbol {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  color: var(--cream);
  background: var(--gold-dark);
  box-shadow: 0 4px 0 #4A2E18;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 900;
}
.pause-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(30px, 3.4vw, 42px);
  font-weight: 600;
  line-height: 1;
}
.pause-body {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 22px);
  padding: 14px;
  border: 2px dashed rgba(107, 78, 51, 0.25);
  border-radius: 18px;
  background: rgba(255, 247, 222, 0.46);
}
.pause-profile {
  flex: none;
  width: 150px;
  text-align: center;
}
.pause-avatar {
  display: block;
  width: 78px;
  height: 78px;
  margin: 0 auto 6px;
  overflow: hidden;
  border: 3px solid var(--gold);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 4px 0 #B9772E;
}
.pause-avatar svg { display: block; width: 100%; height: 100%; }
.pause-profile b {
  display: block;
  color: var(--ink);
  font-family: var(--font-hand);
  font-size: 27px;
  font-weight: 400;
  line-height: 1;
}
.pause-profile span {
  display: block;
  margin-top: 2px;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 800;
}
.pause-settings { flex: 1; min-width: 0; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(107, 78, 51, 0.22);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 900;
}
.setting-row:last-of-type { border-bottom: 0; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 74px;
  min-height: 30px;
  padding: 3px 8px 3px 4px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: #CEC4B1;
  box-shadow: 0 3px 0 #8E8474;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.15s ease;
}
.toggle i {
  width: 20px;
  height: 20px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
}
.toggle b { font-size: 10px; letter-spacing: 0.04em; }
.toggle.on {
  background: var(--green);
  color: #FFF8E4;
  box-shadow: 0 3px 0 #1E5A33;
}
.toggle.on i { background: #FFF8E4; }
.toggle:not(.on) { color: #5F574C; }
.pause-setting-note {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-family: var(--font-hand);
  font-size: 16px;
  line-height: 1.1;
}
.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 16px;
}
.pause-actions .fantasy-btn { min-height: 52px; font-size: 19px; }
.pause-actions .text-btn { align-self: center; margin-top: 1px; font-size: 18px; }

/* =========================================================
   GUIDE OVERLAY
   ========================================================= */

.guide-card {
  border: 4px solid var(--ink);
  border-radius: 24px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 15% 0%, rgba(255, 255, 255, 0.7), transparent 44%),
    linear-gradient(155deg, #FFF8E5 0%, #FDF0C8 64%, #EFD9A8 100%);
  box-shadow: inset 0 0 0 4px rgba(246, 200, 76, 0.3), 0 10px 0 #6B431E, 0 30px 60px rgba(0, 0, 0, 0.5);
}
.guide-card::before { border-color: rgba(107, 78, 51, 0.2); }
.guide-heading .kicker { color: var(--gold-dark); }
.guide-heading h2 { color: var(--ink); }
.guide-heading > p:last-child { color: var(--ink-soft); }
.overlay-close {
  color: var(--ink);
  border: 3px solid var(--ink);
  background: var(--cream);
  box-shadow: 0 3px 0 #B9772E;
}
.overlay-close:hover { background: var(--gold); }
.demo {
  border: 3px solid var(--ink);
  background:
    radial-gradient(ellipse at 50% 20%, rgba(246, 200, 76, 0.22), transparent 55%),
    linear-gradient(160deg, #4A2E18, #241710 70%);
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.4);
}
.demo-pan { color: var(--ink); border-color: var(--gold-dark); background: var(--cream); }
.demo-right { color: var(--ink); background: var(--cream); border-color: var(--gold-dark); }
.demo-right small { color: var(--ink-soft); }
.demo-check { color: #2B1E16; background: var(--green); }
.step-num { color: var(--cream); background: var(--gold-dark); box-shadow: 0 2px 0 #4A2E18; }
.guide-steps strong { color: var(--ink); }
.guide-steps p { color: var(--ink-soft); }
.guide-tip {
  border: 2px solid rgba(107, 78, 51, 0.25);
  background: rgba(246, 200, 76, 0.14);
}
.tip-icon { color: var(--cream); background: var(--green-dark); }
.guide-tip p { color: var(--ink-soft); }
.guide-tip strong { color: var(--ink); }
.guide-done { color: #FFF8E4; background: var(--green); }
.demo-answer .demo-a { color: var(--green-dark); }

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

.victory-screen {
  background: #1B120D;
  overflow-y: auto;
}
.victory-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 52%, rgba(246, 200, 76, 0.28), transparent 54%),
    repeating-linear-gradient(0deg, rgba(20, 12, 7, 0.28) 0 3px, transparent 3px 72px),
    linear-gradient(180deg, #3A2A1F, #1B120D 76%);
}
.victory-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%, transparent 22%, rgba(10, 5, 3, 0.62) 88%);
  pointer-events: none;
}
.victory-vault-wrap {
  position: absolute;
  left: 50%;
  top: 3%;
  width: min(500px, 50vh, 68vw);
  transform: translateX(-50%);
  opacity: 0.9;
}
.victory-vault { width: 100%; }
.victory-cat {
  position: absolute;
  left: auto;
  right: 9%;
  bottom: 9%;
  width: min(190px, 16vw);
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.36));
}
.victory-cat svg { display: block; width: 100%; height: auto; }
.victory-rays {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 70vw;
  height: 70vw;
  transform: translate(-50%, -50%);
  background: conic-gradient(from 0deg, rgba(246, 200, 76, 0.07) 0deg 7deg, transparent 7deg 25deg, rgba(246, 200, 76, 0.06) 25deg 32deg, transparent 32deg 52deg, rgba(246, 200, 76, 0.07) 52deg 59deg, transparent 59deg 79deg, rgba(246, 200, 76, 0.06) 79deg 86deg, transparent 86deg 106deg, rgba(246, 200, 76, 0.07) 106deg 113deg, transparent 113deg 133deg, rgba(246, 200, 76, 0.06) 133deg 140deg, transparent 140deg 160deg, rgba(246, 200, 76, 0.07) 160deg 167deg, transparent 167deg 187deg, rgba(246, 200, 76, 0.06) 187deg 194deg, transparent 194deg 214deg, rgba(246, 200, 76, 0.07) 214deg 221deg, transparent 221deg 241deg, rgba(246, 200, 76, 0.06) 241deg 248deg, transparent 248deg 268deg, rgba(246, 200, 76, 0.07) 268deg 275deg, transparent 275deg 295deg, rgba(246, 200, 76, 0.06) 295deg 302deg, transparent 302deg 322deg, rgba(246, 200, 76, 0.07) 322deg 329deg, transparent 329deg 349deg, rgba(246, 200, 76, 0.06) 349deg 356deg, transparent 356deg 360deg);
  opacity: 0.7;
  pointer-events: none;
}
.victory-spark {
  position: absolute;
  color: var(--gold);
  font-family: var(--font-display);
  opacity: 0.75;
}
.victory-spark.vs1 { left: 18%; top: 24%; font-size: 28px; }
.victory-spark.vs2 { right: 20%; top: 18%; font-size: 19px; }
.victory-spark.vs3 { left: 13%; bottom: 22%; font-size: 20px; }
.victory-spark.vs4 { right: 15%; bottom: 32%; font-size: 25px; }
.victory-spark.vs5 { left: 35%; bottom: 12%; font-size: 14px; }
.victory-layer {
  position: relative;
  z-index: 2;
  width: min(880px, 92vw);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 3vh, 30px) 0 24px;
  text-align: center;
}
.victory-head { position: relative; z-index: 2; }
.victory-head .kicker { justify-content: center; color: var(--gold); }
.victory-head h1 {
  margin: 4px 0 0;
  color: var(--cream);
  font-family: var(--font-display);
  font-size: clamp(34px, 4.8vw, 64px);
  font-weight: 600;
  line-height: 0.94;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
}
.victory-head h1 span { color: var(--gold); }
.selesai-banner {
  display: inline-block;
  margin: 12px auto 8px;
  padding: 7px 34px;
  transform: rotate(-2deg);
  border: 4px solid var(--ink);
  border-radius: 12px;
  color: var(--ink);
  background: var(--gold);
  box-shadow: 0 6px 0 #6B431E;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.3vw, 42px);
  font-weight: 700;
  line-height: 1;
}
.victory-sub {
  max-width: 570px;
  margin: 0 auto;
  color: rgba(253, 240, 200, 0.82);
  font-family: var(--font-hand);
  font-size: clamp(17px, 1.6vw, 22px);
  line-height: 1.2;
}
.victory-sub strong { color: var(--gold-light); }
.victory-board {
  position: relative;
  z-index: 3;
  width: min(760px, 100%);
  margin-top: 18px;
  padding: clamp(16px, 2vw, 24px);
  border: 4px solid var(--ink);
  border-radius: 24px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.5), transparent 46%),
    linear-gradient(160deg, #FFF8E5 0%, #FDF0C8 64%, #EFD9A8 100%);
  box-shadow: inset 0 0 0 4px rgba(246, 200, 76, 0.3), 0 9px 0 #6B431E, 0 24px 42px rgba(0, 0, 0, 0.36);
}
.victory-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.victory-lock-badge,
.victory-star-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 0 #B9772E;
}
.victory-lock-badge { background: var(--green); color: #FFF8E4; }
.victory-lock-badge b { font-family: var(--font-display); font-size: 14px; }
.victory-star-badge { background: var(--gold); color: var(--ink); }
.victory-lock-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--green-dark);
  background: #FFF8E4;
  font-size: 11px;
  font-weight: 900;
}
.victory-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 13px 0;
}
.victory-stats .stat {
  padding: 9px 6px;
  border: 2px solid rgba(107, 78, 51, 0.2);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.32);
}
.stat-label { color: var(--ink-soft); font-size: 8.5px; }
.stat-value { color: var(--ink); font-family: var(--font-display); font-size: clamp(17px, 1.7vw, 24px); }
.stat .coin { width: 16px; height: 16px; }
.victory-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.victory-actions .fantasy-btn { flex: 1; min-height: 54px; font-size: 18px; }
.victory-recap-wrap {
  margin-top: 14px;
  text-align: left;
}
.victory-recap-wrap summary {
  padding: 8px 2px;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.victory-recap-wrap[open] summary { border-bottom: 1px dashed rgba(107, 78, 51, 0.25); }
.victory-recap-wrap .recap { max-height: 200px; margin-top: 7px; }
.victory-foot {
  position: relative;
  z-index: 2;
  margin-top: 13px;
  color: rgba(253, 240, 200, 0.55);
  font-family: var(--font-hand);
  font-size: 18px;
}
.victory-screen .recap-row {
  border-color: rgba(107, 78, 51, 0.18);
  background: rgba(255, 255, 255, 0.3);
}
.victory-screen .recap-num { background: var(--green-dark); color: var(--cream); }
.victory-screen .recap-prompt { color: var(--ink); }
.victory-screen .recap-answer { color: var(--green-dark); }
.victory-screen .recap-meta { color: var(--ink-soft); }
.victory-screen .recap-meta .star { color: var(--gold-dark); }

/* =========================================================
   EXIT
   ========================================================= */

.exit-card {
  position: relative;
  z-index: 2;
  width: min(450px, 92vw);
  padding: 26px;
  border: 4px solid var(--ink);
  border-radius: 24px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.55), transparent 48%),
    linear-gradient(160deg, #FFF8E5, #FDF0C8 64%, #EFD9A8);
  box-shadow: inset 0 0 0 4px rgba(246, 200, 76, 0.3), 0 10px 0 #6B431E, 0 28px 55px rgba(0, 0, 0, 0.45);
  text-align: center;
}
.exit-cat {
  width: 82px;
  height: 82px;
  margin: 0 auto 7px;
  overflow: hidden;
  border: 3px solid var(--gold);
  border-radius: 50%;
  background: var(--cream);
}
.exit-cat svg { display: block; width: 100%; height: 100%; }
.exit-card .kicker { justify-content: center; color: var(--gold-dark); }
.exit-card h2 {
  margin: 4px 0 6px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 600;
}
.exit-card p { margin: 0 0 16px; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.exit-card strong { color: var(--ink); }
.exit-card .fantasy-btn { min-height: 50px; font-size: 18px; }

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

@media (max-width: 900px) {
  .menu-layer { width: calc(100% - 28px); padding-top: 10px; }
  .menu-plaque { width: min(560px, 82vw); padding-left: 24px; padding-right: 24px; }
  .menu-actions { top: 51%; width: min(310px, 46vw); }
  .menu-side { width: min(230px, 27vw); }
  .hanging-padlock.hp1, .hanging-padlock.hp3 { left: 4%; }
  .hanging-padlock.hp2, .hanging-padlock.hp4 { right: 4%; }
  .select-layer { width: calc(100% - 26px); }
  .select-cat { opacity: 0.45; width: 130px; }
  .select-heading h1 { font-size: 28px; }
}

@media (max-width: 720px) {
  .menu-screen { overflow-y: auto !important; }
  .menu-layer { width: calc(100% - 22px); min-height: 100dvh; height: auto; padding-top: 8px; }
  .menu-brand { font-size: 9px; }
  .menu-brand-crest { width: 28px; height: 28px; }
  .menu-icon { width: 36px; height: 36px; }
  .menu-stage { display: flex; flex-direction: column; align-items: center; padding-top: 10px; flex: none; min-height: 0; }
  .menu-door-wrap { position: relative; left: auto; top: auto; transform: none; width: min(330px, 84vw); margin: 4px auto 0; order: 0; }
  .menu-plaque { position: relative; left: auto; top: auto; transform: rotate(-0.4deg); width: 100%; margin: 0 auto 10px; padding: 18px 18px 22px; order: 1; }
  .plaque-line1 { font-size: clamp(32px, 9.4vw, 46px); }
  .plaque-line2 { font-size: clamp(42px, 12vw, 60px); }
  .menu-actions { position: relative; left: auto; top: auto; transform: none; width: min(310px, 82vw); margin-top: 10px; order: 3; }
  .menu-actions .fantasy-btn { min-height: 50px; font-size: 15px; }
  .menu-actions .fantasy-btn.primary { min-height: 56px; font-size: 22px; }
  .menu-side { position: relative; right: auto; bottom: auto; width: min(270px, 80vw); margin-top: 14px; order: 4; }
  .name-card { width: min(210px, 100%); }
  .menu-cat { width: min(185px, 62vw); margin-top: -16px; }
  .menu-foot { font-size: 15px; padding-top: 13px; }
  .hanging-padlock { display: none; }
  .menu-spark.sp1 { left: 8%; top: 20%; }
  .menu-spark.sp2 { right: 7%; top: 34%; }
  .menu-spark.sp4 { right: 6%; bottom: 27%; }
  .menu-paw { display: none; }
  .select-layer { padding-top: 10px; justify-content: flex-start; }
  .select-top { flex-wrap: wrap; gap: 8px; }
  .select-heading { order: -1; width: 100%; flex: 1 0 100%; }
  .select-heading h1 { font-size: 25px; }
  .select-top .fantasy-btn.nav { min-height: 38px; font-size: 13px; }
  .select-player { font-size: 18px; }
  .select-avatar { width: 36px; height: 36px; }
  .select-board { padding: 13px; border-radius: 18px; }
  .class-row { justify-content: flex-start; gap: 5px; padding-bottom: 10px; }
  .class-tab { min-height: 36px; padding: 0 12px; font-size: 12px; }
  .subject-grid { gap: 8px; margin: 10px 0; }
  .subject-card { min-height: 68px; padding: 8px; gap: 8px; }
  .subject-icon { width: 42px; height: 42px; border-radius: 10px; }
  .subject-copy strong { font-size: 13px; }
  .subject-copy span { font-size: 8px; }
  .select-bottom { flex-direction: column; align-items: stretch; gap: 8px; }
  .select-bottom .fantasy-btn { width: 100%; min-height: 48px; font-size: 18px; }
  .select-summary { text-align: center; font-size: 20px; }
  .select-note { font-size: 14px; margin-top: 8px; }
  .select-cat { display: none; }
  .victory-cat { width: 100px; right: 4%; bottom: 4%; opacity: 0.55; }
  .victory-layer { width: calc(100% - 26px); padding-top: 12px; padding-bottom: 18px; justify-content: flex-start; }
  .victory-head h1 { font-size: clamp(31px, 8.6vw, 45px); }
  .selesai-banner { margin-top: 8px; font-size: 28px; padding: 6px 24px; }
  .victory-sub { font-size: 17px; }
  .victory-board { padding: 13px; margin-top: 12px; border-radius: 18px; }
  .victory-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .victory-actions { flex-direction: column; }
  .victory-actions .fantasy-btn { min-height: 46px; font-size: 16px; }
  .victory-foot { font-size: 15px; margin-top: 9px; }
  .pause-card { padding: 14px; border-radius: 18px; }
  .pause-head { margin-bottom: 10px; }
  .pause-head h2 { font-size: 29px; }
  .pause-body { gap: 8px; padding: 9px; }
  .pause-profile { width: 108px; }
  .pause-avatar { width: 60px; height: 60px; }
  .pause-profile b { font-size: 22px; }
  .pause-actions .fantasy-btn { min-height: 45px; font-size: 16px; }
  .round-card { padding: 15px; border-radius: 19px; }
  .round-burst { width: 120px; height: 116px; }
  .round-ray, .round-rays { width: 150px; height: 150px; }
  .round-card h2 { font-size: 25px; }
  .round-explanation { font-size: 11px; }
  .guide-card { padding: 15px; border-radius: 18px; }
  .guide-heading h2 { font-size: 24px; }
  .guide-done { min-height: 44px; font-size: 14px; }
}

@media (max-width: 420px) {
  .menu-plaque { padding: 13px 12px 18px; }
  .plaque-crown { top: -27px; font-size: 37px; }
  .plaque-line1 { font-size: 30px; }
  .plaque-line2 { font-size: 44px; }
  .menu-actions { width: 86vw; gap: 9px; }
  .menu-side { width: 78vw; }
  .menu-cat { width: 160px; }
  .menu-top-actions .menu-icon { width: 32px; height: 32px; }
  .select-heading h1 { font-size: 21px; }
  .subject-icon { width: 36px; height: 36px; }
  .subject-copy strong { font-size: 12px; }
  .victory-head h1 { font-size: 28px; }
  .selesai-banner { font-size: 24px; }
  .victory-lock-badge, .victory-star-badge { font-size: 9px; padding: 5px 8px; }
}

/* =========================================================
   ASET UI DARI assets/Icon
   Tombol memakai kulit SVG asli lewat border-image 9-slice.
   ========================================================= */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

html,
body {
  overscroll-behavior: none;
}
body {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
input,
textarea {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}
button,
[role="switch"],
.subject-card,
.class-tab,
.stone,
.numkey {
  touch-action: manipulation;
}

/* --- tombol utama --- */
.fantasy-btn.primary,
.fantasy-btn.cream,
.fantasy-btn.exit,
.fantasy-btn.gold,
.fantasy-btn.white {
  --btn-lip: #6B431E;
  border: 10px solid transparent;
  border-image-slice: 32 fill;
  border-image-width: 10px;
  border-image-repeat: stretch;
  border-radius: 18px;
  background: transparent;
  padding: 0 8px;
  box-shadow:
    0 0 0 3px var(--ink),
    0 8px 0 var(--btn-lip),
    0 12px 22px rgba(0, 0, 0, 0.24);
}
.fantasy-btn.primary {
  --btn-lip: #1E5A33;
  border-image-source: url("../assets/Icon/Normal Menu.svg");
  color: #FFF8E4;
}
.fantasy-btn.primary.press {
  border-image-source: url("../assets/Icon/Press Menu.svg");
}
.fantasy-btn.press .btn-leaf {
  display: none;
}
.fantasy-btn.cream {
  border-image-source: url("../assets/Icon/Jawaban.svg");
  color: var(--ink);
}
.fantasy-btn.exit {
  --btn-lip: #8A2F26;
  border-image-source: url("../assets/Icon/Normal class-1.svg");
  color: #FFF8E4;
}
.fantasy-btn.gold {
  border-image-source: url("../assets/Icon/Select class.svg");
  color: var(--ink);
}
.fantasy-btn.white {
  border-image-source: url("../assets/Icon/Menu pengaturan.svg");
  color: var(--ink);
}
.fantasy-btn.primary:active,
.fantasy-btn.cream:active,
.fantasy-btn.exit:active,
.fantasy-btn.gold:active,
.fantasy-btn.white:active {
  transform: translateY(5px);
  box-shadow:
    0 0 0 3px var(--ink),
    0 2px 0 var(--btn-lip);
}
.fantasy-btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

/* --- tab kelas --- */
.class-tab {
  border: 7px solid transparent;
  border-image: url("../assets/Icon/Jawaban.svg") 26 fill stretch;
  border-image-width: 7px;
  border-radius: 14px;
  background: transparent;
  padding: 0 6px;
  box-shadow: 0 3px 0 #B9772E;
}
.class-tab:hover {
  background: transparent;
  filter: brightness(1.04);
}
.class-tab.is-selected {
  background: transparent;
  border-image-source: url("../assets/Icon/Normal class.svg");
  box-shadow: 0 3px 0 #6B431E;
  color: var(--ink);
}

/* --- toggle BGM / SFX --- */
.toggle {
  position: relative;
  width: 84px;
  min-width: 84px;
  height: 39px;
  min-height: 39px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent url("../assets/Icon/Off Button.svg") center / 100% 100% no-repeat;
  box-shadow: none;
}
.toggle.on {
  background-image: url("../assets/Icon/On Button.svg");
  box-shadow: none;
}
.toggle i {
  display: none;
}
.toggle b {
  position: absolute;
  top: 50%;
  display: block;
  color: #2F7D46;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
  transform: translateY(-50%);
}
.toggle.on b {
  left: 12px;
}
.toggle:not(.on) b {
  right: 12px;
  color: #5F574C;
}
.toggle:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

/* --- tombol jeda HUD --- */
.hud #btnPause {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: url("../assets/Icon/Pause Button.svg") center / 100% 100% no-repeat;
  box-shadow: none;
}
.hud #btnPause svg {
  display: none;
}
.hud #btnPause:hover {
  background-color: transparent;
  filter: brightness(1.06);
}

/* --- avatar Angelica dari aset Pause.svg --- */
.pause-avatar,
.select-avatar,
.exit-cat {
  background: url("../assets/Icon/angelica-avatar.jpg") center / cover no-repeat, var(--cream);
}
.pause-avatar svg,
.select-avatar svg,
.exit-cat svg {
  display: none;
}

.menu-cat img,
.select-cat img,
.victory-cat img {
  display: block;
  width: 100%;
  height: auto;
}

/* --- safe area Android / iPhone --- */
.hud {
  padding-top: calc(9px + var(--safe-top));
  padding-left: max(clamp(12px, 2.4vw, 30px), var(--safe-left));
  padding-right: max(clamp(12px, 2.4vw, 30px), var(--safe-right));
}
.answer-dock {
  padding-bottom: calc(clamp(8px, 1.4vh, 14px) + var(--safe-bottom));
  padding-left: max(clamp(10px, 2.4vw, 30px), var(--safe-left));
  padding-right: max(clamp(10px, 2.4vw, 30px), var(--safe-right));
}
.menu-layer {
  padding-top: calc(18px + var(--safe-top));
  padding-bottom: calc(14px + var(--safe-bottom));
}
.select-layer {
  padding-top: calc(clamp(14px, 3vh, 30px) + var(--safe-top));
  padding-bottom: calc(26px + var(--safe-bottom));
}
.victory-layer {
  padding-top: calc(clamp(18px, 3vh, 30px) + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
}

@media (max-width: 720px) {
  .fantasy-btn.primary,
  .fantasy-btn.cream,
  .fantasy-btn.exit,
  .fantasy-btn.gold,
  .fantasy-btn.white {
    border-width: 8px;
    border-image-slice: 24 fill;
    border-image-width: 8px;
    border-radius: 14px;
    padding: 0 4px;
    box-shadow:
      0 0 0 2.5px var(--ink),
      0 5px 0 var(--btn-lip);
  }
  .fantasy-btn.primary:active,
  .fantasy-btn.cream:active,
  .fantasy-btn.exit:active,
  .fantasy-btn.gold:active,
  .fantasy-btn.white:active {
    box-shadow:
      0 0 0 2.5px var(--ink),
      0 1px 0 var(--btn-lip);
  }
  .class-tab {
    border-width: 6px;
    border-image-slice: 22 fill;
    border-image-width: 6px;
    border-radius: 11px;
    padding: 0 2px;
    box-shadow: 0 2px 0 #B9772E;
  }
  .class-tab.is-selected {
    box-shadow: 0 2px 0 #6B431E;
  }
  .toggle {
    width: 78px;
    min-width: 78px;
    height: 36px;
    min-height: 36px;
  }
  .hud {
    padding-top: calc(7px + var(--safe-top));
    padding-left: max(10px, var(--safe-left));
    padding-right: max(10px, var(--safe-right));
  }
  .hud #btnPause {
    width: 36px;
    height: 36px;
  }
  .answer-dock {
    padding-bottom: calc(8px + var(--safe-bottom));
    padding-left: max(8px, var(--safe-left));
    padding-right: max(8px, var(--safe-right));
  }
  .menu-layer {
    padding-top: calc(8px + var(--safe-top));
    padding-bottom: calc(14px + var(--safe-bottom));
  }
  .select-layer {
    padding-top: calc(10px + var(--safe-top));
    padding-bottom: calc(26px + var(--safe-bottom));
  }
  .victory-layer {
    padding-top: calc(12px + var(--safe-top));
    padding-bottom: calc(18px + var(--safe-bottom));
  }
}

/* Layar pendek (iPhone SE / Android kecil): rapatkan menu dan panggung. */
@media (max-width: 720px) and (max-height: 730px) {
  .menu-foot {
    display: none;
  }
  .menu-cat {
    width: min(145px, 52vw);
  }
  .menu-side {
    margin-top: 8px;
  }
  .menu-actions {
    margin-top: 6px;
  }
  .name-card {
    padding: 10px 12px 8px;
  }
  .stage-3d.is-compact .dial {
    width: min(210px, 64vw);
    height: 64px;
  }
  .dial-tilt-labels {
    display: none;
  }
  .stage-3d.is-compact .pan-question {
    min-height: 86px;
  }
  .stage-3d.is-compact .pan-answer {
    min-height: 88px;
  }
  .question-text {
    margin: 3px 0 2px;
    font-size: clamp(16px, 5vw, 21px);
  }
  .scale-status {
    min-height: 22px;
    padding: 3px 9px;
    font-size: 9px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .menu-screen {
    overflow: hidden !important;
  }
  .menu-plaque {
    top: 2px;
    width: min(520px, 58vw);
    padding: 8px 20px 10px;
    border-width: 3px;
    border-radius: 18px 18px 28px 28px / 18px 18px 34px 34px;
  }
  .plaque-crown {
    top: -22px;
    font-size: 30px;
  }
  .plaque-line1 {
    font-size: clamp(25px, 4vw, 32px);
  }
  .plaque-line2 {
    font-size: clamp(30px, 5vw, 42px);
  }
  .plaque-star {
    display: none;
  }
  .menu-actions {
    top: 45%;
    width: min(300px, 36vw);
    gap: 8px;
  }
  .menu-actions .fantasy-btn {
    min-height: 44px;
    font-size: 13px;
  }
  .menu-actions .fantasy-btn.primary {
    min-height: 48px;
    font-size: 19px;
  }
  .menu-side {
    width: min(190px, 22vw);
    right: 1%;
  }
  .name-card {
    width: min(170px, 100%);
    padding: 8px 10px 7px;
  }
  .name-card input {
    font-size: 23px;
  }
  .menu-cat {
    width: min(120px, 100%);
    margin-top: -10px;
  }
  .menu-foot {
    display: none;
  }
  .menu-door-wrap {
    width: min(260px, 54vh);
  }
  .hanging-padlock,
  .menu-paw {
    display: none;
  }
  .menu-brand {
    font-size: 9px;
  }
  .menu-layer {
    padding-top: calc(4px + var(--safe-top));
    padding-bottom: calc(4px + var(--safe-bottom));
  }
  .stage-3d.is-compact .compact-dial,
  .stage-3d.is-compact .scale-status {
    display: none;
  }
  .stage-3d.is-compact {
    height: 100%;
    min-height: 100%;
    gap: 0;
    padding-bottom: 0;
    justify-content: flex-start;
  }
  .stage-3d.is-compact .game-main {
    padding: 4px 10px;
    overflow: hidden;
  }
  .stage-3d.is-compact .pan-layer {
    display: flex;
    flex: none;
    flex-direction: row;
    align-items: stretch;
    gap: 10px;
    height: 100%;
    min-height: 0;
    width: 100%;
  }
  .stage-3d.is-compact .pan-float {
    flex: 1;
    width: auto !important;
    min-width: 0;
  }
  .stage-3d.is-compact .pan {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    min-height: 0;
  }
  .stage-3d.is-compact .pan-question,
  .stage-3d.is-compact .pan-answer {
    min-height: 0;
  }
  .stage-3d.is-compact .question-text {
    margin: 2px 0;
    font-size: clamp(15px, 2.3vw, 20px);
  }
  .stage-3d.is-compact .question-text.is-long {
    font-size: clamp(14px, 2vw, 18px);
  }
  .stage-3d.is-compact .question-text.is-very-long {
    font-size: clamp(13px, 1.8vw, 17px);
  }
  .stage-3d.is-compact .question-note {
    font-size: 9px;
  }
  .stage-3d.is-compact .answer-display {
    font-size: clamp(24px, 3.4vw, 34px);
  }
}

@media (max-width: 720px) and (max-height: 660px) {
  .menu-layer {
    padding-top: calc(4px + var(--safe-top));
  }
  .menu-plaque {
    padding-top: 10px;
    padding-bottom: 16px;
  }
  .plaque-crown {
    top: -24px;
    font-size: 34px;
  }
  .menu-actions {
    gap: 7px;
    margin-top: 4px;
  }
  .menu-cat {
    width: min(125px, 46vw);
  }
  .menu-side {
    margin-top: 4px;
  }
  .name-card {
    padding: 8px 10px 6px;
  }
  .stage-3d.is-compact .dial {
    width: min(180px, 56vw);
    height: 54px;
  }
  .stage-3d.is-compact .pan-question {
    min-height: 80px;
  }
  .stage-3d.is-compact .pan-answer {
    min-height: 84px;
  }
  .scale-status {
    min-height: 20px;
    padding: 2px 8px;
    font-size: 8px;
  }
}

@media (max-width: 720px) and (max-height: 600px) {
  .stage-3d.is-compact .compact-dial {
    display: none;
  }
  .stage-3d.is-compact .pan-question {
    min-height: 84px;
  }
  .stage-3d.is-compact .pan-answer {
    min-height: 88px;
  }
}

@media (max-width: 380px) {
  .hud {
    gap: 4px 6px;
    padding-left: max(8px, var(--safe-left));
    padding-right: max(8px, var(--safe-right));
  }
  .hud-session {
    display: none;
  }
  .hud-round {
    font-size: 11px;
  }
  .hud-right {
    gap: 2px;
  }
  .coin-pill {
    min-height: 26px;
    padding: 2px 5px 2px 3px;
    gap: 3px;
    font-size: 10px;
  }
  .coin {
    width: 14px;
    height: 14px;
  }
  .hud .icon-btn {
    width: 30px;
    height: 30px;
  }
  .hud #btnPause {
    width: 32px;
    height: 32px;
  }
  .subject-card.is-selected::after {
    display: none;
  }
}

@media (max-width: 720px) and (min-height: 760px) {
  .victory-cat {
    width: 150px;
    right: 5%;
  }
}

@media (max-width: 720px) and (max-height: 730px) {
  .victory-cat {
    display: none;
  }
}

/* =========================================================
   MODE 2D
   Panggung Three.js tidak dipakai. Dial, kartu, dan karakter
   disusun ulang sesuai ruang yang tersedia.
   ========================================================= */

/* Layar pilih kelas di ponsel pendek: hilangkan catatan dekoratif
   supaya seluruh pilihan dan tombol Mulai muat tanpa scroll. */
@media (max-width: 720px) and (max-height: 620px) {
  .select-note,
  .select-cat {
    display: none;
  }
  .select-layer {
    padding-bottom: calc(10px + var(--safe-bottom));
  }
}

/* Panduan ringkas untuk ponsel pendek. */
@media (max-width: 720px) and (max-height: 700px) {
  .guide-card {
    padding: 12px;
  }
  .guide-heading .kicker {
    display: none;
  }
  .guide-heading h2 {
    font-size: 22px;
  }
  .guide-heading > p:last-child {
    font-size: 11px;
  }
  .guide-body {
    grid-template-columns: 1fr;
    margin: 8px 0;
  }
  .guide-body .demo {
    display: none;
  }
  .guide-steps {
    gap: 6px;
  }
  .guide-tip {
    display: none;
  }
  .guide-done {
    min-height: 40px;
    font-size: 14px;
  }
}

/* Victory ringkas untuk ponsel pendek. */
@media (max-width: 720px) and (max-height: 620px) {
  .victory-layer {
    justify-content: flex-start;
    padding-top: calc(8px + var(--safe-top));
  }
  .victory-head h1 {
    font-size: 26px;
  }
  .selesai-banner {
    margin: 6px 0;
    font-size: 22px;
  }
  .victory-sub {
    font-size: 13px;
  }
  .victory-board {
    margin-top: 8px;
    padding: 10px;
  }
  .victory-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    margin: 6px 0;
  }
  .victory-actions .fantasy-btn {
    min-height: 40px;
    font-size: 14px;
  }
  .victory-recap-wrap,
  .victory-foot,
  .victory-cat {
    display: none;
  }
}

.dial-mascot {
  display: none;
}

@media (min-width: 900px) and (min-height: 560px) {
  .game-main.is-compact {
    overflow: hidden;
    padding: 0;
  }
  .stage-3d.is-compact {
    display: grid;
    grid-template-columns: minmax(330px, 0.9fr) minmax(0, 1.25fr);
    grid-template-rows: auto auto;
    align-content: center;
    align-items: center;
    gap: 14px clamp(20px, 3vw, 38px);
    width: min(1180px, 100%);
    height: 100%;
    min-height: 100%;
    margin: 0 auto;
    padding: clamp(16px, 2.6vw, 32px) clamp(20px, 3vw, 42px);
    overflow: hidden;
  }
  .stage-3d.is-compact .pan-layer {
    display: contents;
  }
  .stage-3d.is-compact .compact-dial {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(90px, 0.75fr);
    grid-template-areas:
      "labels labels"
      "dial cat";
    align-items: center;
    justify-items: center;
    gap: 4px 10px;
    width: 100%;
    height: auto;
  }
  .stage-3d.is-compact .dial-tilt-labels {
    grid-area: labels;
    display: flex;
    width: 100%;
  }
  .stage-3d.is-compact .dial {
    grid-area: dial;
    width: 100%;
    max-width: 280px;
    height: auto;
    aspect-ratio: 2 / 1;
  }
  .stage-3d.is-compact .dial-mascot {
    grid-area: cat;
    display: block;
    width: 100%;
    max-width: 180px;
    height: auto;
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.3));
  }
  .stage-3d.is-compact .questionFloat {
    grid-column: 2;
    grid-row: 1;
  }
  .stage-3d.is-compact .answerFloat {
    grid-column: 2;
    grid-row: 2;
  }
  .stage-3d.is-compact .scale-status {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    margin: 0 auto;
    position: static;
  }
  .stage-3d.is-compact .pan-float {
    width: 100% !important;
  }
  .stage-3d.is-compact .pan {
    min-height: 128px;
    padding: 14px 20px;
    border-radius: 18px;
  }
  .stage-3d.is-compact .pan-answer {
    min-height: 112px;
  }
  .stage-3d.is-compact .question-text {
    margin: 6px 0 4px;
    font-size: clamp(21px, 2.1vw, 30px);
  }
  .stage-3d.is-compact .question-text.is-long {
    font-size: clamp(19px, 1.8vw, 25px);
  }
  .stage-3d.is-compact .answer-display {
    font-size: clamp(32px, 3.2vw, 46px);
  }
  .stage-3d.is-compact .mascot {
    display: none;
  }
}

/* =========================================================
   LANDSCAPE PENDEK — semua layar harus muat tanpa scroll
   ========================================================= */

@media (orientation: landscape) and (max-height: 500px) {
  .menu-layer {
    width: calc(100% - 24px);
    height: 100dvh;
    min-height: 0;
    padding: 6px 0;
  }
  .menu-stage {
    position: relative;
    display: block;
    flex: 1;
    min-height: 0;
    padding: 0;
  }
  .menu-door-wrap {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(260px, 54vh, 48vw);
    margin: 0;
    transform: translate(-50%, -48%);
  }
  .menu-plaque {
    position: absolute;
    left: 50%;
    top: 2px;
    width: min(520px, 70vw);
    margin: 0;
    transform: translateX(-50%) rotate(-0.4deg);
  }
  .menu-actions {
    position: absolute;
    left: 50%;
    top: 46%;
    width: min(290px, 42vw);
    margin: 0;
    transform: translateX(-50%);
  }
  .menu-side {
    position: absolute;
    right: 1%;
    bottom: 0;
    width: min(160px, 24vw);
    margin: 0;
  }
  .name-card {
    width: 100%;
  }
  .menu-cat {
    width: min(110px, 100%);
    margin-top: -10px;
  }
  .menu-foot {
    display: none;
  }

  .select-screen {
    overflow: hidden !important;
  }
  .select-layer {
    width: min(1180px, 96vw);
    min-height: 100dvh;
    justify-content: center;
    padding: 6px 0 8px;
  }
  .select-top {
    flex-wrap: nowrap;
    gap: 12px;
    margin-bottom: 6px;
  }
  .select-heading {
    order: 0;
    width: auto;
    flex: 1 1 auto;
  }
  .select-heading .kicker {
    display: none;
  }
  .select-heading h1 {
    margin: 0;
    font-size: clamp(19px, 2.8vw, 22px);
  }
  .select-player {
    font-size: 16px;
  }
  .select-avatar {
    width: 34px;
    height: 34px;
  }
  .select-board {
    padding: 8px 12px;
    border-width: 3px;
    border-radius: 16px;
    box-shadow: 0 6px 0 var(--ink), 0 12px 20px rgba(0, 0, 0, 0.3);
  }
  .class-row {
    gap: 5px;
    padding-bottom: 6px;
  }
  .class-tab {
    min-height: 32px;
    padding: 0 4px;
    border-width: 5px;
    border-image-slice: 20 fill;
    border-image-width: 5px;
    border-radius: 10px;
    font-size: 12px;
  }
  .subject-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin: 8px 0;
  }
  .subject-card {
    min-height: 62px;
    padding: 6px 8px;
    gap: 7px;
    border-width: 3px;
    border-radius: 12px;
    box-shadow: 0 3px 0 #C98A2C;
  }
  .subject-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }
  .subject-copy strong {
    font-size: 13px;
  }
  .subject-copy span {
    display: none;
  }
  .subject-card.is-selected::after {
    display: none;
  }
  .select-bottom {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: 6px;
    gap: 10px;
  }
  .select-summary {
    font-size: 17px;
    text-align: left;
  }
  .select-bottom .fantasy-btn {
    width: 190px;
    min-height: 40px;
    font-size: 15px;
  }
  .select-note,
  .select-cat {
    display: none;
  }

  .pause-card {
    width: min(820px, 94vw);
    max-width: none;
    max-height: none;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 230px;
    grid-template-areas:
      "head head"
      "body actions";
    align-items: center;
    gap: 8px 16px;
    padding: 10px 14px;
    border-radius: 20px;
  }
  .pause-head {
    grid-area: head;
    justify-content: flex-start;
    gap: 8px;
    margin: 0;
  }
  .pause-symbol {
    width: 32px;
    height: 32px;
    font-size: 11px;
  }
  .pause-head h2 {
    font-size: 26px;
  }
  .pause-body {
    grid-area: body;
    margin: 0;
    padding: 8px 10px;
    gap: 12px;
  }
  .pause-profile {
    width: 112px;
  }
  .pause-avatar {
    width: 56px;
    height: 56px;
    margin-bottom: 2px;
  }
  .pause-profile b {
    font-size: 21px;
  }
  .pause-profile span {
    font-size: 9px;
  }
  .setting-row {
    padding: 4px 0;
    font-size: 12px;
  }
  .pause-setting-note {
    display: none;
  }
  .toggle {
    width: 70px;
    min-width: 70px;
    height: 33px;
    min-height: 33px;
  }
  .pause-actions {
    grid-area: actions;
    gap: 6px;
    margin: 0;
    justify-content: center;
  }
  .pause-actions .fantasy-btn {
    min-height: 42px;
    font-size: 15px;
  }
  .pause-actions .text-btn {
    font-size: 14px;
  }

  .guide-card {
    width: min(820px, 94vw);
    max-height: none;
    overflow: hidden;
    padding: 10px 14px;
  }
  .guide-heading {
    padding-right: 32px;
  }
  .guide-heading .kicker {
    font-size: 8px;
  }
  .guide-heading h2 {
    margin: 2px 0;
    font-size: 23px;
  }
  .guide-heading > p:last-child {
    font-size: 11px;
  }
  .guide-body {
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 12px;
    margin: 7px 0;
  }
  .demo {
    height: 150px;
  }
  .guide-steps {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
  }
  .guide-steps strong {
    font-size: 12px;
  }
  .guide-steps p {
    font-size: 9.5px;
  }
  .step-num {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }
  .guide-tip {
    display: none;
  }
  .guide-done {
    width: 210px;
    min-height: 38px;
    margin-left: auto;
    font-size: 14px;
  }

  .round-card {
    width: min(720px, 94vw);
    max-height: none;
    overflow: hidden;
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: center;
    gap: 2px 14px;
    padding: 12px 18px;
    text-align: left;
  }
  .round-burst {
    grid-column: 1;
    grid-row: 1 / span 5;
    width: 130px;
    height: 120px;
    margin: 0 auto;
  }
  .round-rays {
    width: 150px;
    height: 150px;
  }
  .round-kicker,
  .round-card h2,
  .round-reward,
  .round-explanation,
  .round-card .fantasy-btn {
    grid-column: 2;
  }
  .round-kicker {
    margin: 0;
  }
  .round-card h2 {
    margin: 0;
    font-size: 28px;
  }
  .round-reward {
    justify-content: flex-start;
    font-size: 14px;
  }
  .round-explanation {
    margin: 2px 0 8px;
    font-size: 11px;
    text-align: left;
  }
  .round-card .fantasy-btn {
    min-height: 40px;
    font-size: 15px;
  }

  .victory-screen {
    overflow: hidden;
  }
  .victory-layer {
    width: min(1080px, 96vw);
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    align-items: center;
    align-content: center;
    gap: 0 24px;
    padding: 10px 0;
    text-align: left;
  }
  .victory-head {
    grid-column: 1;
  }
  .victory-head .kicker {
    justify-content: flex-start;
  }
  .victory-head h1 {
    font-size: clamp(28px, 4.2vw, 42px);
  }
  .selesai-banner {
    margin: 8px 0;
    padding: 4px 18px;
    font-size: 28px;
  }
  .victory-sub {
    max-width: 360px;
    font-size: 13px;
  }
  .victory-board {
    grid-column: 2;
    width: 100%;
    margin: 0;
    padding: 12px 14px;
  }
  .victory-stats {
    gap: 5px;
    margin: 8px 0;
  }
  .victory-stats .stat {
    padding: 6px 4px;
  }
  .stat-label {
    font-size: 7.5px;
  }
  .victory-actions {
    margin: 0;
    gap: 8px;
  }
  .victory-actions .fantasy-btn {
    min-height: 40px;
    font-size: 14px;
  }
  .victory-recap-wrap,
  .victory-foot,
  .victory-cat {
    display: none;
  }

  .exit-card {
    width: min(620px, 92vw);
    padding: 14px 18px;
  }
  .exit-cat {
    width: 60px;
    height: 60px;
    margin-bottom: 2px;
  }
  .exit-card h2 {
    font-size: 24px;
  }
  .exit-card p {
    margin-bottom: 10px;
    font-size: 12px;
  }
  .exit-card .fantasy-btn {
    min-height: 42px;
    font-size: 15px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .hud {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "left progress right";
    gap: 4px 8px;
    padding: 5px 8px;
  }
  .hud-left {
    grid-area: left;
  }
  .hud-progress {
    grid-area: progress;
    justify-content: center;
    gap: 7px;
  }
  .hud-progress::before {
    left: 4%;
    right: 4%;
  }
  .hud-right {
    grid-area: right;
    gap: 2px;
  }
  .hud-session {
    display: none;
  }
  .hud-round {
    font-size: 11px;
  }
  .lock-token {
    width: 22px;
    height: 26px;
  }
  .lock-token .lock-body {
    width: 18px;
    height: 16px;
  }
  .lock-token .lock-shackle {
    width: 12px;
    height: 10px;
    border-width: 2px;
  }
  .lock-token .lock-face {
    font-size: 8px;
  }
  .coin-pill {
    min-height: 24px;
    padding: 2px 4px 2px 3px;
    gap: 2px;
    font-size: 10px;
  }
  .coin {
    width: 13px;
    height: 13px;
  }
  .hud .icon-btn {
    width: 28px;
    height: 28px;
  }
  .hud #btnPause {
    width: 30px;
    height: 30px;
  }

  .answer-dock {
    padding: 0 8px 4px;
  }
  .dock-panel {
    padding: 5px 8px;
    border-radius: 12px;
  }
  .dock-fill {
    grid-template-columns: minmax(0, 1fr) minmax(0, 230px);
    grid-template-areas:
      "head head"
      "fill pad";
    gap: 4px 8px;
  }
  .dock-head {
    margin-bottom: 1px;
  }
  .dock-kicker,
  .dock-hint {
    display: none;
  }
  .dock-head h2 {
    font-size: 12px;
  }
  .fill-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px;
  }
  .answer-input {
    height: 34px;
    font-size: 17px;
  }
  .btn-weigh {
    min-height: 34px;
    padding: 0 8px;
    font-size: 10px;
  }
  .numpad {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 3px;
  }
  .numkey {
    min-height: 26px;
    font-size: 11px;
    border-radius: 6px;
  }
  .stones {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }
  .stone {
    min-height: 34px;
    padding: 3px 5px;
    border-width: 1.5px;
    font-size: 11px;
  }
  .stone::before {
    display: none;
  }
  .dock-mc .dock-head {
    margin-bottom: 2px;
  }
}

/* =========================================================
   TOMBOL ASLI — SKALA TETAP
   Aset dipakai pada rasio aslinya. Tidak ada border-image,
   peregangan, atau pengecilan per tombol.
   ========================================================= */

.fantasy-btn.primary,
.fantasy-btn.cream,
.fantasy-btn.exit,
.fantasy-btn.gold,
.fantasy-btn.white {
  flex: 0 0 auto;
  width: 306px;
  height: 104px;
  min-height: 0;
  max-width: none;
  padding: 0;
  border: 0;
  border-image: none;
  border-radius: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  box-shadow: none;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.05;
}
.fantasy-btn.primary {
  background-image: url("../assets/Icon/Normal Menu.svg");
  color: #FFF8E4;
}
.fantasy-btn.primary.press {
  width: 335px;
  height: 118px;
  padding: 14px 0 0 28px;
  background-image: url("../assets/Icon/Press Menu.svg");
  font-size: 26px;
}
.fantasy-btn.cream {
  background-image: url("../assets/Icon/Jawaban.svg");
  color: var(--ink);
}
.fantasy-btn.exit {
  background-image: url("../assets/Icon/Normal class-1.svg");
  color: #FFF8E4;
}
.fantasy-btn.gold {
  width: 336px;
  height: 136px;
  padding: 32px 0 0 28px;
  background-image: url("../assets/Icon/Select class.svg");
  color: var(--ink);
}
.fantasy-btn.white {
  height: 105px;
  background-image: url("../assets/Icon/Menu pengaturan.svg");
  color: var(--ink);
}
.fantasy-btn.primary:hover,
.fantasy-btn.cream:hover,
.fantasy-btn.exit:hover,
.fantasy-btn.gold:hover,
.fantasy-btn.white:hover {
  filter: brightness(1.04);
}
.fantasy-btn.primary:active,
.fantasy-btn.cream:active,
.fantasy-btn.exit:active,
.fantasy-btn.gold:active,
.fantasy-btn.white:active {
  transform: translateY(2px);
  box-shadow: none;
}

/* Layout tombol besar di menu utama desktop */
@media (min-width: 721px) and (min-height: 501px) {
  .menu-actions {
    width: auto;
    gap: 10px;
    top: 50%;
    align-items: center;
  }
  .menu-actions .fantasy-btn {
    width: auto;
  }
}

/* Susunan menu horizontal untuk ponsel landscape */
@media (orientation: landscape) and (max-height: 500px) {
  .menu-plaque {
    display: none;
  }
  .menu-side {
    display: none;
  }
  .menu-top {
    min-height: 0;
  }
  .menu-actions {
    top: 53%;
    left: 50%;
    display: grid;
    grid-template-columns: 335px 336px;
    grid-template-rows: auto auto;
    width: auto;
    gap: 8px;
    align-items: center;
    justify-items: center;
    transform: translate(-50%, -50%);
  }
  .menu-actions #btnPlay {
    grid-column: 1;
    grid-row: 1;
  }
  .menu-actions #btnChoose {
    grid-column: 2;
    grid-row: 1;
  }
  .menu-actions #btnExit {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .menu-foot {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 720px) {
  .menu-actions {
    grid-template-columns: 306px 306px;
  }
  .menu-actions #btnPlay {
    width: 306px;
    height: 104px;
    padding: 0;
    background-image: url("../assets/Icon/Normal Menu.svg");
    font-size: 24px;
  }
  .menu-actions #btnChoose {
    width: 306px;
    height: 104px;
    padding: 0;
    background-image: url("../assets/Icon/Normal class.svg");
    font-size: 24px;
  }
}

/* Tombol di dalam panel tidak boleh mengubah ukuran aset */
.menu-actions .fantasy-btn.primary,
.menu-actions .fantasy-btn.gold,
.menu-actions .fantasy-btn.exit,
.pause-actions .fantasy-btn,
.select-bottom .fantasy-btn,
.round-card .fantasy-btn,
.victory-actions .fantasy-btn,
.exit-card .fantasy-btn,
.guide-done {
  flex: 0 0 auto;
  width: 306px;
  height: 104px;
  min-height: 0;
}
.pause-actions .fantasy-btn,
.victory-actions .fantasy-btn {
  flex: 0 0 auto;
}
.pause-actions .fantasy-btn.white,
.victory-actions .fantasy-btn.white {
  height: 105px;
}

/* Kembalikan tab kelas ke pill CSS; aset tombol besar tidak dipaksa jadi tab. */
.class-tab {
  border: 2px solid var(--ink);
  border-image: none;
  border-radius: 999px;
  background: var(--cream);
  box-shadow: 0 3px 0 #B9772E;
  padding: 0 14px;
  min-height: 38px;
  font-size: 13px;
}
.class-tab:hover {
  background: var(--gold-light);
  filter: none;
}
.class-tab.is-selected {
  background: var(--gold);
  border-image: none;
  box-shadow: 0 3px 0 #6B431E;
}

/* Toggle memakai ukuran asli 91x42, tanpa peregangan. */
.toggle {
  width: 91px;
  min-width: 91px;
  height: 42px;
  min-height: 42px;
  background-size: 100% 100%;
}

/* Pause HUD kembali ke ikon CSS, bukan aset 100x100 yang dipaksa kecil. */
.hud #btnPause {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 2px solid var(--gold-dark);
  border-radius: 12px;
  background: radial-gradient(circle at 35% 25%, #FFF4C9, #F6C84C 55%, #C98A2C);
  box-shadow: 0 3px 0 #6B431E;
}
.hud #btnPause svg {
  display: block;
  width: 18px;
  height: 18px;
  color: var(--ink);
}
.hud #btnPause:hover {
  filter: brightness(1.05);
  background-color: transparent;
}

.victory-cat img {
  animation: catJoy 1.4s ease-in-out infinite;
  transform-origin: 50% 100%;
}
@keyframes catJoy {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

.rotate-gate {
  display: none;
}

@media (orientation: portrait) and (max-width: 900px) {
  .rotate-gate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
    background:
      radial-gradient(ellipse at 50% 35%, rgba(246, 200, 76, 0.16), transparent 55%),
      #1B120D;
    color: var(--cream);
    text-align: center;
  }
  .rotate-card {
    width: min(340px, 100%);
  }
  .rotate-card img {
    display: block;
    width: min(150px, 42vw);
    height: auto;
    margin: 0 auto 6px;
    filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.35));
  }
  .rotate-arrow {
    display: block;
    margin-bottom: 4px;
    color: var(--gold);
    font-family: var(--font-display);
    font-size: 34px;
    line-height: 1;
  }
  .rotate-card h2 {
    margin: 0 0 6px;
    color: var(--cream);
    font-family: var(--font-display);
    font-size: clamp(22px, 7vw, 30px);
    font-weight: 600;
  }
  .rotate-card p {
    margin: 0;
    color: rgba(253, 240, 200, 0.7);
    font-family: var(--font-hand);
    font-size: 17px;
    line-height: 1.3;
  }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 620px) {
  .menu-actions {
    top: 44%;
  }
  .pause-card {
    grid-template-columns: minmax(0, 1fr) 200px;
    gap: 6px 12px;
  }
  .pause-profile {
    width: 95px;
  }
  .pause-avatar {
    width: 48px;
    height: 48px;
  }
  .pause-profile b {
    font-size: 19px;
  }
  .setting-row {
    font-size: 11px;
  }
  .toggle {
    width: 64px;
    min-width: 64px;
    height: 30px;
    min-height: 30px;
  }
  .pause-actions .fantasy-btn {
    min-height: 38px;
    font-size: 14px;
  }
  .name-pencil {
    display: none;
  }
  .name-card {
    padding: 7px 9px 6px;
  }
  .name-card input {
    font-size: 19px;
  }
  .name-card label {
    padding: 2px 7px;
    font-size: 9px;
  }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 700px) {
  .subject-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .subject-card {
    min-height: 48px;
  }
  .select-board {
    padding: 6px 9px;
  }
  .class-tab {
    min-height: 28px;
    font-size: 11px;
  }
}

/* =========================================================
   PANGGUNG TIMBANGAN 2D
   Beam, rantai, dial, dan kucing di tengah seperti referensi.
   ========================================================= */

.scale-rig,
.stage-guide {
  display: none;
}

@media (min-width: 721px) and (min-height: 501px) {
  .stage-3d.is-compact {
    position: relative;
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }
  .stage-3d.is-compact .scale-rig {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
  }
  .rig-arch {
    position: absolute;
    left: 50%;
    top: -2%;
    width: 56%;
    height: 76%;
    transform: translateX(-50%);
    border: 12px solid rgba(201, 138, 44, 0.18);
    border-bottom: 0;
    border-radius: 50% 50% 0 0 / 40% 40% 0 0;
    box-shadow: inset 0 0 60px rgba(246, 200, 76, 0.08);
  }
  .rig-beam {
    position: absolute;
    left: 22%;
    right: 22%;
    top: 26%;
    height: 12px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: linear-gradient(180deg, #FFE39A 0%, #F6C84C 38%, #C98A2C 100%);
    box-shadow: 0 5px 0 rgba(74, 46, 24, 0.55), 0 8px 16px rgba(0, 0, 0, 0.3);
  }
  .rig-column {
    position: absolute;
    left: 50%;
    top: 26%;
    bottom: 16%;
    width: 16px;
    transform: translateX(-50%);
    border: 2px solid var(--ink);
    border-radius: 6px;
    background: linear-gradient(90deg, #C98A2C, #F6C84C 45%, #8A5A1E);
    box-shadow: 0 0 18px rgba(246, 200, 76, 0.18);
  }
  .rig-base {
    position: absolute;
    left: 50%;
    bottom: 11%;
    width: 240px;
    height: 34px;
    transform: translateX(-50%);
    clip-path: polygon(9% 0, 91% 0, 100% 100%, 0 100%);
    background: linear-gradient(180deg, #F6C84C, #C98A2C 45%, #6B431E);
    filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.35));
  }
  .rig-cat {
    position: absolute;
    left: 50%;
    top: 6%;
    z-index: 4;
    width: 92px;
    transform: translateX(-50%);
    filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.3));
  }
  .rig-cat svg {
    display: block;
    width: 100%;
    height: auto;
  }
  .stage-3d.is-compact .pan-layer {
    position: absolute;
    inset: 0;
    display: block;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    z-index: 6;
  }
  .stage-3d.is-compact .pan-float {
    position: absolute !important;
    top: 33% !important;
    width: 31% !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .stage-3d.is-compact #questionFloat {
    left: 6.5% !important;
  }
  .stage-3d.is-compact #answerFloat {
    right: 6.5% !important;
    left: auto !important;
  }
  .stage-3d.is-compact .pan-float::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -28%;
    width: 2px;
    height: 28%;
    background: linear-gradient(180deg, #F6C84C, rgba(201, 138, 44, 0.4));
  }
  .stage-3d.is-compact .pan-hook {
    display: block;
    position: absolute;
    left: 50%;
    top: -13px;
    width: 16px;
    height: 16px;
    transform: translateX(-50%);
    border: 2px solid var(--ink);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #FFF4C9, #F6C84C 55%, #8A5A1E);
  }
  .stage-3d.is-compact .pan {
    min-height: 170px;
    height: auto;
    padding: 14px 18px;
    border: 3px solid var(--ink);
    border-radius: 16px;
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.3);
  }
  .stage-3d.is-compact .question-text {
    font-size: clamp(20px, 2vw, 27px);
  }
  .stage-3d.is-compact .answer-display {
    font-size: clamp(30px, 3vw, 42px);
  }
  .stage-3d.is-compact .compact-dial {
    position: absolute;
    left: 50%;
    top: 16%;
    z-index: 5;
    display: flex;
    width: min(300px, 24vw);
    height: auto;
    transform: translateX(-50%);
    justify-content: center;
    align-items: center;
  }
  .stage-3d.is-compact .dial {
    width: 100%;
    height: auto;
    max-width: none;
    aspect-ratio: 2 / 1;
  }
  .stage-3d.is-compact .dial-tilt-labels {
    display: none;
  }
  .stage-3d.is-compact .dial-mascot {
    display: none;
  }
  .stage-3d.is-compact .scale-status {
    position: absolute;
    left: 50%;
    bottom: 8%;
    z-index: 8;
    margin: 0;
    transform: translateX(-50%);
    max-width: 320px;
  }
  .stage-3d.is-compact .stage-guide {
    display: block;
    position: absolute;
    left: 2%;
    bottom: 2%;
    z-index: 4;
    width: min(145px, 11vw);
    height: auto;
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.3));
  }
  .stage-3d.is-compact .mascot {
    display: none;
  }
}

/* Dock krem seperti referensi */
.dock-panel {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.7), transparent 48%),
    linear-gradient(160deg, #FFF8E5 0%, #FDF0C8 64%, #EFD9A8 100%) !important;
  border: 3px solid var(--ink) !important;
  border-top: 4px solid var(--gold) !important;
  box-shadow:
    0 -12px 30px rgba(0, 0, 0, 0.28),
    inset 0 0 0 2px rgba(255, 255, 255, 0.3) !important;
}
.dock-kicker {
  color: var(--gold-dark) !important;
}
.dock-head h2 {
  color: var(--ink) !important;
}
.dock-hint {
  color: var(--ink-soft) !important;
}
.dock-hint.is-warn {
  color: var(--red-dark) !important;
}
.dock-hint.is-good {
  color: var(--green-dark) !important;
}
.answer-input {
  color: var(--ink) !important;
  border: 3px solid var(--ink) !important;
  background: #FFFDF5 !important;
  box-shadow: inset 0 3px 6px rgba(107, 78, 51, 0.1), 0 3px 0 rgba(107, 78, 51, 0.15) !important;
}
.answer-input::placeholder {
  color: rgba(107, 78, 51, 0.45) !important;
}
.answer-input:focus {
  border-color: var(--gold-dark) !important;
  box-shadow: 0 0 0 4px rgba(246, 200, 76, 0.3) !important;
}
.btn-weigh {
  color: #FFF8E4 !important;
  border: 3px solid var(--ink) !important;
  background: var(--green) !important;
  box-shadow: 0 5px 0 #1E5A33 !important;
}
.btn-weigh:hover {
  filter: brightness(1.05);
}
.btn-weigh:disabled {
  color: #6E665B !important;
  background: #C5BBA7 !important;
  border-color: #8E8474 !important;
  box-shadow: 0 4px 0 #8E8474 !important;
}
.numpad .numkey {
  color: var(--ink) !important;
  border: 2px solid var(--ink) !important;
  background: #FFFDF5 !important;
  box-shadow: 0 3px 0 #B9772E !important;
}
.numpad .numkey:hover {
  background: var(--gold-light) !important;
}
.stones .stone {
  color: var(--ink) !important;
  border: 2px solid var(--ink) !important;
  background: #FFFDF5 !important;
  box-shadow: 0 4px 0 #B9772E !important;
}
.stones .stone:hover {
  background: var(--gold-light) !important;
}
.stones .stone.is-selected {
  background: var(--gold) !important;
  box-shadow: 0 4px 0 #6B431E, 0 0 0 3px rgba(246, 200, 76, 0.3) !important;
}

/* =========================================================
   FINAL: UKURAN ASET TOMBOL DIKUNCI
   Semua tombol besar memakai ukuran asli/rasio asli. Jangan
   mengecilkan atau meregangkan aset per layar.
   ========================================================= */

.fantasy-btn.primary,
.fantasy-btn.cream,
.fantasy-btn.exit,
.fantasy-btn.gold,
.fantasy-btn.white {
  width: 306px !important;
  height: 104px !important;
  min-height: 0 !important;
  max-height: none !important;
  flex: 0 0 auto !important;
  padding: 0 !important;
  border: 0 !important;
  border-image: none !important;
  border-radius: 0 !important;
  background-color: transparent !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 100% 100% !important;
  box-shadow: none !important;
  font-size: 24px !important;
  line-height: 1.05 !important;
}
.fantasy-btn.primary {
  background-image: url("../assets/Icon/Normal Menu.svg") !important;
  color: #FFF8E4 !important;
}
.fantasy-btn.primary.press {
  width: 335px !important;
  height: 118px !important;
  padding: 14px 0 0 28px !important;
  background-image: url("../assets/Icon/Press Menu.svg") !important;
  font-size: 26px !important;
}
.fantasy-btn.cream {
  background-image: url("../assets/Icon/Jawaban.svg") !important;
  color: var(--ink) !important;
}
.fantasy-btn.exit {
  background-image: url("../assets/Icon/Normal class-1.svg") !important;
  color: #FFF8E4 !important;
}
.fantasy-btn.gold {
  width: 336px !important;
  height: 136px !important;
  padding: 32px 0 0 28px !important;
  background-image: url("../assets/Icon/Select class.svg") !important;
  color: var(--ink) !important;
}
.fantasy-btn.white {
  height: 105px !important;
  background-image: url("../assets/Icon/Menu pengaturan.svg") !important;
  color: var(--ink) !important;
}
.fantasy-btn.primary:hover,
.fantasy-btn.cream:hover,
.fantasy-btn.exit:hover,
.fantasy-btn.gold:hover,
.fantasy-btn.white:hover {
  filter: brightness(1.04);
}
.fantasy-btn.primary:active,
.fantasy-btn.cream:active,
.fantasy-btn.exit:active,
.fantasy-btn.gold:active,
.fantasy-btn.white:active {
  transform: translateY(2px);
  box-shadow: none !important;
}

.select-bottom .fantasy-btn,
.pause-actions .fantasy-btn,
.round-card .fantasy-btn,
.victory-actions .fantasy-btn,
.exit-card .fantasy-btn,
.guide-done {
  width: 306px !important;
  height: 104px !important;
  min-height: 104px !important;
  max-height: none !important;
  flex: 0 0 auto !important;
  font-size: 24px !important;
}
.pause-actions .fantasy-btn.white,
.victory-actions .fantasy-btn.white {
  height: 105px !important;
  min-height: 105px !important;
}

.class-tab {
  border: 2px solid var(--ink) !important;
  border-image: none !important;
  border-radius: 999px !important;
  background: var(--cream) !important;
  box-shadow: 0 3px 0 #B9772E !important;
  padding: 0 14px !important;
  min-height: 38px !important;
  font-size: 13px !important;
}
.class-tab.is-selected {
  background: var(--gold) !important;
  box-shadow: 0 3px 0 #6B431E !important;
}

.toggle {
  width: 91px !important;
  min-width: 91px !important;
  height: 42px !important;
  min-height: 42px !important;
  border: 0 !important;
  background-size: 100% 100% !important;
}

.hud #btnPause {
  width: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  border: 2px solid var(--gold-dark) !important;
  border-radius: 12px !important;
  background: radial-gradient(circle at 35% 25%, #FFF4C9, #F6C84C 55%, #C98A2C) !important;
  box-shadow: 0 3px 0 #6B431E !important;
}
.hud #btnPause svg {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  color: var(--ink) !important;
}

@media (min-width: 721px) and (min-height: 501px) {
  .pause-actions {
    align-items: center;
  }
  .victory-actions {
    justify-content: center;
  }
  .round-card .fantasy-btn {
    margin-left: auto;
    margin-right: auto;
  }
  .guide-done {
    margin-left: auto;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .menu-plaque {
    display: block !important;
    position: absolute;
    left: 50%;
    top: 0;
    width: min(460px, 62vw);
    padding: 5px 12px 7px;
    transform: translateX(-50%);
    border-width: 2px;
    border-radius: 12px;
    box-shadow: 0 4px 0 #2B1E16;
  }
  .menu-plaque::before,
  .plaque-crown,
  .plaque-star {
    display: none;
  }
  .plaque-line1 {
    font-size: 15px;
  }
  .plaque-line2 {
    font-size: 20px;
  }
  .menu-side {
    display: none !important;
  }
  .menu-actions {
    top: 53%;
    left: 50%;
    display: grid;
    grid-template-columns: 335px 336px;
    grid-template-rows: auto auto;
    width: auto;
    gap: 8px;
    align-items: center;
    justify-items: center;
    transform: translate(-50%, -50%);
  }
  .menu-actions #btnPlay {
    grid-column: 1;
    grid-row: 1;
  }
  .menu-actions #btnChoose {
    grid-column: 2;
    grid-row: 1;
  }
  .menu-actions #btnExit {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .pause-card {
    display: flex !important;
    flex-direction: column;
    width: min(680px, 100vw) !important;
    max-width: 100vw !important;
    padding: 8px 10px !important;
    gap: 6px;
    overflow: hidden !important;
  }
  .pause-head {
    justify-content: flex-start;
    margin: 0;
  }
  .pause-body {
    width: 100%;
    padding: 6px 8px;
    gap: 10px;
  }
  .pause-profile {
    width: 96px;
  }
  .pause-avatar {
    width: 48px;
    height: 48px;
  }
  .pause-profile b {
    font-size: 19px;
  }
  .pause-actions {
    flex-direction: row;
    justify-content: center;
    width: 100%;
    margin: 0;
    gap: 8px;
  }
  .pause-actions .text-btn {
    display: none;
  }

  .select-bottom {
    min-height: 104px;
  }
  .select-bottom .fantasy-btn {
    width: 306px !important;
    height: 104px !important;
    min-height: 104px !important;
    font-size: 24px !important;
  }

  .guide-done {
    width: 306px !important;
    height: 104px !important;
    min-height: 104px !important;
    font-size: 24px !important;
  }
  .guide-body .demo {
    display: none;
  }
  .guide-body {
    grid-template-columns: 1fr;
  }

  .round-card {
    grid-template-columns: 130px minmax(0, 1fr);
    width: min(760px, 96vw);
    padding: 8px 12px;
  }
  .round-burst {
    width: 110px;
    height: 110px;
  }
  .round-explanation {
    margin: 0 0 4px;
    font-size: 10px;
  }

  .victory-layer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100vw;
    gap: 6px;
    padding: 6px 8px;
    text-align: center;
  }
  .victory-head h1 {
    font-size: 26px;
  }
  .victory-head .kicker {
    justify-content: center;
  }
  .selesai-banner {
    font-size: 22px;
    margin: 4px 0;
  }
  .victory-sub {
    max-width: 620px;
    font-size: 12px;
  }
  .victory-board {
    width: min(680px, 100vw) !important;
    margin: 0 auto;
    padding: 8px 10px;
  }
  .victory-stats {
    margin: 5px 0;
  }
  .victory-actions {
    flex-direction: row;
    justify-content: center;
    gap: 8px;
  }
  .victory-recap-wrap,
  .victory-foot,
  .victory-cat {
    display: none;
  }

  .exit-card {
    width: min(520px, 96vw);
    padding: 8px 12px;
  }
  .exit-cat {
    width: 50px;
    height: 50px;
    margin-bottom: 2px;
  }
  .exit-card h2 {
    font-size: 22px;
  }
  .exit-card p {
    margin-bottom: 6px;
    font-size: 11px;
  }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 720px) {
  .menu-actions {
    grid-template-columns: 306px 306px;
  }
  .menu-actions #btnPlay {
    width: 306px !important;
    height: 104px !important;
    padding: 0 !important;
    background-image: url("../assets/Icon/Normal Menu.svg") !important;
    font-size: 24px !important;
  }
  .menu-actions #btnChoose {
    width: 306px !important;
    height: 104px !important;
    padding: 0 !important;
    background-image: url("../assets/Icon/Normal class.svg") !important;
    font-size: 24px !important;
  }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 640px) {
  .pause-card {
    width: 100vw !important;
    padding: 6px !important;
  }
  .pause-actions {
    gap: 8px;
  }
  .victory-board {
    width: 100vw !important;
    padding: 6px;
  }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 620px) {
  .pause-body {
    display: none;
  }
  .pause-actions {
    flex-direction: column;
  }
  .pause-card {
    width: min(380px, 100vw) !important;
  }
  .select-top {
    margin-bottom: 4px;
  }
  .class-tab {
    min-height: 26px !important;
    padding: 0 8px !important;
    font-size: 10px !important;
  }
  .subject-card {
    min-height: 40px !important;
  }
  .select-board {
    padding: 6px 8px;
  }
  .victory-head {
    display: none;
  }
  .victory-actions {
    flex-direction: column;
  }
  .victory-board {
    width: min(360px, 100vw) !important;
  }
  .victory-badges {
    display: none;
  }
  .victory-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Beam dan piringan bergerak mengikuti hasil timbangan */
.rig-beam {
  transform-origin: 50% 50%;
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
#questionFloat,
#answerFloat {
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.stage-3d.is-heavy .rig-beam {
  transform: rotate(2.4deg);
}
.stage-3d.is-light .rig-beam {
  transform: rotate(-2.4deg);
}
.stage-3d.is-heavy #questionFloat {
  transform: translateY(-9px) !important;
}
.stage-3d.is-heavy #answerFloat {
  transform: translateY(15px) !important;
}
.stage-3d.is-light #questionFloat {
  transform: translateY(15px) !important;
}
.stage-3d.is-light #answerFloat {
  transform: translateY(-9px) !important;
}
.stage-3d.is-balanced #questionFloat,
.stage-3d.is-balanced #answerFloat {
  transform: translateY(0) !important;
}

/* Panggung timbangan ringkas untuk HP landscape */
@media (orientation: landscape) and (max-height: 500px) {
  .stage-3d.is-compact {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 100%;
    padding: 0;
    overflow: hidden;
  }
  .stage-3d.is-compact .scale-rig {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
  }
  .stage-3d.is-compact .rig-arch {
    display: none;
  }
  .stage-3d.is-compact .rig-beam {
    position: absolute;
    left: 19%;
    right: 19%;
    top: 30%;
    height: 7px;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    background: linear-gradient(180deg, #FFE39A 0%, #F6C84C 38%, #C98A2C 100%);
    box-shadow: 0 3px 0 rgba(74, 46, 24, 0.5);
  }
  .stage-3d.is-compact .rig-column {
    position: absolute;
    left: 50%;
    top: 30%;
    bottom: 10%;
    width: 9px;
    transform: translateX(-50%);
    border: 1.5px solid var(--ink);
    border-radius: 4px;
    background: linear-gradient(90deg, #C98A2C, #F6C84C 45%, #8A5A1E);
  }
  .stage-3d.is-compact .rig-base {
    position: absolute;
    left: 50%;
    bottom: 7%;
    width: 120px;
    height: 18px;
    transform: translateX(-50%);
    clip-path: polygon(9% 0, 91% 0, 100% 100%, 0 100%);
    background: linear-gradient(180deg, #F6C84C, #C98A2C 45%, #6B431E);
    filter: drop-shadow(0 5px 6px rgba(0, 0, 0, 0.3));
  }
  .stage-3d.is-compact .rig-cat {
    position: absolute;
    left: 50%;
    top: 0;
    z-index: 4;
    width: clamp(34px, 5.5vw, 48px);
    transform: translateX(-50%);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
  }
  .stage-3d.is-compact .rig-cat svg {
    display: block;
    width: 100%;
    height: auto;
  }
  .stage-3d.is-compact .pan-layer {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
  }
  .stage-3d.is-compact .pan-float {
    position: absolute !important;
    top: 36% !important;
    width: 32% !important;
    min-width: 0;
  }
  .stage-3d.is-compact #questionFloat {
    left: 3% !important;
  }
  .stage-3d.is-compact #answerFloat {
    right: 3% !important;
    left: auto !important;
  }
  .stage-3d.is-compact .pan-float::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -8%;
    width: 2px;
    height: 8%;
    background: linear-gradient(180deg, #F6C84C, rgba(201, 138, 44, 0.4));
  }
  .stage-3d.is-compact .pan {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: auto;
    min-height: 118px;
    padding: 7px 9px;
    border-width: 2px;
    border-radius: 12px;
  }
  .stage-3d.is-compact .pan-question,
  .stage-3d.is-compact .pan-answer {
    min-height: 118px;
  }
  .stage-3d.is-compact .question-text {
    margin: 2px 0;
    font-size: clamp(13px, 1.9vw, 17px);
  }
  .stage-3d.is-compact .question-text.is-long {
    font-size: clamp(12px, 1.7vw, 16px);
  }
  .stage-3d.is-compact .question-note {
    font-size: 8px;
  }
  .stage-3d.is-compact .answer-display {
    font-size: clamp(23px, 3vw, 32px);
  }
  .stage-3d.is-compact .compact-dial {
    position: absolute;
    left: 50%;
    top: 5%;
    z-index: 5;
    display: flex;
    width: clamp(72px, 11vw, 115px);
    height: auto;
    transform: translateX(-50%);
  }
  .stage-3d.is-compact .dial {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 1;
  }
  .stage-3d.is-compact .dial-tilt-labels,
  .stage-3d.is-compact .dial-mascot,
  .stage-3d.is-compact .mascot,
  .stage-3d.is-compact .stage-guide {
    display: none !important;
  }
  .stage-3d.is-compact .scale-status {
    display: flex !important;
    position: absolute;
    left: 3%;
    bottom: 1%;
    z-index: 8;
    margin: 0;
    min-height: 20px;
    max-width: 44%;
    padding: 3px 8px;
    font-size: 8px;
  }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 700px) {
  .stage-3d.is-compact .scale-status {
    display: none !important;
  }
}

@media (orientation: landscape) and (max-height: 500px) and (min-width: 721px) {
  .hud-session {
    display: inline-block;
    margin-top: 1px;
    padding: 1px 6px;
    font-size: 8px;
  }
  .menu-side {
    display: flex !important;
    position: absolute;
    right: 1%;
    bottom: 0;
    width: 150px;
    margin: 0;
  }
  .menu-cat {
    display: block !important;
    position: absolute;
    right: 100%;
    bottom: 0;
    width: 72px;
    margin: 0;
  }
  .name-card {
    width: 100%;
  }
}
