/* ============================================================
   SPASIAL - Clash of Champhion (PKSE UNJA)
   style.css
   ============================================================ */

:root {
  --p: #2458D3;
  --e: #347BFF;
  --pale: #F3F7FF;
  --w: #fff;
  --navy: #17356F;
  --bg: #F3F7FF;
  --fg: #17356F;
  --card: #fff;
  --mut: #5b6f9a;
  --line: #d5e0f7;
}
@media (prefers-color-scheme:dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e2148;
    --fg: #eef3ff;
    --card: #17356F;
    --mut: #a9bde8;
    --line: #2b4a8f;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Sembunyikan scrollbar visual tapi tetap bisa scroll */
::-webkit-scrollbar {
  display: none;
}
html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
button {
  font: inherit;
  cursor: pointer;
  border: 0;
}
.view {
  display: none;
  min-height: 100vh;
  padding: 24px 20px 60px;
}
.view.on {
  display: block;
  animation: in .7s ease both;
}
@keyframes in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.btn {
  background: linear-gradient(135deg,var(--e),var(--p));
  color: #fff;
  padding: 14px 30px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .12em;
  box-shadow: 0 10px 30px -8px var(--p);
  transition: transform .3s,box-shadow .3s;
}
.btn:hover {
  transform: translateY(-2px) scale(1.03);
}
.btn.ghost {
  background: transparent;
  color: var(--p);
  border: 1.5px solid var(--p);
  box-shadow: none;
}
.btn.sm {
  padding: 9px 18px;
  letter-spacing: .04em;
  font-size: 14px;
}

/* ===== LANDING (kubus di tengah) ===== */
#landing {
  padding: 0;
  height: 100svh;
  min-height: 100svh;
  overflow: hidden;
  color: #fff;
  background: #071b49 url("BECRAUND.webp") center/cover no-repeat;
}

.brand {
  position: absolute;
  top: clamp(16px, 3vw, 32px);
  left: clamp(16px, 3vw, 40px);
  z-index: 5;
}
.brand h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: .14em;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
}
.brand p {
  margin: 8px 0 0;
  font-size: clamp(.65rem, 1.2vw, .85rem);
  letter-spacing: .12em;
  color: #cfe0ff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .7);
}

.landing-stage {
  height: 100%;
  display: grid;
  place-items: center;
}
.landing-scene {
  position: relative;
  width: min(90vw, 84svh, 720px);
  aspect-ratio: 1;
}
.landing-scene svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;            /* area kosong tidak bisa diklik */
  will-change: transform;          /* satu lapisan GPU supaya mulus */
  transition: transform .7s cubic-bezier(.22, 1, .36, 1);
}

/* Hanya bentuk kubus yang bisa diklik */
.landing-cube,
.landing-cube * { pointer-events: auto; }
.landing-cube { cursor: pointer; outline: none; }

/* Hover / fokus: membesar halus */
.landing-scene:has(.landing-cube:hover) svg,
.landing-scene:has(.landing-cube:focus-visible) svg { transform: scale(1.12); }  /* atur besar zoom */
.landing-scene:has(.landing-cube:active) svg { transform: scale(1.07); }

/* Cahaya hover di lapisan terpisah */
.landing-scene::before {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(90, 170, 255, .55), transparent 65%);
  opacity: 0;
  transition: opacity .7s ease;
}
.landing-scene:has(.landing-cube:hover)::before,
.landing-scene:has(.landing-cube:focus-visible)::before { opacity: 1; }

/* Animasi saat diklik, sebelum masuk ke hub */
.landing-scene.go svg {
  transform: scale(3);
  opacity: 0;
  transition: transform .7s cubic-bezier(.55, 0, .25, 1), opacity .7s ease-in;
}
/* matikan blur saat animasi supaya ringan */
.landing-scene.go svg * { filter: none; }
.landing-scene.go::before { opacity: 0; }


/* NAV */
.nav {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.nav[data-nav] {
  justify-content: space-between;
}
.nav-side {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.nav button {
  background: transparent;
  color: var(--mut);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
}
.nav button.on {
  background: var(--p);
  color: #fff;
}
h2 {
  margin: 0 0 4px;
  font-size: clamp(22px,4vw,32px);
  text-align: center;
}
.sub {
  text-align: center;
  color: var(--mut);
  margin: 0 0 10px;
  font-size: 14px;
}

/* BABAK (3 kartu awal) */
#rounds.view.on, #kategori.view.on {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}
.babak {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2.4vw, 32px);
  width: min(1100px, 100%);
  margin: 0 auto;
  align-items: center;
  padding: 24px 0 12px;
}
.bcard {
  position: relative;
  display: flex;
  aspect-ratio: 4 / 4.2; /* Proporsi melebar dibuat seimbang (tidak terlalu tinggi) */
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  width: 100%;
  max-height: 520px;
  padding: 22px 20px 24px;
  border-radius: 28px;
  color: #fff;
  overflow: hidden;
  background:
    radial-gradient(120% 55% at 50% 0%, rgba(22, 185, 255, .3), transparent 60%),
    linear-gradient(145deg, #003FC5 0%, #0868F7 55%, #087BFF 100%);
  border: 1px solid rgba(22, 185, 255, .5);
  box-shadow:
    0 26px 40px -18px rgba(0, 20, 90, .7),
    0 0 26px rgba(22, 185, 255, .25),
    inset 0 1px 0 rgba(255, 255, 255, .3);
transition: transform 0.2s ease !important;
}
.bcard:hover, .bcard:focus-visible {
  transform: translateY(-8px) scale(1.02);
  box-shadow:
    0 34px 50px -18px rgba(0, 20, 90, .8),
    0 0 44px rgba(22, 185, 255, .45),
    inset 0 1px 0 rgba(255, 255, 255, .4);
  outline: none;
}
.bnum {
  font-weight: 800;
  letter-spacing: .2em;
  color: #7fdcff;
  font-size: 13px;
}
.bcard h3 {
  margin: 0;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.15;
}
.bart {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  border-radius: 20px;
  border: 1.5px dashed rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bart::before {
  content: "GAMBAR";
  color: rgba(255, 255, 255, .5);
  letter-spacing: .2em;
  font-weight: 700;
  font-size: 13px;
}
.bart img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bart.ok { border-style: solid; border-color: rgba(255, 255, 255, .25); }
.bart.ok::before { display: none; }
.bgo {
  background: #fff;
  color: #0645A8;
  font-weight: 700;
  letter-spacing: .12em;
  font-size: 14px;
  padding: 10px 26px;
  border-radius: 999px;
  box-shadow: 0 8px 20px -8px rgba(22, 185, 255, .9);
}
@media (max-width: 820px) {
  .babak { grid-template-columns: 1fr; }
  .bcard { aspect-ratio: auto; height: auto; min-height: 480px; }
  .bart { flex: none; height: 220px; }
}
/* KATEGORI (4 kartu) */
.babak.k4 {
  width: min(1240px, 100%);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1000px) {
  .babak.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .babak.k4 { grid-template-columns: 1fr; }
}
.crumb {
  display: flex;
  justify-content: flex-start;
  margin: -6px 0 6px;
}
.crumb button {
  background: transparent;
  color: var(--mut);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
}
.crumb button:hover { color: var(--fg); }

/* HUB */
#hub.view.on {
  display: flex;
  flex-direction: column;
  height: 100svh;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 24px;
}
#hub #stage {
  flex: 1;
  height: auto;
  min-height: 0;
  max-height: 620px;
}
#stage {
  position: relative;
   height: min(72vh,560px);
  perspective: 1100px;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
  outline: 0;
  margin-top: 10px;
}
#stage:active {
  cursor: grabbing;
}
#stage:focus-visible {
  outline: 2px dashed var(--e);
  outline-offset: 6px;
}
.slot {
  position: absolute;
  left: 50%;
  top: 50%;
   width: min(330px, 72vw);
  height: min(476px, 62svh);
  margin: calc(min(476px, 62svh) / -2) 0 0 calc(min(330px, 72vw) / -2);calc(min(330px,72vw)/-2);calc(min(270px,66vw)/-2);
  transform-style: preserve-3d;
  will-change: transform;
}
.ch {
  --act: 0;                       /* 1 = kartu di tengah, 0 = kartu samping (diatur script.js) */
  width: 100%;
  height: 100%;
  border-radius: 28px;
  color: #fff;
  background:
    radial-gradient(120% 55% at 50% 0%, rgba(22, 185, 255, .16), transparent 60%),
    linear-gradient(145deg, #082B75 0%, #0645A8 100%);
  border: 1px solid rgba(22, 185, 255, calc(.18 + var(--act) * .4));
  box-shadow:
    0 calc(14px + var(--act) * 18px) calc(26px + var(--act) * 20px) -14px rgba(0, 20, 90, calc(.45 + var(--act) * .25)),
    0 0 calc(8px + var(--act) * 26px) rgba(22, 185, 255, calc(.05 + var(--act) * .3)),
    inset 0 1px 0 rgba(255, 255, 255, .08);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
  position: relative;
}
/* Lapisan biru terang: makin ke tengah makin terlihat */
.ch::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(120% 55% at 50% 0%, rgba(22, 185, 255, .35), transparent 60%),
    linear-gradient(145deg, #003FC5 0%, #0868F7 55%, #087BFF 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 0 40px rgba(22, 185, 255, .2);
  opacity: var(--act);
  pointer-events: none;
  z-index: 0;
}
/* Kilau lembut di atas kartu */
.ch:before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #ffffff30, transparent 40%);
  pointer-events: none;
  z-index: 1;
}
.ch > * { position: relative; z-index: 2; }
.ch .code { color: #7fdcff; }
.ch .cat { color: rgba(255, 255, 255, .75); }
.ch svg { filter: drop-shadow(0 8px 14px rgba(22, 185, 255, .3)); }
.ch .btn {
  background: #fff;
  color: #0645A8;
  opacity: calc(.6 + var(--act) * .4);
  box-shadow: 0 8px 20px -8px rgba(22, 185, 255, .9);
}
@media (max-width: 640px) {
  .ch { border-radius: 24px; padding: 16px; }
}
.code {
  font-weight: 800;
  letter-spacing: .2em;
  color: var(--e);
  font-size: 13px;
}
.ch h3 {
  margin: 6px 0 2px;
  font-size: 25px;
}
.cat {
  color: var(--mut);
  font-size: 13px;
}
.ch svg {
  flex: 1;
  width: 100%;
  min-height: 0;
  margin: 8px 0;
}
.dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}
.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .45);
  transition: .3s;
}
.dots i.on {
  background: #fff;
  width: 24px;
  border-radius: 6px;
}
.hint {
  text-align: center;
  color: var(--mut);
  font-size: 12px;
  letter-spacing: .14em;
  margin-top: 12px;
}

/* DETAIL (layar dibagi dua) */
#detail.view { padding: 0; }
#detail .wrap { max-width: none; margin: 0; }
.dsplit {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100svh;
}
.dback {
  position: absolute;
  top: 24px;
  left: clamp(24px, 4vw, 64px);
  z-index: 5;
  background: transparent;
  color: var(--mut);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
}
.dback:hover { color: var(--fg); }
.dleft {
  display: flex;
  flex-direction: column;
  padding: 90px clamp(24px, 4vw, 64px) 40px;
}
.dtext { margin: auto 0; max-width: 520px; }
.dtitle {
  text-align: left;
  font-size: clamp(32px, 4.6vw, 56px);
  line-height: 1.05;
  margin: 8px 0 12px;
}
.dsub {
  color: var(--mut);
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.6;
  margin: 0 0 28px;
}
.dtext h4 {
  margin: 0 0 10px;
  color: var(--e);
  letter-spacing: .14em;
  font-size: 13px;
}
.dtext ul { margin: 0; padding-left: 20px; line-height: 1.8; }
.dright {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: clamp(20px, 3vw, 48px);
  background:
    radial-gradient(90% 60% at 50% 30%, rgba(22, 185, 255, .22), transparent 65%),
    linear-gradient(160deg, #0645A8 0%, #003FC5 55%, #082B75 100%);
  border-left: 1px solid rgba(22, 185, 255, .35);
  box-shadow: inset 0 0 80px rgba(22, 185, 255, .12);
}
.dart {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 300px;
}
.dart > svg, .dart > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 40px rgba(0, 20, 90, .5));
}
.dph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  line-height: 1.7;
  color: #cfe6ff;
  border: 2px dashed rgba(22, 185, 255, .6);
  border-radius: 24px;
}
.dright .btn {
  background: #fff;
  color: #0645A8;
  padding: 16px 44px;
  box-shadow: 0 12px 30px -10px rgba(22, 185, 255, .9);
}
@media (max-width: 820px) {
  .dsplit { grid-template-columns: 1fr; }
  .dright { order: -1; min-height: 70svh; padding-top: 72px; border-left: 0; }
  .dleft { padding: 28px 24px 48px; }
}
.wrap {
  max-width: 860px;
  margin: 0 auto;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  margin-top: 16px;
}
.hero {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr 1fr;
  align-items: center;
}
@media (max-width:640px) {
  .hero {
    grid-template-columns: 1fr;
  }
}
.hero svg {
  width: 100%;
  max-height: 240px;
}
.panel h4 {
  margin: 0 0 8px;
  color: var(--e);
  letter-spacing: .14em;
  font-size: 13px;
}
.panel ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}
.ph {
  border: 2px dashed var(--e);
  border-radius: 14px;
  padding: 12px;
  color: var(--mut);
  font-size: 13px;
  margin-top: 10px;
}
.opts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.opts button {
  background: var(--pale);
  color: var(--navy);
  border: 1.5px solid var(--line);
  padding: 10px 20px;
  border-radius: 14px;
  font-weight: 700;
}
.opts button.ok {
  background: #16a36a;
  color: #fff;
}
.opts button.no {
  background: #d9435a;
  color: #fff;
}
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 18px;
}
.tag {
  display: inline-block;
  background: #ffb02e;
  color: #4a3000;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 99px;
  letter-spacing: .1em;
}

/* LEADERBOARD */
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
th {
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--mut);
}
td.r {
  font-weight: 800;
  color: var(--e);
  width: 48px;
}
td.s {
  text-align: right;
  font-weight: 700;
}
.tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
  flex-wrap: wrap;
}
.tabs button {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--line);
  font-weight: 600;
}
.tabs button.on {
  background: var(--p);
  color: #fff;
}
input, select, textarea {
  font: inherit;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--fg);
  max-width: 100%;
}
.form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.form input[type=text] {
  flex: 2;
  min-width: 150px;
}
.form input[type=number] {
  width: 110px;
}
.scroll {
  overflow-x: auto;
}
.note {
  font-size: 12px;
  color: var(--mut);
  margin-top: 10px;
  line-height: 1.5;
}

/* PRESENT */
#present {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  background: radial-gradient(circle at 50% 30%,#2458D3,#17356F 55%,#081a3d);
  color: #fff;
  text-align: center;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}
#present.on {
  display: flex;
}
.pnum {
  font-size: clamp(90px,24vw,260px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 60px var(--e);
  font-variant-numeric: tabular-nums;
}
.pname {
  font-size: clamp(30px,7vw,84px);
  font-weight: 800;
  opacity: 0;
  transform: scale(.3);
}
.pname.show {
  animation: pop .8s cubic-bezier(.2,1.4,.4,1) both;
}
.pscore {
  font-size: clamp(22px,4vw,46px);
  color: #9cc0ff;
  opacity: 0;
  margin-top: 8px;
}
.pscore.show {
  animation: fadeup .7s both;
}
@keyframes pop {
  0% {
    opacity: 0;
    transform: scale(.3);
    filter: brightness(4);
  }
  100% {
    opacity: 1;
    transform: none;
    filter: none;
  }
}
@keyframes fadeup {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.pctl {
  position: absolute;
  bottom: calc(16px + env(safe-area-inset-bottom,0px));
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  opacity: .9;
}
.pctl .btn {
  background: #ffffff22;
  box-shadow: none;
  border: 1px solid #ffffff55;
}
.pod {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 55vh;
}
.pod div {
  width: min(28vw,220px);
  border-radius: 18px 18px 0 0;
  background: linear-gradient(#5b92ff,#2458D3);
  padding: 14px 6px;
  font-weight: 800;
  font-size: clamp(14px,2.6vw,26px);
  transform-origin: bottom;
  animation: rise 1.1s cubic-bezier(.2,1,.3,1) both;
  box-shadow: 0 0 40px #347BFF88;
}
.pod small {
  display: block;
  font-weight: 600;
  color: #cfe0ff;
  margin-top: 6px;
}
.pod b {
  display: block;
  font-size: 2em;
}
@keyframes rise {
  from {
    transform: scaleY(0);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.all {
  width: min(720px,92vw);
  max-height: 68vh;
  overflow: auto;
  text-align: left;
}
.all table {
  color: #fff;
}
.all td, .all th {
  border-color: #ffffff33;
}
/* ===== PORTAL (animasi masuk arena) ===== */
#portal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #071b49;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .9s ease, visibility 0s .9s;   /* memudar keluar perlahan */
}
#portal.on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .6s ease;                       /* memudar masuk */
}

/* Lingkaran terowongan (digambar di canvas lewat script.js) */
#portalCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* Lingkaran lama (CSS) */
.portal-ring {
  --size: 30vmax;
  position: absolute;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: calc(3px + var(--i) * .6px) solid rgba(90, 160, 255, .95);
   opacity: 0;
    will-change: transform, opacity;
  contain: layout paint;
}

#portal.play .portal-ring {
  animation:
    ringScale 2.2s cubic-bezier(.45, .05, .3, 1) calc(var(--i) * .2s) both,
    ringFade  2.2s linear calc(var(--i) * .2s) both;
}
@keyframes ringScale {
  from { transform: scale(.15) rotate(0deg); }
   to   { transform: scale(4.5) rotate(var(--r)); }
}
@keyframes ringFade {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Cahaya yang mekar dari tengah di akhir */
.portal-core {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, #fff 0%, #dbe9ff 100%);
  opacity: 0;
  will-change: opacity;
}
#portal.play .portal-core { animation: coreBloom 1.3s ease-in 1.4s both; }
@keyframes coreBloom {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion:reduce) {
  * {
    animation-duration: .01s!important;
    animation-delay: 0s!important;
    transition-duration: .01s!important;
  }
}


/* ===== CAROUSEL BABAK (Arena) ===== */
#rounds.view.on {
  height: 100svh;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 24px;
}
.stage3d {
  position: relative;
  flex: 1;
  min-height: 0;
  max-height: 620px;
  perspective: 1100px;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
  outline: 0;
  margin-top: 10px;
}
.stage3d:active { cursor: grabbing; }
.stage3d:focus-visible { outline: 2px dashed var(--e); outline-offset: 6px; }
.stage3d .bcard {
  width: 100%;
  height: auto; /* Tinggi menyesuaikan isi/wadah */
  max-height: 100%;
  aspect-ratio: 4 / 4.5; /* Kunci proporsi kartu agar melebar dan tidak lonjong */
  padding: 20px;
  max-width: 580px; /* Lebar maksimal ditingkatkan agar kartu lebih besar */
  margin: 0 auto;
}
.stage3d .bcard:hover { transform: none; }
.stage3d .bart { 
  flex: 1; 
  height: auto; 
  min-height: 0; /* Mencegah gambar mendorong tinggi kartu */
}
.stage3d .bart img { -webkit-user-drag: none; pointer-events: none; }



/* ===== BACKGROUND HALAMAN ARENA ===== */
#rounds, #penyisihan, #welcome {
  background-color: transparent;
}
#rounds::before, #penyisihan::before, #welcome::before {
  content: ""; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none;
  background: #071b49 url("BGARENA.webp") center/cover no-repeat;
}

/* ===== BACKGROUND ARENA SEMIFINAL ===== */
#semi, #kategori, #hub, #arena, #jenis, #soal {
  background-color: transparent;
}
#semi::before, #kategori::before, #hub::before, #arena::before, #jenis::before, #soal::before {
  content: ""; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none;
  background: #071b49 url("BGMONOPOLI.webp") center/cover no-repeat;
}
.tgrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(14px, 2vw, 26px);
  max-width: 1180px;
  margin: 34px auto 0;
}
.tcard {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  aspect-ratio: 3 / 4.2;
  min-height: 380px;
  padding: 26px;
  border-radius: 30px;
  text-align: left;
  color: #fff;
  background:
    radial-gradient(rgba(255,255,255,.09) 1px, transparent 1.5px) 0 0 / 16px 16px,
    linear-gradient(165deg, #12306f, #0a1c46);
  transition: transform .45s cubic-bezier(.2,.8,.2,1);
  animation: tUp .7s cubic-bezier(.2,.8,.2,1) backwards;
  animation-delay: calc(var(--i) * .09s + .1s);
}
@keyframes tUp {
  from { opacity: 0; transform: translateY(34px); }
}
.tcard:hover { transform: translateY(-10px); }
.tcard:active { transform: translateY(-4px) scale(.98); }

/* garis tepi bergradasi */
.tcard::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(150deg, var(--c1), rgba(255,255,255,.06) 45%, var(--c2));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .55;
  transition: opacity .4s;
  pointer-events: none;
  z-index: 2;
}
.tcard:hover::before { opacity: 1; }

/* cahaya warna di pojok bawah (bukan shadow) */
.tcard::after {
  content: "";
  position: absolute;
  width: 95%;
  aspect-ratio: 1;
  left: -28%;
  bottom: -38%;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c1) 55%, transparent), transparent 65%);
  opacity: .55;
  transition: opacity .5s, transform .8s cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
  z-index: 0;
}
.tcard:hover::after { opacity: 1; transform: translate(14%, -12%) scale(1.15); }

.tcard > * { position: relative; z-index: 1; }

/* angka besar outline */
.tcard > .t-no {
  position: absolute;
  right: 18px;
  top: 6px;
  z-index: 0;
  font-size: clamp(90px, 9vw, 130px);
  font-weight: 900;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255,255,255,.16);
  transition: -webkit-text-stroke-color .4s;
}
.tcard:hover > .t-no { -webkit-text-stroke-color: var(--c1); }

.t-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--c1) 70%, transparent);
  color: var(--c1);
}

/* ikon berlian */
.t-ico {
  width: 76px;
  height: 76px;
  margin: 34px 16px 40px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  transform: rotate(45deg);
  transition: transform .7s cubic-bezier(.2,.8,.2,1);
}
.t-ico > span {
  display: block;
  width: 40px;
  height: 40px;
  transform: rotate(-45deg);
  transition: transform .7s cubic-bezier(.2,.8,.2,1);
}
.t-ico svg { width: 100%; height: 100%; display: block; }
.tcard:hover .t-ico { transform: rotate(135deg); }
.tcard:hover .t-ico > span { transform: rotate(-135deg); }

.tcard h3 {
  margin: 0 0 8px;
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 800;
  letter-spacing: .01em;
}
.tcard p {
  margin: 0 0 22px;
  font-size: 14.5px;
  line-height: 1.55;
  color: rgba(238,243,255,.72);
}
.t-go {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .14em;
  border: 1.5px solid rgba(255,255,255,.3);
  transition: background .4s, border-color .4s;
}
.t-go b { display: inline-block; transition: transform .4s; }
.tcard:hover .t-go {
  background: linear-gradient(135deg, var(--c1), var(--c2));
  border-color: transparent;
}
.tcard:hover .t-go b { transform: translateX(6px); }

@media (max-width: 1000px) {
  .tgrid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .tgrid { grid-template-columns: 1fr; }
  .tcard { min-height: 0; }
  .t-ico { margin: 26px 16px 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .tcard, .tcard::after, .t-ico, .t-ico > span { transition: none; animation: none; }
}


/* ===== WELCOME BABAK PENYISIHAN ===== */
#welcome.view.on {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100svh;
  min-height: 100svh;
  padding: 32px 16px;
  overflow: hidden;
  text-align: center;
  position: relative;
}
.w-top { flex: 1; }
.w-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 1024px;
}
.w-bot {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 40px;
}
.w-back {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 2;
  padding: 8px 16px;
  border-radius: 99px;
  font-weight: 700;
  color: #fff;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.25);
}

#welcome .w-hi {
  margin: 0;
  padding-left: .5em;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(20px, 3.4vw, 36px);
  letter-spacing: .5em;
  text-transform: uppercase;
  color: #fff;
  animation: wDown 1s ease-out backwards;
}
#welcome .w-title {
  margin: 0;
  font-family: 'Orbitron', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(40px, 8vw, 96px);
  line-height: 1.1;
  text-transform: uppercase;
  background: linear-gradient(to bottom, #FFFDE4 0%, #FFD700 40%, #F59E0B 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 15px rgba(255,215,0,.4));
  animation: wPop 1s cubic-bezier(.2,.8,.2,1) .4s backwards;
}

.w-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
}
.w-badge {
  padding: 10px 24px;
  background: rgba(10,20,45,.6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(0,240,255,.4);
  box-shadow: 0 4px 15px rgba(0,240,255,.15), inset 0 0 10px rgba(0,240,255,.05);
  transform: skewX(-10deg);
  animation: wUp .6s cubic-bezier(.2,.8,.2,1) var(--d) backwards;
}
.w-badge.amber {
  border-color: #fbbf24;
  box-shadow: 0 4px 15px rgba(251,191,36,.15), inset 0 0 10px rgba(251,191,36,.05);
}
.w-badge span {
  display: inline-block;
  transform: skewX(10deg);
  font-family: 'Orbitron', system-ui, sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #22d3ee;
}
.w-badge.amber span { color: #fbbf24; }

.w-btn {
  position: relative;
  overflow: hidden;
  padding: 16px 40px;
  background: linear-gradient(135deg, #FBBF24 0%, #D97706 50%, #B45309 100%);
  border: 2px solid #FDE68A;
  box-shadow: 0 0 20px rgba(217,119,6,.6), inset 0 2px 0 rgba(255,255,255,.4);
  transform: skewX(-10deg);
  transition: transform .3s, box-shadow .3s;
  animation: wUp 1s ease-out 1.6s backwards;
  outline: none;
}
.w-btn:hover {
  transform: skewX(-10deg) scale(1.05);
  box-shadow: 0 0 30px rgba(251,191,36,.8), inset 0 2px 0 rgba(255,255,255,.6);
}
.w-btn span {
  position: relative;
  z-index: 1;
  display: inline-block;
  transform: skewX(10deg);
  font-family: 'Orbitron', system-ui, sans-serif;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #111827;
}
.w-sweep {
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,.6), rgba(255,255,255,0));
  transform: skewX(-20deg);
  animation: wSweep 3s infinite cubic-bezier(.4,0,.2,1);
}
@media (min-width: 768px) {
  .w-badges { gap: 24px; }
  .w-badge { padding: 14px 40px; }
  .w-badge span { font-size: 18px; }
  .w-btn { padding: 20px 64px; }
  .w-btn span { font-size: 30px; }
}

@keyframes wDown { from { opacity: 0; transform: translateY(-40px); } }
@keyframes wPop { from { opacity: 0; transform: scale(.85); } 70% { transform: scale(1.02); } }
@keyframes wUp { from { opacity: 0; transform: translateY(30px) skewX(-10deg); } }
@keyframes wSweep { 0% { left: -150%; } 50%, 100% { left: 200%; } }

/* flash putih saat pindah halaman */
#flashLayer {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
#flashLayer.go { animation: wFlash 1.2s ease-out forwards; pointer-events: auto; }
@keyframes wFlash { 0% { opacity: 0; } 30%, 40% { opacity: 1; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  #welcome *, .w-sweep { animation: none !important; }
}


/* ===== BACKGROUND ARENA SEMIFINAL ===== */
#semi, #kategori, #hub, #arena, #jenis, #soal {
  background: #071b49 url("BGMONOPOLI.webp") center/cover no-repeat fixed;
}


@media (prefers-reduced-motion: reduce) {
  #globeIntro.go, #globeIntro.go img { animation: none; }
}




/* ===== INTRO SEMIFINAL: globe + tombol Masuk ===== */
#semi.view.on {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4svh, 40px);
  height: 100svh;
  min-height: 100svh;
  padding: 24px 16px;
  overflow: hidden;
  position: relative;
}
.semi-globe {
  width: auto;
   max-width: min(94vw, 900px);
  max-height: 72svh;
  user-select: none;
  animation:
    sZoom 2.4s cubic-bezier(.16,.84,.3,1) both,
    sFloat 6s ease-in-out 2.4s infinite;
}
.semi-btn { animation-delay: 1.9s; }   /* tombol muncul setelah globe selesai zoom */

@keyframes sZoom {
  0%   { transform: scale(3.6) rotate(-6deg); opacity: 0; filter: blur(10px); }
  25%  { opacity: 1; }
  70%  { filter: blur(0); }
  100% { transform: scale(1) rotate(0); opacity: 1; filter: blur(0); }
}
@keyframes sFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}
@media (prefers-reduced-motion: reduce) {
  .semi-globe { animation: none; }
}

/* ===== SEMIFINAL: tanpa animasi masuk halaman (background langsung tampil) ===== */
#semi.view.on, #kategori.view.on, #hub.view.on, #arena.view.on, #jenis.view.on, #soal.view.on {
  animation: none;
}


/* ===== WELCOME: anti-tabrakan di layar pendek ===== */
#welcome.view.on { padding: 20px 16px 20px; }
.w-top { flex: 1 1 0; }
.w-bot {
  flex: 1 1 0;
  min-height: clamp(70px, 17svh, 140px);   /* ruang khusus untuk tombol */
  align-items: flex-end;
  padding-bottom: 0;
}
.w-mid { gap: clamp(8px, 2svh, 24px); }
#welcome .w-hi    { font-size: clamp(16px, min(3.4vw, 4.4svh), 36px); }
#welcome .w-title { font-size: clamp(32px, min(8vw, 14svh), 96px); }
.w-badges { margin-top: clamp(12px, 3svh, 40px); gap: clamp(10px, 2vw, 24px); }
.w-badge { padding: clamp(6px, 1.6svh, 14px) clamp(18px, 3vw, 40px); }
.w-badge span { font-size: clamp(12px, min(1.4vw, 2.4svh), 18px); }
.w-btn { padding: clamp(10px, 2.4svh, 20px) clamp(36px, 5vw, 64px); }
.w-btn span { font-size: clamp(18px, min(2.4vw, 4svh), 30px); }


/* ===== WELCOME: tombol tepat di bawah badge ===== */
.w-top { flex: .8 1 0; }
.w-bot {
  flex: 1.2 1 0;
  min-height: clamp(60px, 14svh, 110px);
  align-items: flex-start;                 /* tombol menempel ke atas, bukan ke dasar layar */
  padding-top: clamp(16px, 4svh, 40px);    /* jarak antara badge dan tombol */
  padding-bottom: 0;
}


/* ===== GRAND FINAL ===== */
#grand.view.on {
  position: relative;
  height: 100svh;
  min-height: 100svh;
  overflow: hidden;
  animation: none;                       /* langsung tampil, tanpa animasi masuk */
  background: #071b49 url("BGGRAND.webp") center/cover no-repeat fixed;
}


/* ===== GRAND FINAL: 4 KOTAK ===== */
#grand.view.on {
  height: auto;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 72px 16px 40px;
}
#grand h2 { color: #fff; text-align: center; }
#grand .t-sub { color: rgba(255,255,255,.75); }


/* ===== WELCOME versi Grand Final: background beda ===== */
#welcome.is-grand {
  background: #071b49 url("BGGRAND.webp") center/cover no-repeat fixed;
}

/* ===== KATEGORI: kartu memakai gaya .tgrid / .tcard (sama seperti Penyisihan) ===== */
#kategori h2, #jenis h2 { color: #fff; text-align: center; }
#kategori .tgrid, #jenis .tgrid { margin-top: 28px; width: 100%; }
#jenis .t-sub { color: rgba(255,255,255,.75); }

/* ===== LAMAN KATEGORI: tombol MASUK + BATTLE ===== */
#arena.view.on {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 7svh, 64px);
  height: 100svh;
  min-height: 100svh;
  padding: 24px 16px;
  overflow: hidden;
  position: relative;
  text-align: center;
}
.ar-mid { display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 2svh, 20px); }
.ar-sub {
  margin: 0;
  padding-left: .5em;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(14px, min(2.6vw, 3.6svh), 28px);
  letter-spacing: .5em;
  text-transform: uppercase;
  color: #fff;
}
.ar-title {
  margin: 0;
  font-family: 'Orbitron', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(44px, min(11vw, 17svh), 130px);
  line-height: 1;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 40px rgba(52,123,255,.8);
}
.ar-desc {
  margin: 0;
  max-width: 560px;
  color: rgba(238,243,255,.8);
  font-size: clamp(14px, 1.6vw, 18px);
  line-height: 1.5;
}
.ar-btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vw, 36px);
}
.ar-btns .w-btn { animation-delay: .15s; }
.ar-battle {
  background: linear-gradient(135deg, #38bdf8 0%, #2458D3 50%, #17356F 100%);
  border-color: #bfe3ff;
  box-shadow: 0 0 20px rgba(52,123,255,.6), inset 0 2px 0 rgba(255,255,255,.4);
}
.ar-battle:hover {
  box-shadow: 0 0 30px rgba(56,189,248,.8), inset 0 2px 0 rgba(255,255,255,.6);
}
.ar-battle span { color: #fff; }
.ar-toast {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  padding: 10px 20px;
  border-radius: 99px;
  background: rgba(7,27,73,.9);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.ar-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ===== LAYAR SOAL: bingkai penuh dengan bar kecil di atas ===== */
#soal.view.on {
  display: flex;
  flex-direction: column;
  height: 100svh;
  min-height: 100svh;
  padding: 0;
  overflow: hidden;
}
#soalFrame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #050505;
}

/* 6 kartu sejajar (6 kolom x 1 baris) */

/* Opsional: Tetap biarkan responsif untuk layar kecil agar tidak terlalu gepeng di HP */
@media (max-width: 1200px) { #jenis .tgrid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { #jenis .tgrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { #jenis .tgrid { grid-template-columns: 1fr; } }


/* ===== INTRO VIDEO ===== */
#intro {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .5s;
}
#intro.off { opacity: 0; pointer-events: none; }
#introDot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  cursor: pointer;
  animation: introPulse 1.8s infinite;
}
@keyframes introPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,.5); }
  70%  { box-shadow: 0 0 0 22px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
#intro video {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
   object-fit: cover;
  background: #000;
  pointer-events: none;   /* tidak bisa diklik / dipause */
}
#intro.playing video { display: block; }



/* =========================================
   FIX BACKGROUND TERKUNCI PERMANEN
   ========================================= */

/* 1. Paksa scrollbar selalu ada agar lebar layar tidak goyang saat ganti halaman */
html {
  overflow-y: auto !important;
}

/* 2. Jadikan semua halaman transparan agar background tembus ke layar utama */
#landing, #rounds, #penyisihan, #welcome, #semi, #kategori, #hub, #arena, #jenis, #soal, #grand {
  background: transparent !important;
}

/* 3. Kunci settingan background di body (layar utama) */
body {
  background-color: #071b49 !important;
  background-attachment: fixed !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
}

/* -- ATURAN BACKGROUND BERDASARKAN HALAMAN -- */

/* BG LANDING */
body:has(#landing.on) {
  background-image: url("BECRAUND.webp") !important;
}

/* BG ARENA */
body:has(#rounds.on), 
body:has(#penyisihan.on), 
body:has(#welcome:not(.is-grand).on),
body:has(#numerik-intro.on), 
body:has(#numerik-video.on) {
  background-image: url("BGARENA.webp") !important;
}
/* BG MONOPOLI */
body:has(#semi.on), 
body:has(#kategori.on), 
body:has(#hub.on), 
body:has(#arena.on), 
body:has(#jenis.on), 
body:has(#soal.on) {
  background-image: url("BGMONOPOLI.webp") !important;
}

/* BG GRAND FINAL */
body:has(#grand.on),
body:has(#welcome.is-grand.on) {
  background-image: url("BGGRAND.webp") !important;
}