/* Irish verb practice: an Irish school copybook (cóipleabhar). Cool white paper with faint blue rules on the sheet,
   bottle-green ink for the one accent, book serif headings. The ruled sheet is the only decorated thing; the rest
   stays flat. */
:root {
  --bg: #f4f6f8; --paper: #ffffff; --ink: #17211c; --muted: #4a5651; --line: #d6dde3; --line2: #7d8a86;
  --accent: #1d5c40; --accent-ink: #ffffff; --accent-soft: #e2efe8; --rule: #c9d9ec;
  --ok: #1b6b3a; --ok-soft: #e1f1e6; --bad: #a3261b; --bad-soft: #fbe4e1; --warn: #6b4d00; --warn-soft: #f6ecd0;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --head: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --r: 4px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121a17; --paper: #18221e; --ink: #e5ece8; --muted: #b2c0b9; --line: #2b3832; --line2: #6f7f78;
    --accent: #86d1a8; --accent-ink: #0d1a14; --accent-soft: #1f3129; --rule: #26363a;
    --ok: #86d5a2; --ok-soft: #15301f; --bad: #ff9b8f; --bad-soft: #3d1f1b; --warn: #efc46a; --warn-soft: #382e15;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 9; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--head); line-height: 1.15; font-weight: 700; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.hero { padding: 20px 0 2px; }
.hero h1 { font-size: clamp(1.75rem, 5.2vw, 2.6rem); margin: 0 0 6px; }
.lede { margin: 0; max-width: 66ch; }

/* the choices */
.setup { margin: 14px 0 10px; display: grid; gap: 6px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 650; padding: 0; margin-bottom: 4px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr); }
.chips { display: flex; flex-wrap: wrap; gap: 6px 8px; }
@media (max-width: 480px) { .chip { font-size: 16px; padding-right: 8px; } .hero { padding-top: 12px; } }
.chip, .vchip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 12px 4px 8px; border: 1px solid var(--line2);
  border-radius: var(--r); background: var(--paper); cursor: pointer; }
.chip input, .vchip input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.chip:has(input:checked), .vchip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.vchip { min-height: 44px; padding: 2px 10px 2px 6px; }
details.pick, details.more { margin-top: 2px; }
details.pick > summary, details.more > summary { cursor: pointer; color: var(--accent); font-weight: 600; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.vcount { color: var(--muted); font-weight: 400; }
.vgroup { margin: 4px 0 10px; }
.vgroup legend { font-weight: 600; color: var(--muted); }
.vchips { display: flex; flex-wrap: wrap; gap: 6px; }
details.more .row { margin: 4px 0 8px; }
.setrow { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-top: 4px; }
.inline { display: flex; align-items: center; gap: 8px; font-weight: 650; }
select, input { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--line2); border-radius: var(--r); }
select { min-height: 44px; padding: 6px 10px; max-width: 100%; min-width: 0; }
.btn { font: inherit; min-height: 44px; padding: 8px 16px; border-radius: var(--r); border: 1px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { padding: 6px 14px; }
.btn:hover { filter: brightness(0.96); }
.link { font: inherit; background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 10px 4px; min-height: 44px; }
.note { margin: 8px 0; padding: 10px 12px; background: var(--warn-soft); border-radius: var(--r); overflow-wrap: anywhere; }
.note.info { background: var(--accent-soft); }

/* the sheet: a copybook page */
.sheet { background: var(--paper); border: 1px solid var(--line); padding: 12px 20px 16px; margin: 8px 0 18px; }
@media (max-width: 480px) { .sheet { padding: 10px 12px 14px; margin-left: -8px; margin-right: -8px; } }
.sheet:focus { outline: none; }
.sheet-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.sheet-head h2 { margin: 0; font-size: 1.35rem; }
.code { font-family: var(--mono); letter-spacing: 0.06em; }
.lvname { font-family: var(--sans); font-weight: 500; color: var(--muted); font-size: 1rem; }
.score { margin: 0; color: var(--muted); }
details.rules summary, details.work summary, details.recent summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; color: var(--accent); }
details.rules ul { margin: 4px 0 10px; padding-left: 20px; max-width: 78ch; }
details.rules li { margin: 0 0 6px; }

.qs { list-style: none; margin: 0; padding: 0; }
.q { padding: 10px 0 8px; border-top: 1px solid var(--rule); }
.cue { margin: 0; color: var(--muted); }
.qn { font-family: var(--head); font-weight: 700; color: var(--ink); margin-right: 4px; }
.qn::after { content: "."; }
.cuet { font-style: italic; }
.sent { margin: 4px 0 0; font-size: 1.12rem; line-height: 1.6; overflow-wrap: anywhere; }
.cw { display: inline-flex; align-items: center; gap: 2px; vertical-align: middle; max-width: 100%; margin: 2px 0; }
.cell { width: 13.5em; max-width: calc(100vw - 110px); min-height: 40px; padding: 4px 8px; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0;
  background: color-mix(in srgb, var(--accent-soft) 30%, transparent); font-size: 1.05rem; }
.cell:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 2px 0 var(--accent); }
.cell:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.cell.is-right { border-color: var(--ok); background: var(--ok-soft); }
.cell.is-close { border-color: var(--warn); background: var(--warn-soft); }
.cell.is-wrong, .cell.is-unread { border-color: var(--bad); background: var(--bad-soft); }
.mk:empty { display: none; }
.mk { flex: 0 0 1.2em; font-weight: 800; text-align: center; line-height: 1; }
.mk-right { color: var(--ok); } .mk-close { color: var(--warn); } .mk-wrong, .mk-unread { color: var(--bad); }
.qrow { display: flex; flex-wrap: wrap; gap: 0 14px; align-items: flex-start; margin-top: 4px; }
.qrow details.work { flex: 1 1 10em; min-width: 0; }
.fb { margin: 4px 0 0; }
.fb.right b { color: var(--ok); } .fb.close b { color: var(--warn); } .fb.wrong b, .fb.unread b { color: var(--bad); }
.keyfig { margin: 0 0 6px; }
.keyfig p { margin: 0 0 2px; }
.ksent b { color: var(--accent); }
.kalso, .ktense { color: var(--muted); }

.sheet-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 12px; border-top: 1px solid var(--rule); padding-top: 12px; }
.confirm { flex-basis: 100%; margin: 0; }
.save-hint { flex-basis: 100%; margin: 0; color: var(--muted); }

.share { margin: 0 0 22px; }
.share:empty { display: none; }
details.popts .print-row { margin: 2px 0 8px; }
.print-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.print-row label { display: flex; flex-direction: column; gap: 2px; font-weight: 650; min-width: 0; max-width: 100%; }
.share-out label { display: flex; flex-direction: column; font-weight: 600; }
.share-out input { min-height: 44px; padding: 6px 10px; width: 100%; }
.recent ul { list-style: none; padding: 0; margin: 0; }
.recent li { display: flex; justify-content: space-between; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding: 4px 0; }
.recent .when { display: block; color: var(--muted); }
.hint { color: var(--muted); }

.content { max-width: 72ch; padding-bottom: 20px; }
.content h2 { font-size: 1.5rem; margin: 28px 0 8px; }
.twrap { overflow-x: auto; }
.dt { border-collapse: collapse; width: 100%; background: var(--paper); }
.dt th, .dt td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.dt thead th { border-bottom: 2px solid var(--ink); font-family: var(--sans); }
.dt tbody th { font-weight: 650; }
/* phones: each verb on its own rows, Ceist under Ráiteas, every cell labelled */
@media (max-width: 420px) {
  .dt thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .dt tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line); padding: 4px 0 6px; }
  .dt tbody th { grid-column: 1 / -1; border: 0; padding: 4px 6px 0; }
  .dt tbody td { border: 0; padding: 2px 6px; }
  .dt td::before { content: attr(data-label); display: block; color: var(--muted); }
}
.faq details { border-top: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 650; padding: 10px 0; min-height: 44px; }
.faq p { margin: 0 0 12px; }
.sources { color: var(--muted); overflow-wrap: anywhere; }

footer { border-top: 1px solid var(--line); padding: 14px 0 28px; color: var(--muted); }
.indep { margin: 6px 0; }
.sb-footer p { margin: 6px 0; }
.sb-more { overflow-wrap: anywhere; }
.sb-footer a { color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); max-width: min(92vw, 560px); background: var(--ink); color: var(--bg);
  padding: 10px 14px; border-radius: var(--r); opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; }
.toast.top { bottom: auto; top: 16px; }
.toast.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.print-root { display: none; }

/* ---------- paper ---------- */
@page { margin: 12mm 12mm 12mm 12mm; }
@media print {
  body { background: #fff; color: #000; font: 11pt/1.4 var(--sans); }
  body > main, footer, .skip, .toast { display: none !important; }
  .print-root { display: block; }
  .psheet, .pkey { break-after: page; }
  .print-root > section:last-child { break-after: auto; }
  .prun { font-size: 10pt; color: #333; margin: 0 0 1.5mm; }
  .ph h2 { font: 700 17pt var(--head); margin: 0 0 2.5mm; }
  .pmeta { display: flex; flex-wrap: wrap; gap: 2mm 10mm; margin: 0 0 3mm; font-size: 11pt; }
  .pinst { margin: 0 0 3mm; font-size: 10.5pt; }
  .pq { list-style: none; margin: 0; padding: 0; }
  .pq li { break-inside: avoid; display: grid; grid-template-columns: 7mm 50mm minmax(0, 1fr); align-items: baseline;
    padding: 1.6mm 0 1.2mm; border-top: 0.4pt solid #9ab; font-size: 11.5pt; line-height: 1.65; }
  .pn { font-weight: 700; }
  .pcue { font-style: italic; color: #222; font-size: 10.5pt; padding-right: 2mm; }
  .gap { display: inline-block; width: 64mm; border-bottom: 0.7pt solid #000; height: 1em; vertical-align: -0.2em; }
  .prun.cont { border-bottom: 0.6pt solid #000; padding-bottom: 1.5mm; margin: 0 0 1mm; }
  .prun.cont + ol > li:first-child { border-top: 0; }
  .pkey .ph h2 { margin-bottom: 2mm; }
  .prules { break-inside: avoid; margin: 0 0 3mm; padding: 1mm 0 2mm; border-top: 0.6pt solid #000; border-bottom: 0.6pt solid #000; font-size: 10pt; }
  .prules h3 { font-size: 10.5pt; margin: 1.5mm 0 1mm; font-family: var(--sans); }
  .prules ul { margin: 0; padding-left: 5mm; }
  .pk { list-style: none; margin: 0; padding: 0; font-size: 10pt; line-height: 1.35; }
  .pk li { break-inside: avoid; padding: 0.8mm 0; border-top: 0.4pt solid #bbb; }
  .pk b { font-weight: 700; }
  .palso { color: #333; font-size: 10pt; }
  .prules + ol > li:first-child { border-top: 0; }
  .nw { white-space: nowrap; }
}
