:root {
  --page: #0b1120;
  --card: #131b2e;
  --card2: #0f1728;
  --border: #223049;
  --bctrl: #223049;
  --text: #eaf0ff;
  --muted: #8ea0c4;
  --faint: #6b7a99;
  --accent: #3d7bff;
  --asoft: #152142;
  --asoftbd: #2b3f66;
  --ring: #1a2540;
  --lockbg: #1a2233;
  --okc: #16c46a;
  --okbg: #10261c;
  --okbd: #1f5a3c;
  --oktx: #45d98a;
  --dgc: #ff5a72;
  --dgbg: #2a1620;
  --dgbd: #5a2434;
  --wnbg: #2a2016;
  --wnbd: #5a3f22;
  --wntx: #e0a668;
  --btng: linear-gradient(135deg, #2f63ff, #5b8cff);
}

:root[data-theme='light'] {
  --page: #f5f7fc;
  --card: #ffffff;
  --card2: #f7f8f9;
  --border: #e8eaef;
  --bctrl: #e3e4e6;
  --text: #1a1a33;
  --muted: #7a8399;
  --faint: #9aa2b4;
  --accent: #0044ff;
  --asoft: #f2f5ff;
  --asoftbd: #cfe0ff;
  --ring: #e7ecf6;
  --lockbg: #e6e9f0;
  --okc: #00cc66;
  --okbg: #e9faf1;
  --okbd: #b6ebcf;
  --oktx: #0a7a44;
  --dgc: #ff3355;
  --dgbg: #ffedf0;
  --dgbd: #ffd2da;
  --wnbg: #fff4ec;
  --wnbd: #ffddc2;
  --wntx: #8a5326;
  --btng: linear-gradient(135deg, #0044ff, #4f7bff);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: 'Inter', Helvetica, Arial, sans-serif;
  background: var(--page);
  color: var(--text);
  overscroll-behavior: none;
}

input {
  font-family: inherit;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes glowPulse { 0%,100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.14); opacity: 1; } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes btnGlow { 0%,100% { box-shadow: 0 10px 22px rgba(0,68,255,.30); } 50% { box-shadow: 0 14px 32px rgba(0,68,255,.48); } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fillbar { from { width: 0%; } to { width: 100%; } }

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--page);
  position: relative;
}

.scr {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-width: none;
}
.scr::-webkit-scrollbar { width: 0; }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px 2px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
}
.logo-title {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.4px;
}
.logo-title .b { color: var(--accent); }
.logo-title .w { color: var(--text); }
.theme-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--bctrl);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(20,25,45,.04), 0 10px 26px rgba(20,25,45,.05);
  padding: 20px;
}
.card-sm { border-radius: 16px; padding: 14px 15px; }

.col { display: flex; flex-direction: column; }
.center { align-items: center; text-align: center; }
.gap8 { gap: 8px; }
.gap10 { gap: 10px; }
.gap12 { gap: 12px; }
.gap14 { gap: 14px; }
.gap16 { gap: 16px; }
.gap18 { gap: 18px; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.f1 { flex: 1; }

.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--asoft);
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .04em;
}

.muted { color: var(--muted); }
.faint { color: var(--faint); }

.title-lg {
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -.5px;
  padding: 2px 2px 0;
}

/* Buttons */
.btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-primary {
  height: 52px;
  background: var(--accent);
  box-shadow: 0 8px 20px rgba(0,68,255,.28);
}
.btn-grad {
  background: var(--btng);
  box-shadow: 0 12px 26px rgba(0,68,255,.32);
}
.btn-grad:hover { filter: brightness(1.06); }
.btn-lg { height: 56px; border-radius: 16px; font-size: 17px; font-weight: 700; }
.btn-xl { height: 62px; border-radius: 16px; font-size: 18px; font-weight: 700; }
.btn-lock {
  background: var(--lockbg);
  color: var(--faint);
  cursor: not-allowed;
}
.btn-outline {
  height: 46px;
  border: 1px solid var(--bctrl);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}
.btn:disabled { cursor: default; }
.link {
  color: var(--accent);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
}
.link-muted { color: var(--muted); }

.input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--bctrl);
  border-radius: 12px;
  background: var(--card2);
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  letter-spacing: .05em;
}
.input:focus { border-color: var(--accent); background: var(--card); }

.spinner {
  border: 2.5px solid rgba(255,255,255,.55);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin .8s linear infinite;
}

/* Success box */
.okbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--okbg);
  border: 1px solid var(--okbd);
  border-radius: 14px;
  padding: 14px 16px;
  animation: popIn .35s ease;
}
.okdot {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  background: var(--okc);
  display: flex;
  align-items: center;
  justify-content: center;
}
.oktx { color: var(--oktx); font-size: 14px; line-height: 1.5; }

/* Selectors */
.select-btn {
  width: 100%;
  height: 52px;
  border: 1px solid var(--bctrl);
  border-radius: 14px;
  background: var(--card);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  cursor: pointer;
  color: var(--text);
}
.select-btn.accent {
  border-color: var(--asoftbd);
  background: var(--asoft);
  color: var(--accent);
}
.select-value { flex: 1; text-align: left; font-weight: 600; font-size: 15px; }
.dropdown {
  position: absolute;
  top: 58px;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--bctrl);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(20,25,45,.24);
  padding: 6px;
  z-index: 20;
}
.dropdown.tz { top: 82px; }
.opt {
  width: 100%;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.opt.active { background: var(--asoft); color: var(--accent); font-weight: 600; }

/* Indicator chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--bctrl);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.chip.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.locked { background: var(--card2); color: var(--faint); }

.warn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--wnbg);
  border: 1px solid var(--wnbd);
  border-radius: 11px;
  padding: 10px 12px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.warn span { flex: 1; font-size: 12.5px; color: var(--wntx); font-weight: 500; }

/* Stage / animation */
.stage {
  position: relative;
  min-height: 168px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px;
}
.orb-wrap { position: relative; width: 96px; height: 96px; display: flex; align-items: center; justify-content: center; }
.orb-glow { position: absolute; width: 96px; height: 96px; border-radius: 50%; background: radial-gradient(circle, rgba(0,68,255,.22), rgba(0,68,255,0) 70%); animation: glowPulse 2.4s ease-in-out infinite; }
.orb-ring { position: absolute; width: 78px; height: 78px; border-radius: 50%; border: 1.5px solid rgba(0,68,255,.18); }
.orb-orbit { position: absolute; width: 78px; height: 78px; animation: orbit 3.6s linear infinite; }
.orb-orbit .d1 { position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(0,68,255,.6); }
.orb-orbit .d2 { position: absolute; bottom: 2px; left: 8px; width: 6px; height: 6px; border-radius: 50%; background: #668eff; }
.orb-orbit .d3 { position: absolute; bottom: 2px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: #f70; }
.orb-core { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg,#04f,#4f7bff); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 18px rgba(0,68,255,.4); animation: floaty 2.8s ease-in-out infinite; }

.progress { width: 70%; height: 6px; border-radius: 3px; background: var(--page); overflow: hidden; }
.progress > div { height: 100%; border-radius: 3px; background: linear-gradient(90deg,#04f,#4f7bff); animation: fillbar 2.4s ease-out forwards; }

/* Signal result */
.sigcard { border-radius: 18px; padding: 18px; animation: popIn .35s ease; }
.sig-dir { font-weight: 800; font-size: 26px; letter-spacing: -.5px; }
.sig-open {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
}
.confbar { height: 8px; border-radius: 4px; background: var(--card); overflow: hidden; }
.confbar > div { height: 100%; border-radius: 4px; transition: width .6s ease; }

/* Winrate */
.wr-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 2px; }
.wr-ring { position: relative; width: 150px; height: 150px; }
.wr-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 34px; color: var(--text); letter-spacing: -1px; }

/* Bottom nav */
.nav {
  flex: 0 0 74px;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px 6px;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--faint);
  cursor: pointer;
  border: none;
  background: none;
  font-size: 11px;
}
.nav-item.active { color: var(--accent); }
.nav-item span { font-size: 11px; }
.nav-center { position: relative; color: var(--accent); }
.nav-center .fab {
  position: absolute;
  top: -30px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px rgba(0,68,255,.4);
  border: 4px solid var(--page);
}
.nav-center span { margin-top: 26px; }

/* Referral link box */
.reflink {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
  font-family: monospace;
}
.hero {
  border-radius: 18px;
  padding: 18px;
  background: linear-gradient(135deg,#0038d6,#2f63ff 60%,#5b83ff);
  box-shadow: 0 14px 30px rgba(0,68,255,.28);
  color: #fff;
}
.stat {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(20,25,45,.04);
}
.stat .n { font-weight: 800; font-size: 22px; }
.stat .l { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }

/* FAQ */
.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.faq-q {
  width: 100%;
  min-height: 54px;
  padding: 15px 16px;
  border: none;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-weight: 600;
  font-size: 14.5px;
}
.faq-a { padding: 0 16px 16px; font-size: 13.5px; color: var(--muted); line-height: 1.55; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: #1a2233;
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

.hidden { display: none !important; }

/* Loading overlay */
#boot {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--page);
  z-index: 200;
}
