/* Pasar Rush — mode arcade tanpa henti. Gaya mengikuti Kampung Cahaya. */
:root {
  --rush-ink: #10302b;
  --rush-cream: #fff9ea;
  --rush-gold: #f4b62d;
  --rush-gold-soft: #ffd86e;
  --rush-safe-top: max(12px, env(safe-area-inset-top));
  --rush-safe-bottom: max(14px, env(safe-area-inset-bottom));
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d2a26; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--rush-ink); -webkit-tap-highlight-color: transparent; }

.rush-shell { position: fixed; inset: 0; overflow: hidden; }
#rushCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }

/* ---------- HUD ---------- */
.rush-topbar {
  position: absolute; top: var(--rush-safe-top); left: 10px; right: 10px; z-index: 20;
  display: grid; grid-template-columns: 46px minmax(0, 1fr) 46px; align-items: center; gap: 8px;
}
.rush-icon {
  width: 46px; height: 46px; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 15px;
  background: rgba(8, 38, 34, 0.62); color: #fff; font-size: 17px; font-weight: 800;
  text-decoration: none; cursor: pointer; backdrop-filter: blur(4px);
}
.rush-icon:active { transform: scale(0.95); }
.rush-stats { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 6px; }
.rush-stat {
  display: grid; gap: 1px; padding: 5px 8px; border-radius: 13px;
  background: rgba(255, 249, 234, 0.94); text-align: center; box-shadow: 0 4px 14px rgba(3, 26, 23, 0.22);
}
.rush-stat small { font-size: 9px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #6d7a70; }
.rush-stat b { font-size: 16px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rush-stat--wide b { font-size: 19px; }

.rush-rail { position: absolute; left: 12px; bottom: calc(var(--rush-safe-bottom) + 84px); z-index: 18; display: grid; gap: 8px; justify-items: start; }
.rush-hearts { display: flex; gap: 4px; padding: 6px 10px; border-radius: 14px; background: rgba(8, 38, 34, 0.58); }
.rush-hearts span { font-size: 17px; color: #ff7d6a; transition: opacity 0.2s, transform 0.2s; }
.rush-hearts span.lost { opacity: 0.22; transform: scale(0.82); }
.rush-combo {
  padding: 6px 11px; border-radius: 999px; background: linear-gradient(135deg, var(--rush-gold), var(--rush-gold-soft));
  color: #46350e; font-size: 12px; font-weight: 900; letter-spacing: 0.04em; box-shadow: 0 6px 18px rgba(198, 132, 24, 0.34);
}
.rush-combo b { font-size: 15px; }

.rush-jump {
  position: absolute; right: 16px; bottom: calc(var(--rush-safe-bottom) + 14px); z-index: 22;
  width: 96px; height: 96px; display: grid; place-items: center; gap: 1px;
  border: 0; padding: 0; border-radius: 50%;
  background: linear-gradient(150deg, var(--rush-gold), var(--rush-gold-soft));
  color: #46350e; box-shadow: 0 12px 30px rgba(198, 132, 24, 0.4); cursor: pointer;
  /* Teks tombol tidak boleh bisa diseleksi: kalau bisa, menekan dan menahan
     memunculkan seleksi bawaan browser sehingga labelnya tampak berubah. */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.rush-jump span { font-size: 26px; line-height: 1; }
.rush-jump b { font-size: 11px; letter-spacing: 0.08em; }
.rush-jump:active { transform: scale(0.93); }

.rush-toast {
  position: absolute; left: 50%; bottom: calc(var(--rush-safe-bottom) + 128px); z-index: 24;
  transform: translate(-50%, 8px); padding: 9px 16px; border-radius: 999px;
  background: rgba(8, 38, 34, 0.86); color: #fff; font-size: 13px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity 0.22s, transform 0.22s; max-width: min(86vw, 420px); text-align: center;
}
.rush-toast.show { opacity: 1; transform: translate(-50%, 0); }

.rush-milestone {
  position: absolute; left: 50%; top: 26%; z-index: 26; transform: translate(-50%, -6px) scale(0.94);
  color: #fff; font-size: 42px; font-weight: 900; letter-spacing: 0.02em;
  text-shadow: 0 6px 22px rgba(3, 26, 23, 0.6); opacity: 0; pointer-events: none;
}
.rush-milestone.show { animation: rush-milestone 1.4s ease-out; }
@keyframes rush-milestone {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.9); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
  70% { opacity: 1; transform: translate(-50%, -6px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -22px) scale(0.98); }
}

.rush-flash { position: absolute; inset: 0; z-index: 15; pointer-events: none; background: radial-gradient(circle at 50% 60%, transparent 42%, rgba(214, 84, 58, 0.42) 100%); opacity: 0; }
.rush-flash.show { animation: rush-flash 0.42s ease-out; }
@keyframes rush-flash { 0% { opacity: 1; } 100% { opacity: 0; } }

@keyframes rush-pop { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }
.pop { animation: rush-pop 0.3s ease-out; }

/* ---------- Overlay ---------- */
.rush-overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 22px;
  background: linear-gradient(105deg, rgba(8, 38, 34, 0.9), rgba(8, 38, 34, 0.5)); backdrop-filter: blur(5px);
  overflow: auto;
}
.rush-panel {
  width: min(520px, 100%); padding: clamp(24px, 5vw, 42px);
  border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 28px;
  background: rgba(255, 249, 232, 0.97); box-shadow: 0 28px 75px rgba(3, 26, 23, 0.4); text-align: center;
}
.rush-panel--compact { max-width: 440px; }
.rush-chapter { display: block; color: #b16036; font-size: 11px; font-weight: 900; letter-spacing: 0.16em; }
.rush-panel h1 { font-family: Georgia, serif; margin: 8px 0 12px; font-size: clamp(38px, 9vw, 62px); line-height: 0.98; color: #143c34; }
.rush-panel h2 { font-family: Georgia, serif; margin: 6px 0 12px; color: #143c34; }
#rushOverScore { font-family: Georgia, serif; margin: 4px 0 8px; font-size: clamp(44px, 12vw, 72px); color: #143c34; line-height: 1; }
.rush-panel p { margin: 0 0 14px; font-size: 15px; line-height: 1.55; color: #52645b; }
.rush-badge {
  display: inline-block; margin: 4px 0 8px; padding: 6px 14px; border-radius: 999px;
  background: linear-gradient(135deg, var(--rush-gold), var(--rush-gold-soft)); color: #46350e;
  font-size: 11px; font-weight: 900; letter-spacing: 0.12em;
}
.rush-best, .rush-result { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 16px 0; }
.rush-result { grid-template-columns: repeat(4, 1fr); }
.rush-best span, .rush-result span { padding: 10px 6px; border-radius: 15px; background: #edf4e8; display: grid; gap: 2px; }
.rush-best small, .rush-result small { font-size: 9px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #728076; }
.rush-best b, .rush-result b { font-size: 17px; font-variant-numeric: tabular-nums; }
.rush-primary {
  width: 100%; min-height: 56px; margin-top: 6px; padding: 0 18px; border: 0; border-radius: 17px;
  background: linear-gradient(135deg, var(--rush-gold), var(--rush-gold-soft)); color: #46350e;
  display: flex; justify-content: space-between; align-items: center; font-size: 16px; font-weight: 900; cursor: pointer;
  box-shadow: 0 10px 26px rgba(198, 132, 24, 0.28);
}
.rush-primary:disabled { filter: grayscale(1); opacity: 0.65; }
.rush-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.rush-settings button, .rush-text {
  min-height: 46px; border: 1px solid #d8d6c6; border-radius: 13px; background: #fff;
  color: var(--rush-ink); font-weight: 800; font-size: 13px; cursor: pointer; padding: 0 10px;
}
.rush-text { width: 100%; margin-top: 8px; background: transparent; }
.rush-note { margin-top: 14px; display: grid; gap: 4px; color: #748078; font-size: 11px; text-align: left; }

/* ---------- Nyaris tegak ---------- */
@media (max-width: 680px) {
  .rush-stat b { font-size: 14px; }
  .rush-stat--wide b { font-size: 17px; }
  .rush-jump { width: 84px; height: 84px; }
  .rush-result { grid-template-columns: repeat(2, 1fr); }
  .rush-milestone { font-size: 34px; }
}
@media (max-width: 760px) and (orientation: landscape) {
  .rush-jump { width: 74px; height: 74px; }
  .rush-rail { bottom: calc(var(--rush-safe-bottom) + 10px); }
  .rush-toast { bottom: calc(var(--rush-safe-bottom) + 96px); }
}
@media (prefers-reduced-motion: reduce) {
  .rush-milestone.show, .rush-flash.show, .pop { animation: none; }
  .rush-toast { transition: none; }
}

.rush-shield {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: linear-gradient(135deg, #45cfbc, #9ffbe8); color: #0b3a35;
  font-size: 11px; font-weight: 900; letter-spacing: 0.06em;
  box-shadow: 0 6px 18px rgba(69, 207, 188, 0.36);
}

.rush-stars{color:#eca820;font-size:26px;letter-spacing:6px;margin:2px 0 6px}
.rush-line{margin:8px 0 0;font-size:11px;color:#74807a;text-align:center}
#rushTheme{font-size:13px}
/* Meter kebaikan: terisi dari perbuatan baik, memicu Mode Cahaya. */
.rush-kebaikan{display:flex;align-items:center;gap:8px;margin-top:6px}
.rush-kebaikan small{font-size:9px;font-weight:900;letter-spacing:.1em;color:var(--rush-gold-soft)}
.rush-kebaikan__bar{flex:1;height:7px;border-radius:6px;background:rgba(255,255,255,.18);overflow:hidden}
.rush-kebaikan__bar i{display:block;height:100%;width:0;border-radius:inherit;background:linear-gradient(90deg,var(--rush-gold),#fff0a5);transition:width .18s ease}
.rush-magnet{right:auto;left:50%;transform:translateX(-50%) translateY(34px)}

/* Pemilih tema awal: mulai dari tema pilihan, lalu lanjut ke tema berikutnya. */
.rush-themepick{margin-top:14px}
.rush-themepick small{display:block;font-size:9px;font-weight:900;letter-spacing:.12em;color:#6b7a70}
.rush-theme-chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:7px}
.rush-theme-chip{
  min-height:34px;padding:0 12px;border:1px solid #d8d6c6;border-radius:999px;
  background:#fff;color:#33413a;font:inherit;font-size:11px;font-weight:800;cursor:pointer;
  -webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation;
}
.rush-theme-chip.is-active{background:linear-gradient(135deg,var(--rush-gold),var(--rush-gold-soft));border-color:transparent;color:#46350e}
.rush-theme-blurb{margin:7px 0 0;font-size:11px;line-height:1.45;color:#6b7a70;min-height:16px}

