/* Panel styles.
   Scale: type 12/14/16/20/24, spacing 4/8/12/16/24/32.
   Shape: cards 16 (padding 12); buttons and inputs 8; chips and segmented controls pill (999);
   a block nested inside a 12px padded card takes the inner radius 4 (16 minus 12). Nothing else.
   Flat backgrounds, no gradients, no italics, motion on transform and opacity only.
   Tap targets are at least 44px: the visual size stays, the hit area grows with a pseudo element. */
:root {
  --accent: #7000FF;
  --pos: #1E9E5A;
  --neg: #D93025;
  --warn: #C77700;
  --bg: #F4F4F6;
  --card: #FFFFFF;
  --text: #111114;
  --hint: #6B6B76;
  --line: #E4E4EA;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Manrope", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}
/* Dark tokens, used when Telegram's theme gives no colours (the client's scheme picks them). */
:root[data-scheme="dark"] {
  --bg: #181818;
  --card: #1F1F1F;
  --text: #F2F2F4;
  --hint: #9A9AA5;
  --line: #313131;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text); font: 500 14px/20px var(--font);
  font-style: normal; min-height: var(--tg-viewport-stable-height, 100vh);
  font-variant-numeric: tabular-nums; padding-left: var(--safe-left); padding-right: var(--safe-right);
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: 8px; top: -48px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { top: 8px; }

.shell { display: block; }
.main { padding: calc(16px + var(--safe-top)) 16px calc(96px + var(--safe-bottom)); max-width: 1100px; margin: 0 auto; outline: none; }

/* Navigation: bottom bar on phones */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex;
  background: var(--card); border-top: 1px solid var(--line); padding: 4px 8px calc(4px + var(--safe-bottom));
}
.nav .brand { display: none; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px;
  background: none; border: 0; color: var(--hint); font-size: 12px; line-height: 16px; font-weight: 600;
  border-radius: 8px; transition: transform 500ms var(--ease), opacity 300ms var(--ease);
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab:active { transform: scale(0.98); }
.tab:hover { opacity: 0.8; }

/* Header */
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head h1 { font-size: 20px; line-height: 28px; font-weight: 700; text-wrap: balance; }
.head .sub { color: var(--hint); font-size: 12px; line-height: 16px; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button {
  border: 0; background: none; padding: 4px 12px; border-radius: 999px; font-size: 14px; line-height: 20px; font-weight: 600;
  color: var(--hint); transition: transform 500ms var(--ease), opacity 300ms var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.seg button:active { transform: scale(0.98); }
.seg button:hover { opacity: 0.8; }

/* Cards */
.card { background: var(--card); border-radius: 16px; padding: 12px; border: 1px solid var(--line); }
.card h2 { font-size: 16px; line-height: 24px; font-weight: 700; margin-bottom: 8px; text-wrap: balance; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.tile .label { color: var(--hint); font-size: 12px; line-height: 16px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.tile .value { font: 500 20px/28px var(--mono); margin-top: 4px; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.tile .unit { font: 600 12px/16px var(--font); color: var(--hint); margin-left: 4px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font: 500 12px/16px var(--mono); margin-top: 4px; }
.delta svg { width: 12px; height: 12px; }
.delta.up { color: var(--pos); }
.delta.down { color: var(--neg); }
.delta.flat, .delta.none { color: var(--hint); }
.note { color: var(--warn); font-size: 12px; line-height: 16px; margin-top: 4px; text-wrap: pretty; }
.hintline { color: var(--hint); font-size: 12px; line-height: 16px; margin-top: 4px; text-wrap: pretty; }

.sections { display: grid; gap: 12px; }
.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.chart-tools h2 { margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--hint); font-size: 12px; line-height: 16px; margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 4px; border-radius: 999px; background: var(--accent); margin-right: 4px; vertical-align: middle; }
.legend svg { width: 12px; height: 12px; margin-right: 4px; vertical-align: middle; color: var(--hint); }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); border-radius: 8px; padding: 4px 8px; font-size: 12px; line-height: 16px; white-space: nowrap; opacity: 0; transition: opacity 200ms var(--ease); z-index: 2; }
.tip.on { opacity: 1; }

.adv { display: grid; gap: 12px; }
.adv .item { border: 1px solid var(--line); border-radius: 4px; padding: 12px; display: grid; gap: 8px; }
.adv .item strong { font-size: 14px; line-height: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.adv .item strong svg { width: 16px; height: 16px; color: var(--warn); flex: none; }
.adv .item p { color: var(--text); font-size: 14px; line-height: 20px; white-space: pre-line; text-wrap: pretty; }
.btn {
  justify-self: start; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 12px;
  font-size: 14px; line-height: 20px; font-weight: 600; transition: transform 500ms var(--ease), opacity 300ms var(--ease);
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }

.events { list-style: none; padding: 0; display: grid; gap: 12px; }
.events li { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; }
.events time { font: 500 12px/20px var(--mono); color: var(--hint); }
.events span { font-size: 14px; line-height: 20px; text-wrap: pretty; overflow-wrap: anywhere; }

/* Empty and error states */
.empty { text-align: center; padding: 32px 16px; display: grid; gap: 8px; justify-items: center; color: var(--hint); }
.empty svg { width: 32px; height: 32px; color: var(--hint); }
.empty h2 { color: var(--text); margin: 0; }
.empty p { max-width: 360px; text-wrap: pretty; }
.empty.error svg { color: var(--neg); }
.inline-empty { color: var(--hint); font-size: 14px; line-height: 20px; padding: 8px 0; text-wrap: pretty; }

/* Skeletons shaped like the layout */
.sk { background: var(--line); border-radius: 4px; animation: pulse 1.4s var(--ease) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.sk.t1 { height: 12px; width: 60%; }
.sk.t2 { height: 28px; width: 80%; margin-top: 8px; }
.sk.t3 { height: 12px; width: 40%; margin-top: 8px; }
.sk.chart { height: 200px; width: 100%; }
.sk.row { height: 20px; width: 100%; margin-top: 8px; }

.enter { animation: rise 600ms var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Tablet and desktop: sidebar, four tiles, two columns */
@media (min-width: 768px) {
  .shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
  .nav {
    position: sticky; top: 0; height: 100vh; flex-direction: column; gap: 4px; padding: 24px 12px;
    border-top: 0; border-right: 1px solid var(--line); align-self: start;
  }
  .nav .brand { display: block; font-size: 16px; line-height: 24px; font-weight: 700; padding: 0 12px 16px; }
  .tab { flex: none; flex-direction: row; gap: 12px; padding: 8px 12px; font-size: 14px; line-height: 20px; }
  .tab svg { width: 20px; height: 20px; }
  .tab[aria-current="page"] { background: var(--bg); }
  .main { padding: 24px 32px 32px; width: 100%; }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sections.two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
  .head h1 { font-size: 24px; line-height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: opacity 200ms linear !important; animation-duration: 1ms !important; }
  .enter { animation: none; }
  .tab:active, .btn:active, .seg button:active { transform: none; }
}

/* ---- Products, product card, supply, prices ---- */
.stack { display: grid; gap: 8px; align-content: start; }
.mono { font-family: var(--mono); font-weight: 500; }
.neg { color: var(--neg); }
.pos { color: var(--pos); }
.warn { color: var(--warn); }
.warnc { color: var(--warn); }
.muted { color: var(--hint); }
.pad { padding: 0 4px; margin-top: 12px; }
.subhead { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.subtitle { min-width: 0; }
.subtitle h1 { font-size: 16px; line-height: 24px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subtitle .sub { color: var(--hint); font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
.iconbtn {
  flex: none; width: 40px; height: 40px; border-radius: 8px; background: var(--card); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; transition: transform 500ms var(--ease), opacity 300ms var(--ease);
}
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn:active { transform: scale(0.98); }
.iconbtn:hover { opacity: 0.8; }
.metaline { color: var(--hint); font-size: 12px; line-height: 16px; margin-bottom: 12px; }
.metaline a { color: var(--accent); text-decoration: none; font-weight: 600; }

.search {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 8px; color: var(--hint);
}
.search svg { width: 20px; height: 20px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: 500 16px/24px var(--font); }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0; margin: -6px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px;
  font-size: 12px; line-height: 16px; font-weight: 600; color: var(--hint);
  transition: transform 500ms var(--ease), opacity 300ms var(--ease);
}
.chip.low { color: var(--warn); }
.chip.out { color: var(--neg); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--card); border-color: var(--text); }
.chip:active { transform: scale(0.98); }
.chip:hover { opacity: 0.8; }

.rowcard {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; text-align: left;
  color: inherit; transition: transform 500ms var(--ease), opacity 300ms var(--ease);
}
.rowcard.prod, .listhead { grid-template-columns: minmax(0, 1fr) 48px 48px 64px; }
.rowcard:active { transform: scale(0.98); }
.rowcard:hover { opacity: 0.9; }
.rowcard .mono { text-align: right; }
.rc-main { min-width: 0; }
.rc-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-sub { font-size: 12px; line-height: 16px; color: var(--hint); text-wrap: pretty; }
.rc-go { color: var(--hint); display: flex; }
.rc-go svg { width: 16px; height: 16px; }
.listhead { display: grid; gap: 8px; padding: 0 12px 8px; font-size: 12px; line-height: 16px; color: var(--hint); font-weight: 600; }
.listhead span:not(:first-child) { text-align: right; }
.ptable { display: none; width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.ptable th { padding: 8px 12px; font-size: 12px; line-height: 16px; color: var(--hint); font-weight: 600; border-bottom: 1px solid var(--line); text-align: left; }
.ptable th.r, .ptable td.r { text-align: right; }
.ptable th button { background: none; border: 0; padding: 0; font: inherit; color: inherit; font-weight: 600; }
.ptable th button:hover { color: var(--text); }
.ptable td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ptable tr:last-child td { border-bottom: 0; }
.ptable tbody tr { cursor: pointer; }
.ptable tbody tr:hover { background: var(--bg); }
.ptable td.l { max-width: 0; width: 60%; }

.tiles3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.tiles3 .tile .value { font-size: 20px; }
.chart-wrap .tip { top: 0; }
.legend i.g { background: var(--pos); }
.legend i.w { background: var(--warn); }
.trow { display: grid; grid-template-columns: minmax(0, 1fr) 80px 80px; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.trow.head { border-top: 0; color: var(--hint); font-size: 12px; line-height: 16px; font-weight: 600; padding-top: 0; }
.trow.v { grid-template-columns: minmax(0, 1fr) 80px 56px; }
.trow .r { text-align: right; }
.findings { margin: 8px 0 0; padding-left: 16px; display: grid; gap: 4px; font-size: 14px; line-height: 20px; }
.rival { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.rv-main { min-width: 0; }
.rv-title { display: block; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-price { flex: none; }
.markbtns { display: flex; gap: 4px; flex: none; }
.mk {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--card);
  display: flex; align-items: center; justify-content: center; transition: transform 500ms var(--ease), opacity 300ms var(--ease);
}
.mk svg { width: 16px; height: 16px; }
.mk.y { color: var(--pos); }
.mk.n { color: var(--neg); }
.mk:active { transform: scale(0.98); }
.mk:disabled { opacity: 0.4; }
.botfoot { margin-top: 12px; display: grid; gap: 8px; justify-items: start; color: var(--hint); font-size: 12px; line-height: 16px; }

.sgroup .sline, .pline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sgroup .sline { padding: 8px 0; border-top: 1px solid var(--line); }
.ship { display: grid; text-align: right; flex: none; }
.ship .mono { font-size: 16px; line-height: 24px; }
.main > .card + .card { margin-top: 12px; }
.pline { flex-direction: column; align-items: flex-start; }
.pline p, .card p { text-wrap: pretty; }
.card .btn { margin-top: 8px; }
.plain { white-space: pre-line; }

.sheet-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); display: flex; align-items: flex-end; justify-content: center; z-index: 20; animation: fade 300ms var(--ease) both; }
.sheet { background: var(--card); border-radius: 16px 16px 0 0; padding: 16px; width: 100%; max-width: 560px; display: grid; gap: 8px; justify-items: start; animation: rise 500ms var(--ease) both; }
.sheet h2 { font-size: 16px; line-height: 24px; font-weight: 700; }
.sheet p { white-space: pre-line; text-wrap: pretty; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 768px) {
  .plist { display: none; }
  .ptable { display: table; }
  .rowcard.prod { display: none; }
  .tiles3 { gap: 12px; }
  .sheet-back { align-items: center; }
  .sheet { border-radius: 16px; }
}

/* ---- Money and market ---- */
.headtools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.iconbtn.txt { width: auto; padding: 0 12px; font-size: 14px; font-weight: 600; color: var(--accent); }
.bigvalue { font-size: 24px; line-height: 32px; margin: 4px 0 12px; overflow-wrap: anywhere; }
.bigvalue.muted { font: 500 14px/20px var(--font); }
.prow { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.prow:first-of-type { border-top: 0; }
.weeklabels { display: grid; gap: 4px; font-size: 12px; line-height: 16px; color: var(--hint); text-align: center; margin-top: 8px; }
.weeklabels b { color: var(--text); font-weight: 500; }
.weeklabels b.neg { color: var(--neg); }
.bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; margin: 4px 0 8px; }
.bar i { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: 4px; transform-origin: left; transition: transform 500ms var(--ease); }
.lsec { padding-top: 8px; display: grid; gap: 4px; }
.lsec p { font-size: 14px; line-height: 20px; text-wrap: pretty; white-space: pre-line; }
.lsec .ltitle { font-weight: 700; padding-top: 4px; }
.seg-row { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 6fr) 40px; gap: 8px; align-items: center; padding: 4px 0; font-size: 14px; line-height: 20px; }
.seg-row .bar { margin: 0; }
.seg-row .mono { text-align: right; }
.you { color: var(--accent); font-size: 12px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 12px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; padding-bottom: 0; }
.chip.plain { color: var(--text); }
.chip:disabled { opacity: 0.4; }
.txtbtn { width: auto; height: auto; padding: 4px 8px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--accent); }
.rival .txtbtn { flex: none; }
.nrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.rv-title.wrap { white-space: normal; }
.sgroup h3 { font-size: 12px; line-height: 16px; color: var(--hint); font-weight: 600; padding: 8px 0 0; text-wrap: balance; }
.stack > .card .sgroup:first-of-type h3 { padding-top: 0; }
.empty .btn { justify-self: center; }

/* Way back to the bot: muted, never accent */
.tobot { background: none; border: 0; padding: 4px 0; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--hint); text-align: left; }
.tobot:hover { opacity: 0.8; }
.tobot.wide { display: none; }
.tobot.phone { display: block; margin-top: 4px; }
@media (min-width: 768px) {
  .tobot.wide { display: block; margin-top: auto; padding: 8px 12px; font-size: 14px; line-height: 20px; }
  .tobot.phone { display: none; }
}


/* ---- Polish: icons, hit areas, numbers ---- */
.ci, .si, .gi { display: inline-flex; vertical-align: -3px; margin-right: 4px; }
.ci svg, .si svg, .gi svg { width: 16px; height: 16px; }
.si { color: var(--accent); }
.gi.neg { color: var(--neg); } .gi.warn { color: var(--warn); } .gi.muted { color: var(--hint); }
.sgroup h3 { display: flex; align-items: center; }
.sgroup h3 .gi { margin-right: 8px; }
.chip, .mk, .seg button, .ptable th button, .iconbtn, .tobot, .txtbtn, .btn, .tab { position: relative; }
.chip::after, .mk::after, .seg button::after, .ptable th button::after, .iconbtn::after, .tobot::after, .txtbtn::after, .btn::after {
  content: ""; position: absolute; left: -4px; right: -4px; top: 50%; height: max(100%, 44px); transform: translateY(-50%);
}
.mk::after { left: -2px; right: -2px; height: 44px; }
.ptable th button { min-height: 16px; }
.rowcard, .ptable tbody tr, .tab { min-height: 44px; }
.mono, .value, .bigvalue, .delta, td, .prow, .trow { font-variant-numeric: tabular-nums; }

/* ---- Partial updates ----
   A block that changes fades out (150 ms) and the new content rises 4 px while fading in (250 ms).
   A request in flight dims its block to 0.6 and draws a thin progress line at its top; there are no
   skeletons after the first load. A new screen cross-fades the main area (120 ms out, 200 ms in). */
[hidden] { display: none !important; }
[data-block] { transition: opacity 150ms var(--ease); }
[data-block].fade-out { opacity: 0; }
[data-block].fade-in { animation: blockin 250ms var(--ease) both; }
[data-block].busy { opacity: 0.6; position: relative; overflow: hidden; border-radius: 16px; }
/* A slow breathing shimmer while new content is on its way: one flat translucent band sweeping across the block. */
[data-block].busy::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; background: var(--text); opacity: 0.07;
  pointer-events: none; animation: sweep 1.2s var(--ease) infinite;
}
@keyframes blockin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.main { transition: opacity 120ms var(--ease); }
.main.fade-out { opacity: 0; }
.main.fade-in { animation: mainin 200ms var(--ease) both; }
@keyframes mainin { from { opacity: 0; } to { opacity: 1; } }
.chip { transition: transform 500ms var(--ease), opacity 300ms var(--ease), background-color 200ms var(--ease), color 200ms var(--ease), border-color 200ms var(--ease); }
.seg button { transition: transform 500ms var(--ease), opacity 300ms var(--ease), background-color 200ms var(--ease), color 200ms var(--ease); }
@media (prefers-reduced-motion: reduce) {
  [data-block].fade-in { animation-name: blockin-plain; animation-duration: 250ms !important; }
  @keyframes blockin-plain { from { opacity: 0; } to { opacity: 1; } }
  [data-block].busy::after { animation: none; display: none; }
}

/* ---- Product chart panes, loader ---- */
.legend i.h { background: var(--hint); }
.chart-wrap[tabindex] { border-radius: 8px; }
.chart-wrap svg { overflow: visible; }
.loader { display: grid; justify-items: center; gap: 16px; padding: 24px; min-height: 55vh; align-content: center; }
.loader.small { padding: 16px 0; min-height: 0; justify-items: start; }
.loader .bars { display: flex; align-items: flex-end; gap: 6px; height: 40px; }
.loader .bars i { display: block; width: 8px; height: 40px; border-radius: 4px; background: var(--accent); transform-origin: bottom; transform: scaleY(0.25); animation: bargrow 900ms var(--ease) infinite; }
.loader .bars i:nth-child(2) { animation-delay: 120ms; }
.loader .bars i:nth-child(3) { animation-delay: 240ms; }
.loader .bars i:nth-child(4) { animation-delay: 360ms; }
.loader-hint { color: var(--hint); font-size: 14px; line-height: 20px; text-align: center; min-height: 20px; }
.loader.small .loader-hint { text-align: left; }
@keyframes bargrow { 0% { transform: scaleY(0.2); } 45% { transform: scaleY(1); } 100% { transform: scaleY(0.2); } }
@media (prefers-reduced-motion: reduce) {
  .loader .bars i { animation: none !important; }
  .loader .bars i:nth-child(1) { transform: scaleY(0.4); }
  .loader .bars i:nth-child(2) { transform: scaleY(0.7); }
  .loader .bars i:nth-child(3) { transform: scaleY(0.55); }
  .loader .bars i:nth-child(4) { transform: scaleY(1); }
}

.since { color: var(--text); font-size: 14px; line-height: 20px; padding: 8px 0; text-wrap: pretty; }
.newtag { color: var(--hint); font-weight: 700; }


/* ---- Chart look: soft area, summary row, tooltip card ---- */
:root { --area-op: 0.14; }
:root[data-scheme="dark"] { --area-op: 0.22; }
.chart-wrap { position: relative; }
.chart-wrap .tip, .tip {
  position: absolute; pointer-events: none; z-index: 3; display: grid; gap: 2px; min-width: 120px; max-width: 220px;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px;
  font-size: 12px; line-height: 16px; white-space: normal; opacity: 0; transition: opacity 150ms var(--ease);
}
.tip.on { opacity: 1; }
.tip b { font-weight: 700; }
.d { font-weight: 600; font-size: 12px; line-height: 16px; }
.d.up { color: var(--pos); } .d.down { color: var(--neg); } .d.flat { color: var(--hint); }
.sumrow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0 8px; }
.sumrow .cell { display: grid; gap: 2px; min-width: 0; align-content: start; }
.sumrow .k { color: var(--hint); font-size: 12px; line-height: 16px; }
.sumrow .v { font-size: 16px; line-height: 24px; font-weight: 700; overflow-wrap: anywhere; }
.panes { display: grid; gap: 4px; border-radius: 8px; }
.flat { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 8px; font-size: 14px; line-height: 20px; }
.legend { gap: 4px 12px; }
.chart-wrap svg { max-width: 100%; }


/* ---- Fit the phone: nothing may be wider than the screen ----
   Grid tracks are minmax(0, 1fr) so a long word cannot widen a column; cards and blocks may shrink;
   text breaks anywhere; the page never scrolls sideways (a last resort, the content fits without it). */
html, body { overflow-x: hidden; overflow-x: clip; max-width: 100vw; }
.shell, .main { min-width: 0; max-width: 100%; }
.main { overflow-wrap: anywhere; }
.sections, .stack { grid-template-columns: minmax(0, 1fr); }
.sections.two { grid-template-columns: minmax(0, 1fr); }
.card, [data-block], .tile, .rival, .trow, .prow, .sline, .nrow, .item, .panes, .chart-wrap, .legend, .note, .since, .flat, .sumrow, .cell, .chart-tools { min-width: 0; max-width: 100%; }
.card, .trow span, .prow span, .sline, .rival, .item p, .findings li, .legend span, .note, .since, .sumrow .v { overflow-wrap: anywhere; }
.chart-tools { flex-wrap: wrap; }
.chart-wrap svg { max-width: 100%; height: auto; }
.trow > span, .prow > span { min-width: 0; }
.rc-main, .rv-main, .subtitle { min-width: 0; }
.findings { padding-left: 16px; }
@media (min-width: 768px) {
  .sections.two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}
