/* Light or dark follows the visitor's system setting. The dark colours stay in index.html; this file adds the chart
   colours (read by theme.js, since a canvas cannot use CSS variables) and everything the light screen changes. */
:root {
  color-scheme: dark light;   /* scrollbars and form controls follow too */
  --up-rgb:34,197,94; --down-rgb:239,68,68;
  --pair1:#93c5fd; --pair2:#fb923c;
  --chart-grid:#1a1a1a; --chart-day:#151515; --chart-axis:#2a2a2a; --chart-cross:#555;
  --chart-mark:#facc15; --chart-ma1:#38bdf8; --chart-ma2:#c084fc; --chart-draw:#e5e7eb;
  --chart-ema1:#34d399; --chart-ema2:#fb7185; --chart-bb:#a3a3a3; --chart-bb-fill:rgba(163,163,163,.07);
  --chart-macd:#38bdf8; --chart-macd-signal:#f59e0b;
  --chart-entry:#3b82f6; --chart-stop:#f97316;
  --chart-band:rgba(255,255,255,.03); --chart-select:rgba(255,255,255,.06);
  --chart-on-tag:#000; --chart-tag:#3a3a3a; --chart-tag-text:#ededed;
}
.pairhead .l1 { color:var(--pair1); } .pairhead .l2 { color:var(--pair2); }

@media (prefers-color-scheme: light) {
  :root {
    --bg:#fff; --panel:#fff; --panel2:#f7f7f8; --panel3:#eeeff1; --line:#e5e7eb; --line2:#d1d5db;
    --text:#111827; --soft:#4b5563; --mute:#6b7280;
    --up:#15803d; --down:#dc2626; --amber:#a16207; --upbg:rgba(21,128,61,.12); --downbg:rgba(220,38,38,.12);
    --up-rgb:21,128,61; --down-rgb:220,38,38;
    --pair1:#2563eb; --pair2:#c2410c;
    --chart-grid:#e5e7eb; --chart-day:#eef0f2; --chart-axis:#d1d5db; --chart-cross:#9ca3af;
    --chart-mark:#ca8a04; --chart-ma1:#0284c7; --chart-ma2:#9333ea; --chart-draw:#1f2937;
    --chart-ema1:#059669; --chart-ema2:#e11d48; --chart-bb:#6b7280; --chart-bb-fill:rgba(107,114,128,.08);
    --chart-macd:#0284c7; --chart-macd-signal:#d97706;
    --chart-entry:#1d4ed8; --chart-stop:#c2410c;
    --chart-band:rgba(0,0,0,.03); --chart-select:rgba(0,0,0,.06);
    --chart-on-tag:#fff; --chart-tag:#374151; --chart-tag-text:#fff;
  }

  /* dark text on a dark or coloured button would not read */
  button.primary, .lots button.on, button.info.on, .views#mktSwitch button.on, .hnum { color:#fff; }
  button.buy, button.sell { color:#fff; }

  @keyframes flash { from { background:rgba(0,0,0,.08); } to { background:transparent; } }
  .book tr.lvl:hover td { background:rgba(0,0,0,.04); }
  #lib { background:rgba(0,0,0,.35); }
  .libbox { box-shadow:0 16px 48px rgba(0,0,0,.2); }
  .lockbar { background:#fef2f2; color:#991b1b; border-bottom-color:rgba(220,38,38,.4); }

  /* the help bubble stands out from the page, so it flips with it */
  .bubble { background:#1f2937; color:#f9fafb; box-shadow:0 8px 24px rgba(0,0,0,.25); }
  .bubble.below::before { border-bottom-color:#1f2937; }
  .bubble.above::before { border-top-color:#1f2937; }
  .bubble .bnav span { color:#9ca3af; }
  .bubble .bnav button { background:#f9fafb; color:#111827; }
  .bubble .bnav button.x { background:transparent; color:#9ca3af; }
}

/* same width as the phone layout in index.html */
@media (prefers-color-scheme: light) and (max-width:760px) {
  header { background:var(--bg); border-color:var(--line); }
  #mobileTabs { background:var(--bg); border-bottom-color:var(--line); }
  #mobileTabs button { color:var(--mute); }
  #mobileTabs button.on { color:var(--text); border-bottom-color:#2563eb; }
  #bookCard { background:var(--panel); border-color:var(--line); }
  .mobileSide { border-color:#bbf7d0; background:linear-gradient(160deg,#dcfce7,#fff 50%); }
  .mobileSide.offer { border-color:#fecaca; background:linear-gradient(200deg,#fee2e2,#fff 50%); }
  .mobileSide.bid .mobileSideTitle, .mobileSide.bid .mobileBest { color:var(--up); }
  .mobileSide.offer .mobileSideTitle, .mobileSide.offer .mobileBest { color:var(--down); }
  .mobileLevels button { background:var(--panel2); border-color:var(--line); }
  .mobileLevels button span:last-child { color:var(--mute); }
  .mobilePrice { color:var(--mute); }
  .mobilePrice strong { color:var(--text); }
}
