/* ================================================
   PosturAid — Clean Light Design System
   Font: Inter (Google Fonts — loaded in HTML)
   ================================================ */

/* ---- Variables ---- */
:root {
  --accent:       #6366F1;
  --accent-2:     #818CF8;
  --accent-glow:  rgba(99,102,241,.15);
  --accent-dark:  #4F46E5;
  --green:        #16A34A;
  --green-dim:    rgba(22,163,74,.1);
  --amber:        #D97706;
  --amber-dim:    rgba(217,119,6,.1);
  --red:          #DC2626;
  --red-dim:      rgba(220,38,38,.1);
  --blue:         #2563EB;
  --blue-dim:     rgba(37,99,235,.1);

  /* Light palette */
  --bg:           #F7F8FA;
  --surface-1:    #FFFFFF;
  --surface-2:    #F1F3F7;
  --surface-3:    #E5E8EF;
  --border:       rgba(0,0,0,.07);
  --border-hi:    rgba(0,0,0,.13);

  /* Text */
  --text-1:       #0F172A;
  --text-2:       #334155;
  --text-3:       #64748B;
  --text-4:       #94A3B8;

  --r-sm:        10px;
  --r-md:        14px;
  --r-lg:        18px;
  --r-xl:        22px;
  --r-2xl:       30px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.04);
  --shadow:      0 8px 20px rgba(0,0,0,.06), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg:   0 12px 32px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --shadow-accent: 0 8px 24px var(--accent-glow);

  --nav-h: 76px;
  --header-h: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-2);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .h-title, .modal-title, .auth-title {
  font-family: 'Outfit', 'Inter', sans-serif;
  color: var(--text-1);
}

/* ---- Interactions ---- */
button, .nav-item, .card, .btn-icon, .ai-btn, .chip, [onclick] {
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}
button:active, .nav-item:active, .card:active:not(.no-active), .btn-icon:active, .chip:active {
  transform: scale(0.97);
  opacity: 0.85;
}

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  bottom: calc(90px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 40px);
  max-width: 390px;
  pointer-events: none;
}
.toast {
  background: var(--text-1);
  color: #fff;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.2) forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

/* ---- App Shell ---- */
.app {
  max-width: 430px;
  margin: 0 auto;
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 20px 60px rgba(0,0,0,.06);
}

.page {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(100px + var(--safe-bottom));
  position: relative;
  z-index: 1;
}

/* ---- Bottom Nav ---- */
.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: calc(72px + var(--safe-bottom));
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  z-index: 9999;
  padding: 10px 8px 0;
  padding-bottom: var(--safe-bottom);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  color: var(--text-3);
  transition: color .2s;
  flex: 1;
  position: relative;
}
.nav-item svg { transition: transform .2s; }
.nav-item span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1px;
}
.nav-item.active { color: var(--accent); }
.nav-item.active svg { transform: translateY(-1px); }
.nav-item.active::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}

/* ---- Header ---- */
.header {
  flex-shrink: 0;
  width: 100%;
  height: var(--header-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 900;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.header.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,.05);
}
.header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.2px;
}
.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 40px;
}

/* ---- Icon Button ---- */
.btn-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  transition: background 0.15s;
}
.btn-icon:active { background: var(--surface-3); }

/* ---- Cards ---- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.15s;
}
.card:active { transform: scale(0.985); }
.card-featured {
  box-shadow: var(--shadow);
  border-color: rgba(0,0,0,.05);
}

/* ---- Sections ---- */
.sec { padding: 0 16px; margin-bottom: 20px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sec-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ---- Badges ---- */
.badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
}
.badge-sehat   { background: var(--green-dim); color: var(--green); }
.badge-warmup  { background: var(--amber-dim); color: var(--amber); }
.badge-resiko  { background: var(--red-dim);   color: var(--red); }

.badge-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.badge-latihan    { background: rgba(22,163,74,.1);   color: var(--green); }
.badge-anatomi    { background: rgba(99,102,241,.1);  color: var(--accent); }
.badge-pencegahan { background: rgba(217,119,6,.1);   color: var(--amber); }
.badge-umum       { background: rgba(37,99,235,.1);   color: var(--blue); }

/* ---- AI Card ---- */
.ai-card {
  background: linear-gradient(135deg, rgba(99,102,241,.07) 0%, rgba(129,140,248,.05) 100%);
  border: 1px solid rgba(99,102,241,.15);
  border-radius: var(--r-lg);
  padding: 18px;
  color: var(--text-1);
  position: relative;
  overflow: hidden;
}
.ai-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.ai-icon-wrap {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.ai-title { font-size: 14px; font-weight: 700; color: var(--text-1); }
.ai-body  { font-size: 13px; line-height: 1.65; color: var(--text-2); }
.ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 16px;
  background: var(--surface-1);
  border: 1px solid var(--border-hi);
  border-radius: 50px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.ai-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Score Circle ---- */
.score-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 8px;
}
.score-ring {
  position: relative;
  width: 176px;
  height: 176px;
}
.score-ring svg { display: block; }
.score-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.score-num   { font-size: 46px; font-weight: 800; color: var(--text-1); line-height: 1; letter-spacing: -2px; }
.score-denom { font-size: 12px; color: var(--text-3); font-weight: 500; }
.score-lbl   { font-size: 12px; font-weight: 700; margin-top: 2px; }

/* ---- Breakdown ---- */
.breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bd-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.bd-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.bd-label { font-size: 11px; color: var(--text-3); font-weight: 500; margin-bottom: 3px; }
.bd-status { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--text-1); }
.bd-status.excellent { color: var(--green); }
.bd-status.good      { color: var(--blue); }
.bd-status.improv    { color: var(--amber); }
.bd-status.poor      { color: var(--red); }
.bd-bar  { height: 4px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bd-fill { height: 100%; border-radius: 4px; transition: width .9s cubic-bezier(.4,0,.2,1); }

/* ---- Stat cards ---- */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.stat-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; font-size: 18px; }
.stat-lbl  { font-size: 9px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.stat-val  { font-size: 28px; font-weight: 800; color: var(--text-1); line-height: 1; letter-spacing: -1px; }
.stat-unit { font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* ---- Chart ---- */
.chart-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.chart-top   { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.chart-score-lbl { font-size: 12px; color: var(--text-3); font-weight: 500; margin-bottom: 4px; }
.chart-avg { font-size: 40px; font-weight: 800; color: var(--text-1); letter-spacing: -2px; line-height: 1; display: flex; align-items: baseline; gap: 4px; }
.chart-avg span { font-size: 14px; color: var(--text-3); font-weight: 500; letter-spacing: 0; }
.chart-trend { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.chart-trend.up   { background: var(--green-dim); color: var(--green); }
.chart-trend.down { background: var(--red-dim);   color: var(--red); }
.chart-legend { display: flex; gap: 14px; margin: 8px 0 14px; font-size: 11px; color: var(--text-3); }
.chart-legend span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 10px; height: 3px; border-radius: 3px; display: inline-block; }

/* ---- Period tabs ---- */
.period-tabs { display: flex; gap: 6px; }
.period-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  border: 1px solid var(--border);
  background: transparent;
  transition: all .15s;
  cursor: pointer;
}
.period-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---- History ---- */
.hist-list { padding: 4px 0; }
.hist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity .15s;
}
.hist-item:last-child { border-bottom: none; }
.hist-item:hover { opacity: .75; }
.hist-date { text-align: center; width: 40px; flex-shrink: 0; }
.hist-day   { font-size: 20px; font-weight: 800; color: var(--accent); line-height: 1; }
.hist-month { font-size: 9px; font-weight: 600; text-transform: uppercase; color: var(--text-3); letter-spacing: .4px; }
.hist-icon-wrap { width: 38px; height: 38px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hist-info { flex: 1; min-width: 0; }
.hist-title { font-size: 14px; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-desc  { font-size: 11px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-right { text-align: right; flex-shrink: 0; }
.hist-score { font-size: 22px; font-weight: 800; color: var(--text-1); line-height: 1; }

/* ---- Search ---- */
.search-wrap { padding: 4px 16px 12px; }
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 10px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s;
}
.search-box:focus-within { border-color: var(--accent); }
.search-box input { flex: 1; border: none; outline: none; font-size: 14px; font-family: inherit; color: var(--text-1); background: transparent; }
.search-box input::placeholder { color: var(--text-3); }

/* ---- Chips ---- */
.chips { display: flex; gap: 8px; padding: 0 16px 14px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-3);
  transition: all .15s;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip:not(.active):hover { border-color: var(--border-hi); color: var(--text-2); }

/* ---- Featured article ---- */
.feat-card {
  border-radius: var(--r-xl);
  overflow: hidden;
  height: 200px;
  position: relative;
  cursor: pointer;
  margin: 0 16px 14px;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.feat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.feat-inner {
  position: absolute;
  inset: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(to top, rgba(0,0,0,.8) 0%, rgba(0,0,0,.1) 60%);
}
.feat-badge { display: inline-block; background: rgba(255,255,255,.2); backdrop-filter: blur(4px); color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .6px; padding: 3px 10px; border-radius: 20px; margin-bottom: 8px; text-transform: uppercase; border: 1px solid rgba(255,255,255,.25); }
.feat-title { color: #fff; font-size: 17px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.feat-meta  { color: rgba(255,255,255,.7); font-size: 11px; display: flex; align-items: center; gap: 8px; }

/* ---- Journal list ---- */
.journal-item { padding: 14px 0; border-bottom: 1px solid var(--border); cursor: pointer; transition: opacity .15s; }
.journal-item:last-child { border-bottom: none; }
.journal-item:hover { opacity: .75; }
.j-type-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.j-type { display: flex; align-items: center; gap: 5px; font-size: 9px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--accent); }
.j-date { font-size: 11px; color: var(--text-3); }
.j-title { font-size: 13px; font-weight: 600; color: var(--text-1); line-height: 1.45; }
.j-source-row { display: flex; gap: 16px; margin-top: 8px; }
.j-source-item { display: flex; flex-direction: column; gap: 1px; }
.j-source-lbl  { font-size: 8px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--text-3); }
.j-source-val  { font-size: 11px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; gap: 3px; }

/* ---- Article grid ---- */
.art-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.art-mini { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm); transition: all .2s; }
.art-mini:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.art-thumb { height: 96px; display: flex; align-items: flex-end; padding: 8px; position: relative; }
.art-info { padding: 10px 12px 12px; }
.art-title { font-size: 12px; font-weight: 600; color: var(--text-1); line-height: 1.4; margin-bottom: 6px; }
.art-foot  { display: flex; gap: 8px; font-size: 10px; color: var(--text-3); }

/* ---- Tip bar ---- */
.tip-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin: 0 16px 14px;
  box-shadow: var(--shadow-sm);
}
.tip-icon-w { width: 38px; height: 38px; background: var(--accent-glow); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.tip-lbl  { font-size: 9px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--accent); margin-bottom: 3px; }
.tip-text { font-size: 13px; line-height: 1.5; color: var(--text-2); }

/* ---- Modal ---- */
.modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-bg.open { opacity: 1; pointer-events: all; }
.modal-sheet {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  padding: 20px 20px 32px;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,.12);
}
.modal-bg.open .modal-sheet { transform: translateY(0); }
.modal-handle { width: 36px; height: 4px; background: var(--surface-3); border-radius: 2px; margin: 0 auto 20px; }
.modal-art-badge { margin-bottom: 12px; }
.modal-title { font-size: 20px; font-weight: 700; color: var(--text-1); line-height: 1.35; margin-bottom: 8px; }
.modal-meta  { font-size: 12px; color: var(--text-3); margin-bottom: 16px; }
.modal-body  { font-size: 14px; color: var(--text-2); line-height: 1.8; }
.modal-body h3 { font-size: 15px; font-weight: 700; color: var(--text-1); margin: 18px 0 8px; }
.modal-body p  { margin-bottom: 12px; }
.modal-body ul { padding-left: 18px; margin: 8px 0; }
.modal-body li { margin-bottom: 6px; }
.modal-body b  { color: var(--text-1); font-weight: 600; }
.modal-doi { margin-top: 16px; font-size: 11px; color: var(--text-3); padding: 10px; background: var(--surface-2); border-radius: 8px; }

/* ====================================================
   SCAN PAGE — full-screen camera (stays dark)
   ==================================================== */
.scan-wrap { position: absolute; inset: 0; background: #000; overflow: hidden; }
#videoEl  { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .9; }
#cvOutput { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* Body guide */
.guide-frame {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -52%);
  width: 140px; height: 270px;
  border: 1.5px solid rgba(255,255,255,.5);
  border-radius: 70px;
  pointer-events: none;
  z-index: 10;
}
.guide-head {
  position: absolute;
  top: -38px; left: 50%;
  transform: translateX(-50%);
  width: 58px; height: 58px;
  border: 1.5px solid rgba(255,255,255,.5);
  border-radius: 50%;
}
.guide-vline {
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 1px;
  background: rgba(255,255,255,.2);
}
.guide-frame::before,
.guide-frame::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-color: rgba(255,255,255,.8);
  border-style: solid;
}
.guide-frame::before { top: 10px; left: 10px; border-width: 2px 0 0 2px; border-radius: 4px 0 0 0; }
.guide-frame::after  { bottom: 10px; right: 10px; border-width: 0 2px 2px 0; border-radius: 0 0 4px 0; }

/* Scan top */
.scan-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 16px;
  background: linear-gradient(to bottom, rgba(0,0,0,.6) 0%, transparent 100%);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 20;
}
.track-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.12);
  padding: 7px 14px;
  border-radius: 50px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.track-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse-dot 1.5s infinite; }
.track-dot.off { background: rgba(255,255,255,.4); animation: none; }
@keyframes pulse-dot {
  0%,100%{ opacity:1; }
  50%{ opacity:.5; }
}

/* Live score */
.live-box {
  position: absolute;
  right: 12px;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 12px;
  color: #fff;
  text-align: center;
  z-index: 20;
  min-width: 72px;
  display: none;
  top: 80px;
}
.live-lbl { font-size: 9px; font-weight: 700; letter-spacing: .7px; opacity: .5; text-transform: uppercase; }
.live-num { font-size: 34px; font-weight: 800; line-height: 1.05; letter-spacing: -1px; }
.live-bars { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.live-bar-r { display: flex; align-items: center; gap: 5px; }
.live-bar-nm  { font-size: 9px; opacity: .6; width: 22px; text-align: left; }
.live-bar-tr  { flex: 1; height: 3px; background: rgba(255,255,255,.12); border-radius: 3px; overflow: hidden; }
.live-bar-fill{ height: 100%; border-radius: 3px; transition: width .4s ease, background .3s; }

/* Guidance */
.guidance {
  position: absolute;
  bottom: calc(110px + var(--safe-bottom));
  left: 16px; right: 16px;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 12px 16px;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  z-index: 20;
}

/* Capture */
.capture-row {
  position: absolute;
  bottom: calc(30px + var(--safe-bottom));
  left: 0; right: 0;
  text-align: center;
  z-index: 20;
  padding: 0 24px;
}
.capture-btn {
  width: 100%;
  padding: 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 4px 20px rgba(99,102,241,.5);
  transition: all .2s;
  text-transform: uppercase;
}
.capture-btn:active   { transform: scale(.97); }
.capture-btn:disabled { background: rgba(255,255,255,.15); box-shadow: none; color: rgba(255,255,255,.4); }
.capture-btn.ready    { background: var(--green); box-shadow: 0 4px 20px rgba(22,163,74,.5); animation: ready-pulse 2s infinite; }
@keyframes ready-pulse {
  0%,100%{ box-shadow: 0 4px 20px rgba(22,163,74,.4); }
  50%{ box-shadow: 0 4px 30px rgba(22,163,74,.7); }
}

/* Permission screen */
.perm-wrap {
  position: absolute;
  inset: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 40px 28px;
  text-align: center;
}
.perm-ring {
  width: 90px; height: 90px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 8px 28px var(--accent-glow);
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%,100%{ transform: translateY(0); }
  50%{ transform: translateY(-6px); }
}
.perm-wrap h2 { color: var(--text-1); font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.perm-wrap p  { color: var(--text-3); font-size: 14px; line-height: 1.65; max-width: 280px; }
.perm-btn {
  margin-top: 28px;
  padding: 14px 44px;
  background: var(--accent);
  color: #fff;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: all .15s;
}
.perm-btn:active { transform: scale(.97); }

/* Saving overlay */
.saving-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.saving-overlay p { color: #fff; font-size: 14px; font-weight: 500; }

/* Spinner */
.spin {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Spinner dark variant */
.spin-dark {
  width: 32px; height: 32px;
  border: 2.5px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ====================================================
   ANALISIS PAGE
   ==================================================== */
.anat-card {
  border-radius: var(--r-xl);
  overflow: hidden;
  height: 170px;
  position: relative;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.anat-inner {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--surface-1) 0%, rgba(99,102,241,0.08) 100%);
  padding: 24px 20px;
  display: flex;
  align-items: flex-end;
}
.anat-svg { position: absolute; right: 0; top: 0; bottom: 0; width: 130px; display: flex; align-items: center; justify-content: center; opacity: .4; }
.anat-badge { display: inline-block; background: var(--accent); color: #fff; font-size: 8px; font-weight: 800; letter-spacing: .8px; padding: 4px 10px; border-radius: 50px; margin-bottom: 10px; text-transform: uppercase; }
.anat-title { color: var(--text-1); font-size: 19px; font-weight: 800; line-height: 1.25; font-family: 'Outfit', sans-serif; }

/* Score hero */
.score-hero-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px 20px 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

/* Action buttons */
.action-btn-primary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  padding: 14px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 14px;
  gap: 6px;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: all .15s;
}
.action-btn-primary:hover { opacity: .9; }
.action-btn-secondary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-2);
  padding: 14px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--border-hi);
  gap: 6px;
  transition: all .15s;
}
.action-btn-secondary:hover { background: var(--surface-3); }

/* ====================================================
   JEJAK PAGE
   ==================================================== */
.jejak-header { padding: 20px 16px 8px; display: flex; justify-content: space-between; align-items: flex-start; }
.jejak-eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.jejak-title  { font-size: 28px; font-weight: 800; color: var(--text-1); line-height: 1.1; letter-spacing: -1px; }

/* ====================================================
   LITERASI PAGE
   ==================================================== */
.literasi-header { padding: 20px 16px 14px; }
.literasi-eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.literasi-title   { font-size: 26px; font-weight: 800; color: var(--text-1); line-height: 1.1; letter-spacing: -1px; }

/* ====================================================
   HOME PAGE
   ==================================================== */
.h-topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 0; }
.h-brand { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--text-1); letter-spacing: -.2px; }
.h-brand-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.h-date { font-size: 12px; font-weight: 500; color: var(--text-3); }

/* Score section */
.h-score-section { padding: 20px 16px; }
.h-name { font-size: 13px; font-weight: 500; color: var(--text-3); margin-bottom: 18px; }
.h-score-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.h-score-left { flex: 1; }
.h-score-num { font-size: 68px; font-weight: 800; line-height: 1; letter-spacing: -4px; }
.h-score-denom { font-size: 15px; color: var(--text-3); font-weight: 500; margin-top: 2px; letter-spacing: 0; }
.h-score-status { font-size: 14px; font-weight: 600; color: var(--text-2); margin-top: 10px; }
.h-score-time { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.h-score-ring-wrap { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.h-ring-inner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.h-ring-num { font-size: 22px; font-weight: 800; letter-spacing: -1px; }

/* Body part bars */
.h-parts { display: flex; flex-direction: column; gap: 9px; margin-bottom: 20px; }
.h-part { display: flex; align-items: center; gap: 10px; }
.h-part-lbl { font-size: 11px; font-weight: 500; color: var(--text-3); width: 48px; flex-shrink: 0; }
.h-part-track { flex: 1; height: 5px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.h-part-fill { height: 100%; border-radius: 5px; transition: width 1s cubic-bezier(.4,0,.2,1); }
.h-part-val { font-size: 12px; font-weight: 700; width: 26px; text-align: right; flex-shrink: 0; color: var(--text-1); }

/* Action buttons */
.h-actions { display: flex; gap: 10px; }
.h-btn-scan {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: all .15s;
}
.h-btn-scan:active { transform: scale(.97); }
.h-btn-detail {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  color: var(--text-2);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  transition: all .15s;
}
.h-btn-detail:hover { background: var(--surface-3); }

/* Empty state */
.h-empty { padding: 10px 0 8px; }
.h-empty-title { font-size: 26px; font-weight: 800; color: var(--text-1); letter-spacing: -.6px; margin-bottom: 8px; }
.h-empty-sub { font-size: 13px; color: var(--text-3); line-height: 1.65; max-width: 280px; }

/* Week strip */
.h-week-strip {
  margin: 0 16px 16px;
  padding: 16px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.h-week-label { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px; }
.h-week-bars { display: flex; align-items: flex-end; justify-content: space-between; gap: 4px; height: 48px; margin-bottom: 10px; }
.h-week-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; }
.h-week-col { flex: 1; display: flex; align-items: flex-end; width: 100%; justify-content: center; }
.h-week-bar { width: 80%; max-width: 16px; border-radius: 3px 3px 0 0; transition: height .5s ease; }
.h-week-dn { font-size: 9px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .2px; }
.h-week-dn.today { color: var(--accent); font-weight: 700; }
.h-week-meta { display: flex; align-items: center; gap: 14px; font-size: 11px; color: var(--text-3); padding-top: 10px; border-top: 1px solid var(--border); }
.h-week-meta strong { color: var(--text-1); }
.h-week-link { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--accent); }

/* Tip card */
.h-tip-card {
  margin: 0 16px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-lg);
  padding: 14px 14px 14px 12px;
  box-shadow: var(--shadow-sm);
}
.h-tip-icon { width: 30px; height: 30px; background: var(--accent-glow); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.h-tip-body { flex: 1; min-width: 0; }
.h-tip-title { font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--accent); margin-bottom: 3px; }
.h-tip-text  { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.h-tip-arrow { color: var(--text-3); flex-shrink: 0; margin-top: 4px; }

/* ---- Utilities ---- */
.px-16  { padding-left: 16px; padding-right: 16px; }
.mb-10  { margin-bottom: 10px; }
.mb-14  { margin-bottom: 14px; }
.mt-10  { margin-top: 10px; }
.mt-14  { margin-top: 14px; }
.w-full { width: 100%; }
.flex   { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8  { gap: 8px; }
.text-center { text-align: center; }
.fw-700 { font-weight: 700; }
.fs-13  { font-size: 13px; }
.c-muted{ color: var(--text-3); }
