/* ==========================================================================
   google-news-13  |  "Quotewire" finance / market-dashboard theme
   Scrolling market ticker, dense stat tiles, a leaderboard, and a card feed.
   Finance green (#16a34a), red-up / green-down accents, mono figures.
   Original, dependency-free, responsive, light + dark.
   (Deliberately distinct layout/naming/vars from 01-12.)
   ========================================================================== */

:root {
  --sheet: #f4f6f5;
  --panel: #ffffff;
  --edge: #e2e6e3;
  --text: #14181a;
  --muted: #5a635f;
  --ghost: #8b938e;
  --bull: #16a34a;
  --bull-2: #12803e;
  --bear: #dc2626;
  --wash: #e8f5ee;
  --maxw: 1200px;
  --readw: 720px;
  --type-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Arial, sans-serif;
  --type-mono: "SFMono-Regular", ui-monospace, "Cascadia Code", "Consolas", Menlo, monospace;
}
html[data-fin="dark"] {
  --sheet: #0d1211;
  --panel: #141a18;
  --edge: #253029;
  --text: #e6ece9;
  --muted: #9fa9a4;
  --ghost: #6b746f;
  --bull: #4ade80;
  --bull-2: #86efac;
  --bear: #f87171;
  --wash: #12251a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--sheet); color: var(--text); font-family: var(--type-sans); font-size: 16px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--bull); text-decoration: none; }
a:hover { color: var(--bull-2); }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
.frame { max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--type-mono); font-variant-numeric: tabular-nums; }

/* ---------- Desk bar (masthead) ---------- */
.deskbar { background: var(--panel); border-bottom: 1px solid var(--edge); }
.deskbar__inner { display: flex; align-items: center; gap: 14px; padding: 13px 0; }
.deskbar__mark { display: inline-flex; align-items: center; gap: 9px; font-size: 21px; font-weight: 800; letter-spacing: .3px; color: var(--text); }
.deskbar__badge { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--bull); color: #fff; font-size: 15px; font-weight: 900; font-family: var(--type-mono); }
html[data-fin="dark"] .deskbar__badge { color: #06210f; }
.deskbar__meta { margin-left: auto; font-family: var(--type-mono); font-size: 12.5px; color: var(--ghost); letter-spacing: .5px; }
.desktools { display: flex; gap: 7px; }
.desktool { width: 36px; height: 36px; border: 1px solid var(--edge); background: var(--panel); border-radius: 8px; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; display: grid; place-items: center; }
.desktool:hover { color: var(--bull); border-color: var(--bull); }

/* ---------- Board nav ---------- */
.boardnav { background: var(--panel); border-bottom: 1px solid var(--edge); }
.boardnav__inner { display: flex; align-items: center; }
.boardnav__list { display: flex; flex-wrap: wrap; }
.boardnav__list a { display: block; padding: 11px 15px; font-size: 14.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.boardnav__list a:hover, .boardnav__list .live a { color: var(--bull); border-bottom-color: var(--bull); }
.boardnav__toggle { display: none; }

.seekline { display: none; border-bottom: 1px solid var(--edge); background: var(--panel); }
.seekline.open { display: block; }
.seekline form { display: flex; gap: 8px; padding: 11px 0; }
.seekline input { flex: 1; min-width: 0; border: 1px solid var(--edge); background: var(--sheet); color: var(--text); border-radius: 8px; padding: 9px 13px; font-size: 15px; }
.seekline button { border: 0; background: var(--bull); color: #fff; border-radius: 8px; padding: 9px 20px; font-weight: 700; cursor: pointer; }

/* ---------- Ticker tape (scrolling market strip) ---------- */
.tickertape { background: var(--text); color: #fff; overflow: hidden; border-bottom: 1px solid var(--edge); }
html[data-fin="dark"] .tickertape { background: #05100b; }
.tickertape__track { display: inline-flex; white-space: nowrap; padding: 8px 0; animation: tape-slide 44s linear infinite; will-change: transform; }
.tickertape:hover .tickertape__track { animation-play-state: paused; }
.quotechip { display: inline-flex; align-items: baseline; gap: 8px; padding: 0 18px; border-right: 1px solid rgba(255,255,255,.14); font-size: 13px; }
.quotechip__sym { font-weight: 700; letter-spacing: .4px; color: #d7ded9; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quotechip__px { font-family: var(--type-mono); color: #fff; }
.quotechip__mv { font-family: var(--type-mono); font-size: 12px; }
.quotechip:nth-child(odd) .quotechip__mv { color: #4ade80; }
.quotechip:nth-child(odd) .quotechip__mv::before { content: "\25B2 "; }
.quotechip:nth-child(even) .quotechip__mv { color: #f87171; }
.quotechip:nth-child(even) .quotechip__mv::before { content: "\25BC "; }
@keyframes tape-slide { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .tickertape__track { animation: none; } }

/* ---------- Panel (section shell) ---------- */
.panel { margin: 26px 0; }
.panel__cap { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel__name { font-size: 19px; font-weight: 800; color: var(--text); position: relative; padding-left: 13px; }
.panel__name::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px; border-radius: 2px; background: var(--bull); }
.panel__note { margin-left: auto; font-family: var(--type-mono); font-size: 12px; color: var(--ghost); letter-spacing: .6px; text-transform: uppercase; }

/* ---------- Stat tiles ---------- */
.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.statcell { min-width: 0; background: var(--panel); border: 1px solid var(--edge); border-left: 4px solid var(--bull); border-radius: 10px; padding: 15px 16px; }
.statcell__fig { font-family: var(--type-mono); font-variant-numeric: tabular-nums; font-size: 27px; font-weight: 700; color: var(--text); line-height: 1.1; overflow-wrap: anywhere; }
.statcell__tag { font-size: 13px; color: var(--muted); margin-top: 5px; }
.statcell__mv { font-family: var(--type-mono); font-size: 12.5px; margin-top: 8px; }
.statcell:nth-child(odd) .statcell__mv { color: var(--bull); }
.statcell:nth-child(odd) .statcell__mv::before { content: "\25B2 "; }
.statcell:nth-child(even) { border-left-color: var(--bear); }
.statcell:nth-child(even) .statcell__mv { color: var(--bear); }
.statcell:nth-child(even) .statcell__mv::before { content: "\25BC "; }

/* ---------- Board grid (main feed + side leaderboard) ---------- */
.board { display: grid; grid-template-columns: 1fr 336px; gap: 26px; align-items: start; }
.board__main { min-width: 0; }
.board__side { min-width: 0; }

/* ---------- Dispatch cards (feed) ---------- */
.feed { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.dispatch { min-width: 0; background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.dispatch:hover { border-color: var(--bull); }
.dispatch__shot { position: relative; overflow: hidden; background: var(--edge); }
.dispatch__shot::before { content: ""; display: block; padding-top: 58%; }
.dispatch__shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.dispatch:hover .dispatch__shot img { transform: scale(1.05); }
.dispatch__text { min-width: 0; padding: 14px 15px 16px; display: flex; flex-direction: column; }
.dispatch__tag { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--bull); background: var(--wash); padding: 3px 8px; border-radius: 5px; }
.dispatch__head { font-size: 16.5px; font-weight: 700; line-height: 1.4; margin: 10px 0 0; overflow-wrap: break-word; }
.dispatch__head a { color: var(--text); }
.dispatch__head a:hover { color: var(--bull); }
.dispatch__sum { color: var(--muted); font-size: 13.5px; margin: 8px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dispatch__foot { margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--edge); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-family: var(--type-mono); font-size: 12px; color: var(--ghost); }

/* ---------- Rank board (leaderboard) ---------- */
.rankcard { background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; padding: 6px 15px 10px; }
.board__side .rankcard { position: sticky; top: 14px; }
.rankboard { counter-reset: rk; }
.rankrow { counter-increment: rk; display: grid; grid-template-columns: 26px 1fr auto; gap: 11px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--edge); }
.rankrow:last-child { border-bottom: 0; }
.rankrow::before { content: counter(rk); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--sheet); color: var(--muted); font-family: var(--type-mono); font-size: 12.5px; font-weight: 700; }
.rankrow:nth-child(-n+3)::before { background: var(--bull); color: #fff; }
html[data-fin="dark"] .rankrow:nth-child(-n+3)::before { color: #06210f; }
.rankrow__box { min-width: 0; }
.rankrow__head { display: block; font-size: 14.5px; font-weight: 600; color: var(--text); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rankrow__head:hover { color: var(--bull); }
.rankrow__time { font-family: var(--type-mono); font-size: 11.5px; color: var(--ghost); margin-top: 3px; }
.rankrow__heat { font-family: var(--type-mono); font-size: 12.5px; color: var(--bull); white-space: nowrap; }

/* ---------- Wire (dense list rows: list page + more-news) ---------- */
.wire { background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; overflow: hidden; }
.wire__row { display: grid; grid-template-columns: 120px 1fr auto; gap: 16px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--edge); }
.wire__row:last-child { border-bottom: 0; }
.wire__row:hover { background: var(--wash); }
.wire__time { font-family: var(--type-mono); font-size: 12.5px; color: var(--ghost); white-space: nowrap; }
.wire__head { min-width: 0; font-size: 15.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wire__head:hover { color: var(--bull); }
.wire__heat { font-family: var(--type-mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.wire__heat b { color: var(--bull); font-weight: 700; }

/* ---------- Pagination ---------- */
.paging { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 30px 0 8px; }
.paging a { min-width: 42px; text-align: center; padding: 9px 13px; border: 1px solid var(--edge); background: var(--panel); color: var(--muted); font-family: var(--type-mono); font-weight: 700; border-radius: 8px; }
.paging a:hover, .paging a.cur { background: var(--bull); border-color: var(--bull); color: #fff; }

/* ---------- Breadcrumb ---------- */
.crumbs { font-family: var(--type-mono); font-size: 12.5px; color: var(--ghost); margin: 20px 0 2px; }
.crumbs a { color: var(--muted); }
.crumbs i { font-style: normal; margin: 0 7px; color: var(--edge); }

/* ---------- Read layout (article + side) ---------- */
.readgrid { display: grid; grid-template-columns: 1fr 320px; gap: 30px; align-items: start; margin-top: 8px; }
.readmain { min-width: 0; max-width: var(--readw); }
.readside { min-width: 0; }
.readside .rankcard { position: sticky; top: 14px; }

.readout__tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--bull); background: var(--wash); padding: 4px 10px; border-radius: 6px; }
.readout__head { font-size: 32px; font-weight: 800; line-height: 1.25; color: var(--text); margin: 14px 0 0; overflow-wrap: break-word; }
.readout__meta { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: 16px 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--edge); font-family: var(--type-mono); font-size: 12.5px; color: var(--ghost); }
.readout__body { font-size: 17px; line-height: 1.9; color: var(--text); overflow-wrap: break-word; }
.readout__body p { margin: 0 0 1.2em; }
.readout__body img, .readout__body video, .readout__body iframe { max-width: 100%; height: auto; border-radius: 8px; margin: 1.3em auto; }
.readout__body a { color: var(--bull); text-decoration: underline; text-underline-offset: 3px; }
.readout__body pre { white-space: pre-wrap; overflow-wrap: break-word; background: var(--panel); border: 1px solid var(--edge); border-radius: 8px; padding: 14px; font-size: 14.5px; font-family: var(--type-mono); }
.readout__body table { display: block; width: max-content; max-width: 100%; overflow: auto; border-collapse: collapse; font-size: 14.5px; }
.readout__body table td, .readout__body table th { border: 1px solid var(--edge); padding: 7px 12px; }

.readout__cite { margin: 26px 0 0; padding: 15px 18px; background: var(--wash); border-left: 4px solid var(--bull); border-radius: 8px; font-size: 13.5px; color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }
.stepnav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 22px 0 0; }
.stepnav a { min-width: 0; display: block; padding: 13px 16px; background: var(--panel); border: 1px solid var(--edge); border-radius: 8px; font-size: 14.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepnav a:hover { color: var(--bull); border-color: var(--bull); }
.stepnav b { display: block; font-family: var(--type-mono); font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--ghost); font-weight: 700; margin-bottom: 5px; }
.stepnav .nx { text-align: right; }

/* ---------- Colophon (footer) ---------- */
.footplate { background: var(--panel); border-top: 1px solid var(--edge); margin-top: 44px; }
.footplate__rec { padding: 28px 0 6px; }
.footplate__rec h2, .footplate__friends h2 { font-family: var(--type-mono); font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--ghost); margin-bottom: 14px; }
.reccols { columns: 4; column-gap: 30px; }
.reccols li { break-inside: avoid; border-bottom: 1px solid var(--edge); }
.reccols a { display: block; position: relative; padding: 9px 4px 9px 16px; color: var(--muted); font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.reccols a::before { content: "\203A"; position: absolute; left: 2px; top: 9px; color: var(--bull); font-weight: 700; }
.reccols a:hover { color: var(--bull); }
.footplate__friends { padding: 20px 0; border-top: 1px solid var(--edge); margin-top: 16px; }
.friendwrap { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.friendwrap a { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.friendwrap a:hover { color: var(--bull); }
.footplate__base { text-align: center; color: var(--ghost); font-size: 13px; padding: 20px 0 26px; border-top: 1px solid var(--edge); }
.footplate__base a { color: var(--muted); margin: 0 8px; }
.footplate__base p { margin: 5px 0; }

/* ---------- Back to top ---------- */
#gotop { position: fixed; right: 20px; bottom: 24px; width: 44px; height: 44px; border-radius: 10px; background: var(--bull); color: #fff; border: 0; font-size: 20px; cursor: pointer; opacity: 0; visibility: hidden; transition: .2s; box-shadow: 0 6px 18px rgba(0,0,0,.22); z-index: 50; }
#gotop.on { opacity: 1; visibility: visible; }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .board { grid-template-columns: 1fr; }
  .readgrid { grid-template-columns: 1fr; }
  .readmain { max-width: none; }
  .board__side .rankcard, .readside .rankcard { position: static; }
  .statrow { grid-template-columns: repeat(2, 1fr); }
  .reccols { columns: 2; }
}
@media (max-width: 600px) {
  .deskbar__meta { display: none; }
  .boardnav__list { display: none; flex-direction: column; width: 100%; }
  .boardnav__list.open { display: flex; }
  .boardnav__list a { border-bottom: 1px solid var(--edge); }
  .boardnav__toggle { display: block; width: 100%; border: 0; background: var(--panel); color: var(--muted); padding: 11px; font-size: 15px; cursor: pointer; text-align: left; }
  .feed { grid-template-columns: 1fr; }
  .statrow { grid-template-columns: repeat(2, 1fr); }
  .wire__row { grid-template-columns: 1fr auto; }
  .wire__time { display: none; }
  .readout__head { font-size: 25px; }
  .readout__body { font-size: 16px; }
  .stepnav { grid-template-columns: 1fr; }
  .reccols { columns: 1; }
}

/* ---------- Content overflow safety ---------- */
.dispatch, .statcell, .rankrow__box, .wire__head, .board__main, .readmain, .panel { min-width: 0; }
.dispatch__head, .readout__head, .rankrow__head { overflow-wrap: break-word; }
