:root {
  --bg: #060a14; --bg2: #0b1222; --panel: #0f182c; --panel2: #13203a; --line: #22324f; --text: #e9f0ff; --muted: #8fa3c7;
  --gold: #e8c25a; --gold2: #b8902f; --buy: #19d18b; --sell: #ff4d6a; --warn: #ffb400; --sim: #6fb3ff; --demo: #ffc857; --real: #ff3b52;
  --radius: 12px; --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: radial-gradient(1200px 600px at 20% -10%, #14223f 0%, var(--bg) 60%) fixed, var(--bg); color: var(--text);
  font: 14px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel2); border-radius: 9px; padding: 8px 12px; }
button:hover:not(:disabled) { border-color: var(--gold2); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
input, select, textarea { background: #0a1120; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; width: 100%; }
a { color: var(--gold); }
.muted { color: var(--muted); } .up { color: var(--buy); } .down { color: var(--sell); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- topo: ambiente SEMPRE visível ---------- */
.top { position: sticky; top: 0; z-index: 50; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: calc(8px + var(--safe-top)) 14px 8px; background: rgba(6, 10, 20, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: .18em; color: var(--gold); display: flex; gap: 8px; align-items: center; }
.brand .logo { width: 26px; height: 26px; border-radius: 50%; background: conic-gradient(from 200deg, var(--gold), #fff3c4, var(--gold2), var(--gold)); box-shadow: 0 0 12px rgba(232, 194, 90, .5); }
.env { font-weight: 800; letter-spacing: .06em; padding: 5px 10px; border-radius: 999px; border: 2px solid; font-size: 12px; white-space: nowrap; }
.env[data-env="SIM"] { color: var(--sim); border-color: var(--sim); }
.env[data-env="DEMO"] { color: var(--demo); border-color: var(--demo); }
.env[data-env="REAL"] { color: #fff; background: var(--real); border-color: #fff; }
.conn { font-size: 12px; display: flex; gap: 6px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--buy); box-shadow: 0 0 8px var(--buy); } .dot.bad { background: var(--sell); } .dot.warn { background: var(--warn); }
.nav { margin-left: auto; display: flex; gap: 6px; }
.nav button[aria-current="page"] { border-color: var(--gold); color: var(--gold); }
.top select { width: auto; min-width: 150px; }

/* ---------- layout ---------- */
main { padding: 12px 14px calc(16px + var(--safe-bottom)); max-width: 1600px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; }
@media (max-width: 1000px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.grid > * { min-width: 0; }
@media (max-width: 520px) { .top select { min-width: 0; flex: 1 1 40%; } .nav { margin-left: 0; width: 100%; justify-content: flex-end; } main { padding-left: 8px; padding-right: 8px; } .px .last { font-size: 24px; } }
.card { background: linear-gradient(180deg, var(--panel), #0c1426); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.card h2 { margin: 0 0 8px; font-size: 13px; letter-spacing: .12em; color: var(--muted); font-weight: 700; }

/* ---------- seletor de visualização ---------- */
.views { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.views button { flex: 0 0 auto; font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 7px 10px; }
.views button[aria-pressed="true"] { background: linear-gradient(180deg, #2b3b62, #1b2745); border-color: var(--gold); color: var(--gold); }
.stage { position: relative; height: min(72vh, 780px); min-height: 420px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #02050b; }
.stage iframe { width: 100%; height: 100%; border: 0; display: block; background: #02050b; }
.stage.multi { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 4px; }
@media (max-width: 700px) { .stage { height: 64vh; min-height: 360px; } .stage.multi { grid-template-columns: 1fr; grid-template-rows: repeat(4, 1fr); height: 160vh; } }
.stage .label { position: absolute; left: 8px; bottom: 8px; font-size: 11px; background: rgba(0, 0, 0, .6); padding: 3px 7px; border-radius: 6px; pointer-events: none; }
canvas.chart { width: 100%; height: 100%; display: block; }

/* ---------- painel de negociação ---------- */
.px { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.px .sym { font-weight: 800; letter-spacing: .06em; }
.px .last { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.px .state { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; border: 1px solid; }
.state[data-s="LIVE"] { color: var(--buy); } .state[data-s="STALE"] { color: var(--warn); } .state[data-s="NO_DATA"], .state[data-s="DISCONNECTED"], .state[data-s="RECONNECTING"] { color: var(--sell); }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; font-variant-numeric: tabular-nums; }
.trade { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trade .buy, .trade .sell { font-size: 18px; font-weight: 900; letter-spacing: .1em; padding: 14px; border: 0; color: #041018; }
.trade .buy { background: linear-gradient(180deg, #3ef0a8, var(--buy)); } .trade .sell { background: linear-gradient(180deg, #ff7a90, var(--sell)); color: #1a0208; }
.vol { display: flex; gap: 6px; align-items: center; margin: 8px 0; } .vol input { text-align: center; font-weight: 700; }
.blocked { margin-top: 8px; font-size: 12px; font-weight: 700; color: #ffd7dc; background: #3a0d12; border: 1px solid var(--sell); padding: 6px 8px; border-radius: 8px; }
.totals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 10px 0; font-variant-numeric: tabular-nums; }
.totals div { background: #0a1120; border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; }
.totals b { display: block; font-size: 16px; }
ul.pos { list-style: none; padding: 0; margin: 0; max-height: 320px; overflow: auto; }
ul.pos li { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; align-items: center; padding: 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
ul.pos li .side { font-weight: 900; } ul.pos li .side.BUY { color: var(--buy); } ul.pos li .side.SELL { color: var(--sell); }
ul.pos li small { grid-column: 1 / -1; color: var(--muted); }
.adslot { margin-top: 10px; border: 1px dashed #3a4a6b; border-radius: 10px; padding: 8px 10px; font-size: 12px; color: var(--muted); }
.adslot .adlabel { font-size: 10px; font-weight: 800; letter-spacing: .12em; color: #9fb0d0; border: 1px solid #3a4a6b; border-radius: 4px; padding: 1px 5px; margin-right: 6px; }
.disclaimer { font-size: 11px; color: var(--muted); margin-top: 10px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 14px; bottom: calc(14px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, 92vw); }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--gold); padding: 10px 12px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; }
.toast.ok { border-left-color: var(--buy); } .toast.err { border-left-color: var(--sell); } .toast.warn { border-left-color: var(--warn); }

/* ---------- auth / portal / admin ---------- */
.auth { max-width: 420px; margin: 8vh auto; } .auth form { display: grid; gap: 10px; } .auth .tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; } .tabs button[aria-selected="true"] { border-color: var(--gold); color: var(--gold); }
.form { display: grid; gap: 8px; max-width: 560px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; } th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 700; }
.table-wrap { overflow-x: auto; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); }
.danger { border-color: var(--sell) !important; color: #ffc3cc; }
pre.code { white-space: pre-wrap; word-break: break-all; background: #0a1120; padding: 8px; border-radius: 8px; border: 1px solid var(--line); font-size: 12px; }
.doc { max-height: 50vh; overflow: auto; white-space: pre-wrap; background: #0a1120; padding: 10px; border-radius: 8px; border: 1px solid var(--line); font-size: 12.5px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
/* mobile: avisos nunca cobrem BUY/SELL/P&L do game — ficam no topo, no máximo 2 */
@media (max-width: 700px) {
  .toasts { top: calc(8px + var(--safe-top)); bottom: auto; left: 8px; right: 8px; max-width: none; }
  .toast { padding: 7px 10px; font-size: 12px; opacity: .96; }
  .toasts .toast:nth-last-child(n+3) { display: none; }
}

/* ---------- botão de ativo + seletor de mercado ---------- */
.symbtn { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.symbtn .sym { font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
.symbtn .sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
body.modal-open { overflow: hidden; }
.mkt { position: fixed; inset: 0; z-index: 200; background: rgba(2, 5, 11, .72); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px 12px; }
.mkt-panel { width: min(760px, 100%); max-height: 86vh; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--panel), #0a1224); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.mkt-head { display: flex; gap: 8px; padding: 12px; }
.mkt-head input { font-size: 16px; font-weight: 700; letter-spacing: .03em; }
.mkt-tabs { display: flex; gap: 6px; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: thin; }
.mkt-tabs button { flex: 0 0 auto; font-size: 12px; font-weight: 700; padding: 6px 10px; }
.mkt-tabs button[aria-selected="true"] { border-color: var(--gold); color: var(--gold); }
.mkt-tabs .n { font-size: 10px; color: var(--muted); margin-left: 2px; }
.mkt-meta { padding: 0 12px 8px; font-size: 12px; }
.mkt-list { list-style: none; margin: 0; padding: 0 6px 10px; overflow-y: auto; overflow-x: hidden; flex: 1 1 auto; min-height: 200px; }
.mrow { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto minmax(0, 150px); gap: 4px 10px; align-items: center; padding: 8px 8px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.mrow:hover, .mrow:focus { background: #13203a; outline: none; }
.mrow.sel { background: #1b2745; box-shadow: inset 3px 0 0 var(--gold); }
.mrow .star { border: 0; background: transparent; font-size: 18px; color: var(--gold); padding: 2px; }
.mrow .nm { min-width: 0; }
.mrow .nm b { font-size: 14px; }
.mrow .nm small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .nm code { color: #c9d6f2; }
.mrow .cat { font-size: 10.5px; font-weight: 800; color: var(--muted); letter-spacing: .06em; }
.mrow .state { font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 6px; border: 1px solid; }
.mrow .ba { font-variant-numeric: tabular-nums; font-size: 12px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill.warn { border-color: var(--warn); color: var(--warn); font-size: 9.5px; }
@media (max-width: 640px) {
  .mkt { padding: 0; }
  .mkt-panel { width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; }
  .mrow { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .mrow .cat { display: none; }
  .mrow .ba { grid-column: 2 / -1; text-align: left; }
  .symbtn .sub { max-width: 110px; }
}
.mkt-head, .mkt-tabs, .mkt-meta { flex-shrink: 0; }
/* ---------- identidade FXGG_ARENA ---------- */
.brand .logo { background: url(/icon.svg) center / cover no-repeat; box-shadow: 0 0 12px rgba(232, 194, 90, .35); border-radius: 8px; }
.brand .brand-name { letter-spacing: .12em; }
.brand-tag { text-align: center; margin: 0 0 6px; font-size: 13px; font-weight: 800; letter-spacing: .08em; color: var(--gold); }
/* origem dos limites (FxPro x Arena) */
.limits { margin-top: 8px; font-size: 12px; line-height: 1.45; border: 1px solid #2b3b55; border-radius: 8px; padding: 6px 8px; background: rgba(20, 32, 52, .6); }
.limits h3 { margin: 0 0 2px; font-size: 12px; letter-spacing: .04em; }
.limits .warn { color: #ffd166; }
.order-sym { margin: 2px 0 6px; font: 800 11px "Segoe UI", system-ui; letter-spacing: .08em; color: var(--gold); text-align: center; }

/* contador de visualizações — só o proprietário vê */
.views-badge { font-size: 12px; padding: 2px 8px; border: 1px solid currentColor; border-radius: 999px; opacity: .85; white-space: nowrap; cursor: default; }
