:root {
  --bg: #090b10;
  --panel: #0e1118;
  --line: #202735;
  --text: #eef2f7;
  --muted: #98a3b3;
  --bull: #1b5e20;
  --bear: #4a148c;
  --accent: #d4a72c;
  --danger: #ef5350;
  --ok: #26a69a;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

button { font: inherit; }

#app {
  display: grid;
  grid-template-rows: 104px 82px 78px 1fr 46px;
  height: 100vh;
  min-height: 620px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #10141d 0%, #0c1017 100%);
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid #3b465b;
  border-radius: 10px;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -1px;
  background: #151b27;
}
.brand-title { font-weight: 850; letter-spacing: .08em; font-size: 22px; }
.brand-subtitle { color: var(--muted); font-size: 16px; margin-top: 3px; letter-spacing: .06em; }

.symbol-block { text-align: center; }
.symbol-row { display: flex; justify-content: center; align-items: center; gap: 10px; }
.symbol { font-size: 34px; font-weight: 900; }
.instrument { color: var(--muted); font-size: 18px; margin-top: 4px; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 9px currentColor;
}
.dot.online { background: var(--ok); color: var(--ok); }
.dot.offline { background: var(--danger); color: var(--danger); }
.connection-text { color: var(--muted); font-size: 16px; font-weight: 700; letter-spacing: .06em; }

.price-block { text-align: right; }
.last-price { font-size: 46px; line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; }
.price-meta { margin-top: 7px; color: var(--muted); font-size: 18px; display: flex; justify-content: flex-end; gap: 20px; }
.price-meta b { color: var(--text); font-weight: 750; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  gap: 12px;
}

.timeframes {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.timeframes::-webkit-scrollbar { display: none; }

.tf-btn, .tool-btn {
  border: 1px solid transparent;
  background: transparent;
  color: #b8c0cc;
  border-radius: 7px;
  cursor: pointer;
  transition: .15s ease;
  white-space: nowrap;
}
.tf-btn { min-width: 62px; padding: 13px 14px; font-size: 19px; font-weight: 800; }
.tf-btn:hover, .tool-btn:hover { color: #fff; background: #171d29; }
.tf-btn.active { color: #fff; border-color: #48546a; background: #1b2230; }
.tool-btn { padding: 12px 15px; font-size: 18px; font-weight: 750; border-color: #2b3445; background: #111620; }
.toolbar-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.countdown-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 7px 14px;
  border: 1px solid #3a4559;
  border-radius: 8px;
  background: #121824;
}
.countdown-box span { color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: .06em; }
.countdown-box b { min-width: 86px; text-align: right; color: #fff; font-size: 25px; font-weight: 900; font-variant-numeric: tabular-nums; }

.stats {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #0b0f16;
}
.stats > div { padding: 0 16px; border-right: 1px solid #171d28; min-width: 0; }
.stats > div:last-child { border-right: none; }
.stats span { display: block; color: var(--muted); font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.stats b {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-shell { position: relative; min-height: 0; background: var(--bg); }
#chart { position: absolute; inset: 0; }

.ohlc-hud {
  position: absolute;
  z-index: 4;
  top: 10px;
  left: 14px;
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid rgba(65, 75, 95, .55);
  border-radius: 7px;
  background: rgba(9, 11, 16, .84);
  backdrop-filter: blur(5px);
  color: var(--muted);
  font-size: 20px;
  font-weight: 650;
  pointer-events: none;
}
.ohlc-hud b { color: #e6ebf2; font-weight: 800; }
#hudTf { color: var(--accent); font-weight: 900; }

.source-badge {
  position: absolute;
  z-index: 5;
  top: 12px;
  right: 92px;
  padding: 7px 10px;
  border: 1px solid #334056;
  border-radius: 6px;
  background: rgba(10, 14, 21, .88);
  color: #aeb8c7;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .05em;
  pointer-events: none;
}

.loading, .error-box {
  position: absolute;
  z-index: 20;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 15px 19px;
  border-radius: 8px;
  background: rgba(14,17,24,.96);
  border: 1px solid #313b4e;
  font-size: 20px;
}
.error-box { color: #ffb4b4; max-width: 650px; text-align: center; }
.hidden { display: none; }

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  color: #818c9c;
  border-top: 1px solid var(--line);
  background: #090c12;
  font-size: 16px;
  font-weight: 650;
}

.positive { color: #42c98a !important; }
.negative { color: #ff6d6d !important; }

@media (max-width: 1100px) {
  #app { grid-template-rows: 94px 76px 96px 1fr 42px; }
  .brand { display: none; }
  .topbar { grid-template-columns: 1fr 1fr; }
  .symbol-block { text-align: left; }
  .symbol-row { justify-content: flex-start; }
  .stats { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr); }
  .stats > div:nth-child(4) { border-right: none; }
  .countdown-box span { display: none; }
  .ohlc-hud { gap: 10px; font-size: 17px; }
}

/* Harmonic scanner */
.harmonic-btn { display:flex; align-items:center; gap:8px; }
.harmonic-dot { width:10px; height:10px; border-radius:50%; background:#2f394a; box-shadow:0 0 0 transparent; }
.harmonic-btn.enabled .harmonic-dot { background:#42c98a; box-shadow:0 0 9px rgba(66,201,138,.75); }

#harmonicCanvas {
  position:absolute;
  inset:0;
  z-index:3;
  width:100%;
  height:100%;
  pointer-events:none;
}

.harmonic-legend {
  position:absolute;
  left:14px;
  bottom:14px;
  z-index:6;
  max-width:min(560px,70vw);
  padding:10px 12px;
  border:1px solid #354055;
  border-radius:8px;
  background:rgba(8,11,16,.90);
  backdrop-filter:blur(6px);
  font-size:15px;
  color:#b9c3d1;
  pointer-events:none;
}
.harmonic-legend b { color:#fff; }

.settings-panel {
  position:fixed;
  top:0;
  right:0;
  z-index:80;
  width:460px;
  max-width:96vw;
  height:100vh;
  display:grid;
  grid-template-rows:auto 1fr auto;
  background:#0d1119;
  border-left:1px solid #2a3343;
  box-shadow:-18px 0 50px rgba(0,0,0,.45);
  transform:translateX(0);
  transition:transform .18s ease;
}
.settings-panel.closed { transform:translateX(102%); }
.settings-head {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  padding:20px 20px 16px;
  border-bottom:1px solid #202837;
  background:#111722;
}
.settings-head h2 { margin:0; font-size:24px; }
.settings-head p { margin:4px 0 0; color:#8f9bad; font-size:14px; }
.icon-btn {
  width:40px; height:40px; border-radius:8px;
  border:1px solid #323c4f; background:#151c28; color:#cbd3df;
  font-size:28px; line-height:1; cursor:pointer;
}
.settings-body { overflow:auto; padding:14px 16px 20px; }
.setting-section {
  margin-bottom:14px;
  padding:14px;
  border:1px solid #222b3b;
  border-radius:10px;
  background:#0f141e;
}
.setting-title {
  margin-bottom:12px;
  color:#d8dee8;
  font-size:15px;
  font-weight:900;
  letter-spacing:.06em;
  text-transform:uppercase;
}
.setting-section > label:not(.switch-row) {
  display:grid;
  grid-template-columns:1fr 128px;
  gap:12px;
  align-items:center;
  margin:10px 0;
  color:#aeb8c7;
  font-size:15px;
  font-weight:650;
}
.setting-section input[type="number"] {
  width:100%;
  padding:9px 10px;
  border:1px solid #354055;
  border-radius:7px;
  background:#0a0e15;
  color:#eef2f7;
  font-size:16px;
  font-weight:750;
  outline:none;
}
.setting-section input[type="color"] {
  width:100%; height:38px; padding:3px;
  border:1px solid #354055; border-radius:7px; background:#0a0e15;
}
.switch-row {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin:10px 0;
  color:#b5bfcd;
  font-size:15px;
  font-weight:700;
}
.switch-row input { display:none; }
.switch-row i {
  position:relative; flex:0 0 auto;
  width:46px; height:25px; border-radius:999px;
  background:#30394a; border:1px solid #3e495f;
}
.switch-row i::after {
  content:""; position:absolute; top:3px; left:3px;
  width:17px; height:17px; border-radius:50%; background:#aab3c0;
  transition:.15s ease;
}
.switch-row input:checked + i { background:#174b32; border-color:#26734d; }
.switch-row input:checked + i::after { left:24px; background:#52d18f; }

.pattern-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px 10px; }
.pattern-grid label {
  display:flex; align-items:center; gap:8px;
  padding:8px 9px; border-radius:7px; background:#0b1018;
  border:1px solid #202938; color:#c0c8d4; font-size:14px; font-weight:700;
}
.pattern-grid input { width:17px; height:17px; accent-color:#42c98a; }

.scan-info > div:not(.setting-title) {
  display:flex; justify-content:space-between; gap:12px;
  margin:8px 0; color:#96a2b3; font-size:14px;
}
.scan-info b { color:#eef2f7; font-variant-numeric:tabular-nums; }

.settings-actions {
  display:grid; grid-template-columns:1fr 1.6fr; gap:10px;
  padding:14px 16px 18px;
  border-top:1px solid #222b3b;
  background:#0b0f16;
}
.primary-btn,.secondary-btn {
  border-radius:8px; padding:12px 14px; cursor:pointer; font-size:16px; font-weight:850;
}
.primary-btn { border:1px solid #2d7a52; background:#174b32; color:#ddf7e9; }
.secondary-btn { border:1px solid #354055; background:#141b26; color:#c8d0dc; }

@media (max-width: 1250px) {
  .tf-btn { min-width:54px; padding:12px 11px; font-size:17px; }
  .tool-btn { font-size:16px; padding:11px 12px; }
  .countdown-box { padding:7px 10px; }
  .countdown-box b { font-size:22px; }
}

.engine-note {
  margin: 4px 0 12px;
  padding: 10px 11px;
  border: 1px solid #2e3a4d;
  border-radius: 8px;
  background: #0b111a;
  color: #9eabbc;
  font-size: 13px;
  line-height: 1.45;
}

/* Divergence + Z-score overlays */
.divergence-btn,.bands-btn { display:flex; align-items:center; gap:8px; }
.divergence-dot,.bands-dot { width:10px; height:10px; border-radius:50%; background:#2f394a; box-shadow:0 0 0 transparent; }
.divergence-btn.enabled .divergence-dot { background:#42c98a; box-shadow:0 0 9px rgba(66,201,138,.75); }
.bands-btn.enabled .bands-dot { background:#d4a72c; box-shadow:0 0 9px rgba(212,167,44,.72); }
#indicatorCanvas {
  position:absolute;
  inset:0;
  z-index:2;
  width:100%;
  height:100%;
  pointer-events:none;
}
.setting-section select {
  width:100%;
  padding:9px 10px;
  border:1px solid #354055;
  border-radius:7px;
  background:#0a0e15;
  color:#eef2f7;
  font-size:15px;
  font-weight:750;
  outline:none;
}
.indicator-grid label { min-height:38px; }
@media (min-width: 1450px) {
  .stats { grid-template-columns:repeat(10,1fr); }
}
@media (max-width: 1449px) {
  #app { grid-template-rows:104px 82px 112px 1fr 46px; }
  .stats { grid-template-columns:repeat(5,1fr); grid-template-rows:repeat(2,1fr); }
  .stats > div:nth-child(5) { border-right:none; }
  .toolbar-right { gap:5px; }
  .tool-btn { padding:10px 11px; font-size:16px; }
}

/* ============================================================
   LIGHT GRAY / PURPLE / GREEN THEME
   Palette matched to harmonic(2).html supplied by the user.
   Logic is unchanged; these are visual overrides only.
   ============================================================ */
:root {
  --bg: #b8b8b8;
  --panel: #a8a8a8;
  --line: #999999;
  --text: #333333;
  --muted: #666666;
  --bull: #388e3c;
  --bear: #7a2acc;
  --accent: #7a2acc;
  --danger: #c62828;
  --ok: #2e7d32;
}
html, body { background:#b8b8b8; color:#333333; }
.topbar { background:#a8a8a8; border-bottom-color:#999999; }
.brand-mark { background:#c2c2c2; border-color:#999999; color:#333333; }
.brand-title { color:#333333; }
.brand-subtitle, .instrument, .connection-text, .price-meta { color:#666666; }
.price-meta b { color:#222222; }
.toolbar { background:#a8a8a8; border-bottom-color:#999999; }
.tf-btn, .tool-btn { background:#c2c2c2; border-color:#999999; color:#666666; }
.tf-btn:hover, .tool-btn:hover { background:#cccccc; color:#222222; }
.tf-btn.active, .tool-btn.enabled { background:#7a2acc; border-color:#7a2acc; color:#ffffff; }
.countdown-box { background:#c2c2c2; border-color:#999999; }
.countdown-box span { color:#666666; }
.countdown-box b { color:#222222; }
.stats { background:#b8b8b8; border-bottom-color:#999999; }
.stats > div { border-right-color:#999999; }
.stats span { color:#666666; }
.stats b { color:#333333; }
.chart-shell { background:#d0d0d0; }
.ohlc-hud { background:rgba(194,194,194,.92); border-color:rgba(153,153,153,.9); color:#666666; box-shadow:0 2px 8px rgba(0,0,0,.08); }
.ohlc-hud b { color:#222222; }
#hudTf { color:#7a2acc; }
.source-badge { background:rgba(194,194,194,.94); border-color:#999999; color:#555555; }
.loading, .error-box { background:rgba(194,194,194,.97); border-color:#999999; color:#333333; box-shadow:0 4px 20px rgba(0,0,0,.12); }
.error-box { color:#9b1c1c; }
.footer { background:#a8a8a8; border-top-color:#999999; color:#555555; }
.positive { color:#2e7d32 !important; }
.negative { color:#7a2acc !important; }
.harmonic-dot, .divergence-dot, .bands-dot { background:#888888; }
.harmonic-btn.enabled .harmonic-dot, .divergence-btn.enabled .divergence-dot { background:#388e3c; box-shadow:0 0 9px rgba(56,142,60,.60); }
.bands-btn.enabled .bands-dot { background:#7a2acc; box-shadow:0 0 9px rgba(122,42,204,.55); }
.harmonic-legend { background:rgba(194,194,194,.95); border-color:#999999; color:#444444; box-shadow:0 2px 12px rgba(0,0,0,.10); }
.harmonic-legend b { color:#222222; }

.settings-panel { background:#b8b8b8; border-left-color:#999999; box-shadow:-18px 0 50px rgba(0,0,0,.18); }
.settings-head { background:#a8a8a8; border-bottom-color:#999999; }
.settings-head h2 { color:#222222; }
.settings-head p { color:#666666; }
.icon-btn { border-color:#999999; background:#c2c2c2; color:#333333; }
.settings-body { background:#b8b8b8; }
.setting-section { background:#c2c2c2; border-color:#999999; }
.setting-title { color:#333333; }
.setting-section > label:not(.switch-row), .switch-row { color:#444444; }
.setting-section input[type="number"], .setting-section select { background:#d0d0d0; border-color:#999999; color:#222222; }
.setting-section input[type="color"] { background:#d0d0d0; border-color:#999999; }
.switch-row i { background:#999999; border-color:#888888; }
.switch-row i::after { background:#dddddd; }
.switch-row input:checked + i { background:#7a2acc; border-color:#6c24b6; }
.switch-row input:checked + i::after { background:#ffffff; }
.pattern-grid label { background:#d0d0d0; border-color:#999999; color:#333333; }
.pattern-grid input { accent-color:#7a2acc; }
.scan-info > div:not(.setting-title) { color:#555555; }
.scan-info b { color:#222222; }
.settings-actions { background:#a8a8a8; border-top-color:#999999; }
.primary-btn { border-color:#6c24b6; background:#7a2acc; color:#ffffff; }
.secondary-btn { border-color:#999999; background:#c2c2c2; color:#333333; }
.engine-note { background:#d0d0d0; border-color:#999999; color:#555555; }


/* ============================================================
   READABILITY PATCH — larger terminal text + larger confluence labels
   ============================================================ */
.brand-title { font-size: 24px; }
.brand-subtitle { font-size: 17px; }
.symbol { font-size: 38px; }
.instrument { font-size: 20px; }
.connection-text { font-size: 17px; }
.last-price { font-size: 50px; }
.price-meta { font-size: 20px; }
.tf-btn { min-width: 70px; padding: 15px 16px; font-size: 21px; }
.tool-btn { padding: 14px 17px; font-size: 20px; }
.countdown-box { height: 62px; }
.countdown-box span { font-size: 14px; }
.countdown-box b { min-width: 96px; font-size: 29px; }
.stats span { font-size: 16px; }
.stats b { font-size: 22px; }
.ohlc-hud { gap: 20px; padding: 10px 14px; font-size: 22px; }
.source-badge { font-size: 15px; padding: 8px 12px; }
.harmonic-legend { font-size: 17px; padding: 10px 14px; }
.footer { font-size: 17px; }
.settings-head h2 { font-size: 26px; }
.settings-head p { font-size: 15px; }
.setting-title { font-size: 17px; }
.setting-section > label:not(.switch-row), .switch-row { font-size: 15px; }
.setting-section input[type="number"], .setting-section select { font-size: 15px; padding: 8px 10px; }
.primary-btn, .secondary-btn { font-size: 16px; padding: 11px 14px; }
.scan-info > div:not(.setting-title), .engine-note { font-size: 14px; }

/* ============================================================
   POI ENGINE
   ============================================================ */
#poiCanvas {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  z-index:3;
  pointer-events:none;
}
#indicatorCanvas { z-index:4; }
#harmonicCanvas { z-index:5; }
.poi-dot { width:8px; height:8px; border-radius:50%; display:inline-block; background:#888888; margin-right:7px; vertical-align:1px; }
.poi-btn.enabled .poi-dot { background:#d4a72c; box-shadow:0 0 9px rgba(212,167,44,.65); }

@media (min-width:1450px){.stats{grid-template-columns:repeat(11,1fr);}}
@media (max-width:1449px){.stats{grid-template-columns:repeat(6,1fr);grid-template-rows:repeat(2,1fr);} .stats>div:nth-child(5){border-right:1px solid #999999;} .stats>div:nth-child(6){border-right:none;}}


/* ============================================================
   V7.5 FULL TERMINAL STYLE CONTROL
   ============================================================ */
:root {
  --style-page-bg:#b8b8b8;
  --style-panel-bg:#a8a8a8;
  --style-control-bg:#c2c2c2;
  --style-input-bg:#d0d0d0;
  --style-border:#999999;
  --style-text:#333333;
  --style-muted:#666666;
  --style-chart-bg:#d0d0d0;
  --style-ui-font:12px;
  --style-settings-font:12px;
  --style-panel-width:400px;
}
html,body { background:var(--style-page-bg)!important; color:var(--style-text)!important; }
.topbar,.toolbar,.footer,.settings-head,.settings-actions { background:var(--style-panel-bg)!important; border-color:var(--style-border)!important; }
.stats,.settings-body { background:var(--style-page-bg)!important; border-color:var(--style-border)!important; }
.chart-shell { background:var(--style-chart-bg)!important; }
.settings-panel { width:var(--style-panel-width)!important; background:var(--style-page-bg)!important; border-color:var(--style-border)!important; }
.setting-section,.tf-btn,.tool-btn,.countdown-box,.icon-btn,.secondary-btn,.pattern-grid label { background:var(--style-control-bg)!important; border-color:var(--style-border)!important; }
.setting-section input[type="number"],.setting-section select,.setting-section input[type="color"],.engine-note { background:var(--style-input-bg)!important; border-color:var(--style-border)!important; }
.brand-title,.settings-head h2,.setting-title,.stats b,.price-meta b,.ohlc-hud b,.scan-info b { color:var(--style-text)!important; }
.brand-subtitle,.instrument,.connection-text,.price-meta,.stats span,.footer,.settings-head p,.setting-section>label:not(.switch-row),.switch-row,.scan-info>div:not(.setting-title),.engine-note { color:var(--style-muted)!important; }
.setting-section input[type="number"],.setting-section select,.pattern-grid label,.secondary-btn,.icon-btn { color:var(--style-text)!important; }

/* General terminal text sizing. Large price/title elements intentionally keep their own hierarchy. */
.tool-btn,.tf-btn,.footer,.connection-text,.price-meta,.source-badge { font-size:var(--style-ui-font)!important; }
.stats span { font-size:calc(var(--style-ui-font) - 2px)!important; }
.stats b { font-size:calc(var(--style-ui-font) + 4px)!important; }
.instrument { font-size:calc(var(--style-ui-font) + 2px)!important; }
.ohlc-hud { font-size:calc(var(--style-ui-font) + 4px)!important; }

/* Settings typography — deliberately large/readable. */
.settings-head h2 { font-size:calc(var(--style-settings-font) + 10px)!important; }
.settings-head p { font-size:calc(var(--style-settings-font) - 2px)!important; }
.setting-title { font-size:calc(var(--style-settings-font) + 1px)!important; }
.setting-section>label:not(.switch-row),.switch-row { font-size:var(--style-settings-font)!important; }
.setting-section input[type="number"],.setting-section select,.pattern-grid label,.primary-btn,.secondary-btn { font-size:calc(var(--style-settings-font) - 1px)!important; }
.scan-info>div:not(.setting-title),.engine-note { font-size:calc(var(--style-settings-font) - 2px)!important; }
.setting-section>label:not(.switch-row) { grid-template-columns:minmax(0,1fr) 145px; }

.style-dot { width:8px;height:8px;border-radius:50%;display:inline-block;background:#7a2acc;margin-right:7px;vertical-align:1px;box-shadow:0 0 8px rgba(122,42,204,.45); }
.style-btn.enabled .style-dot { background:#388e3c;box-shadow:0 0 9px rgba(56,142,60,.65); }

.brand-mark,.ohlc-hud,.source-badge,.loading,.error-box { background:var(--style-control-bg)!important; border-color:var(--style-border)!important; color:var(--style-text)!important; }


/* MTF POI timeframe selector */
.poi-tf-wrap{margin:8px 0 12px;padding:9px;border:1px solid var(--style-border,#999);border-radius:7px;background:var(--style-input-bg,#d0d0d0)}
.poi-tf-title{font-size:var(--style-settings-font,20px);font-weight:800;margin-bottom:8px;color:var(--style-text,#333)}
.poi-tf-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.poi-tf-grid label{display:flex;align-items:center;gap:6px;min-width:0;padding:6px 7px;border:1px solid var(--style-border,#999);border-radius:5px;background:var(--style-control-bg,#c2c2c2);color:var(--style-text,#333);font-size:calc(var(--style-settings-font,20px) - 2px);font-weight:700;cursor:pointer}
.poi-tf-grid input{width:17px;height:17px;accent-color:#7a2acc;flex:0 0 auto}
@media(max-width:900px){.poi-tf-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}


/* MAX PAIN final-signal control */
.max-pain-btn { display:flex;align-items:center;gap:7px; }
.max-pain-dot { width:8px;height:8px;border-radius:50%;display:inline-block;background:#888888;box-shadow:none; }
.max-pain-btn.enabled .max-pain-dot { background:#c62828;box-shadow:0 0 10px rgba(198,40,40,.65); }
.max-pain-btn.scanning { opacity:.72; }
.max-pain-btn.scanning .max-pain-dot { animation:maxPainPulse .8s ease-in-out infinite alternate; }
@keyframes maxPainPulse { from{transform:scale(.8);opacity:.45} to{transform:scale(1.25);opacity:1} }


/* v7.14 searchable multi-pair watchlist */
.symbol-block { position: relative; z-index: 30; }
.symbol-picker-wrap { position: relative; display: inline-block; }
.symbol-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 3px 9px 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.symbol-picker-btn:hover,
.symbol-picker-btn[aria-expanded="true"] {
  border-color: var(--style-border, #999);
  background: var(--style-control-bg, #c2c2c2);
}
.symbol-chevron {
  font-size: 17px;
  line-height: 1;
  color: var(--style-muted, #666);
  transform: translateY(1px);
}
.symbol-menu {
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%);
  width: min(620px, 76vw);
  max-height: min(560px, 70vh);
  padding: 12px;
  border: 1px solid var(--style-border, #999);
  border-radius: 10px;
  background: var(--style-panel-bg, #a8a8a8);
  box-shadow: 0 14px 38px rgba(0,0,0,.28);
  text-align: left;
  overflow: hidden;
}
.symbol-menu-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.symbol-search {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--style-border, #999);
  border-radius: 7px;
  outline: none;
  background: var(--style-input-bg, #d0d0d0);
  color: var(--style-text, #333);
  font: inherit;
  font-weight: 700;
}
.symbol-search:focus { border-color: #7a2acc; box-shadow: 0 0 0 2px rgba(122,42,204,.15); }
.symbol-count {
  min-width: 88px;
  color: var(--style-muted, #666);
  font-size: .76em;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}
.symbol-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  max-height: min(470px, 60vh);
  overflow-y: auto;
  padding-right: 3px;
}
.symbol-option {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--style-border, #999);
  border-radius: 6px;
  background: var(--style-control-bg, #c2c2c2);
  color: var(--style-text, #333);
  cursor: pointer;
  font: inherit;
  font-size: .82em;
  font-weight: 850;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.symbol-option:hover { border-color: #7a2acc; }
.symbol-option.active {
  border-color: #7a2acc;
  box-shadow: inset 3px 0 0 #7a2acc;
  background: var(--style-input-bg, #d0d0d0);
}
@media (max-width: 900px) {
  .symbol-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .symbol-menu { width: min(520px, 92vw); }
}
@media (max-width: 560px) {
  .symbol-list { grid-template-columns: 1fr; }
}


/* v7.14.1 obvious pair picker */
.pair-picker-actions {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.open-pair-btn {
  appearance: none;
  border: 1px solid rgba(122,42,204,.55);
  background: linear-gradient(180deg, rgba(122,42,204,.16), rgba(122,42,204,.08));
  color: #4a148c;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: .04em;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(122,42,204,.12);
}
.open-pair-btn:hover {
  background: linear-gradient(180deg, rgba(122,42,204,.22), rgba(122,42,204,.12));
  transform: translateY(-1px);
}
.open-pair-btn:focus-visible {
  outline: 2px solid #7a2acc;
  outline-offset: 2px;
}
.pair-picker-hint {
  color: #555;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}
@media (max-width: 720px) {
  .pair-picker-actions { align-items: stretch; }
  .open-pair-btn { width: 100%; }
}


/* v7.14.2 pair picker + header overflow fix */
.topbar {
  grid-template-columns: minmax(190px, 1fr) minmax(520px, 1.7fr) minmax(190px, 1fr);
  column-gap: 12px;
  padding-left: 16px;
  padding-right: 16px;
  overflow: visible;
}
.brand, .symbol-block, .price-block { min-width: 0; }
.brand { justify-self: start; }
.symbol-block { width: 100%; min-width: 0; }
.price-block { justify-self: end; }
.symbol-row { flex-wrap: nowrap; min-width: 0; }
.symbol-picker-wrap { flex: 0 1 auto; min-width: 0; }
.symbol-picker-btn { max-width: 100%; }
.symbol { white-space: nowrap; }
.instrument {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.pair-picker-actions, .pair-picker-hint { display:none !important; }
.open-pair-btn {
  flex: 0 0 auto;
  appearance:none;
  border:1px solid #6c24b6;
  background:#7a2acc;
  color:#fff;
  font-weight:900;
  font-size:15px;
  letter-spacing:.035em;
  line-height:1;
  padding:9px 12px;
  border-radius:7px;
  cursor:pointer;
  box-shadow:0 2px 7px rgba(74,20,140,.22);
  white-space:nowrap;
}
.open-pair-btn:hover { background:#6c24b6; transform:none; }
.open-pair-btn:focus-visible { outline:2px solid #4a148c; outline-offset:2px; }
.symbol-menu { z-index: 1000; }

@media (max-width: 1450px) {
  .topbar { grid-template-columns: minmax(165px,.8fr) minmax(500px,1.7fr) minmax(165px,.8fr); padding-left:10px; padding-right:10px; }
  .brand { gap:8px; }
  .brand-mark { width:44px; height:44px; font-size:17px; }
  .brand-title { font-size:18px; }
  .brand-subtitle { font-size:12px; }
  .symbol { font-size:28px; }
  .instrument { font-size:14px; }
  .connection-text { font-size:13px; }
  .open-pair-btn { font-size:13px; padding:8px 10px; }
  .last-price { font-size:34px; }
  .price-meta { font-size:14px; gap:10px; }
}
@media (max-width: 1180px) {
  .topbar { grid-template-columns: minmax(0,1fr) auto; }
  .brand { display:none; }
  .symbol-block { text-align:left; }
  .symbol-row { justify-content:flex-start; }
  .price-block { display:block; }
}
@media (max-width: 820px) {
  .topbar { grid-template-columns: 1fr; }
  .price-block { display:none; }
  .symbol-block { text-align:center; }
  .symbol-row { justify-content:center; }
  .instrument { text-align:center; }
}


/* v7.15 MAGIC scanner */
.magic-btn {
  border-color: rgba(92,45,145,.55) !important;
  background: linear-gradient(180deg, rgba(122,42,204,.18), rgba(56,142,60,.10)) !important;
  font-weight: 900 !important;
  letter-spacing: .04em;
}
.magic-btn:hover,.magic-btn.enabled { box-shadow: 0 0 0 2px rgba(122,42,204,.12), 0 3px 14px rgba(74,20,140,.18); }
.magic-btn.scanning { animation: magicPulse 1.1s ease-in-out infinite; }
.magic-dot { font-size: 18px; line-height: 1; color: #7a2acc; }
@keyframes magicPulse { 50% { transform: translateY(-1px); filter: brightness(1.12); } }
.magic-panel {
  position: fixed;
  z-index: 150;
  top: 72px;
  right: 18px;
  width: min(620px, calc(100vw - 36px));
  max-height: calc(100vh - 92px);
  display: flex;
  flex-direction: column;
  background: #b8b8b8;
  border: 1px solid #8d8d8d;
  border-radius: 14px;
  box-shadow: 0 18px 55px rgba(0,0,0,.28);
  overflow: hidden;
}
.magic-panel.closed { display: none; }
.magic-head { display:flex; justify-content:space-between; align-items:flex-start; gap:14px; padding:16px 18px 12px; border-bottom:1px solid #969696; background:#aaa; }
.magic-head h2 { margin:0; font-size:28px; color:#4a148c; }
.magic-head p { margin:3px 0 0; color:#555; font-weight:700; font-size:13px; }
.magic-kicker { font-size:11px; font-weight:900; letter-spacing:.14em; color:#666; }
.magic-body { padding:14px; overflow:auto; }
.magic-status-card { border:1px solid #999; border-radius:10px; background:#c5c5c5; padding:12px; }
.magic-status-row { display:flex; justify-content:space-between; gap:12px; font-size:14px; }
.magic-status-row b { color:#4a148c; }
.magic-progress { height:8px; border-radius:999px; background:#a4a4a4; overflow:hidden; margin:9px 0 7px; }
.magic-progress i { display:block; height:100%; width:0%; background:linear-gradient(90deg,#7a2acc,#388e3c); transition:width .18s ease; }
.magic-detail { color:#555; font-size:12px; font-weight:700; }
.magic-score-key { display:grid; grid-template-columns:repeat(4,1fr); gap:6px; margin:10px 0 12px; }
.magic-score-key span { text-align:center; padding:7px 4px; border:1px solid #a0a0a0; border-radius:7px; background:#c2c2c2; color:#555; font-size:11px; font-weight:900; }
.magic-results { display:flex; flex-direction:column; gap:9px; }
.magic-empty { padding:22px; text-align:center; border:1px dashed #999; border-radius:10px; color:#666; font-weight:800; }
.magic-result { border:1px solid #959595; border-left:5px solid #7a2acc; border-radius:10px; background:#c8c8c8; padding:11px 12px; cursor:pointer; transition:.12s ease; }
.magic-result.bull { border-left-color:#388e3c; }
.magic-result:hover { transform:translateY(-1px); box-shadow:0 5px 16px rgba(0,0,0,.12); }
.magic-result-top { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.magic-rank { font-weight:1000; color:#555; min-width:28px; }
.magic-symbol { flex:1; font-size:18px; font-weight:1000; color:#333; }
.magic-side { font-weight:1000; }
.magic-side.buy { color:#2e7d32; }.magic-side.sell { color:#6a1b9a; }
.magic-score { font-size:21px; font-weight:1000; color:#4a148c; }
.magic-result.bull .magic-score { color:#2e7d32; }
.magic-components { display:grid; grid-template-columns:repeat(4,1fr); gap:5px; margin-top:8px; }
.magic-components span { background:#b7b7b7; border-radius:5px; padding:5px 4px; text-align:center; font-size:10px; font-weight:900; color:#555; }
.magic-reason { margin-top:7px; color:#444; font-size:12px; font-weight:750; line-height:1.35; }
.magic-pois { margin-top:5px; color:#4a148c; font-size:12px; font-weight:900; }
.magic-result.bull .magic-pois { color:#2e7d32; }
.magic-actions { padding:11px 14px 14px; border-top:1px solid #999; background:#aaa; display:flex; gap:8px; justify-content:flex-end; }
@media(max-width:760px){
  .magic-panel{top:8px;right:8px;width:calc(100vw - 16px);max-height:calc(100vh - 16px)}
  .magic-score-key,.magic-components{grid-template-columns:repeat(2,1fr)}
}


/* ============================================================
   v7.15.1 RESPONSIVE WEBSITE FIT
   Keeps scanner/chart logic unchanged; compacts chrome on smaller desktops.
   ============================================================ */
@media (max-width: 1900px) {
  #app { grid-template-rows: 82px 62px 64px 1fr 36px; min-height: 560px; }
  .topbar { padding-left:10px; padding-right:10px; column-gap:8px; }
  .brand { gap:8px; }
  .brand-mark { width:46px; height:46px; font-size:17px; border-radius:8px; }
  .brand-title { font-size:18px !important; }
  .brand-subtitle { font-size:12px !important; }
  .symbol { font-size:30px !important; }
  .instrument { font-size:13px !important; margin-top:2px; }
  .connection-text { font-size:12px !important; }
  .open-pair-btn { font-size:12px !important; padding:7px 9px; }
  .last-price { font-size:34px !important; }
  .price-meta { font-size:13px !important; gap:9px; margin-top:4px; }

  .toolbar { padding:0 8px; gap:7px; min-width:0; }
  .timeframes { gap:4px; flex:1 1 auto; min-width:0; }
  .tf-btn {
    min-width:42px !important;
    padding:9px 8px !important;
    font-size:13px !important;
    border-radius:6px;
  }
  .toolbar-right { gap:4px; flex:0 0 auto; }
  .tool-btn {
    padding:9px 10px !important;
    font-size:13px !important;
    border-radius:6px;
  }
  .magic-dot { font-size:14px; }
  .countdown-box { height:46px; padding:5px 9px; gap:6px; }
  .countdown-box span { font-size:10px; }
  .countdown-box b { min-width:62px; font-size:18px; }

  .stats { min-height:0; }
  .stats > div { padding:8px 10px; }
  .stats span { font-size:11px !important; }
  .stats b { font-size:16px !important; margin-top:3px; }
  .footer { font-size:13px !important; }
  .ohlc-hud { font-size:14px !important; gap:9px; padding:6px 9px; }
  .source-badge { font-size:11px !important; padding:5px 8px; }
  .harmonic-legend { font-size:13px; padding:7px 9px; }
}

@media (max-width: 1550px) {
  #app { grid-template-rows: 76px 58px 60px 1fr 34px; }
  .topbar { grid-template-columns:minmax(150px,.72fr) minmax(430px,1.65fr) minmax(145px,.72fr); }
  .brand-mark { width:40px; height:40px; font-size:15px; }
  .brand-title { font-size:16px !important; }
  .brand-subtitle { font-size:10px !important; }
  .symbol { font-size:26px !important; }
  .instrument { font-size:11px !important; }
  .connection-text { font-size:10px !important; }
  .open-pair-btn { font-size:11px !important; padding:6px 8px; }
  .last-price { font-size:29px !important; }
  .price-meta { font-size:11px !important; }

  .tf-btn { min-width:36px !important; padding:8px 6px !important; font-size:12px !important; }
  .tool-btn { padding:8px 8px !important; font-size:12px !important; }
  .toolbar-right { gap:3px; }
  .stats > div { padding:7px 8px; }
  .stats span { font-size:10px !important; }
  .stats b { font-size:14px !important; }
}

/* At narrower widths, keep every control reachable instead of overflowing right. */
@media (max-width: 1280px) {
  #app { grid-template-rows: 72px 104px 60px 1fr 34px; }
  .toolbar { align-items:stretch; flex-direction:column; justify-content:center; gap:5px; padding:5px 8px; }
  .timeframes { width:100%; flex:0 0 auto; justify-content:flex-start; overflow-x:auto; }
  .toolbar-right { width:100%; flex:0 0 auto; justify-content:flex-start; overflow-x:auto; scrollbar-width:none; }
  .toolbar-right::-webkit-scrollbar { display:none; }
  .tf-btn { flex:1 0 38px; }
  .tool-btn { flex:0 0 auto; }
}

@media (max-width: 900px) {
  #app { grid-template-rows: 70px 104px 88px 1fr 32px; }
  .topbar { grid-template-columns:1fr; }
  .brand,.price-block { display:none !important; }
  .symbol-block { text-align:center; }
  .symbol-row { justify-content:center; }
  .instrument { text-align:center; }
  .stats { grid-template-columns:repeat(4,1fr) !important; grid-template-rows:repeat(3,1fr) !important; overflow:hidden; }
  .stats > div { padding:5px 6px; }
  .stats span { font-size:9px !important; }
  .stats b { font-size:12px !important; }
}


/* ==========================================================
   v7.15.3 TRUE 100%-ZOOM DESKTOP COMPACT MODE
   Layout-only: full watchlist, timeframes and buttons remain
   accessible; this is NOT browser/CSS zoom (canvas is unscaled).
   ========================================================== */
@media (min-width: 901px) {
  #app {
    min-width: 0;
    min-height: 0;
    height: 100dvh;
    grid-template-rows: 60px 78px 48px minmax(0, 1fr) 23px;
  }
  .topbar {
    grid-template-columns: minmax(170px, .9fr) minmax(0, 2fr) minmax(135px, .8fr);
    padding: 0 12px;
    gap: 10px;
  }
  .brand { display: flex !important; gap: 8px; }
  .brand-mark { width: 35px; height: 35px; font-size: 14px; flex-shrink: 0; border-radius: 7px; }
  .brand-title { font-size: 15px !important; line-height: 1.15; letter-spacing: .055em; }
  .brand-subtitle { font-size: 10px !important; letter-spacing: 0; margin-top: 2px; }
  .symbol-row { gap: 6px; }
  .symbol { font-size: 23px !important; line-height: 1.08; }
  .symbol-picker-btn { padding: 2px 4px !important; }
  .symbol-chevron { font-size: 11px; }
  .open-pair-btn { font-size: 11px !important; padding: 6px 8px !important; }
  .connection-text { font-size: 10px !important; }
  .dot { width: 7px; height: 7px; flex-shrink: 0; }
  .instrument { font-size: 11px !important; margin-top: 1px; }
  .last-price { font-size: 26px !important; }
  .price-meta { font-size: 10px !important; margin-top: 3px; gap: 7px; }

  /* Two intentional toolbar rows, not two oversized strips. */
  .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 30px 34px;
    align-content: center;
    row-gap: 4px;
    padding: 3px 10px;
    min-width: 0;
  }
  .timeframes {
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    min-width: 0;
    width: 100%;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }
  .timeframes::-webkit-scrollbar { height: 3px; }
  .tf-btn {
    flex: 0 0 auto;
    min-width: 44px !important;
    height: 29px;
    padding: 4px 9px !important;
    font-size: 12px !important;
    line-height: 1;
    border-radius: 5px;
  }
  .toolbar-right {
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }
  .toolbar-right::-webkit-scrollbar { height: 3px; }
  .tool-btn {
    flex: 0 0 auto;
    padding: 5px 9px !important;
    height: 31px;
    font-size: 12px !important;
    line-height: 1;
    border-radius: 5px;
  }
  .harmonic-dot,.divergence-dot,.bands-dot,.poi-dot,.max-pain-dot { width: 7px; height: 7px; }
  .countdown-box {
    flex: 0 0 auto;
    height: 31px;
    padding: 3px 8px;
    gap: 5px;
    border-radius: 5px;
  }
  .countdown-box span { font-size: 9px; }
  .countdown-box b { font-size: 13px; min-width: 42px; }

  .stats {
    min-height: 0;
    grid-template-columns: repeat(11, minmax(0, 1fr)) !important;
    grid-template-rows: 1fr !important;
    overflow: hidden;
  }
  .stats > div { padding: 4px 8px !important; min-width: 0; border-right: 1px solid var(--style-border) !important; }
  .stats > div:last-child { border-right: 0 !important; }
  .stats span { font-size: 9px !important; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stats b { font-size: 12px !important; line-height: 1.2; margin-top: 3px; }
  .footer { font-size: 10px !important; padding: 0 10px; min-width: 0; gap: 10px; }
  .footer span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ohlc-hud { top: 6px; left: 8px; gap: 7px; padding: 4px 7px; font-size: 12px !important; }
  .source-badge { top: 7px; right: 72px; padding: 3px 5px; font-size: 10px !important; }
  .harmonic-legend { font-size: 11px; padding: 5px 8px; }
}

/* Long pairs remain selectable without pushing the header outside the window. */
@media (min-width: 901px) and (max-width: 1250px) {
  #app { grid-template-rows: 56px 78px 70px minmax(0, 1fr) 22px; }
  .topbar { grid-template-columns: minmax(0,1fr) minmax(0,1.7fr); }
  .brand { display: none !important; }
  .symbol-block { text-align: left; }
  .symbol-row { justify-content: flex-start; }
  .price-block { display: block; }
  .stats { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; grid-template-rows: repeat(2, 1fr) !important; }
  .stats > div { padding: 2px 6px !important; }
  .stats span { font-size: 8px !important; }
  .stats b { font-size: 11px !important; margin-top: 1px; }
  .timeframes,.toolbar-right { justify-content: flex-start; }
}

@media (max-width: 900px) {
  #app { min-height: 0; height: 100dvh; grid-template-rows: 58px 80px 74px minmax(0,1fr) 22px; }
  .toolbar { display: flex; flex-direction: column; justify-content: center; padding: 3px 6px; gap: 3px; }
  .timeframes,.toolbar-right { width: 100%; min-height: 31px; overflow-x: auto; overflow-y: hidden; flex: 0 0 auto; }
  .tf-btn { min-width: 37px !important; padding: 6px 6px !important; font-size: 11px !important; }
  .tool-btn { padding: 6px 8px !important; font-size: 11px !important; }
  .stats { grid-template-columns: repeat(6,minmax(0,1fr)) !important; grid-template-rows: repeat(2,1fr) !important; }
  .stats > div { padding: 2px 4px !important; }
  .stats span { font-size: 8px !important; }
  .stats b { font-size: 10px !important; margin-top: 1px; }
  .footer { font-size: 10px !important; }
  .ohlc-hud { font-size: 11px !important; padding: 4px 5px; gap: 5px; }
}
