/* wordfig.com: deep teal and amber. Amber fails text contrast on white, so teal carries all text and amber is only an accent on teal or a non-text mark.
   Same shell as calcfig and handyfig. Mobile first, no web fonts. */
:root {
  --navy: #0B4552; --navy-2: #146B7C; --gold: #1B8296; --gold-deep: #0F5C6E; --gold-soft: #E6F4F6; --sage: #FFC24B; --sage-deep: #7A4F00;
  --grey: #F3F9FA; --line: #CFE3E7; --ink: #14262B; --muted: #4A6169; --white: #fff;
  --surface: #fff; --bar: #08333D; --on-navy: #fff; --adbg: #E4F0F2; --adline: #AFC9CF;
  --radius: 16px; --shadow: 0 1px 2px rgba(8,51,61,.07), 0 6px 20px rgba(8,51,61,.07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 1.0625rem; line-height: 1.6; color: var(--ink); background: var(--grey); }
a { color: var(--navy-2); text-underline-offset: 2px; }
a:hover { color: var(--navy); }
h1, h2, h3 { line-height: 1.2; color: var(--navy); }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.35rem); margin: .3em 0 .35em; letter-spacing: -.01em; }
h2 { font-size: 1.35rem; margin: 1.2em 0 .5em; }
h3 { font-size: 1.1rem; margin: 1.2em 0 .4em; }
.h-small { font-size: 1.05rem; margin: 0 0 .6em; }
.small, .hint { font-size: .9rem; color: var(--muted); }
.hint { margin: .35em 0 0; }
.lede { font-size: 1.12rem; color: var(--muted); margin-top: 0; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* header */
.site-header { background: var(--bar); color: var(--white); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; }
.brand .fig-mark { box-shadow: 0 0 0 1px rgba(255,255,255,.18); border-radius: 9px; }
.brand:hover, .brand:focus-visible { color: var(--white); }
.wordmark { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; }
.wordmark b { color: #FFC24B; font-weight: 700; }
.footer-brand b { color: var(--navy-2); font-weight: 700; }
.main-nav { display: flex; gap: 4px; flex-wrap: nowrap; order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a { color: #DCEFF3; text-decoration: none; padding: 8px 12px; border-radius: 999px; font-size: .95rem; font-weight: 600; white-space: nowrap; }
.main-nav a:hover { background: rgba(255,255,255,.1); color: var(--white); }
.main-nav a[aria-current] { color: var(--white); box-shadow: inset 0 -3px 0 #FFC24B; border-radius: 0; }
.region { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; background: rgba(255,255,255,.1); border-radius: 999px; padding: 3px; }
.region a { color: #DCEFF3; text-decoration: none; font-weight: 600; font-size: .9rem; padding: 6px 11px; border-radius: 999px; min-width: 44px; text-align: center; }
.region a[aria-current] { background: #fff; color: #08333D; }
@media (min-width: 700px) { .main-nav { order: 0; width: auto; } }
@media (max-width: 520px) { .header-inner { gap: 8px 8px; } .wordmark { font-size: 1.2rem; } .region a { padding: 6px 8px; min-width: 36px; } .brand { gap: 7px; } }

/* layout: one centred column (about 780 px); a sticky ad column only appears at 1100 px and wider when a side ad is live */
.layout { display: grid; gap: 32px; padding-top: 8px; padding-bottom: 48px; max-width: 780px; }
.sidebar { display: none !important; }
@media (min-width: 1100px) {
  .has-side-ad .layout { grid-template-columns: minmax(0, 1fr) 300px; max-width: 1140px; }
  .has-side-ad .sidebar { display: block !important; }
}
.content { min-width: 0; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 0 0 24px; }
@media (min-width: 640px) { .card { padding: 26px; } }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 10px 0 0; font-size: .88rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: #8FB4BE; }
.crumbs a { color: var(--muted); }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { padding: 6px 0; border-bottom: 1px solid var(--grey); }
.link-list li:last-child { border-bottom: 0; }

/* ads: space reserved only when an ad is actually shown */
.ad { margin: 12px 0 20px; text-align: center; }
.ad-side { min-height: 600px; position: sticky; top: 16px; margin-top: 0; }
.ad-content, .ad-end { min-height: 250px; }
.ad-preview { display: grid; place-items: center; border: 2px dashed var(--adline); border-radius: 12px; background: var(--adbg); color: var(--muted); font-size: .9rem; }
.ad-preview::before { content: attr(data-label); }
.ad-content { margin-top: 36px; }

/* home */
.tool-grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin-bottom: 20px; }
@media (min-width: 600px) { .tool-grid { grid-template-columns: 1fr 1fr; } }
.tool-card { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; text-decoration: none; color: var(--ink); margin: 0; transition: transform .15s ease, box-shadow .15s ease; }
.tool-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(8,51,61,.09), 0 12px 28px rgba(8,51,61,.11); }
.tool-icon { grid-row: span 2; }
.tool-name { font-weight: 700; color: var(--navy); font-size: 1.08rem; }
.tool-blurb { color: var(--muted); font-size: .95rem; }
.section-label { font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sage-deep); margin: 26px 0 10px; }
.section-label::before { content: ""; display: inline-block; width: 18px; height: 3px; border-radius: 2px; background: var(--sage); margin-right: 8px; vertical-align: middle; }

/* forms */
.field { margin: 0 0 18px; }
label, .label { display: block; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
input[type=text], select {
  font: inherit; font-size: 1.15rem; width: 100%; min-height: 52px; padding: 10px 14px; color: var(--ink);
  background: var(--surface); border: 2px solid var(--line); border-radius: 12px; transition: border-color .15s, box-shadow .15s;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--navy) 50%), linear-gradient(135deg, var(--navy) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
input[type=text]:focus, select:focus { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(27,130,150,.28); outline: none; }
.affix { display: flex; align-items: stretch; }
.affix .pre, .affix .post { display: grid; place-items: center; padding: 0 14px; background: var(--grey); border: 2px solid var(--line); color: var(--muted); font-weight: 600; font-size: 1.1rem; white-space: nowrap; }
.affix .post { border-left: 0; border-radius: 0 12px 12px 0; }
.affix input:has(+ .post) { border-radius: 12px 0 0 12px; min-width: 0; flex: 1 1 auto; }
.field-row { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@supports (grid-template-rows: subgrid) {
  .field-row > .field { display: grid; grid-template-rows: subgrid; grid-row: span 3; }
  .field-row > .field[hidden] { display: none; }
}
.field-row > .field { min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 18px; }
.chip { font: inherit; font-size: .95rem; font-weight: 600; min-height: 40px; min-width: 56px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--navy); cursor: pointer; }
.chip:hover { border-color: var(--navy); }
.chip[aria-pressed=true] { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; background: var(--grey); padding: 5px; border-radius: 14px; margin: 0 0 18px; }
.seg label { flex: 1 1 auto; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--muted); min-height: 44px; }
.seg input:checked + span { background: var(--surface); color: var(--navy); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 3px solid var(--gold); }
.field > .seg { margin-bottom: 0; }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; }

/* from, swap, to */
.convert-row { display: grid; gap: 0 12px; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; margin: 0 0 6px; }
.swap { font: inherit; width: 52px; min-height: 52px; margin: 0 0 18px; border-radius: 50%; border: 2px solid var(--navy); background: var(--navy); color: var(--on-navy); cursor: pointer; display: grid; place-items: center; }
.swap:hover { background: var(--navy-2); border-color: var(--navy-2); }
.swap svg { display: block; }
@media (max-width: 520px) {
  .convert-row { grid-template-columns: 1fr; }
  .swap { justify-self: center; margin: -6px 0 12px; transform: rotate(90deg); }
}

/* result */
.result { margin: 12px 0 0; padding: 20px; border-radius: 14px; background: var(--gold-soft); }
.result-grid { display: flex; flex-direction: column; gap: 6px; }
.r { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.r-label { font-size: .95rem; color: var(--muted); }
.r output { font-size: 1.1rem; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; text-align: right; word-break: break-word; }
.r-main { order: -1; flex-direction: column; align-items: flex-start; gap: 0; padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.r-main .r-label { font-weight: 600; }
.r-main output { font-size: 2.4rem; font-weight: 700; text-align: left; line-height: 1.15; }
.result-note { margin: 10px 0 0; font-size: .95rem; color: var(--ink); }
.result-note:empty { display: none; }
.result figcaption { font-size: .85rem; color: var(--muted); margin-top: 10px; text-align: left; }
.fig-no { font-weight: 700; color: var(--gold-deep); margin-right: 4px; }
.pop { animation: pop .32s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { from { opacity: .2; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pop { animation: none; } .tool-card { transition: none; } }
.working { margin: 12px 0 0; font-size: .92rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.working:empty { display: none; }
.checked { font-size: .88rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0; }
.act { font: inherit; font-size: .92rem; font-weight: 600; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--navy); cursor: pointer; }
.act:hover { border-color: var(--navy); }
.act-status { font-size: .9rem; color: var(--gold-deep); font-weight: 600; }
.feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 0; font-size: .95rem; color: var(--muted); }
.feedback .act { min-height: 36px; padding: 4px 14px; }
.fb-thanks { color: var(--navy); }
.trust { font-size: .85rem; color: var(--muted); margin: 8px 0 0; }
.assumptions { margin: 0 0 18px; font-size: .95rem; }
.assumptions summary { cursor: pointer; color: var(--navy-2); font-weight: 600; }
.assumptions[open] summary { margin-bottom: 8px; }
.assumptions p { margin: 0 0 .7em; }

/* comparison tables */
.compare { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
.compare table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .97rem; }
.compare th, .compare td { padding: 8px 6px; border-bottom: 1px solid var(--grey); text-align: right; white-space: nowrap; }
.compare th:first-child { text-align: left; }
.compare thead th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; white-space: normal; }
.compare tbody th { font-weight: 600; color: var(--navy); }
.compare tr.current th, .compare tr.current td { background: var(--gold-soft); }
.compare-cap { font-size: .85rem; color: var(--muted); margin: 8px 0 0; }

/* diagrams (Fig. 1 in guides) */
.diagram { margin: 0 0 14px; }
.diagram svg { width: 100%; height: auto; max-width: 520px; display: block; margin: 0 auto; }
.diagram svg .d-line { stroke: var(--navy); fill: none; stroke-width: 1.6; }
.diagram svg .d-fill { fill: var(--gold-soft); stroke: var(--navy); stroke-width: 1.6; }
.diagram svg .d-hot { fill: var(--sage); stroke: var(--navy); stroke-width: 1.6; }
.diagram svg .d-dim { stroke: var(--navy-2); stroke-width: 1.2; fill: none; }
.diagram svg text { fill: var(--navy); font-family: var(--font); font-size: 12px; }
.diagram figcaption { font-size: .85rem; color: var(--muted); margin-top: 6px; }

/* guide */
.guide p, .prose p { margin: 0 0 .9em; }
.guide h2:first-child, .prose h2:first-child { margin-top: 0; }
.guide table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 0 0 1em; }
.guide th, .guide td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--grey); }
.faq { border-bottom: 1px solid var(--grey); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--navy); list-style-position: outside; }
.faq p { margin: 8px 0 0; }
.leaf-rule { border: 0; height: 24px; margin: 24px 0 8px; background:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 24'%3E%3Cpath d='M20 22c0-6 0-9-4-13-3-2-7-2-8-1 1 5 4 7 8 8-4 0-6-1-8-2 0 4 4 6 8 6h4zm0 0c0-6 0-9 4-13 3-2 7-2 8-1-1 5-4 7-8 8 4 0 6-1 8-2 0 4-4 6-8 6h-4z' fill='%23B4E33D'/%3E%3C/svg%3E") center / 40px 24px no-repeat,
  linear-gradient(var(--line), var(--line)) center / 100% 1px no-repeat; }
.disclaimer { margin: 14px 0 0; padding: 12px 14px; border-left: 3px solid var(--gold); background: var(--surface); border-radius: 0 10px 10px 0; color: var(--muted); }
.disclaimer strong { color: var(--navy); }

/* footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 26px 0 30px; }
.footer-inner { display: grid; gap: 10px; }
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--navy); flex-wrap: wrap; }
.footer-line { font-weight: 400; font-style: italic; color: var(--muted); font-size: .95rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-footer nav a, .site-footer nav button { color: var(--navy-2); font-size: .95rem; }

/* theme toggle (shown by app.js) */
.theme-toggle { margin-left: auto; width: 40px; height: 40px; display: inline-grid; place-items: center; border: 0; border-radius: 999px; background: rgba(255,255,255,.1); color: #DCEFF3; cursor: pointer; }
.theme-toggle:hover { background: rgba(255,255,255,.18); color: #fff; }
.region + .theme-toggle { margin-left: 0; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }

/* dark theme */
:root[data-theme="dark"] {
  color-scheme: dark;
  --navy: #E3F3F6; --navy-2: #8FE0F0; --gold: #5CC0D6; --gold-deep: #8FE0F0; --gold-soft: #14303A; --sage: #FFC24B; --sage-deep: #FFC24B;
  --grey: #081317; --surface: #0F2228; --line: #1F4350; --ink: #E1F1F4; --muted: #A9C9D2;
  --on-navy: #0F2228; --adbg: #10262C; --adline: #2C5A68; --bar: #0B1A1E;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
}
:root[data-theme="dark"] .crumbs li + li::before { color: #6C98A4; }
:root[data-theme="dark"] input[type=text]:focus, :root[data-theme="dark"] select:focus { box-shadow: 0 0 0 4px rgba(92,192,214,.35); }
:root[data-theme="dark"] .region a[aria-current] { color: #08333D; }

/* static "to" box in the Roman numeral converter */
.static { min-height: 52px; display: flex; align-items: center; padding: 10px 14px; border: 2px dashed var(--line); border-radius: 12px; color: var(--muted); font-weight: 600; font-size: 1.05rem; margin: 0 0 18px; }
.cell { min-width: 0; }

/* Print: the result and charts only */
@media print {
  header, footer, nav, .actions, .feedback, .breadcrumb, .consent, .sister, .ad-slot { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .card { border: 0 !important; box-shadow: none !important; }
  a[href]::after { content: none !important; }
}

/* Home: working hero tool and the root directory */
.hero-tool { margin: 0 0 28px; }
.root-links { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 6px 18px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .root-links { grid-template-columns: 1fr 1fr; } }
.root-links a { display: inline-block; padding: 8px 0; min-height: 44px; }

/* Word tools */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.summary-line { margin: 0 0 8px; font-weight: 600; color: var(--navy); }
.results { max-height: 560px; overflow: auto; }
.grp { margin: 14px 0 6px; font-size: 1rem; }
.grp-n { color: var(--muted); font-weight: 400; font-size: .9rem; }
.words { display: flex; flex-wrap: wrap; gap: 6px; }
.word { font: inherit; font-size: .98rem; font-weight: 600; letter-spacing: .02em; padding: 6px 12px; min-height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); color: var(--navy); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.word:hover { border-color: var(--navy-2); }
.word .pts { font-size: .72rem; font-weight: 700; background: var(--gold-soft); color: var(--navy); border-radius: 999px; padding: 1px 7px; }
.empty { color: var(--muted); margin: 6px 0; }
.more { margin-top: 12px; }
.more summary { cursor: pointer; font-weight: 600; color: var(--navy); min-height: 40px; }
.guess-grid { display: grid; gap: 8px; margin: 0 0 6px; }
.guess-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.guess-row .guess-in { width: 8.5em; min-height: 44px; padding-top: 6px; padding-bottom: 6px; margin: 0; text-transform: uppercase; letter-spacing: .12em; }
.tiles { display: flex; gap: 6px; }
.tile { width: 44px; height: 44px; font: inherit; font-size: 1.15rem; font-weight: 800; text-transform: uppercase; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; padding: 0; }
.tile[data-state="g"] { background: #1B7A3E; border-color: #1B7A3E; color: #fff; }
.tile[data-state="y"] { background: #FFC24B; border-color: #FFC24B; color: #3A2600; }
.tile[data-state="x"] { background: #5B6B70; border-color: #5B6B70; color: #fff; }
.drawer { margin-top: 14px; padding: 16px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); }
.drawer h3 { margin: 0 0 6px; font-size: 1.15rem; }
.drawer p { margin: 4px 0; }
.drawer .words { margin: 6px 0; }
.wordlist { line-height: 2; word-spacing: .15em; }
.wordlist span { white-space: nowrap; }
.list-links { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 0 0 12px; }
.list-links a { min-height: 40px; display: inline-flex; align-items: center; }
.foot-lists { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.rates { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 0 0 1em; }
.rates caption { text-align: left; font-size: .9rem; color: var(--muted); padding-bottom: 6px; }
.rates th, .rates td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.examples { margin-bottom: 14px; }
.tool-icon { grid-row: span 2; align-self: center; }
@media (min-width: 700px) { .tool-grid { grid-template-columns: 1fr 1fr; } }
@media print { .drawer, .guess-in { display: none !important; } }
