:root {
  --ri-red: #e30613;
  --ri-red-bright: #ff2638;
  --ri-red-deep: #72000a;
  --ri-maroon: #240004;
  --ri-white: #fffdf7;
  --ri-cream: #fff1d5;
  --ri-gold: #ffd21c;
  --ri-gold-deep: #f39a05;
  --ri-ink: #150205;
  --ri-night: #080102;
  --ri-muted: rgba(255,255,255,.68);
  --ri-line: rgba(255,255,255,.14);
}

html { scroll-behavior: smooth; }

body.merdeka-theme {
  background: var(--ri-night) !important;
  color: #fff;
  font-family: 'Inter', sans-serif;
  background-image:
    radial-gradient(circle at 50% -10%, rgba(227,6,19,.32), transparent 34%),
    linear-gradient(180deg, #160003 0%, #080102 42%, #130003 100%) !important;
}

body.merdeka-theme .main-bg {
  background:
    linear-gradient(118deg, transparent 48%, rgba(255,255,255,.018) 49%, rgba(255,255,255,.018) 51%, transparent 52%) 0 0/70px 70px,
    radial-gradient(circle at 13% 22%, rgba(255,38,56,.20), transparent 24%),
    radial-gradient(circle at 88% 62%, rgba(255,210,28,.08), transparent 23%),
    linear-gradient(180deg, #120003, #060102 52%, #120003) !important;
}

body.merdeka-theme .main-bg::before,
body.merdeka-theme .main-bg::after {
  content: '';
  position: absolute;
  width: 460px;
  height: 460px;
  border: 1px solid rgba(255,255,255,.035);
  border-radius: 50%;
  box-shadow: 0 0 0 80px rgba(255,255,255,.012), 0 0 0 160px rgba(255,255,255,.008);
}
body.merdeka-theme .main-bg::before { left: -180px; top: 20%; }
body.merdeka-theme .main-bg::after { right: -230px; top: 55%; }

body.merdeka-theme .brand-watermark,
body.merdeka-theme .scanlines { display: none; }

/* Header festival */
body.merdeka-theme header {
  background: rgba(18,0,3,.88) !important;
  border-color: rgba(255,210,28,.18) !important;
  box-shadow: 0 12px 45px rgba(0,0,0,.38) !important;
}

body.merdeka-theme header::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(227,6,19,.22), transparent 25%, transparent 75%, rgba(227,6,19,.18));
}

body.merdeka-theme header h1 {
  font-family: 'Barlow Condensed', sans-serif !important;
  font-size: 2.15rem !important;
  font-style: italic;
  letter-spacing: -.02em !important;
  text-shadow: 3px 3px 0 #85000a, 0 0 24px rgba(255,38,56,.34) !important;
}

body.merdeka-theme header h1::after {
  content: '45';
  color: var(--ri-gold);
  font-size: .54em;
  margin-left: .35rem;
  vertical-align: top;
}

body.merdeka-theme .festival-nav-bar {
  position: relative;
  min-height: 42px;
  padding-block: .45rem !important;
  background: linear-gradient(90deg, #84000a, #dc0818 28%, #f31a28 50%, #dc0818 72%, #84000a) !important;
  border-color: rgba(255,255,255,.2) !important;
  box-shadow: 0 7px 22px rgba(176,0,15,.26) !important;
}

.nav-label-ri {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: #fff;
  font: 800 .72rem/1 'Inter', sans-serif;
  letter-spacing: .16em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-label-ri i { color: var(--ri-gold); }

body.merdeka-theme #dynamic-nav-icons a { color: rgba(255,255,255,.78); }
body.merdeka-theme #dynamic-nav-icons a:hover { color: var(--ri-gold); }
body.merdeka-theme [class*="text-[#00a2e8]"] { color: #ff5260 !important; }
body.merdeka-theme [class*="border-[#00a2e8]"] { border-color: rgba(255,38,56,.6) !important; }
body.merdeka-theme [class*="bg-[#00a2e8]"] { background-color: var(--ri-red) !important; }
body.merdeka-theme .scroller::-webkit-scrollbar-thumb,
body.merdeka-theme .scroller-x::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--ri-gold), var(--ri-red)); }

/* Jackpot */
body.merdeka-theme .jackpot-wrapper-custom { gap: .15rem; }
body.merdeka-theme .jackpot-label-text {
  color: var(--ri-gold);
  font-size: .66rem;
  letter-spacing: .35em;
}
body.merdeka-theme .jackpot-ticker-custom {
  font-family: 'Barlow Condensed', sans-serif;
  color: #fff !important;
  font-style: italic;
  letter-spacing: .03em;
  text-shadow: 0 2px 0 #7f0009, 0 0 20px rgba(255,210,28,.35);
}
body.merdeka-theme .line-deco { background: linear-gradient(90deg, transparent, var(--ri-gold)); }
body.merdeka-theme .line-deco.right { background: linear-gradient(90deg, var(--ri-gold), transparent); }

.mobile-jackpot-bar { display: none; }

/* Hero ala panggung kemerdekaan */
.independence-hero {
  width: min(1600px, calc(100% - 2rem));
  min-height: 650px;
  margin: 1.25rem auto 0;
  position: relative;
  z-index: 20;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(430px,.78fr) minmax(560px,1.22fr);
  align-items: center;
  border: 1px solid rgba(255,210,28,.38);
  border-radius: 38px 38px 90px 90px;
  isolation: isolate;
  background:
    radial-gradient(circle at 78% 48%, rgba(255,55,43,.52), transparent 32%),
    radial-gradient(circle at 50% 120%, rgba(255,210,28,.23), transparent 38%),
    linear-gradient(135deg, #240004 0%, #71000a 40%, #b00412 70%, #3b0006 100%);
  box-shadow: 0 38px 110px rgba(0,0,0,.7), inset 0 0 0 5px rgba(255,255,255,.035);
}

.independence-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    repeating-conic-gradient(from 196deg at 78% 70%, rgba(255,255,255,.07) 0 6deg, transparent 6deg 16deg),
    radial-gradient(circle at 78% 70%, rgba(255,210,28,.24), transparent 36%);
}

.independence-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(circle at 13% 24%, #ffd21c 0 2px, transparent 3px),
    radial-gradient(circle at 21% 67%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 88% 20%, #ffd21c 0 2px, transparent 3px),
    radial-gradient(circle at 94% 69%, #fff 0 1px, transparent 2px);
  background-size: 74px 74px, 83px 83px, 67px 67px, 91px 91px;
  opacity: .55;
}

.flag-ribbon-ri {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  height: 10px;
  background: linear-gradient(180deg, var(--ri-red) 0 50%, #fff 50% 100%);
  box-shadow: 0 4px 20px rgba(255,255,255,.2);
}

.hero-curtain {
  position: absolute;
  top: 0;
  width: 29%;
  height: 43%;
  z-index: 0;
  opacity: .9;
  background: repeating-linear-gradient(102deg, #4d0006 0 18px, #99000e 18px 48px, #bd0a18 48px 64px);
  filter: drop-shadow(0 12px 14px rgba(0,0,0,.45));
}
.hero-curtain-left { left: -4%; clip-path: polygon(0 0,100% 0,72% 58%,100% 100%,45% 76%,0 100%); }
.hero-curtain-right { right: -4%; transform: scaleX(-1); clip-path: polygon(0 0,100% 0,72% 58%,100% 100%,45% 76%,0 100%); }

.hero-star-ri {
  position: absolute;
  z-index: 0;
  width: 450px;
  aspect-ratio: 1;
  right: 16%;
  top: 20%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,210,28,.12) 0 5deg, transparent 5deg 14deg);
  -webkit-mask: radial-gradient(circle, transparent 0 17%, #000 18% 100%);
  mask: radial-gradient(circle, transparent 0 17%, #000 18% 100%);
  animation: riRotate 34s linear infinite;
}

.hero-copy-ri {
  position: relative;
  z-index: 8;
  padding: 4.75rem 1rem 4.75rem clamp(2rem,5vw,5.25rem);
}

.hero-kicker-ri {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .9rem .55rem .58rem;
  color: #fff;
  border: 1px solid rgba(255,210,28,.44);
  border-radius: 999px;
  background: rgba(16,0,2,.5);
  backdrop-filter: blur(10px);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .17em;
  text-transform: uppercase;
}
.hero-kicker-ri span {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe97d, var(--ri-gold-deep));
  color: #480006;
  font: 900 1rem/1 'Barlow Condensed', sans-serif;
  box-shadow: 0 0 18px rgba(255,210,28,.38);
}

.hero-title-ri {
  max-width: 630px;
  margin-top: 1.3rem;
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(4.2rem,6.5vw,7.4rem);
  font-style: italic;
  font-weight: 900;
  letter-spacing: -.045em;
  line-height: .77;
  text-transform: uppercase;
  text-shadow: 5px 7px 0 rgba(90,0,8,.55), 0 14px 45px rgba(0,0,0,.38);
}
.hero-title-ri span {
  display: block;
  margin-top: .55rem;
  color: var(--ri-gold);
  font-size: .53em;
  letter-spacing: .015em;
  line-height: .95;
  -webkit-text-stroke: 1px rgba(73,0,5,.4);
  text-shadow: 3px 4px 0 #780008, 0 0 30px rgba(255,210,28,.26);
}

.hero-description-ri {
  max-width: 580px;
  margin-top: 1.45rem;
  color: rgba(255,255,255,.83);
  font-size: .96rem;
  line-height: 1.75;
}

.hero-actions-ri { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.55rem; }
.hero-cta-ri,
.hero-link-ri {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  min-height: 48px;
  padding: 0 1.2rem;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}
.hero-cta-ri {
  color: #310004;
  background: linear-gradient(135deg, #fff27b, var(--ri-gold) 48%, #ff9f0a);
  border: 1px solid #fff5a7;
  box-shadow: 0 12px 30px rgba(255,170,0,.25), inset 0 -3px 0 rgba(126,51,0,.22);
}
.hero-link-ri { color: #fff; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.22); }
.hero-cta-ri:hover,
.hero-link-ri:hover { transform: translateY(-3px); }
.hero-cta-ri:hover { box-shadow: 0 16px 38px rgba(255,210,28,.36); }
.hero-link-ri:hover { background: rgba(255,255,255,.12); }

.hero-badges-ri { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.3rem; }
.hero-badges-ri span {
  min-width: 118px;
  padding: .66rem .75rem;
  border-left: 3px solid var(--ri-gold);
  border-radius: 0 10px 10px 0;
  background: rgba(18,0,3,.44);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.hero-badges-ri b { display: block; color: #fff; font: 900 1.08rem/1 'Barlow Condensed', sans-serif; letter-spacing: .04em; }
.hero-badges-ri small { display: block; margin-top: .28rem; color: rgba(255,255,255,.58); font-size: .58rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }

.hero-art-ri {
  position: relative;
  z-index: 4;
  align-self: end;
  min-height: 640px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.hero-art-ri::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 10%;
  width: 82%;
  aspect-ratio: 1.45;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,230,108,.48), rgba(255,48,45,.15) 44%, transparent 70%);
  filter: blur(18px);
}
.hero-art-ri img {
  position: relative;
  width: min(980px,120%);
  max-width: none;
  transform: translate(1%,3%);
  filter: saturate(1.08) contrast(1.04) drop-shadow(0 24px 30px rgba(0,0,0,.45));
}
.hero-art-ri picture { display:contents; }
.hero-art-caption {
  position: absolute;
  z-index: 5;
  right: 5%;
  bottom: 8%;
  padding: .62rem .85rem;
  border-radius: 10px;
  color: #fff;
  background: rgba(25,0,3,.76);
  border: 1px solid rgba(255,210,28,.35);
  backdrop-filter: blur(8px);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.hero-art-caption i { color: var(--ri-gold); margin-right: .35rem; }
.hero-bottom-wave {
  position: absolute;
  z-index: 7;
  left: -2%;
  right: -2%;
  bottom: -48px;
  height: 102px;
  border-radius: 50% 50% 0 0;
  background: #090102;
  box-shadow: 0 -5px 0 rgba(255,255,255,.9), 0 -10px 0 var(--ri-red);
}

.event-marquee-ri {
  width: min(1500px,calc(100% - 3rem));
  margin: -1px auto 0;
  overflow: hidden;
  position: relative;
  z-index: 22;
  border: 1px solid rgba(255,210,28,.45);
  border-top: 0;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(90deg,#c50614,#f21a29,#c50614);
  box-shadow: 0 14px 30px rgba(0,0,0,.35);
}
.event-marquee-ri > div {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  color: #fff;
  font: 800 .7rem/1 'Inter',sans-serif;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.event-marquee-ri i { color: var(--ri-gold); font-style: normal; }

.legacy-banner-ri { display: none !important; }

/* Main event layout */
body.merdeka-theme main {
  padding-top: 3.2rem !important;
  gap: 2rem !important;
}

.draw-heading-ri { scroll-margin-top: 140px; }
.draw-heading-ri h2 {
  font-family: 'Barlow Condensed', sans-serif !important;
  font-style: italic;
  letter-spacing: .02em !important;
  color: #fff !important;
  background: none !important;
  -webkit-text-fill-color: initial !important;
  text-shadow: 4px 5px 0 #790008, 0 0 26px rgba(255,38,56,.3) !important;
}
.draw-subtitle-ri {
  color: rgba(255,255,255,.52);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-align: center;
}

body.merdeka-theme #left-column,
body.merdeka-theme #right-column { gap: 1.25rem; }

body.merdeka-theme #left-column::before {
  content: '';
  position: absolute;
  inset: 7rem -.65rem 0;
  z-index: -1;
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(112,0,10,.26), rgba(20,0,3,.15));
  border: 1px solid rgba(255,255,255,.07);
}

body.merdeka-theme #left-column > .w-full.max-w-\[95\%\] { border-color: rgba(255,210,28,.42) !important; }
body.merdeka-theme #next-grand-prize { font-family: 'Barlow Condensed',sans-serif !important; font-style: italic; }

body.merdeka-theme .slot-backdrop-aura {
  width: min(760px,90vw);
  height: min(760px,90vw);
  background:
    repeating-conic-gradient(from 0deg, rgba(255,210,28,.10) 0 5deg, transparent 5deg 15deg),
    radial-gradient(circle, rgba(227,6,19,.32), transparent 65%) !important;
}

body.merdeka-theme .cabinet-container {
  background: linear-gradient(180deg,#87000c 0%,#3c0006 25%,#110002 72%,#4f0007 100%) !important;
  border-radius: 74px 74px 22px 22px !important;
  box-shadow:
    0 28px 70px rgba(0,0,0,.65),
    0 0 0 8px rgba(255,255,255,.035),
    inset 0 12px 35px rgba(255,89,89,.24),
    inset 0 -12px 30px rgba(0,0,0,.55) !important;
}
body.merdeka-theme .cabinet-container::before {
  background: linear-gradient(160deg,#fff7a1 0%,#ffd21c 20%,#f20d20 45%,#fff 52%,#9f000c 74%,#ffcf16 100%) !important;
  box-shadow: 0 0 32px rgba(227,6,19,.58) !important;
}
body.merdeka-theme .cabinet-container::after {
  content: 'MERDEKA • KANGTOTO • 17 AGUSTUS';
  position: absolute;
  left: 50%;
  top: 1.1rem;
  transform: translateX(-50%);
  width: max-content;
  color: rgba(255,255,255,.65);
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .22em;
}
body.merdeka-theme .slot-glass-panel {
  background: linear-gradient(180deg,#130003,#020000 50%,#180003) !important;
  border-color: var(--ri-gold) !important;
  box-shadow: 0 0 24px rgba(255,210,28,.32), inset 0 36px 38px -26px #000, inset 0 -36px 38px -26px #000 !important;
}
body.merdeka-theme .slot-reel { background: linear-gradient(180deg,#050000,#460006 24%,#92000d 50%,#460006 76%,#050000) !important; }
body.merdeka-theme .slot-item {
  color: #fff !important;
  -webkit-text-stroke: 2px #a3000d !important;
  text-shadow: 0 2px 0 #650008, 0 0 12px #fff, 0 0 28px var(--ri-red) !important;
}

body.merdeka-theme .info-card-custom {
  background: linear-gradient(145deg,rgba(80,0,8,.92),rgba(14,0,2,.94)) !important;
  border-color: rgba(255,210,28,.24) !important;
  box-shadow: 0 12px 25px rgba(0,0,0,.28) !important;
}
body.merdeka-theme .info-label-custom { color: rgba(255,255,255,.58) !important; border-color: rgba(255,210,28,.3) !important; }
body.merdeka-theme .info-value-gold { color: var(--ri-gold) !important; }

/* Right-side leaderboard */
.event-strip-ri {
  position: relative;
  overflow: hidden;
  min-height: 125px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.4rem;
  color: #150205;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 24px;
  background: linear-gradient(135deg,#fff,#fff0ed 70%,#ffd7d2);
  box-shadow: 0 18px 44px rgba(0,0,0,.38);
}
.event-strip-ri::after {
  content: '45';
  position: absolute;
  right: .8rem;
  bottom: -2rem;
  color: rgba(227,6,19,.07);
  font: italic 900 8rem/1 'Barlow Condensed',sans-serif;
}
.event-strip-icon-ri {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: var(--ri-gold);
  font-size: 1.65rem;
  background: linear-gradient(145deg,#e91727,#9d000c);
  box-shadow: 0 12px 28px rgba(173,0,13,.28), inset 0 0 0 1px rgba(255,255,255,.24);
}
.event-strip-ri small { display:block; color:var(--ri-red); font-size:.61rem; font-weight:900; letter-spacing:.18em; text-transform:uppercase; }
.event-strip-ri strong { display:block; margin-top:.33rem; color:#1b0305; font:italic 900 clamp(1.5rem,2.4vw,2.2rem)/1 'Barlow Condensed',sans-serif; text-transform:uppercase; }
.event-strip-ri p { margin-top:.45rem; color:rgba(21,2,5,.58); font-size:.73rem; }

body.merdeka-theme #stats-container > div {
  min-height: 112px !important;
  border-radius: 22px !important;
  border-color: rgba(255,210,28,.28) !important;
  background: linear-gradient(120deg,#8b000c,#e30b1b 70%,#8b000c) !important;
  box-shadow: 0 14px 32px rgba(0,0,0,.33) !important;
}
body.merdeka-theme #stats-container > div::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(125deg,transparent 0 30px,rgba(255,255,255,.035) 30px 60px);
  pointer-events: none;
}
body.merdeka-theme #stats-container h4 { font-family:'Barlow Condensed',sans-serif; font-style:italic; }

body.merdeka-theme #hof-container { border-radius: 26px !important; box-shadow: 0 24px 60px rgba(0,0,0,.56) !important; }
body.merdeka-theme #hof-container > div:first-child {
  min-height: 82px;
  padding-inline: 1.45rem !important;
  border-radius: 26px 26px 0 0 !important;
  border-color: rgba(255,210,28,.25) !important;
  background: linear-gradient(100deg,#740009,#e10b1a 60%,#8e000b) !important;
}
body.merdeka-theme #hof-container > div:first-child h3 { font-family:'Barlow Condensed',sans-serif !important; font-style:italic; font-size:1.65rem !important; }
body.merdeka-theme #hof-container > div:last-child {
  border-radius: 0 0 26px 26px !important;
  border-color: rgba(255,255,255,.22) !important;
  background: #fffaf7 !important;
  box-shadow: inset 0 20px 40px rgba(96,0,7,.07) !important;
}
body.merdeka-theme #history-placeholder { color: rgba(157,0,12,.28) !important; }
body.merdeka-theme #history-container { background: linear-gradient(180deg,#fffaf7,#fff); }
body.merdeka-theme #history-container > div {
  border-color: rgba(150,0,11,.16) !important;
  background: #fff !important;
  box-shadow: 0 8px 18px rgba(76,0,6,.08) !important;
}
body.merdeka-theme #history-container > div:hover { border-color: rgba(227,6,19,.5) !important; transform:translateY(-2px) !important; }
body.merdeka-theme #history-container > div > div:nth-child(2) > div { color: #240004 !important; }
body.merdeka-theme #history-container > div > div:nth-child(3) > div:first-child { color: #b0000e !important; }
body.merdeka-theme #history-container > div > div:nth-child(3) > div:last-child { background:#fff0ec !important; border-color:rgba(227,6,19,.14) !important; }
body.merdeka-theme #history-container > div > div:nth-child(3) > div:last-child span { color:#6d3238 !important; }

/* Floating actions and ticker */
body.merdeka-theme .fixed.bottom-16.right-4 > * {
  background: rgba(65,0,6,.9) !important;
  border-color: rgba(255,210,28,.4) !important;
  color: #fff !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.38) !important;
}
body.merdeka-theme .fixed.bottom-16.right-4 > *:hover { background: var(--ri-red) !important; color:#fff !important; }
body.merdeka-theme .fixed.bottom-0.left-0 {
  background: linear-gradient(90deg,#3a0005,#9a000c 20%,#550007 80%,#270003) !important;
  border-color: rgba(255,210,28,.38) !important;
}

body.merdeka-theme #modal-screenshot-content,
body.merdeka-theme #modal-prize-content { border-color: var(--ri-red) !important; background: linear-gradient(155deg,#2a0004,#080102) !important; }
body.merdeka-theme #modal-auth-content > div { border-color: rgba(255,210,28,.32) !important; }

/* Winner history page */
body.merdeka-history {
  background:
    radial-gradient(circle at 50% -8%,rgba(227,6,19,.4),transparent 30%),
    linear-gradient(180deg,#260004 0,#080102 38%,#120003 100%) !important;
  font-family:'Inter',sans-serif;
}
.merdeka-history .bg-mesh {
  background:
    repeating-linear-gradient(120deg,transparent 0 70px,rgba(255,255,255,.015) 70px 72px),
    radial-gradient(circle at 12% 10%,rgba(255,38,56,.22),transparent 25%),
    radial-gradient(circle at 90% 38%,rgba(255,210,28,.08),transparent 22%),
    #090102 !important;
}
.merdeka-history .bg-mesh::after {
  content:'';
  position:fixed;
  inset:auto 50% 0 auto;
  transform:translateX(50%);
  width:min(1100px,100vw);
  aspect-ratio:16/9;
  background:url('images/merdeka-kangtoto.gif') center bottom/contain no-repeat;
  opacity:.055;
  pointer-events:none;
}
.merdeka-history .bg-grid {
  background-image:linear-gradient(to right,rgba(227,6,19,.12) 1px,transparent 1px),linear-gradient(to bottom,rgba(255,255,255,.045) 1px,transparent 1px) !important;
  opacity:.26 !important;
}
.merdeka-history main { max-width: 1120px !important; }
.merdeka-history main::before {
  content:'';
  position:fixed;
  left:0; right:0; top:0;
  height:8px;
  z-index:100;
  background:linear-gradient(180deg,var(--ri-red) 0 50%,#fff 50%);
  box-shadow:0 4px 16px rgba(227,6,19,.3);
}
.merdeka-history header {
  margin-top:1rem;
  padding:1.35rem 1.5rem !important;
  border:1px solid rgba(255,210,28,.25);
  border-radius:24px;
  background:linear-gradient(115deg,rgba(89,0,8,.94),rgba(226,8,25,.8),rgba(75,0,7,.94));
  box-shadow:0 18px 45px rgba(0,0,0,.38);
}
.merdeka-history header h1 {
  font-family:'Barlow Condensed','Montserrat',sans-serif !important;
  font-style:italic;
  font-size:clamp(1.9rem,5vw,3.25rem) !important;
  letter-spacing:.03em !important;
  text-shadow:3px 4px 0 #750008;
}
.merdeka-history [class*="text-brand-blue"] { color:#ffd21c !important; }
.merdeka-history [class*="border-brand-blue"] { border-color:rgba(255,210,28,.48) !important; }
.merdeka-history [class*="bg-brand-blue"] { background-color:var(--ri-red) !important; }
.history-event-label {
  display:inline-flex;
  align-items:center;
  gap:.45rem;
  margin-top:.45rem;
  padding:.36rem .72rem;
  border-radius:999px;
  color:#fff7bd;
  border:1px solid rgba(255,210,28,.35);
  background:rgba(35,0,3,.44);
  font-size:.58rem;
  font-weight:900;
  letter-spacing:.14em;
  text-transform:uppercase;
}
.merdeka-history .search-panel {
  background:rgba(255,250,247,.98) !important;
  border-color:rgba(255,255,255,.8) !important;
  box-shadow:0 18px 42px rgba(0,0,0,.42) !important;
}
.merdeka-history .search-panel > div { background:#fff2ef !important; border-color:rgba(160,0,12,.12) !important; }
.merdeka-history .search-panel input { color:#270004 !important; }
.merdeka-history .search-panel input::placeholder { color:#9f777a !important; }
.merdeka-history .podium-card > div:last-child { border-color:rgba(255,210,28,.28) !important; box-shadow:0 20px 46px rgba(0,0,0,.38) !important; }
.merdeka-history .stagger-item {
  background:linear-gradient(100deg,#fff,#fff5f1) !important;
  border-color:rgba(227,6,19,.16) !important;
  box-shadow:0 10px 24px rgba(0,0,0,.2) !important;
}
.merdeka-history .stagger-item:hover { border-color:rgba(227,6,19,.55) !important; transform:translateY(-3px); }
.merdeka-history .stagger-item .text-slate-100,
.merdeka-history .stagger-item .text-white { color:#230003 !important; }
.merdeka-history .stagger-item .text-slate-400 { color:#7c5559 !important; }
.merdeka-history .stagger-item [class*="text-brand-blue"] { color:#bd0010 !important; }
.merdeka-history .stagger-item [class*="bg-[#030712]"] { background:#fff0ec !important; }
.merdeka-history .stagger-item [class*="text-slate-500"] { color:#815e61 !important; }

@keyframes riRotate { to { transform:rotate(360deg); } }

@media (max-width:1279px) {
  .independence-hero { grid-template-columns:minmax(380px,.85fr) minmax(500px,1.15fr); min-height:580px; }
  .hero-art-ri { min-height:570px; }
  .hero-title-ri { font-size:clamp(3.8rem,6.3vw,6.4rem); }
  .nav-label-ri { display:none; }
}

@media (max-width:1023px) {
  body.merdeka-theme .festival-nav-bar {
    display:grid !important;
    grid-template-columns:28px minmax(0,1fr) 28px;
    grid-template-rows:auto auto;
    gap:.36rem .5rem;
    min-height:94px;
    padding:.48rem .7rem .52rem !important;
  }
  .mobile-jackpot-bar {
    grid-column:2;
    grid-row:1;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:.18rem;
    min-width:0;
    min-height:55px;
    padding:.38rem clamp(.55rem,3vw,1.1rem) .42rem;
    color:#fff;
    white-space:nowrap;
    overflow:hidden;
    border:1px solid rgba(255,210,28,.48);
    border-radius:12px;
    background:
      radial-gradient(circle at 50% 0,rgba(227,6,19,.28),transparent 65%),
      linear-gradient(180deg,rgba(42,0,5,.94),rgba(8,0,1,.96));
    box-shadow:
      inset 0 0 0 1px rgba(255,255,255,.06),
      inset 0 -12px 24px rgba(0,0,0,.2),
      0 4px 12px rgba(69,0,6,.34);
  }
  .mobile-jackpot-heading {
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:.52rem;
  }
  .mobile-jackpot-line {
    width:clamp(24px,8vw,58px);
    height:1px;
    flex:0 1 58px;
    background:linear-gradient(90deg,transparent,var(--ri-gold));
    opacity:.92;
  }
  .mobile-jackpot-line-right {
    background:linear-gradient(90deg,var(--ri-gold),transparent);
  }
  .mobile-jackpot-label {
    color:var(--ri-gold);
    font:900 .54rem/1 'Inter',sans-serif;
    letter-spacing:.27em;
    text-transform:uppercase;
    text-shadow:0 1px 8px rgba(63,0,5,.8);
  }
  .mobile-jackpot-value {
    display:block;
    font:900 italic 1.58rem/1 'Barlow Condensed',sans-serif;
    letter-spacing:.025em;
    text-shadow:0 2px 0 #760008,0 0 14px rgba(255,210,28,.3);
  }
  .festival-nav-bar .nav-arrow {
    grid-row:1;
    align-self:center;
    justify-self:center;
    font-size:.9rem;
    filter:drop-shadow(0 2px 4px rgba(0,0,0,.45));
  }
  .festival-nav-bar .nav-arrow-left { grid-column:1; }
  .festival-nav-bar .nav-arrow-right { grid-column:3; }
  body.merdeka-theme #dynamic-nav-icons {
    grid-column:1 / -1;
    grid-row:2;
    width:100%;
    min-height:24px;
    gap:1.15rem !important;
    padding:.15rem .3rem 0 !important;
    justify-content:center !important;
    font-size:.82rem !important;
    scrollbar-width:none;
  }
  body.merdeka-theme #dynamic-nav-icons::-webkit-scrollbar { display:none; }
  .independence-hero { grid-template-columns:1fr; min-height:0; border-radius:28px 28px 68px 68px; }
  .hero-copy-ri { padding:4.25rem 2rem 1rem; text-align:center; }
  .hero-title-ri { max-width:760px; margin-inline:auto; }
  .hero-description-ri { margin-inline:auto; }
  .hero-kicker-ri { margin-inline:auto; }
  .hero-actions-ri,
  .hero-badges-ri { justify-content:center; }
  .hero-art-ri { min-height:430px; }
  .hero-art-ri img { width:min(920px,105%); }
  .hero-art-caption { right:8%; }
  body.merdeka-theme main { padding-top:2.5rem !important; }
}

@media (max-width:640px) {
  body.merdeka-theme {
    background-color:#160003 !important;
    background-image:none !important;
    isolation:isolate;
  }
  body.merdeka-theme::before {
    content:'';
    position:fixed;
    inset:0;
    z-index:-1;
    pointer-events:none;
    background-image:
      linear-gradient(180deg,rgba(33,0,4,.34),rgba(13,0,2,.5)),
      url('images/background-mobile-kemerdekaan.jpg');
    background-position:center top;
    background-size:100% 100%;
    background-repeat:no-repeat;
    box-shadow:inset 0 0 55px rgba(72,0,7,.36);
  }
  body.merdeka-theme .main-bg {
    display:none !important;
  }
  body.merdeka-theme header > div:first-child { height:68px !important; }
  body.merdeka-theme header h1 { font-size:1.7rem !important; }
  body.merdeka-theme .festival-nav-bar {
    min-height:92px;
    grid-template-columns:22px minmax(0,1fr) 22px;
    grid-template-rows:57px 20px;
    padding:.4rem .34rem .42rem !important;
  }
  .mobile-jackpot-bar {
    gap:.13rem;
    min-height:55px;
    padding:.34rem .45rem .38rem;
    border-radius:10px;
  }
  .mobile-jackpot-heading { gap:.38rem; }
  .mobile-jackpot-label { font-size:.5rem; letter-spacing:.2em; }
  .mobile-jackpot-value { font-size:1.48rem; }
  body.merdeka-theme #dynamic-nav-icons {
    gap:1.28rem !important;
    justify-content:flex-start !important;
    font-size:.76rem !important;
  }
  .independence-hero { width:calc(100% - .8rem); margin-top:.55rem; border-radius:22px 22px 48px 48px; }
  .hero-curtain { width:46%; height:26%; opacity:.62; }
  .hero-copy-ri { padding:3rem 1rem .5rem; }
  .hero-kicker-ri { font-size:.58rem; letter-spacing:.11em; }
  .hero-kicker-ri span { width:30px; height:30px; }
  .hero-title-ri { font-size:clamp(3.2rem,18vw,4.75rem); line-height:.79; }
  .hero-title-ri span { font-size:.47em; }
  .hero-description-ri { font-size:.82rem; line-height:1.65; }
  .hero-actions-ri { flex-direction:column; align-items:stretch; padding-inline:.6rem; }
  .hero-cta-ri,.hero-link-ri { width:100%; }
  .hero-badges-ri { display:grid; grid-template-columns:repeat(3,1fr); gap:.35rem; }
  .hero-badges-ri span { min-width:0; padding:.55rem .42rem; text-align:left; }
  .hero-badges-ri b { font-size:.95rem; }
  .hero-badges-ri small { font-size:.48rem; letter-spacing:.03em; }
  .hero-art-ri { min-height:240px; }
  .hero-art-ri img { width:112%; transform:translateY(4%); }
  .hero-art-caption { display:none; }
  .hero-bottom-wave { bottom:-31px; height:64px; }
  .event-marquee-ri { width:calc(100% - 1.6rem); }
  .event-marquee-ri > div { justify-content:flex-start; width:max-content; padding-inline:1rem; gap:.85rem; font-size:.57rem; animation:marqueeRi 18s linear infinite; }
  body.merdeka-theme main { padding:2rem .55rem 5rem !important; gap:1.5rem !important; }
  .draw-heading-ri h2 { font-size:2.2rem !important; letter-spacing:.02em !important; }
  .draw-subtitle-ri { font-size:.58rem; letter-spacing:.09em; }
  body.merdeka-theme .cabinet-container { border-radius:44px 44px 18px 18px !important; padding:2.35rem .75rem 1.15rem !important; }
  body.merdeka-theme .cabinet-container::after { font-size:.45rem; letter-spacing:.1em; }
  .event-strip-ri { grid-template-columns:54px 1fr; padding:1rem; min-height:105px; }
  .event-strip-icon-ri { width:54px; height:54px; border-radius:16px; }
  .event-strip-ri strong { font-size:1.45rem; }
  .event-strip-ri p { font-size:.63rem; }
  body.merdeka-theme #hof-container > div:first-child h3 { font-size:1.3rem !important; }
  body.merdeka-theme #history-container > div { gap:.55rem !important; padding:.62rem !important; }
  body.merdeka-theme #history-container > div > div:first-child { width:46px !important; height:46px !important; }
  .merdeka-history main { padding-inline:.65rem !important; }
  .merdeka-history header { padding:1rem .75rem !important; border-radius:18px; }
  .merdeka-history header > a { width:38px !important; height:38px !important; }
}

@keyframes marqueeRi { to { transform:translateX(-38%); } }

@media (prefers-reduced-motion:reduce) {
  .hero-star-ri,
  .event-marquee-ri > div { animation:none !important; }
  html { scroll-behavior:auto; }
}

/* Mobile polish: compact jackpot, tidy prize card and winner history */
body.merdeka-theme #history-container > div > div:nth-child(3) > div:first-child {
  color:#ff1233 !important;
  text-shadow:none !important;
  filter:none !important;
}

.merdeka-history .stagger-item [class*="text-brand-blue"] {
  color:#ff1233 !important;
  text-shadow:none !important;
  filter:none !important;
}

@media (max-width:640px) {
  body.merdeka-theme .festival-nav-bar {
    min-height:62px !important;
    grid-template-rows:54px !important;
    gap:0 .3rem !important;
    padding:.24rem .32rem !important;
  }
  body.merdeka-theme .mobile-jackpot-bar {
    min-height:50px !important;
    height:50px;
    padding:.24rem .45rem .28rem !important;
    border-radius:10px !important;
  }
  body.merdeka-theme .mobile-jackpot-value { font-size:1.42rem !important; }
  body.merdeka-theme .mobile-jackpot-label { font-size:.48rem !important; }
  body.merdeka-theme #dynamic-nav-icons { display:none !important; }

  body.merdeka-theme .next-prize-wrap {
    width:calc(100% - .3rem) !important;
    max-width:none !important;
    margin-top:.2rem !important;
    margin-bottom:1rem !important;
  }
  body.merdeka-theme .next-prize-card {
    min-height:140px;
    padding:1rem .8rem 1.1rem !important;
    border-radius:18px !important;
    justify-content:center !important;
  }
  body.merdeka-theme .next-prize-heading {
    margin-bottom:.7rem !important;
  }
  body.merdeka-theme .next-prize-heading-inner {
    width:100%;
    display:grid !important;
    grid-template-columns:20px minmax(0,1fr) 20px;
    align-items:center;
    gap:.4rem !important;
  }
  body.merdeka-theme .next-prize-heading-inner > i {
    justify-self:center;
    font-size:.68rem !important;
  }
  body.merdeka-theme .next-prize-label {
    display:block;
    width:100%;
    padding:0 0 .48rem !important;
    text-align:center;
    white-space:nowrap;
    font-size:.56rem !important;
    letter-spacing:.18em !important;
    line-height:1.15 !important;
  }
  body.merdeka-theme .next-prize-value-wrap {
    min-height:50px;
    margin-top:0 !important;
    padding-inline:.2rem;
  }
  body.merdeka-theme #next-grand-prize {
    max-width:100%;
    font-size:clamp(1.18rem,6vw,1.62rem) !important;
    line-height:1.08 !important;
    letter-spacing:.035em !important;
    overflow-wrap:normal !important;
    word-break:normal !important;
    text-wrap:balance;
  }

  .merdeka-history main {
    padding:.55rem .7rem 0 !important;
  }
  .merdeka-history header {
    display:grid !important;
    grid-template-columns:40px minmax(0,1fr) 40px;
    align-items:center;
    gap:.45rem;
    margin-top:.35rem !important;
    padding:.9rem .7rem 1rem !important;
    border-radius:18px !important;
  }
  .merdeka-history header > a {
    width:38px !important;
    height:38px !important;
  }
  .merdeka-history header > div {
    min-width:0;
  }
  .merdeka-history header h1 {
    font-size:clamp(1.65rem,8vw,2.05rem) !important;
    line-height:.9 !important;
    text-align:center;
  }
  .merdeka-history .history-event-label {
    max-width:100%;
    padding:.32rem .55rem;
    font-size:.48rem;
    letter-spacing:.1em;
    text-align:center;
  }
  .merdeka-history main > .mb-12 {
    top:.45rem !important;
    margin-bottom:2.2rem !important;
  }
  .merdeka-history .search-panel {
    padding:.38rem !important;
    gap:.35rem !important;
    border-radius:16px !important;
  }
  .merdeka-history .search-panel > div {
    height:42px !important;
    padding-inline:.8rem !important;
    border-radius:11px !important;
  }

  .merdeka-history .history-podium-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    align-items:stretch !important;
    gap:.75rem !important;
    margin-bottom:2.5rem !important;
    padding:0 .15rem !important;
  }
  .merdeka-history .history-podium-item {
    width:100%;
    transform:none !important;
    opacity:1 !important;
  }
  .merdeka-history .history-podium-item[data-rank="1"] {
    order:1 !important;
    grid-column:1 / -1;
    width:min(72%,240px);
    justify-self:center;
  }
  .merdeka-history .history-podium-item[data-rank="2"] { order:2 !important; }
  .merdeka-history .history-podium-item[data-rank="3"] { order:3 !important; }
  .merdeka-history .history-podium-item > .relative.mb-3 {
    margin-bottom:.6rem !important;
  }
  .merdeka-history .history-podium-card {
    min-height:142px;
    padding:.85rem .65rem .9rem !important;
    border-radius:14px !important;
    justify-content:flex-start;
  }
  .merdeka-history .history-podium-name {
    font-size:.82rem !important;
    margin-bottom:.38rem !important;
  }
  .merdeka-history .history-podium-coupon {
    margin-bottom:.62rem !important;
    font-size:.56rem !important;
  }
  .merdeka-history .history-podium-prize {
    width:100%;
    font-size:.68rem !important;
    line-height:1.3 !important;
    letter-spacing:.01em !important;
    overflow-wrap:anywhere;
  }

  .merdeka-history .stagger-item {
    display:grid !important;
    grid-template-columns:42px minmax(0,1fr);
    align-items:center !important;
    gap:.25rem .7rem !important;
    min-height:86px;
    padding:.72rem .78rem !important;
    border-radius:13px !important;
  }
  .merdeka-history .stagger-item > div:first-child {
    display:contents !important;
  }
  .merdeka-history .stagger-item > div:first-child > div:first-child {
    grid-column:1;
    grid-row:1 / 3;
    align-self:center;
    width:40px !important;
    height:40px !important;
  }
  .merdeka-history .stagger-item > div:first-child > div:nth-child(2) {
    grid-column:2;
    grid-row:1;
    width:100%;
  }
  .merdeka-history .stagger-item > div:nth-child(2) {
    grid-column:2;
    grid-row:2;
    width:100%;
    align-items:flex-start !important;
    padding-left:0 !important;
  }
  .merdeka-history .stagger-item > div:nth-child(2) > div:first-child {
    width:100%;
    margin:0 0 .35rem !important;
    font-size:.68rem !important;
    line-height:1.28 !important;
    text-align:left !important;
    letter-spacing:.025em !important;
    white-space:normal;
    overflow-wrap:anywhere;
  }
  .merdeka-history .stagger-item > div:nth-child(2) > div:last-child {
    font-size:.5rem !important;
    padding:.18rem .42rem !important;
  }
  .merdeka-history .stagger-item:hover { transform:none !important; }
}

/* Low-end mobile performance mode */
@media (max-width:767px) {
  body.merdeka-theme::before {
    position:fixed !important;
    inset:0 !important;
    width:auto !important;
    height:auto !important;
    min-height:0 !important;
    background-size:100% 100% !important;
    background-position:center top !important;
    background-repeat:no-repeat !important;
    box-shadow:none !important;
  }

  body.merdeka-theme header,
  body.merdeka-theme .festival-nav-bar,
  body.merdeka-theme .legacy-banner-ri,
  body.merdeka-theme .hero-art-caption,
  body.merdeka-theme #hof-container > div:first-child,
  body.merdeka-theme .fixed.bottom-16.right-4 > *,
  body.merdeka-theme .fixed.bottom-0.left-0,
  body.merdeka-theme [class*="backdrop-blur"],
  .merdeka-history .search-panel,
  .merdeka-history .history-podium-card,
  .merdeka-history [class*="backdrop-blur"] {
    -webkit-backdrop-filter:none !important;
    backdrop-filter:none !important;
  }

  body.merdeka-theme .hero-star-ri,
  body.merdeka-theme .hero-curtain,
  body.merdeka-theme .animate-ping,
  body.merdeka-theme .animate-pulse,
  body.merdeka-theme .animate-pulse-slow,
  body.merdeka-theme .animate-spin-slow,
  body.merdeka-theme .animate-neon-flicker,
  body.merdeka-theme .animate-shimmer,
  .merdeka-history .animate-ping,
  .merdeka-history .animate-pulse {
    animation:none !important;
  }

  body.merdeka-theme .hero-star-ri,
  body.merdeka-theme .hero-art-ri::before,
  body.merdeka-theme .slot-backdrop-aura,
  body.merdeka-theme [class*="blur-2xl"],
  body.merdeka-theme [class*="blur-[20px]"] {
    display:none !important;
  }

  body.merdeka-theme .hero-art-ri img {
    filter:none !important;
    will-change:auto !important;
  }
  body.merdeka-theme .independence-hero {
    box-shadow:0 10px 28px rgba(0,0,0,.42) !important;
  }
  body.merdeka-theme .next-prize-card,
  body.merdeka-theme .cabinet-container,
  body.merdeka-theme #hof-container,
  body.merdeka-theme #stats-container > div,
  body.merdeka-theme .info-card-custom,
  body.merdeka-theme .stagger-item {
    box-shadow:0 5px 14px rgba(0,0,0,.28) !important;
  }
  body.merdeka-theme .slot-reel {
    box-shadow:inset 0 18px 20px -18px #000,inset 0 -18px 20px -18px #000 !important;
  }
  body.merdeka-theme .slot-strip {
    will-change:transform;
    contain:layout paint;
  }
  body.merdeka-theme #stats-container,
  body.merdeka-theme #hof-container,
  body.merdeka-theme .legacy-banner-ri,
  body.merdeka-theme .event-strip-ri {
    content-visibility:auto;
    contain-intrinsic-size:320px;
  }

  .merdeka-history .bg-grid,
  .merdeka-history .bg-mesh::after {
    display:none !important;
  }
  .merdeka-history .bg-mesh {
    position:absolute !important;
    height:100svh;
  }
  .merdeka-history .stagger-item {
    animation:none !important;
    opacity:1 !important;
    transform:none !important;
    transition:none !important;
    content-visibility:auto;
    contain-intrinsic-size:86px;
  }
  .merdeka-history .podium-card,
  .merdeka-history .history-podium-card {
    transition:none !important;
  }

  body.page-paused *,
  body.page-paused *::before,
  body.page-paused *::after {
    animation-play-state:paused !important;
  }
}
