* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #2a6cff;
  --blue-dark: #1b55d6;
  --blue-soft: #eaf1ff;
  --ink: #0a0a0a;
  --bg: #ffffff;
  --soft: #f5f6f8;
  --line: #e7e9ee;
  --text: #14161a;
  --muted: #6b7280;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --font: "Unbounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html { background: #eceef2; }

body {
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

/* Selalu tampil seperti layar HP, juga di desktop */
.app {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}
@media (min-width: 480px) {
  .app { box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(15, 23, 42, 0.12); }
}

/* ---------- header ---------- */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.logo {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  font-size: 0.95rem;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

i.ph, i.ph-bold { vertical-align: -0.15em; }
.feedback i, #testMsg i, #cameraMsg i, #apiWarn i, .hint i { margin-right: 4px; }
.history .st i { margin-left: 4px; vertical-align: -0.12em; }

main { padding: 4px 14px calc(40px + env(safe-area-inset-bottom, 0px)); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 22px 20px 24px;
  min-height: 168px;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,0.85) 0 9%, transparent 10%),
    radial-gradient(circle at 24% 30%, rgba(255,255,255,0.75) 0 12%, transparent 13%),
    radial-gradient(circle at 78% 82%, rgba(255,255,255,0.8) 0 14%, transparent 15%),
    radial-gradient(circle at 62% 94%, rgba(255,255,255,0.7) 0 12%, transparent 13%),
    radial-gradient(circle at 96% 20%, rgba(255,255,255,0.55) 0 14%, transparent 15%),
    linear-gradient(160deg, #8bbcff 0%, #c9defc 55%, #eef4ff 100%);
}
.hero-icon {
  position: absolute;
  right: -6px;
  top: 14px;
  font-size: 5.6rem;
  color: #fff;
  transform: rotate(-18deg);
  filter: drop-shadow(0 10px 14px rgba(42, 108, 255, 0.35));
}
.hero-eyebrow { font-size: 0.62rem; font-weight: 400; margin-bottom: 10px; }
.hero h2 {
  position: relative;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.03em;
}
.hero-sub {
  position: relative;
  margin-top: 12px;
  font-size: 0.6rem;
  font-weight: 300;
  line-height: 1.6;
  max-width: 62%;
}

/* ---------- tab ---------- */

.tabs {
  display: flex;
  gap: 4px;
  margin: 14px 0;
  padding: 4px;
  border-radius: 999px;
  background: var(--soft);
}
.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 11px 4px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.62rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab.active { background: var(--ink); color: #fff; }

.tabview { display: none; }
.tabview.active { display: block; }

/* ---------- kamera ---------- */

#reader {
  border-radius: 28px;
  overflow: hidden;
  background: var(--blue-soft);
  min-height: 260px;
  border: 3px solid var(--blue-soft);
}
#reader video { border-radius: 24px; }

/* ---------- card ---------- */

.card {
  background: var(--soft);
  border-radius: 24px;
  padding: 18px;
  margin-top: 14px;
}
.card label, .modal-card label {
  display: block;
  font-size: 0.62rem;
  font-weight: 400;
  color: var(--muted);
  margin: 12px 0 6px;
}

/* kartu hasil scan: biru seperti kartu "Book a Ticket" */
.result {
  position: relative;
  overflow: hidden;
  background: var(--blue);
  color: #fff;
}
.result::after {
  content: '';
  position: absolute;
  top: -46px;
  right: -46px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #5fd0d6, #1f8fb0 70%);
  opacity: 0.85;
  pointer-events: none;
}
.result > * { position: relative; z-index: 1; }
.result label, .result .hint { color: rgba(255, 255, 255, 0.78); }

.raw {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.78);
  word-break: break-all;
  margin-bottom: 4px;
  max-width: 70%;
  max-height: 3.5em;
  overflow: hidden;
}
.raw::before { content: 'Ticket ID: '; }

.nama-peserta {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 8px 0 6px;
  min-height: 1.3em;
}

.hint.small { font-size: 0.56rem; margin-top: 8px; }

input {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
}
input:focus-visible, button:focus-visible {
  outline: 3px solid rgba(42, 108, 255, 0.45);
  outline-offset: 2px;
}

/* ---------- tombol ---------- */

.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

button.primary, button.secondary {
  flex: 1;
  min-width: 130px;
  padding: 15px 14px;
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 500;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
button.primary { background: var(--blue); color: #fff; }
button.primary:disabled { opacity: 0.5; }
button.secondary { background: var(--ink); color: #fff; }
button.small { min-width: 0; font-size: 0.6rem; padding: 11px 16px; flex: 0 0 auto; }

/* di atas kartu biru: tombol putih agar kontras */
.result button.primary { background: #fff; color: var(--blue-dark); }
.result button.secondary { background: rgba(255, 255, 255, 0.2); color: #fff; }

/* ---------- feedback ---------- */

.feedback {
  margin-top: 14px;
  padding: 16px;
  border-radius: 20px;
  font-size: 0.72rem;
  line-height: 1.6;
}
.feedback.ok { background: #e8f8ee; color: #0f5a2c; }
.feedback.warn { background: #fff4e0; color: #8a4b04; }
.feedback.err { background: #fdeceb; color: #9b1c1c; }

.hint { font-size: 0.62rem; color: var(--muted); margin-top: 12px; line-height: 1.7; font-weight: 300; }
.hint.first { margin-top: 0; }
.hint code { background: var(--soft); padding: 1px 6px; border-radius: 6px; font-size: 0.9em; }

/* ---------- riwayat ---------- */

.history { list-style: none; }
.history li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px 8px;
  background: var(--soft);
  border-radius: 20px;
  padding: 14px 16px;
  margin-bottom: 8px;
  font-size: 0.72rem;
  border-left: 5px solid var(--line);
}
.history li.ok { border-left-color: var(--ok); }
.history li.warn { border-left-color: var(--warn); }
.history li .no { font-weight: 600; }
.history li .st { text-align: right; font-size: 0.6rem; font-weight: 500; }
.history li.ok .st { color: var(--ok); }
.history li.warn .st { color: var(--warn); }
.history li .nama { color: var(--text); grid-column: 1 / 3; font-weight: 400; }
.history li .waktu { color: var(--muted); font-size: 0.56rem; font-weight: 300; grid-column: 1 / 4; }

/* ---------- modal (tetap selebar layar HP) ---------- */

.modal {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  background: rgba(10, 10, 10, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: 0;
}
.modal-card {
  background: #fff;
  border-radius: 28px 28px 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  width: 100%;
}
.modal-card h2 { font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; }

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
