/* /manuscript-report/ ("Your manuscript, by the numbers"). Colors come from app.css's light/dark tokens. */
:root { --c2: #0f766e; --heavy: #b45309; }
@media (prefers-color-scheme: dark) { :root { --c2: #2dd4bf; --heavy: #fbbf24; } }

.ms { max-width: 900px; }
.h2 { font-size: 1.25rem; margin: 0 0 12px; letter-spacing: -.01em; }
.h3 { font-size: 1rem; margin: 18px 0 8px; }
.h3:first-child, .h2 + .h3 { margin-top: 0; }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 4px; }

/* the ask */
.ask { display: grid; gap: 14px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; margin: 0; min-height: 150px; padding: 20px;
  border: 2px dashed var(--line); border-radius: var(--radius); cursor: pointer; text-align: center; font-weight: 400; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-big { font-size: 1.2rem; font-weight: 700; color: var(--accent); }
.paste summary { color: var(--muted); font-weight: 600; }
.paste textarea { width: 100%; margin: 10px 0; font: inherit; font-size: .95rem; color: inherit; background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; resize: vertical; }
.paste textarea:focus, .cast-edit textarea:focus { outline: none; border-color: var(--accent); }
.genre { margin: 0; max-width: 360px; }
.busy { margin: 0; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.private { border-left: 5px solid var(--good); }
.private p { margin: 0; }
.about p:last-child { margin: 0; }

/* the report */
.rep-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 20px 0 12px; }
.rep-title { font-size: clamp(1.6rem, 6vw, 2.3rem); letter-spacing: -.03em; margin: 0 0 4px; overflow-wrap: anywhere; }
.rep-head p { margin: 0; }
.rep-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.toc a { font-size: .82rem; text-decoration: none; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; background: var(--card); }
.toc a:hover { color: var(--accent); border-color: var(--accent); }
.ms-stats { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .ms-stats { grid-template-columns: repeat(4, 1fr); } }
.ms-stats .stat b { font-size: clamp(1.4rem, 5.5vw, 2rem); }
.rep { scroll-margin-top: 12px; }
.rep > p:last-child { margin-bottom: 0; }
.note { padding: 10px 12px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); border-radius: 0 8px 8px 0; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 640px) { .two { grid-template-columns: 1fr; gap: 0; } }

.flags { margin: 0; padding: 0 0 0 1.4em; }
.flags li { margin: 0 0 10px; padding-left: 4px; }
.flags li::marker { color: var(--muted); font-weight: 700; }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-radius: 99px; padding: 1px 8px; margin-right: 4px; border: 1px solid var(--line); color: var(--muted); vertical-align: .1em; }
.k-polish .tag { border-color: var(--bad); color: var(--bad); }
.k-characters .tag, .k-voice .tag { border-color: var(--c2); color: var(--c2); }
.k-style .tag, .k-dialogue .tag, .k-rhythm .tag { border-color: var(--accent); color: var(--accent); }
.jump { font-size: .82rem; white-space: nowrap; }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; border-radius: 99px; padding: 1px 8px; vertical-align: .15em; margin-left: 4px; }
.badge.lean { background: color-mix(in srgb, var(--good) 15%, var(--card)); color: var(--good); }
.badge.mid { background: var(--line); color: var(--muted); }
.badge.heavy { background: color-mix(in srgb, var(--heavy) 18%, var(--card)); color: var(--heavy); }
.num { font-weight: 400; color: var(--muted); font-size: .9rem; margin-left: 4px; }
.metric { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 16px; }
.metric .h3 { margin-top: 12px; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 6px; }
.chips li { border: 1px solid var(--line); border-radius: 8px; padding: 2px 9px; font-size: .88rem; background: var(--bg); }
.chips b { color: var(--accent); font-variant-numeric: tabular-nums; margin-left: 2px; }
.chips small { color: var(--muted); }
.examples { list-style: none; padding: 0; margin: 0 0 8px; }
.examples li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.examples li:last-child { border-bottom: 0; }
.where { display: inline-block; font-size: .75rem; font-weight: 700; color: var(--muted); margin-right: 6px; white-space: nowrap; }
.notes { margin: 12px 0 0; padding-left: 1.2em; }
.notes li { margin: 0 0 6px; }

.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 12px; }
@media (max-width: 560px) { .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mini { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.mini b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.mini span { color: var(--muted); font-size: .8rem; }

.tablewrap { overflow-x: auto; margin: 8px 0 0; }
.ch-table, .char-table, .small-table, .lines-table { font-size: .88rem; }
.ch-table td, .ch-table th, .char-table td, .char-table th { white-space: nowrap; padding: 7px 6px; }
.ch-table td:first-child { white-space: normal; min-width: 150px; }
.char-table td, .char-table th { text-align: right; }
.char-table td:first-child, .char-table th:first-child { white-space: normal; text-align: left; }
.small-table td, .small-table th { padding: 6px 6px; }
.lines-table td, .lines-table th { text-align: left; vertical-align: top; padding: 8px 6px; }
.lines-table td:first-child { white-space: nowrap; }
.lines-table td:nth-child(n+2) { width: 50%; font-size: .85rem; }

/* length against genres */
.genres { display: grid; gap: 5px; margin: 12px 0 6px; }
.g-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px; align-items: center; font-size: .85rem; }
@media (max-width: 520px) { .g-row { grid-template-columns: 110px minmax(0, 1fr); font-size: .78rem; } }
.g-row.on .g-name { font-weight: 700; color: var(--accent); }
.g-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-track { position: relative; height: 14px; background: var(--bg); border-radius: 99px; border: 1px solid var(--line); }
.g-range { position: absolute; top: 2px; bottom: 2px; border-radius: 99px; background: color-mix(in srgb, var(--c2) 40%, var(--card)); }
.g-row.on .g-range { background: color-mix(in srgb, var(--accent) 50%, var(--card)); }
.g-you { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; background: var(--ink); border-radius: 2px; }

/* charts */
.chart { margin: 4px 0 8px; }
.ms-chart { display: block; width: 100%; height: auto; overflow: visible; }
.ms-chart .grid line { stroke: var(--line); stroke-width: 1; }
.ms-chart .grid line.zero { stroke: var(--muted); stroke-dasharray: 3 3; }
.ms-chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ms-chart .ylab text { text-anchor: end; }
.ms-chart .xlab text { text-anchor: middle; }
.ms-chart .bars rect { fill: var(--accent); }
.ms-chart .bars rect.out { fill: var(--heavy); }
.ms-chart .bars rect:hover { fill: var(--ink); }
.ms-chart .avg { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 5 4; }
.ms-chart .avg-l { text-anchor: end; fill: var(--ink); font-weight: 600; }
.ms-chart .series path { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.ms-chart .s0 path { stroke: var(--accent); } .ms-chart .s0 circle { fill: var(--accent); }
.ms-chart .s1 path { stroke: var(--c2); } .ms-chart .s1 circle { fill: var(--c2); }
.ms-chart .series circle { stroke: var(--card); stroke-width: 1.5; }
.ms-chart .series circle:hover { r: 6; }
.ms-chart .band { fill: color-mix(in srgb, var(--good) 10%, transparent); }
.ms-heat .rl { text-anchor: end; fill: var(--ink); font-size: 12px; }
.ms-heat rect:hover { stroke: var(--ink); stroke-width: 1.5; }
.ms-key { list-style: none; display: flex; gap: 16px; padding: 0; margin: 4px 0 0; font-size: .8rem; color: var(--muted); }
.sw { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.sw.s0 { background: var(--accent); } .sw.s1 { background: var(--c2); }

.hbars { list-style: none; padding: 0; margin: 0; }
.hbars li { display: grid; grid-template-columns: minmax(70px, 120px) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: .88rem; padding: 3px 0; }
.hl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.hb i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.hv { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hv small { color: var(--muted); }

.voice-strip { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 6px; }
.voice-strip .v { font-size: .75rem; padding: 3px 7px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.v.odd-pov, .key.odd-pov { background: color-mix(in srgb, var(--c2) 22%, var(--card)); border-color: var(--c2); color: var(--ink); }
.v.odd-tense, .key.odd-tense { background: color-mix(in srgb, var(--heavy) 22%, var(--card)); border-color: var(--heavy); color: var(--ink); }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid; vertical-align: -1px; }

.cast-edit { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.cast-edit textarea { width: 100%; font: .92rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: inherit; background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 6px 0; resize: vertical; }
.cast-edit code { font-size: .85em; background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.rep-foot { margin: 8px 0 24px; }

/* Save as PDF: a clean, light report on paper */
@media print {
  :root { --accent: #c2410c; --accent-ink: #fff; --bg: #fff; --card: #fff; --ink: #111; --muted: #555; --line: #ddd; --good: #15803d; --bad: #b91c1c; --c2: #0f766e; --heavy: #b45309; color-scheme: light; }
  body { background: #fff; font-size: 11pt; }
  .bar, #intro, #about, .rep-tools, .toc, .jump, .cast-edit, .rep-foot { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card { border: 0; padding: 0; margin: 0 0 18pt; break-inside: auto; }
  .rep { break-before: auto; }
  .h2 { border-bottom: 2px solid var(--accent); padding-bottom: 4pt; break-after: avoid; }
  .h3 { break-after: avoid; }
  .chart, .metric, .stat, .examples li, tr, .g-row { break-inside: avoid; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .tablewrap { overflow: visible; }
  a { color: inherit; text-decoration: none; }
}
@page { margin: 16mm 14mm; }
