/* Coin charts. On a phone the list and the chart are two screens; the URL hash says which coin is open. */
:root {
  /* HLO's colours (hlotrade.xyz): teal on blue-black, Geist for words, Geist Mono for numbers. */
  --bg: #0E1219;
  --card: #1A202B;
  --card2: #232A37;
  --pill: #3F4858;
  --seg: #0F131B;
  --line: #2A3240;
  --line2: #364051;
  --text: #F3F6F9;
  --muted: #A7B1C2;
  --dim: #939EB0;
  --brand: #2AD4CD;
  --brand-ink: #03201E;
  --brand-soft: rgba(42, 212, 205, 0.14);
  --ring: linear-gradient(120deg, #0ABAB5, #3FE6DF);
  --green: #3FE3A0;
  --red: #FF6B86;
  --amber: #F5C451;
  --amber-soft: rgba(245, 196, 81, 0.13);
  --red-soft: rgba(255, 107, 134, 0.13);
  --display: 'Geist', system-ui, sans-serif;
  --sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { display: flex; background: var(--bg); color: var(--text); font: 14.5px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.quiet { color: var(--dim); font-size: 12.5px; }

/* --- coin list ---------------------------------------------------------------------------------------- */
#coins { width: 268px; flex: none; height: 100dvh; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--card); }
#coins header { padding: 16px 14px 12px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
#coins h1 { margin: 0; display: flex; align-items: center; gap: 8px; font: 700 18px/1.2 var(--display); letter-spacing: -.02em; }
#coins h1 svg { flex: none; display: block; }
#coins h1 span { background: linear-gradient(120deg, #3FE6DF, #D9FFFD); -webkit-background-clip: text; background-clip: text; color: transparent; } /* HLO's name style */
#search { width: 100%; padding: 9px 14px; border-radius: 999px; border: 1px solid transparent; background: var(--seg); color: var(--text); font: inherit; }
#search:focus { outline: 2px solid var(--brand); outline-offset: -2px; }
#list { flex: 1; overflow-y: auto; padding: 6px; }
#list p { margin: 12px 8px; }
.row { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 0 10px; align-items: baseline; padding: 8px 10px; border: 0; border-radius: 10px; background: none; text-align: left; text-decoration: none; }
.row:hover { background: var(--card2); }
.row.on { background: var(--brand-soft); box-shadow: inset 0 0 0 1px #2AD4CD55; }
.row b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.row .px { font: 12.5px var(--mono); }
.row .vol { color: var(--dim); font-size: 12px; }
.row .chg { font: 12px var(--mono); text-align: right; }
.up { color: var(--green); }
.down { color: var(--red); }
#coins footer { padding: 10px 14px; border-top: 1px solid var(--line); }

/* --- chart --------------------------------------------------------------------------------------------- */
#view { flex: 1; min-width: 0; height: 100dvh; overflow-y: auto; padding: 14px 18px 24px; display: flex; flex-direction: column; gap: 10px; }
#head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.to-list { display: none; }
#coin { margin: 0; font: 600 22px/1.2 var(--display); letter-spacing: -.02em; }
#price { font: 500 16px var(--mono); }
#price small { font-size: 13px; margin-left: 6px; }
#trade-link { align-self: center; padding: 6px 14px; border-radius: 999px; background: var(--ring); color: var(--brand-ink); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
#trade-link:hover { filter: brightness(1.08); }
.controls { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--seg); }
.seg button, #log { border: 0; background: none; padding: 6px 11px; min-height: 32px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button:hover, #log:hover { color: var(--text); }
#log { background: var(--seg); }
.seg button.on, #log[aria-pressed='true'] { background: var(--pill); color: var(--text); }
#story { margin: 0; font-size: 14px; color: var(--text); }
#structure { margin: -6px 0 0; font-size: 13px; color: var(--muted); }
#structure:empty { display: none; }
#odds { margin: -6px 0 0; font-size: 13px; color: var(--muted); }
#odds[hidden] { display: none; }
#where { display: grid; gap: 3px; }
#where[hidden] { display: none; }
#meter { position: relative; display: flex; gap: 2px; height: 8px; }
#meter span { border-radius: 2px; opacity: .85; }
#marker { position: absolute; top: -4px; width: 4px; height: 16px; margin-left: -2px; border-radius: 2px; background: var(--text); box-shadow: 0 0 0 2px var(--bg); }
.ends { display: flex; justify-content: space-between; color: var(--dim); font-size: 11.5px; }
#now { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
#now b { color: var(--brand); }
#warn { padding: 8px 12px; border-radius: 10px; font-size: 13.5px; border: 1px solid; }
#warn.low { border-color: #FF6B8666; background: var(--red-soft); }
#warn.partial { border-color: #F5C45155; background: var(--amber-soft); }
#scenario { align-self: flex-start; }
#scenario[hidden] { display: none; }
#stage { position: relative; flex: 1 0 auto; height: min(72vh, 760px); min-height: 420px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--card); }
#chart { position: absolute; inset: 0; }
#readout { position: absolute; top: 8px; left: 10px; z-index: 3; pointer-events: none; font: 12px var(--mono); color: var(--muted); background: #1A202Bb8; padding: 2px 6px; border-radius: 6px; }
#readout:empty { display: none; }
#status { position: absolute; inset: 0; z-index: 4; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; text-align: center; color: var(--muted); background: #1A202Be0; }
#status[hidden] { display: none; }
#status button { padding: 8px 18px; border-radius: 999px; border: 0; background: var(--ring); color: var(--brand-ink); font-weight: 600; }
#legend { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }
#legend button { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line2); background: var(--card); color: var(--muted); white-space: nowrap; }
#legend button[aria-pressed='false'] { opacity: .5; border-style: dashed; }
#legend button[aria-pressed='false'] em { display: none; }
#legend i { width: 14px; height: 3px; border-radius: 2px; pointer-events: none; }
#legend i.text { width: auto; height: auto; background: none; font: 600 10px var(--sans); font-style: normal; color: #8fdcb0; }
#legend i.dash { background: repeating-linear-gradient(90deg, #c8ccd4 0 4px, transparent 4px 7px); }
#legend em { font: 12px var(--mono); font-style: normal; color: var(--text); pointer-events: none; }

#tabs { display: flex; gap: 14px; margin-top: 4px; }
#tabs button { flex: 1; max-width: 220px; border: 0; border-top: 2px solid var(--line2); background: none; padding: 10px 2px 2px; text-align: left; font: 600 12.5px var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
#tabs button:hover { color: var(--text); }
#tabs button[aria-selected='true'] { border-top-color: var(--brand); color: var(--brand); }
#tabs span { font-family: var(--mono); margin-right: 8px; }
#below { display: grid; gap: 14px; align-items: start; }
#below > * { padding: 14px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); min-width: 0; }
#below > [hidden] { display: none; }
#levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; margin: 10px 0 0; }
#levels div { display: grid; gap: 1px; padding: 8px 10px; border-radius: 9px; background: var(--card2); }
#levels span { color: var(--dim); font-size: 11.5px; }
#levels b { font: 500 13.5px var(--mono); }
#plan { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.case { display: grid; gap: 4px; align-content: start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card2); text-align: left; }
.case[aria-pressed='true'] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.case b { font-weight: 600; }
.case span { color: var(--muted); font-size: 13.5px; }
.case small { color: var(--dim); font-size: 12.5px; }
#plan > p { grid-column: 1 / -1; margin: 0; color: var(--muted); }
#below h3 { margin: 0; font: 600 13px/1.3 var(--display); }
.zhead, .zrow { display: grid; grid-template-columns: minmax(0, 1fr) 52px 52px 58px; gap: 0 4px; align-items: center; }
.zhead .after { grid-column: 2 / 5; text-align: right; }
.zhead .after small { display: block; color: var(--dim); font-size: 11.5px; margin-bottom: 4px; white-space: nowrap; }
.zhead .after div { display: grid; grid-template-columns: 52px 52px 58px; gap: 4px; color: var(--dim); font-size: 11.5px; white-space: nowrap; }
.zhead { padding-bottom: 8px; }
.zrow { padding: 8px 6px; margin: 0 -6px; border-top: 1px solid var(--line); }
.zrow.on { background: var(--brand-soft); border-radius: 8px; border-top-color: transparent; }
.zrow.on + .zrow { border-top-color: transparent; }
.zrow i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; }
.zrow b { font-weight: 600; }
.zrow em { margin-left: 7px; font: 700 10.5px var(--sans); font-style: normal; color: var(--brand-ink); background: var(--brand); padding: 1px 5px; border-radius: 5px; vertical-align: 1px; }
.zrow small { display: block; margin: 1px 0 0 16px; color: var(--dim); font: 11.5px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zrow .wks { margin-left: 7px; color: var(--dim); font-size: 11.5px; white-space: nowrap; }
.zrow .n { font: 13px var(--mono); text-align: right; }
.note { margin: 10px 0 0; }
.note.strong { font-size: 13.5px; color: var(--text); }
#how summary { cursor: pointer; font: 600 13px/1.3 var(--display); }
#how p { margin: 10px 0 0; color: var(--muted); font-size: 13.5px; }
#how p b { color: var(--text); }
#how p.quiet { color: var(--dim); font-size: 12.5px; }

@media (max-width: 860px) {
  #coins { width: 100%; }
  #view { display: none; padding: 10px 12px calc(20px + env(safe-area-inset-bottom)); }
  body.open #coins { display: none; }
  body.open #view { display: flex; }
  .row { padding: 11px 10px; }
  .to-list { display: inline; color: var(--muted); text-decoration: none; font-size: 13.5px; flex-basis: 100%; }
  #coin { font-size: 19px; }
  .controls { margin-left: auto; }
  #stage { height: 60dvh; min-height: 380px; }
  #plan { grid-template-columns: 1fr; }
}
