:root {
  --navy-950: #060b16;
  --navy-900: #0a1526;
  --navy-800: #0f2140;
  --navy-700: #16305c;
  --navy-600: #1d3f78;

  --oren-400: #ffab5c;
  --oren-500: #fb8a24;
  --oren-600: #f2720a;

  --kelabu-050: #f4f6fa;
  --kelabu-200: #d7deeb;
  --kelabu-300: #b7c1d6;
  --kelabu-600: #8592ad;

  --hijau: #34d399;
  --hijau-bg: rgba(52, 211, 153, 0.16);
  --merah: #ff6b6b;
  --merah-bg: rgba(255, 107, 107, 0.16);

  --glass-bg: linear-gradient(165deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.025));
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-shadow: 0 12px 34px -10px rgba(2, 6, 16, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.14);

  --teks: var(--kelabu-050);
  --teks-muted: var(--kelabu-300);
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--teks);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  position: relative;
  overflow-x: hidden;
  background: var(--navy-950);
}

button { font-family: inherit; }

/* Latar liquid: blob biru + oren yg blur besar di belakang panel kaca */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 32% at 12% 8%, rgba(29, 63, 120, 0.85), transparent 70%),
    radial-gradient(32% 30% at 92% 18%, rgba(251, 138, 36, 0.35), transparent 70%),
    radial-gradient(45% 40% at 50% 100%, rgba(15, 33, 64, 0.9), transparent 70%),
    linear-gradient(180deg, var(--navy-950), var(--navy-900) 55%, var(--navy-950));
}

/* ---------- Splash (pelancaran app) ---------- */

.splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background:
    radial-gradient(38% 32% at 12% 8%, rgba(29, 63, 120, 0.85), transparent 70%),
    radial-gradient(32% 30% at 92% 18%, rgba(251, 138, 36, 0.35), transparent 70%),
    var(--navy-950);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.splash--hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash__icon {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.5));
  animation: splashNaik 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes splashNaik {
  from { opacity: 0; transform: translateY(8px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.splash__title {
  margin: 22px 0 2px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  animation: splashNaik 0.6s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.splash__subtitle {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--oren-400);
  animation: splashNaik 0.6s 0.14s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.splash__loader {
  display: flex;
  gap: 6px;
  margin-top: 30px;
}

.splash__loader span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--kelabu-600);
  animation: splashTitik 1s ease-in-out infinite;
}

.splash__loader span:nth-child(2) { animation-delay: 0.15s; }
.splash__loader span:nth-child(3) { animation-delay: 0.3s; }

@keyframes splashTitik {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); background: var(--oren-500); }
}

/* ---------- App bar (kaca) ---------- */

.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(10, 21, 38, 0.6);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--glass-border);
  color: #fff;
}

.app-bar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-bar__logo-jpj {
  width: 30px;
  height: 30px;
  object-fit: contain;
  background: var(--kelabu-050);
  border-radius: 7px;
  padding: 3px;
  flex-shrink: 0;
}

.app-bar__divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.app-bar__logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}

.app-bar__text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.app-bar__text strong {
  font-size: 15px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-bar__text span {
  font-size: 11.5px;
  color: var(--kelabu-300);
}

.btn-install {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-install::after {
  content: "";
  position: absolute;
  inset: 0 0 55% 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent);
}

.btn-install:hover { background: rgba(255, 255, 255, 0.16); }
.btn-install:active { transform: scale(0.92); }

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

main {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  animation: naikMasuk 0.4s ease both;
}

@keyframes naikMasuk {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Gate GPS ---------- */

.gate {
  padding: 34px 22px;
  text-align: center;
}

.gate__icon {
  position: relative;
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-600), var(--oren-500));
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(251, 138, 36, 0.5);
}

.gate__icon--pulse::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--oren-500);
  opacity: 0.55;
  animation: denyut 1.8s ease-out infinite;
}

@keyframes denyut {
  0% { transform: scale(0.85); opacity: 0.55; }
  100% { transform: scale(1.35); opacity: 0; }
}

.gate h2 {
  margin: 0 0 8px;
  font-size: 18px;
  letter-spacing: 0.1px;
  color: #fff;
}

.gate p {
  font-size: 14px;
  color: var(--teks-muted);
  margin: 0 0 22px;
  line-height: 1.55;
}

/* ---------- Kawasan imbasan ---------- */

.scan-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reader-wrap {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #000;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.reader, .reader video, .reader canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

.reader > div { border: none !important; }

.viewfinder {
  position: absolute;
  inset: 12%;
  pointer-events: none;
}

.viewfinder__corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 3px solid var(--oren-500);
  filter: drop-shadow(0 0 6px rgba(251, 138, 36, 0.75));
}

.viewfinder__corner--tl { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 10px 0 0 0; }
.viewfinder__corner--tr { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 10px 0 0; }
.viewfinder__corner--bl { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 10px; }
.viewfinder__corner--br { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 10px 0; }

.viewfinder__laser {
  position: absolute;
  left: 4%;
  right: 4%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--oren-400), transparent);
  box-shadow: 0 0 10px 2px rgba(251, 138, 36, 0.85);
  animation: imbas 2.2s ease-in-out infinite;
}

@keyframes imbas {
  0% { top: 4%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 94%; opacity: 0; }
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: var(--teks-muted);
  margin: 0 8px;
  font-size: 13.5px;
}

.status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--oren-500);
  box-shadow: 0 0 8px 1px rgba(251, 138, 36, 0.7);
  flex-shrink: 0;
  animation: hidupMati 1.4s ease-in-out infinite;
}

@keyframes hidupMati {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

/* ---------- Kad hasil ---------- */

.result-card {
  padding: 30px 20px;
  text-align: center;
  animation: popMasuk 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes popMasuk {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.result-card__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.result-card.ok .result-card__icon { background: var(--hijau-bg); color: var(--hijau); }
.result-card.ok .result-card__icon::before { content: "\2713"; }

.result-card.error .result-card__icon { background: var(--merah-bg); color: var(--merah); }
.result-card.error .result-card__icon::before { content: "\0021"; }

.result-card__text {
  font-size: 15px;
  margin: 0 0 20px;
  word-break: break-word;
  color: var(--teks);
}

/* ---------- Butang (liquid glass) ---------- */

.btn-primary, .btn-secondary {
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: 16px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--oren-500), var(--oren-600));
  color: #fff;
  box-shadow: 0 10px 24px -8px rgba(242, 114, 10, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0 0 60% 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent);
  pointer-events: none;
}

.btn-primary span { position: relative; }

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -8px rgba(242, 114, 10, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-primary:disabled { opacity: 0.55; cursor: default; transform: none; }

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover { background: rgba(255, 255, 255, 0.14); }
.btn-secondary:active { transform: scale(0.98); }

.btn-text {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--teks-muted);
  font-size: 13.5px;
  padding: 12px 0 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Footer ---------- */

.app-foot {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 8px auto 0;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--glass-border);
  font-size: 11.5px;
  color: var(--kelabu-600);
}

.app-foot a {
  color: var(--kelabu-300);
  text-decoration: none;
}

.app-foot a:hover { text-decoration: underline; }

.app-foot span:last-child {
  flex-shrink: 0;
  opacity: 0.85;
}

/* ---------- Modal (bottom sheet - panduan iOS) ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 14, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  animation: fadeIn 0.2s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal__box {
  background: linear-gradient(165deg, rgba(20, 33, 58, 0.96), rgba(10, 18, 33, 0.98));
  color: var(--teks);
  width: 100%;
  max-width: 480px;
  border: 1px solid var(--glass-border);
  border-bottom: none;
  backdrop-filter: blur(20px) saturate(180%);
  border-radius: 24px 24px 0 0;
  padding: 12px 22px calc(24px + env(safe-area-inset-bottom));
  animation: naikDariBawah 0.3s cubic-bezier(0.32, 0.72, 0, 1) both;
}

@keyframes naikDariBawah {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal__handle {
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 4px;
  background: var(--glass-border);
  margin: 0 auto 16px;
}

.modal__box h2 {
  margin-top: 0;
  font-size: 18px;
  color: #fff;
}

.modal__box ol {
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.7;
}

.modal__note {
  font-size: 13px;
  color: var(--teks-muted);
}

.ios-icon { font-size: 14px; }

/* ---------- Modal (tengah skrin - promosi pasang app) ---------- */

.modal--center {
  align-items: center;
  padding: 20px;
}

.modal__box--center {
  border: 1px solid var(--glass-border);
  border-radius: 26px;
  text-align: center;
  padding: 30px 24px 24px;
  animation: popMasuk 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.promo__icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  margin-bottom: 14px;
  box-shadow: var(--glass-shadow);
}

.modal__box--center h2 {
  font-size: 18px;
  margin: 0 0 20px;
}

.promo__lede {
  font-size: 13.5px;
  color: var(--teks-muted);
  margin: 0 0 18px;
  line-height: 1.5;
}

.promo__list {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.promo__list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--teks);
}

.promo__list-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
