@font-face {
  font-family: "Instrument Sans";
  src: url("../Resources/Fonts/instrument-sans-master/fonts/webfonts/InstrumentSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../Resources/Fonts/instrument-sans-master/fonts/webfonts/InstrumentSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../Resources/Fonts/instrument-sans-master/fonts/webfonts/InstrumentSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../Resources/Fonts/instrument-sans-master/fonts/webfonts/InstrumentSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans SemiCondensed";
  src: url("../Resources/Fonts/instrument-sans-master/fonts/webfonts/InstrumentSansSemiCondensed-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans SemiCondensed";
  src: url("../Resources/Fonts/instrument-sans-master/fonts/webfonts/InstrumentSansSemiCondensed-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------------
   GATCHA-KUEH
   Premium night market meets collectible toy culture. Dark, warm,
   a little dramatic. Not childish, not clinical.
------------------------------------------------------------------- */

:root {
  --bg: #150F0A;
  --bg-elevated: #211710;
  --bg-elevated-2: #2A1D14;
  --ink: #F5EEE2;
  --ink-soft: #B8A98F;
  --ink-faint: #8A7A63;

  --coral: #E8604B;
  --coral-dark: #C94A38;
  --marigold: #F2A63B;
  --pandan: #5FAE71;
  --pink: #F0879E;
  --gold: #F5C24B;

  --border: rgba(245, 238, 226, 0.12);
  --border-strong: rgba(245, 238, 226, 0.24);

  --common: #B8A98F;
  --rare: #5FAE71;
  --ultra: #F5C24B;
  --legendary: #B085F5;

  --serif: "Instrument Sans", Roboto, sans-serif;
  --sans: "Instrument Sans", Roboto, sans-serif;
  --signage: "Instrument Sans SemiCondensed", "Instrument Sans", "Roboto Condensed", "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 32px; }
.wrap-narrow { max-width: 560px; }

h1, h2 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.eyebrow {
  display: inline-block;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(245, 194, 75, 0.12);
  border: 1px solid rgba(245, 194, 75, 0.3);
  padding: 6px 14px;
  border-radius: 999px;
  margin: 0 0 16px;
}

p { margin: 0 0 16px; color: var(--ink-soft); }

/* ---------------- HEADER ---------------- */
.site-header { padding: 26px 0; border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.wordmark { font-family: var(--serif); font-size: 24px; font-weight: 600; color: var(--gold); }

/* ---------------- BUTTONS ---------------- */
.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  padding: 15px 30px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary {
  background: var(--coral);
  color: #1A0F0A;
  box-shadow: 0 0 0 1px rgba(232,96,75,0.4), 0 0 24px rgba(232,96,75,0.35);
}
.btn-primary:hover { background: #ED725F; transform: translateY(-2px); }
.btn-primary:active { transform: translateY(1px); }

/* ---------------- MACHINE SECTION ---------------- */
.machine-section {
  position: relative;
  padding: 108px 0 64px;
  text-align: center;
  overflow: hidden;
  background: var(--bg) url("../Resources/images/optimized/batik2.webp") center / cover no-repeat;
}
.machine-section::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #000;
  opacity: 0.8;
  pointer-events: none;
}
.machine-section .wrap { position: relative; z-index: 2; }
.machine-section h1 {
  font-family: var(--signage);
  font-size: 64px;
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  max-width: 760px;
  margin: 0 auto 24px;
  text-shadow: 0 3px 18px rgba(0,0,0,0.55), 0 1px 0 rgba(0,0,0,0.3);
}
.title-subline {
  display: inline-block;
  font-family: var(--signage);
  font-size: 0.62em;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.accent-italic {
  font-style: normal;
  font-weight: 700;
  color: var(--gold);
}
.hero-copy {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-transform: none;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

/* ---------------- MACHINE RIG ---------------- */
.machine-rig {
  display: flex;
  justify-content: center;
  margin: 32px 0 0;
}
.gatcha-cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 0;
  padding: 10px 18px 10px 24px;
  border: 1px solid rgba(245, 194, 75, 0.5);
  border-radius: 999px;
  background: rgba(21, 15, 10, 0.78);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(245, 194, 75, 0.12), 0 8px 24px rgba(0, 0, 0, 0.28);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.gatcha-cta:hover,
.gatcha-cta:focus-visible {
  background: rgba(42, 29, 20, 0.9);
  box-shadow: 0 0 0 1px rgba(245, 194, 75, 0.35), 0 10px 30px rgba(0, 0, 0, 0.38);
  transform: translateY(-2px);
}
.gatcha-cta:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.gatcha-cta:disabled { cursor: default; opacity: 0.6; transform: none; }
.gatcha-cta img { width: 48px; height: 48px; object-fit: contain; display: block; }
.machine-stage {
  position: relative;
  width: 576px;
  height: 864px;
}
.machine-stage.is-shaking { animation: machine-shake 1.6s ease-in-out; }
@keyframes machine-shake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  10% { transform: translateX(-4px) rotate(-1.5deg); }
  20% { transform: translateX(4px) rotate(1.5deg); }
  30% { transform: translateX(-5px) rotate(-2deg); }
  40% { transform: translateX(5px) rotate(2deg); }
  50% { transform: translateX(-4px) rotate(-1.5deg); }
  60% { transform: translateX(4px) rotate(1.5deg); }
  70% { transform: translateX(-3px) rotate(-1deg); }
  80% { transform: translateX(3px) rotate(1deg); }
  90% { transform: translateX(-1px) rotate(0deg); }
}
.machine-illustration { width: 100%; height: 100%; display: block; }
.machine-illustration-svg { width: 100%; height: 100%; display: block; }
.machine-illustration-image { width: 100%; height: 100%; display: block; object-fit: contain; }
.machine-stage.is-stop-motion .capsule-layer { visibility: hidden; }

.stop-motion-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.stop-motion-layer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--glow-size, 180px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 244, 1) 0%, rgba(255, 226, 133, 0.92) 24%, rgba(245, 194, 75, 0.34) 58%, transparent 72%);
  filter: blur(5px);
  opacity: 0;
  transition: opacity 0.2s ease, width 0.2s ease;
}
.stop-motion-layer::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: var(--glow-core-size, 58px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(255, 241, 178, 0.96) 24%, rgba(245, 194, 75, 0.48) 52%, transparent 76%);
  filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, width 0.2s ease;
}
.stop-motion-layer.is-playing { opacity: 1; }
.stop-motion-layer.is-playing::before { opacity: var(--glow-opacity, 0.72); }
.stop-motion-layer.is-playing::after { opacity: var(--glow-core-opacity, 0.58); }
.stop-motion-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
  transform: translate(-50%, -50%) scale(0.8);
  transform-origin: center center;
  opacity: 0;
  transition: opacity 160ms ease-in-out, transform 220ms cubic-bezier(0.22, 0.8, 0.32, 1);
}
.stop-motion-frame.is-visible {
  opacity: 1;
}
@keyframes reveal-glow {
  from { transform: translate(-50%, -50%) scale(0.82); filter: blur(8px); }
  to { transform: translate(-50%, -50%) scale(1.08); filter: blur(14px); }
}
@keyframes reveal-core {
  from { transform: translate(-50%, -50%) scale(0.75); filter: blur(5px); }
  to { transform: translate(-50%, -50%) scale(1.2); filter: blur(2px); }
}

.marquee-bulb { fill: #4A3826; transition: fill 0.15s ease; }
.machine-illustration.is-flashing .marquee-bulb {
  animation: bulb-flash 0.35s ease-in-out infinite alternate;
}
@keyframes bulb-flash {
  0% { fill: #4A3826; }
  100% { fill: var(--gold); filter: drop-shadow(0 0 4px var(--gold)); }
}

/* dispensing window overlay, aligned to the flap drawn in the machine SVG */
.dispense-window {
  position: absolute;
  left: 32%;
  bottom: 7%;
  width: 36%;
  height: 15%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.dispense-hint {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink-faint);
  opacity: 0.6;
}
.dispense-ball {
  position: absolute;
  left: 50%;
  top: 18%;
  width: 72px;
  height: 72px;
  object-fit: contain;
  opacity: 0;
  transform: translate(-50%, -28px) scale(0.82);
  pointer-events: none;
}
.dispense-ball.is-rolling {
  animation: ball-roll-out 480ms ease-out forwards;
}
@keyframes ball-roll-out {
  0% { opacity: 0; transform: translate(-50%, -28px) scale(0.82); }
  18% { opacity: 1; }
  72% { opacity: 1; transform: translate(-50%, 10px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, 24px) scale(0.92); }
}
.dispense-window.is-dropping .dispense-hint { display: none; }
.dispense-window.is-dropping::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: var(--capsule-color, var(--gold));
  box-shadow: 0 0 14px var(--capsule-color, var(--gold));
  animation: capsule-drop 0.9s cubic-bezier(0.3, 1.3, 0.4, 1);
}
@keyframes capsule-drop {
  /* falls into the dispensing window, bounces, then tips out through the chute at the bottom */
  0% { transform: translateY(-150px) scale(0.8); opacity: 0; }
  50% { transform: translateY(0) scale(1); opacity: 1; }
  62% { transform: translateY(-8px) scale(1); opacity: 1; }
  74% { transform: translateY(2px) scale(1); opacity: 1; }
  88% { transform: translateY(14px) scale(0.94); opacity: 1; }
  100% { transform: translateY(46px) scale(0.7); opacity: 0; }
}

/* ---------------- CAPSULE REVEAL LAYER ----------------
   A full layer floating above the machine: a dark vignette dims the
   cabinet, a large capsule rises into the middle of it, cracks open,
   and the kueh pops out — the machine becomes the backdrop for this,
   not the other way around. ---------------------------------------- */
.capsule-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}
.capsule-backdrop {
  position: absolute;
  inset: -6%;
  border-radius: 22px;
  background: radial-gradient(circle at 50% 40%, rgba(21,15,10,0) 0%, rgba(21,15,10,0.55) 58%, rgba(21,15,10,0.82) 100%);
  opacity: 0;
  transition: opacity 0.45s ease;
}
.capsule-layer.is-active .capsule-backdrop { opacity: 1; }

.capsule-reveal {
  --capsule-color: var(--gold);
  --capsule-color-dark: var(--coral-dark);
  position: absolute;
  left: calc(50% - 13px);
  top: calc(68% - 21px);
  width: 92%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(0.14);
  opacity: 0;
  transition: top 0.55s cubic-bezier(0.22, 0.9, 0.32, 1.25), transform 0.55s cubic-bezier(0.22, 0.9, 0.32, 1.25), opacity 0.3s ease;
}
.capsule-reveal.is-risen {
  top: 40%;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.capsule-shadow {
  position: absolute;
  left: 50%;
  bottom: -6%;
  width: 58%;
  height: 12%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.55), transparent 72%);
  filter: blur(2px);
  opacity: 0;
  transition: opacity 0.4s ease 0.15s;
}
.capsule-reveal.is-risen .capsule-shadow { opacity: 1; }

.capsule-ball { position: absolute; inset: 0; perspective: 700px; }
.capsule-half {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.3, 1.4, 0.5, 1), opacity 0.4s ease 0.18s;
}
.capsule-half--top { top: 0; transform-origin: bottom center; }
.capsule-half--bottom { bottom: 0; transform-origin: top center; }
.capsule-half::before {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 200%;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, rgba(255,255,255,0.92), var(--capsule-color) 50%, var(--capsule-color-dark) 100%);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25), 0 14px 30px rgba(0,0,0,0.5);
}
.capsule-half--top::before { top: 0; }
.capsule-half--bottom::before { bottom: 0; }
.capsule-ball.is-opening .capsule-half--top { transform: rotateX(55deg) translateY(-60%); opacity: 0; }
.capsule-ball.is-opening .capsule-half--bottom { transform: rotateX(-55deg) translateY(60%); opacity: 0; }

.capsule-rays {
  position: absolute;
  inset: -45%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,0.4) 0deg 4deg, transparent 4deg 16deg);
  opacity: 0;
  transform: scale(0.3) rotate(0deg);
  pointer-events: none;
}
.capsule-reveal.is-revealed .capsule-rays {
  animation: capsule-rays-spin 3.8s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes capsule-rays-spin {
  0% { opacity: 0; transform: scale(0.3) rotate(0deg); }
  25% { opacity: 0.9; transform: scale(1.4) rotate(60deg); }
  100% { opacity: 0.5; transform: scale(1.6) rotate(320deg); }
}

.capsule-glow {
  position: absolute;
  inset: -35%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--capsule-color) 0%, transparent 70%);
  opacity: 0;
  filter: blur(8px);
  pointer-events: none;
}
.capsule-reveal.is-revealed .capsule-glow { animation: capsule-glow-pulse 1.2s ease-out forwards; }
.capsule-reveal.rarity-ultraRare.is-revealed .capsule-glow { animation-name: capsule-glow-pulse-ultra; }
@keyframes capsule-glow-pulse {
  0% { transform: scale(0.4); opacity: 0; }
  40% { opacity: 0.65; }
  100% { transform: scale(1.3); opacity: 0.4; }
}
@keyframes capsule-glow-pulse-ultra {
  0% { transform: scale(0.4); opacity: 0; }
  40% { opacity: 0.95; }
  100% { transform: scale(1.55); opacity: 0.68; }
}

.capsule-kueh {
  position: absolute;
  inset: 12%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.35) rotate(-6deg);
  overflow: hidden;
  border-radius: 50%;
}
.capsule-kueh svg { width: 100%; height: 100%; filter: drop-shadow(0 14px 22px rgba(0,0,0,0.4)); }
.capsule-reveal.is-revealed .capsule-kueh {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  transition: transform 0.6s cubic-bezier(0.3, 1.7, 0.5, 1) 0.14s, opacity 0.35s ease 0.14s;
}
.capsule-kueh::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,0.6) 50%, transparent 60%);
  transform: translateX(-120%);
  opacity: 0;
  pointer-events: none;
}
.capsule-reveal.is-revealed .capsule-kueh::after {
  animation: capsule-shine 0.9s ease-out 0.4s forwards;
}
@keyframes capsule-shine {
  0% { transform: translateX(-120%); opacity: 0; }
  15% { opacity: 0.9; }
  100% { transform: translateX(120%); opacity: 0; }
}

/* ---------------- TWIST KNOB (the interactive pull control) ---------------- */
/* positioned to sit exactly over the chrome knob drawn in the machine SVG */
.knob-btn {
  position: absolute;
  left: calc(50% - 13px);
  top: calc(68% - 21px);
  width: 167px;
  height: 167px;
  margin: -83.5px 0 0 -83.5px;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
  border: 2px solid transparent;
  background-color: transparent;
  background-image: url("../Resources/images/optimized/Knob.webp");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: center;
  box-shadow: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.15s ease;
}
.knob-btn:hover { box-shadow: 0 0 24px rgba(232,96,75,0.28); }
.knob-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.knob-btn.is-pressed { transform: rotate(20deg); transition: transform 180ms ease-out; }
.knob-label {
  display: none;
}
.knob-btn:disabled { cursor: default; }

.odds-note {
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

/* ---------------- REVEAL ---------------- */
.output { padding: 80px 0 72px; }
.output-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 52px 40px 44px;
  text-align: center;
  overflow: hidden;
}
.output-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../Resources/images/optimized/batik.webp") center / cover;
  opacity: 0.08;
  pointer-events: none;
}
.output-card > * { position: relative; z-index: 1; }
.output-card.rarity-common { box-shadow: 0 0 0 1px rgba(184,169,143,0.25); }
.output-card.rarity-rare { box-shadow: 0 0 0 1px rgba(95,174,113,0.35), 0 0 40px rgba(95,174,113,0.12); }
.output-card.rarity-ultraRare { box-shadow: 0 0 0 1px rgba(245,194,75,0.5), 0 0 70px rgba(245,194,75,0.25); }

.rarity-banner {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 20px;
  border-radius: 999px;
  margin-bottom: 20px;
  animation: banner-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.output-card.rarity-common .rarity-banner {
  background: rgba(184,169,143,0.15); color: var(--common); font-size: 13px;
}
.output-card.rarity-rare .rarity-banner {
  background: rgba(95,174,113,0.18); color: var(--rare); font-size: 14px;
}
.output-card.rarity-ultraRare .rarity-banner {
  background: rgba(245,194,75,0.2); color: var(--ultra); font-size: 16px;
  box-shadow: 0 0 24px rgba(245,194,75,0.4);
}
@keyframes banner-pop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

.output-illustration {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 20px;
}
.kueh-illustration { width: 100%; height: 100%; display: block; }
.kueh-ball-illustration { width: 100%; height: 100%; display: block; object-fit: contain; }

.output-card h2 { font-size: 28px; margin-bottom: 12px; }
.output-meaning { max-width: 440px; margin: 0 auto 28px; font-size: 15px; }

.output-message-block { border-top: 1px solid var(--border); padding-top: 24px; margin-bottom: 28px; }
.output-message-label {
  font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 12px;
}
.output-message {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  max-width: 460px;
  margin: 0 auto;
}

/* ---------------- CONFETTI ---------------- */
.confetti-piece {
  position: absolute;
  top: 50%; left: 50%;
  width: 8px; height: 8px;
  border-radius: 2px;
  pointer-events: none;
  animation: confetti-burst 950ms ease-out forwards;
}
@keyframes confetti-burst {
  0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.6); opacity: 0; }
}

/* full-screen flash for ultra-rare pulls */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--gold);
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  transition: opacity 0.35s ease;
}
body.is-flash::after { opacity: 0.16; transition: opacity 0.05s ease; }

/* ---------------- COLLECTION ---------------- */
.collection-section { padding: 80px 0; }
.collection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}
.collection-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 14px;
  text-align: center;
}
.collection-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../Resources/images/optimized/batik.webp") center / cover;
  opacity: 0.08;
  pointer-events: none;
}
.collection-card > * { position: relative; z-index: 1; }
.collection-card.is-locked { border-style: dashed; opacity: 0.7; }
button.collection-card {
  width: 100%;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
button.collection-card:hover,
button.collection-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}
button.collection-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.collection-card-illustration {
  width: 84px;
  height: 84px;
  margin: 0 auto 12px;
}
.kueh-ball-frame {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}
.kueh-ball-frame.rarity-ultraRare {
  border: 1px solid rgba(245, 194, 75, 0.45);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(245, 194, 75, 0.35), inset 0 0 8px rgba(255, 244, 181, 0.18);
  animation: ultra-ball-border-glow 3.8s ease-in-out infinite;
}
.collection-card-illustration img,
.kueh-ball-illustration {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.kueh-ball-frame.rarity-ultraRare::before {
  content: "";
  position: absolute;
  top: 7%;
  right: 8%;
  z-index: 2;
  width: 15%;
  aspect-ratio: 1;
  background: #fff8d0;
  clip-path: polygon(50% 0%, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0% 50%, 38% 38%);
  filter: drop-shadow(0 0 5px rgba(255, 219, 91, 0.85));
  opacity: 0.5;
  pointer-events: none;
  animation: ultra-ball-sparkle 3.8s ease-in-out infinite;
}
.kueh-ball-frame.rarity-ultraRare::after {
  content: "";
  position: absolute;
  bottom: 16%;
  left: 13%;
  z-index: 3;
  width: 8%;
  aspect-ratio: 1;
  background: #fff8d0;
  clip-path: polygon(50% 0%, 64% 36%, 100% 50%, 64% 64%, 50% 100%, 36% 64%, 0% 50%, 36% 36%);
  filter: drop-shadow(0 0 4px rgba(255, 219, 91, 0.75));
  box-shadow: 18px -13px 0 -2px rgba(255, 248, 208, 0.7), 28px 3px 0 -3px rgba(255, 248, 208, 0.55);
  opacity: 0.32;
  pointer-events: none;
  animation: ultra-ball-sparkle-small 4.6s ease-in-out infinite 1.2s;
}
@keyframes ultra-ball-sparkle {
  0%, 70%, 100% { opacity: 0.18; transform: scale(0.8); }
  78% { opacity: 0.68; transform: scale(1.08); }
  86% { opacity: 0.34; transform: scale(0.94); }
}
@keyframes ultra-ball-sparkle-small {
  0%, 72%, 100% { opacity: 0.12; transform: scale(0.72); }
  80% { opacity: 0.54; transform: scale(1.12); }
  88% { opacity: 0.2; transform: scale(0.88); }
}
@keyframes ultra-ball-border-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(245, 194, 75, 0.28), inset 0 0 8px rgba(255, 244, 181, 0.12); }
  50% { box-shadow: 0 0 18px rgba(245, 194, 75, 0.72), inset 0 0 12px rgba(255, 244, 181, 0.28); }
}
.collection-card-illustration--locked {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 26px;
  color: var(--ink-faint);
  background: var(--bg-elevated-2);
  border-radius: 50%;
}
.collection-card-name { font-size: 13px; font-weight: 500; color: var(--ink); margin: 0 0 10px; }
.collection-count { color: var(--ink-faint); font-weight: 400; }

/* ---------------- SHOP ---------------- */
.shop-section { padding: 80px 0 88px; border-top: 1px solid var(--border); }
.shop-heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.shop-heading-row h2 { margin-bottom: 8px; }
.shop-copy { max-width: 420px; margin-bottom: 0; }
.shop-copy--nowrap { max-width: none; white-space: nowrap; }
.shop-bag-button { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; border: 1px solid var(--border-strong); border-radius: 999px; padding: 10px 14px 10px 18px; background: var(--bg-elevated); color: var(--ink); font: 600 15px var(--sans); cursor: pointer; }
.shop-bag-button:hover { border-color: var(--gold); }
.shop-bag-count { min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--gold); color: var(--bg); font-size: 12px; }
.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 28px; }
.shop-card { display: flex; align-items: center; gap: 14px; width: 100%; min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-elevated); color: var(--ink); text-align: left; font: inherit; cursor: pointer; transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
.shop-card:hover, .shop-card:focus-visible { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 10px 24px rgba(0,0,0,0.3); }
.shop-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.shop-card-image { width: 64px; height: 64px; flex: 0 0 64px; display: block; }
.shop-card-details { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shop-card-details strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.shop-card-details > span { color: var(--gold); font-size: 14px; }
.shop-card-action { margin-left: auto; color: var(--ink-faint); font-size: 12px; white-space: nowrap; }
.shop-empty-state { color: var(--ink-soft); margin: 28px 0 0; }
.shop-product-overlay[hidden] { display: none; }
.shop-product-overlay { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(10, 7, 4, 0); backdrop-filter: blur(0); transition: background 0.25s ease, backdrop-filter 0.25s ease; }
.shop-product-overlay.is-open { background: rgba(10, 7, 4, 0.72); backdrop-filter: blur(4px); }
.shop-product-modal { position: relative; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); width: min(1100px, 100%); height: min(680px, 88vh); overflow: hidden; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: 20px; box-shadow: 0 24px 80px rgba(0,0,0,0.5); transform: scale(0.94) translateY(14px); opacity: 0; transition: transform 0.3s cubic-bezier(0.22, 0.8, 0.32, 1), opacity 0.25s ease; }
.shop-product-overlay.is-open .shop-product-modal { transform: scale(1) translateY(0); opacity: 1; }
.shop-product-close { position: absolute; top: 14px; right: 14px; z-index: 4; width: 36px; height: 36px; border: 1px solid rgba(245,238,226,0.3); border-radius: 50%; background: rgba(21,15,10,0.6); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; }
.shop-product-image { position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--bg-elevated-2) url("../Resources/images/optimized/batik.webp") center / cover; }
.shop-product-image::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.58) 52%, rgba(0,0,0,0.42) 100%); }
.shop-product-image > * { position: relative; z-index: 1; width: min(50%, 331px); height: min(50%, 331px); margin: auto; }
.shop-product-image > .kueh-ball-frame { width: min(50%, 331px); height: min(50%, 331px); margin: auto; }
.shop-product-image .kueh-ball-illustration { width: 100%; height: 100%; object-fit: contain; }
.shop-product-details { min-width: 0; display: grid; grid-template-columns: 1fr; align-content: center; gap: 18px; padding: 28px 24px; background: var(--bg-elevated); }
.shop-product-heading h2 { margin: 6px 0 4px; font-size: 25px; }
.shop-product-heading p { margin: 0; font-size: 13px; line-height: 1.4; }
.shop-product-specs { display: flex; flex-direction: column; gap: 6px; }
.shop-product-specs p { display: flex; flex-direction: column; gap: 2px; margin: 0; font-size: 11px; color: var(--ink-faint); }
.shop-product-specs strong { max-width: none; color: var(--ink-soft); font-weight: 400; }
.shop-product-buy { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.shop-product-price { color: var(--gold); font-size: 20px; }
.shop-product-buy label { display: flex; align-items: center; gap: 8px; color: var(--ink-faint); font-size: 12px; }
.shop-product-buy input { width: 48px; padding: 6px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg-elevated-2); color: var(--ink); font: inherit; text-align: center; }
.shop-product-buy .btn { padding: 10px 16px; font-size: 13px; white-space: nowrap; }
body.shop-product-open { overflow: hidden; }
.shop-tray-overlay[hidden] { display: none; }
.shop-tray-overlay { position: fixed; inset: 0; z-index: 160; background: rgba(10, 7, 4, 0); transition: background 0.25s ease; }
.shop-tray-overlay.is-open { background: rgba(10, 7, 4, 0.62); }
.shop-tray { position: absolute; top: 0; right: 0; display: flex; flex-direction: column; width: min(420px, 100%); height: 100%; padding: 28px; background: var(--bg-elevated); border-left: 1px solid var(--border-strong); transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.22, 0.8, 0.32, 1); }
.shop-tray-overlay.is-open .shop-tray { transform: translateX(0); }
.shop-tray-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.shop-tray-header .eyebrow { margin-bottom: 10px; }
.shop-tray-header h2 { margin: 0; font-size: 28px; }
.shop-tray-close { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 50%; background: var(--bg-elevated-2); color: var(--ink-soft); font-size: 18px; cursor: pointer; }
.shop-tray-items { flex: 1; overflow-y: auto; padding: 20px 0; }
.shop-tray-empty { color: var(--ink-soft); }
.shop-tray-item { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.shop-tray-item-image { width: 64px; height: 64px; }
.shop-tray-item-image img, .shop-tray-item-image svg { width: 100%; height: 100%; display: block; object-fit: contain; }
.shop-tray-item-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.shop-tray-item-info strong { font-size: 14px; }
.shop-tray-item-info span { color: var(--gold); font-size: 13px; }
.shop-quantity { display: inline-flex; align-items: center; gap: 8px; }
.shop-quantity button { width: 25px; height: 25px; border: 1px solid var(--border-strong); border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; }
.shop-quantity button:hover { border-color: var(--gold); color: var(--gold); }
.shop-quantity span { min-width: 14px; text-align: center; font-size: 13px; }
.shop-tray-footer { border-top: 1px solid var(--border); padding-top: 20px; }
.shop-total-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; color: var(--ink-soft); }
.shop-total-row strong { color: var(--ink); font-size: 20px; }
.shop-checkout-button { width: 100%; }
body.shop-tray-open { overflow: hidden; }

/* ---------------- KUEH MAKERS ---------------- */
.makers-section { padding: 80px 0 96px; border-top: 1px solid var(--border); overflow: hidden; }
.makers-heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.makers-heading-row h2 { margin: 0 0 8px; }
.makers-subtitle { margin: 0; color: var(--ink-soft); font-size: 17px; }
.makers-controls { display: flex; gap: 8px; flex: 0 0 auto; }
.makers-control { width: 42px; height: 42px; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--bg-elevated); color: var(--ink); font: 22px/1 var(--sans); cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease; }
.makers-control:hover, .makers-control:focus-visible { border-color: var(--gold); color: var(--gold); transform: translateY(-2px); }
.makers-control:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.makers-carousel { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(300px, 42%); gap: 18px; overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: var(--gold) transparent; padding-bottom: 14px; }
.maker-card { scroll-snap-align: start; min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elevated); }
.maker-card-image { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; filter: saturate(0.78) contrast(1.02); }
.maker-card-body { padding: 18px 18px 20px; }
.maker-card-body h3 { margin: 0 0 8px; color: var(--ink); font: 600 22px/1.1 var(--signage); }
.maker-card-body p { min-height: 48px; margin: 0 0 16px; font-size: 14px; line-height: 1.45; }
.maker-card-body a { color: var(--gold); font-size: 13px; font-weight: 500; text-decoration: none; }
.maker-card-body a:hover { text-decoration: underline; }

.rarity-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}
.rarity-badge--common { background: rgba(184,169,143,0.15); color: var(--common); }
.rarity-badge--rare { background: rgba(95,174,113,0.18); color: var(--rare); }
.rarity-badge--ultraRare { background: rgba(245,194,75,0.2); color: var(--ultra); }
.rarity-badge--legendary { background: rgba(176,133,245,0.18); color: var(--legendary); }

/* ---------------- LEGENDARY (locked, shrouded tier) ---------------- */
.legendary-section { padding: 8px 0 80px; }
.eyebrow--legendary {
  color: var(--legendary);
  background: rgba(176,133,245,0.12);
  border-color: rgba(176,133,245,0.3);
}
.legendary-copy { max-width: 480px; }
.legendary-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-top: 28px;
}
.legendary-card {
  position: relative;
  background: linear-gradient(160deg, var(--bg-elevated), #241832);
  border: 1px solid rgba(176,133,245,0.3);
  border-radius: 16px;
  padding: 18px 12px;
  text-align: center;
  overflow: hidden;
  animation: legendary-pulse 3.2s ease-in-out infinite;
}
.legendary-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(176,133,245,0.16) 50%, transparent 60%);
  transform: translateX(-120%);
  animation: legendary-shimmer 3.6s ease-in-out infinite;
  pointer-events: none;
}
.legendary-card:nth-child(2)::before, .legendary-card:nth-child(2) { animation-delay: 0.4s; }
.legendary-card:nth-child(3)::before, .legendary-card:nth-child(3) { animation-delay: 0.8s; }
.legendary-card:nth-child(4)::before, .legendary-card:nth-child(4) { animation-delay: 1.2s; }
.legendary-card:nth-child(5)::before, .legendary-card:nth-child(5) { animation-delay: 1.6s; }
@keyframes legendary-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(176,133,245,0); }
  50% { box-shadow: 0 0 22px rgba(176,133,245,0.22); }
}
@keyframes legendary-shimmer {
  0%, 15% { transform: translateX(-120%); }
  50%, 100% { transform: translateX(120%); }
}
.legendary-card-icon {
  position: relative;
  width: 72px; height: 72px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 24px;
  color: rgba(176,133,245,0.75);
  background: radial-gradient(circle at 35% 30%, rgba(176,133,245,0.2), rgba(176,133,245,0.04));
  border: 1px dashed rgba(176,133,245,0.4);
}
.legendary-card-label {
  position: relative;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin: 0 0 10px;
}

/* ---------------- KUEH DETAIL MODAL ---------------- */
.kueh-modal-overlay[hidden] { display: none; }
.kueh-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 7, 4, 0);
  backdrop-filter: blur(0px);
  transition: background 0.25s ease, backdrop-filter 0.25s ease;
}
.kueh-modal-overlay.is-open {
  background: rgba(10, 7, 4, 0.72);
  backdrop-filter: blur(4px);
}
body.modal-open { overflow: hidden; }

.kueh-modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 48px 32px 36px;
  text-align: center;
  transform: scale(0.9) translateY(16px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.25s ease;
}
.kueh-modal-overlay.is-open .kueh-modal { transform: scale(1) translateY(0); opacity: 1; }
.kueh-modal-overlay.rarity-common .kueh-modal { box-shadow: 0 0 0 1px rgba(184,169,143,0.25); }
.kueh-modal-overlay.rarity-rare .kueh-modal { box-shadow: 0 0 0 1px rgba(95,174,113,0.35), 0 0 40px rgba(95,174,113,0.12); }
.kueh-modal-overlay.rarity-ultraRare .kueh-modal { box-shadow: 0 0 0 1px rgba(245,194,75,0.5), 0 0 70px rgba(245,194,75,0.25); }

.kueh-modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated-2);
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.kueh-modal-close:hover { background: var(--coral); color: #1A0F0A; }

.kueh-modal-illustration { width: 150px; height: 150px; margin: 0 auto 16px; }
.kueh-modal #kueh-modal-rarity { margin-bottom: 14px; }
.kueh-modal h2 { font-size: 24px; margin-bottom: 10px; }
.kueh-modal-meaning { font-size: 14px; max-width: 400px; margin: 0 auto 28px; }

.kueh-modal-section {
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin-top: 18px;
}
.kueh-modal-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}
.kueh-modal-section p { font-size: 14px; margin-bottom: 0; }
.kueh-modal-facts { margin: 0; padding-left: 18px; }
.kueh-modal-facts li { font-size: 14px; color: var(--ink-soft); margin-bottom: 8px; }
.kueh-modal-facts li:last-child { margin-bottom: 0; }

.kueh-modal-variants { display: flex; flex-direction: column; gap: 12px; }
.kueh-modal-variant {
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.kueh-modal-variant-name { font-size: 13px; font-weight: 600; color: var(--ink); margin: 0 0 4px; }
.kueh-modal-variant-desc { font-size: 13px; color: var(--ink-soft); margin: 0; }

/* ---------------- FOOTER ---------------- */
.site-footer { padding: 40px 0 60px; border-top: 1px solid var(--border); }
.footer-inner p { font-size: 13px; color: var(--ink-faint); margin: 0 0 4px; }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  .machine-section { padding: 64px 0 40px; }
  .machine-section h1 { font-size: 42px; }
  .hero-copy { font-size: 15px; letter-spacing: 0.01em; }
  .machine-stage { width: min(480px, calc(100vw - 40px)); height: auto; aspect-ratio: 2 / 3; }
  .knob-btn {
    width: 141px;
    height: 141px;
    margin: -70.5px 0 0 -70.5px;
    background-size: 100% 100%;
    background-position: center;
  }
  .output-card { padding: 40px 22px 32px; }
  .output-illustration { width: 130px; height: 130px; }
  .collection-grid { grid-template-columns: repeat(2, 1fr); }
  .shop-heading-row { align-items: flex-start; flex-direction: column; }
  .shop-grid { grid-template-columns: 1fr; }
  .shop-copy--nowrap { white-space: normal; }
  .shop-product-overlay { padding: 12px; }
  .shop-product-modal { width: 100%; height: min(720px, 92vh); grid-template-columns: 1fr; grid-template-rows: 3fr 1fr; border-radius: 14px; }
  .shop-product-image > * { width: 70%; height: 70%; }
  .shop-product-details { grid-template-columns: 1fr auto; gap: 12px; padding: 16px; }
  .shop-product-specs { display: none; }
  .shop-product-buy { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .makers-section { padding-top: 24px; }
  .makers-heading-row { align-items: flex-start; flex-direction: column; }
  .makers-controls { align-self: flex-end; }
  .makers-carousel { grid-auto-columns: 86%; }
  .legendary-grid { grid-template-columns: repeat(2, 1fr); }
  .kueh-modal { padding: 40px 22px 28px; max-height: 92vh; }
  .kueh-modal-illustration { width: 120px; height: 120px; }
}
