
:root{
  --bg:#FBFAF6; --card:#FFFFFF; --sunk:#F2EFE7; --line:#E3DED2;
  --text:#0B0D0C; --muted:#4F544D;
  --green:#2D8A4E; --green-text:#1F6B3A; --on-green:#FFFFFF; --green-tint:#E3F1E7;
  --red:#C4432B; --gold:#C8930A;
  --font:'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"]{
  --bg:#080A0A; --card:#111413; --sunk:#171B19; --line:#252B28;
  --text:#F2F0EA; --muted:#B5BAB0;
  --green:#3FD47A; --green-text:#3FD47A; --on-green:#06110A; --green-tint:#12261A;
  --red:#E5755F; --gold:#E5A93C;
  color-scheme: dark;
}
*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
:root{ padding-top:env(safe-area-inset-top,0px); }
body{ margin:0; background:var(--bg); color:var(--text); font-family:var(--font); font-size:17px; font-weight:600; line-height:1.5; -webkit-font-smoothing:antialiased; }
button, input{ font:inherit; color:inherit; }
button{ cursor:pointer; }
:focus-visible{ outline:3px solid var(--green); outline-offset:2px; border-radius:10px; }
.num{ font-variant-numeric:tabular-nums; font-feature-settings:'tnum' 1; }
.up{ color:var(--green-text); } .down{ color:var(--red); } .muted{ color:var(--muted); }
h1,h2,h3{ margin:0; letter-spacing:-.015em; line-height:1.2; font-weight:800; }
h1{ font-size:28px; } h2{ font-size:22px; } h3{ font-size:18px; }

.app{ max-width:520px; margin:0 auto; padding:0 18px calc(100px + env(safe-area-inset-bottom,0px)); }
.top{ position:sticky; top:env(safe-area-inset-top,0px); z-index:5; background:var(--bg); display:flex; align-items:center; justify-content:space-between; padding:14px 0 10px; }
.brand{ display:flex; align-items:center; gap:10px; background:none; border:none; padding:0; text-align:left; }
.brand img{ width:40px; height:40px; border-radius:11px; }
.brand .wm{ font-size:21px; font-weight:900; letter-spacing:-.02em; line-height:1; }
.brand .wm .v{ color:var(--gold); }
.brand .sl{ font-size:13px; font-weight:800; color:var(--muted); }
.avatar{ width:46px; height:46px; border-radius:50%; border:2px solid var(--line); background:var(--card); font-weight:900; font-size:15px; }

.screen{ display:none; } .screen.on{ display:block; }
.sec{ margin-top:22px; }
.sec-head{ display:flex; justify-content:space-between; align-items:baseline; margin-bottom:10px; }
.link{ background:none; border:none; color:var(--green-text); font-weight:800; padding:8px 0; font-size:16px; }

.card{ background:var(--card); border:2px solid var(--line); border-radius:20px; padding:18px; }
.big{ font-size:36px; font-weight:900; letter-spacing:-.02em; }
.list{ background:var(--card); border:2px solid var(--line); border-radius:20px; overflow:hidden; }
.row{ display:flex; align-items:center; gap:12px; width:100%; padding:14px 16px; min-height:72px; background:none; border:none; border-top:2px solid var(--line); text-align:left; }
.row:first-child{ border-top:none; }
.row .flag{ font-size:26px; }
.row .mid{ flex:1; min-width:0; }
.row .name{ font-weight:800; }
.row .sub{ font-size:15px; color:var(--muted); }
.row .right{ text-align:right; }
.score{ min-width:48px; height:36px; padding:0 8px; border-radius:11px; display:inline-flex; align-items:center; justify-content:center; font-weight:900; font-size:16px; border:2px solid var(--line); background:var(--sunk); }
.empty{ padding:18px 16px; color:var(--muted); }

.btn{ width:100%; min-height:54px; border-radius:15px; border:none; background:var(--green); color:var(--on-green); font-weight:800; font-size:17px; padding:0 18px; }
.btn.alt{ background:var(--card); color:var(--text); border:2px solid var(--line); }
.btn[disabled]{ opacity:.45; cursor:not-allowed; }
.btns{ display:grid; gap:10px; }

.search{ display:flex; align-items:center; gap:10px; min-height:56px; padding:0 14px; border-radius:16px; border:2px solid var(--line); background:var(--card); }
.search input{ flex:1; border:none; outline:none; background:transparent; font-size:17px; font-weight:700; min-height:52px; }
.search input::placeholder{ color:var(--muted); opacity:1; }
.chips{ display:flex; gap:8px; overflow-x:auto; padding:2px 2px 6px; scrollbar-width:none; }
.chips::-webkit-scrollbar{ display:none; }
.chip{ flex:none; min-height:44px; padding:0 15px; border-radius:999px; border:2px solid var(--line); background:var(--card); font-weight:800; font-size:15px; white-space:nowrap; }
.chip[aria-pressed="true"]{ background:var(--text); border-color:var(--text); color:var(--bg); }
.seg{ display:grid; grid-auto-flow:column; grid-auto-columns:1fr; gap:6px; padding:5px; border-radius:15px; background:var(--sunk); }
.seg button{ min-height:46px; border:none; border-radius:11px; background:transparent; font-weight:800; }
.seg button[aria-pressed="true"]{ background:var(--card); box-shadow:0 0 0 2px var(--line); }

/* stock page */
.back{ background:none; border:none; font-weight:800; min-height:48px; padding:0; }
.chart{ width:100%; height:170px; display:block; margin-top:8px; }
.ring{ position:relative; width:104px; height:104px; flex:none; }
.ring svg{ width:100%; height:100%; transform:rotate(-90deg); }
.ring .n{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.ring .n b{ font-size:32px; font-weight:900; line-height:1; }
.ring .n span{ font-size:13px; color:var(--muted); }
.fac{ margin-top:12px; }
.fac .t{ display:flex; justify-content:space-between; font-weight:800; font-size:16px; }
.bar{ height:10px; border-radius:6px; background:var(--sunk); overflow:hidden; margin-top:5px; }
.bar i{ display:block; height:100%; border-radius:6px; background:var(--text); }
.kv{ display:flex; justify-content:space-between; padding:10px 0; border-top:2px solid var(--line); }
.kv:first-child{ border-top:none; }

/* sheet */
.veil{ position:fixed; inset:0; z-index:40; background:rgba(0,0,0,.45); display:none; align-items:flex-end; justify-content:center; }
.veil.on{ display:flex; }
.sheet{ width:100%; max-width:520px; background:var(--bg); border-radius:24px 24px 0 0; padding:18px 18px calc(22px + env(safe-area-inset-bottom,0px)); max-height:92vh; overflow-y:auto; }
.grab{ width:44px; height:5px; border-radius:3px; background:var(--line); margin:0 auto 14px; }
.stepper{ display:flex; gap:10px; align-items:center; }
.stepper button{ width:56px; height:56px; border-radius:15px; border:2px solid var(--line); background:var(--card); font-size:26px; font-weight:900; }
.stepper input{ flex:1; min-height:56px; border-radius:15px; border:2px solid var(--line); background:var(--card); text-align:center; font-size:22px; font-weight:900; }
.field{ width:100%; min-height:56px; border-radius:15px; border:2px solid var(--line); background:var(--card); padding:0 14px; font-size:17px; font-weight:700; }
.err{ color:var(--red); font-weight:800; min-height:24px; margin:8px 0 0; font-size:15px; }
.note{ font-size:15px; color:var(--muted); }
.steps{ display:grid; gap:12px; margin-top:12px; }
.step{ display:flex; gap:12px; }
.step b{ flex:none; width:32px; height:32px; border-radius:50%; background:var(--green-tint); display:flex; align-items:center; justify-content:center; font-weight:900; }

/* tab bar */
.tabs{ position:fixed; left:0; right:0; bottom:0; z-index:20; background:var(--card); border-top:2px solid var(--line); padding:6px 6px calc(6px + env(safe-area-inset-bottom,0px)); }
.tabs .in{ max-width:520px; margin:0 auto; display:grid; grid-template-columns:repeat(5,1fr); gap:4px; }
.tab{ display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; min-height:60px; border:none; background:none; border-radius:14px; font-size:13px; font-weight:800; color:var(--muted); }
.tab svg{ width:24px; height:24px; }
.tab[aria-current="page"]{ color:var(--text); background:var(--green-tint); }

.toast{ position:fixed; left:50%; transform:translateX(-50%); bottom:calc(92px + env(safe-area-inset-bottom,0px)); z-index:60; max-width:90%; background:var(--text); color:var(--bg); padding:13px 18px; border-radius:14px; font-weight:800; display:none; text-align:center; }
.toast.on{ display:block; }
.foot{ margin-top:26px; font-size:14px; color:var(--muted); }
.foot button{ background:none; border:none; padding:0; color:var(--green-text); font-weight:800; text-decoration:underline; font-size:14px; }
.lesson{ display:flex; gap:12px; align-items:flex-start; }
.lesson .ico{ font-size:26px; }
details summary{ list-style:none; cursor:pointer; }
details summary::-webkit-details-marker{ display:none; }
@media (prefers-reduced-motion: reduce){ *{ transition:none !important; animation:none !important; } }
/* ---------- Intro (first screen) ---------- */
body.intro-mode .app, body.intro-mode .tabs{ display:none; }
body.intro-mode{ overflow:hidden; }
body.intro-mode .app{ padding-bottom:0; }
.intro{ position:fixed; inset:0; z-index:30; background:#080A0A; color:#fff; overflow-y:auto; overflow-x:hidden; display:flex; flex-direction:column; -webkit-overflow-scrolling:touch; }
.intro[hidden]{ display:none; }
.intro .bg{ position:fixed; inset:-3%; background-size:cover; background-position:center; opacity:0; transition:opacity .8s ease; }
.intro .bg.on{ opacity:1; animation:drift 14s ease-out forwards; }
@keyframes drift{ from{ transform:scale(1.08); } to{ transform:scale(1); } }
.intro .scrim{ position:fixed; inset:0; background:linear-gradient(180deg, rgba(8,10,10,.45) 0%, rgba(8,10,10,.15) 30%, rgba(8,10,10,.8) 58%, rgba(8,10,10,.97) 100%); }
:root[data-theme="light"] .intro{ background:#FBFAF6; color:#0B0D0C; }
:root[data-theme="light"] .intro .scrim{ background:linear-gradient(180deg, rgba(251,250,246,.5) 0%, rgba(251,250,246,.1) 30%, rgba(251,250,246,.85) 58%, rgba(251,250,246,.98) 100%); }
.intro-top{ position:relative; z-index:2; flex:none; width:100%; max-width:520px; margin:0 auto; padding:calc(16px + env(safe-area-inset-top,0px)) 18px 16px; display:flex; justify-content:space-between; align-items:flex-start; }
.intro-top .brand{ color:inherit; }
.intro-top .sl{ color:inherit; opacity:.85; }
.skip{ min-height:46px; padding:0 16px; border-radius:14px; border:2px solid rgba(255,255,255,.25); background:rgba(8,10,10,.45); color:inherit; font-weight:800; }
:root[data-theme="light"] .skip{ border-color:var(--line); background:rgba(255,255,255,.8); }
.intro-body{ position:relative; z-index:2; flex:none; width:100%; margin-top:auto; padding:0 18px calc(20px + env(safe-area-inset-bottom,0px)); }
.intro-body .in{ max-width:520px; margin:0 auto; }
.islide{ display:none; }
.islide.on{ display:block; animation:rise .5s ease both; }
@keyframes rise{ from{ opacity:0; transform:translateY(12px); } to{ opacity:1; transform:none; } }
.islide h1{ font-size:clamp(30px,8vw,40px); font-weight:900; line-height:1.08; margin:0 0 8px; }
.islide .lead{ font-size:18px; margin:0 0 14px; opacity:.9; }
.glass{ background:rgba(8,10,10,.55); border:2px solid rgba(255,255,255,.14); border-radius:18px; padding:12px 14px; backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); }
:root[data-theme="light"] .glass{ background:rgba(255,255,255,.88); border-color:var(--line); }
.istats{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.istats b{ display:block; font-size:22px; font-weight:900; }
.istats span{ font-size:14px; opacity:.85; }
.ictl{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin:14px 0 12px; }
.ipills{ display:flex; gap:7px; }
.ipill{ position:relative; width:20px; height:9px; border-radius:999px; border:0; padding:0; background:rgba(127,127,127,.5); overflow:hidden; transition:width .3s; }
.ipill.on{ width:50px; }
.ipill i{ position:absolute; inset:0 auto 0 0; width:0; background:var(--green); border-radius:999px; }
.iround{ width:48px; height:48px; border-radius:14px; border:2px solid rgba(255,255,255,.22); background:rgba(8,10,10,.45); color:inherit; font-size:22px; font-weight:900; }
:root[data-theme="light"] .iround{ border-color:var(--line); background:rgba(255,255,255,.85); }
.intro .btn.alt{ background:rgba(8,10,10,.45); color:inherit; border-color:rgba(255,255,255,.25); }
:root[data-theme="light"] .intro .btn.alt{ background:#fff; border-color:var(--line); }
.ifine{ font-size:13px; text-align:center; opacity:.8; margin:10px 0 0; }
.iring{ display:flex; gap:14px; align-items:center; }
.iring .ring .n span{ color:inherit; opacity:.8; }
.ibars{ flex:1; display:grid; gap:6px; font-size:15px; }
.ibars .bar{ background:rgba(127,127,127,.3); }
.ibars .bar i{ transition:width 1s ease-out; }
@media (max-height:700px){ .islide .lead{ font-size:16px; margin-bottom:10px; } .islide h1{ font-size:28px; } }
@media (prefers-reduced-motion: reduce){ .intro .bg.on, .islide.on{ animation:none; } .ipill, .ibars .bar i, #i-arc{ transition:none; } }

.chip[disabled]{ opacity:.4; cursor:not-allowed; }
button.card{ font:inherit; color:inherit; }

[hidden]{ display:none !important; }

/* ---------- LongX brand (shown only when the app runs on LongX) ---------- */
:root{ --longx:#047857; --longx-text:#065F46; --longx-tint:#E3F5EC; --on-longx:#FFFFFF; }
:root[data-theme="dark"]{ --longx:#34D399; --longx-text:#6EE7B7; --longx-tint:#0F2A20; --on-longx:#052E1F; }
/* LongX logo inside "Powered by LongX" badges: light and dark versions */
.lx-logo-light, .lx-logo-dark{ height:auto; display:inline-block; vertical-align:middle; }
.lx-logo-dark{ display:none; }
:root[data-theme="dark"] .lx-logo-light{ display:none; }
:root[data-theme="dark"] .lx-logo-dark{ display:inline-block; }
.longx-badge{ display:none; align-items:center; gap:7px; margin-top:8px; padding:6px 14px; border-radius:999px;
  background:var(--longx-tint); border:2px solid var(--longx); color:var(--longx-text); font-size:14px; font-weight:800; width:max-content; }
.lx-mark{ width:24px; height:24px; border-radius:8px; background:var(--longx); color:var(--on-longx);
  display:inline-flex; align-items:center; justify-content:center; font-weight:900; font-size:15px; line-height:1; }
.lx-x{ color:var(--longx); }
.engine-longx .longx-badge{ display:inline-flex; }
.engine-longx .kv-score-name{ color:var(--longx-text); font-weight:900; }
.engine-longx .score{ background:var(--longx-tint); border-color:var(--longx); color:var(--longx-text); }
.engine-longx #st-arc{ stroke:var(--longx); }
.engine-longx #st-score{ color:var(--longx-text); }
.engine-longx #st-factors .bar i{ background:var(--longx); }
.engine-longx #b-result .bar i{ background:var(--longx) !important; }
.engine-longx #c-sort button[aria-pressed="true"]:first-child{ box-shadow:0 0 0 2px var(--longx); color:var(--longx-text); }
.engine-longx #b-weight button[aria-pressed="true"]:first-child{ box-shadow:0 0 0 2px var(--longx); color:var(--longx-text); }

/* ---------- Lesson: risk, currency and fees over time ---------- */
.grow-key{ display:grid; gap:6px; margin:10px 0 4px; font-size:15px; }
.grow-key span{ display:flex; gap:8px; align-items:flex-start; }
.grow-key i, .grow-res-h i{ flex:none; width:14px; height:14px; border-radius:4px; margin-top:4px; display:inline-block; }
.ga{ background:var(--green); } .gb{ background:var(--gold); }
.grow-lbl{ font-size:15px; font-weight:800; margin:12px 0 6px; }
.grow-chart{ margin-top:14px; }
.grow-chart svg{ width:100%; height:auto; display:block; }
.grow-legend{ display:flex; flex-wrap:wrap; gap:6px 14px; font-size:13px; color:var(--muted); margin-top:6px; }
.grow-legend span{ display:inline-flex; align-items:center; gap:6px; }
.grow-legend i{ display:inline-block; width:18px; height:10px; border-radius:3px; }
.grow-legend i.band{ background:var(--muted); opacity:.25; }
.grow-legend i.mid{ height:3px; background:var(--text); }
.grow-legend i.put{ height:0; border-top:2px dashed var(--muted); }
.grow-res-paid{ margin:14px 0 8px; font-size:16px; }
.grow-res{ border:2px solid var(--line); border-radius:16px; padding:12px 14px; margin-bottom:10px; background:var(--card); }
.grow-res-h{ display:flex; gap:8px; align-items:center; font-weight:800; margin-bottom:6px; }
.grow-res-h i{ margin-top:0; }
.grow-res-row{ display:flex; justify-content:space-between; gap:10px; font-size:15px; padding:3px 0; }
.grow-res-row span{ color:var(--muted); }
.grow-learn{ margin-top:14px; padding:12px 14px; border-radius:16px; background:var(--sunk); }
.grow-learn p{ margin:0 0 10px; font-size:15px; }
.grow-learn p:last-child{ margin:0; }
.grow-fine{ font-size:13px; color:var(--muted); margin:12px 0 4px; line-height:1.5; }

/* ---------- Sector spotlight ---------- */
.spot-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.spot-l{ font-size:13px; font-weight:800; }
.spot-v{ font-size:18px; font-weight:900; margin-top:4px; }
.spot-lead{ margin-top:12px; border:2px solid var(--line); border-radius:14px; min-height:64px; }
.sector-row{ gap:10px; }
.sector-bar{ flex:none; width:72px; height:10px; border-radius:6px; background:var(--sunk); overflow:hidden; }
.sector-bar i{ display:block; height:100%; border-radius:6px; background:var(--green); }
.engine-longx .sector-bar i{ background:var(--longx); }
@media (max-width:360px){ .spot-grid{ grid-template-columns:repeat(2,1fr); } }
