:root {
  --bg-base: #040406;
  --bg-panel: #0a0a0f;
  --bg-elevated: #111118;
  --bg-hover: #181822;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #ececf1;
  --text-muted: #8b8b9a;
  --text-dim: #5c5c6a;
  --buy: #00e599;
  --buy-dim: rgba(0, 229, 153, 0.12);
  --buy-strong: #00c47f;
  --sell: #ff4d6a;
  --sell-dim: rgba(255, 77, 106, 0.12);
  --accent: #6c8cff;
  --accent-dim: rgba(108, 140, 255, 0.15);
  --warn: #ffb020;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --ob-head-h: 22px;
  --ob-row-h: 20px;
  --ob-visible-rows: 6;
  --ob-pane-h: calc(var(--ob-head-h) + var(--ob-row-h) * var(--ob-visible-rows));
  --ob-col-price: 34%;
  --ob-col-shares: 33%;
  --ob-col-total: 33%;
  --ob-cols: var(--ob-col-price) var(--ob-col-shares) var(--ob-col-total);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(108, 140, 255, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(0, 229, 153, 0.04), transparent),
    var(--bg-base);
}

.hidden { display: none !important; }

.brand-mark, .logo-mark {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #4d63cc);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 8px 32px rgba(108, 140, 255, 0.35);
}
.form-error { color: var(--sell); font-size: 12px; margin-top: 12px; min-height: 18px; }

/* Buttons */
.btn {
  border: none; border-radius: var(--radius-sm);
  padding: 10px 16px; font-weight: 600; cursor: pointer;
  font-family: var(--font-ui); font-size: 12px;
  transition: transform 0.08s, opacity 0.08s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.snipe-btn-locked {
  opacity: 0.28;
  filter: grayscale(0.85);
  pointer-events: none;
}
.btn-block { width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5568d4);
  color: #fff; margin-top: 8px;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }
.btn-sm { padding: 6px 10px; font-size: 11px; }
.btn-team-a {
  background: linear-gradient(180deg, var(--buy), var(--buy-strong));
  color: #001a10;
  font-weight: 700;
}
.btn-team-b {
  background: linear-gradient(180deg, #ff6b84, var(--sell));
  color: #fff;
  font-weight: 700;
}
.btn-buy {
  background: linear-gradient(180deg, var(--buy), var(--buy-strong));
  color: #001a10; font-weight: 700;
}
.btn-buy.alt { background: linear-gradient(180deg, #ff6b84, var(--sell)); color: #fff; }
.btn-sell {
  background: linear-gradient(180deg, var(--buy), var(--buy-strong));
  color: #001a10; font-weight: 700;
}
.btn-sell.alt { background: linear-gradient(180deg, #ff6b84, var(--sell)); color: #fff; }

/* App shell — viewport-locked on full screen */
.app {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  z-index: 100;
  min-width: 0;
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-left { flex: 1 1 auto; min-width: 0; }
.topbar-right { flex: 0 0 auto; justify-content: flex-end; margin-left: auto; }

.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark { width: 34px; height: 34px; margin: 0; font-size: 12px; border-radius: 9px; }
.logo-text { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.logo-pro { color: var(--accent); font-size: 10px; margin-left: 4px; vertical-align: super; }

.conn-pill, .latency-pill, .balance-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
}
.conn-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--sell);
  box-shadow: 0 0 8px var(--sell);
}
.conn-pill.online .conn-dot {
  background: var(--buy);
  box-shadow: 0 0 8px var(--buy);
}
.latency-pill.fast { color: var(--buy); border-color: rgba(0,229,153,0.25); }
.latency-pill.mid { color: var(--warn); }
.latency-pill.slow { color: var(--sell); }

.chip-label { color: var(--text-dim); font-size: 10px; text-transform: uppercase; }
.chip-value { color: var(--buy); font-weight: 700; font-size: 14px; }
.balance-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  margin-left: 2px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.balance-refresh-btn:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.balance-refresh-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.search-wrap {
  display: flex;
  gap: 8px;
  min-width: 0;
}
.search-wrap input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
}
.search-wrap input:focus {
  outline: none; border-color: var(--accent);
}

.search-panel {
  position: relative;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn-search-toggle:hover,
.btn-search-toggle.active {
  color: var(--accent);
  border-color: rgba(108, 140, 255, 0.35);
  background: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(108, 140, 255, 0.08);
}

.search-panel.open .search-wrap {
  display: flex;
  width: min(380px, calc(100vw - 220px));
  max-width: 420px;
}

@media (max-width: 1280px) {
  .search-panel.open .search-wrap {
    position: fixed;
    width: auto;
    max-width: none;
    height: auto;
  }
}

.search-wrap.hidden {
  display: none;
}

@media (min-width: 1281px) {
  .search-panel {
    height: 36px;
    flex-shrink: 0;
  }

  .search-panel.open .search-wrap {
    position: absolute;
    right: calc(100% + 8px);
    top: 0;
    display: flex;
    align-items: center;
    width: min(380px, calc(100vw - 280px));
    max-width: 420px;
    height: 36px;
    z-index: 110;
  }

  .search-panel.open .search-wrap input {
    height: 36px;
    padding: 0 12px;
    box-sizing: border-box;
  }

  .search-panel.open .search-wrap .btn-ghost,
  .search-panel.open .search-wrap .btn-search-close {
    height: 36px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    box-sizing: border-box;
  }
}

.btn-search-close {
  padding: 8px 10px;
  font-size: 16px;
  line-height: 1;
}

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text);
  cursor: pointer; font-weight: 600;
}
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 160px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.user-dropdown button {
  display: block; width: 100%; text-align: left;
  padding: 10px 14px; border: none;
  background: transparent; color: var(--text);
  cursor: pointer;
}
.user-dropdown button:hover { background: var(--bg-hover); }

/* Workspace */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr) minmax(0, 220px);
  gap: 14px;
  padding: 14px;
  min-height: 0;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-head.compact { padding: 10px 14px; }
.panel-head h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; }
.badge {
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent-dim); color: var(--accent);
}

.markets-panel {
  gap: 0;
}

.markets-split {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.cricket-section {
  flex: 4 1 0;
  border-bottom: 1px solid var(--border);
}

.markets-section {
  flex: 6 1 0;
}

.markets-section .event-title {
  flex-shrink: 0;
}

.cricket-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}

.markets-panel .event-title {
  padding: 10px 16px;
  font-size: 12px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}

.market-list {
  flex: 1; min-height: 0; overflow-y: auto; padding: 8px;
}
.cricket-list,
.market-list,
.ob-asks-pane,
.ob-bids-pane,
.activity-feed,
.positions-table-wrap,
.trade-panel,
.center-panel,
html,
body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.cricket-list::-webkit-scrollbar,
.market-list::-webkit-scrollbar,
.ob-asks-pane::-webkit-scrollbar,
.ob-bids-pane::-webkit-scrollbar,
.activity-feed::-webkit-scrollbar,
.positions-table-wrap::-webkit-scrollbar,
.trade-panel::-webkit-scrollbar,
.center-panel::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.market-item {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.market-item:hover { background: var(--bg-hover); border-color: var(--border); }
.market-item.active {
  background: var(--buy-dim);
  border-color: rgba(0, 229, 153, 0.35);
}
.market-q { font-size: 12px; font-weight: 500; line-height: 1.35; color: var(--text); }
.market-meta { display: flex; justify-content: space-between; margin-top: 4px; font-size: 10px; color: var(--text-dim); font-family: var(--font-mono); }

.cricket-item {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.cricket-item:hover { background: var(--bg-hover); border-color: var(--border); }
.cricket-item.active {
  background: rgba(108, 140, 255, 0.12);
  border-color: rgba(108, 140, 255, 0.35);
}
.cricket-title { font-size: 12px; font-weight: 500; line-height: 1.35; color: var(--text); }
.cricket-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.cricket-status { text-transform: capitalize; }
.cricket-status.live { color: #2ebd85; }
.cricket-status.upcoming { color: var(--accent); }
.cricket-status.past { color: var(--text-dim); }
.cricket-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}
.cricket-guide {
  padding: 10px 8px;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.55;
  text-align: left;
}
.cricket-guide strong {
  color: var(--text-muted);
  font-weight: 600;
}

.center-panel {
  padding: 0;
  gap: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.market-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.market-header > div:first-child {
  flex: 1;
  min-width: 0;
}
.market-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 2px; }
.market-header h2 {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-header-tabs { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.btn-cancel-market {
  padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.08);
  color: #60a5fa;
  cursor: pointer; font-weight: 600; font-size: 11px; white-space: nowrap;
}
.btn-cancel-market:hover { background: rgba(96, 165, 250, 0.16); }
.outcome-tabs { display: flex; gap: 6px; }
.outcome-tab {
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer; font-weight: 600; font-size: 11px;
}
.outcome-tab.active[data-tab="0"] {
  background: #2ebd85;
  color: #ffffff;
  border-color: #2ebd85;
}
.outcome-tab.active[data-tab="1"] {
  background: #e8616f;
  color: #ffffff;
  border-color: #e8616f;
}

.orderbook-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.ob-head {
  display: grid;
  grid-template-columns: var(--ob-cols);
  align-items: center;
  padding: 6px 8px;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
  flex-shrink: 0;
}
.ob-head-left {
  display: flex;
  align-items: center;
  gap: 5px;
  grid-column: 1;
  justify-self: start;
}
.ob-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  opacity: 0.85;
  border-radius: 3px;
  line-height: 0;
}
.ob-refresh-btn:hover {
  color: #9ca3af;
  opacity: 1;
  background: rgba(255, 255, 255, 0.05);
}
.ob-outcome-label {
  grid-column: 2;
  justify-self: center;
  text-align: center;
  color: #c9a227;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  padding: 0 4px;
}
.ob-status {
  grid-column: 3;
  justify-self: end;
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-weight: 500;
  text-transform: none;
}
.ob-status.live { color: var(--buy); }

.ob-grid { display: none; }

.ob-scroll-wrap {
  flex: 0 0 auto;
  padding: 0 10px 8px;
  display: flex;
  flex-direction: column;
}

.ob-scroll {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  background: #141416;
}

.ob-asks-pane,
.ob-bids-pane {
  flex: 0 0 auto;
  height: var(--ob-pane-h);
  max-height: var(--ob-pane-h);
  overflow-x: hidden;
  overflow-y: auto;
  contain: paint;
  background: #141416;
  -webkit-overflow-scrolling: touch;
}

.ob-asks-pane {
  display: flex;
  flex-direction: column;
}

.ob-asks-pane > .ob-table {
  margin-top: auto;
  flex-shrink: 0;
}

.ob-bids-pane > .ob-table {
  flex-shrink: 0;
}

.ob-scroll::-webkit-scrollbar { width: 0; height: 0; }

.ob-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--font-ui);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.ob-table col.ob-col-price { width: var(--ob-col-price); }
.ob-table col.ob-col-shares { width: var(--ob-col-shares); }
.ob-table col.ob-col-total { width: var(--ob-col-total); }

.ob-asks-pane .ob-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.ob-bids-pane .ob-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.ob-table th {
  font-size: 9px;
  color: #6b7280;
  font-weight: 600;
  padding: 4px 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #141416;
}

.ob-table th.ob-col-price { text-align: left; }
.ob-table th.ob-col-shares { text-align: center; padding-left: 4px; padding-right: 4px; }
.ob-table th.ob-col-total { text-align: right; }

.ob-table td {
  padding: 3px 8px;
  cursor: pointer;
  line-height: 1.4;
  white-space: nowrap;
}

.ob-table td.ob-col-price { text-align: left; }
.ob-table td.ob-col-shares {
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
  color: #f5f5f5;
  font-weight: 400;
}
.ob-table td.ob-col-total {
  text-align: right;
  color: #f5f5f5;
  font-weight: 400;
}

.ob-table tr.ob-ask-row td.ob-col-price { color: #e8616f; font-weight: 500; }
.ob-table tr.ob-bid-row td.ob-col-price { color: #2ebd85; font-weight: 500; }
.ob-table tr:hover td { background: rgba(255, 255, 255, 0.03); }

.ob-spread-row {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: var(--ob-cols);
  padding: 4px 8px;
  font-size: 10px;
  color: #6b7280;
  font-family: var(--font-ui);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #101012;
  letter-spacing: 0.02em;
  line-height: 1.3;
}
.ob-spread-inner {
  grid-column: 2;
  text-align: center;
}
.ob-spread-row.spread-tight .ob-spread-inner { color: #2ebd85; }
.ob-spread-row.spread-mid .ob-spread-inner { color: #f59e0b; }
.ob-spread-row.spread-wide .ob-spread-inner { color: #e8616f; }

.ob-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}

.positions-panel {
  flex: 0 0 auto;
  min-height: auto;
  display: flex;
  flex-direction: column;
  overflow: visible;
}
.positions-table-wrap {
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  text-align: left; padding: 8px 14px;
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-panel);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); }
.data-table .empty { text-align: center; color: var(--text-dim); font-family: var(--font-ui); }
.pnl-pos { color: var(--buy); }
.pnl-neg { color: var(--sell); }

/* Trade deck — Buy | Snipe | Sell */
.trade-deck {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.trade-deck .trade-section {
  border-right: 1px solid var(--border);
  border-bottom: none;
  min-height: 0;
}

.trade-deck .sell-section { border-right: none; }

/* Snipe slot — fixed width; on/off only disables content */
.snipe-slot {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-height: 0;
  min-width: 0;
}

.snipe-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.snipe-header {
  text-align: center;
  padding: 6px 8px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.snipe-slot.snipe-on .snipe-header {
  background: rgba(255, 176, 32, 0.15);
  color: var(--warn);
  border-color: rgba(255, 176, 32, 0.35);
}

.snipe-power-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  flex-shrink: 0;
}

.field-row-inline .snipe-power-toggle {
  align-self: center;
}

.snipe-power-track {
  display: block;
  width: 44px;
  height: 22px;
  border-radius: 11px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}

.snipe-power-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: left 0.15s, background 0.15s;
}

.snipe-power-toggle.on .snipe-power-track {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.08);
}

.snipe-power-toggle.on .snipe-power-thumb {
  left: calc(100% - 18px);
  background: rgba(52, 211, 153, 0.85);
}

.snipe-slot.snipe-off .snipe-section > *:not(#snipe-type-field) {
  pointer-events: none;
  opacity: 0.42;
}

.snipe-slot.snipe-off #snipe-type-control {
  pointer-events: none;
  opacity: 0.42;
}

.snipe-section {
  background: linear-gradient(180deg, rgba(255, 176, 32, 0.04), transparent);
  border-bottom: none;
  flex: 1;
}

.snipe-slot.snipe-off .snipe-section {
  background: transparent;
}

.stats-panel {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.exec-stats.vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  margin-bottom: 0;
}

.btn-cancel-all {
  margin-bottom: 10px;
  border: 1px solid rgba(255, 90, 110, 0.45);
  background: rgba(255, 90, 110, 0.08);
  color: var(--sell);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.btn-cancel-all:hover {
  background: rgba(255, 90, 110, 0.16);
  border-color: var(--sell);
}

.sidebar-activity {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  overflow: hidden;
}

.sidebar-activity .panel-head.compact {
  border-bottom: 1px solid var(--border);
}
.activity-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-clear-activity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  opacity: 0.85;
  border-radius: 3px;
  line-height: 0;
}
.btn-clear-activity:hover {
  color: #e8616f;
  opacity: 1;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-activity .activity-feed {
  flex: 1;
  min-height: 0;
}

.snipe-help { display: none; }

.trade-panel {
  padding: 0;
  overflow-y: auto;
  gap: 0;
}

.trade-section {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.section-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.section-collapse-btn {
  padding: 0 4px;
  border: none;
  background: none;
  color: inherit;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
}

.section-collapse-btn:hover { opacity: 1; }

.trade-section.collapsed .section-head { margin-bottom: 0; }
.trade-section.collapsed .trade-section-body { display: none; }

.section-head .hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
  font-size: 10px;
}

.buy-head { color: var(--buy); }
.snipe-head { color: var(--warn); }
.sell-head { color: var(--sell); }

.btn-snipe {
  background: linear-gradient(180deg, var(--buy), var(--buy-strong));
  color: #001a10;
  font-weight: 700;
}

.btn-snipe.alt {
  background: linear-gradient(180deg, #ff6b84, var(--sell));
  color: #fff;
}

.sell-section {
  background: rgba(255, 77, 106, 0.03);
  border-bottom: none;
}

.sell-pos-display {
  margin-bottom: 8px;
}

.sell-pos-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 77, 106, 0.06);
  border: 1px solid rgba(255, 77, 106, 0.15);
  margin-bottom: 8px;
  font-size: 11px;
}

.sell-pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.sell-pos-grid span {
  display: block;
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.sell-pos-grid strong {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #ff8888;
}

.empty-pos {
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 0 8px;
}

.center-activity { display: none; }

.trade-panel .exec-stats {
  margin: 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
}

/* removed old trade-tabs */
.trade-tabs { display: none; }

.field-row { margin-bottom: 8px; }

.field-row-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field-row-duo .duo-field {
  margin-bottom: 0;
}

.snipe-outcome-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.snipe-outcome-tab {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}

.snipe-outcome-tab.active {
  background: rgba(255, 176, 32, 0.12);
  color: var(--warn);
  border-color: rgba(255, 176, 32, 0.4);
}

#snipe-price[readonly] {
  cursor: default;
  color: var(--text-muted);
  background: var(--bg-base);
  border-color: var(--border);
  pointer-events: none;
}

.field-row-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-row-inline > label {
  margin-bottom: 0;
  flex-shrink: 0;
}

.field-row-inline .seg-control {
  flex: 1;
  max-width: 160px;
}

.field-hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
  font-size: 9px;
}

.field-row label {
  display: block; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim); margin-bottom: 6px;
}
.field-row label .unit { color: var(--text-muted); }
.field-row input {
  width: 100%; padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px; font-weight: 600;
}
.field-row input:focus { outline: none; border-color: var(--accent); }
.field-row.disabled { opacity: 0.4; pointer-events: none; }

.seg-control {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.seg {
  padding: 9px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer; font-weight: 600;
}
.seg.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(108,140,255,0.35); }

.size-presets {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
}
.size-presets button {
  flex: 1; min-width: 52px;
  padding: 7px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px; cursor: pointer;
}
.size-presets button:hover { border-color: var(--accent); color: var(--accent); }

.trade-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.trade-actions .btn { padding: 14px 10px; font-size: 12px; }

.exec-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}
.exec-stats span { display: block; font-size: 10px; color: var(--text-dim); text-transform: uppercase; }
.exec-stats strong { font-family: var(--font-mono); font-size: 16px; color: var(--buy); }

.activity-panel {
  flex: 1; min-height: 140px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.activity-feed {
  flex: 1; overflow-x: hidden; overflow-y: auto; padding: 8px 12px 12px;
  font-family: var(--font-mono); font-size: 11px;
}
.activity-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  border-left: 3px solid var(--border);
  background: var(--bg-elevated);
  word-break: break-word;
  line-height: 1.4;
}
.activity-item.ok { border-left-color: var(--buy); }
.activity-item.err { border-left-color: var(--sell); }
.activity-item .time { color: var(--text-dim); font-size: 10px; }

.hotkeys-bar {
  display: flex; flex-wrap: wrap; gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: rgba(10, 10, 15, 0.9);
  color: var(--text-dim);
  font-size: 11px;
}
.hotkeys-bar kbd {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  margin-right: 4px;
}

.toast-root {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 1000; pointer-events: none;
  max-width: min(420px, calc(100vw - 40px));
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 12px;
  animation: slideIn 0.2s ease;
  pointer-events: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.ok { border-color: rgba(0,229,153,0.4); }
.toast.err { border-color: rgba(255,77,106,0.4); }
.toast.warn { border-color: rgba(255,176,32,0.4); color: var(--warn); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(4px); }
.modal-card-wide {
  max-width: 480px;
}

.withdraw-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

#withdraw-form select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

.modal-card {
  position: relative;
  width: min(480px, calc(100% - 32px));
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text);
  cursor: pointer; font-size: 20px; line-height: 1;
}

.setup-hint {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 8px;
}

.wallet-setup {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.wallet-info {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.wallet-info.compact { margin-top: 12px; }

.wallet-info code {
  font-family: var(--font-mono);
  font-size: 11px;
  word-break: break-all;
  color: var(--accent);
}

.wallet-status {
  font-size: 12px;
  color: var(--warn);
}

.wallet-status.deployed { color: var(--buy); }

.wallet-actions {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.wallet-chip .chip-value.mono {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ── Compact: split-screen / narrow window only (full screen unchanged) ── */
@media (min-width: 1281px) {
  .center-panel {
    overflow-x: hidden;
    overflow-y: auto;
  }
}

@media (max-width: 1280px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app {
    height: auto;
    min-height: 100dvh;
    max-height: none;
    overflow: visible;
  }

  .workspace {
    flex: 1 1 auto;
    grid-template-columns: 1fr;
    align-content: start;
  }

  .markets-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 168px;
    max-height: min(28vh, 240px);
    overflow: hidden;
  }

  .markets-panel .markets-split {
    min-height: 0;
    height: 100%;
  }

  .markets-panel .cricket-section {
    border-bottom: none;
    border-right: 1px solid var(--border);
  }

  .markets-panel .event-title {
    padding: 6px 12px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stats-panel { display: none; }

  .topbar {
    gap: 8px;
    padding: 8px 12px;
    overflow: visible;
  }
  .topbar-left {
    flex-wrap: nowrap;
    overflow: hidden;
  }
  .topbar-right {
    flex-wrap: nowrap;
    gap: 8px;
    overflow: visible;
  }
  .logo-text {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .conn-pill #conn-label {
    display: none;
  }
  .balance-chip {
    padding: 5px 10px;
  }
  .chip-value {
    font-size: 12px;
  }

  .search-panel.open .search-wrap {
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(env(safe-area-inset-top, 0px) + 52px);
    width: auto;
    max-width: none;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 10px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 200;
  }

  .search-panel.open .search-wrap input {
    flex: 1 1 100%;
    min-width: 0;
  }

  .center-panel { overflow: visible; }

  .market-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }

  .market-header > div:first-child {
    min-width: 0;
    width: 100%;
  }

  .market-header h2 {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .market-header-tabs {
    flex-wrap: wrap;
    width: 100%;
    gap: 6px;
  }

  .btn-cancel-market {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
  }

  .outcome-tabs {
    flex: 1 1 auto;
    min-width: 0;
  }

  .outcome-tab {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .toast-root {
    top: calc(env(safe-area-inset-top, 0px) + 56px);
    bottom: auto;
    left: 12px;
    right: 12px;
    max-width: none;
    align-items: stretch;
  }

  .toast {
    width: 100%;
    max-width: 100%;
    text-align: center;
    font-size: 11px;
    padding: 10px 14px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
  }

  .positions-panel {
    flex: 0 0 auto;
  }

  .trade-deck { grid-template-columns: 1fr; }

  .trade-deck .trade-section {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: auto;
  }

  .snipe-slot {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: nowrap;
    gap: 6px;
    padding: 8px 10px;
  }
  .topbar-left { gap: 6px; }
  .topbar-right { gap: 6px; }
  .logo-mark { width: 30px; height: 30px; font-size: 11px; }
  .logo-text { font-size: 12px; }
  .conn-pill { padding: 5px 8px; }
  .latency-pill { padding: 5px 8px; font-size: 10px; }
  .balance-chip { padding: 4px 8px; gap: 6px; }
  .chip-label { font-size: 9px; }
  .chip-value { font-size: 11px; }
  .btn-search-toggle { width: 32px; height: 32px; }
  .balance-refresh-btn {
    width: 20px;
    height: 20px;
    font-size: 13px;
  }
  .market-header-tabs {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-cancel-market {
    width: 100%;
  }
  .outcome-tabs {
    width: 100%;
  }
  .markets-panel {
    min-height: 150px;
    max-height: min(32vh, 220px);
  }
}
