/* App shell: full-height column, scrollable view, fixed tab bar. */
html, body.app { height: 100%; }
body.app { display: flex; flex-direction: column; overflow: hidden; background: #070707; font-size: 15px; overscroll-behavior: none; }
.mono { font-family: var(--mono); }

/* ---------- Splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: .6rem; text-align: center;
  background: radial-gradient(circle at 50% 40%, #1E1A12, #070707 70%); transition: opacity .5s var(--ease), visibility .5s;
}
.splash.done { opacity: 0; visibility: hidden; }
.splash-mark { width: 110px; height: 74px; overflow: visible; animation: mark-in .9s var(--ease) both; }
.splash h1 { font-size: 3.2rem; font-weight: 800; animation: fade-in .8s .25s var(--ease) both; }
.splash p { color: var(--gold); font-size: 1.1rem; line-height: 1.4; animation: fade-in .8s .45s var(--ease) both; }
.splash-bar { width: 90px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); margin-top: 3rem; overflow: hidden; }
.splash-bar span { display: block; height: 100%; width: 100%; background: var(--gold-grad); transform-origin: left; animation: load var(--splash, 1.4s) var(--ease) forwards; }
@keyframes mark-in { from { opacity: 0; transform: translateY(20px) scale(.8); } }
@keyframes fade-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes load { from { transform: scaleX(0); } }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: .6rem; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line-soft); background: #0B0B0B; flex: none;
}
.topbar h1 { font-size: 1.15rem; font-weight: 700; flex: 1; }
.back { display: grid; place-items: center; width: 32px; height: 32px; margin-left: -6px; border-radius: 8px; }
.back svg, .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.demo-pill { font-size: .65rem; font-weight: 700; letter-spacing: .12em; padding: .3em .7em; border-radius: 99px; border: 1px solid var(--line); color: var(--gold); }

/* ---------- View ---------- */
#view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen { padding: 14px 14px 24px; display: grid; gap: 12px; max-width: 560px; margin: 0 auto; animation: screen-in .35s var(--ease); }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }

.card { display: block; padding: 14px; border-radius: var(--radius); background: #121110; border: 1px solid var(--line-soft); }
.card-title { font-size: .9rem; font-weight: 600; margin-bottom: .7rem; }

.quote-row { display: flex; align-items: center; gap: 10px; }
.quote-row.compact { padding: 2px 2px 4px; }
.coin { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #3A2706; background: var(--gold-grad); box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .3); }
.sym { flex: 1; display: grid; }
.sym small, .card small { color: var(--muted); font-size: .75rem; }
.px { display: grid; text-align: right; }
.px strong { font-size: 1.35rem; transition: color .3s; }
[data-bid].tick-up { color: var(--up); }
[data-bid].tick-down { color: var(--down); }
.side strong.tick-up, .side strong.tick-down { color: inherit; } /* keep prices readable on red/green buttons */

.chart { width: 100%; }
.chart-sm { height: 150px; margin: 10px 0 6px; }
.chart-lg { height: min(56vh, 420px); border-radius: 12px; background: #0D0C0B; border: 1px solid var(--line-soft); }

.chips { display: flex; gap: 6px; justify-content: space-between; }
.chips button { flex: 1; padding: 6px 0; border-radius: 8px; font-size: .78rem; color: var(--muted); border: 1px solid var(--line-soft); }
.chips button[aria-pressed='true'] { color: #1A1305; background: var(--gold); border-color: var(--gold); font-weight: 700; }

.sentiment { height: 8px; border-radius: 8px; background: var(--down); overflow: hidden; }
.sentiment .buyers { display: block; height: 100%; width: 60%; background: var(--up); border-radius: 8px 0 0 8px; transition: width 1s var(--ease); }
.sent-labels { display: flex; justify-content: space-between; font-size: .8rem; margin-top: 6px; }

.account-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.account-mini div { display: grid; gap: 2px; }
.account-mini strong { font-size: .92rem; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qbtn, .side { display: grid; justify-items: center; gap: 2px; padding: 12px 0; border-radius: 12px; font-weight: 800; color: #fff; transition: transform .15s var(--ease), box-shadow .2s, outline-color .2s; }
.qbtn small { font-weight: 500; opacity: .9; }
.qbtn:active, .side:active { transform: scale(.97); }
.sell { background: linear-gradient(180deg, #F25555, #C42B2B); }
.buy { background: linear-gradient(180deg, #2BD46A, #179A48); }

/* ---------- Chart screen ---------- */
.chart-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.chart-head .big { font-size: 1.6rem; }
.chart-head .seg { margin-left: auto; }
.ohlc { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; font-size: .8rem; }
.ohlc div { padding: 8px; border-radius: 10px; background: #121110; border: 1px solid var(--line-soft); text-align: center; }
.ohlc dt { color: var(--muted); font-size: .7rem; }
.ohlc dd { margin: 0; }

/* ---------- Trade ---------- */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #121110; border: 1px solid var(--line-soft); }
.seg button { flex: 1; padding: 8px 0; border-radius: 9px; font-size: .85rem; color: var(--muted); position: relative; }
.seg button[aria-selected='true'], .seg button[aria-pressed='true'] { background: rgba(245, 196, 81, .14); color: var(--gold); font-weight: 700; }
.seg-sm button { padding: 5px 10px; font-size: .75rem; }
.dot { position: absolute; top: 6px; right: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }

.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.side { padding: 14px 0; font-size: .95rem; opacity: .5; outline: 2px solid transparent; outline-offset: 2px; }
.side strong { font-size: 1.1rem; }
.side[aria-pressed='true'] { opacity: 1; outline-color: var(--gold); box-shadow: 0 10px 30px -12px currentColor; }

.field { display: grid; gap: 6px; font-size: .82rem; color: var(--muted); }
.field input, .inline-form input {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line-soft); background: #121110;
  color: var(--text); font: 600 1rem var(--mono); text-align: center;
}
.field input:focus, .inline-form input:focus { outline: none; border-color: var(--gold); }
.sltp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sltp .link { grid-column: 1 / -1; justify-self: start; color: var(--gold); font-size: .8rem; }
.stepper { display: grid; grid-template-columns: 48px 1fr 48px; gap: 6px; }
.stepper button { border-radius: 10px; border: 1px solid var(--line-soft); font-size: 1.3rem; background: #121110; }
.lot-chips { display: flex; gap: 6px; }
.lot-chips button { flex: 1; padding: 5px 0; border-radius: 8px; font: .75rem var(--mono); color: var(--muted); border: 1px dashed var(--line-soft); }
.lot-chips button:hover { color: var(--gold); border-color: var(--line); }

.kv { display: grid; gap: 6px; margin: 0; font-size: .85rem; }
.kv div { display: flex; justify-content: space-between; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.form-error { color: var(--down); font-size: .82rem; min-height: 1.2em; }
.place { width: 100%; padding: 14px; font-size: 1rem; }

.list-title { font-size: .9rem; font-weight: 600; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.count { font: .72rem var(--mono); padding: 1px 7px; border-radius: 99px; background: rgba(255, 255, 255, .08); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #121110; border: 1px solid var(--line-soft); font-size: .82rem; animation: screen-in .3s var(--ease); }
.list li .grow { flex: 1; display: grid; gap: 2px; }
.list li small { color: var(--muted); font-size: .72rem; }
.list .empty { justify-content: center; color: var(--muted); border-style: dashed; }
.tag { font-weight: 800; font-size: .7rem; padding: 3px 7px; border-radius: 6px; }
.tag.buy { background: rgba(34, 197, 94, .15); color: var(--up); }
.tag.sell { background: rgba(239, 68, 68, .15); color: var(--down); }
.x { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line-soft); color: var(--muted); font-size: 1rem; }
.x:hover { color: var(--text); border-color: var(--down); }

/* ---------- Analysis ---------- */
.tool summary { list-style: none; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.tool summary::-webkit-details-marker { display: none; }
.tool summary::after { content: '›'; margin-left: auto; color: var(--muted); font-size: 1.3rem; transition: transform .25s; }
.tool[open] summary::after { transform: rotate(90deg); }
.tool summary > span:nth-child(2) { display: grid; }
.tool[open] summary { margin-bottom: 12px; }
.t-ico, .m-ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px; background: rgba(245, 196, 81, .1); border: 1px solid var(--line); font-size: 1.1rem; }
.signal { margin-top: 10px; padding: 10px; border-radius: 10px; font-weight: 700; text-align: center; font-size: .9rem; }
.signal.bull { background: rgba(34, 197, 94, .12); color: var(--up); }
.signal.bear { background: rgba(239, 68, 68, .12); color: var(--down); }
.signal.flat { background: rgba(255, 255, 255, .06); color: var(--muted); }
.events, .notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: .85rem; }
.events li { display: flex; gap: 10px; align-items: flex-start; }
.events li span { display: grid; }
.imp { flex: none; font-size: .65rem; padding: 3px 6px; border-radius: 5px; }
.imp.high { background: rgba(239, 68, 68, .15); color: var(--down); }
.imp.med { background: rgba(245, 196, 81, .15); color: var(--gold); }
.notes li { color: var(--muted); }
.notes strong { color: var(--text); }
#ideas { display: grid; gap: 8px; font-size: .88rem; }
#ideas p { padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, .04); border-left: 3px solid var(--gold); }
.disclaimer { margin-top: 10px; font-size: .72rem; color: var(--muted); }

/* ---------- More ---------- */
.menu { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.menu > li > a, .alert-row > div { display: flex; align-items: center; gap: 12px; }
.menu > li { padding: 12px; border-radius: var(--radius); background: #121110; border: 1px solid var(--line-soft); }
.menu > li span:not(.m-ico) { flex: 1; display: grid; }
.menu small { color: var(--muted); font-size: .75rem; }
.menu b { color: var(--muted); font-weight: 500; }
.alert-row { display: grid; gap: 10px; }
.inline-form { display: flex; gap: 8px; }
.alerts li { padding: 8px 10px; }

/* ---------- Account ---------- */
.balance-card { padding: 18px; border-radius: 18px; background: var(--gold-grad); color: #1A1305; display: grid; gap: 4px; box-shadow: 0 20px 50px -20px rgba(245, 196, 81, .6); }
.balance-card small { font-weight: 600; opacity: .75; }
.balance-card > strong { font-size: 2rem; }
.bc-row { display: flex; justify-content: space-between; font-size: .8rem; margin-top: 6px; }
.reset { width: 100%; margin-top: 10px; background: #1A1A1A; border: 1px solid var(--line-soft); padding: 14px; }
.reset:hover { border-color: var(--down); color: var(--down); }

/* ---------- Tab bar ---------- */
.tabbar {
  flex: none; display: grid; grid-template-columns: repeat(5, 1fr); background: #0B0B0B; border-top: 1px solid var(--line-soft);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a { display: grid; justify-items: center; gap: 3px; padding: 4px 0; font-size: .68rem; color: var(--muted); transition: color .2s; }
.tabbar a[aria-current='page'] { color: var(--gold); }
.tabbar a[aria-current='page'] svg { animation: pop-tab .35s var(--ease); }
@keyframes pop-tab { 50% { transform: translateY(-3px) scale(1.12); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); translate: -50% 20px; z-index: 60;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: #1E1C17; border: 1px solid var(--line);
  font-size: .85rem; opacity: 0; pointer-events: none; transition: opacity .3s, translate .3s var(--ease); box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.toast.show { opacity: 1; translate: -50% 0; }
