:root{
  --bg: #05070d;
  --panel: #0b0f1a;
  --card: #121826;
  --card-border: rgba(255,255,255,0.07);
  --line: rgba(255,255,255,0.08);
  --text: #f5f7fb;
  --text-dim: #8b93a7;
  --text-faint: #5b6478;
  --accent: #3d63ff;
  --accent-2: #5b7dff;
  --up: #22c55e;
  --down: #ef4444;
  --btc: #f7931a;
  --eth: #8fa3ff;
  --sol: #6b5bff;
  --usdt: #26a17b;
  --radius-lg: 20px;
  --radius-md: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, Arial, sans-serif;
  --home-indicator: rgba(255,255,255,0.55);
  --backdrop-base: #05070d;
  --backdrop-glow-1: rgba(61,99,255,0.16);
  --backdrop-glow-2: rgba(61,99,255,0.10);
  --handle-color: rgba(255,255,255,0.2);
  --nav-bg: rgba(11,15,26,0.92);
  --toast-bg: #1a2233;
  --toast-text: #f5f7fb;
}

:root[data-theme="light"]{
  --bg: #eef1f8;
  --panel: #ffffff;
  --card: #f4f6fb;
  --card-border: rgba(15,23,42,0.09);
  --line: rgba(15,23,42,0.08);
  --text: #0f1626;
  --text-dim: #566079;
  --text-faint: #8790a3;
  --accent: #3d63ff;
  --accent-2: #2f4fe0;
  --home-indicator: rgba(15,23,42,0.32);
  --backdrop-base: #eef1f8;
  --backdrop-glow-1: rgba(61,99,255,0.10);
  --backdrop-glow-2: rgba(61,99,255,0.07);
  --handle-color: rgba(15,23,42,0.18);
  --nav-bg: rgba(255,255,255,0.85);
  --toast-bg: #1f2937;
  --toast-text: #f5f7fb;
}

*{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow-x:hidden;
}

.app-backdrop{
  position:fixed; inset:0;
  background:
    radial-gradient(ellipse 900px 600px at 80% 20%, var(--backdrop-glow-1), transparent 60%),
    radial-gradient(ellipse 700px 500px at 10% 90%, var(--backdrop-glow-2), transparent 55%),
    var(--backdrop-base);
  z-index:-1;
}

/* ---------- Layout: full-screen app ---------- */
.phone-frame{
  height:100dvh;
}

/* ---------- Device shell ---------- */
.device{
  position:relative;
  width:100vw;
  height:100dvh;
  background: var(--panel);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.home-indicator{
  position:absolute;
  bottom:8px; left:50%;
  transform:translateX(-50%);
  width:134px; height:5px;
  background:var(--home-indicator);
  border-radius:4px;
  z-index:60;
}

/* ---------- Screens ---------- */
.screens{
  flex:1;
  position:relative;
  overflow:hidden;
}
.screen{
  position:absolute;
  inset:0;
  overflow-y:auto;
  padding:24px 20px 96px;
  opacity:0;
  visibility:hidden;
  transform:translateY(6px);
  transition:opacity .22s ease, transform .22s ease;
  scrollbar-width:none;
}
.screen::-webkit-scrollbar{ display:none; }
.screen.active{
  opacity:1;
  visibility:visible;
  transform:translateY(0);
  z-index:5;
}

.screen-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 0 10px;
}
.screen-header h1{
  font-size:26px;
  font-weight:800;
  margin:0;
  letter-spacing:-0.01em;
}
.icon-btn{
  width:38px; height:38px;
  border-radius:12px;
  border:1px solid var(--card-border);
  background:var(--card);
  color:var(--text);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.icon-btn.ghost{ background:transparent; border:none; width:auto; height:auto; padding:0; color:var(--text-dim); }
.header-actions{ display:flex; gap:8px; }

/* ---------- Search & chips ---------- */
.search-bar{
  display:flex;
  align-items:center;
  gap:10px;
  background:var(--card);
  border:1px solid var(--card-border);
  border-radius:14px;
  padding:12px 14px;
  color:var(--text-dim);
  margin-bottom:14px;
}
.search-bar input{
  border:none; background:transparent; outline:none;
  color:var(--text); font-size:15px; width:100%; font-family:var(--font);
}
.search-bar input::placeholder{ color:var(--text-faint); }

.chip-row{
  display:flex;
  gap:8px;
  overflow-x:auto;
  padding-bottom:14px;
  scrollbar-width:none;
}
.chip-row::-webkit-scrollbar{ display:none; }
.chip{
  flex-shrink:0;
  padding:8px 14px;
  border-radius:999px;
  border:1px solid var(--card-border);
  background:var(--card);
  color:var(--text-dim);
  font-size:13px;
  font-weight:600;
  cursor:pointer;
  transition: background .15s, color .15s;
}
.chip.active{
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
}
.chip.tf{ padding:7px 12px; font-size:12.5px; }

/* ---------- Cards ---------- */
.card{
  background:var(--card);
  border:1px solid var(--card-border);
  border-radius:var(--radius-lg);
  padding:16px;
  margin-bottom:14px;
}
.card-title{
  font-size:14px;
  font-weight:700;
  color:var(--text);
  margin-bottom:10px;
}
.section-title{ margin:18px 2px 10px; }
.hint-text{
  font-size:12.5px;
  color:var(--text-faint);
  line-height:1.4;
  margin:0 0 10px;
}

/* ---------- Market list ---------- */
.market-list{ display:flex; flex-direction:column; gap:12px; }
.market-card{
  background:var(--card);
  border:1px solid var(--card-border);
  border-radius:var(--radius-lg);
  padding:16px;
  cursor:pointer;
  transition: border-color .15s, transform .1s;
}
.market-card:active{ transform:scale(0.98); }
.market-card-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:10px;
}
.coin-info{ display:flex; align-items:center; gap:10px; }
.coin-dot{
  width:36px; height:36px;
  border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
  overflow:hidden;
}
.coin-dot svg{ width:58%; height:58%; display:block; }
.coin-name{ font-weight:700; font-size:15.5px; }
.coin-symbol{ font-size:12.5px; color:var(--text-faint); }
.coin-price-block{ text-align:right; }
.coin-price{ font-weight:700; font-size:15.5px; }
.coin-change{ font-size:13px; font-weight:600; }
.up{ color:var(--up); }
.down{ color:var(--down); }
.market-card canvas{ width:100%; height:60px; display:block; }
.tf-mini{
  display:flex; gap:16px; margin-top:8px;
  font-size:12px; color:var(--text-faint); font-weight:600;
}
.tf-mini span.on{ color:var(--accent-2); }

/* ---------- Portfolio ---------- */
.balance-block{ padding:10px 2px 18px; }
.balance-label{
  display:flex; align-items:center; gap:8px;
  font-size:13.5px; color:var(--text-dim); margin-bottom:8px;
}
.balance-value{ font-size:38px; font-weight:800; letter-spacing:-0.02em; }
.balance-change{ font-size:14px; font-weight:700; margin-top:6px; }

.allocation-row{ display:flex; align-items:center; gap:18px; }
.allocation-row canvas{ flex-shrink:0; width:180px; height:180px; }
.legend{ list-style:none; margin:0; padding:0; flex:1; display:flex; flex-direction:column; gap:10px; }
.legend li{ display:flex; align-items:center; gap:8px; font-size:13.5px; }
.legend .dot{ width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.legend .lg-name{ flex:1; color:var(--text-dim); }
.legend .lg-val{ font-weight:700; }

.asset-list{ display:flex; flex-direction:column; gap:10px; }
.asset-row{
  display:flex; align-items:center; gap:12px;
  background:var(--card);
  border:1px solid var(--card-border);
  border-radius:var(--radius-md);
  padding:12px 14px;
}
.asset-row .coin-info{ flex:1.3; }
.asset-row canvas{ width:60px; height:28px; flex:0.7; }
.asset-row .coin-price-block{ flex:1; }

/* ---------- Trade ---------- */
.trade-header{ padding-top:10px; }
.pair-select{
  display:flex; align-items:center; gap:6px;
  background:none; border:none; color:var(--text);
  font-size:19px; font-weight:800; cursor:pointer; padding:0;
}
.asset-name{ color:var(--text-faint); font-size:13.5px; margin:2px 0 14px; }
.price-block{ margin-bottom:10px; }
.price-value{ font-size:32px; font-weight:800; letter-spacing:-0.02em; }
.price-change{ font-size:14px; font-weight:700; margin-top:4px; }

.chart-wrap{
  background:var(--card);
  border:1px solid var(--card-border);
  border-radius:var(--radius-lg);
  padding:14px 10px 10px;
  margin:12px 0 14px;
}
.chart-wrap canvas{ width:100%; height:230px; display:block; }
.chart-wrap.small{ padding:14px 12px 6px; }
.chart-wrap.small canvas{ height:150px; }

.volume-card canvas{ height:40px; width:100%; margin-top:4px; }
.volume-value{ font-size:19px; font-weight:800; }

#projection-chart{ width:100%; height:150px; display:block; }

.stats-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-bottom:14px;
}
.stat-box{
  background:var(--card);
  border:1px solid var(--card-border);
  border-radius:var(--radius-md);
  padding:12px 14px;
}
.stat-label{ font-size:12.5px; color:var(--text-faint); margin-bottom:4px; }
.stat-value{ font-size:15px; font-weight:700; }

.trade-actions{ display:flex; gap:10px; margin-top:6px; }
.btn{
  flex:1;
  border:none;
  border-radius:14px;
  padding:15px;
  font-size:15.5px;
  font-weight:800;
  cursor:pointer;
  font-family:var(--font);
  transition: filter .15s, transform .1s;
}
.btn:active{ transform:scale(0.97); }
.btn-buy{ background:linear-gradient(180deg, #4c74ff, var(--accent)); color:#fff; }
.btn-buy:hover{ filter:brightness(1.08); }
.btn-sell{ background:var(--card); color:var(--text); border:1px solid var(--card-border); }
.btn-outline{ background:transparent; border:1px solid var(--card-border); color:var(--text-dim); }
.btn.full{ width:100%; margin-top:6px; }

/* ---------- Automated trading / form ---------- */
.form-card{ padding:4px 16px; }
.form-row{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 0;
  border-bottom:1px solid var(--line);
}
.form-row.no-border{ border-bottom:none; }
.form-label{ font-size:14.5px; color:var(--text-dim); }
.form-value{
  display:flex; align-items:center; gap:6px;
  background:none; border:none; color:var(--text);
  font-size:14.5px; font-weight:700; cursor:pointer; padding:0;
  font-family:var(--font);
}
.form-value svg{ color:var(--text-faint); }
.form-static{ font-size:14.5px; font-weight:700; color:var(--text); }

.switch{ position:relative; width:46px; height:28px; flex-shrink:0; }
.switch input{ opacity:0; width:0; height:0; }
.slider{
  position:absolute; inset:0; cursor:pointer;
  background:#2a3142; border-radius:999px; transition:.2s;
}
.slider::before{
  content:""; position:absolute; width:22px; height:22px; left:3px; top:3px;
  background:#fff; border-radius:50%; transition:.2s;
}
.switch input:checked + .slider{ background:var(--accent); }
.switch input:checked + .slider::before{ transform:translateX(18px); }

.activity-list{ display:flex; flex-direction:column; gap:10px; margin-bottom:16px; }
.activity-row{
  display:flex; align-items:center; gap:12px;
  background:var(--card);
  border:1px solid var(--card-border);
  border-radius:var(--radius-md);
  padding:12px 14px;
}
.activity-icon{
  width:34px; height:34px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.activity-icon.buy{ background:rgba(34,197,94,0.15); color:var(--up); }
.activity-icon.sell{ background:rgba(239,68,68,0.15); color:var(--down); }
.activity-pair{ font-weight:700; font-size:14.5px; }
.activity-side{ font-size:12.5px; font-weight:600; }
.activity-right{ margin-left:auto; text-align:right; }
.activity-amount{ font-weight:700; font-size:14px; }
.activity-time{ font-size:12px; color:var(--text-faint); }

/* ---------- Profile ---------- */
.profile-card{
  display:flex; align-items:center; gap:14px;
  background:var(--card);
  border:1px solid var(--card-border);
  border-radius:var(--radius-lg);
  padding:16px;
  margin:6px 0 6px;
}
.avatar{
  width:54px; height:54px; border-radius:50%;
  background:linear-gradient(135deg, var(--accent), #8ea4ff);
  display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:17px; color:#fff; flex-shrink:0;
}
.profile-name{ font-weight:800; font-size:16.5px; }
.profile-email{ font-size:13px; color:var(--text-faint); margin-top:2px; }

.menu-list{ display:flex; flex-direction:column; gap:8px; margin-bottom:6px; }
.menu-item{
  display:flex; align-items:center; justify-content:space-between;
  background:var(--card);
  border:1px solid var(--card-border);
  border-radius:var(--radius-md);
  padding:14px 16px;
  color:var(--text);
  font-size:14.5px;
  font-weight:600;
  cursor:pointer;
  font-family:var(--font);
}
.menu-item svg{ color:var(--text-faint); }
.logout-btn{ margin-top:18px; color:var(--down); border-color:rgba(239,68,68,0.3); }

/* ---------- Account (guest / registered / PRO) ---------- */
.card-gradient{
  background:
    linear-gradient(135deg, rgba(61,99,255,0.22) 0%, transparent 65%),
    var(--card);
  border-color:rgba(93,125,255,0.28);
}
.card-eyebrow{
  display:inline-block;
  font-size:11px; font-weight:800; letter-spacing:0.08em;
  color:var(--accent-2); text-transform:uppercase;
  background:rgba(61,99,255,0.14); border:1px solid rgba(93,125,255,0.28);
  border-radius:999px; padding:4px 10px; margin-bottom:10px;
}
.card-lead{ font-size:19px; font-weight:800; margin:0 0 6px; letter-spacing:-0.01em; }

.status-badge{
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 10px; border-radius:999px;
  background:var(--panel); border:1px solid var(--card-border);
  font-size:11.5px; font-weight:700; color:var(--text-dim);
  margin-top:8px;
}
.status-badge::before{ content:""; width:7px; height:7px; border-radius:50%; background:var(--text-faint); flex-shrink:0; }
.status-badge[data-status="registered"]{ color:var(--accent-2); }
.status-badge[data-status="registered"]::before{ background:var(--accent); }
.status-badge[data-status="pro_pending"]{ color:#f0b90b; }
.status-badge[data-status="pro_pending"]::before{ background:#f0b90b; animation:statusPulse 1.6s ease-in-out infinite; }
@keyframes statusPulse{ 0%,100%{ opacity:1; } 50%{ opacity:0.35; } }

.why-list{ list-style:none; margin:10px 0 0; padding:0; }
.why-list li{
  display:flex; align-items:flex-start; gap:10px;
  padding:7px 0; font-size:13.5px; color:var(--text-dim); line-height:1.4;
}
.why-list li::before{
  content:""; width:6px; height:6px; border-radius:50%; background:var(--accent);
  flex-shrink:0; margin-top:6px;
}

.benefit-list{ display:flex; flex-direction:column; gap:10px; }
.benefit-row{
  display:flex; gap:12px; padding:12px 14px;
  background:var(--panel); border:1px solid var(--card-border); border-radius:var(--radius-md);
}
.benefit-icon{
  width:34px; height:34px; flex-shrink:0; border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  background:rgba(61,99,255,0.15); color:var(--accent-2);
}
.benefit-title{ font-size:14px; font-weight:700; margin-bottom:2px; }
.benefit-desc{ font-size:12.5px; color:var(--text-faint); line-height:1.45; }

/* Register / apply forms */
.form-field{ margin-bottom:14px; }
.form-label-block{
  display:block; font-size:11.5px; font-weight:700; letter-spacing:0.05em;
  text-transform:uppercase; color:var(--text-faint); margin-bottom:6px;
}
.form-input{
  width:100%; padding:12px 14px; font-size:14.5px; color:var(--text);
  background:var(--panel); border:1px solid var(--card-border); border-radius:var(--radius-md);
  outline:none; font-family:var(--font); transition:border-color .15s;
}
.form-input:focus{ border-color:var(--accent); }
.form-textarea{ resize:vertical; min-height:88px; line-height:1.5; }
.form-hint{ font-size:12px; color:var(--down); margin-top:6px; display:none; }
.form-field.invalid .form-input{ border-color:var(--down); }
.form-field.invalid .form-hint{ display:block; }

.form-consent{
  display:flex; align-items:flex-start; gap:10px; padding:12px;
  background:var(--panel); border:1px solid var(--card-border); border-radius:var(--radius-md);
  margin-bottom:16px; cursor:pointer; user-select:none;
}
.form-consent-box{
  width:18px; height:18px; flex-shrink:0; margin-top:1px; border-radius:5px;
  border:1.5px solid var(--card-border); display:flex; align-items:center; justify-content:center;
  transition:all .15s;
}
.form-consent-box svg{ opacity:0; }
.form-consent.checked .form-consent-box{ background:var(--accent); border-color:var(--accent); }
.form-consent.checked .form-consent-box svg{ opacity:1; }
.form-consent-text{ flex:1; font-size:12.5px; line-height:1.5; color:var(--text-dim); }
.form-consent-text a{ color:var(--accent-2); }
.form-consent.invalid .form-consent-box{ border-color:var(--down); }

.modal-success{ text-align:center; padding:6px 4px 0; }
.modal-success-icon{
  width:60px; height:60px; margin:0 auto 16px; border-radius:50%;
  background:rgba(34,197,94,0.15); color:var(--up);
  display:flex; align-items:center; justify-content:center;
}
.modal-success h3{ font-size:18px; margin:0 0 8px; }
.modal-success .hint-text{ margin-bottom:18px; }

/* Privacy modal */
.privacy-summary{
  padding:14px; background:var(--panel); border:1px solid var(--card-border);
  border-radius:var(--radius-md); font-size:13.5px; line-height:1.6;
  color:var(--text-dim); margin:0 0 12px;
}
.privacy-meta{ font-size:12px; color:var(--text-faint); margin:0 0 14px; }
.privacy-note{ font-size:12px; color:var(--text-faint); margin:10px 0 0; text-align:center; }
.btn svg{ vertical-align:-3px; margin-right:6px; }

/* Settings preferences (visual-only, no i18n/theme system wired yet) */
.pref-toggle{ display:flex; gap:4px; background:var(--panel); border:1px solid var(--card-border); border-radius:999px; padding:3px; }
.pref-btn{
  border:none; background:none; color:var(--text-faint);
  font-size:12px; font-weight:700; padding:6px 12px; border-radius:999px;
  cursor:pointer; font-family:var(--font);
}
.pref-btn.active{ background:var(--accent); color:#fff; }

/* About / privacy link row (thin, in-card, no box) */
.link-row{
  display:flex; align-items:center; gap:12px; width:100%;
  padding:12px 2px; margin-top:8px; border-top:1px solid var(--line);
  background:none; border-left:none; border-right:none; border-bottom:none;
  text-align:left; cursor:pointer; font-family:var(--font);
}
.link-row-icon{
  width:32px; height:32px; flex-shrink:0; border-radius:10px;
  background:var(--panel); color:var(--text-faint);
  display:flex; align-items:center; justify-content:center;
}
.link-row-text{ flex:1; min-width:0; }
.link-row-title{ font-size:14px; font-weight:700; color:var(--text); }
.link-row-desc{ font-size:12px; color:var(--text-faint); margin-top:1px; }
.link-row-arrow{ color:var(--text-faint); flex-shrink:0; }

.version-footer{ text-align:center; font-size:12px; color:var(--text-faint); margin:14px 0 6px; }

/* ---------- Strategy sheet ---------- */
.sheet-overlay{
  position:absolute; inset:0;
  background:rgba(0,0,0,0.55);
  opacity:0; visibility:hidden;
  transition:opacity .25s ease;
  z-index:70;
}
.sheet-overlay.open{ opacity:1; visibility:visible; }

.sheet{
  position:absolute;
  left:0; right:0; bottom:0;
  height:88%;
  background:var(--panel);
  border-radius:26px 26px 0 0;
  padding:10px 20px 90px;
  overflow-y:auto;
  transform:translateY(100%);
  transition:transform .3s cubic-bezier(.32,.72,0,1);
  z-index:80;
  scrollbar-width:none;
}
.sheet::-webkit-scrollbar{ display:none; }
.sheet.open{ transform:translateY(0); }
.sheet-handle{
  width:36px; height:4px; background:var(--handle-color);
  border-radius:3px; margin:8px auto 4px;
}
.subtitle{ color:var(--text-faint); font-size:13.5px; margin:0 0 14px; }

.notice-box{
  display:flex; align-items:flex-start; gap:10px;
  background:var(--card);
  border:1px solid var(--card-border);
  border-radius:var(--radius-md);
  padding:14px;
  color:var(--text-dim);
  font-size:12.5px;
  line-height:1.4;
  margin-bottom:16px;
}
.notice-box svg{ flex-shrink:0; margin-top:1px; color:var(--accent-2); }

/* ---------- Bottom nav ---------- */
.bottom-nav{
  position:absolute;
  left:0; right:0; bottom:0;
  display:flex;
  background:var(--nav-bg);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
  border-top:1px solid var(--line);
  padding:10px 6px 22px;
  z-index:40;
}
.nav-item{
  flex:1;
  display:flex; flex-direction:column; align-items:center; gap:4px;
  background:none; border:none; color:var(--text-faint);
  font-size:10.5px; font-weight:600; cursor:pointer;
  font-family:var(--font);
  padding:4px 0;
}
.nav-item.active{ color:var(--accent-2); }

/* ---------- Toast ---------- */
.toast{
  position:absolute;
  left:50%; bottom:110px;
  transform:translateX(-50%) translateY(20px);
  background:var(--toast-bg);
  border:1px solid var(--card-border);
  color:var(--toast-text);
  padding:12px 18px;
  border-radius:12px;
  font-size:13.5px;
  font-weight:600;
  opacity:0;
  pointer-events:none;
  transition:opacity .25s ease, transform .25s ease;
  z-index:100;
  box-shadow:0 10px 30px rgba(0,0,0,0.4);
  white-space:nowrap;
}
.toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }
