/* ===== Kerangka layar ===== */
.screen {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.screen.screen-in > * { animation: screen-in 0.55s var(--ease-back) both; }
.screen.screen-in > *:nth-child(2) { animation-delay: 0.04s; }
.screen.screen-in > *:nth-child(3) { animation-delay: 0.08s; }
.screen.screen-in > *:nth-child(4) { animation-delay: 0.12s; }
.screen.screen-in > *:nth-child(5) { animation-delay: 0.16s; }
.screen.screen-in > *:nth-child(n + 6) { animation-delay: 0.2s; }
@keyframes screen-in { from { opacity: 0; transform: translateY(26px) scale(0.97); } to { opacity: 1; transform: none; } }
.arena.screen-in > * { animation: none; }

.screen-title { text-align: center; margin: 6px 0 4px; font-size: 1rem; }
.screen-title .ribbon { font-size: clamp(1.6rem, 7vw, 2.2rem); }

/* Logo resmi Al Faiz (warna asli merah) di plakat krem berbingkai emas, di atas judul game.
   Merah di atas krem = kontras tinggi, jadi wordmark tetap terbaca walau kecil. */
.brand-badge {
  display: inline-flex; align-items: center;
  padding: 6px 16px 7px 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, var(--cream) 100%);
  border: 3px solid var(--gold);
  box-shadow: 0 4px 0 var(--gold-deep), 0 0 22px rgba(255, 197, 49, 0.35);
  margin-bottom: 10px;
}
.brand-badge img { display: block; height: 40px; width: auto; }
.logo-title { display: grid; line-height: 0.86; margin: 2px 0 0; }
.logo-title span {
  font-family: var(--display);
  font-size: clamp(3.4rem, 17vw, 5.4rem);
  color: var(--gold);
  -webkit-text-stroke: 3px #2a1100;
  paint-order: stroke fill;
  text-shadow: 0 6px 0 #2a1100, 0 10px 24px rgba(255, 122, 26, 0.45);
  letter-spacing: 0.02em;
}
.logo-title span + span {
  font-size: clamp(2.6rem, 13vw, 4.2rem);
  color: #fff;
  background: linear-gradient(180deg, #ffffff 30%, #ffd8b0 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 5px 0 #2a1100);
  -webkit-text-stroke: 0;
  text-shadow: none;
}

/* ===== Splash ===== */
.splash {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; align-content: center; gap: 18px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(90% 60% at 50% 40%, #3a1f8f 0%, var(--night-1) 55%, var(--night-0) 100%);
  overflow: hidden;
  transition: opacity 0.5s ease, transform 0.6s var(--ease-snap);
}
.splash.out { opacity: 0; transform: scale(1.15); pointer-events: none; }
.splash-rays {
  position: absolute; inset: -50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 197, 49, 0.09) 0 10deg, transparent 10deg 20deg);
  animation: spin 30s linear infinite;
}
.splash-logo { position: relative; display: grid; justify-items: center; animation: impact 0.75s var(--ease-back) 0.1s both; }
.splash-logo .brand-badge img { height: 48px; }
@keyframes impact {
  0% { transform: scale(3.2); opacity: 0; filter: blur(8px); }
  55% { transform: scale(0.9); opacity: 1; filter: blur(0); }
  65% { transform: scale(1.04) translateX(-6px); }
  75% { transform: scale(1) translateX(6px); }
  85% { transform: translateX(-3px); }
  100% { transform: none; }
}
.splash-mascot { position: relative; width: min(240px, 60vw); }
.splash-mascot img { width: 100%; height: auto; display: block; transform-origin: 50% 100%; animation: mascot-pushup 0.9s ease-in-out infinite; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.5)); }
@keyframes mascot-pushup { 0%, 100% { transform: scaleY(1) translateY(0); } 50% { transform: scaleY(0.8) translateY(6%); } }
.energy-bar {
  position: relative; width: min(320px, 78vw); height: 26px;
  border-radius: 999px; padding: 4px;
  background: #0b0726; border: 3px solid #3b2f80;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.6), 0 0 22px rgba(46, 232, 255, 0.25);
}
.energy-bar .energy-fill {
  height: 100%; border-radius: 999px;
  transform-origin: left; transform: scaleX(0);
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.25) 0 8px, transparent 8px 16px), linear-gradient(90deg, var(--cyan), var(--lime) 60%, var(--gold));
  background-size: 32px 100%, 100% 100%;
  animation: stripes 0.6s linear infinite;
  box-shadow: 0 0 14px rgba(168, 255, 62, 0.6);
}
@keyframes stripes { to { background-position: 32px 0, 0 0; } }
.energy-bar .energy-bolt { position: absolute; right: -14px; top: 50%; width: 38px; height: 38px; transform: translateY(-50%); --o1: var(--bolt); --o3: #fff; filter: drop-shadow(0 0 8px var(--bolt)); animation: float-y 0.6s ease-in-out infinite alternate; }
.splash-load { margin: 0; font-family: var(--display); font-size: 1.2rem; color: var(--cyan); letter-spacing: 0.08em; }
.splash-tip { margin: 0; color: var(--muted); max-width: 34ch; min-height: 3em; }

/* ===== Login ===== */
/* Ruang di atas untuk balon kata maskot, supaya tidak menutupi logo */
.brand { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; padding-top: 62px; }
.brand-coach .coach-bubble { left: 8%; bottom: 88%; max-width: min(200px, 54vw); min-width: 0; width: max-content; transform: scale(0); transform-origin: 30px 100%; }
.brand-coach .coach-bubble.show { transform: scale(1); }
.brand-coach .coach-bubble::after { left: 30px; }
.brand-coach { width: min(150px, 36vw); }
.brand-text { min-width: 0; }
.brand .logo-title span { font-size: clamp(2.8rem, 13vw, 4.4rem); }
.brand .logo-title span + span { font-size: clamp(2.1rem, 10vw, 3.4rem); }
.login { display: grid; gap: 14px; }
.login .panel-title { margin-bottom: 0; }
.login-lead { margin: 0; }
.login .error:empty { display: none; }
.login-sites { display: grid; gap: 12px; }
.login-sites a.btn { text-decoration: none; text-align: center; }
.admin-login summary { cursor: pointer; text-align: center; font-size: 0.85rem; font-weight: 700; color: var(--muted); padding: 6px 0; }
.admin-login[open] summary { margin-bottom: 10px; }
.gold-orn { --o1: var(--gold); --o2: var(--red); --o3: #fff3c2; }

/* Pintu tutorial */
.guide-link {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 12px 14px; text-align: left;
  background: rgba(10, 6, 34, 0.6);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.2s var(--ease-back);
}
.guide-link:hover { border-color: var(--cyan); transform: translateY(-2px); }
.guide-link > .orn { width: 46px; height: 46px; --o1: var(--cyan); --o2: #fff; --o3: var(--night-2); }
.guide-link span { flex: 1; }
.guide-link b { display: block; font-size: 1.05rem; }
.guide-link small { display: block; color: var(--muted); font-size: 0.875rem; }
.guide-link .chev { color: var(--muted); }

/* ===== Lobby / menu utama ===== */
.topbar { display: flex; align-items: center; gap: 12px; }
.profile-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.profile-name { display: block; font-size: 1.15rem; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.level-row { display: flex; align-items: center; gap: 8px; }
.level-shield { position: relative; width: 34px; height: 34px; flex: none; display: grid; place-items: center; }
.level-shield .orn { position: absolute; inset: 0; width: 100%; height: 100%; --o1: #0b0726; --o2: var(--gold); --o3: transparent; filter: drop-shadow(0 2px 0 #0b0726); }
.level-shield b { position: relative; font-family: var(--display); font-size: 0.95rem; color: var(--me-ink); margin-top: -2px; }
.level-shield.div-SILVER .orn { --o2: #d6def0; }
.level-shield.div-BRONZE .orn { --o2: #e68a4a; }

.xp-bar {
  position: relative; flex: 1; height: 18px; border-radius: 999px;
  background: #0b0726; border: 2px solid #3b2f80; overflow: hidden;
}
.xp-bar.big { height: 30px; border-width: 3px; }
.xp-fill {
  position: absolute; inset: 0; transform-origin: left; transform: scaleX(0);
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.22) 0 7px, transparent 7px 14px), linear-gradient(90deg, var(--cyan), var(--lime));
  border-radius: inherit;
  transition: transform 0.9s var(--ease-out);
}
.xp-bar span { position: relative; z-index: 1; display: block; text-align: center; font-size: 0.72rem; font-weight: 800; line-height: 14px; text-shadow: 0 1px 2px #000; }
.xp-bar.big span { font-size: 0.9rem; line-height: 24px; }

.stage-hero {
  position: relative;
  display: grid; justify-items: center;
  min-height: 330px;
  margin-top: -4px;
}
.hero-title { position: relative; z-index: 2; text-align: center; }
.hero-coach { position: relative; z-index: 3; width: min(250px, 62vw); margin-top: -12px; }
/* Balon kata di kanan kepala maskot, tidak menutupi judul */
.hero-coach .coach-bubble { left: 60%; bottom: 64%; max-width: min(140px, 36vw); min-width: 0; width: max-content; transform: scale(0); transform-origin: 0 100%; }
.hero-coach .coach-bubble.show { transform: scale(1); }
.hero-coach .coach-bubble::after { left: 16px; }
.hero-pedestal {
  position: absolute; bottom: 4px; left: 50%; width: min(300px, 74vw); height: 48px; transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 197, 49, 0.55), rgba(255, 122, 26, 0.2) 60%, transparent);
  filter: blur(2px);
  animation: pedestal 2.4s ease-in-out infinite alternate;
}
@keyframes pedestal { from { opacity: 0.6; transform: translateX(-50%) scaleX(0.9); } to { opacity: 1; transform: translateX(-50%) scaleX(1.05); } }

.play-btn {
  --b-edge: #8a3a00;
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 92px;
  border: 4px solid var(--b-edge); border-radius: 28px;
  background: linear-gradient(180deg, #ffe27a 0%, var(--gold) 45%, var(--fire) 100%);
  color: #3a1200;
  font-family: var(--display); font-size: clamp(2.4rem, 11vw, 3.4rem); letter-spacing: 0.06em;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.55);
  cursor: pointer;
  box-shadow: 0 9px 0 var(--b-edge), 0 0 0 0 rgba(255, 197, 49, 0.55), inset 0 4px 0 rgba(255, 255, 255, 0.55);
  animation: play-pulse 1.6s ease-in-out infinite;
  transition: transform 0.12s var(--ease-out);
  overflow: hidden;
}
.play-btn .icon { width: 0.9em; height: 0.9em; fill: currentColor; stroke-width: 2; }
.play-btn:hover { transform: translateY(-3px) scale(1.01); }
.play-btn:active { transform: translateY(9px) scale(0.98, 0.95); box-shadow: 0 0 0 var(--b-edge), inset 0 4px 0 rgba(255, 255, 255, 0.4); animation: none; }
@keyframes play-pulse {
  0%, 100% { box-shadow: 0 9px 0 var(--b-edge), 0 0 0 0 rgba(255, 197, 49, 0.6), 0 0 30px rgba(255, 122, 26, 0.5), inset 0 4px 0 rgba(255, 255, 255, 0.55); }
  50% { box-shadow: 0 9px 0 var(--b-edge), 0 0 0 16px rgba(255, 197, 49, 0), 0 0 50px rgba(255, 122, 26, 0.8), inset 0 4px 0 rgba(255, 255, 255, 0.55); }
}
.play-mode { margin: -6px 0 0; font-weight: 600; }

.nav-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.nav-btn {
  display: grid; justify-items: center; gap: 4px;
  padding: 14px 6px 12px;
  border-radius: var(--radius);
  border: 3px solid #0b0726;
  background: linear-gradient(180deg, var(--night-4), var(--night-2));
  box-shadow: 0 5px 0 #0b0726, inset 0 2px 0 rgba(255, 255, 255, 0.16);
  color: var(--text); font-weight: 800; font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.12s var(--ease-out), box-shadow 0.12s;
}
.nav-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 0 #0b0726, 0 0 20px rgba(180, 140, 255, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.16); }
.nav-btn:active { transform: translateY(5px); box-shadow: 0 0 0 #0b0726; }
.nav-btn .orn { width: 40px; height: 40px; --o1: var(--gold); --o2: var(--red); --o3: #fff3c2; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.4)); }
.nav-btn:nth-child(3) .orn { --o1: var(--cyan); --o2: #fff; --o3: var(--night-2); }

/* ===== Pilih mode: kartu game dengan tilt ===== */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; perspective: 900px; }
.mode {
  --accent: var(--gold);
  --rx: 0deg; --ry: 0deg;
  position: relative;
  display: grid; justify-items: center; align-content: start; gap: 6px;
  min-height: 210px;
  padding: 14px 10px 14px;
  text-align: center;
  border-radius: var(--radius-lg);
  border: 3px solid #0b0726;
  background:
    radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 70%),
    linear-gradient(180deg, var(--night-4), var(--night-2));
  box-shadow: 0 7px 0 #0b0726, inset 0 2px 0 rgba(255, 255, 255, 0.16);
  color: var(--text);
  cursor: pointer;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s;
  overflow: hidden;
}
.mode::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, 0.2), transparent 45%);
  opacity: 0; transition: opacity 0.2s;
}
.mode:hover::after { opacity: 1; }
.mode:hover { box-shadow: 0 10px 0 #0b0726, 0 0 28px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 2px 0 rgba(255, 255, 255, 0.16); }
.mode-ico { width: 70px; height: 70px; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.45)); transform: translateZ(30px); transition: transform 0.3s var(--ease-back); }
.mode:hover .mode-ico { transform: translateZ(30px) scale(1.12) rotate(-6deg); }
.mode b { font-family: var(--display); font-weight: 400; font-size: 1.3rem; line-height: 1.05; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.mode small { display: block; color: var(--muted); font-weight: 500; font-size: 0.8rem; line-height: 1.3; }
.mode .diff { display: flex; gap: 2px; justify-content: center; }
.mode .diff .orn { width: 18px; height: 18px; --o1: #3b3166; --o2: #0b0726; --o3: transparent; }
.mode .diff .orn.on { --o1: var(--accent); --o3: rgba(255, 255, 255, 0.7); }
.mode .diff .orn.skull.on { --o1: #fff1d9; --o2: #2a1100; }
.mode .pill {
  position: absolute; top: 10px; right: -30px; transform: rotate(35deg);
  padding: 2px 34px; font-style: normal; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em;
  background: var(--red); color: #fff; box-shadow: 0 2px 0 var(--red-deep);
}
.mode[aria-pressed='true'] {
  border-color: var(--accent);
  box-shadow: 0 7px 0 color-mix(in srgb, var(--accent) 45%, #0b0726), 0 0 0 3px #0b0726, 0 0 30px color-mix(in srgb, var(--accent) 55%, transparent), inset 0 2px 0 rgba(255, 255, 255, 0.2);
}
.mode[aria-pressed='true']::before {
  content: '✓'; position: absolute; top: 8px; left: 8px;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #0b0726; font-weight: 900; font-size: 0.9rem;
  box-shadow: 0 2px 0 #0b0726;
  animation: pop 0.4s var(--ease-back);
}
.mode[data-mode='SPRINT_60'] { --accent: var(--gold); }
.mode[data-mode='FIRST_TO_N'] { --accent: var(--cyan); }
.mode[data-mode='ENDURANCE'] { --accent: var(--fire); }
.mode[data-mode='QUIZ'] { --accent: var(--lime); }

.option-strip { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px; border-radius: var(--radius); background: rgba(10, 6, 34, 0.55); border: 2px solid var(--line); }
.option-strip > .muted { flex-basis: 100%; font-weight: 700; }
.option-strip .btn { flex: 1; min-height: 46px; padding: 8px; font-size: 1.05rem; --press: 4px; }
.play-panel .panel-title .orn { --o1: var(--bolt); --o3: #fff; }
.actions.play .wide { grid-column: 1 / -1; min-height: 66px; font-size: 1.6rem; }
.actions.play .btn:not(.wide) { font-size: 1.02rem; padding-inline: 10px; white-space: nowrap; gap: 6px; }
.actions.play .wide .icon { width: 30px; height: 30px; }
#ghostNote { margin: 12px 0 0; display: flex; gap: 6px; align-items: center; }

/* ===== Leaderboard ===== */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 8px 14px; border-radius: 999px;
  border: 2px solid var(--line); background: rgba(10, 6, 34, 0.6); color: var(--muted);
  font-weight: 800; font-size: 0.85rem; cursor: pointer; white-space: nowrap;
}
.tab[aria-selected='true'] { background: var(--gold); color: var(--me-ink); border-color: var(--gold-deep); box-shadow: 0 3px 0 var(--gold-deep); }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; min-height: 40px; margin-top: 8px; }
.podium:empty { display: none; }
.pod { display: grid; justify-items: center; gap: 6px; text-align: center; min-width: 0; animation: pod-in 0.7s var(--ease-back) both; }
.pod.p1 { order: 2; animation-delay: 0.3s; }
.pod.p2 { order: 1; animation-delay: 0.1s; }
.pod.p3 { order: 3; animation-delay: 0.2s; }
@keyframes pod-in { from { opacity: 0; transform: translateY(60px); } to { opacity: 1; transform: none; } }
.pod .crown { width: 44px; height: 44px; --o1: var(--gold); --o2: var(--gold-deep); --o3: var(--red); filter: drop-shadow(0 0 10px rgba(255, 197, 49, 0.7)); animation: float-y 1.2s ease-in-out infinite alternate; }
.pod .medal-ico { width: 34px; height: 34px; }
.pod.p2 .medal-ico { --o1: #e3e9f6; --o2: #3a7bd5; --o3: #8a96b3; }
.pod.p3 .medal-ico { --o1: #e68a4a; --o2: #2fa36b; --o3: #fff1d9; }
.pod .avatar { width: 58px; height: 58px; font-size: 1.7rem; }
.pod.p1 .avatar { width: 74px; height: 74px; font-size: 2.2rem; --c: var(--gold) !important; }
.pod .pod-name { font-weight: 800; font-size: 0.85rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .pod-score { font-family: var(--display); font-size: 1.3rem; color: var(--gold); }
.pod .block {
  width: 100%; border-radius: 14px 14px 6px 6px;
  border: 3px solid #0b0726;
  display: grid; place-items: center;
  font-family: var(--display); font-size: 2.2rem; color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.3);
}
.pod.p1 .block { height: 110px; background: linear-gradient(180deg, var(--gold-hi), var(--gold) 50%, var(--gold-deep)); color: #5a3500; text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5); }
.pod.p2 .block { height: 80px; background: linear-gradient(180deg, #f1f5ff, #b8c4dc 60%, #7d8aa8); color: #3a4560; text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5); }
.pod.p3 .block { height: 62px; background: linear-gradient(180deg, #ffbf8f, #e68a4a 60%, #9a4f1c); }
.pod.me .pod-name { color: var(--cyan); }

/* ===== Profil ===== */
.profile-hero { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; }
.profile-coach { width: 120px; }
.profile-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-tile {
  padding: 10px; border-radius: 14px; background: rgba(10, 6, 34, 0.6); border: 2px solid var(--line);
  display: grid; gap: 0;
}
.stat-tile b { font-family: var(--display); font-weight: 400; font-size: 1.7rem; line-height: 1.1; color: var(--gold); }
.stat-tile small { color: var(--muted); font-weight: 600; font-size: 0.75rem; }
.stat-tile.c-cyan b { color: var(--cyan); }
.stat-tile.c-lime b { color: var(--lime); }
.stat-tile.c-red b { color: var(--red-hi); }
.streak-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 6px; }
.streak-day {
  display: grid; justify-items: center; gap: 2px; padding: 8px 2px;
  border-radius: 12px; background: rgba(10, 6, 34, 0.6); border: 2px solid var(--line);
  font-size: 0.7rem; font-weight: 700; color: var(--dim);
}
.streak-day .orn { width: 26px; height: 26px; --o1: #3b3166; --o2: #241c4a; }
.streak-day.on { border-color: var(--fire); color: var(--text); background: linear-gradient(180deg, rgba(255, 122, 26, 0.25), rgba(10, 6, 34, 0.6)); }
.streak-day.on .orn { --o1: var(--fire); --o2: var(--bolt); filter: drop-shadow(0 0 6px rgba(255, 122, 26, 0.8)); animation: flicker 0.8s ease-in-out infinite alternate; }
.streak-day.today { box-shadow: 0 0 0 2px var(--gold); }
@keyframes flicker { from { transform: scale(1) rotate(-3deg); } to { transform: scale(1.1) rotate(3deg); } }
#streakText { margin: 0; display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--fire-hi); }
.record-chart { display: grid; gap: 10px; }
.rec-row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 10px; font-weight: 700; font-size: 0.875rem; }
.rec-row .rec-track { height: 18px; border-radius: 999px; background: #0b0726; border: 2px solid #3b2f80; overflow: hidden; }
.rec-row .rec-fill { height: 100%; transform-origin: left; transform: scaleX(0); border-radius: inherit; background: linear-gradient(90deg, var(--fire), var(--gold)); transition: transform 1s var(--ease-out); }
.rec-row b { font-family: var(--display); font-weight: 400; font-size: 1.1rem; color: var(--gold); min-width: 64px; text-align: right; }
.rec-row.none b { color: var(--dim); font-family: var(--body); font-size: 0.8rem; }
.panel-title .orn { --o1: var(--gold); --o2: var(--red); --o3: #fff3c2; }

/* ===== Lobi duel ===== */
.vs-banner { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 4px 0; }
.vs-banner b {
  font-family: var(--display); font-size: 3rem; color: var(--gold);
  -webkit-text-stroke: 3px #2a1100; paint-order: stroke fill;
  text-shadow: 0 5px 0 #2a1100, 0 0 30px rgba(255, 122, 26, 0.7);
  animation: vs-pulse 1s ease-in-out infinite alternate;
}
@keyframes vs-pulse { from { transform: scale(1) rotate(-4deg); } to { transform: scale(1.12) rotate(4deg); } }
.vs-side { width: 70px; height: 70px; border-radius: 22px; display: grid; place-items: center; border: 3px solid #0b0726; font-family: var(--display); font-size: 2rem; }
.vs-side.me { background: linear-gradient(180deg, var(--gold-hi), var(--gold)) center / cover; box-shadow: 0 5px 0 var(--gold-deep), 0 0 24px rgba(255, 197, 49, 0.5); }
.vs-side.foe { background: linear-gradient(180deg, var(--red-hi), var(--red)); box-shadow: 0 5px 0 var(--red-deep), 0 0 24px rgba(236, 42, 63, 0.5); color: #fff; animation: float-y 1s ease-in-out infinite alternate; }
.lobby-card .btn { width: 100%; }
.lobby-card .panel-title { margin-bottom: 4px; }
.join { display: flex; gap: 10px; margin-top: 8px; }
.join input {
  flex: 1; min-width: 0;
  background: #0b0726;
  border: 3px solid #3b2f80;
  border-radius: 14px;
  padding: 6px 10px;
  font-family: var(--display);
  font-size: 1.9rem;
  letter-spacing: 0.22em;
  text-align: center;
  color: var(--gold);
}
.join input:focus { outline: none; border-color: var(--cyan); box-shadow: var(--glow-cyan); }
.join .btn { width: auto; }

/* ===== Hasil ===== */
.result { position: relative; overflow: hidden; }
.result-rays {
  position: fixed; left: 50%; top: 18%; width: 160vmax; height: 160vmax;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(255, 197, 49, 0.1) 0 9deg, transparent 9deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 45%);
  mask-image: radial-gradient(circle, #000 0%, transparent 45%);
  animation: spin 40s linear infinite;
  pointer-events: none; z-index: -1;
}
.result.lose .result-rays { background: repeating-conic-gradient(from 0deg, rgba(180, 140, 255, 0.08) 0 9deg, transparent 9deg 18deg); }
.result-head { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px; margin-top: 4px; }
.result-coach { width: min(150px, 36vw); }
.result-banner { display: grid; justify-items: center; text-align: center; gap: 4px; min-width: 0; }
.result-kicker {
  display: inline-block; padding: 6px 14px; border-radius: 10px;
  font-family: var(--display); font-size: clamp(0.95rem, 4vw, 1.2rem); letter-spacing: 0.04em; color: #fff;
  background: linear-gradient(180deg, var(--red-hi), var(--red)); border: 3px solid var(--red-deep); box-shadow: 0 4px 0 var(--red-deep);
  animation: pop 0.6s var(--ease-back) 0.1s both;
}
.result-title {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(2.4rem, 12.5vw, 5.4rem); line-height: 0.95;
  max-width: 100%; overflow-wrap: anywhere;
  color: var(--gold);
  -webkit-text-stroke: 3px #2a1100; paint-order: stroke fill;
  text-shadow: 0 6px 0 #2a1100, 0 0 40px rgba(255, 197, 49, 0.55);
  animation: impact 0.8s var(--ease-back) 0.25s both;
}
.result-title.lose { color: #c9c3ef; text-shadow: 0 6px 0 #2a1100, 0 0 30px rgba(180, 140, 255, 0.35); }
.result-title.draw { color: var(--cyan); }
#resultSub { margin: 0; }
.stars { display: flex; justify-content: center; align-items: flex-end; gap: 6px; min-height: 96px; }
.star-slot { position: relative; width: 78px; height: 78px; }
.star-slot:nth-child(2) { width: 96px; height: 96px; }
.star-slot .orn { position: absolute; inset: 0; width: 100%; height: 100%; }
.star-slot .orn.empty { --o1: #241c4a; --o3: transparent; filter: drop-shadow(0 3px 0 #0b0726); }
.star-slot .orn.full { --o1: var(--gold); --o3: #fff7d0; filter: drop-shadow(0 4px 0 var(--gold-deep)) drop-shadow(0 0 16px rgba(255, 197, 49, 0.8)); opacity: 0; transform: scale(2.4) rotate(-40deg); }
.star-slot.lit .orn.full { animation: star-in 0.55s var(--ease-back) forwards; }
@keyframes star-in { to { opacity: 1; transform: none; } }
.star-notes { margin: -6px 0 0; display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; }
.star-notes span { display: inline-flex; align-items: center; gap: 4px; }
.star-notes .got { color: var(--gold-hi); }
.new-record {
  align-self: center;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 20px; border-radius: 999px;
  font-family: var(--display); font-size: 1.5rem; letter-spacing: 0.04em; color: #3a1200;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 50%, var(--fire));
  border: 3px solid #8a3a00; box-shadow: 0 5px 0 #8a3a00, 0 0 30px rgba(255, 197, 49, 0.7);
  overflow: hidden; position: relative;
  animation: pop 0.6s var(--ease-back) both, glow-pulse 1.2s ease-in-out 0.6s infinite alternate;
}
.new-record .orn { width: 28px; height: 28px; --o1: #fff7d0; --o2: #8a3a00; --o3: var(--red); }
@keyframes glow-pulse { from { box-shadow: 0 5px 0 #8a3a00, 0 0 20px rgba(255, 197, 49, 0.5); } to { box-shadow: 0 5px 0 #8a3a00, 0 0 44px rgba(255, 197, 49, 0.95); } }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.player-card {
  --c: var(--me);
  position: relative;
  background: linear-gradient(180deg, rgba(47, 34, 117, 0.95), rgba(23, 16, 66, 0.95));
  border: 3px solid #0b0726; border-radius: var(--radius-lg); padding: 16px;
  box-shadow: var(--shadow-panel), inset 0 0 0 2px color-mix(in srgb, var(--c) 35%, transparent);
}
.player-card.winner { box-shadow: var(--shadow-panel), inset 0 0 0 3px var(--gold), 0 0 30px rgba(255, 197, 49, 0.35); }
.player-card header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.player-card header b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.winner-mark { color: var(--gold); display: grid; }
.winner-mark .orn { width: 34px; height: 34px; --o1: var(--gold); --o2: var(--gold-deep); --o3: #fff7d0; animation: float-y 0.9s ease-in-out infinite alternate; }
.player-card .big {
  font-family: var(--display); font-weight: 400; font-size: 4.6rem; line-height: 0.9;
  color: var(--c);
  -webkit-text-stroke: 3px #0b0726; paint-order: stroke fill;
  text-shadow: 0 5px 0 #0b0726;
}
.stat-list { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 0.9375rem; margin: 10px 0 0; }
.stat-list dt { color: var(--muted); }
.stat-list dd { margin: 0; font-weight: 800; text-align: right; }
.xp-panel { padding: 14px 16px; }
.xp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 700; }
.xp-head .orn { --o1: var(--bolt); --o3: #fff; }
.xp-head b { font-family: var(--display); font-weight: 400; font-size: 1.4rem; color: var(--lime); }
.rewards { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.reward {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
  background: rgba(10, 6, 34, 0.7); border: 2px solid var(--line); font-weight: 800;
  animation: pop 0.5s var(--ease-back) both; animation-delay: calc(1.6s + var(--i, 0) * 0.12s);
}
.reward .icon { color: var(--gold); }
.reward.gold { border-color: var(--gold); background: linear-gradient(180deg, rgba(255, 197, 49, 0.25), rgba(10, 6, 34, 0.7)); }
.result-actions { grid-template-columns: 1fr 1fr; }
.result-actions .wide { grid-column: 1 / -1; min-height: 66px; font-size: 1.6rem; }

.review { display: grid; gap: 10px; }
.review h2 { margin: 0; }
.review-item { border-left: 5px solid var(--line); padding: 6px 0 6px 12px; border-radius: 4px; background: rgba(10, 6, 34, 0.35); }
.review-item.ok { border-color: var(--ok); }
.review-item.bad { border-color: var(--bad); }
.review-item p { margin: 2px 0; }
.review-item .q { font-weight: 700; }
.review-item .mark { margin-right: 4px; }
.review-item.ok .mark { color: var(--ok); }
.review-item.bad .mark { color: var(--bad); }
.review-item .exp { color: var(--muted); font-size: 0.9375rem; }

/* ===== Tutorial (gelap) ===== */
#tutCount { font-family: var(--display); font-size: 1.3rem; color: var(--cyan); }
#tutorial .row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tut-step h3 { font-family: var(--display); font-weight: 400; font-size: 1.6rem; margin: 14px 0 6px; color: var(--gold); }
.tut-svg {
  display: block; width: 100%; height: auto; border-radius: 14px;
  background: linear-gradient(180deg, #2a1f6b, #171042); border: 3px solid #0b0726;
  --tut-ink: #f6f3ff; --tut-mist: #241c55;
}
.tut-svg .floor { fill: #1a1348; }
.tut-svg .floorline { stroke: var(--muted); stroke-width: 2; }
.tut-svg .fov { fill: rgba(168, 255, 62, 0.14); }
.tut-svg .phone { fill: #0b0726; stroke: var(--ok); stroke-width: 2.5; }
.tut-svg .phone.bad { stroke: var(--bad); }
.tut-svg .lens { fill: var(--ok); }
.tut-svg .cross { stroke: var(--bad); stroke-width: 4; stroke-linecap: round; }
.tut-svg .body, .tut-svg .body line { fill: none; stroke: var(--tut-ink); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.tut-svg .body.thin { stroke-width: 5; }
.tut-svg .body .torso { stroke-width: 22; }
.tut-svg .torso-fill { fill: #3b2f80; stroke: var(--tut-ink); stroke-width: 3; stroke-linejoin: round; }
.tut-svg .head { fill: #2f2275; stroke: var(--tut-ink); stroke-width: 4; }
.tut-svg .head.small { stroke-width: 3; }
.tut-svg .eye { fill: var(--tut-ink); }
.tut-svg .joint { fill: var(--ok); }
.tut-svg .ghost { stroke: var(--muted); stroke-width: 4; stroke-dasharray: 6 6; stroke-linecap: round; }
.tut-svg .arrow, .tut-svg .pointer, .tut-svg .dim line { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.tut-svg .pointer { stroke: var(--muted); stroke-dasharray: 3 4; }
.tut-svg .label { fill: var(--muted); font: 600 12px var(--body); }
.tut-svg .good { stroke: var(--ok); }
.tut-svg .bad { stroke: var(--bad); }
.tut-svg text.good { fill: var(--ok); stroke: none; }
.tut-svg text.bad { fill: var(--bad); stroke: none; }
#tutorial.has-3d .tut-svg, #tutorial.loading-3d .tut-svg { display: none; }
#tutorial.loading-3d .tut-step::before {
  content: ''; display: block; aspect-ratio: 320 / 220;
  background: linear-gradient(180deg, #2a1f6b 0%, #14213d 100%);
  border-radius: var(--radius);
  animation: tut-wait 1.2s ease-in-out infinite alternate;
}
@keyframes tut-wait { to { opacity: 0.6; } }
.tut-3d {
  position: relative; overflow: hidden; aspect-ratio: 320 / 220;
  background: linear-gradient(180deg, #2a1f6b 0%, #14213d 100%);
  border-radius: var(--radius); border: 3px solid #0b0726;
}
.tut-3d canvas { position: absolute; inset: 0; width: 100%; display: block; }
.tut-3d-labels { position: absolute; inset: 0; pointer-events: none; }
.tut-3d-label {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px;
  font: 700 0.8125rem/1.2 var(--body); padding: 4px 9px; border-radius: 999px;
  background: rgba(10, 6, 34, 0.86); color: #fff;
}
.tut-3d-label[hidden] { display: none; }
.tut-3d-label .icon { width: 1.1em; height: 1.1em; stroke-width: 2.5; }
.tut-3d-label.good { color: #c8ff8a; }
.tut-3d-label.bad { color: #ff8f8f; }
.tut-3d-label.gold { color: var(--gold); }
.tut-dots { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.tut-dots span { width: 10px; height: 10px; border-radius: 50%; background: #3b2f80; transition: background-color 0.2s, width 0.25s var(--ease-back); }
.tut-dots span.on { width: 26px; border-radius: 5px; background: var(--gold); }
.tut-skip { display: flex; margin: 10px auto 0; }

/* Layar lebar: menu dua kolom tetap terasa seperti game. */
@media (min-width: 720px) {
  .screen { max-width: 640px; }
  .modes { grid-template-columns: repeat(4, 1fr); }
  .screen[data-screen='modes'] { max-width: 920px; }
  .mode { min-height: 240px; }
}
@media (max-width: 360px) {
  .modes { gap: 10px; }
  .mode { min-height: 190px; }
  .mode-ico { width: 56px; height: 56px; }
}
