@font-face { font-family: "DM Sans"; src: url("./fonts/dm-sans.woff2") format("woff2"); font-style: normal; font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Source Serif"; src: url("./fonts/source-serif-4.woff2") format("woff2"); font-style: normal; font-weight: 200 900; font-display: swap; }
:root { color-scheme: dark; --bg: #101923; --surface: #172431; --raised: #203342; --line: #344b5c; --text: #edf1ee; --muted: #aebdc6; --quiet: #8a9fae; --blue: #9bbfff; --gold: #ddb46e; --serif: "Source Serif", Georgia, serif; --sans: "DM Sans", system-ui, sans-serif; }
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body { margin: 0; background: radial-gradient(ellipse at 85% 0, #233a5038, transparent 50%), var(--bg); color: var(--text); font: 400 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button, a, select, summary, input { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; z-index: 50; top: -60px; left: 16px; padding: 9px 13px; background: var(--text); color: var(--bg); }
.skip:focus { top: 12px; }
.app-shell { display: flex; flex-direction: column; position: relative; width: 100%; max-width: 2560px; height: 100vh; height: 100dvh; min-height: 0; margin: auto; padding: 0 clamp(12px, 2vw, 30px); }
.topbar { display: flex; align-items: center; flex: none; gap: 22px; min-height: 60px; border-bottom: 1px solid #ffffff19; }
.identity { display: flex; align-items: center; gap: 9px; text-decoration: none; font-size: 1.3rem; font-weight: 800; letter-spacing: -.065em; }
.mark { width: 38px; height: 38px; }
.wordmark-dot { color: var(--blue); }
.parent-brand { padding-left: 20px; border-left: 1px solid var(--line); color: var(--muted); font-size: .74rem; text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 22px; margin-left: auto; font-size: .75rem; font-weight: 700; }
.header-actions a { text-decoration: none; }
.privacy-pill { color: #adcbb9; font-size: .68rem; }
.github-link { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; }
a:hover { color: var(--blue); }
.deskbar { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 1px 14px; }
.eyebrow { margin: 0 0 3px; color: var(--blue); font-size: .57rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
h1 { margin: 0; font: 500 1.9rem/1.1 var(--serif); letter-spacing: -.03em; }
h1 em { color: var(--blue); font-weight: 400; }
.sample-group { display: flex; align-items: center; gap: 7px; }
.sample-group>span { margin-right: 5px; color: var(--quiet); font-size: .58rem; font-weight: 800; letter-spacing: .12em; }
.sample-choice { padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-size: .7rem; font-weight: 700; }
.sample-choice[aria-pressed="true"], .sample-choice:hover { border-color: var(--blue); background: #294263; color: var(--text); }
.writing-desk { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 12px 38px #050b1440; }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; flex: none; gap: 16px; min-height: 48px; padding: 5px 13px; border-bottom: 1px solid var(--line); background: #1a2b39; }
.finding-toggles { display: flex; min-width: 0; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: thin; }
.finding-group { flex: none; }
.finding-group>summary { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid transparent; border-radius: 6px; color: var(--muted); font-size: .71rem; font-weight: 700; cursor: pointer; list-style: none; white-space: nowrap; }
.finding-group>summary::-webkit-details-marker { display: none; }
.finding-group>summary::after { content: "⌄"; color: var(--quiet); }
.finding-group[open]>summary, .finding-group>summary:hover { border-color: var(--line); background: var(--raised); color: var(--text); }
.swatch { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--finding-color, var(--blue)); }
.finding-group[data-enabled="false"]>summary { opacity: .5; }
.rule-popover { position: fixed; z-index: 20; top: var(--popover-top); left: var(--popover-left); width: 270px; max-width: calc(100vw - 24px); padding: 8px; border: 1px solid #567084; border-radius: 9px; background: #1e3040; box-shadow: 0 8px 30px #030910aa; }
.rule-option { display: flex; align-items: center; gap: 8px; padding: 7px; border-radius: 4px; color: var(--text); font-size: .75rem; cursor: pointer; }
.rule-option:hover { background: #344d60; }
.rule-option input { accent-color: var(--finding-color); }
.rule-count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.group-action { width: 100%; text-align: left; }
.editor-tools, .drawer-actions { display: flex; align-items: center; flex: none; gap: 8px; }
select { max-width: 100%; padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text); font-size: .7rem; }
.text-button { padding: 6px; border: 0; border-radius: 4px; background: transparent; color: #c1d0d9; font-size: .71rem; font-weight: 700; white-space: nowrap; }
.text-button:hover { color: var(--blue); background: #9bbfff0b; }
.primary-button { padding: 6px 12px; border: 1px solid #a4c7ff; border-radius: 6px; background: #86aff5; color: #101b26; font-size: .72rem; font-weight: 800; }
.primary-button:hover { background: #aacaff; }
.icon-button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: transparent; color: var(--muted); font-size: 1.2rem; }
.icon-button:hover { color: var(--text); border-color: var(--blue); }
.editor-wrap { display: flex; position: relative; flex: 1; min-height: 70px; background: linear-gradient(140deg, #172633, #14212d 75%); }
#source { width: 100%; min-width: 0; min-height: 0; }
.cm-editor { height: 100%; color: #f2efe7; background: transparent; }
.cm-editor.cm-focused { outline: none; }
.cm-scroller { font: 400 1.13rem/1.95 var(--serif) !important; overflow: auto !important; scrollbar-color: #526b7e transparent; }
.writing-desk .cm-editor .cm-content { width: 100%; min-width: 0; max-width: 1800px; min-height: 100%; margin: 0 auto; padding: 35px clamp(20px, 3.5vw, 64px) 40vh; caret-color: var(--blue); }
.writing-desk .cm-editor .cm-line { padding: 0; }
.cm-cursor { border-left-color: var(--blue); }
.cm-selectionBackground, .cm-focused .cm-selectionBackground, .cm-content ::selection { background: #8bb4ff40 !important; }
.cm-placeholder { color: var(--quiet); }
.cm-finding { cursor: pointer; border-radius: 2px; text-decoration-line: underline; text-decoration-color: var(--finding-color); text-decoration-thickness: 1px; text-underline-offset: 4px; background: color-mix(in srgb, var(--finding-color) 15%, transparent); }
.cm-finding:hover { background: color-mix(in srgb, var(--finding-color) 30%, transparent); }
.cm-finding-span { background: transparent; text-decoration-style: dotted; }
.finding-repetition { --finding-color: #9bbfff; }
.finding-style { --finding-color: #e2ba75; }
.finding-rhythm { --finding-color: #7dcfb2; }
.finding-dialogue { --finding-color: #e3a3c5; }
.finding-narrative { --finding-color: #c5a4f4; }
.drop-hint { position: absolute; z-index: 8; inset: 12px; display: grid; place-items: center; border: 2px dashed var(--blue); border-radius: 8px; background: #172a3bf0; color: var(--text); font-weight: 700; pointer-events: none; }
.editor-status { display: flex; align-items: center; justify-content: space-between; flex: none; gap: 12px; min-height: 38px; padding: 3px 15px; border-top: 1px solid var(--line); color: var(--muted); background: #192a37; font-size: .68rem; }
.editor-status>div { display: flex; align-items: center; gap: 15px; white-space: nowrap; }
#viewport-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#stats { color: var(--quiet); }
.chart-toggle { color: var(--blue); }
.drawer { display: grid; flex: none; grid-template-rows: 0fr; transition: grid-template-rows 180ms ease; background: #1d3040; }
.drawer[data-open="true"] { grid-template-rows: 1fr; }
.drawer-inner { min-height: 0; overflow: hidden; }
.finding-content { max-height: 24dvh; padding: 13px 22px 10px; overflow-y: auto; border-bottom: 1px solid #526b7e; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.drawer-head h2 { margin: 0; color: var(--text); font-size: .86rem; font-weight: 750; }
.finding-excerpt { margin: 8px 0 6px; color: #e6e8df; font: 400 .92rem/1.5 var(--serif); }
.finding-explanation { margin: 0; max-width: 1100px; color: var(--muted); font-size: .75rem; }
.finding-overlap { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.finding-overlap:empty { display: none; }
.finding-overlap button { padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--muted); font-size: .68rem; }
.finding-overlap button[aria-pressed="true"] { border-color: var(--blue); color: var(--text); }
.chart-content { --track-height: 52px; --chart-label-width: 136px; --chart-scale-width: 42px; max-height: 44dvh; overflow-y: auto; padding: 12px 20px 9px; border-top: 1px solid #526b7e; background: linear-gradient(130deg, #203645, #182a38); }
.chart-heading-group { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 13px; }
.chart-resolution { color: var(--quiet); font-size: .64rem; font-variant-numeric: tabular-nums; }
.chart-controls { display: flex; align-items: center; gap: 7px; }
.chart-controls select { min-height: 29px; }
.chart-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0 9px; }
.chart-series { display: flex; min-width: 0; gap: 5px; align-items: center; overflow-x: auto; scrollbar-width: thin; }
.chart-series button { display: flex; flex: none; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid #496274; border-radius: 5px; background: transparent; color: var(--quiet); font-size: .66rem; white-space: nowrap; }
.chart-series button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--series-color) 70%, transparent); color: var(--text); background: color-mix(in srgb, var(--series-color) 10%, transparent); }
.chart-series .swatch { width: 7px; height: 7px; border-radius: 50%; background: var(--series-color); }
.chart-series-value { display: none; color: var(--series-color); font-variant-numeric: tabular-nums; }
.chart-content[data-layout="overlay"] .chart-series button[aria-pressed="true"] .chart-series-value { display: inline; }
.chart-layout { display: flex; flex: none; padding: 2px; border: 1px solid #486173; border-radius: 6px; background: #101f2b88; }
.chart-layout button { padding: 4px 8px; border: 0; border-radius: 4px; background: transparent; color: var(--quiet); font-size: .64rem; font-weight: 700; }
.chart-layout button[aria-pressed="true"] { background: #38556b; color: #edf4f9; }
.chart-plot { position: relative; height: calc(var(--chart-tracks, 3) * var(--track-height)); min-height: var(--track-height); }
.chart-plot[data-layout="overlay"] { height: 150px; --chart-label-width: 0px; --chart-scale-width: 0px; }
#analysis-chart { display: block; margin-left: var(--chart-label-width); width: calc(100% - var(--chart-label-width) - var(--chart-scale-width)); height: 100%; overflow: visible; cursor: crosshair; }
#chart-empty { position: absolute; top: 35%; left: 0; width: 100%; padding: 0 16px; color: var(--quiet); text-align: center; font-size: .75rem; }
#chart-empty[data-kind="error"] { color: #f5d8ac; }
.chart-track-labels { position: absolute; inset: 0 auto 0 0; width: var(--chart-label-width); pointer-events: none; }
.chart-track-label { position: absolute; left: 0; width: 100%; padding: 0 12px 0 10px; display: flex; flex-direction: column; justify-content: center; border-left: 2px solid var(--series-color); }
.chart-track-name { color: var(--muted); font-size: .67rem; line-height: 1.35; }
.chart-track-value { color: var(--series-color); font-size: .76rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.4; }
.chart-track-value small { margin-left: 4px; color: var(--quiet); font-size: .56rem; font-weight: 400; }
.chart-track-scales { position: absolute; inset: 0 0 0 auto; width: var(--chart-scale-width); pointer-events: none; }
.chart-track-scale { position: absolute; width: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 6px 0 6px 7px; color: var(--quiet); font: 400 .55rem/1.2 var(--sans); font-variant-numeric: tabular-nums; }
.chart-plot[data-layout="overlay"] .chart-track-labels, .chart-plot[data-layout="overlay"] .chart-track-scales { display: none; }
.chart-grid { stroke: #a8c6db17; stroke-width: 1; stroke-dasharray: 2 4; }
.chart-row-divider { stroke: #a8c6db20; stroke-width: 1; }
.chart-section-fill { fill: #b8d6ee04; }
.chart-section-line { stroke: #a8c6db26; stroke-width: 1; stroke-dasharray: 3 4; }
.chart-area { opacity: .075; }
.chart-line { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-node { stroke-width: .7; stroke: #182a38; vector-effect: non-scaling-stroke; }
.chart-selected-node { stroke: #edf5ff; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.chart-band { fill: #9bbfff08; stroke: #9bbfff50; stroke-width: 1; }
.chart-visible { fill: #9bbfff12; stroke: none; }
.chart-cursor { stroke: #dfecf7b0; stroke-width: 1; stroke-dasharray: 2 3; }
.chart-axis { position: relative; display: flex; justify-content: space-between; margin-left: var(--chart-label-width); margin-right: var(--chart-scale-width); height: 20px; padding-top: 3px; color: var(--quiet); font-size: .56rem; }
.chart-content[data-layout="overlay"] .chart-axis { margin-left: 0; margin-right: 0; }
#chart-chapters { position: absolute; inset: 0; pointer-events: none; }
.chart-chapter-label { position: absolute; top: 3px; overflow: hidden; color: #aebfcb; font-size: .56rem; white-space: nowrap; text-overflow: ellipsis; text-align: center; transform: translateX(-50%); }
.chart-readout { display: flex; align-items: center; gap: 10px; min-height: 28px; color: var(--muted); font-size: .66rem; }
#chart-cursor { width: 105px; min-width: 50px; height: 16px; margin: 0; accent-color: var(--blue); }
#chart-tooltip { flex: 1; font-variant-numeric: tabular-nums; }
.chart-note { margin: 0; color: var(--quiet); font-size: .59rem; }
.chart-content.is-loading .chart-plot { opacity: .45; pointer-events: none; }
.chart-content.is-loading .chart-resolution { color: var(--blue); }
.analysis-notice { display: flex; align-items: center; justify-content: space-between; flex: none; gap: 12px; margin-bottom: 9px; padding: 7px 12px; border: 1px solid #4e6b83; border-radius: 7px; background: #20364a; color: #d5e6f5; font-size: .73rem; }
.analysis-notice>div { display: flex; align-items: center; gap: 15px; min-width: 0; }
.analysis-notice[data-kind="error"] { border-color: #bf945a; color: #f5d8ac; }
.analysis-notice progress { width: 95px; height: 5px; accent-color: var(--blue); }
.app-footer { display: flex; align-items: center; justify-content: space-between; flex: none; gap: 12px; min-height: 30px; color: var(--quiet); font-size: .61rem; }
.app-footer div { display: flex; gap: 18px; white-space: nowrap; }
.app-footer a { text-decoration: none; }
@media (max-width: 1100px) {
  .editor-toolbar { flex-wrap: wrap; gap: 0; padding: 5px 10px; }
  .finding-toggles { flex: 1; }
  .editor-tools { margin-left: auto; }
  .privacy-pill { display: none; }
  .finding-group>summary { padding: 5px; }
  .parent-brand { display: none; }
}
@media (max-width: 780px) {
  .editor-toolbar { display: block; }
  .finding-toggles { padding-bottom: 4px; }
  .editor-tools { justify-content: flex-end; padding-top: 4px; border-top: 1px solid #ffffff12; }
  .editor-tools #format { margin-right: auto; }
  #stats { display: none; }
  .editor-status { padding: 3px 9px; }
  .editor-status>div { gap: 5px; }
  .chart-content { padding: 8px 10px; }
  .chart-content .drawer-head { flex-wrap: wrap; gap: 7px; }
  .chart-controls { margin-left: auto; }
  .chart-content .drawer-head h2 { font-size: .76rem; }
  .chart-note { font-size: .56rem; }
  .app-footer div a:first-child { display: none; }
}
@media (max-width: 600px) {
  .app-shell { padding: 0 10px; }
  .topbar { min-height: 53px; }
  .identity { font-size: 1.13rem; }
  .mark { width: 33px; height: 33px; }
  .header-actions { gap: 14px; font-size: .69rem; }
  .deskbar { padding: 10px 0; }
  .eyebrow { font-size: .5rem; }
  h1 { font-size: 1.28rem; }
  .sample-group { gap: 4px; }
  .sample-group>span { display: none; }
  .sample-choice { padding: 4px 6px; font-size: .63rem; }
  .finding-group>summary { font-size: .66rem; padding: 5px 6px; }
  .cm-scroller { font-size: 1rem !important; line-height: 1.85 !important; }
  .writing-desk .cm-editor .cm-content { padding: 20px 19px 35vh; }
  .finding-content { max-height: 25dvh; padding: 10px 13px 7px; }
  .drawer-head h2 { font-size: .77rem; }
  .finding-explanation { font-size: .7rem; }
  .finding-excerpt { font-size: .81rem; }
  #inspect-finding { font-size: .64rem; }
  .editor-status { font-size: .61rem; }
  .editor-status .text-button { padding: 5px 3px; font-size: .64rem; }
  .chart-readout { flex-wrap: wrap; gap: 4px 8px; }
  #chart-tooltip { flex-basis: calc(100% - 105px); font-size: .6rem; }
  #chart-jump { margin-left: auto; padding: 0 3px; font-size: .6rem; }
  .chart-controls select { font-size: .62rem; }
  .chart-content { --track-height: 39px; --chart-label-width: 96px; --chart-scale-width: 28px; }
  .chart-track-label { padding: 0 5px; }
  .chart-track-name { font-size: .57rem; }
  .chart-track-value { font-size: .64rem; }
  .chart-track-value small { font-size: .49rem; }
  .chart-track-scale { font-size: .49rem; padding-left: 3px; }
  .chart-heading-group { gap: 3px 10px; }
  .chart-resolution { font-size: .55rem; }
  .chart-options { gap: 7px; padding: 6px 0; }
  .chart-layout button { padding: 4px 6px; font-size: .57rem; }
  .chart-plot[data-layout="overlay"] { height: 120px; }
  .app-footer { min-height: 25px; font-size: .54rem; }
  .app-footer>span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .app-footer div { display: none; }
  .analysis-notice { font-size: .65rem; padding: 5px 8px; }
  .analysis-notice progress { width: 45px; }
}
@media (max-height: 600px) {
  .deskbar { padding: 7px 0; }
  .deskbar .eyebrow { display: none; }
  .app-footer { display: none; }
  .chart-note { display: none; }
  .chart-content { --track-height: 29px; max-height: 45dvh; }
  .chart-track-name { font-size: .56rem; }
  .chart-track-value { font-size: .61rem; }
  .finding-content { max-height: 23dvh; }
}
@media (max-height: 420px) {
  .topbar { min-height: 42px; }
  .deskbar { display: none; }
  .editor-toolbar { flex-wrap: nowrap; display: flex; }
  .editor-tools { border: 0; padding: 0; }
  .chart-content { --track-height: 20px; max-height: 48dvh; padding-top: 5px; padding-bottom: 5px; }
  .chart-heading-group { display: none; }
  .chart-track-name { font-size: .52rem; }
  .chart-track-value { display: none; }
  .chart-axis { height: 14px; }
  .chart-options { padding: 4px 0; }
  .chart-plot[data-layout="overlay"] { height: 70px; }
  #chart-cursor, .chart-readout #chart-jump { display: none; }
  .finding-content { max-height: 25dvh; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
