/* ============ SUPERCYCLE — IBM Plex terminal ============ */

:root {
  --bg:      #0B0E14;
  --panel:   #11151F;
  --panel-2: #171C29;
  --line:    #232A3A;
  --ink:     #E8E6E1;
  --muted:   #6B7385;
  --amber:   #F7931A;   /* phase 2 — power & grid */
  --green:   #3FB68B;   /* phase 1 — infrastructure */
  --red:     #E0564F;   /* downside */
  --blue:    #5B8DEF;   /* phase 3 — physical AI */
  --violet:  #9B7BF0;   /* accent */
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --cond: 'IBM Plex Sans Condensed', 'Arial Narrow', sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  padding: 20px clamp(14px, 3vw, 40px) 40px;
  max-width: 1240px;
  margin: 0 auto;
}

a { color: var(--green); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- header ---------- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark {
  font-family: var(--mono); font-weight: 700; font-size: 17px; color: var(--green);
  border: 1.5px solid var(--green); border-radius: 50%;
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  align-self: center;
}
.brand-name { font-family: var(--cond); font-weight: 700; font-size: 26px; letter-spacing: 0.04em; }
.brand-name em { font-style: normal; color: var(--green); }
.brand-sub { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }
.top-right { display: flex; align-items: center; gap: 10px; }
.idx-chip {
  display: flex; align-items: baseline; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 12px; font-family: var(--mono);
}
.idx-label { color: var(--green); font-weight: 700; font-size: 11px; letter-spacing: 0.06em; }
.idx-price { font-size: 17px; font-weight: 500; }
.idx-chg { font-size: 12px; color: var(--muted); }
.updated { font-family: var(--mono); font-size: 11px; color: var(--muted); margin: 6px 0 18px; }

.btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 14px; cursor: pointer;
}
.btn:hover { border-color: var(--green); color: var(--green); }
.btn-swap { text-decoration: none; }
.btn-swap:hover { text-decoration: none; }

/* ---------- panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
h2 { font-family: var(--cond); font-weight: 700; font-size: 19px; letter-spacing: 0.03em; text-transform: uppercase; }
.panel-note { font-family: var(--mono); font-size: 11px; color: var(--muted); max-width: 460px; text-align: right; }
.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 4px;
}

/* ---------- hero / ruler ---------- */
.hero { margin-bottom: 18px; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.daybox { max-width: 640px; }
.daybox h1 { font-family: var(--cond); font-weight: 700; font-size: clamp(30px, 5vw, 46px); line-height: 1.05; letter-spacing: 0.01em; text-transform: uppercase; }
.hero-line { font-size: 14px; color: var(--muted); margin-top: 8px; }
.phasebox { text-align: right; }
.phase-chip {
  display: inline-block; font-family: var(--cond); font-weight: 700; font-size: 20px;
  letter-spacing: 0.05em; color: var(--amber);
  border: 1px solid currentColor; border-radius: 6px; padding: 4px 12px;
}
.phase-chip.p1 { color: var(--green); }
.phase-chip.p2 { color: var(--amber); }
.phase-chip.p3 { color: var(--blue); }
.phase-sub { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 6px; max-width: 340px; }

.ruler-wrap { position: relative; padding-bottom: 56px; }
.ruler {
  position: relative; height: 26px; border-radius: 6px; overflow: visible;
  background: var(--panel-2);
}
.seg { position: absolute; top: 0; height: 100%; }
.seg-p1 { background: color-mix(in srgb, var(--green) 38%, var(--panel-2)); border-radius: 6px 0 0 6px; }
.seg-p2 { background: color-mix(in srgb, var(--amber) 40%, var(--panel-2)); }
.seg-p3 { background: color-mix(in srgb, var(--blue) 32%, var(--panel-2)); border-radius: 0 6px 6px 0; }
.window {
  position: absolute; top: -5px; height: 36px;
  border: 1.5px dashed var(--violet); border-radius: 5px;
}
.needle { position: absolute; top: -12px; width: 2px; height: 50px; background: var(--ink); }
.needle span {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  color: var(--ink); background: var(--bg); padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px;
}
@keyframes needlepulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.needle { animation: needlepulse 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .needle { animation: none; } }

.ticks { position: absolute; left: 0; right: 0; top: 26px; height: 56px; }
.tick { position: absolute; transform: translateX(-50%); text-align: center; }
.tick i { display: block; width: 1px; height: 8px; background: var(--muted); margin: 0 auto 4px; }
.tick span { font-family: var(--mono); font-size: 10px; line-height: 1.45; color: var(--muted); white-space: nowrap; }
.tick-end { transform: translateX(-100%); }
.tick-end i { margin-right: 0; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 4px; }
.legend span { font-family: var(--mono); font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-p1 { background: var(--green); } .sw-p2 { background: var(--amber); }
.sw-p3 { background: var(--blue); }
.sw-win { background: transparent; border: 1.5px dashed var(--violet); }

/* ---------- main grid ---------- */
.grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; }
.chart-panel { grid-column: 1; }
.model-panel { grid-column: 2; }
.watch-panel, .analysts, .pattern-panel { grid-column: 1 / -1; }
@media (max-width: 920px) {
  .grid { grid-template-columns: 1fr; }
  .chart-panel, .model-panel { grid-column: 1; }
  .phasebox { text-align: left; }
  .panel-note { text-align: left; }
  .tick span { display: none; }
}

/* ---------- chart ---------- */
.chart-box { position: relative; height: 340px; }
.chart-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.chart-foot { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.7; }

/* ---------- model ---------- */
.slider-row { margin-bottom: 15px; }
.slider-row label { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink); margin-bottom: 6px; }
.slider-row label b { font-family: var(--mono); color: var(--green); }
.slider-row input[type=range] { width: 100%; accent-color: var(--green); }
.slider-hist { font-family: var(--mono); font-size: 10px; color: var(--muted); }

.targets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.target { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.target-low  { border-left: 3px solid var(--red); }
.target-high { border-left: 3px solid var(--green); }
.t-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); display: block; }
.t-price { font-family: var(--mono); font-weight: 700; font-size: clamp(20px, 2.6vw, 26px); display: block; margin: 4px 0 2px; }
.target-low .t-price { color: var(--red); }
.target-high .t-price { color: var(--green); }
.t-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.history { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
.history th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase; padding: 6px 8px; border-bottom: 1px solid var(--line);
}
.history td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.history tr:last-child td { border-bottom: none; }
.history td:last-child { color: var(--red); text-align: right; white-space: nowrap; }
.history .yes { color: var(--green); }

/* ---------- rotation lab ---------- */
.pattern-grid { display: grid; grid-template-columns: 1fr 1fr 1.7fr; gap: 14px; }
@media (max-width: 920px) { .pattern-grid { grid-template-columns: 1fr; } }
.pat-block { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.pat-block.alert { border-color: var(--amber); }
.pat-block.alert .t-label { color: var(--amber); }
.pat-big { font-family: var(--mono); font-weight: 700; font-size: clamp(17px, 2.1vw, 22px); margin: 6px 0 4px; line-height: 1.3; }
.pat-sub { font-family: var(--mono); font-size: 11px; color: var(--muted); line-height: 1.7; }

.rs-head, .rs-row {
  display: grid; grid-template-columns: 1.5fr repeat(4, 1fr); gap: 8px;
  align-items: center; font-family: var(--mono); font-size: 11px;
}
.rs-head { color: var(--muted); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; margin: 8px 0 4px; }
.rs-head span:not(:first-child), .rs-row span:not(:first-child) { text-align: right; }
.rs-row { padding: 6px 0; border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.rs-row .rs-name { font-weight: 700; }
.rs-row.rs-p1 .rs-name { color: var(--green); }
.rs-row.rs-p2 .rs-name { color: var(--amber); }
.rs-row.rs-p3 .rs-name { color: var(--blue); }
.rs-row .best { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 520px) {
  .rs-head, .rs-row { grid-template-columns: 1.1fr repeat(4, 1fr); gap: 4px; font-size: 10px; }
}

/* ---------- watchlist ---------- */
.phase-band {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin: 26px 0 4px; padding: 8px 12px; border-radius: 8px;
  border-left: 3px solid var(--muted); background: var(--panel-2);
}
.phase-band:first-child { margin-top: 0; }
.phase-band h3 { font-family: var(--cond); font-weight: 700; font-size: 17px; letter-spacing: 0.05em; text-transform: uppercase; }
.phase-band .pb-years { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.phase-band .pb-status { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; margin-left: auto; }
.phase-band.pb-p1 { border-left-color: var(--green); } .phase-band.pb-p1 h3, .phase-band.pb-p1 .pb-status { color: var(--green); }
.phase-band.pb-p2 { border-left-color: var(--amber); } .phase-band.pb-p2 h3, .phase-band.pb-p2 .pb-status { color: var(--amber); }
.phase-band.pb-p3 { border-left-color: var(--blue); }  .phase-band.pb-p3 h3, .phase-band.pb-p3 .pb-status { color: var(--blue); }

.group-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  margin: 16px 0 4px; flex-wrap: wrap;
}
.group-head h4 { font-family: var(--cond); font-weight: 700; font-size: 14px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink); }
.group-head .g-note { font-family: var(--mono); font-size: 10px; color: var(--muted); }

.tbl-wrap { overflow-x: auto; }
.wtable { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 13px; }
.wtable th {
  text-align: right; font-weight: 500; color: var(--muted); font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.wtable th:first-child { text-align: left; }
.wtable td { text-align: right; padding: 8px 10px; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); white-space: nowrap; }
.wtable td:first-child { text-align: left; }
.wtable tr:hover td { background: color-mix(in srgb, var(--panel-2) 70%, transparent); }
.tk b { font-weight: 700; }
.tk span { display: block; font-size: 10px; color: var(--muted); font-family: var(--sans); }
.up { color: var(--green); } .down { color: var(--red); }
.t2 { display: block; font-size: 10px; }
.beta { color: var(--muted); }
.swing { color: var(--green); font-weight: 700; }
.swing.clamped { color: var(--muted); }
td.clamped { cursor: help; }

.add-form { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.add-form input, .add-form select {
  font-family: var(--mono); font-size: 13px; background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
}
.add-form input[type=text] { width: 150px; text-transform: uppercase; }
.add-form input[type=number] { width: 80px; }

/* ---------- thesis cards ---------- */
.analysts { margin-top: 4px; }
.analysts-title { margin-bottom: 12px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 920px) { .cards { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.card-flag {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px;
}
.card h3 { font-family: var(--cond); font-size: 20px; margin: 10px 0 6px; letter-spacing: 0.03em; text-transform: uppercase; }
.card-frame { font-size: 13px; color: var(--ink); margin-bottom: 10px; }
.card-tickers { font-family: var(--mono); font-size: 11px; color: var(--muted); line-height: 1.9; margin-bottom: 10px; }
.card-read { font-family: var(--mono); font-size: 11px; }
.card.c-p1 { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.card.c-p1 h3, .card.c-p1 .card-flag, .card.c-p1 .card-read { color: var(--green); border-color: currentColor; }
.card.c-p2 h3, .card.c-p2 .card-flag, .card.c-p2 .card-read { color: var(--amber); }
.card.c-p3 h3, .card.c-p3 .card-flag, .card.c-p3 .card-read { color: var(--blue); }

/* ---------- footer ---------- */
.foot { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 16px; }
.foot p { font-size: 12px; color: var(--muted); max-width: 780px; }
.foot-src { font-family: var(--mono); font-size: 10px; margin-top: 8px; }
