@font-face {
  font-family: "BeaufortLoL";
  src: url("/assets/fonts/beaufortforlol-bold.otf") format("opentype");
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #070a0f;
  --bg-soft: #0b1018;
  --card: rgba(17, 24, 35, 0.78);
  --card-2: rgba(22, 31, 45, 0.72);
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #e8eef7;
  --muted: #8a9bb1;
  --dim: #5c6b7f;
  --green: #35e08a;
  --green-soft: rgba(53, 224, 138, 0.12);
  --red: #ff5c7a;
  --red-soft: rgba(255, 92, 122, 0.12);
  --amber: #ffcc66;
  --accent: #7dd3fc;
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
.bg-glow {
  position: fixed; inset: -20% -10% auto -10%; height: 520px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(600px 260px at 18% 10%, rgba(53, 224, 138, 0.12), transparent 70%),
    radial-gradient(700px 300px at 82% 0%, rgba(125, 211, 252, 0.10), transparent 70%);
  filter: blur(2px);
}

.boot-error {
  display: none; position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 100; max-width: 90vw; padding: 8px 12px; border-radius: 8px;
  background: rgba(255,92,122,.16); border: 1px solid rgba(255,92,122,.5);
  color: #ffd7de; font-family: var(--mono); font-size: 12px;
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 12px 28px;
  background: rgba(7, 10, 15, 0.85);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-center { display: flex; justify-content: center; align-items: center; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: conic-gradient(from 210deg, #f59e0b, #3b82f6, #10b981, #f59e0b);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.45);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 7px; border-radius: 4px; background: var(--bg);
}
.brand-title {
  font-family: "BeaufortLoL", "Cinzel", Georgia, serif;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 19px;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fffbeb 0%, #fef08a 25%, #f59e0b 70%, #b45309 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.4)) drop-shadow(0 0 16px rgba(245, 158, 11, 0.25));
  text-align: center;
  user-select: none;
}
.brand-sub { color: var(--muted); font-size: 11px; font-family: var(--mono); }
.chip {
  font-size: 10px; font-weight: 800; letter-spacing: 0.14em;
  padding: 5px 9px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--muted); background: rgba(255,255,255,0.02);
}
.chip.live { color: var(--green); border-color: rgba(53,224,138,.4); background: var(--green-soft); }
.chip.backtest { color: var(--amber); border-color: rgba(255,204,102,.35); background: rgba(255,204,102,.08); }
.conn { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.conn i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); box-shadow: 0 0 0 3px rgba(148,163,184,.08); }
.conn.on i { background: var(--green); box-shadow: 0 0 10px var(--green); }
.conn.off i { background: var(--red); }
.clock { font-family: var(--mono); color: var(--muted); font-size: 12px; }

.wrap { position: relative; z-index: 1; max-width: 1440px; margin: 0 auto; padding: 22px 24px 32px; display: grid; gap: 16px; }
.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.03);
}
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .09em; }
.stat .value { font-family: var(--mono); font-size: 22px; font-weight: 650; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--dim); font-size: 11px; margin-top: 3px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; }
.section-head h2 { margin: 0; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: #c8d3e2; font-weight: 650; }
.muted { color: var(--muted); font-size: 12px; }
.count { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10px; color: var(--muted); background: rgba(148,163,184,.12); vertical-align: 1px; }


.candle-card { overflow: hidden; }
.candle-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; padding: 0 16px 16px; }
.candle-panel {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 8px;
  background: rgba(0,0,0,.16);
  min-width: 0;
  width: 100%;
}
.candle-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.candle-head .sym { font-weight: 750; letter-spacing: .04em; font-size: 13px; }
.ohlc { font-family: var(--mono); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.candle-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin: 4px 0 2px; font-size: 11px; }
.candle-meta .last { font-family: var(--mono); font-size: 16px; font-weight: 650; }
.chart-tools { display: flex; align-items: center; justify-content: flex-end; gap: 5px; margin: 2px 0 2px; min-height: 22px; }
.zoom-hint { color: var(--dim); font-size: 10px; margin-right: auto; }
.chart-tools button {
  width: 24px; height: 22px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.03); color: var(--text); font-size: 13px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.chart-tools button:hover { background: rgba(125,211,252,.12); border-color: rgba(125,211,252,.4); }
.chart-tools button:active { transform: translateY(1px); }
#xau-zoom-label, #btc-zoom-label { font-family: var(--mono); font-size: 10px; }
.candle-wrap { height: 320px; }
.candle-wrap canvas { cursor: grab; touch-action: none; }
.candle-wrap canvas:active { cursor: grabbing; }
.candle-wrap canvas { width: 100%; height: 100%; display: block; }
canvas { width: 100%; height: 100%; display: block; }
.legend { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.bid { background: var(--accent); }
.dot.ask { background: var(--amber); }
.bidask { font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.bidask .bid { color: var(--accent); }
.bidask .ask { color: var(--amber); }
.bidask .sep { color: var(--dim); }
.bidask .arrow { font-size: 8px; margin-left: 3px; vertical-align: 1px; }
.bidask .arrow.up { color: var(--green); }
.bidask .arrow.down { color: var(--red); }
.live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--dim); margin-left: 5px; vertical-align: 2px; }
.live-dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }

.grid-2 { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 16px; align-items: start; }
.table-wrap { overflow: auto; padding: 0 6px 8px; }
.table-wrap.tall { max-height: 420px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(11,16,24,.92); backdrop-filter: blur(6px); }
td { padding: 9px 10px; border-bottom: 1px solid rgba(148,163,184,.07); white-space: nowrap; }
tbody tr:hover td { background: rgba(255,255,255,.02); }
.r { text-align: right; font-variant-numeric: tabular-nums; }
td.r { font-family: var(--mono); }
.empty { color: var(--dim); text-align: center; padding: 26px 10px; }
.subhead { padding: 10px 16px 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  line-height: 1;
  box-sizing: border-box;
}
.pill.buy { color: var(--green); background: var(--green-soft); border: 1px solid rgba(53,224,138,.35); }
.pill.sell { color: var(--red); background: var(--red-soft); border: 1px solid rgba(255,92,122,.35); }
.pill.neutral { color: var(--muted); background: rgba(148,163,184,.12); border: 1px solid rgba(148,163,184,.35); }

/* Standardize pill border size in Matrix table */
.matrix-table .pill,
.matrix-table button.pill {
  min-width: 58px;
  height: 22px;
  text-align: center;
  border-width: 1px;
  border-style: solid;
}
.matrix-table button.pill {
  cursor: pointer;
  outline: none;
}
.pos { color: var(--green); }
.neg { color: var(--red); }
.flat { color: var(--muted); }
.mono { font-family: var(--mono); }
.small { font-size: 11px; color: var(--muted); }

.footer-card { padding: 14px 16px; }
.footer-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 12px; }
.footer-grid > div { display: flex; flex-direction: column; gap: 3px; }
.footer-grid .label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.footer-grid span:last-child { font-family: var(--mono); font-size: 12.5px; }
.params { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.25); border: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 11px; overflow: auto; white-space: pre-wrap; }

.bottom { display: flex; justify-content: space-between; max-width: 1440px; margin: 0 auto; padding: 0 26px 26px; color: var(--dim); font-size: 11px; }

.top-performers-card { margin-top: 0; margin-bottom: 0; }
.performers-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 0 16px 16px; }
.performers-panel { background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; width: 100%; overflow: hidden; }
.performers-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.performers-title { font-size: 13px; font-weight: 600; color: #f1f5f9; }
.performers-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.performers-table th { color: var(--muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(11,16,24,.92); backdrop-filter: blur(6px); white-space: nowrap; }
.performers-table td { padding: 8px 10px; border-bottom: 1px solid rgba(148,163,184,.07); vertical-align: middle; white-space: nowrap; }
.performers-table .col-strategy { width: auto; }
.performers-table .col-strategy .strat-cell { gap: 2px; }
.rank-lol-emblem-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  position: relative;
  cursor: default;
  margin: -4px 0;
}
.rank-lol-emblem-wrap:hover {
  /* Hover zoom disabled */
  transform: none;
}
.rank-lol-emblem {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.85));
}

/* Rank 1: Challenger - Radiant Golden Aura */
.lol-challenger .rank-lol-emblem {
  filter: drop-shadow(0 0 14px rgba(245, 158, 11, 0.9)) drop-shadow(0 0 26px rgba(59, 130, 246, 0.75)) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.95));
  animation: lol-emblem-challenger 2.6s ease-in-out infinite;
}
@keyframes lol-emblem-challenger {
  0%, 100% {
    filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.8)) drop-shadow(0 0 20px rgba(59, 130, 246, 0.6));
  }
  50% {
    filter: drop-shadow(0 0 22px rgba(251, 191, 36, 1)) drop-shadow(0 0 34px rgba(59, 130, 246, 0.95)) drop-shadow(0 8px 16px rgba(0, 0, 0, 1));
  }
}

/* Rank 2: Grandmaster - Fiery Crimson Ruby Aura */
.lol-grandmaster .rank-lol-emblem {
  filter: drop-shadow(0 0 12px rgba(225, 29, 72, 0.85)) drop-shadow(0 0 22px rgba(244, 63, 94, 0.65));
  animation: lol-emblem-gm 3s ease-in-out infinite;
}
@keyframes lol-emblem-gm {
  0%, 100% {
    filter: drop-shadow(0 0 10px rgba(225, 29, 72, 0.8));
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(244, 63, 94, 1)) drop-shadow(0 0 28px rgba(225, 29, 72, 0.85));
  }
}

/* Rank 3: Master - Void Amethyst Purple Glow */
.lol-master .rank-lol-emblem {
  filter: drop-shadow(0 0 12px rgba(168, 85, 247, 0.9)) drop-shadow(0 0 22px rgba(147, 51, 234, 0.65));
}

/* Rank 4: Diamond - Celestial Cyan Shimmer */
.lol-diamond .rank-lol-emblem {
  filter: drop-shadow(0 0 11px rgba(56, 189, 248, 0.85)) drop-shadow(0 0 20px rgba(14, 165, 233, 0.6));
}

/* Rank 5: Emerald - Radiant Jade Glow */
.lol-emerald .rank-lol-emblem {
  filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.9)) drop-shadow(0 0 22px rgba(5, 150, 105, 0.65));
}

/* Rank 6: Platinum - Teal / Turquoise Shimmer */
.lol-platinum .rank-lol-emblem {
  filter: drop-shadow(0 0 9px rgba(45, 212, 191, 0.75));
}

/* Rank 7: Gold - Warm Solar Glow */
.lol-gold .rank-lol-emblem {
  filter: drop-shadow(0 0 9px rgba(234, 179, 8, 0.75));
}

/* Rank 8: Silver - Polished Chrome Reflection */
.lol-silver .rank-lol-emblem {
  filter: drop-shadow(0 0 8px rgba(203, 213, 225, 0.7));
}

/* Rank 9: Bronze - Molten Copper */
.lol-bronze .rank-lol-emblem {
  filter: drop-shadow(0 0 8px rgba(217, 119, 6, 0.65));
}

/* Rank 10+: Iron - Dark Forged Iron */
.lol-iron .rank-lol-emblem {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.9));
}

.matrix-card { margin-top: 0; margin-bottom: 0; }
.matrix-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 0 16px 16px; }
.matrix-panel { background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; width: 100%; overflow: hidden; }
.matrix-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.matrix-table-wrap { overflow-x: auto; margin-top: 4px; }
.matrix-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.matrix-table th { padding: 8px 8px; font-size: 10.5px; white-space: nowrap; color: var(--muted); border-bottom: 1px solid var(--line); }
.matrix-table td { padding: 8px 8px; border-bottom: 1px solid rgba(148, 163, 184, 0.07); white-space: nowrap; vertical-align: middle; }
.strat-cell { display: flex; flex-direction: column; gap: 2px; }
.strat-cell .strat-title { font-weight: 600; color: #f8fafc; font-size: 12.5px; }
.strat-cell .strat-sub { font-size: 10.5px; color: var(--muted); font-family: var(--mono); }
.reason-cell { display: flex; flex-direction: column; gap: 3px; }
.reason-sub { font-size: 10.5px; color: var(--muted); font-family: var(--mono); }
.active-strat-row { background: rgba(59, 130, 246, 0.08); }
.view-btn { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); color: #e2e8f0; padding: 3px 8px; border-radius: 6px; font-size: 10.5px; cursor: pointer; transition: all 0.15s; }
.view-btn:hover { background: rgba(59, 130, 246, 0.3); border-color: #60a5fa; color: #fff; }

.symbol-panels-card { margin-top: 0; }
.symbol-panels-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 0 16px 16px; }
.symbol-panel { background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; width: 100%; overflow: hidden; }
.symbol-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.sym-badge { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; letter-spacing: 0.05em; }
.sym-badge.xau { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.sym-badge.btc { background: rgba(59, 130, 246, 0.18); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.sym-title { font-size: 13px; font-weight: 600; color: #f1f5f9; }
.sym-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.sym-stat-item { background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.sym-stat-item .label { font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.08em; }
.sym-stat-item .value { font-family: var(--mono); font-size: 18px; font-weight: 600; }
.sym-stat-item .sub { font-size: 10.5px; color: var(--dim); }
.sym-positions-block { border-top: 1px solid var(--line); padding-top: 10px; }
/* Unified 10-Item Scrollable Containers */
.performers-panel .table-wrap {
  max-height: 480px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.matrix-panel .matrix-table-wrap {
  max-height: 480px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.symbol-panel .table-wrap {
  max-height: 440px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.journal-scroll-wrap {
  max-height: 460px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1100px) {
  .matrix-grid { grid-template-columns: minmax(0, 1fr); }
  .symbol-panels-grid { grid-template-columns: minmax(0, 1fr); }
  .performers-grid { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .candle-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .topbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 14px 8px;
    gap: 6px;
  }
  .topbar-center {
    order: 1;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    text-align: center;
  }
  .topbar-left {
    display: none;
  }
  .topbar-right {
    order: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
  }
  .brand-title {
    font-size: 17px;
    letter-spacing: 0.12em;
    text-align: center;
  }
  .brand-sub { display: none; }
  .clock { display: none; }

  .wrap { padding: 10px 8px 24px; gap: 12px; width: 100%; max-width: 100vw; overflow-x: hidden; }
  .card {
    border-radius: 12px;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    overflow: hidden;
  }
  .candle-grid,
  .performers-grid,
  .matrix-grid,
  .symbol-panels-grid {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    gap: 12px;
    padding: 0 10px 12px;
  }
  .candle-panel,
  .performers-panel,
  .matrix-panel,
  .symbol-panel {
    width: 100%;
    min-width: 0;
    padding: 12px 10px;
    box-sizing: border-box;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .matrix-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .bottom {
    padding: 0 12px 16px;
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .brand-title { font-size: 14.5px; }
  .stats { grid-template-columns: 1fr; }
  .candle-wrap { height: 180px; }
}
