/* ====================================================================
   FOREX ARCADE — neon / synthwave theme, responsive (mobile first)
   ==================================================================== */
:root {
  --bg: #07040f;
  --bg2: #0e0820;
  --panel: rgba(18, 11, 36, .92);
  --panel2: rgba(28, 18, 54, .95);
  --line: #2b1f4d;
  --line2: #3d2d6b;
  --text: #ece8ff;
  --muted: #8f86b3;
  --cyan: #22e4ff;
  --pink: #ff4fd8;
  --green: #39ff88;
  --red: #ff3b5c;
  --yellow: #ffd23f;
  --purple: #9b5cff;
  --orange: #ff9b3d;
  --pixel: 'Press Start 2P', ui-monospace, 'Courier New', monospace;
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, Tahoma, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --r: 10px;
  --glow-c: 0 0 12px rgba(34, 228, 255, .55);
  --glow-p: 0 0 12px rgba(255, 79, 216, .55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }
.pixel { font-family: var(--pixel); letter-spacing: .02em; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.up { color: var(--green); }
.down { color: var(--red); }

/* ---------------------------------------------------------- background */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, #2a0f4d 0%, var(--bg2) 45%, var(--bg) 80%);
}
.bg-grid::before {           /* sun */
  content: ''; position: absolute; left: 50%; top: 18%; width: 46vmin; height: 46vmin;
  transform: translateX(-50%); border-radius: 50%;
  background: linear-gradient(180deg, #ffd23f 0%, #ff4fd8 60%, #9b5cff 100%);
  opacity: .16; filter: blur(2px);
  -webkit-mask: repeating-linear-gradient(180deg, #000 0 14px, transparent 14px 20px);
          mask: repeating-linear-gradient(180deg, #000 0 14px, transparent 14px 20px);
}
.bg-grid::after {            /* perspective floor */
  content: ''; position: absolute; left: -50%; right: -50%; bottom: -10%; height: 60%;
  background-image:
    linear-gradient(rgba(255, 79, 216, .35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 79, 216, .35) 1px, transparent 1px);
  background-size: 60px 60px;
  transform: perspective(300px) rotateX(62deg);
  transform-origin: 50% 100%;
  animation: floor 3s linear infinite;
  -webkit-mask: linear-gradient(180deg, transparent, #000 60%);
          mask: linear-gradient(180deg, transparent, #000 60%);
}
@keyframes floor { to { background-position: 0 60px, 0 0; } }

.crt {
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, .55) 100%);
  mix-blend-mode: multiply;
}
body.no-crt .crt { display: none; }

/* ---------------------------------------------------------- app shell */
#app { position: relative; z-index: 1; height: 100vh; height: 100dvh; width: 100%; }

.screen {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-y: auto; overflow-x: hidden;
  animation: screenIn .25s ease-out;
}
.screen > .inner { width: 100%; max-width: 520px; margin: auto 0; display: flex; flex-direction: column; gap: 14px; }
@keyframes screenIn { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }

.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.back { font-family: var(--pixel); font-size: 10px; color: var(--muted); padding: 8px 4px; }
.back:hover { color: var(--cyan); }
.h1 { font-family: var(--pixel); font-size: clamp(16px, 4.5vw, 22px); text-align: center; margin: 4px 0 6px; line-height: 1.4; }
.h2 { font-family: var(--pixel); font-size: 11px; color: var(--muted); margin: 0 0 8px; letter-spacing: .08em; }

.panel {
  background: var(--panel); border: 2px solid var(--line2); border-radius: var(--r);
  padding: 14px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .45);
}

/* ---------------------------------------------------------- logo */
.logo { text-align: center; margin-bottom: 4px; }
.logo .t1, .logo .t2 {
  font-family: var(--pixel); display: block; line-height: 1.15;
  font-size: clamp(30px, 10vw, 52px);
}
.logo .t1 { color: var(--cyan); text-shadow: 0 0 6px var(--cyan), 0 0 24px rgba(34, 228, 255, .6), 4px 4px 0 #3a0a5c; }
.logo .t2 { color: var(--pink); text-shadow: 0 0 6px var(--pink), 0 0 24px rgba(255, 79, 216, .6), 4px 4px 0 #3a0a5c; animation: flicker 5s infinite; }
.logo .sub { font-family: var(--pixel); font-size: 9px; color: var(--yellow); letter-spacing: .4em; margin-top: 12px; display: block; }
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: .4; } 94% { opacity: 1; } 96% { opacity: .6; } }

/* ---------------------------------------------------------- buttons */
.btn {
  --c: var(--cyan);
  position: relative; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--pixel); font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  padding: 14px 12px; border-radius: 8px;
  color: #fff; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 55%, #000) 0%, color-mix(in srgb, var(--c) 30%, #000) 100%);
  border: 2px solid var(--c);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 35%, #000), 0 0 14px color-mix(in srgb, var(--c) 45%, transparent);
  transition: transform .06s, box-shadow .06s, filter .15s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 35%, #000), 0 0 8px color-mix(in srgb, var(--c) 45%, transparent); }
.btn:disabled, .btn.disabled { opacity: .35; pointer-events: none; filter: grayscale(.8); }
.btn.big { font-size: 14px; padding: 18px 14px; }
.btn.small { font-size: 9px; padding: 10px 8px; }
.btn .sub { display: block; font-size: 8px; opacity: .75; margin-top: 4px; font-family: var(--ui); letter-spacing: .05em; text-transform: none; }
.btn.col { flex-direction: column; gap: 0; }
.btn.cyan { --c: var(--cyan); } .btn.pink { --c: var(--pink); } .btn.green { --c: #1fd873; }
.btn.red { --c: var(--red); } .btn.yellow { --c: #e9b400; } .btn.purple { --c: var(--purple); }
.btn.gray { --c: #5b5480; } .btn.orange { --c: var(--orange); }
.btn.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 35%, #000), 0 0 28px var(--c); } }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-list { display: flex; flex-direction: column; gap: 12px; }

/* chips (segmented choices) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  flex: 1 0 auto; min-width: 58px; padding: 10px 8px; border-radius: 6px;
  background: #140d2a; border: 2px solid var(--line2); color: var(--muted);
  font-family: var(--pixel); font-size: 9px; text-align: center; transition: all .12s;
}
.chip small { display: block; font-family: var(--mono); font-size: 10px; margin-top: 5px; color: var(--muted); }
.chip:hover { border-color: var(--cyan); color: var(--text); }
.chip.on { border-color: var(--cyan); color: #fff; background: rgba(34, 228, 255, .14); box-shadow: var(--glow-c); }
.chip.on small { color: var(--cyan); }
.assets .chip { flex: 1 0 calc(25% - 6px); }

.field label, .label { display: block; font-family: var(--pixel); font-size: 8px; color: var(--muted); margin-bottom: 8px; letter-spacing: .08em; }
.input {
  width: 100%; background: #0c0719; border: 2px solid var(--line2); border-radius: 6px;
  padding: 12px; color: var(--yellow); font-family: var(--pixel); font-size: 12px; outline: none;
  user-select: text; -webkit-user-select: text;
}
.input:focus { border-color: var(--cyan); box-shadow: var(--glow-c); }
.input.center { text-align: center; }
.callsign { display: flex; align-items: center; gap: 8px; }
.callsign .input { text-transform: uppercase; }

input[type=range] { width: 100%; accent-color: var(--pink); }

.toggles { display: flex; gap: 8px; justify-content: center; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 8px; border: 2px solid var(--line2); background: #140d2a;
  display: grid; place-items: center; font-size: 16px; color: var(--muted);
}
.icon-btn.on { color: var(--cyan); border-color: var(--cyan); }

/* ---------------------------------------------------------- ticker */
.ticker {
  position: relative; overflow: hidden; border-top: 2px solid var(--line2); border-bottom: 2px solid var(--line2);
  background: rgba(8, 5, 18, .85); height: 34px; border-radius: 6px;
}
.ticker .badge {
  position: absolute; left: 0; top: 0; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 6px;
  padding: 0 10px; background: #1a0f33; font-family: var(--pixel); font-size: 8px; color: var(--green);
  border-right: 2px solid var(--line2);
}
.ticker .badge.off { color: var(--orange); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.ticker .track { display: flex; gap: 28px; white-space: nowrap; position: absolute; top: 0; bottom: 0; align-items: center; left: 100%; animation: marquee 32s linear infinite; font-family: var(--mono); font-size: 12px; }
.ticker .track span b { color: var(--text); margin-right: 6px; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(calc(-100% - 100vw)); } }

/* ---------------------------------------------------------- league cards */
.league {
  display: flex; align-items: center; justify-content: space-between; padding: 14px;
  border-radius: 8px; background: #140d2a; border: 2px solid var(--line2); border-left: 6px solid var(--c, var(--cyan));
  text-align: left; transition: all .12s;
}
.league:hover, .league.on { border-color: var(--c); box-shadow: 0 0 16px color-mix(in srgb, var(--c) 45%, transparent); }
.league .n { font-family: var(--pixel); font-size: 11px; color: var(--c); }
.league .b { font-size: 12px; color: var(--muted); margin-top: 6px; }
.league .e { font-size: 24px; }

/* ---------------------------------------------------------- lobby */
.room-code { font-family: var(--pixel); font-size: clamp(34px, 12vw, 54px); color: var(--yellow); text-align: center; letter-spacing: .15em; text-shadow: 0 0 18px rgba(255, 210, 63, .6); }
.plist { display: flex; flex-direction: column; gap: 8px; }
.pitem { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #140d2a; border: 2px solid var(--line2); border-radius: 8px; }
.pitem .nm { font-family: var(--pixel); font-size: 10px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitem .tag { font-family: var(--pixel); font-size: 7px; padding: 4px 6px; border-radius: 4px; background: #2b1f4d; color: var(--yellow); }
.pitem.me { border-color: var(--cyan); }
.online { color: var(--green); } .offline { color: #5b5480; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 12px; }
.kv div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.kv span:first-child { color: var(--muted); }

/* radar (quick match) */
.radar { width: 180px; height: 180px; margin: 10px auto; border-radius: 50%; position: relative; border: 2px solid rgba(57, 255, 136, .5);
  background: radial-gradient(circle, rgba(57, 255, 136, .08) 0 30%, transparent 31%), repeating-radial-gradient(circle, transparent 0 29px, rgba(57, 255, 136, .25) 29px 30px); overflow: hidden; }
.radar::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, rgba(57, 255, 136, .45), transparent 25%); animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------- GAME */
#game {
  position: absolute; inset: 0; display: grid;
  grid-template-columns: 100%;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: 'hud' 'opp' 'chart' 'ctl';
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
#game aside { display: contents; }

.hud { grid-area: hud; background: var(--panel); border-bottom: 2px solid var(--line2); padding: 8px 10px 6px; }
.hud-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.hud-top .pair { font-family: var(--pixel); font-size: 11px; color: var(--yellow); }
.hud-top .tf { font-family: var(--pixel); font-size: 8px; color: var(--cyan); border: 1px solid var(--cyan); padding: 3px 5px; border-radius: 4px; }
.hud-top .src { font-size: 9px; color: var(--muted); border: 1px solid var(--line2); padding: 2px 5px; border-radius: 4px; }
.hud-top .date { font-family: var(--mono); font-size: 11px; color: #b9b0e6; margin-left: auto; }
.hud-top .timer { font-family: var(--pixel); font-size: 13px; color: #fff; min-width: 62px; text-align: right; }
.hud-top .timer.warn { color: var(--red); animation: blink .6s infinite; }
.hud-top .exit { font-family: var(--pixel); font-size: 8px; color: var(--red); border: 2px solid var(--red); border-radius: 6px; padding: 6px 7px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat { background: #0c0719; border: 1px solid var(--line); border-radius: 6px; padding: 5px 6px; min-width: 0; }
.stat .l { font-family: var(--pixel); font-size: 6.5px; color: var(--muted); display: block; margin-bottom: 4px; letter-spacing: .06em; }
.stat .v { font-family: var(--mono); font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.stat.eq .v { color: var(--green); text-shadow: 0 0 8px rgba(57, 255, 136, .4); }
.mlbar { height: 6px; background: #1a1233; border-radius: 3px; overflow: hidden; margin-top: 6px; position: relative; }
.mlbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: linear-gradient(90deg, var(--red), var(--yellow), var(--green)); transition: width .3s; }

.opp { grid-area: opp; display: flex; gap: 6px; padding: 6px 10px; background: rgba(12, 7, 25, .9); border-bottom: 2px solid var(--line2); overflow-x: auto; }
.opp:empty { display: none; }
.ocard { flex: 1 0 140px; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; background: #140d2a; border: 1px solid var(--line2); min-width: 0; }
.ocard.me { border-color: var(--cyan); }
.ocard.lead { border-color: var(--yellow); box-shadow: 0 0 10px rgba(255, 210, 63, .3); }
.ocard .rk { font-family: var(--pixel); font-size: 10px; color: var(--yellow); }
.ocard .nm { font-family: var(--pixel); font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ocard .eq { font-family: var(--mono); font-size: 12px; font-weight: 700; }
.ocard .ps { font-size: 9px; font-family: var(--pixel); margin-left: auto; }
.ocard .body { min-width: 0; flex: 1; }

.chart-wrap { grid-area: chart; position: relative; min-height: 0; background: rgba(5, 3, 12, .72); overflow: hidden; }
#chart { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float-txt { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-family: var(--pixel); font-size: clamp(16px, 5vw, 26px); text-shadow: 3px 3px 0 #000, 0 0 16px currentColor; animation: floatUp 1.4s ease-out forwards; white-space: nowrap; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -220%) scale(1); } }
.flash { position: absolute; inset: 0; animation: flash .45s ease-out forwards; }
@keyframes flash { from { opacity: .45; } to { opacity: 0; } }
.combo { position: absolute; top: 46px; left: 10px; font-family: var(--pixel); font-size: 10px; color: var(--yellow); text-shadow: 0 0 10px var(--yellow); }
.zoom { position: absolute; left: 8px; top: 8px; display: flex; gap: 4px; z-index: 3; }
.zoom button { width: 28px; height: 28px; border-radius: 6px; background: rgba(20, 13, 42, .85); border: 1px solid var(--line2); color: var(--muted); font-family: var(--pixel); font-size: 11px; }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5, 3, 12, .6); z-index: 5; }
.countdown span { font-family: var(--pixel); font-size: clamp(60px, 22vw, 120px); color: var(--yellow); text-shadow: 0 0 30px var(--yellow), 6px 6px 0 #3a0a5c; animation: pop 1s ease-out infinite; }
@keyframes pop { 0% { transform: scale(1.6); opacity: 0; } 20% { transform: scale(1); opacity: 1; } 100% { transform: scale(.9); opacity: .8; } }
.wait-banner { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 4; font-family: var(--pixel); font-size: 9px; color: var(--yellow); background: rgba(20, 13, 42, .92); border: 2px solid var(--yellow); padding: 8px 12px; border-radius: 6px; animation: blink 1.4s infinite; white-space: nowrap; }
.net { position: absolute; left: 10px; bottom: 10px; font-family: var(--pixel); font-size: 8px; color: var(--orange); z-index: 4; }

.pos-bar { position: absolute; left: 10px; right: 76px; bottom: 30px; z-index: 4; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(12, 7, 25, .92); border: 2px solid var(--c, var(--green)); box-shadow: 0 0 14px color-mix(in srgb, var(--c, var(--green)) 35%, transparent); }
.pos-bar .side { font-family: var(--pixel); font-size: 10px; color: var(--c); }
.pos-bar .info { font-family: var(--mono); font-size: 11px; color: var(--muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-bar .pnl { font-family: var(--pixel); font-size: 12px; }

.controls { grid-area: ctl; background: var(--panel); border-top: 2px solid var(--line2); padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.lot-row { display: flex; align-items: center; gap: 6px; }
.lot-row .lbtn { width: 40px; height: 36px; border-radius: 6px; background: #140d2a; border: 2px solid var(--line2); font-family: var(--pixel); font-size: 12px; color: var(--cyan); }
.lot-row .lot { flex: 1; text-align: center; background: #0c0719; border: 2px solid var(--line2); border-radius: 6px; padding: 5px 4px; }
.lot-row .lot b { font-family: var(--pixel); font-size: 12px; color: var(--yellow); display: block; }
.lot-row .lot small { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.trade-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }
.trade-row .btn { padding: 0; height: 56px; font-size: 12px; }
.trade-row .btn .sub { font-size: 9px; font-family: var(--mono); }
#btnClose { grid-column: span 2; }
.speed { font-size: 8px; opacity: .8; }
.keys { font-size: 10px; color: var(--muted); text-align: center; display: none; }

/* ---------------------------------------------------------- results */
.result-title { font-family: var(--pixel); font-size: clamp(22px, 7vw, 34px); text-align: center; line-height: 1.3; animation: pop .6s ease-out 1; }
.result-title.win { color: var(--green); text-shadow: 0 0 20px var(--green), 4px 4px 0 #0a3a1f; }
.result-title.lose { color: var(--red); text-shadow: 0 0 20px var(--red), 4px 4px 0 #3a0a14; }
.result-title.draw { color: var(--cyan); text-shadow: 0 0 20px var(--cyan); }
.big-num { font-family: var(--pixel); font-size: clamp(20px, 6vw, 28px); text-align: center; }
.rrow { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 8px; background: #140d2a; border: 2px solid var(--line2); }
.rrow.first { border-color: var(--yellow); box-shadow: 0 0 16px rgba(255, 210, 63, .35); }
.rrow.me { outline: 2px dashed var(--cyan); outline-offset: 2px; }
.rrow .medal { font-size: 22px; width: 30px; text-align: center; }
.rrow .nm { font-family: var(--pixel); font-size: 10px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rrow .det { font-size: 11px; color: var(--muted); margin-top: 4px; font-family: var(--ui); }
.rrow .eq { font-family: var(--pixel); font-size: 11px; text-align: right; }

/* leaderboard */
.lb-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.lb-tabs .chip { flex: 1 0 auto; }
.lb { display: flex; flex-direction: column; gap: 6px; min-height: 200px; }
.lb .ln { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; padding: 10px; border-radius: 6px; background: #140d2a; border: 1px solid var(--line); }
.lb .ln:nth-child(1) { border-color: var(--yellow); } .lb .ln:nth-child(2) { border-color: #c9c9e0; } .lb .ln:nth-child(3) { border-color: var(--orange); }
.lb .rk { font-family: var(--pixel); font-size: 11px; color: var(--yellow); text-align: center; }
.lb .nm { font-family: var(--pixel); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .sm { font-size: 10px; color: var(--muted); margin-top: 4px; }
.lb .roi { font-family: var(--pixel); font-size: 10px; text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-family: var(--pixel); font-size: 9px; line-height: 2; }

/* ---------------------------------------------------------- toast / modal / loader */
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 460px; }
.toast { background: #1a0f33; border: 2px solid var(--c, var(--cyan)); color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 20px rgba(0, 0, 0, .5); animation: screenIn .2s ease-out; text-align: center; }
.loader { width: 44px; height: 44px; margin: 10px auto; border: 4px solid #2b1f4d; border-top-color: var(--cyan); border-radius: 50%; animation: spin .8s linear infinite; }
#loading { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(5, 3, 12, .75); }
#loading .t { font-family: var(--pixel); font-size: 10px; color: var(--cyan); margin-top: 10px; text-align: center; }
#confetti { position: fixed; inset: 0; z-index: 80; pointer-events: none; }

.shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake { 10%, 90% { transform: translate3d(-2px, 0, 0); } 20%, 80% { transform: translate3d(4px, 0, 0); } 30%, 50%, 70% { transform: translate3d(-8px, 2px, 0); } 40%, 60% { transform: translate3d(8px, -2px, 0); } }
.note { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.6; }
.footer-note { font-size: 10px; color: #5b5480; text-align: center; }

/* ---------------------------------------------------------- desktop */
@media (min-width: 960px) {
  #game {
    grid-template-columns: minmax(0, 1fr) 360px;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: 'hud hud' 'chart side';
    max-width: 1500px; margin: 0 auto;
    border-left: 2px solid var(--line2); border-right: 2px solid var(--line2);
  }
  #game aside { display: flex; flex-direction: column; grid-area: side; background: var(--panel); border-left: 2px solid var(--line2); min-height: 0; }
  .opp { flex-direction: column; border-bottom: 2px solid var(--line2); overflow-y: auto; max-height: 45%; padding: 10px; }
  .ocard { flex: 0 0 auto; }
  .controls { margin-top: auto; border-top: 2px solid var(--line2); padding: 14px; gap: 12px; }
  .trade-row { grid-template-columns: 1fr 1fr; }
  .trade-row .btn { height: 64px; }
  #btnClose { grid-column: span 2; }
  .keys { display: block; }
  .hud { padding: 10px 16px 8px; }
  .stats { grid-template-columns: repeat(6, 1fr); }
  .stat .v { font-size: 15px; }
  .hud-top .pair { font-size: 13px; }
}
@media (max-width: 380px) {
  .stat .v { font-size: 11px; }
  .trade-row .btn { height: 50px; font-size: 10px; }
  .assets .chip { flex-basis: calc(33% - 6px); }
}
@media (max-height: 620px) and (max-width: 959px) {
  .stats .stat.hide-sm { display: none; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .trade-row .btn { height: 46px; }
}
.stats .stat.hide-sm { }
@media (max-width: 959px) {
  .stats .stat.desk, #log { display: none; }
  .stat .v { font-size: 11.5px; }
}
.log { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.log .h2 { margin-bottom: 4px; }
.log .li { display: flex; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 12px; padding: 7px 9px; border-radius: 6px; background: #140d2a; border-left: 3px solid var(--line2); animation: screenIn .2s ease-out; }
.log .li.w { border-left-color: var(--green); } .log .li.l { border-left-color: var(--red); }
.log .emptylog { color: var(--muted); font-size: 11px; text-align: center; padding: 20px 0; line-height: 1.8; }
