:root {
  color-scheme: dark;
  --bg: #070b0d;
  --panel: #0d1417;
  --panel-2: #111a1e;
  --line: #223036;
  --line-soft: #172226;
  --text: #ecf3ef;
  --muted: #82928d;
  --lime: #c8ff58;
  --cyan: #4dd9ff;
  --amber: #ffbf69;
  --green: #48e0a4;
  --red: #ff6b78;
  --radius: 18px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 82% 4%, rgba(77, 217, 255, 0.07), transparent 28rem),
    radial-gradient(circle at 15% 14%, rgba(200, 255, 88, 0.055), transparent 25rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-width: 320px;
}

button, input { font: inherit; }
button { color: inherit; }

.shell { min-height: 100vh; }

.topbar {
  height: 76px;
  padding: 0 max(24px, calc((100vw - 1500px) / 2));
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: rgba(7, 11, 13, 0.82);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; width: max-content; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid #566d39; border-radius: 11px; color: var(--lime);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 800;
  background: linear-gradient(145deg, rgba(200,255,88,.14), rgba(200,255,88,.02));
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: -0.02em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; text-transform: uppercase; letter-spacing: .08em; }

.market-state { display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 12px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(72,224,164,.08); }
.pulse.loading { background: var(--amber); animation: pulse 1.2s infinite; }
.pulse.error { background: var(--red); }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(255,191,105,0); } }

.ghost-button { justify-self: end; background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; cursor: pointer; font-size: 12px; }
.ghost-button:hover { border-color: #43585f; background: rgba(255,255,255,.025); }

main { width: min(1500px, calc(100% - 48px)); margin: 0 auto; }
.hero { min-height: 430px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 70px; align-items: center; padding: 68px 3vw 54px; }
.eyebrow { color: var(--lime); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; letter-spacing: .16em; margin: 0 0 10px; }
.hero h1 { font-size: clamp(46px, 6vw, 88px); line-height: .94; letter-spacing: -.07em; margin: 0; max-width: 850px; }
.hero h1 span { color: #8a9994; }
.hero-copy { max-width: 650px; color: var(--muted); line-height: 1.65; font-size: 15px; margin: 28px 0 0; }

.search-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  background: linear-gradient(155deg, rgba(18,29,33,.96), rgba(10,16,18,.96)); box-shadow: var(--shadow);
}
.search-card > label { display: block; font-size: 12px; color: #b4c1bd; margin-bottom: 10px; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-row input, .settings-card input {
  min-width: 0; background: #080d0f; border: 1px solid #2d3d43; border-radius: 11px; color: var(--text);
  padding: 15px 16px; outline: none; text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.search-row input:focus, .settings-card input:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(200,255,88,.08); }
.search-row button, .primary-button {
  border: 0; border-radius: 11px; padding: 0 18px; background: var(--lime); color: #111707; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; gap: 14px; justify-content: center;
}
.search-row button:hover, .primary-button:hover { background: #d4ff7f; }
.search-row button:disabled { cursor: wait; opacity: .58; }
.quick-tickers { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.quick-tickers button { color: #a6b4af; background: #121b1e; border: 1px solid #243238; border-radius: 999px; padding: 6px 10px; cursor: pointer; font-size: 10px; }
.quick-tickers button:hover { color: var(--lime); border-color: #4a5b34; }
.search-card > p { color: #64736e; font-size: 10px; margin: 15px 0 0; }

.workspace { border-top: 1px solid var(--line-soft); padding: 34px 0 70px; }
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 4px 24px; }
.instrument-line { display: flex; align-items: center; gap: 14px; }
.instrument-line h2 { font-size: 32px; letter-spacing: -.05em; margin: 0; }
.workspace-header > div > p:last-child { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.badge { display: inline-flex; border-radius: 999px; padding: 6px 10px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.badge.neutral { color: #a8b6b1; background: #1a2427; }
.badge.bullish { color: #8bf3c6; background: rgba(72,224,164,.12); }
.badge.bearish { color: #ff9ca5; background: rgba(255,107,120,.12); }

.score-ring {
  --value: calc(var(--score) * 1%); width: 78px; height: 78px; border-radius: 50%; padding: 5px;
  background: conic-gradient(var(--lime) var(--value), #1a272b 0); transition: background .5s ease;
}
.score-ring > div { background: #0a1012; border-radius: 50%; width: 100%; height: 100%; display: grid; place-content: center; text-align: center; }
.score-ring strong { display: block; font-size: 18px; }
.score-ring span { display: block; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .12em; margin-top: 2px; }

.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); margin-bottom: 16px; }
.metric-strip article { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line); }
.metric-strip article:last-child { border: 0; }
.metric-strip span, .metric-strip small { display: block; color: var(--muted); }
.metric-strip span { font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.metric-strip strong { display: block; font-size: 20px; margin: 8px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-strip small { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(300px, .65fr); gap: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(13,20,23,.93); overflow: hidden; }
.panel-heading { min-height: 76px; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line-soft); }
.panel-heading.compact { min-height: auto; padding: 0 0 14px; }
.panel-heading h3, .decision-panel h3 { font-size: 16px; margin: 0; letter-spacing: -.025em; }
.legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; color: var(--muted); font-size: 9px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend-line { width: 14px; height: 2px; display: inline-block; }
.legend-line.cyan { background: var(--cyan); }
.legend-line.amber { background: var(--amber); }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.legend-dot.green { background: var(--green); }
.legend-dot.red { background: var(--red); }
.chart-panel { min-height: 720px; position: relative; }
.chart { height: 545px; width: 100%; }
.chart-empty { position: absolute; inset: 76px 0 0; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 30px; }
.chart-empty.hidden { display: none; }
.empty-mark { color: var(--lime); font-size: 38px; }
.chart-empty strong { color: #b9c5c1; font-size: 14px; margin-top: 10px; }
.chart-empty p, .empty-copy { font-size: 11px; max-width: 360px; line-height: 1.5; }
.pattern-proof {
  min-height: 94px; margin: 0 16px 16px; border: 1px solid #2b3b40; border-radius: 13px;
  background: linear-gradient(120deg, rgba(77,217,255,.055), rgba(200,255,88,.025));
  padding: 14px 16px; display: grid; grid-template-columns: minmax(150px, .55fr) 1.5fr auto; gap: 18px; align-items: center;
}
.pattern-proof[hidden] { display: none; }
.pattern-proof strong { display: block; font-size: 13px; margin-top: 6px; text-transform: capitalize; }
.proof-label, .pattern-proof > span { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .1em; }
.pattern-proof p { color: #aebdb8; font-size: 10px; line-height: 1.5; margin: 0; }
.pattern-proof > span { color: var(--cyan); white-space: nowrap; }

.side-stack { display: grid; gap: 16px; align-content: start; }
.decision-panel, .context-panel { padding: 22px; }
.decision-panel { background: linear-gradient(160deg, rgba(20,32,35,.98), rgba(11,17,19,.98)); }
.decision-panel h3 { font-size: 25px; margin: 4px 0 12px; }
.decision-panel > p:nth-of-type(2) { color: #9daca7; font-size: 12px; line-height: 1.65; margin: 0; }
.action-chip { display: inline-flex; margin: 5px 0 10px; border-radius: 7px; padding: 6px 9px; font: 800 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .1em; }
.action-chip.wait { color: #ffe0aa; background: rgba(255,191,105,.12); border: 1px solid rgba(255,191,105,.28); }
.action-chip.buy { color: #8bf3c6; background: rgba(72,224,164,.12); border: 1px solid rgba(72,224,164,.3); }
.action-chip.sell { color: #ffadb5; background: rgba(255,107,120,.12); border: 1px solid rgba(255,107,120,.3); }
.action-checklist { display: grid; gap: 7px; margin: 17px 0 0; counter-reset: action-step; }
.action-step { counter-increment: action-step; position: relative; padding: 9px 10px 9px 34px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(5,9,10,.35); color: #aebbb7; font-size: 9px; line-height: 1.45; }
.action-step::before { content: counter(action-step); position: absolute; left: 10px; top: 8px; width: 15px; height: 15px; display: grid; place-items: center; border-radius: 50%; background: #202d31; color: var(--lime); font-size: 8px; }
.decision-levels { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 20px; }
.decision-levels div { border: 1px solid var(--line); border-radius: 11px; padding: 12px; background: #0a1012; }
.decision-levels span, .decision-levels strong { display: block; }
.decision-levels span { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .1em; }
.decision-levels strong { font-size: 14px; margin-top: 7px; }
.blockers { display: grid; gap: 7px; margin-top: 14px; }
.blocker { border-left: 2px solid var(--amber); background: rgba(255,191,105,.06); color: #c8b899; padding: 8px 10px; font-size: 9px; line-height: 1.4; }
.brief-details { margin-top: 15px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.brief-details summary { color: var(--muted); cursor: pointer; font-size: 9px; }
.brief-details p { color: #8f9e99; font-size: 9px; line-height: 1.55; margin: 10px 0 0; }

.context-list { display: grid; gap: 0; margin: 0; }
.context-list div { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.context-list dt { color: var(--muted); font-size: 9px; }
.context-list dd { color: #bdc8c4; font-size: 10px; margin: 0; text-align: right; line-height: 1.4; }
.pattern-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.pattern { border: 1px solid #2e3d42; border-radius: 999px; padding: 5px 8px; font-size: 8px; color: #aab8b3; }
.pattern.bullish { color: var(--green); border-color: rgba(72,224,164,.32); }
.pattern.bearish { color: var(--red); border-color: rgba(255,107,120,.32); }
.pattern { cursor: default; }
.pattern-detail-list { display: grid; gap: 8px; margin-top: 12px; }
.pattern-detail { border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px; background: rgba(5,9,10,.3); }
.pattern-detail header { display: flex; justify-content: space-between; gap: 8px; color: #becbc7; font-size: 9px; text-transform: capitalize; }
.pattern-detail header span { color: var(--cyan); font: 8px ui-monospace, SFMono-Regular, Menlo, monospace; }
.pattern-detail p { color: var(--muted); font-size: 8px; line-height: 1.5; margin: 7px 0 0; }

.evidence-panel { margin-top: 16px; }
.text-button, .close-button { background: none; border: 0; color: var(--muted); cursor: pointer; }
.text-button { font-size: 10px; text-decoration: underline; text-underline-offset: 4px; }
.evidence-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.evidence-item { min-height: 115px; padding: 18px; border-right: 1px solid var(--line-soft); }
.evidence-item:last-child { border: 0; }
.evidence-item span { color: var(--lime); font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }
.evidence-item strong { display: block; font-size: 12px; margin: 9px 0; }
.evidence-item p { color: var(--muted); font-size: 9px; line-height: 1.45; margin: 0; }
.evidence-grid > .empty-copy { padding: 18px; }
pre { margin: 0; padding: 20px; max-height: 480px; overflow: auto; border-top: 1px solid var(--line-soft); background: #070b0d; color: #b9d0c6; font: 10px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }

footer { width: min(1500px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0 40px; border-top: 1px solid var(--line-soft); color: #52615c; display: flex; justify-content: space-between; font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }

dialog { width: min(460px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: var(--radius); padding: 0; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.settings-card { padding: 22px; display: grid; gap: 13px; }
.settings-card .panel-heading { padding: 0 0 12px; }
.settings-card label { font-size: 11px; }
.settings-card > p { color: var(--muted); font-size: 10px; line-height: 1.5; margin: 0; }
.settings-card .primary-button { min-height: 43px; margin-top: 4px; }
.close-button { font-size: 26px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #182326; border: 1px solid #34474e; border-radius: 10px; padding: 11px 16px; font-size: 11px; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255,107,120,.5); color: #ffb4bb; }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding-top: 52px; }
  .content-grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: 1fr 1fr; }
  .chart-panel { min-height: 700px; }
  .chart { height: 520px; }
}

@media (max-width: 720px) {
  .topbar { height: 66px; padding: 0 16px; grid-template-columns: 1fr auto; }
  .market-state { display: none; }
  main, footer { width: min(100% - 24px, 1500px); }
  .hero { min-height: auto; padding: 44px 0 36px; }
  .hero h1 { font-size: clamp(43px, 15vw, 66px); }
  .hero-copy { font-size: 13px; }
  .search-card { padding: 16px; }
  .search-row { grid-template-columns: 1fr; }
  .search-row button { min-height: 48px; }
  .workspace-header { align-items: flex-start; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric-strip article:nth-child(2) { border-right: 0; }
  .metric-strip article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .side-stack { grid-template-columns: 1fr; }
  .chart-panel { min-height: 680px; }
  .chart { height: 465px; }
  .pattern-proof { grid-template-columns: 1fr; gap: 8px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .legend { justify-content: flex-start; }
  .evidence-grid { grid-template-columns: 1fr 1fr; }
  .evidence-item:nth-child(2) { border-right: 0; }
  .evidence-item:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  footer { gap: 20px; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
