/* QUANTUM ELITE — phone layout (portrait and landscape).
   Loaded only on touch phones (see the media attribute in index.html), so the desktop layout never changes. */

/* ── shared (both orientations) ── */
body.qapp { overflow-x: hidden; overflow-y: auto; height: auto; }
.stage, .stage.no-rail { grid-template-columns: minmax(0, 1fr); position: relative; }
.rail { grid-column: 1 / -1; padding-bottom: 12px; }
.tools { position: absolute; z-index: 15; left: 0; top: 0; bottom: 0; height: auto; max-height: 100%; width: 46px; transform: translateX(-100%); transition: transform .22s ease; box-shadow: 6px 0 24px rgba(0,0,0,.5); }
.tools.open { transform: none; }
.tools:not(.open) { visibility: hidden; }
.wordmark, .status, .spacer, .brand div { display: none; }
.bar { backdrop-filter: none; -webkit-backdrop-filter: none; flex-wrap: nowrap; gap: 8px; padding-left: calc(10px + env(safe-area-inset-left, 0px)); padding-right: calc(10px + env(safe-area-inset-right, 0px)); }
.quote { margin-left: auto; flex-direction: column; gap: 0; align-items: flex-end; }
.quote .px { font-size: 15px; line-height: 1.15; }
.quote .chg { font-size: 10.5px; }
.chartwrap { height: var(--qchart-h, 70vh); min-height: 260px; }

/* the module dock becomes an app-style tab bar */
.dock { position: fixed; z-index: 26; clip-path: none; padding: 0; background: linear-gradient(180deg, rgba(14,19,29,.97), rgba(6,9,14,.99)); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.dock::-webkit-scrollbar { display: none; }
.dock::before { display: none; }
.dock .iconbtn { flex: 0 0 auto; flex-direction: column; justify-content: center; gap: 4px; padding: 0; color: var(--steel); }
.dock .iconbtn::before { inset: 4px; border-radius: 10px; }
.dock .iconbtn + .iconbtn::after { display: none; }
.dock .iconbtn svg { width: 18px; height: 18px; }
.dock .iconbtn .ind-txt, .dock .iconbtn .hide-sm { display: block !important; font: 600 9px/1 var(--f-ui); letter-spacing: .05em; white-space: nowrap; }
.dock .iconbtn[aria-pressed="true"] { color: #fff; }
.dock .iconbtn[aria-pressed="true"]::before, .dock .iconbtn:active::before { background: rgba(169,210,255,.14); }
.dock .show-sm { display: flex !important; }

/* chart overlays */
.qleg { top: 6px; left: 8px; }
.qleg .card { max-height: 50vh; overflow-y: auto; }
.qf3d { height: 26px; padding: 0 10px; font-size: 10px; letter-spacing: .1em; }
.qf3d, .qf3d.qfhi, .qf3d.qfgx { left: auto; transform: none; }
.qf3d, .qf3d.qfhi, .qf3d.qfgx { top: 6px; right: var(--qaxis, 64px); }
.qf3d.qfhi { top: 38px; }
.qf3d.qfgx { top: 70px; }
.tvdash.compact { transform: scale(.78); }
.toasts { top: 40px; }

/* dialogs and panels use the whole screen width */
.modal { padding: calc(10px + env(safe-area-inset-top, 0px)) 8px 8px; place-items: start stretch; }
.dialog, .dialog.scan { width: 100%; max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px)); }
.drawer { width: 100%; }
#qaBtn { left: auto !important; right: calc(12px + env(safe-area-inset-right, 0px)) !important; height: 40px !important; padding: 0 12px 0 10px !important; font-size: 11.5px !important; line-height: 40px !important; }

/* ── portrait: tab bar at the bottom ── */
@media (orientation: portrait) {
  .dock { left: 0; right: 0; bottom: 0; display: flex; overflow-x: auto; overflow-y: hidden; padding: 3px 4px calc(3px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid rgba(169,210,255,.16); box-shadow: 0 -10px 30px rgba(0,0,0,.45); }
  .dock .iconbtn { width: 64px; height: 50px; }
  body.qapp { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
  #qaBtn { bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important; }
  .bar .tfs { display: none; }
}

/* ── landscape: chart over the full height, modules in a slim column on the left ── */
@media (orientation: landscape) {
  .bar { padding-top: calc(5px + env(safe-area-inset-top, 0px)); padding-bottom: 5px; }
  .symbtn { height: 30px; }
  .bar .tfs { display: flex; height: 30px; }
  .bar .tfs.wide { max-width: 46vw; }
  .matrix-bar, .matrix-bar.tfrow { display: none !important; }
  .dock { left: 0; top: var(--qbar-h, 41px); bottom: 0; width: calc(56px + env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; padding: 4px 0 calc(4px + env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px); border-right: 1px solid rgba(169,210,255,.14); }
  .dock .iconbtn { width: 56px; height: 46px; gap: 3px; }
  .dock .iconbtn .ind-txt, .dock .iconbtn .hide-sm { font-size: 8px; }
  .stage { margin-left: calc(56px + env(safe-area-inset-left, 0px)); }
  #qaBtn { bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important; }
  .qf3d.qfhi { top: 6px; right: calc(var(--qaxis, 64px) + 118px); }
  .qf3d.qfgx { top: 6px; right: calc(var(--qaxis, 64px) + 222px); }
}

/* ───────── module pages (Gravity, Whales, Gamma, Heatmap, News) ───────── */
body.lqpage, body.wpage, body.gexpage { overflow-y: auto; height: auto; display: block; }
.lq-main, .gx-main { display: block; }
.lq-side, .gx-side { border-left: 0; border-top: 1px solid rgba(169,210,255,.18); }
.lq-bar { gap: 6px; padding: 6px calc(10px + env(safe-area-inset-right, 0px)) 6px calc(10px + env(safe-area-inset-left, 0px)); -webkit-overflow-scrolling: touch; }
.lq-bar > *, #coins { flex-shrink: 0; }
#coins { display: flex; gap: 6px; }
.lq-3d .title { left: 12px; right: 12px; top: 10px; }
.lq-3d .title span { display: block; font-size: 10px; margin-top: 2px; }
.lq-leg3 { left: 12px; right: auto; top: auto; bottom: 46px; text-align: left; font-size: 9.5px; line-height: 1.6; }
.lq-3d .hint, .gx-3d .hint { display: none; }
.lq-replay { left: 10px; right: 10px; bottom: 8px; justify-content: space-between; }
.lq-replay input { flex: 1; width: auto; min-width: 0; }
.lq-tip { max-width: calc(100vw - 24px); }
.wm-back { padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px; align-items: flex-start; }
.wm { padding: 14px; }
.wm table { display: block; overflow-x: auto; white-space: nowrap; }
.wm-kpi { grid-template-columns: repeat(2, 1fr); }
.nw { width: 100%; min-width: 0; box-sizing: border-box; overflow-x: hidden; padding-left: calc(14px + env(safe-area-inset-left, 0px)); padding-right: calc(14px + env(safe-area-inset-right, 0px)); }
.nt, .ns { overflow-wrap: anywhere; }
.nh h1 { font-size: 15px; }
@media (orientation: portrait) {
  .lq-3d, .gx-3d { height: 60vh; min-height: 340px; }
}
@media (orientation: landscape) {
  .lq-3d, .gx-3d { height: calc(100dvh - 90px); min-height: 240px; }
  .lq-leg3 { bottom: 40px; }
}
body.flowpage { height: 100%; height: 100dvh; overflow: hidden; }

/* layouts dialog */
.ly-row { flex-wrap: wrap; }
.ly-item { flex-wrap: wrap; }
.ly-item b { flex-basis: 100%; }

/* gamma page */
.gx-bar { gap: 6px; padding: 6px calc(10px + env(safe-area-inset-right, 0px)) 6px calc(10px + env(safe-area-inset-left, 0px)); }
.gx-bar > *, #gCoins, #gVen { flex-shrink: 0; }
#gCoins, #gVen { display: flex; gap: 6px; }
.gx-3d .title { left: 12px; top: 10px; right: 12px; }
.gx-3d .title span { display: block; font-size: 10px; margin-top: 2px; }
.gx-sum { left: 10px; right: 10px; top: 54px; font-size: 11.5px; }
.gx-replay { left: 10px; right: 10px; bottom: 8px; justify-content: space-between; }
.gx-replay input { flex: 1; width: auto; min-width: 0; }
.gx-tip { max-width: calc(100vw - 24px); }
.gx-prof, .lq-prof { height: 200px; }
/* module page header: the "Chart / Gamma / Gravity" buttons keep their labels */
body:not(.qapp) .bar .iconbtn .ind-txt { display: inline !important; }
body:not(.qapp) .bar .iconbtn { padding: 0 10px; height: 30px; }

/* hologram */
.qleg { z-index: 7; }
.qd3-top { padding: calc(10px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-right, 0px)) 10px calc(12px + env(safe-area-inset-left, 0px)); }
.qd3-note { display: none; }
.qd3-legend { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); gap: 4px 10px; font-size: 9.5px; }
.qd3-pf-l2 { font-size: 10px; }
@media (orientation: portrait) {
  .qd3-stats { top: calc(52px + env(safe-area-inset-top, 0px)); left: 12px; }
  .qd3-range { top: calc(86px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px; max-width: none; justify-content: flex-start; }
  .qd3-venues { top: calc(120px + env(safe-area-inset-top, 0px)); left: 12px; }
  .qd3-venues .hint, .qd3-cover { display: none; }
  .qd3-pf { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); width: calc(100% - 20px); padding: 8px 10px; font-size: 11px; }
}
@media (orientation: landscape) {
  .qd3-legend { display: none; }
  .qd3-venues .hint, .qd3-cover { display: none; }
  .qd3-pf { left: auto; right: calc(10px + env(safe-area-inset-right, 0px)); transform: none; bottom: 10px; width: min(380px, 46%); padding: 8px 10px; font-size: 10.5px; }
  .qd3-stats { top: calc(48px + env(safe-area-inset-top, 0px)); }
  .qd3-venues { top: calc(80px + env(safe-area-inset-top, 0px)); }
  .qd3-range { top: calc(48px + env(safe-area-inset-top, 0px)); }
}

/* owner 22. 11. 2026: the bottom tab bar (Heatmap, Gamma, Depth 3D, Scanner …) at about half its height */
@media (orientation: portrait) {
  .dock { padding: 1px 4px max(2px, calc(env(safe-area-inset-bottom, 0px) - 16px)); }
  .dock .iconbtn { width: 58px; height: 38px; gap: 2px; }
  .dock .iconbtn svg { width: 15px; height: 15px; }
  .dock .iconbtn .ind-txt, .dock .iconbtn .hide-sm { font-size: 8px !important; }
  .dock .iconbtn::before { inset: 2px; border-radius: 8px; }
  body.qapp { padding-bottom: calc(42px + max(2px, calc(env(safe-area-inset-bottom, 0px) - 16px))); }
  #qaBtn { bottom: calc(50px + max(2px, calc(env(safe-area-inset-bottom, 0px) - 16px))) !important; }
}
/* owner 22. 11. 2026 (2nd): even lower – no extra space under the icons, the home bar sits over the bar's own edge */
@media (orientation: portrait) {
  .dock { padding: 0 4px 0 !important; height: calc(34px + env(safe-area-inset-bottom, 0px) * .45); align-items: flex-start; }
  .dock .iconbtn { height: 34px; gap: 1px; }
  .dock .iconbtn svg { width: 14px; height: 14px; }
  .dock .iconbtn .ind-txt, .dock .iconbtn .hide-sm { font-size: 7.5px !important; }
  body.qapp { padding-bottom: calc(34px + env(safe-area-inset-bottom, 0px) * .45); }
  #qaBtn { bottom: calc(42px + env(safe-area-inset-bottom, 0px) * .45) !important; }
}
/* owner 22. 11. 2026 (3rd): normal-size icons and labels again – only the bar itself stays low */
@media (orientation: portrait) {
  .dock { height: calc(42px + env(safe-area-inset-bottom, 0px) * .35); }
  .dock .iconbtn { width: 64px; height: 42px; gap: 4px; }
  .dock .iconbtn svg { width: 18px; height: 18px; }
  .dock .iconbtn .ind-txt, .dock .iconbtn .hide-sm { font-size: 9px !important; }
  body.qapp { padding-bottom: calc(42px + env(safe-area-inset-bottom, 0px) * .35); }
  #qaBtn { bottom: calc(50px + env(safe-area-inset-bottom, 0px) * .35) !important; }
}
/* the strip under the bar that Safari keeps for its hidden toolbar: same colour as the bar, so it does not look like a gap */
@media (orientation: portrait) { .dock { box-shadow: 0 -10px 30px rgba(0,0,0,.45), 0 60px 0 30px #06090E; } }   /* keeps the bar scrollable sideways */

/* CANDLE inspector on a phone (owner 23. 11. 2026): a solid bottom sheet above the tab bar – never see-through, never under the tab bar */
.fpi { position: fixed !important; left: 0 !important; right: 0 !important; top: auto !important; width: auto !important;
  bottom: calc(42px + env(safe-area-inset-bottom, 0px) * .35) !important; height: auto !important; max-height: 58dvh !important;
  z-index: 27 !important; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background: #0A0E15 !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  border-radius: 16px 16px 0 0 !important; border: 1px solid rgba(169,210,255,.16) !important; border-bottom: 0 !important;
  box-shadow: 0 -14px 40px rgba(0,0,0,.6) !important; }
.fpi > header { position: sticky; top: -12px; z-index: 2; background: #0A0E15; padding-top: 2px; }
