/* ====================================================================
   Optiqo — modern dark trading UI (full-bleed chart, floating controls)
   ==================================================================== */
:root {
  --bg: #0a0b0d;
  --bg-1: #131417;
  --bg-2: #1a1c20;
  --bg-3: #25282e;
  --rail: #0e0f12;

  --green: #1FE07A;
  --green-2: #12b863;
  --red: #FF4D5E;
  --red-2: #e23048;
  --gold: #FFC857;

  --text: #FFFFFF;
  --muted: #8b919c;
  --muted-2: #565c66;
  --line: rgba(255,255,255,0.07);
  --line-2: rgba(255,255,255,0.13);

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-body: 'Inter', system-ui, sans-serif;

  --r: 14px;
  --r-lg: 18px;
  --r-pill: 999px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font-body); overflow: hidden; }
#app, main { height: 100%; }
button { font-family: inherit; color: inherit; border: none; background: none; cursor: pointer; }
input { font-family: inherit; color: inherit; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.disp { font-family: var(--font-display); }
.up { color: var(--green); }
.down { color: var(--red); }
.gold { color: var(--gold); }
.muted { color: var(--muted); }

@keyframes flashUp { 0% { color: var(--green); } 100% {} }
@keyframes flashDown { 0% { color: var(--red); } 100% {} }
.flash-up { animation: flashUp .45s ease-out; }
.flash-down { animation: flashDown .45s ease-out; }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); position: relative; flex: none; }
.live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: var(--green); opacity: .5; animation: ping 1.6s cubic-bezier(0,0,.2,1) infinite; }
@keyframes ping { 75%, 100% { transform: scale(2.2); opacity: 0; } }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: var(--r-pill); background: var(--bg-1); border: 1px solid var(--line); font-size: 13px; font-weight: 600; white-space: nowrap; transition: all .15s; }
.pill.active { background: rgba(31,224,122,.13); border-color: rgba(31,224,122,.4); color: var(--green); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; }
.badge.pos { background: rgba(31,224,122,.14); color: var(--green); }
.badge.neg { background: rgba(255,77,94,.14); color: var(--red); }

.cta-green { background: linear-gradient(95deg, #0fce8f, var(--green)); color: #042713; font-weight: 700; border-radius: var(--r); padding: 11px 20px; font-size: 14px; box-shadow: 0 6px 20px -8px rgba(31,224,122,.7); }

.asset-pill { display: flex; align-items: center; gap: 11px; padding: 8px 14px; border-radius: var(--r); background: var(--bg-1); border: 1px solid var(--line); cursor: pointer; transition: background .15s; }
.asset-pill:hover { background: var(--bg-2); }
.asset-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 13px; flex: none; color: #04210f; background: linear-gradient(135deg, #ff9d5c, #ff5e7e); }
.asset-pill .nm { font-weight: 700; font-size: 14px; line-height: 1.15; }
.asset-pill .meta { font-size: 11px; color: var(--muted); }

.stepper { display: flex; align-items: center; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); height: 52px; overflow: hidden; }
.stepper .sbtn { width: 50px; height: 100%; display: grid; place-items: center; font-size: 22px; color: var(--muted); transition: background .12s, color .12s; flex: none; }
.stepper .sbtn:hover { background: var(--bg-2); color: var(--text); }
.stepper .sval { flex: 1; text-align: center; }
.stepper .sval .lbl { font-size: 10px; color: var(--muted-2); font-weight: 600; letter-spacing: .04em; }
.stepper .sval .num { font-family: var(--font-mono); font-weight: 700; font-size: 17px; }

.order-btn { height: 52px; border-radius: var(--r); background: var(--bg-1); border: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 18px; font-weight: 700; font-size: 14px; transition: background .15s; }
.order-btn:hover { background: var(--bg-2); }

.bigbtn { height: 58px; border-radius: var(--r); display: flex; align-items: center; justify-content: space-between; padding: 0 22px; font-family: var(--font-display); font-weight: 700; font-size: 19px; position: relative; overflow: hidden; transition: transform .08s, filter .15s; }
.bigbtn:hover { filter: brightness(1.08); }
.bigbtn:active { transform: scale(.975); }
.bigbtn.up { background: linear-gradient(100deg, #14c46e, var(--green)); color: #052b14; box-shadow: 0 8px 26px -10px rgba(31,224,122,.8); }
.bigbtn.down { background: linear-gradient(100deg, var(--red), #ff6b7a); color: #2c0008; box-shadow: 0 8px 26px -10px rgba(255,77,94,.8); }
.bigbtn .ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.5); transform: translate(-50%,-50%) scale(0); animation: ripple .55s ease-out; pointer-events: none; }
@keyframes ripple { to { transform: translate(-50%,-50%) scale(8); opacity: 0; } }

.profit-line { text-align: center; font-size: 13px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.profit-line b { color: var(--green); font-family: var(--font-mono); }
.q-mark { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--muted-2); color: var(--muted); font-size: 10px; display: inline-grid; place-items: center; }

.chart-shell { position: relative; flex: 1; min-height: 0; height: 100%; background: var(--bg); overflow: hidden; }
.chart-shell canvas { display: block; width: 100%; height: 100%; }
.chart-shell iframe { width: 100% !important; height: 100% !important; border: none !important; display: block; }
.chart-tools { position: absolute; left: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; background: rgba(19,20,23,.85); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; backdrop-filter: blur(8px); z-index: 3; }
.ctool { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); font-weight: 700; font-size: 13px; transition: background .12s, color .12s; }
.ctool:hover, .ctool.active { background: var(--bg-2); color: var(--text); }
.ctool.active { color: var(--green); }
.zoom-pill { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 4px; background: rgba(19,20,23,.85); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 5px; backdrop-filter: blur(8px); z-index: 3; }
.zoom-pill button { width: 38px; height: 30px; border-radius: var(--r-pill); display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.zoom-pill button:hover { background: var(--bg-2); color: var(--text); }

/* DESKTOP */
.q-desktop { display: none; }
.q-mobile { display: flex; flex-direction: column; height: 100%; width: 100%; max-width: 480px; margin: 0 auto; position: relative; overflow: hidden; background: var(--bg); box-shadow: 0 0 0 1px var(--line); }

@media (min-width: 1024px) {
  .q-mobile { display: none; }
  .q-desktop { display: flex; height: 100%; position: relative; }
}

.rail { width: 82px; flex: none; background: var(--rail); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 4px; }
.rail .logo-dot { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, var(--green), #0fce8f); display: grid; place-items: center; margin-bottom: 12px; color: #042713; }
.rail-item { width: 62px; height: 54px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted-2); position: relative; transition: color .15s, background .15s; }
.rail-item:hover { color: var(--text); background: var(--bg-1); }
.rail-item.active { color: var(--text); background: var(--bg-1); }
.rail-item.active::before { content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%); width: 3px; height: 22px; border-radius: 3px; background: var(--green); }
.rail-item .gdot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.rail-label { font-size: 9px; font-weight: 500; letter-spacing: 0.03em; line-height: 1; }
.rail-spacer { flex: 1; }

.q-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.q-top { height: 68px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.add-btn { width: 46px; height: 46px; border-radius: var(--r); background: var(--bg-1); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); flex: none; }
.add-btn:hover { background: var(--bg-2); color: var(--text); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.bal-block { text-align: right; }
.bal-block .amt { font-family: var(--font-mono); font-weight: 700; font-size: 17px; }
.bal-block .acct { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; justify-content: flex-end; cursor: pointer; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--bg-2); border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--muted); position: relative; }
.avatar .on { position: absolute; bottom: 2px; left: 2px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); border: 2px solid var(--rail); }

.q-stage { flex: 1; display: flex; min-height: 0; }
.q-right { width: 326px; flex: none; padding: 18px; display: flex; flex-direction: column; gap: 12px; border-left: 1px solid var(--line); background: var(--bg); overflow: hidden; }
.q-right > * { flex-shrink: 0; }
.open-trades-container { max-height: 300px; overflow-y: auto; }

/* MOBILE */
.m-top { height: 56px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; }
.m-top .center { text-align: center; }
.m-top .center .amt { font-family: var(--font-mono); font-weight: 700; font-size: 15px; }
.m-top .center .acct { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 3px; justify-content: center; }
.m-app-btn { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, var(--green), #0fce8f); display: grid; place-items: center; color: #042713; }
.avatar-sm { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-2); border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--muted); position: relative; }
.avatar-sm .on { position: absolute; bottom: 1px; left: 1px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); border: 2px solid var(--bg); }

.m-asset-row { display: flex; align-items: center; gap: 8px; padding: 4px 14px 10px; }
.m-asset-row .asset-pill { flex: 1; padding: 7px 12px; }
.m-asset-row .asset-ic { width: 30px; height: 30px; }
.mini-tool { width: 38px; height: 38px; border-radius: 11px; background: var(--bg-1); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 700; flex: none; }

.m-controls { flex: none; padding: 10px 14px calc(8px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.m-controls .mode-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 12px; }
.m-controls .mode-row .mode { color: var(--muted); font-weight: 600; }
.m-steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.m-actions { display: grid; grid-template-columns: 1fr 56px 1fr; gap: 10px; }
.m-order { width: 56px; height: 58px; border-radius: var(--r); background: var(--bg-1); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.m-order:hover { color: var(--text); }

.m-nav { height: 58px; flex: none; display: flex; border-top: 1px solid var(--line); background: var(--rail); padding-bottom: env(safe-area-inset-bottom); }
.nav-item { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted-2); position: relative; transition: color .15s; }
.nav-item.active { color: var(--text); }
.nav-item .gdot { position: absolute; top: 11px; margin-left: 18px; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

/* Secondary screens */
.scr { flex: 1; overflow-y: auto; padding: 18px 16px 28px; }
.scr::-webkit-scrollbar { display: none; }
.scr h2 { font-family: var(--font-display); font-size: 23px; font-weight: 700; }
.scr .sub { color: var(--muted); font-size: 13px; margin: 2px 0 16px; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 20px 2px 10px; }

.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.stat { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 12px; }
.stat .k { font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.stat .v { font-family: var(--font-mono); font-size: 19px; font-weight: 700; }

.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; cursor: pointer; transition: background .12s; }
.row:hover { background: var(--bg-2); }
.row .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--bg-2); display: grid; place-items: center; font-weight: 700; font-family: var(--font-display); flex: none; font-size: 13px; }
.row .name { font-weight: 700; font-size: 14px; }
.row .meta { font-size: 12px; color: var(--muted); }
.row .right { margin-left: auto; text-align: right; }
.row .px { font-family: var(--font-mono); font-weight: 700; font-size: 14px; }
.star { color: var(--muted-2); font-size: 16px; padding: 4px; }
.star.on { color: var(--gold); }
.spark { width: 50px; height: 24px; flex: none; }

.hist { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.hist .res { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 14px; font-weight: 700; flex: none; }
.hist .res.win { background: rgba(31,224,122,.14); color: var(--green); }
.hist .res.loss { background: rgba(255,77,94,.14); color: var(--red); }
.hist .pnl { margin-left: auto; font-family: var(--font-mono); font-weight: 700; }

/* Asset picker */
.sheet-scrim { position: absolute; inset: 0; background: rgba(5,6,8,.65); z-index: 40; backdrop-filter: blur(2px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--bg-1); border-radius: 22px 22px 0 0; border-top: 1px solid var(--line-2); max-height: 88%; display: flex; flex-direction: column; animation: slideUp .32s cubic-bezier(.2,.9,.25,1); }
@keyframes slideUp { from { transform: translateY(100%); } }
.sheet.pop { left: 16px; right: auto; bottom: auto; top: 68px; width: 420px; max-height: 70%; border-radius: var(--r-lg); border: 1px solid var(--line-2); box-shadow: 0 30px 80px -20px rgba(0,0,0,.8); animation: popIn .2s ease-out; }
@keyframes popIn { from { transform: translateY(-10px); opacity: 0; } }
.sheet-grab { width: 40px; height: 4px; border-radius: 4px; background: var(--bg-3); margin: 10px auto 4px; }
.sheet-head { padding: 8px 16px 12px; border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.search input { flex: 1; background: none; border: none; outline: none; font-size: 14px; }
.sheet-body { overflow-y: auto; padding: 8px 12px 20px; }
.cat-head { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 4px 6px; position: sticky; top: 0; background: var(--bg-1); }

/* Toasts */
.toast-host { position: absolute; top: 0; left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 14px; pointer-events: none; }
.toast { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 11px 16px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 10px; box-shadow: 0 12px 40px -10px rgba(0,0,0,.7); animation: toastIn .35s cubic-bezier(.2,.9,.25,1); max-width: 92%; }
.toast.win { border-color: rgba(31,224,122,.4); }
.toast.loss { border-color: rgba(255,77,94,.4); animation: toastIn .35s, shake .4s .1s; }
@keyframes toastIn { from { transform: translateY(-24px); opacity: 0; } }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }

/* Result modal */
.modal-scrim { position: absolute; inset: 0; z-index: 70; background: rgba(5,6,8,.8); display: grid; place-items: center; backdrop-filter: blur(4px); animation: fade .25s; }
.result-card { text-align: center; padding: 34px 30px; border-radius: 24px; background: var(--bg-1); border: 1px solid var(--line-2); width: 84%; max-width: 340px; animation: pop .4s cubic-bezier(.2,1.3,.4,1); }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }
.result-card .big-amt { font-family: var(--font-mono); font-size: 42px; font-weight: 700; margin: 12px 0 4px; }
.result-card h3 { font-family: var(--font-display); font-size: 26px; letter-spacing: .04em; }
.check-ring { width: 78px; height: 78px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; font-size: 38px; animation: popRing .5s cubic-bezier(.2,1.4,.4,1); }
.check-ring.win { background: rgba(31,224,122,.16); color: var(--green); box-shadow: 0 0 0 8px rgba(31,224,122,.06); }
.check-ring.loss { background: rgba(255,77,94,.16); color: var(--red); box-shadow: 0 0 0 8px rgba(255,77,94,.06); }
.btn-primary { width: 100%; height: 50px; border-radius: 14px; font-family: var(--font-display); font-weight: 700; font-size: 16px; margin-top: 22px; background: var(--text); color: var(--bg); }
.btn-primary.green { background: var(--green); color: #042713; }

.confetti { position: absolute; inset: 0; z-index: 69; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(120vh) rotate(720deg); opacity: 1; } }

/* Deposit / Tournament / Profile */
.pay-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 16px; }
.pay { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 10px; text-align: center; font-size: 13px; font-weight: 700; }
.pay.active { border-color: rgba(31,224,122,.45); background: rgba(31,224,122,.08); }
.pay .pic { font-size: 22px; margin-bottom: 8px; }
.amt-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.amt-opt { height: 52px; border-radius: 12px; background: var(--bg-1); border: 1px solid var(--line); font-family: var(--font-mono); font-weight: 700; font-size: 16px; }
.amt-opt.active { border-color: rgba(31,224,122,.45); background: rgba(31,224,122,.1); color: var(--green); }
.bonus { background: linear-gradient(100deg, rgba(255,200,87,.14), rgba(255,200,87,.04)); border: 1px solid rgba(255,200,87,.3); border-radius: var(--r); padding: 14px; margin: 16px 0; display: flex; gap: 12px; align-items: center; }
.tcard { background: linear-gradient(135deg, var(--bg-1), var(--bg-2)); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px; }
.tcard .prize { font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: var(--gold); }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.lb-row .rank { width: 24px; font-family: var(--font-mono); font-weight: 700; color: var(--muted); }
.lb-row .rank.top { color: var(--gold); }
.prof-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.prof-av { width: 62px; height: 62px; border-radius: 18px; background: var(--bg-2); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 24px; border: 1px solid var(--line-2); }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 15px 4px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; cursor: pointer; }
.menu-item .chev { margin-left: auto; color: var(--muted-2); }
.vip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-pill); background: rgba(255,200,87,.12); color: var(--gold); font-size: 11px; font-weight: 700; border: 1px solid rgba(255,200,87,.3); }
.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 8px; }

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}
