/* سودسنج / Sodsanj — iOS Glass Mini App (HTML/CSS/JS) */
:root{
  --bg0:#00020a; --bg1:#050815;
  --card: rgba(255,255,255,.08);
  --card2: rgba(255,255,255,.10);
  --stroke: rgba(255,255,255,.14);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.62);
  --shadow: 0 18px 50px rgba(0,0,0,.35);
  --blur: 20px;

  --accentA:#59d8ff; --accentB:#8a5bff;
  --good:#39d98a; --bad:#ff5b6b;

  --radius:24px; --radius2:18px;
  --speed:260ms; --ease: cubic-bezier(.2,.9,.2,1);
  --safeB: env(safe-area-inset-bottom, 0px);
  --safeT: env(safe-area-inset-top, 0px);

  --font: ui-sans-serif, system-ui, -apple-system, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Arial;

  /* Status Banner theme vars (Dynamic Island-ish) */
  --status-bg: rgba(8,10,18,.72);
  --status-stroke: rgba(255,255,255,.16);
  --status-shadow: 0 22px 60px rgba(0,0,0,.28);

  /* Auth glass (darker like menu, a bit more translucent) */
  --auth-bg: rgba(8,10,18,.78);
  --auth-bg2: rgba(8,10,18,.70);
  --auth-stroke: rgba(255,255,255,.16);
}

[data-theme="light"]{
  --bg0:#f2f5ff; --bg1:#e9efff;
  --card: rgba(255,255,255,.65);
  --card2: rgba(255,255,255,.78);
  --stroke: rgba(20,24,40,.10);
  --text: rgba(12,16,28,.92);
  --muted: rgba(12,16,28,.55);
  --shadow: 0 18px 50px rgba(20,24,40,.12);

  --status-bg: rgba(255,255,255,.78);
  --status-stroke: rgba(12,16,28,.12);
  --status-shadow: 0 22px 60px rgba(20,24,40,.14);

  /* Auth glass (slightly more translucent than Status Banner) */
  --auth-bg: rgba(255,255,255,.86);
  --auth-bg2: rgba(255,255,255,.78);
  --auth-stroke: rgba(12,16,28,.12);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font);
  color:var(--text);
  background:
    radial-gradient(1200px 650px at 20% -5%, rgba(89,216,255,.05), transparent 55%),
    radial-gradient(1000px 600px at 100% 10%, rgba(138,91,255,.08), transparent 50%),
    radial-gradient(900px 520px at 50% 110%, rgba(89,216,255,.05), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  overflow-x:hidden;
}

.bg-glow{
  position:fixed; inset:-40px;
  pointer-events:none;
  background:
    radial-gradient(520px 340px at 8% 15%, rgba(89,216,255,.14), transparent 62%),
    radial-gradient(600px 380px at 92% 12%, rgba(138,91,255,.12), transparent 62%),
    radial-gradient(520px 340px at 50% 96%, rgba(89,216,255,.05), transparent 65%);
  opacity:.95;
}

.app{
  min-height:100%;
  padding: calc(14px + var(--safeT)) 14px calc(96px + var(--safeB)) 14px;
  max-width:1100px;
  margin:0 auto;
}

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; margin-bottom:14px;
}

.brand{ display:flex; align-items:center; gap:10px; min-width:0; }
.logo{
  width:40px;height:40px;border-radius:14px;
  background: linear-gradient(135deg, rgba(89,216,255,.92), rgba(138,91,255,.92));
  box-shadow: 0 10px 30px rgba(89,216,255,.18);
  position:relative; overflow:hidden;
}
.logo::after{
  content:""; position:absolute; inset:-30px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.55), transparent 55%);
  transform: rotate(25deg);
}
.brandText{ min-width:0; }
.title{
  margin:0; font-size:16px; line-height:1.1;
  font-weight: 950; letter-spacing:-.2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.title .en{ opacity:.7; font-weight:800; }
.subtitle{
  margin-top:3px; font-size:12px; color:var(--muted);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.pill{
  border:1px solid var(--stroke);
  border-radius:999px;
  padding:10px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.06));
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
  color: var(--muted);
  font-weight:900; font-size:12px;
  display:flex; align-items:center; gap:8px;
  cursor:pointer;
  transition: transform var(--speed) var(--ease);
}
.pill:active{ transform: scale(.98); }

.dot{
  width:8px;height:8px;border-radius:50%;
  background: linear-gradient(135deg, var(--accentA), var(--accentB));
  box-shadow: 0 0 0 6px rgba(89,216,255,.05);
  will-change: transform, filter;
  animation: dotPulse 1.6s cubic-bezier(.2,.9,.2,1) infinite;
}

/* Layout */
.grid{ display:grid; grid-template-columns: 1fr; gap:12px; }
@media (min-width:820px){ .grid{ grid-template-columns: 1.1fr .9fr; } }

.card{
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--stroke);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
  overflow:hidden;
  position:relative;
}
.card::before{
  content:""; position:absolute; inset:0;
  background:
    radial-gradient(700px 220px at 10% 0%, rgba(89,216,255,.14), transparent 55%),
    radial-gradient(700px 220px at 90% 0%, rgba(138,91,255,.12), transparent 55%);
  pointer-events:none;
}
.cardInner{ position:relative; padding:14px; }

.row2{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }

.mini{
  border-radius: var(--radius2);
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.06));
  border: 1px solid var(--stroke);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  padding:12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}

.mini h3{
  margin:0 0 8px 0;
  font-size:12px; color:var(--muted);
  font-weight:950; letter-spacing:-.2px;
}

.sectionTitle{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; margin-bottom:12px;
}
.sectionTitle h2{ margin:0; font-size:13px; font-weight:1000; letter-spacing:-.2px; }
.hint{ color:var(--muted); font-size:12px; white-space:nowrap; }

.big{
  margin:0; font-size:22px; font-weight:1000; letter-spacing:-.4px;
  display:flex; align-items:baseline; gap:8px;
}
.unit{ font-size:12px; color:var(--muted); font-weight:900; }

.delta{
  font-size:12px; font-weight:1000;
  padding:6px 10px; border-radius:999px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  color: var(--muted);
}
.delta.good{ color: rgba(57,217,138,.95); border-color: rgba(57,217,138,.22); background: rgba(57,217,138,.08); }
.delta.bad{  color: rgba(255,91,107,.95); border-color: rgba(255,91,107,.22); background: rgba(255,91,107,.08); }

.split{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.heavy{ font-weight:1000; letter-spacing:-.2px; }
.muted{ color:var(--muted); font-size:12px; margin-top:6px; }
.small{ font-size:12px; line-height:1.8; margin:8px 0 0 0; }

.hr{ height:1px; background: rgba(255,255,255,.10); margin:12px 0; }
[data-theme="light"] .hr{ background: rgba(12,16,28,.10); }

/* Buttons */
.btn{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.08);
  color: var(--text);
  padding:10px 12px;
  border-radius:14px;
  font-weight:1000; font-size:12px;
  cursor:pointer;
  transition: transform var(--speed) var(--ease), background var(--speed) var(--ease);
  user-select:none;
}
.btn:active{ transform: scale(.98); }
.btn.primary{
  background: linear-gradient(135deg, rgba(89,216,255,.92), rgba(138,91,255,.92));
  border-color: rgba(255,255,255,.20);
  box-shadow: 0 14px 40px rgba(89,216,255,.18);
  color: rgba(8,10,16,.92);
}
[data-theme="light"] .btn.primary{ color: rgba(255,255,255,.95); }
.btn:disabled{ opacity:.45; cursor:not-allowed; }

.btn.good{ background: rgba(57,217,138,.10); border-color: rgba(57,217,138,.26); color: rgba(57,217,138,.95); }
.btn.bad{  background: rgba(255,91,107,.10); border-color: rgba(255,91,107,.26); color: rgba(255,91,107,.95); }

/* Slider */
.sliderWrap{ display:flex; align-items:center; gap:12px; margin-top:8px; }
input[type="range"]{ width:100%; accent-color: var(--accentA); }
.nBox{
  min-width:48px; text-align:center;
  padding:10px 10px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  font-weight:1000;
}

/* Trades */
.trades{ display:flex; flex-direction:column; gap:10px; }
.trade{
  display:grid; grid-template-columns: 1fr auto;
  gap:10px; align-items:center;
  padding:12px;
  border-radius: var(--radius2);
  background: rgba(255,255,255,.06);
  border:1px solid var(--stroke);
  transition: transform var(--speed) var(--ease);
}
.trade:hover{ transform: translateY(-1px); }

.tMeta{ display:flex; flex-direction:column; gap:4px; min-width:0; }
.tName{ font-weight:1000; font-size:13px; letter-spacing:-.2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tStatus{ font-size:12px; color:var(--muted); display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

.chip{
  font-size:11px; font-weight:1000;
  padding:5px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  color:var(--muted);
}
.chip.win{ color: rgba(57,217,138,.95); border-color: rgba(57,217,138,.24); background: rgba(57,217,138,.08); }
.chip.loss{ color: rgba(255,91,107,.95); border-color: rgba(255,91,107,.24); background: rgba(255,91,107,.08); }

.tActions{ display:flex; gap:8px; align-items:center; }

/* Chart */
.chartWrap{
  border-radius: var(--radius2);
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  padding:10px;
  overflow:hidden;
}
canvas{ width:100%; height:160px; display:block; }

/* Views */
.view{ display:none; animation: fadeUp .36s var(--ease) both; }
.view.active{ display:block; }
@keyframes fadeUp{
  from{ opacity:0; transform: translateY(10px); filter: blur(4px); }
  to{ opacity:1; transform: translateY(0); filter: blur(0); }
}

/* Bottom Nav */
.nav{
  position:fixed;
  left:12px; right:12px;
  bottom: calc(10px + var(--safeB));
  height:70px;
  border-radius:26px;
  /* Match Status Banner glass (same darkness + translucency) */
  background: var(--status-bg);
  border: 1px solid var(--status-stroke);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--status-shadow);
  overflow:hidden;
  isolation:isolate;
  display:flex; align-items:center; justify-content:space-around;
  padding:8px;
  z-index:50;
}

/* Subtle highlight like Status Banner */
.nav::before{
  content:"";
  position:absolute;
  inset:-1px;
  border-radius: inherit;
  background: radial-gradient(520px 140px at 30% 0%, rgba(255,255,255,.12), transparent 60%);
  pointer-events:none;
  opacity:.9;
}
.navBtn{
  width:25%; height:100%;
  border:0; background:transparent;
  color:var(--muted);
  font-weight:1000;
  cursor:pointer;
  border-radius:18px;
  transition: background var(--speed) var(--ease), transform var(--speed) var(--ease), color var(--speed) var(--ease);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:6px; user-select:none;
}
.navBtn:active{ transform: scale(.98); }
.navBtn.active{ background: rgba(255,255,255,.12); color: var(--text); }
.navLbl{ font-size:11px; }
.navIco{ width:22px; height:22px; display:block; opacity:.92; }

/* iOS overlays (soft open/close like iOS) */
.modalBack,
.authBack,
.loaderBack{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;

  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition: opacity 240ms var(--ease), visibility 240ms var(--ease);
  will-change: opacity;
}

/* Individual overlay backdrops */
.modalBack{ background: rgba(0,0,0,.45); align-items:flex-end; z-index:80; 
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);}
.authBack{  background: rgba(0,0,0,.55); z-index:130; 
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);}
.loaderBack{ background: rgba(0,0,0,.35); z-index:120; }

/* Open state */
.modalBack.show,
.authBack.show,
.loaderBack.show{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
}

/* Closing state (lets us play exit animation before hiding) */
.modalBack.closing,
.authBack.closing,
.loaderBack.closing{
  opacity:0;
  visibility:visible;
  pointer-events:none;
}

/* Panels animate with the overlay state (iOS-like) */
.sheet,
.authCard,
.loaderCard{
  transform: translateY(16px) scale(.985);
  opacity:0;
  filter: blur(10px);
  transition:
    transform 320ms var(--ease),
    opacity 240ms var(--ease),
    filter 320ms var(--ease);
  will-change: transform, opacity, filter;
}

.modalBack.show .sheet,
.authBack.show .authCard,
.loaderBack.show .loaderCard{
  transform: translateY(0) scale(1);
  opacity:1;
  filter: blur(0);
}

.modalBack.closing .sheet,
.authBack.closing .authCard,
.loaderBack.closing .loaderCard{
  transform: translateY(12px) scale(.985);
  opacity:0;
  filter: blur(10px);
}

/* iOS sheet modal */
.sheet{
  width: min(720px, 100%);
  border-radius: 28px 28px 0 0;
  background: linear-gradient(180deg, var(--card2), var(--card));
  border:1px solid var(--stroke);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  box-shadow: 0 -20px 60px rgba(0,0,0,.35);
  padding:14px;
}
.grab{
  width:52px; height:5px;
  border-radius:999px;
  background: rgba(255,255,255,.22);
  margin:6px auto 10px;
}
.sheet h3{ margin:0 0 6px 0; font-size:14px; font-weight:1000; }
.sheet p{ margin:0 0 12px 0; }
.actions{ display:flex; gap:10px; }

/* Toast */
.toast{
  position:fixed;
  left:50%;
  transform: translateX(-50%);
  bottom: calc(92px + var(--safeB));
  background: rgba(0,0,0,.55);
  color: rgba(255,255,255,.92);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 16px 50px rgba(0,0,0,.25);
  opacity:0;
  pointer-events:none;
  transition: opacity var(--speed) var(--ease), transform var(--speed) var(--ease);
  z-index:90;
}
.toast.show{ opacity:1; transform: translateX(-50%) translateY(-2px); }


/* Active dot reflection (subtle iOS pulse) */
@keyframes dotPulse{
  0%   { transform: scale(0);   box-shadow: 0 0 0 0 rgba(89,216,255,.00), 0 0 0 rgba(89,216,255,.00); filter: brightness(.9); opacity:0; }
  35%  { transform: scale(1);   box-shadow: 0 0 0 6px rgba(89,216,255,.10), 0 0 18px rgba(89,216,255,.10); filter: brightness(1); opacity:1; }
  60%  { transform: scale(1.18); box-shadow: 0 0 0 10px rgba(89,216,255,.14), 0 0 26px rgba(138,91,255,.16); filter: brightness(1.15); opacity:1; }
  100% { transform: scale(0);   box-shadow: 0 0 0 0 rgba(89,216,255,.00), 0 0 0 rgba(89,216,255,.00); filter: brightness(.9); opacity:0; }
}
  50%  { transform: scale(1.18); box-shadow: 0 0 0 10px rgba(89,216,255,.14), 0 0 26px rgba(138,91,255,.16); filter: brightness(1.15); }
  100% { transform: scale(1);   box-shadow: 0 0 0 6px rgba(89,216,255,.10), 0 0 18px rgba(89,216,255,.10); filter: brightness(1); }
}


/* Loader (Glass) */
.loaderCard{
  width: min(520px, calc(100% - 28px));
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.08));
  border: 1px solid var(--stroke);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  box-shadow: var(--shadow);
  padding: 14px;
  display:flex;
  align-items:center;
  gap: 12px;
}
.spinner{
  width: 34px; height:34px;
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,.18);
  border-top-color: rgba(255,255,255,.72);
  animation: spin 1s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }
.loaderTitle{ font-weight: 1000; letter-spacing:-.2px; }
.loaderSub{ color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Auth overlay */
.authCard{
  width: min(520px, calc(100% - 28px));
  border-radius: 28px;
  /* darker like bottom menu, but a bit more glassy */
  background: linear-gradient(180deg, var(--auth-bg), var(--auth-bg2));
  border: 1px solid var(--auth-stroke);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow: var(--shadow);
  padding: 14px;
}

@media (prefers-reduced-motion: reduce){
  .modalBack,
  .authBack,
  .loaderBack,
  .sheet,
  .authCard,
  .loaderCard{
    transition: none !important;
    filter: none !important;
    transform: none !important;
  }
}
.logo.sm{ width:34px; height:34px; border-radius: 14px; }
.authHeader{ margin-bottom: 10px; }
.authBrand{ display:flex; align-items:center; gap: 10px; }
.authTitle{ font-weight: 1100; letter-spacing:-.2px; }
.authHint{ color: var(--muted); font-size: 12px; margin-top: 3px; }

.authTabs{
  display:flex; gap: 8px;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 6px;
  background: rgba(255,255,255,.06);
  margin: 10px 0;
}
.tab{
  flex:1;
  border:0;
  border-radius: 12px;
  padding: 10px;
  font-weight: 1000;
  background: transparent;
  color: var(--muted);
  cursor:pointer;
  transition: background var(--speed) var(--ease), transform var(--speed) var(--ease), color var(--speed) var(--ease);
}
.tab:active{ transform: scale(.98); }
.tab.active{
  background: rgba(255,255,255,.12);
  color: var(--text);
}

.authForm{ display:flex; flex-direction:column; gap: 10px; }
.authForm.hidden{ display:none; }

.field{ display:flex; flex-direction:column; gap: 6px; }
.field span{ font-size: 12px; color: var(--muted); font-weight: 900; }
.input{
  width:100%;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  color: var(--text);
  outline: none;
  font-weight: 800;
  transition: transform var(--speed) var(--ease), border-color var(--speed) var(--ease), background var(--speed) var(--ease);
}
.input:focus{
  border-color: rgba(89,216,255,.45);
  background: rgba(255,255,255,.08);
}
.full{ width:100%; justify-content:center; }
.ghost{ background: rgba(255,255,255,.06); }
.authMsg{ min-height: 18px; font-size: 12px; color: var(--muted); }
.authMsg.good{ color: rgba(57,217,138,.95); }
.authMsg.bad{ color: rgba(255,91,107,.95); }
.authFoot{ margin-top: 10px; font-size: 11px; color: var(--muted); line-height: 1.7; }

/* Profile */
.profileBox{ padding: 14px; }
.profileTop{ display:flex; gap: 12px; align-items:center; }
.avatarWrap{
  width: 84px; height: 84px; border-radius: 26px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  overflow:hidden;
  display:grid; place-items:center;
  position:relative;
}
.avatarImg, .avatarCanvas{ width:84px; height:84px; display:none; }
.profileMeta{ min-width:0; }
.profileName{ font-weight: 1100; font-size: 16px; letter-spacing:-.2px; }
.profileSub{ color: var(--muted); font-size: 12px; margin-top: 4px; }
.profileBadges{ display:flex; gap: 8px; margin-top: 8px; flex-wrap:wrap; }
.statMini{ padding: 12px; }


/* Status Banner (Dynamic Island-ish, auto-hide) */
.statusBanner{
  position: fixed;
  left: 50%;
  top: calc(12px + var(--safeT));
  width: min(560px, calc(100% - 28px));
  transform: translateX(-50%);
  z-index: 140;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--speed) var(--ease);
}
.statusBanner.show{
  opacity: 1;
  visibility: visible;
}
.statusInner{
  border-radius: 999px;
  background: var(--status-bg);
  border: 1px solid var(--status-stroke);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--status-shadow);
  padding: 12px 14px;
  transform-origin: 50% 0%;
}
.statusBanner.show .statusInner{
  animation: islandIn 520ms var(--ease) both;
}
.statusBanner.hide .statusInner{
  animation: islandOut 240ms var(--ease) both;
}
.statusBanner.pulse .statusInner{
  animation: islandIn 520ms var(--ease) both;
}
.statusInner::before{
  content:"";
  position:absolute;
  inset:-1px;
  border-radius: inherit;
  background: radial-gradient(420px 120px at 30% 0%, rgba(255,255,255,.12), transparent 60%);
  pointer-events:none;
  opacity: .9;
}
.statusInner{ position:relative; }
.statusTitle{
  font-weight: 1100;
  letter-spacing:-.2px;
}
.statusSub{
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

@keyframes islandIn{
  0%{ transform: translateY(-10px) scale(.86); filter: blur(10px); border-radius: 999px; opacity:0; }
  60%{ transform: translateY(0) scale(1.02); filter: blur(0); opacity:1; }
  100%{ transform: translateY(0) scale(1); filter: blur(0); border-radius: 22px; opacity:1; }
}
@keyframes islandOut{
  from{ transform: translateY(0) scale(1); filter: blur(0); opacity:1; }
  to{ transform: translateY(-8px) scale(.92); filter: blur(8px); opacity:0; }
}

/* variants */
.statusBanner.success .statusTitle{ color: rgba(57,217,138,.98); }
.statusBanner.error .statusTitle{ color: rgba(255,91,107,.98); }
