/* shared/style.css -- one stylesheet for every tool site.
   System fonts only (no font download, no FOUT, no layout shift). Ad slots
   reserve their height from day one so switching ads on later moves nothing. */
:root {
  --bg: #fafaf9; --fg: #1c1917; --muted: #57534e; --line: #e7e5e4;
  --card: #ffffff; --accent: #1d4ed8; --accent-fg: #ffffff; --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
  --radius: 10px; --maxw: 860px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c0a09; --fg: #f5f5f4; --muted: #a8a29e; --line: #292524; --card: #1c1917; --accent: #60a5fa; --accent-fg: #0c0a09; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 1.4em 0 .5em; }
h1 { font-size: 2rem; margin-top: .6em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p, li { max-width: 70ch; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; }
table { border-collapse: collapse; width: 100%; max-width: 100%; display: block; overflow-x: auto; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 600; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1rem; }
header.site { border-bottom: 1px solid var(--line); background: var(--card); }
header.site .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; min-height: 56px; }
header.site .brand { font-weight: 700; text-decoration: none; color: var(--fg); font-size: 1.1rem; }
header.site nav a { text-decoration: none; color: var(--muted); font-size: .95rem; padding: .25rem 0; }
header.site nav a[aria-current="page"] { color: var(--fg); border-bottom: 2px solid var(--accent); }
header.site nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
main { padding-bottom: 3rem; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 70ch; }
footer.site { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; padding: 1.5rem 0 2.5rem; }
footer.site a { color: var(--muted); }
footer.site nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-bottom: .75rem; }

/* ----- the tool card: visible on load, usable before JS ----- */
.tool { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 1rem 0 1.5rem; }
.tool fieldset { border: 0; padding: 0; margin: 0 0 .75rem; min-width: 0; }
.tool legend { font-weight: 600; padding: 0; margin-bottom: .4rem; }
.tool label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .15rem; }
.tool input[type=number], .tool input[type=text], .tool select {
  width: 100%; font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--fg); min-height: 42px; }
.tool input:focus, .tool select:focus, .tool button:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
.row { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); align-items: end; margin-bottom: .5rem; }
.row.course { grid-template-columns: minmax(140px, 2fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(110px, 1fr) 44px; }
.row.assign { grid-template-columns: minmax(140px, 2fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(90px, 1fr) 44px; }
.row.category { grid-template-columns: minmax(140px, 2fr) minmax(90px, 1fr) minmax(90px, 1fr) 44px; }
@media (max-width: 560px) {
  .row.course, .row.assign, .row.category { grid-template-columns: 1fr 1fr; }
  .row .remove { grid-column: 2; justify-self: end; }
}
.tool button { font: inherit; font-weight: 600; padding: .55rem .9rem; border-radius: 6px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); cursor: pointer; min-height: 42px; }
.tool button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.tool button.remove { padding: 0; width: 42px; }
.tool .actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: .25rem 0 .75rem; }
.tool .opts { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; margin: .5rem 0 .75rem; }
.tool .opts label { margin: 0; }
.tool .opts > div { min-width: 140px; flex: 1; }

/* result: fixed minimum height so the number appearing never shifts the page */
.result { min-height: 92px; border-top: 1px solid var(--line); padding-top: .75rem; display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: baseline; }
.result .big { font-size: 2.4rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.result .letter { font-size: 1.6rem; font-weight: 700; }
.result .note { color: var(--muted); font-size: .95rem; flex-basis: 100%; min-height: 1.5em; margin: 0; }
.result .ok { color: var(--ok); } .result .warn { color: var(--warn); } .result .bad { color: var(--bad); }
.pair { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pair .big { font-size: 2rem; }
.pair .cap { color: var(--muted); font-size: .9rem; }

/* ----- ad slots: reserved now, filled later. CLS stays at zero. ----- */
.ad { display: block; width: 100%; margin: 1.25rem 0; border-radius: 6px; }
.ad.top { min-height: 100px; }
.ad.mid { min-height: 250px; }
@media (min-width: 728px) { .ad.top { min-height: 90px; } }
.ad:empty { background: transparent; }

.faq details { border-bottom: 1px solid var(--line); padding: .6rem 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: .5rem 0 0; }
.chart { columns: 2; column-gap: 2rem; }
@media (min-width: 640px) { .chart { columns: 3; } }
.chart table { display: table; width: auto; break-inside: avoid; }
.print-only { display: none; }
@media print {
  header.site, footer.site, .ad, .no-print, .content, .faq { display: none !important; }
  .tool { border: 0; padding: 0; }
  .print-only { display: block; }
  body { font-size: 12pt; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ----- one-question-at-a-time tools ----- */
.wizard .how { margin: 0 0 .75rem; color: var(--muted); font-size: .95rem; }
.wizard .steps { list-style: none; margin: 0; padding: 0; }
.wizard .step { padding: .75rem 0; border-top: 1px solid var(--line); }
.wizard .step:first-child { border-top: 0; padding-top: 0; }
.wizard .q label { display: block; font-size: 1.1rem; font-weight: 600; color: var(--fg); margin-bottom: .5rem; }
.wizard .n { display: inline-block; width: 1.6em; height: 1.6em; line-height: 1.6em; text-align: center; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg); font-size: .85rem; margin-right: .4rem; vertical-align: 2px; }
.wizard .field { display: flex; align-items: center; gap: .5rem; max-width: 420px; }
.wizard .field input { max-width: 180px; }
.wizard .field .next { white-space: nowrap; }
.wizard .field input { font-size: 1.3rem; }
.wizard .unit { color: var(--muted); font-weight: 600; }
.wizard .hint { margin: .4rem 0 0; color: var(--muted); font-size: .9rem; }
.wizard .a { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.wizard .a .label { color: var(--muted); }
.wizard .a .value { font-size: 1.05rem; }
.wizard .a .change { padding: .2rem .6rem; min-height: 32px; font-size: .9rem; font-weight: 500; }
.wizard .result { margin-top: .75rem; }
.wizard .lead-in { flex-basis: 100%; color: var(--muted); margin-bottom: -.5rem; }

.tool.equal-mode .wcol { opacity: .45; }

/* ----- wavelength site extras ----- */
.tool .hint { color: var(--muted); font-size: .9rem; margin: 0 0 .5rem; }
.result table.lengths { display: table; width: auto; flex-basis: 100%; }
.result table.lengths th { color: var(--muted); font-weight: 500; }
.result table.lengths td { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ----- running tools: timer, stopwatch, pomodoro, countdown ----- */
.tool.timer { text-align: center; }
.tool.timer .clock { font-size: clamp(3.5rem, 18vw, 8rem); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; min-height: 1em; margin: .5rem 0 .25rem; }
.tool.timer .clock small { font-size: .4em; font-weight: 500; color: var(--muted); }
.tool.timer .clock.done { color: var(--bad); }
.tool.timer .bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: .5rem auto 1rem; max-width: 520px; }
.tool.timer .fill { height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.tool.timer .controls { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1rem; }
.tool.timer .big-btn { min-width: 110px; min-height: 52px; font-size: 1.1rem; }
.tool.timer .big-btn[aria-label] { min-width: 52px; }
.tool.timer .setrow { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; text-align: left; max-width: 640px; margin: 0 auto .75rem; }
.tool.timer .setrow > div { display: flex; flex-direction: column; justify-content: flex-end; }
.tool.timer .presets { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; margin-bottom: .75rem; }
.tool.timer .preset { padding: .35rem .7rem; min-height: 36px; font-weight: 500; font-size: .9rem; }
.tool.timer .note { text-align: center; color: var(--muted); font-size: .95rem; min-height: 1.5em; margin: 0 auto; }
.tool.timer .phase { color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .85rem; }
.tool.timer:fullscreen { display: flex; flex-direction: column; justify-content: center; border: 0; border-radius: 0; background: var(--bg); }
.tool.timer:fullscreen .clock { font-size: clamp(6rem, 28vw, 22rem); }
.tool.timer:fullscreen .setrow, .tool.timer:fullscreen .presets, .tool.timer:fullscreen .laps { display: none; }
table.laps, table.facts { display: table; width: auto; margin: .5rem auto 0; }
table.laps td, table.laps th { font-variant-numeric: tabular-nums; }
table.facts th { color: var(--muted); font-weight: 500; }
.result table.facts { flex-basis: 100%; margin: 0; }
.big.small { font-size: 1.5rem; }
.cd { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; max-width: 640px; margin: .5rem auto 1rem; }
.cd div { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .75rem .25rem; }
.cd .n { display: block; font-size: clamp(1.8rem, 7vw, 3rem); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cd .u { display: block; color: var(--muted); font-size: .85rem; }
.tool textarea { width: 100%; font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
.row.trow { grid-template-columns: 1fr 44px; max-width: 360px; }
table.world { display: table; width: 100%; table-layout: fixed; }
table.world td.t { width: 52%; } table.world td.o { width: 20%; }
table.world td { white-space: normal; }
.result.tz { min-height: 168px; align-content: start; }
.result.tz .outwrap { flex-basis: 100%; min-height: 2.6em; }
.result.tz .big { font-size: 1.7rem; line-height: 1.25; }
.result.tz .letter { font-size: 1.1rem; min-height: 1.5em; flex-basis: 100%; }

/* ----- bookmark line under a tool ----- */
.bookmark { margin: -.75rem 0 1rem; text-align: center; color: var(--muted); font-size: .9rem; min-height: 1.6em; }
.bookmark button { font: inherit; font-size: .9rem; color: var(--accent); background: none; border: 0; padding: .2rem .3rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.bookmark button:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-radius: 4px; }

/* ----- clockincalc extras ----- */
table.tc { display: table; width: 100%; margin: .25rem 0 .75rem; }
table.tc th[scope=row] { color: var(--muted); font-weight: 500; white-space: nowrap; }
table.tc td { padding: .25rem .3rem; white-space: normal; }
table.tc input { min-height: 40px; padding: .4rem .5rem; min-width: 5.5em; }
table.tc td.hrs { font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 7em; }
@media (max-width: 560px) {
  table.tc, table.tc tbody { display: block; } table.tc thead { display: none; }
  table.tc tr.day { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .35rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
  table.tc th[scope=row] { grid-column: 1 / -1; color: var(--fg); font-weight: 600; padding: 0; }
  table.tc td { border: 0; padding: 0; }
  table.tc td[data-col]::before { content: attr(data-col); display: block; font-size: .75rem; color: var(--muted); margin-bottom: .15rem; }
  table.tc td.hrs { grid-column: 1 / -1; display: flex; gap: .5rem; align-items: baseline; } table.tc td.hrs::before { margin: 0; }
  table.tc input { min-width: 0; width: 100%; }
}
.tool details.more { margin: .25rem 0 .75rem; } .tool details.more summary { cursor: pointer; color: var(--accent); font-weight: 600; } .tool details.more .row { margin-top: .6rem; }
.result .lead-in { color: var(--muted); font-size: .95rem; }
@media print { .tool.print-card { border: 0; } }

/* ----- unscramblist ----- */
.tool .rack .biglabel { font-size: 1.05rem; font-weight: 600; color: var(--fg); }
.tool .rack .field { display: flex; gap: .5rem; max-width: 560px; }
.tool .rack .field input { font-size: 1.4rem; letter-spacing: .12em; text-transform: lowercase; }
.tool .rack .field button { white-space: nowrap; }
.tool label.inline { display: inline-flex; gap: .4rem; align-items: center; color: var(--fg); font-size: .95rem; }
.result.words { display: block; min-height: 120px; }
.wordlist .wgroup h3 { margin: 1rem 0 .4rem; font-size: 1rem; } .wordlist .count { color: var(--muted); font-weight: 400; }
.wordlist ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.wordlist li { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .55rem; font-size: 1rem; display: inline-flex; gap: .45rem; align-items: baseline; }
.wordlist li.blank .w { text-decoration: underline dotted; }
.wordlist .pts { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.tool.wordle .grid { display: grid; gap: .35rem; justify-content: center; margin: .5rem 0 .75rem; }
.tool.wordle .wrow { display: flex; gap: .35rem; }
.tool.wordle .cell { width: 54px; height: 54px; text-align: center; font-size: 1.5rem; font-weight: 700; text-transform: uppercase; padding: 0; border: 2px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer; caret-color: transparent; }
.tool.wordle .cell:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
.tool.wordle .gcell[data-state=grey]:not(:placeholder-shown) { background: #787c7e; border-color: #787c7e; color: #fff; }
.tool.wordle .cells { display: flex; gap: .35rem; margin-bottom: .25rem; } .tool.wordle fieldset { margin-bottom: .75rem; } .tool.wordle legend { font-weight: 600; margin-bottom: .35rem; }
.tool.wordle .cell.green:not(:placeholder-shown) { background: #6aaa64; border-color: #6aaa64; color: #fff; } .tool.wordle .cell.yellow:not(:placeholder-shown) { background: #c9b458; border-color: #c9b458; color: #fff; }
.tool.wordle .cell.green, .tool.wordle .cell.yellow { border-style: dashed; } .tool.wordle .cell.green:not(:placeholder-shown), .tool.wordle .cell.yellow:not(:placeholder-shown) { border-style: solid; }
.tool.wordle #greys { max-width: 300px; letter-spacing: .15em; }
.tool.wordle .gcell[data-state=yellow] { background: #c9b458; border-color: #c9b458; color: #fff; }
.tool.wordle .gcell[data-state=green] { background: #6aaa64; border-color: #6aaa64; color: #fff; }
.tool.wordle .actions { justify-content: center; }
@media (max-width: 360px) { .tool.wordle .cell { width: 46px; height: 46px; } }
