/* ============================================================
   Roket Nova — gaya global (mobile-first, portrait)
   ============================================================ */

:root {
  color-scheme: dark;

  --bg:        #070b1c;
  --bg-2:      #0b1230;
  --panel:     rgba(16, 24, 56, 0.82);
  --panel-2:   rgba(12, 19, 46, 0.92);
  --border:    rgba(96, 128, 220, 0.22);
  --text:      #e7ecff;
  --muted:     #93a3ca;
  --accent:    #4ade80;
  --accent-2:  #22d3ee;
  --danger:    #f87171;
  --warn:      #fbbf24;
  --radius:    16px;
  --safe-t:    env(safe-area-inset-top, 0px);
  --safe-b:    env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(120% 80% at 50% -10%, #182b6b 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 55%, #04060f 100%);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* bintang latar */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 78% 8%,  #cfe0ff 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 33% 62%, #fff 50%, transparent 51%),
    radial-gradient(1.1px 1.1px at 88% 47%, #bcd0ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 84%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 22% 91%, #dbe6ff 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 66% 33%, #fff 50%, transparent 51%);
  opacity: .55;
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .35 } to { opacity: .7 } }

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

/* ---------------- Layout ---------------- */

.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: calc(20px + var(--safe-t)) 16px calc(20px + var(--safe-b));
}

.shell {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(18px + var(--safe-t)) 16px calc(28px + var(--safe-b));
}

.panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px 22px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}

.card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}

/* ---------------- Tipografi ---------------- */

h1 { font-size: 26px; line-height: 1.25; margin: 14px 0 8px; letter-spacing: -.4px; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
p  { margin: 0 0 14px; }
.muted { color: var(--muted); font-size: 14px; }
.tiny  { font-size: 12.5px; color: var(--muted); }

.brand {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 800; font-size: 17px; letter-spacing: -.2px;
}
.brand img { width: 30px; height: 30px; }

.mark { display: block; margin: 0 auto 6px; filter: drop-shadow(0 8px 24px rgba(74,222,128,.35)); }

/* ---------------- Tombol ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 15.5px; font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
  text-decoration: none;
  font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn + .btn { margin-top: 10px; }

.btn-primary { background: linear-gradient(135deg, #4ade80, #22c55e); color: #052e16; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: rgba(255,255,255,.06); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-danger { background: rgba(248,113,113,.14); color: #fca5a5; border-color: rgba(248,113,113,.35); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-sm { width: auto; padding: 9px 14px; font-size: 13.5px; border-radius: 11px; }

/* ---------------- Gate install PWA ---------------- */

.steps { text-align: left; margin: 4px 0 18px; padding: 0; list-style: none; counter-reset: s; }
.steps li {
  counter-increment: s;
  position: relative;
  padding: 10px 0 10px 42px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: 14.5px;
}
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: 9px;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(74,222,128,.16); color: var(--accent);
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
}

.tabs { display: flex; gap: 6px; background: rgba(255,255,255,.05); padding: 4px; border-radius: 12px; margin-bottom: 14px; }
.tabs button {
  flex: 1; padding: 9px 6px; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--muted); font: 600 13.5px inherit; font-family: inherit;
}
.tabs button[aria-selected="true"] { background: rgba(74,222,128,.16); color: var(--accent); }

.pill {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  background: rgba(74,222,128,.13); color: var(--accent);
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
}
.pill.warn { background: rgba(251,191,36,.14); color: var(--warn); }

/* ---------------- Statistik & papan peringkat ---------------- */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: rgba(255,255,255,.045);
  border: 1px solid var(--border);
  border-radius: 13px; padding: 12px 8px; text-align: center;
}
.stat b { display: block; font-size: 21px; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.stat span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.lb { list-style: none; margin: 0; padding: 0; }
.lb li {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 8px; border-radius: 11px;
  font-size: 14px;
}
.lb li + li { margin-top: 2px; }
.lb li.me { background: rgba(74,222,128,.1); outline: 1px solid rgba(74,222,128,.28); }
.lb .rk { width: 26px; text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb li:nth-child(1) .rk { color: #fbbf24; }
.lb li:nth-child(2) .rk { color: #cbd5e1; }
.lb li:nth-child(3) .rk { color: #d9a066; }
.lb .av { width: 30px; height: 30px; border-radius: 50%; background: #1b2650; object-fit: cover; flex: none; }
.lb .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .sc { font-weight: 800; font-variant-numeric: tabular-nums; }
.lb .lv { font-size: 11.5px; color: var(--muted); }

.who { display: flex; align-items: center; gap: 11px; text-align: left; }
.who img { width: 42px; height: 42px; border-radius: 50%; background: #1b2650; }
.who .n { font-weight: 700; }

/* ---------------- Google Sign-In ---------------- */

#gsiBox { display: flex; justify-content: center; min-height: 44px; }

/* ---------------- Layar game ---------------- */

body.game {
  overflow: hidden;
  position: fixed;
  inset: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: #04060f;
}

#c {
  display: block;
  width: 100%; height: 100%;
  touch-action: none;
}

.hud {
  position: fixed; top: 0; left: 0; right: 0;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px;
  pointer-events: none;
  z-index: 5;
  font-variant-numeric: tabular-nums;
}
.hud .box {
  background: rgba(6, 10, 26, .55);
  border: 1px solid rgba(120,150,230,.16);
  border-radius: 12px;
  padding: 7px 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hud .lab { font-size: 10px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.hud .val { font-size: 20px; font-weight: 800; line-height: 1.15; }
.hud .val.acc { color: var(--accent); }

#pauseBtn {
  pointer-events: auto;
  width: 42px; height: 42px; padding: 0;
  display: grid; place-items: center;
  background: rgba(6,10,26,.55);
  border: 1px solid rgba(120,150,230,.16);
  border-radius: 12px; color: var(--text);
  font-size: 16px; cursor: pointer;
}

.lvbar {
  position: fixed; left: 14px; right: 14px;
  top: calc(58px + var(--safe-t));
  height: 5px; border-radius: 3px;
  background: rgba(255,255,255,.09);
  overflow: hidden; z-index: 5; pointer-events: none;
}
.lvbar i { display: block; height: 100%; width: 0; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s ease; }

.overlay {
  position: fixed; inset: 0;
  display: none; align-items: center; justify-content: center;
  padding: calc(20px + var(--safe-t)) 18px calc(20px + var(--safe-b));
  background: rgba(4, 7, 20, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
}
.overlay.show { display: flex; }
.overlay .panel { animation: pop .28s cubic-bezier(.2,.9,.3,1.3); max-height: 92dvh; overflow-y: auto; }
@keyframes pop { from { transform: scale(.9); opacity: 0 } to { transform: scale(1); opacity: 1 } }

.bigscore { font-size: 54px; font-weight: 800; line-height: 1; letter-spacing: -2px; margin: 6px 0 2px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(26px + var(--safe-b));
  background: rgba(10,16,38,.94);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 18px; border-radius: 12px;
  font-size: 14px; z-index: 30;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

.levelup {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  pointer-events: none; z-index: 8; opacity: 0;
}
.levelup.show { animation: lvup 1.5s ease forwards; }
.levelup div {
  font-size: 36px; font-weight: 800; letter-spacing: -1px;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(74,222,128,.6);
  text-align: center;
}
.levelup div small { display: block; font-size: 14px; color: var(--text); font-weight: 600; letter-spacing: 0; margin-top: 4px; }
@keyframes lvup {
  0%   { opacity: 0; transform: scale(.7) }
  18%  { opacity: 1; transform: scale(1.06) }
  70%  { opacity: 1; transform: scale(1) }
  100% { opacity: 0; transform: scale(1.1) }
}

.hidden { display: none !important; }
