/* 📊 Stats (web/novel-stats.js): BuckBoy's tiles and two-column cards, ChoreBoy's heatmap and share bars. Tokens
   only (theme.css), so it follows light and dark: no colour of its own here (test/novel-stats.test.js checks). */
.nb-page.nst { max-width: 1100px; }
.nst-first { margin: 0 0 1rem; }
.nst-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.nst-how { margin: -.4rem 0 1rem; }
.nst-paused { font-size: .85em; margin-left: .25rem; }
.nst-tiles .tile { display: flex; flex-direction: column; gap: .15rem; min-width: 0; padding: .8rem .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.nst-tiles .tile b { font-size: 1.35rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.nst-tiles .tile .sub { overflow-wrap: anywhere; }
.nst-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.nst-grid > * { min-width: 0; }
.nst-grid .panel + .panel { margin-top: 0; }
.nst-grid .wide { grid-column: 1 / -1; }
.nb-page.nst .nst-grid section > h3 { margin: 0 0 .6rem; }
.nst-h4 { margin: 1rem 0 .4rem; font-size: .95rem; }

/* 🗓️ The heatmap: a column a week, a row a weekday; one hue, light (a little) to dark (a lot), over the surface */
.nst-heat-sum { margin: -.3rem 0 .6rem; }
.nst-heat { display: grid; gap: 3px; max-width: 62rem; grid-auto-rows: auto; }
.nst-mon { grid-row: 1; font-size: .68rem; color: var(--text-3); white-space: nowrap; overflow: visible; }
.nst-dow { grid-column: 1; align-self: center; font-size: .66rem; line-height: 0; color: var(--text-3); } /* no height of its own: every row as tall as a square */
.nst-cell { display: block; aspect-ratio: 1; min-width: 0; border-radius: 2px; background: var(--surface-2); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 70%, transparent); }
.nst-cell.l1 { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); box-shadow: none; }
.nst-cell.l2 { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); box-shadow: none; }
.nst-cell.l3 { background: color-mix(in srgb, var(--accent) 70%, var(--surface)); box-shadow: none; }
.nst-cell.l4 { background: var(--accent); box-shadow: none; }
.nst-cell.future { background: transparent; box-shadow: none; }
.nst-cell.today { outline: 1.5px solid var(--text-2); outline-offset: 1px; }
.nst-cell[data-i]:hover { outline: 2px solid var(--text); outline-offset: 1px; }
.nst-cell[data-i]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.nst-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; margin-top: .5rem; font-size: .72rem; color: var(--text-3); }
.nst-legend .nst-cell { width: 11px; height: 11px; }
.nst-legend > span:first-child { margin-right: 3px; }
.nst-legend > span:last-child { margin-left: 3px; }
.nst-heat-read { margin: .6rem 0 0; min-height: 1.2em; font-size: .82rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nst-heat-read.on { color: var(--text); font-weight: 600; }

/* 📈 Words a week: the bars stretch to the card; the dates under them are text, so they stay sharp */
.nst-chart { position: relative; margin: .9rem 0 0 2.6rem; }
.nst-bars { display: block; width: 100%; height: 150px; overflow: visible; border-bottom: 1px solid var(--border); }
.nst-bar { fill: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.nst-bar.now { fill: var(--accent); }
.nst-bar:hover { fill: var(--accent-text); }
.nst-grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.nst-ymax { position: absolute; right: calc(100% + .4rem); top: 0; transform: translateY(-50%); font-size: .68rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nst-x { display: flex; margin: .3rem 0 0 2.6rem; }
.nst-x span { flex: 1 1 0; min-width: 0; text-align: center; font-size: .68rem; color: var(--text-3); white-space: nowrap; overflow: hidden; }

/* 🎯 Goal met: a ring and the words beside it; a bar a book under them */
.nst-goal { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nst-goal-text { flex: 1 1 12rem; min-width: 0; }
.nst-goal-text p { margin: 0 0 .25rem; }
.nst-ring { flex: 0 0 auto; }
.nst-ring-bg { stroke: var(--surface-2); }
.nst-ring-arc { stroke: var(--accent); }
.nst-ring-big { fill: var(--text); font-size: 22px; font-weight: 700; font-family: var(--font); }
.nst-ring-sub { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.nst-goal-books { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: .55rem; }
.nst-goal-books li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .7rem; align-items: baseline; }
.nst-goal-books .meter { grid-column: 1 / -1; }
.nst-goal-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.nst-goal-n { font-size: .8rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.nst .meter > i { background: var(--accent); }

/* 📑 Chapters by book: a stacked bar a book */
.nst-chs { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.nst-ch-head { display: flex; justify-content: space-between; align-items: baseline; gap: .7rem; margin-bottom: .25rem; }
.nst-ch-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .92rem; }
.nst-ch-n { flex: 0 0 auto; font-size: .8rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.nst-stack { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.nst-stack i { display: block; height: 100%; }
.nst-stack i + i { box-shadow: inset 2px 0 0 var(--surface); }
.nst-stack .done, .key.nst-k-done { background: var(--accent); }
.nst-stack .writing, .key.nst-k-writing { background: var(--gold); }
.nst-stack .planned, .key.nst-k-planned { background: color-mix(in srgb, var(--text-3) 35%, var(--surface)); }

/* 📚 Your books: a table on a computer, a card a book on a phone */
.nst-table-wrap { overflow-x: auto; }
.nst-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.nst-table th, .nst-table td { padding: .5rem .6rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: baseline; }
.nst-table thead th { font-size: .78rem; font-weight: 650; color: var(--text-2); }
.nst-table tbody th { font-weight: 600; }
.nst-table tbody th .link-like { color: var(--text); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-align: left; font-weight: 600; } /* (a link at rest, not only on hover) */
.nst-table tbody th .link-like:hover { color: var(--accent-text); text-decoration: underline; }
.nst-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.nst-table tbody tr:last-child > * { border-bottom: 0; }

/* 🌍 You and NovelBoy's writers */
.nst-cmp { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .8rem; }
.nst-cmp-label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .3rem; }
.nst-cmp-bars { display: grid; grid-template-columns: 4rem minmax(0, 1fr) 4.5rem; gap: .3rem .6rem; align-items: center; }
.nst-cmp-who { font-size: .8rem; color: var(--text-2); }
.nst-cmp-track { display: block; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.nst-cmp-track i { display: block; height: 100%; border-radius: 999px; }
.nst-cmp-track .you { background: var(--accent); }
.nst-cmp-track .them { background: var(--move); }
.nst-cmp-bars b { text-align: right; font-size: .85rem; font-variant-numeric: tabular-nums; }
.nst-app-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 1rem 0 0; }
.nst-genres { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.nst-genres li { padding: .3rem .65rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: .85rem; }
.nst-none p { margin: 0 0 .3rem; }

@media (max-width: 900px) { .nst-app-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .nst-tiles, .nst-app-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .nst-tiles .tile { padding: .65rem .7rem; }
  .nst-tiles .tile b { font-size: 1.15rem; }
  .nst-grid { grid-template-columns: minmax(0, 1fr); }
  .nst-heat { gap: 2px; }
  .nst-x span { display: flex; justify-content: center; overflow: visible; }
  .nst-x span:nth-child(even) { visibility: hidden; }
  .nst-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .nst-table, .nst-table tbody, .nst-table tr, .nst-table th, .nst-table td { display: block; }
  .nst-table tr { padding: .55rem 0; border-bottom: 1px solid var(--border); }
  .nst-table tbody tr:last-child { border-bottom: 0; }
  .nst-table th, .nst-table td { border: 0; padding: .1rem 0; }
  .nst-table td { display: flex; justify-content: space-between; gap: .7rem; text-align: right; }
  .nst-table td::before { content: attr(data-label); color: var(--text-3); font-size: .8rem; text-align: left; }
  .nst-cmp-bars { grid-template-columns: 3.4rem minmax(0, 1fr) 4rem; }
}
