/* Słówko — "letter grid & pencil loop": aubergine ink, lilac desk, word-search loops as the one motif. */
:root {
  --ink: #1f1530;
  --ink-2: #4d4060;
  --plum: #4b2a6b;
  --plum-2: #6b3f96;
  --plum-wash: #f2ecf8;
  --desk: #e8e2f0;
  --line: #d5cde0;
  --line-2: #b9b0c6;
  --paper: #fff;
  --bg: #fbfafd;
  --ok: #0d6e5f;
  --err: #a8201a;
  --err-wash: #fdf0ef;
  --focus: #0b7a8a;
  --f-head: "Gill Sans", "Gill Sans MT", Seravek, "Trebuchet MS", system-ui, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 12px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--f-body); }
a { color: var(--plum); text-underline-offset: 2px; }
a:hover { color: var(--plum-2); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--plum); color: #fff; padding: 10px 14px; border-radius: 4px; }
.skip:focus { top: 10px; }

/* ---------- top bar ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 28px; border-bottom: 1px solid var(--line); background: var(--paper); }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; color: var(--ink); }
.logo { display: grid; grid-template-columns: repeat(2, 18px); grid-template-rows: repeat(2, 18px); border: 1.5px solid var(--plum); border-radius: 3px; position: relative; }
.logo i { font: 700 12px/18px var(--f-body); font-style: normal; text-align: center; color: var(--plum); border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.logo i:nth-child(2n) { border-right: 0; }
.logo i:nth-child(n+3) { border-bottom: 0; }
.logo::after { content: ""; position: absolute; left: 1px; right: 1px; top: 2px; height: 14px; border: 2px solid var(--plum-2); border-radius: 9px; opacity: .55; }
.brand-name { font: 600 22px/1 var(--f-head); letter-spacing: .01em; }
.bar-nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.bar-nav a { color: var(--ink-2); text-decoration: none; font-size: 15px; padding: 8px 0; }
.bar-nav a:hover { color: var(--plum); text-decoration: underline; }

/* ---------- intro ---------- */
.intro { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 560px); align-items: end; gap: 12px 40px; padding: 22px 28px 18px; }
.intro h1 { margin: 0; font: 600 clamp(30px, 3.4vw, 44px)/1.08 var(--f-head); letter-spacing: -.01em; color: var(--ink); }
.intro p { margin: 0; color: var(--ink-2); font-size: 16px; }
.loop { position: relative; display: inline-block; padding: 0 .18em; color: var(--plum); }
.loop::before { content: ""; position: absolute; left: -.04em; right: -.04em; top: .02em; bottom: -.02em; border: 3px solid var(--plum-2); border-radius: 999px; transform: rotate(-1.6deg); opacity: .8; pointer-events: none; }

/* ---------- studio: words | sheet | settings ---------- */
.studio { display: grid; grid-template-columns: 330px minmax(0, 1fr) 300px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--paper); }
.pane { padding: 20px 22px 26px; min-width: 0; }
.pane-words { border-right: 1px solid var(--line); }
.pane-settings { border-left: 1px solid var(--line); }
.pane-sheet { background: var(--desk); padding: 14px 24px 24px; }
.step { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font: 600 21px/1.2 var(--f-head); }
.step-2, .step-4 { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.tile { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 1.5px solid var(--plum); border-radius: 3px; color: var(--plum); font: 700 15px/1 var(--f-body); background: var(--plum-wash); }
.aside { font: 400 13px/1.3 var(--f-body); color: var(--ink-2); }
label, .label, legend { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 15px; color: var(--ink); }
.label { margin-top: 0; }
input[type=text], input:not([type]), input[type=number], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 11px; font: 16px/1.4 var(--f-body); color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line-2); border-radius: 4px;
}
textarea { font-family: var(--f-mono); font-size: 15px; line-height: 1.55; resize: vertical; min-height: 220px;
  background-image: linear-gradient(var(--paper), var(--paper)); }
input:focus, select:focus, textarea:focus { border-color: var(--plum); }
input:disabled { background: #f4f2f7; color: #8a8096; }
.stats { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.problems { margin: 8px 0 0; padding: 0; list-style: none; }
.problems li { margin-top: 6px; padding: 8px 10px; background: var(--err-wash); border-left: 3px solid var(--err); color: var(--err); font-size: 14px; }
.note { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; margin: 10px 0 4px; font-weight: 500; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--plum); flex: none; }

/* theme chips */
.themes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.chip { min-height: 40px; padding: 7px 12px; border: 1.5px solid var(--line-2); border-radius: 999px; background: var(--paper); color: var(--ink); font: 500 14px/1.2 var(--f-body); cursor: pointer; }
.chip:hover { border-color: var(--plum-2); color: var(--plum); }
.chip[aria-pressed="true"] { border-color: var(--plum); background: var(--plum-wash); color: var(--plum); box-shadow: inset 0 0 0 1px var(--plum); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; border-radius: 4px; font: 600 15px/1.2 var(--f-body); cursor: pointer; border: 1.5px solid transparent; }
.btn-primary { background: var(--plum); color: #fff; }
.btn-primary:hover { background: #3c1f58; }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-secondary { background: var(--paper); color: var(--plum); border-color: var(--plum); }
.btn-secondary:hover { background: var(--plum-wash); }
.btn-ghost { background: transparent; color: var(--plum); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--plum); background: var(--paper); }
.btn-small { min-height: 40px; padding: 8px 14px; font-size: 14px; background: var(--paper); color: var(--plum); border-color: var(--plum); }
.btn-small:hover { background: var(--plum-wash); }
.link-btn { margin-top: 22px; padding: 8px 0; min-height: 40px; background: none; border: 0; color: var(--ink-2); font: 14px/1.3 var(--f-body); text-decoration: underline; cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--err); }

/* ---------- sheet column ---------- */
.sheet-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.view-tabs { display: inline-flex; border: 1.5px solid var(--plum); border-radius: 4px; overflow: hidden; background: var(--paper); }
.view-tabs button { min-height: 40px; padding: 8px 16px; border: 0; background: transparent; color: var(--plum); font: 600 15px/1.2 var(--f-body); cursor: pointer; }
.view-tabs button + button { border-left: 1.5px solid var(--plum); }
.view-tabs button[aria-selected="true"] { background: var(--plum); color: #fff; }
.view-tabs button:focus-visible { outline-offset: -4px; outline-color: #fff; box-shadow: inset 0 0 0 3px var(--focus); }
.versions { display: flex; flex-wrap: wrap; gap: 4px; }
.versions:empty { display: none; }
.versions button { min-width: 40px; min-height: 40px; border: 1.5px solid var(--line-2); border-radius: 3px; background: var(--paper); color: var(--ink); font: 700 15px/1 var(--f-body); cursor: pointer; }
.versions button[aria-pressed="true"] { border-color: var(--plum); color: var(--plum); box-shadow: inset 0 0 0 1.5px var(--plum); background: var(--plum-wash); }
.tool-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.desk { position: relative; }
.example-tag { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 12px; font-size: 14px; color: var(--ink-2); }
.example-tag[hidden] { display: none; }
.pill { display: inline-block; padding: 3px 12px; border: 2px solid var(--plum-2); border-radius: 999px; color: var(--plum); font: 700 13px/1.3 var(--f-body); letter-spacing: .1em; text-transform: uppercase; transform: rotate(-2deg); background: var(--paper); }
.paper-wrap { position: relative; max-width: 620px; margin: 0 auto; }
.sheet { background: var(--paper); box-shadow: 0 1px 2px rgba(40, 20, 60, .14), 0 10px 30px rgba(40, 20, 60, .12); aspect-ratio: 210 / 297; transition: opacity .2s; }
.sheet svg { display: block; width: 100%; height: 100%; }
.sheet.is-stale { opacity: .35; filter: grayscale(.6); }
.stale { position: absolute; left: 6%; right: 6%; top: 18%; padding: 16px 18px; background: var(--paper); border: 2px solid var(--err); border-radius: 4px; box-shadow: 0 8px 24px rgba(40, 20, 60, .18); }
.stale p { margin: 0 0 10px; color: var(--err); font-weight: 600; font-size: 15px; }
.stale-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.status { max-width: 620px; margin: 12px auto 0; font-size: 15px; font-weight: 600; color: var(--plum); }
.status:empty { display: none; }
.checks { max-width: 620px; margin: 12px auto 0; font-size: 14px; color: var(--ink-2); }
.checks .ok { color: var(--ok); }
.checks .ok::before { content: "✓ "; font-weight: 700; }
.checks .warn { color: var(--err); }

/* ---------- settings column ---------- */
.levels { margin: 0; padding: 0; border: 0; }
.levels legend { margin-top: 0; }
.level { position: relative; display: flex; align-items: center; gap: 12px; margin: 0 0 6px; padding: 8px 10px; min-height: 58px; border: 1.5px solid var(--line-2); border-radius: 4px; cursor: pointer; font-weight: 400; background: var(--paper); }
.level input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.level b { display: block; font-size: 16px; }
.level small { display: block; font-size: 13px; color: var(--ink-2); }
.level:hover { border-color: var(--plum-2); }
.level:has(input:checked) { border-color: var(--plum); background: var(--plum-wash); box-shadow: inset 0 0 0 1px var(--plum); }
.level:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.rose { width: 40px; height: 40px; flex: none; }
.rose .arm { stroke: var(--plum); stroke-width: 3; stroke-linecap: round; }
.rose .head, .rose .hub { fill: var(--plum); }
.rose .off { fill: var(--line-2); }
.seg { margin: 0; padding: 0; border: 0; }
.seg { display: flex; flex-wrap: wrap; }
.seg legend { width: 100%; }
.seg label { position: relative; margin: 0; flex: 1; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 42px; border: 1.5px solid var(--line-2); font-weight: 600; cursor: pointer; background: var(--paper); }
.seg label:first-of-type span { border-radius: 4px 0 0 4px; }
.seg label:last-of-type span { border-radius: 0 4px 4px 0; border-left: 0; }
.seg input:checked + span { background: var(--plum); border-color: var(--plum); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.stepper { display: flex; align-items: stretch; max-width: 170px; }
.stepper button { width: 44px; min-height: 44px; border: 1.5px solid var(--line-2); background: var(--paper); color: var(--plum); font: 600 20px/1 var(--f-body); cursor: pointer; }
.stepper button:first-child { border-radius: 4px 0 0 4px; }
.stepper button:last-child { border-radius: 0 4px 4px 0; }
.stepper input { border-radius: 0; border-left: 0; border-right: 0; text-align: center; font-weight: 600; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.actions { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 16px; }
.mobile-bar { display: none; }

/* ---------- content sections ---------- */
.info { max-width: 1120px; margin: 0 auto; padding: 44px 28px 8px; }
.info h2 { margin: 0 0 14px; font: 600 28px/1.2 var(--f-head); }
.info h3 { margin: 6px 0 6px; font: 600 20px/1.25 var(--f-head); }
.info p, .info li { font-size: 16px; color: var(--ink); }
.info-note { color: var(--ink-2) !important; }
.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0; padding: 0; list-style: none; counter-reset: how; border-top: 1.5px solid var(--ink); }
.how li { position: relative; padding: 16px 20px 12px 52px; counter-increment: how; border-right: 1px solid var(--line); }
.how li:last-child { border-right: 0; }
.how li::before { content: counter(how); position: absolute; left: 12px; top: 16px; width: 28px; height: 28px; display: grid; place-items: center; border: 1.5px solid var(--plum); border-radius: 3px; color: var(--plum); font-weight: 700; background: var(--plum-wash); }
.level-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1.5px solid var(--ink); }
.level-cards article { padding: 18px 20px 6px 0; border-right: 1px solid var(--line); }
.level-cards article + article { padding-left: 20px; }
.level-cards article:last-child { border-right: 0; }
.rose-lg { width: 64px; height: 64px; }
.haslo-explain { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 32px; align-items: start; border-top: 1.5px solid var(--ink); padding-top: 14px; }
.haslo-explain ul { padding-left: 20px; }
.mini { margin: 6px 0 0; }
.mini-grid { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(3, 56px); border: 2px solid var(--ink); width: max-content; position: relative; background: var(--paper); }
.mini-grid span { display: grid; place-items: center; font: 700 24px/1 var(--f-body); border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.mini-grid span:nth-child(3n) { border-right: 0; }
.mini-grid span:nth-child(n+7) { border-bottom: 0; }
.mini-grid .w1, .mini-grid .w2 { color: #9a90a8; text-decoration: line-through; text-decoration-thickness: 2px; }
.mini-grid .h { color: var(--plum); background: var(--plum-wash); }
.mini-grid::before, .mini-grid::after { content: ""; position: absolute; border: 2.5px solid #d9480f; border-radius: 999px; pointer-events: none; }
.mini-grid::before { left: 4px; top: 6px; width: calc(100% - 8px); height: 44px; }
.mini-grid::after { left: 62px; top: 4px; width: 44px; height: calc(100% - 8px); border-color: #0b7285; }
.mini figcaption { margin-top: 10px; font-size: 15px; color: var(--ink-2); }
.sets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1.5px solid var(--ink); }
.sets article { padding: 16px 20px 18px 0; border-bottom: 1px solid var(--line); }
.sets article:nth-child(3n+2), .sets article:nth-child(3n) { padding-left: 20px; border-left: 1px solid var(--line); }
.sets p { margin: 0 0 8px; font-size: 15px; }
.set-h { color: var(--ink-2) !important; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1.5px solid var(--ink); }
.faq summary { padding: 14px 0; min-height: 44px; font-weight: 600; font-size: 17px; cursor: pointer; }
.faq details p { margin: 0 0 16px; max-width: 760px; }

/* ---------- footer ---------- */
.foot { margin-top: 56px; padding: 22px 28px 90px; border-top: 1px solid var(--line); background: var(--paper); color: var(--ink-2); font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.foot-brand { font: 600 19px/1 var(--f-head); color: var(--ink); }
.foot a { color: var(--plum); }
.foot-row a { display: inline-block; padding: 10px 0; }
.tw-xlinks a { color: var(--plum); }

#print-root { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .studio { grid-template-columns: 320px minmax(0, 1fr); grid-template-areas: "words sheet" "settings sheet"; }
  .pane-words { grid-area: words; }
  .pane-settings { grid-area: settings; border-left: 0; border-right: 1px solid var(--line); border-top: 1px solid var(--line); }
  .pane-sheet { grid-area: sheet; }
  .intro { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .bar { padding: 10px 16px; }
  .bar-nav { display: none; }
  .intro { padding: 18px 16px 14px; }
  .intro p { font-size: 15.5px; }
  .studio { display: flex; flex-direction: column; }
  .pane { padding: 18px 16px 22px; }
  .pane-sheet { order: -1; padding: 12px 12px 18px; }
  .pane-words, .pane-settings { border: 0; border-top: 1px solid var(--line); }
  .tool-actions { margin-left: 0; }
  .tool-actions #print, .tool-actions #pdf { display: none; }
  .sheet-tools { gap: 8px; }
  .info { padding: 36px 16px 4px; }
  .info h2 { font-size: 24px; }
  .how, .level-cards, .sets { grid-template-columns: 1fr; }
  .how li, .level-cards article, .sets article { border-right: 0; border-left: 0 !important; padding-left: 0 !important; border-bottom: 1px solid var(--line); }
  .how li { padding-left: 44px !important; }
  .how li::before { left: 0; }
  .haslo-explain { grid-template-columns: 1fr; gap: 12px; }
  .mobile-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); transform: translateY(110%); transition: transform .2s; }
  .mobile-bar.show { transform: none; }
  .foot { padding: 20px 16px 96px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- print: only the A4 sheets ---------- */
@page { size: A4 portrait; margin: 0; }
@media print {
  body { background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  .print-page { width: 210mm; height: 297mm; overflow: hidden; break-after: page; page-break-after: always; }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .print-svg { display: block; width: 210mm; height: 297mm; }
}

/* ---------- simple pages (about, privacy) ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 40px 28px 20px; }
.page h1 { margin: 0 0 16px; font: 600 40px/1.1 var(--f-head); }
.page h2 { margin: 32px 0 8px; padding-top: 16px; border-top: 1.5px solid var(--ink); font: 600 23px/1.25 var(--f-head); }
.page p { font-size: 16px; }
.page .lead { font-size: 18px; color: var(--ink-2); }
.page .small { font-size: 14px; color: var(--ink-2); }
@media (max-width: 820px) { .page { padding: 28px 16px 12px; } .page h1 { font-size: 32px; } }
