/* Script Finder: liquid-glass panels over the shader gradient (fx.js). System fonts only (CSP).
   Every color is a variable set from DESIGN.colors in app.js (light and dark); no color values live here,
   except plain black and white for paper in the print styles. */
:root {
  --radius: 18px;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; font: 17px/1.55 var(--font); color: var(--text); background: var(--bg);
  overflow-x: hidden; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .4em; }
h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; margin-top: 14px; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 10; background: var(--surface); color: var(--text);
  padding: 8px 12px; border-radius: 10px; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.topbar { position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line); background: var(--surface); }
.top-in { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 8px 12px; align-items: center;
  flex-wrap: wrap; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; font-weight: 700; font-family: var(--serif);
  font-size: 1.1rem; margin-right: auto; }
nav { display: flex; gap: 4px; flex-wrap: wrap; order: 3; width: 100%; }
nav a { text-decoration: none; padding: 6px 11px; border-radius: 999px; font-size: .95rem; }
nav a[aria-current="page"] { background: var(--primary); color: var(--primary-ink); }
nav a.help-link { border: 1px solid var(--line); font-weight: 700; }
.fx-toggle { font: inherit; font-size: .82rem; color: inherit; background: transparent; border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; cursor: pointer; min-height: 34px; }
@media (min-width: 900px) { nav { order: 0; width: auto; } nav a.help-link { margin-left: 6px; } }

main { max-width: 980px; margin: 0 auto; padding: 18px 16px 40px; outline: none; }
#banners { max-width: 980px; margin: 0 auto; padding: 12px 16px 0; }
#banners:empty { display: none; }
.banner { margin: 0 0 8px; padding: 10px 14px; border-radius: 14px; background: var(--surface); color: var(--text);
  border: 2px dashed var(--accent); font-size: .95rem; }
.banner.warn { border-style: solid; border-color: var(--red); }
footer.site { max-width: 980px; margin: 0 auto; padding: 0 16px 28px; font-size: .88rem; color: var(--muted); }
footer.site p { margin: 0 0 .5em; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  margin: 0 0 16px; min-width: 0; }
.card.urgent { border: 2px solid var(--red); }
.big-text { font-size: 1.2rem; font-family: var(--serif); }
.btn { font: inherit; font-weight: 700; border: 0; border-radius: 999px; padding: 11px 20px; cursor: pointer;
  background: var(--primary); color: var(--primary-ink); min-height: 44px; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px; }
.btn.secondary { background: transparent; color: inherit; border: 1px solid var(--line); }
.btn.danger { background: var(--red); color: var(--surface); }
.btn.small { padding: 6px 14px; min-height: 40px; font-size: .92rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.tight { gap: 8px; margin-top: 8px; }
.msg { margin: 10px 0 0; font-weight: 600; min-height: 1.5em; }
.msg.small { font-weight: 500; min-height: 1.2em; margin-top: 6px; }
.result { font-family: var(--serif); font-size: 1.2rem; }
.small-result { font-size: 1rem; margin: 8px 0 0; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--primary); color: var(--primary-ink);
  font-size: .82rem; font-weight: 700; }
.tag { display: inline-block; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; padding: 2px 9px;
  border-radius: 99px; background: var(--soft); color: var(--accent); font-weight: 700; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-bottom: 8px; font-size: .9rem; }
.bar { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 4px 0 6px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--coral));
  transition: width .3s ease; }

/* forms */
form, fieldset { margin: 0; }
label.field, div.field { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; margin: 0 0 12px; }
input[type=search], input[type=text], input[type=date], input[type=file], select, textarea { font: inherit; font-weight: 400;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  min-height: 44px; width: 100%; max-width: 100%; }
textarea { resize: vertical; display: block; }
.fields.two { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
fieldset.q-set { border: 0; padding: 0; margin: 10px 0 0; min-width: 0; }
fieldset legend { font-weight: 600; font-size: .98rem; padding: 0; margin-bottom: 6px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg label { flex: 1 1 0; min-width: 44px; position: relative; }
.seg.scale5 label { flex: 1 1 96px; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 12px; font-weight: 600; font-size: .86rem; line-height: 1.2; text-align: center; }
.seg span b { font-size: 1.05rem; }
.seg input:checked + span { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; cursor: pointer; border-bottom: 1px solid var(--line); }
.check.inline { border: 0; padding: 4px 0; align-items: center; }
.check input { margin-top: 3px; width: 22px; height: 22px; flex: none; accent-color: var(--primary); }
.check.inline input { margin-top: 0; }
ul.checks, ul.entries, ul.counts, ul.help-list { list-style: none; padding: 0; margin: 0; }
ul.entries li, ul.counts li { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 8px 0;
  border-bottom: 1px solid var(--line); }
ul.entries li > span { min-width: 0; overflow-wrap: anywhere; }
ul.help-list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
ul.help-list a { font-weight: 700; white-space: nowrap; }
.x { font: inherit; font-size: .82rem; background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 99px; padding: 4px 12px; cursor: pointer; min-height: 36px; flex: none; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.chip { font: inherit; font-size: .9rem; text-align: left; color: inherit; background: transparent; border: 1px solid var(--line);
  border-radius: 99px; padding: 6px 13px; cursor: pointer; min-height: 40px; max-width: 100%; overflow-wrap: anywhere; }
.chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); font-weight: 700; }
.ideas .chip { background: var(--soft); border-style: dashed; border-radius: 14px; }
.chip-n { font-weight: 700; color: var(--accent); margin-right: 4px; }
.ideas summary { cursor: pointer; font-weight: 600; min-height: 40px; display: flex; align-items: center; color: var(--accent); }

/* scripts */
.script .situation { font-size: 1.18rem; font-family: var(--font); font-weight: 700; margin-bottom: 10px; }
.words { font-family: var(--serif); font-size: 1.42rem; line-height: 1.38; margin: 0 0 12px; padding: 0;
  quotes: "\201C" "\201D"; }
.words::before { content: open-quote; color: var(--coral); }
.words::after { content: close-quote; color: var(--coral); }
.words.big { font-size: 1.7rem; }
.why { font-size: .93rem; color: var(--muted); }
.why b { color: var(--text); }
.actions { margin-top: 4px; }
.star-btn[aria-pressed="true"] { border-color: var(--star); color: var(--star); }
.star-btn span { font-size: 1.1em; line-height: 1; }
.empty-note { text-align: center; }
.pager { justify-content: space-between; margin-bottom: 14px; }
.pager .btn { flex: 1 1 0; }

/* rules */
.rule .desc { font-family: var(--serif); font-size: 1.08rem; }
.rule-bars { display: grid; gap: 6px; margin: 12px 0; }
.rule-row { padding: 8px 10px; border-radius: 12px; }
.rule-row p { margin: 0; }
.rule-row.hi { background: var(--hi); }
.where { margin: 0 0 10px; padding-left: 20px; }
.where li { margin-bottom: 6px; }
.where a { font-weight: 600; white-space: nowrap; }
.submit-row { justify-content: flex-start; }
.submit-row .msg { margin: 0; }
.table-wrap { overflow-x: auto; }
table.hist, .table-view table { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.hist th, table.hist td, .table-view th, .table-view td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--line); }
table.hist th { font-size: .8rem; }
.table-view summary { cursor: pointer; font-weight: 600; min-height: 36px; }

/* standards */
.std-h { font-size: 1.15rem; }
.print-row { margin-bottom: 16px; justify-content: center; }
.print-only { display: none; }

/* tracker */
.moments { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 4px 0; }
.moment { font: inherit; font-weight: 700; min-height: 56px; padding: 8px 12px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--primary); background: var(--primary); color: var(--primary-ink); }
.moment.slip { background: transparent; color: inherit; border: 1px dashed var(--muted); }
ul.counts li b { font-family: var(--serif); font-size: 1.1rem; }
.chart { width: 100%; height: auto; display: block; margin: 6px 0 4px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--line); stroke-width: 1.5; }
.chart .tick { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart .empty { fill: var(--muted); font-size: 15px; font-family: var(--font); }
.chart .b-good { fill: var(--chart); }
.chart .b-slip { fill: var(--chart-slip); }
.chart .hit { fill: transparent; }
.chart g:hover .b-good, .chart g:hover .b-slip { opacity: .8; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .88rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.good { background: var(--chart); } .sw.slip { background: var(--chart-slip); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 20px); z-index: 20; max-width: calc(100vw - 32px);
  background: var(--primary); color: var(--primary-ink); padding: 10px 18px; border-radius: 14px; font-weight: 600;
  box-shadow: 0 10px 30px var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast:empty { padding: 0; }

/* ---------- shader gradient, liquid glass, liquid logo (fx.js) */
.fx-bg { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; display: block; pointer-events: none; }
.fx-bg.hidden { display: none; }
body.fx-on { background: transparent; }
body.fx-on.fx-nogl { background: radial-gradient(120% 80% at 10% 0%, var(--primary) 0%, transparent 60%),
  radial-gradient(90% 70% at 100% 30%, var(--coral) 0%, transparent 55%), var(--bg); }
body:not(.fx-on) .hero h1 { color: var(--text); }
body.fx-on .card, body.fx-on .topbar, body.fx-on .banner {
  position: relative; background: var(--glass); border-color: var(--edge);
  -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%);
  box-shadow: inset 0 1px 0 var(--edge), 0 10px 34px var(--shadow);
}
body.fx-on .card { border-radius: 22px; overflow: hidden; }
body.fx-on .card.urgent { border-color: var(--red); }
body.fx-on .banner { border-color: var(--accent); }
body.fx-on .banner.warn { border-color: var(--red); }
body.fx-on.fx-refract .card.glass-hero { backdrop-filter: url(#fx-liquid) blur(16px) saturate(170%); }
body.fx-on .card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(125deg, var(--sheen) 0%, transparent 38%, transparent 70%, var(--sheen) 100%); opacity: .8; }
body.fx-on .card > * { position: relative; }
body.fx-on .topbar { border-width: 0 0 1px; }
.hero { text-align: center; padding: 22px 0 18px; }
.hero h1 { font-size: 2.4rem; letter-spacing: -.02em; }
.hero p { font-size: 1.08rem; max-width: 600px; margin: 0 auto; }
body.fx-on .hero h1 { color: var(--hero-ink); text-shadow: 0 2px 22px rgba(0, 0, 0, .3); }
body.fx-on .hero p { color: var(--hero-ink); opacity: .95; text-shadow: 0 1px 12px rgba(0, 0, 0, .35); }
body.fx-on footer.site { color: var(--hero-ink); opacity: .92; text-shadow: 0 1px 8px rgba(0, 0, 0, .4); }
.liquid-logo { display: block; width: 104px; height: 104px; margin: 0 auto 10px; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .3)); }
img.liquid-logo { border-radius: 28px; }
@media (max-width: 720px) {
  .hero h1 { font-size: 1.85rem; } .liquid-logo { width: 84px; height: 84px; }
  nav a { padding: 6px 8px; font-size: .9rem; } .card { padding: 16px; }
  .words { font-size: 1.28rem; } .words.big { font-size: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- print: the Standards Card on plain paper (other pages print their content without the chrome) */
@media print {
  @page { margin: 16mm; }
  body, body.fx-on { background: #fff !important; color: #000; font-size: 12pt; }
  .fx-bg, .topbar, #banners, .no-print, .skip, footer.site, .toast, .actions, .pager { display: none !important; }
  .print-only { display: block; }
  main { padding: 0; max-width: none; }
  body.fx-on .card, .card { background: #fff !important; color: #000; box-shadow: none !important; backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important; border: 1px solid #999; break-inside: avoid; overflow: visible; }
  body.fx-on .card::before { display: none; }
  .hero h1, body.fx-on .hero h1, .hero p, body.fx-on .hero p { color: #000 !important; text-shadow: none !important; }
  .muted, .why { color: #333; }
  .std-card { border: 2px solid #000; border-radius: 12pt; padding: 16pt 20pt; max-width: 170mm; margin: 0 auto; }
  .std-card h1 { font-size: 22pt; margin: 0 0 10pt; }
  .std-card ol { margin: 0; padding-left: 18pt; }
  .std-card li { margin: 0 0 12pt; break-inside: avoid; }
  .std-card .old { display: block; font-size: 10.5pt; color: #333; }
  .std-card .new { display: block; min-height: 2.6em; font-family: var(--serif); font-size: 14pt; border-bottom: 1px solid #999;
    white-space: pre-wrap; }
  .std-card .from { font-size: 9.5pt; color: #333; margin: 14pt 0 0; }
}
