/* MBC Desk — the look: near-black, gold for XC and the Compass, green buy / red sell with white text */
:root { --bg: #0A0C10; --panel: #141821; --panel2: #11141B; --field: #0F1218; --line: #252B37; --line2: #1C212B; --text: #ECEFF4; --soft: #C9D1E2; --muted: #9AA3B2;
  --gold: #E8B84A; --buy: #15803D; --sell: #C62828; --ok: #22C55E; --bad: #F87171; --pos: #4ADE80;
  --mono: ui-monospace, "SF Mono", Menlo, monospace; --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 var(--ui); overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
.hide { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; } .center { text-align: center; }
.grow { flex: 1; }
.screen { position: fixed; inset: 0; padding: var(--st) var(--sr) var(--sb) var(--sl); display: flex; flex-direction: column; }
.xc { display: flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 11px; border: 1.5px solid var(--gold); background: linear-gradient(160deg, #2A220C, #0A0C10); color: var(--gold); font-weight: 800; font-size: 16px; letter-spacing: -.04em; }
.xc.big { width: 96px; height: 96px; border-radius: 26px; font-size: 42px; animation: glow 3s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(232,184,74,0); } 50% { box-shadow: 0 0 40px 4px rgba(232,184,74,.25); } }
.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; border-radius: 14px; font-weight: 700; font-size: 16px; margin-top: 10px; }
.btn.gold { background: var(--gold); color: #0A0C10; }
.btn.ghost { background: var(--panel); border: 1px solid var(--line); }
.btn.buyBtn { background: var(--buy); color: #fff; } .btn.sellBtn { background: var(--sell); color: #fff; }
.btn:disabled { opacity: .45; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #39404E; display: inline-block; flex: none; }
.dot.on { background: var(--ok); animation: blink 1.6s ease-in-out infinite; } .dot.warn { background: var(--gold); } .dot.bad { background: var(--bad); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* the lock */
#lock { align-items: center; }
.glow { position: absolute; inset: 0; background: radial-gradient(420px 320px at 50% 26%, rgba(232,184,74,.10), transparent 70%); pointer-events: none; }
.lockTop { margin-top: 12vh; display: flex; flex-direction: column; align-items: center; position: relative; }
.lockTop h1 { margin: 22px 0 0; font-size: 26px; font-weight: 800; }
.lockTop p { margin: 6px 0 0; }
.lockMid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
.face { width: 86px; height: 86px; border-radius: 22px; border: 3px solid var(--muted); position: relative; opacity: .8; }
.face::before, .face::after { content: ''; position: absolute; top: 28px; width: 6px; height: 10px; border-radius: 3px; background: var(--muted); }
.face::before { left: 24px; } .face::after { right: 24px; }
.face.busy { border-color: var(--gold); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(.94); } }
.lockMsg { min-height: 40px; margin: 16px 24px 0; text-align: center; color: var(--soft); }
.lockMsg.bad { color: var(--bad); }
.lockBottom { width: 100%; padding: 0 24px 28px; position: relative; }
.fine { color: var(--muted); font-size: 12px; text-align: center; margin: 14px 0 0; }

/* the chart screen */
.top { display: flex; align-items: center; gap: 8px; padding: 6px 12px 0; }
.xc.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; position: relative; }
.dot.badge { position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border: 2px solid var(--bg); box-sizing: content-box; }
.pnls { margin-left: auto; display: flex; gap: 12px; flex: none; }
.pv { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.pv .k { font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: .06em; }
.pv b { font-size: 13px; font-weight: 700; }
.pv .up { color: var(--pos); } .pv .dn { color: var(--bad); }
.acct { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px 0 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; font-weight: 600; font-size: 13px; min-width: 0; flex: 0 1 auto; }
.acct .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 10px; font-weight: 800; letter-spacing: .08em; padding: 3px 6px; border-radius: 6px; background: #252B37; color: #C9D1E2; flex: none; }
.tag.live { background: #3A2E0E; color: var(--gold); } .tag.sim { background: #252B37; color: #C9D1E2; }
.caret { color: var(--muted); font-size: 12px; }
.pcBtn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 8px 4px; }
.sub { margin: 4px 14px 0 64px; font-size: 12px; color: var(--muted); min-height: 16px; }
.inst { display: flex; align-items: center; padding: 6px 12px 0; gap: 8px; }
.sym { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.price { font-size: 16px; font-weight: 700; }
.tfs { display: flex; gap: 1px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.tfs button { height: 26px; padding: 0 9px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 12px; }
.tfs button[aria-pressed="true"] { background: var(--line); color: var(--text); }
.chartWrap { flex: 1; position: relative; min-height: 120px; margin-top: 4px; }
#chart { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.chartNote { position: absolute; left: 14px; right: 70px; top: 8px; background: rgba(20,24,33,.92); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; color: var(--soft); }
.strip { position: absolute; left: 8px; right: 64px; bottom: 26px; display: flex; align-items: center; gap: 6px; }
.strip .pos { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: rgba(20,24,33,.94); border: 1px solid var(--line); border-radius: 10px; padding: 0 5px 0 10px; height: 38px; }
.strip .flat { background: rgba(20,24,33,.94); border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; height: 38px; display: flex; align-items: center; }
.strip .pos b { font-weight: 600; font-size: 13px; white-space: nowrap; }
.strip .mini { white-space: nowrap; }
.strip .flat { color: var(--muted); font-size: 13px; }
.mini { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid #39404E; background: var(--bg); font-weight: 700; font-size: 12px; }
.pnl.up { color: var(--pos); } .pnl.dn { color: var(--bad); }
.orderBar { padding: 4px 12px 6px; display: flex; flex-direction: column; gap: 6px; }
.qtyRow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lbl { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin: 14px 0 6px; }
.qtyRow .lbl { margin: 0; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 20px; }
.qtyRow .stepper button { width: 32px; height: 32px; border-radius: 8px; font-size: 18px; } .qtyRow .stepper .mono { font-size: 16px; min-width: 24px; }
.stepper .mono, .stepper b { font-size: 19px; font-weight: 700; min-width: 30px; text-align: center; }
.bracketBtn { font-size: 12px; color: var(--soft); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; height: 32px; padding: 0 10px; }
.bs { display: flex; gap: 10px; }
.big { flex: 1; height: 54px; border-radius: 14px; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.big b { font-size: 17px; letter-spacing: .06em; } .big span { font-size: 11px; opacity: .9; }
.big.buy { background: var(--buy); } .big.sell { background: var(--sell); }
.big:active, .btn:active { transform: scale(.97); }

/* sheets */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 10; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-height: 88vh; overflow-y: auto; background: var(--panel2); border-top: 1px solid var(--line); border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(18px + var(--sb)); animation: up .22s ease-out; -webkit-overflow-scrolling: touch; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.grab { width: 40px; height: 5px; border-radius: 3px; background: #39404E; margin: 0 auto 12px; }
.grab { position: relative; } .grab::before { content: ''; position: absolute; left: -60px; right: -60px; top: -14px; bottom: -14px; }  /* (a bigger place to grab) */
.sheetX { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 15px; line-height: 1; z-index: 1; }
.sheet.dragging { animation: none; transition: none; }
.sheet.settle { transition: transform .2s ease-out; }
.sheet h2 { margin: 0 0 10px; font-size: 20px; font-weight: 800; }
.rows .r { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line2); font-size: 15px; }
.rows .r span:last-child { margin-left: auto; color: var(--muted); font-size: 13px; text-align: right; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; height: 38px; border-radius: 9px; color: var(--muted); font-weight: 700; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--line); color: var(--text); }
.seg.side button[aria-pressed="true"].b { background: var(--buy); color: #fff; } .seg.side button[aria-pressed="true"].s { background: var(--sell); color: #fff; }
.two { display: flex; gap: 10px; } .two .seg { flex: 1; }
.field { display: block; width: 100%; height: 48px; margin-top: 10px; padding: 0 14px; background: var(--field); border: 1px solid var(--line); border-radius: 12px; color: var(--text); font: 16px var(--ui); -webkit-user-select: text; user-select: text; }
.field:focus { outline: 2px solid var(--gold); outline-offset: 0; }
.note { font-size: 13px; color: var(--muted); margin: 10px 0 0; line-height: 1.45; }
.steps { margin-top: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px; }
.steps:empty { display: none; }
.step { display: flex; align-items: center; gap: 12px; padding: 9px 0; font-size: 14px; }
.sdot { width: 20px; height: 20px; border-radius: 50%; flex: none; border: 2px solid #39404E; }
.sdot.now { border-color: var(--gold); border-top-color: transparent; animation: spin .8s linear infinite; }
.sdot.done { background: var(--buy); border-color: var(--buy); } .sdot.failed { background: var(--sell); border-color: var(--sell); }
@keyframes spin { to { transform: rotate(360deg); } }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; width: 100%; }
.item.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.item .h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.item .d { display: flex; justify-content: space-between; margin-top: 5px; font-size: 13px; color: var(--muted); }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; border-radius: 3px; }
.line { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line2); gap: 8px; }
.line label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--soft); }
.line input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--gold); }
.holdWrap { display: flex; justify-content: center; margin-top: 14px; }
.hold { position: relative; width: 120px; height: 120px; border-radius: 50%; }
.hold svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.holdBg { fill: var(--buy); stroke: #252B37; stroke-width: 6; } .hold.sell .holdBg { fill: var(--sell); } .hold.flat .holdBg { fill: #374151; }
.holdRing { fill: none; stroke: var(--gold); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 289; stroke-dashoffset: 289; }
.hold span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 15px; letter-spacing: .06em; }
.toast { position: fixed; left: 14px; right: 14px; top: calc(var(--st) + 10px); z-index: 20; background: #0F3320; border: 1px solid #166534; color: var(--text); border-radius: 12px; padding: 12px 14px; font-size: 14px; animation: up .2s ease-out; }
.toast.bad { background: #3B1212; border-color: #7F1D1D; }
.toast.warn { background: #3A2E0E; border-color: #8A6A1C; }

/* sideways: the order buttons on the right */
@media (orientation: landscape) and (max-height: 500px) {
  #main { display: grid; grid-template-columns: 1fr 190px; grid-template-rows: auto auto 1fr; }
  #main.hide { display: none; }
  .top { grid-column: 1; grid-row: 1; padding-top: 6px; }
  .sub { display: none; }
  .inst { grid-column: 1; grid-row: 2; padding-top: 4px; } .price { font-size: 18px; }
  .chartWrap { grid-column: 1; grid-row: 3; margin-top: 4px; }
  .orderBar { grid-column: 2; grid-row: 1 / 4; justify-content: center; border-left: 1px solid var(--line2); padding: 8px 10px; }
  .qtyRow { flex-wrap: wrap; } .qtyRow .lbl { display: none; } .bracketBtn { width: 100%; }
  .bs { flex-direction: column-reverse; } .big { height: 62px; flex: none; }
  .sheet { max-height: 96vh; left: 15%; right: 15%; }
}
