/* Cryptocium Analis — tampilan mengikuti app Cryptocium (kanvas hitam, kartu
   #161616, aksen biru, Manrope untuk angka/judul, Inter untuk isi). Sengaja
   satu tema gelap, sama seperti app-nya. */

@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("fonts/Manrope-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("fonts/Manrope-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #000000;
  --card: #161616;
  --elev: #1f1f1f;
  --cell: #242424;
  --line: #1c1c1c;
  --line-strong: #292929;
  --control: #6e6e6e;
  --fg: #ffffff;
  --text: #d4d4d4;
  --muted: #8b8b8b;
  --blue: #0080ff;
  --blue-fill: #006fdd;
  --blue-soft: rgba(0, 128, 255, 0.14);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.13);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.13);
  --indigo: #818cf8;
  --indigo-soft: rgba(129, 140, 248, 0.14);
  --orange: #f97316;
  --orange-soft: rgba(249, 115, 22, 0.14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --slate: #94a3b8;
  --slate-soft: rgba(148, 163, 184, 0.14);

  --radius: 16px;
  --radius-sm: 10px;
  --gutter: 16px;
  --tabbar-h: 64px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* Landscape di HP bernotch: isi tak boleh masuk area notch/sudut membulat.
     Di potret nilainya 0 → padding mendatar tetap sebesar --gutter. */
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --pad-l: max(var(--gutter), var(--safe-l));
  --pad-r: max(var(--gutter), var(--safe-r));
  --display: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
/* Atribut hidden harus menang atas display milik kelas (.icon-btn dsb). */
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.up, .tile .value.up, .level .v.up { color: var(--green); }
.down, .tile .value.down, .level .v.down { color: var(--red); }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.inline-ico { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 24px; text-align: center; }

/* ---------- kerangka ---------- */
.boot, .center-screen {
  min-height: 100dvh; display: grid; place-items: center; align-content: center;
  gap: 12px; padding: 24px; text-align: center;
}
.boot img { width: 72px; height: 72px; border-radius: 18px; animation: pulse 1.6s ease-in-out infinite; }
.center-logo { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 6px; }
.center-text { max-width: 340px; margin: 0 auto 8px; }

.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-t) + 8px) var(--pad-r) 8px var(--pad-l);
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  /* Garis hanya muncul saat konten lewat di belakang header (lihat .scrolled). */
  border-bottom: 1px solid transparent;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}
.topbar.scrolled {
  border-bottom-color: var(--line-strong);
  background: rgba(0, 0, 0, 0.94);
}
/* Tinggi TETAP: header tak ikut berubah walau judul panjang atau subjudul
   baru datang belakangan (mis. judul topik channel yang diambil async). */
.topbar-inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 12px; height: 48px; }
.topbar h1 {
  margin: 0; color: var(--fg); letter-spacing: -0.01em;
  font-family: var(--display); font-weight: 700; line-height: 1.25;
  /* Menyusut di layar sempit supaya tak cepat terpotong. */
  font-size: clamp(17px, 4.8vw, 20px);
}
.topbar .sub { font-size: 12.5px; line-height: 1.25; color: var(--muted); }
/* Judul & subjudul selalu satu baris — dipotong rapi, tak pernah membungkus. */
.topbar h1, .topbar .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .grow { flex: 1; min-width: 0; }
.main {
  flex: 1; width: 100%; max-width: 640px; margin: 0 auto;
  padding: 16px var(--pad-r) calc(var(--tabbar-h) + var(--safe-b) + 24px) var(--pad-l);
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.section-title {
  margin: 18px 2px 8px; font: 700 13px/1.3 var(--display); color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}

/* ---------- menu bawah ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding-bottom: var(--safe-b);
  background: rgba(10, 10, 10, 0.94);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-strong);
}
.tabbar ul { list-style: none; margin: 0 auto; padding: 0 var(--pad-r) 0 var(--pad-l); display: flex; max-width: 640px; }
.tabbar li { flex: 1; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--tabbar-h); text-decoration: none; color: var(--muted);
  font: 600 11px/1 var(--body);
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--fg); }
.tab[aria-current="page"] svg { color: var(--blue); }

/* ---------- tombol & input ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent;
  font: 700 15px/1 var(--display); cursor: pointer; text-decoration: none;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.55; cursor: default; }
/* Ikon di dalam tombol wajib berukuran tetap — tanpa ini SVG melebar memenuhi tombol. */
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--blue-fill); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-danger { background: transparent; color: var(--red); border-color: rgba(248, 113, 113, 0.35); }
.btn-block { width: 100%; }
.icon-btn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
.link-btn {
  background: none; border: 0; color: var(--blue); font: 600 14px var(--body);
  min-height: 44px; padding: 0 4px; cursor: pointer;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font: 600 13px var(--body); color: var(--text); }
.input-wrap { position: relative; }
.input {
  width: 100%; min-height: 50px; padding: 0 14px; border-radius: 12px;
  background: var(--card); color: var(--fg); border: 1px solid var(--control);
  font: 500 16px var(--body); /* 16px: iOS tidak memperbesar layar saat fokus */
}
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.input-wrap .input { padding-right: 52px; }
.input-wrap .icon-btn { position: absolute; right: 3px; top: 3px; border: 0; background: transparent; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: calc(var(--safe-t) + 24px) 20px calc(var(--safe-b) + 24px); }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.login-head { text-align: center; margin-bottom: 8px; }
.login-head img { width: 76px; height: 76px; border-radius: 20px; margin: 0 auto 14px; }
.login-head h1 { margin: 0 0 6px; font: 700 24px/1.2 var(--display); color: var(--fg); }
.login-head p { margin: 0; color: var(--muted); font-size: 14px; }
.form-error {
  padding: 12px 14px; border-radius: 12px; font-size: 14px;
  background: var(--red-soft); color: #fecaca; border: 1px solid rgba(248, 113, 113, 0.3);
}
.hint { font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------- kartu & isi ---------- */
.card { background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 16px; }
.card-tight { padding: 12px 14px; }
.card-press { cursor: pointer; transition: border-color 0.15s ease, transform 0.08s ease; text-align: left; width: 100%; color: inherit; font: inherit; }
.card-press:hover { border-color: #3a3a3a; }
.card-press:active { transform: scale(0.995); }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title { font: 700 16px/1.3 var(--display); color: var(--fg); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line-strong); border-radius: 14px; padding: 12px 14px; }
.tile .label { font-size: 12px; color: var(--muted); }
.tile .value { font: 700 22px/1.2 var(--display); color: var(--fg); margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .value.small-v { font-size: 18px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px;
  font: 700 11px/1 var(--display); letter-spacing: 0.02em; white-space: nowrap;
  background: var(--slate-soft); color: var(--slate);
}
.chip-green { background: var(--green-soft); color: var(--green); }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-blue { background: var(--blue-soft); color: #66b3ff; }
.chip-indigo { background: var(--indigo-soft); color: var(--indigo); }
.chip-orange { background: var(--orange-soft); color: var(--orange); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

.coin { width: 36px; height: 36px; border-radius: 50%; background: var(--elev); flex: none; object-fit: cover; }
.coin-fallback { width: 36px; height: 36px; border-radius: 50%; background: var(--elev); flex: none; display: grid; place-items: center; font: 700 12px var(--display); color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--blue-soft); color: #66b3ff; font: 700 13px var(--display); }

.levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.level { background: var(--cell); border-radius: var(--radius-sm); padding: 8px 10px; min-width: 0; }
.level .k { font-size: 11px; color: var(--muted); }
.level .v { font: 700 14px/1.3 var(--display); color: var(--fg); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--line-strong); }
.seg button {
  flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font: 700 13px var(--display); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--blue-fill); color: #fff; }

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }

.bar-track { height: 8px; border-radius: 999px; background: var(--cell); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--blue); }
.dist { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--cell); }
.dist span { display: block; height: 100%; }

.prose { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); font-size: 14.5px; line-height: 1.6; }
.photo { width: 100%; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--elev); cursor: zoom-in; }
.photo-btn { display: block; padding: 0; border: 0; background: none; width: 100%; margin-top: 12px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }

.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ---------- sakelar (notifikasi) ---------- */
.setting { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.switch {
  position: relative; width: 48px; height: 28px; flex: none; border-radius: 999px; border: 0;
  background: var(--control); cursor: pointer; transition: background 0.15s ease;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: transform 0.15s ease;
}
.switch[aria-checked="true"] { background: var(--blue-fill); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch[disabled] { opacity: 0.5; cursor: default; }
.note { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.note.warn { color: var(--amber); }

/* ---------- keadaan ---------- */
.skeleton {
  background: linear-gradient(90deg, #141414 0%, #1d1d1d 50%, #141414 100%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: var(--radius);
}
.state { text-align: center; padding: 28px 16px; }
.state svg { width: 26px; height: 26px; color: var(--muted); margin: 0 auto 10px; display: block; }
.state p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.fresh { font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; }
.fresh.warn { color: var(--amber); }

/* ---------- lembar bawah & pratinjau foto ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.72); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 640px; background: var(--card); border-top: 1px solid var(--line-strong);
  border-radius: 20px 20px 0 0;
  padding: 10px max(20px, var(--safe-r)) calc(var(--safe-b) + 20px) max(20px, var(--safe-l));
  max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  animation: rise 0.2s ease-out;
}
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 0 auto 16px; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.94); display: grid; place-items: center;
  padding: calc(var(--safe-t) + 56px) max(12px, var(--safe-r)) calc(var(--safe-b) + 24px) max(12px, var(--safe-l)); }
.lightbox img { max-height: 100%; max-width: 100%; border-radius: 10px; }
.lightbox .icon-btn { position: fixed; top: calc(var(--safe-t) + 12px); right: max(12px, var(--safe-r)); }

.install {
  position: fixed; z-index: 40;
  left: max(12px, var(--safe-l)); right: max(12px, var(--safe-r));
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  max-width: 616px; margin: 0 auto;
  background: var(--elev); border: 1px solid var(--line-strong); border-radius: 16px; padding: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.install img { width: 44px; height: 44px; border-radius: 12px; flex: none; }

@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: 0.55; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

@media (min-width: 560px) {
  .tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
