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

:root {
  --cream:       #FFF8EE;
  --peach:       #FFE4C4;
  --orange:      #FF7043;
  --brown:       #6D3A1A;
  --gold:        #F5A623;
  --gold-dark:   #C47E0A;
  --tray-bg:     #B06820;
  --tray-rim:    #D4892A;
  --tray-shadow: #7A4510;
  --text-warm:   #5C2C0A;
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--cream);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ──────────── PAGES ──────────── */
.page {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  position: relative;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ──────────── LANDING ──────────── */
#page-landing {
  background: radial-gradient(ellipse at 60% 30%, #FFD8A8 0%, #FFBA6A 40%, #FF9A44 100%);
}

.landing-deco {
  position: absolute;
  font-size: 3.5rem;
  opacity: 0.18;
  user-select: none;
  pointer-events: none;
}

.arum-hero {
  width: 200px;
  height: 200px;
  object-fit: contain;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, 0.6);
  box-shadow:
    0 12px 40px rgba(139, 69, 19, 0.35),
    0 0 0 10px rgba(255, 255, 255, 0.15);
  margin-bottom: 24px;
  animation: floatBob 3.2s ease-in-out infinite;
}

@keyframes floatBob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%       { transform: translateY(-12px) rotate(2deg); }
}

.landing-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  color: #fff;
  text-shadow: 0 3px 12px rgba(90, 30, 0, 0.3);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.landing-sub {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  margin-bottom: 36px;
}

.btn-start {
  background: #fff;
  color: var(--orange);
  border: none;
  padding: 16px 48px;
  border-radius: 60px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.45rem;
  cursor: pointer;
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.18),
    0 2px 0 rgba(255, 255, 255, 0.5) inset;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.5px;
}

.btn-start:hover  { transform: translateY(-3px) scale(1.04); box-shadow: 0 10px 32px rgba(0,0,0,0.22); }
.btn-start:active { transform: scale(0.97); }

/* ──────────── GACHA PAGE ──────────── */
#page-gacha {
  background: linear-gradient(175deg, #FFF2DC 0%, #FFDFA0 100%);
  gap: 0;
  justify-content: flex-start;
  padding-top: 28px;
}

/* ── Nampan ── */
.nampan-wrap {
  width: 100%;
  max-width: 420px;
  margin-bottom: 28px;
}

.nampan-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  color: var(--brown);
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.nampan {
  background: linear-gradient(175deg, #C47820 0%, #9A5A10 100%);
  border-radius: 20px;
  padding: 14px 16px 18px;
  border: 3px solid var(--tray-rim);
  box-shadow: 0 7px 0 var(--tray-shadow), 0 12px 28px rgba(0, 0, 0, 0.2);
  position: relative;
  min-height: 150px;
}

.nampan::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 200, 100, 0.2);
  pointer-events: none;
}

.total-box {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  padding: 8px 16px;
  text-align: center;
  margin-bottom: 12px;
}

.total-lbl {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255, 220, 140, 0.8);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.total-val {
  font-family: 'Fredoka One', cursive;
  font-size: 2.2rem;
  color: #FFE44A;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}

.total-val.bump {
  animation: bump 0.35s ease;
}

@keyframes bump {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.2); }
}

.money-pile {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: flex-end;
  min-height: 60px;
}

.money-note {
  width: 72px;
  height: auto;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transform: rotate(var(--rot, 0deg));
  animation: noteIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes noteIn {
  from { transform: rotate(var(--rot, 0deg)) scale(0) translateY(-10px); opacity: 0; }
  to   { transform: rotate(var(--rot, 0deg)) scale(1) translateY(0);     opacity: 1; }
}

/* ── Pouch area ── */
.pouch-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pouch-img {
  width: 170px;
  height: 170px;
  object-fit: contain;
  cursor: pointer;
  filter: drop-shadow(0 8px 20px rgba(100, 40, 0, 0.35));
  transition: filter 0.2s;
  user-select: none;
  -webkit-user-drag: none;
}

.pouch-img.shake {
  animation: pouchShake 0.5s ease;
}

@keyframes pouchShake {
  0%   { transform: rotate(0)     scale(1);    }
  15%  { transform: rotate(-10deg) scale(1.08); }
  35%  { transform: rotate(10deg)  scale(1.1);  }
  55%  { transform: rotate(-6deg)  scale(1.06); }
  75%  { transform: rotate(6deg)   scale(1.04); }
  100% { transform: rotate(0)     scale(1);    }
}

.pouch-img.done {
  opacity: 0.45;
  cursor: default;
  filter: saturate(0.3) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.hint-text {
  font-family: 'Fredoka One', cursive;
  font-size: 1.15rem;
  color: var(--brown);
  letter-spacing: 0.3px;
}

/* ── Chances dots ── */
.dots-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 2px 6px rgba(255, 112, 67, 0.5);
  transition: all 0.3s;
}

.dot.used {
  background: rgba(0, 0, 0, 0.12);
  box-shadow: none;
  transform: scale(0.75);
}

.dots-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brown);
  opacity: 0.7;
}

/* ── Reveal bubble ── */
.reveal-bubble {
  background: white;
  border-radius: 20px;
  padding: 12px 24px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.reveal-lbl {
  font-size: 0.75rem;
  font-weight: 700;
  color: #aaa;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.reveal-val {
  font-family: 'Fredoka One', cursive;
  font-size: 1.6rem;
  color: var(--orange);
}

/* ── Game over ── */
.gameover-box {
  background: linear-gradient(135deg, #FFE44A, #FFCA28);
  border-radius: 20px;
  padding: 16px 28px;
  text-align: center;
  box-shadow: 0 6px 24px rgba(200, 120, 0, 0.3);
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gameover-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  color: var(--brown);
  margin-bottom: 4px;
}

.gameover-total {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: var(--brown);
  margin-bottom: 10px;
}

.gameover-motivasi {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--brown);
  background: rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  padding: 8px 14px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.btn-reset {
  background: var(--orange);
  color: white;
  border: none;
  padding: 10px 28px;
  border-radius: 40px;
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 4px 12px rgba(255, 112, 67, 0.4);
  transition: transform 0.15s;
}

.btn-reset:hover { transform: scale(1.05); }

/* ── Flying money overlay ── */
#fly-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.fly-note {
  position: absolute;
  width: 90px;
  height: auto;
  border-radius: 5px;
  pointer-events: none;
  will-change: transform, opacity;
}

/* ── Sparkles ── */
.sparkle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  pointer-events: none;
  animation: sparklePop 0.6s ease forwards;
}

@keyframes sparklePop {
  0%   { transform: scale(0);                                            opacity: 1; }
  60%  {                                                                  opacity: 1; }
  100% { transform: scale(2.5) translate(var(--sx, 0), var(--sy, 0));   opacity: 0; }
}