/* TheoNotes · Arctic Pearl theme (design system: TheoNotes, claude.ai/artifact/L9sjedWCZtCnhUxoXqwaJu).
   Loaded after the app stylesheet. Unlayered, so it wins over the Tailwind layers it restyles.
   Visual only: no rule here adds, hides or moves a feature. */

/* ---------- font: Geist variable, self-hosted (SIL OFL 1.1), Latin + Latin Extended for Polish ---------- */
@font-face {
  font-family: Geist;
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(./geist-latin-ext-12ffd1b0.woff2) format("woff2-variations"), url(./geist-latin-ext-12ffd1b0.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Geist;
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(./geist-latin-b3495042.woff2) format("woff2-variations"), url(./geist-latin-b3495042.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- tokens ---------- */
:root:not([data-theme=dark]) {
  --tn-bg: #ffffff;
  --tn-bg-secondary: #f4f6f9;
  --tn-bg-tertiary: #eef1f5;
  --tn-bg-elevated: #ffffff;
  --tn-bg-subtle: #f8f9fb;
  --tn-bg-hover: #edf0f4;
  --tn-separator: #e6eaf0;
  --tn-separator-strong: #d5dce4;
  --tn-text: #161c24;
  --tn-text-secondary: #4f5a67;
  --tn-text-tertiary: #606b78;
  --tn-text-on-accent: #ffffff;
  --tn-icon: #4f5a67;
  --tn-accent: #0b7a8f;
  --tn-accent-hover: #096a7c;
  --tn-accent-soft: #e2f2f5;
  --tn-accent-soft-hover: #d2eaef;
  --tn-danger: #b8402f;
  --tn-danger-soft: #fbe9e5;
  --tn-danger-soft-hover: #f6d9d2;
  --tn-success: #2f7a55;
  --tn-success-soft: #e4f3ea;
  --tn-warning: #92600e;
  --tn-warning-soft: #faf1de;
  --tn-verse: #8a6114;
  --tn-verse-bg: #f8f0de;
  --tn-verse-mark: #b07d22;
  --tn-maxim: #7a4fa0;
  --tn-maxim-bg: #f1ebf8;
  --tn-example: #3b62c4;
  --tn-example-bg: #eaeffb;
  --tn-treasure: #b23f5c;
  --tn-treasure-bg: #fae9ee;
  --tn-recording: #b8402f;
  --tn-shadow-card: 0 0 0 1px rgba(22, 32, 48, 0.06), 0 1px 2px rgba(22, 32, 48, 0.04);
  --tn-shadow-panel: 0 0 0 1px rgba(22, 32, 48, 0.06), 0 8px 24px -16px rgba(22, 32, 48, 0.14);
  --tn-shadow-raised: 0 0 0 1px rgba(22, 32, 48, 0.10), 0 1px 1px rgba(22, 32, 48, 0.05);
  --tn-shadow-float: 0 0 0 1px rgba(22, 32, 48, 0.08), 0 12px 32px -10px rgba(22, 32, 48, 0.20);
  --tn-shadow-focus: 0 0 0 2px #ffffff, 0 0 0 4px #0b7a8f;
  --tn-shadow-focus-soft: 0 0 0 1px #0b7a8f, 0 0 0 4px #e2f2f5;
  --tn-shadow-panel-active: var(--tn-shadow-panel);
  --tn-cat-blue: #4a72d1;
  --tn-cat-teal: #1f8f9e;
  --tn-cat-violet: #8a67c9;
  --tn-cat-amber: #b8801f;
  --tn-cat-red: #c94545;
  --tn-cat-green: #2f8a55;
  --tn-cat-pink: #c2508a;
  --tn-cat-indigo: #5a5fcf;
  --tn-cat-lime: #6b8a1a;
  --tn-cat-orange: #c4612a;
  --tn-cat-cyan: #1b8aa6;
  --tn-cat-stone: #75808c;
}
:root {
  --tn-font-sans: Geist, ui-sans-serif, -apple-system, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --tn-font-display: Geist, ui-sans-serif, -apple-system, "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --tn-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --tn-text-base: .875rem;
  --tn-text-md: 1rem;
  --tn-text-lg: 1.0625rem;
  --tn-text-xl: 1.375rem;
  --tn-text-2xl: 1.75rem;
  --tn-radius-sm: 6px;
  --tn-radius-control: 8px;
  --tn-radius-md: 12px;
  --tn-radius-lg: 12px;
  --tn-radius-xl: 14px;
  --tn-sidebar-width: 240px;
  --tn-sidebar-rail-width: 64px;
  --tn-topbar-height: 52px;
  --tn-content-max: 1160px;
  --tn-duration-fast: .12s;
  --tn-duration: .18s;
}
@media (prefers-reduced-motion: reduce) { :root { --tn-duration-fast: 0s; --tn-duration: 0s; } }

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3 { letter-spacing: -0.02em; }
h1 { font-weight: 650; letter-spacing: -0.03em; }

/* Phones and touch: fields stay at 16px so iOS does not zoom on focus. */
@media (max-width: 47.99rem), (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea { font-size: 16px; }
}

/* ---------- shell ---------- */
/* Sidebar: white column on a hairline. */
aside.bg-tn-bg-secondary.tn-hairline-r { background-color: var(--tn-bg); }
.tn-nav-item { color: var(--tn-text-secondary); font-size: .84375rem; font-weight: 500; min-height: 34px; padding: 6px 10px; gap: 10px; }
.tn-nav-item svg { width: 18px; height: 18px; }
.tn-nav-item:hover { background: var(--tn-bg-hover); color: var(--tn-text); }
.tn-nav-item[aria-current=page] { background: var(--tn-bg-tertiary); color: var(--tn-text); font-weight: 550; }
.tn-nav-item[aria-current=page] svg { color: var(--tn-accent); }
@media (pointer: coarse) { .tn-nav-item { min-height: 44px; font-size: 1rem; } }

/* Top bar: white on a hairline. */
.backdrop-blur.tn-hairline-b { background-color: rgb(255 255 255 / .92); }

/* ---------- surfaces ---------- */
.tn-card, .tn-panel, .tn-panel-flat { box-shadow: var(--tn-shadow-card); }
.tn-panel { border-radius: var(--tn-radius-lg); }

/* ---------- editor ---------- */
.tn-editor-panel { border-radius: var(--tn-radius-lg); box-shadow: var(--tn-shadow-card); }
.tn-editor-panel:focus-within { box-shadow: var(--tn-shadow-card); }
.tn-editor-bar { border-radius: var(--tn-radius-lg) var(--tn-radius-lg) 0 0; background: rgb(255 255 255 / .92); }
.tn-tool-group + .tn-tool-group::before { background: var(--tn-separator-strong); height: 18px; }
.tn-editor { font-size: 1rem; line-height: 1.6875; }
/* Text fills the full width of the editor panel (inside its own padding). */
@media (min-width: 96rem) { .tn-editor { font-size: 1.0625rem; line-height: 1.7; } }
/* Annotation tools carry their hue. */
.tn-editor-toolbar button[aria-label="Oznacz jako werset"] { color: var(--tn-verse); }
.tn-editor-toolbar button[aria-label="Oznacz jako ciekawą sentencję"] { color: var(--tn-maxim); }
.tn-editor-toolbar button[aria-label="Oznacz jako przykład"] { color: var(--tn-example); }
.tn-editor-toolbar button[aria-label="Oznacz jako werset"]:hover:not(:disabled) { background: var(--tn-verse-bg); }
.tn-editor-toolbar button[aria-label="Oznacz jako ciekawą sentencję"]:hover:not(:disabled) { background: var(--tn-maxim-bg); }
.tn-editor-toolbar button[aria-label="Oznacz jako przykład"]:hover:not(:disabled) { background: var(--tn-example-bg); }
.tn-editor h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.025em; }
.tn-editor h2 { font-size: 1.25rem; font-weight: 650; letter-spacing: -0.02em; }
.tn-editor h3 { font-size: 1.0625rem; font-weight: 650; letter-spacing: -0.01em; }
.tn-editor blockquote { border-left: 0; padding: 12px 16px; border-radius: var(--tn-radius-control); background: var(--tn-bg-tertiary); font-style: italic; }

/* Annotation marks: verse recolours its text; maxim and example get a soft fill with an inner underline. */
.tn-verse, .tn-editor .tn-verse { background: none; padding: 0; border-radius: 2px; color: var(--tn-verse); font-weight: 550; text-decoration: underline 2px var(--tn-verse-mark); text-underline-offset: 4px; }
.tn-editor .tn-verse:hover { background: var(--tn-verse-bg); }
.tn-verse-suggestion, .tn-editor .tn-verse-suggestion { text-decoration-color: var(--tn-verse-mark); text-underline-offset: 4px; }
.tn-maxim, .tn-example, .tn-editor .tn-maxim, .tn-editor .tn-example, .tn-editor .tn-example .tn-maxim { text-decoration: none; padding: 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.tn-maxim, .tn-editor .tn-maxim { background: var(--tn-maxim-bg); box-shadow: inset 0 -2px 0 var(--tn-maxim); }
.tn-example, .tn-editor .tn-example { background: var(--tn-example-bg); box-shadow: inset 0 -2px 0 var(--tn-example); }
.tn-editor .tn-example .tn-maxim { box-shadow: inset 0 -2px 0 var(--tn-maxim), inset 0 -4px 0 var(--tn-example); }
.tn-search-hit, .tn-editor .tn-search-hit { background: #fbeaa0; }

/* ---------- calendar screen (/kalendarz) ----------
   Scoped by structure: the page root is the only element whose card holds the month grid and whose
   second column holds the day heading. Visual only — markup, handlers and data are untouched. */
main > div:has(> .tn-card > [role="grid"]):has(> div > h2) {
  --cal-gap: 6px;
  --cal-radius: 10px;
  --cal-sel-line: rgb(11 122 143 / .38);
  gap: 16px;
}

/* Month card */
main > div:has(> .tn-card > [role="grid"]) > .tn-card {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  padding: 20px 20px 18px; border-radius: 14px; box-shadow: var(--tn-shadow-card);
}

/* Header: month + Dziś / ‹ › */
main > div:has(> .tn-card > [role="grid"]) > .tn-card > div:first-child { margin: 0 0 16px; padding: 0 2px; gap: 8px; }
main > div:has(> .tn-card > [role="grid"]) > .tn-card > div:first-child > h1 {
  font-size: 1.625rem; line-height: 2rem; font-weight: 650; letter-spacing: -0.032em; color: var(--tn-text);
}
main > div:has(> .tn-card > [role="grid"]) > .tn-card > div:first-child > div { gap: 6px; }
main > div:has(> .tn-card > [role="grid"]) > .tn-card > div:first-child > div > button {
  height: 34px; min-width: 34px; padding: 0 10px; border-radius: 9px;
  background: var(--tn-bg); color: var(--tn-text-secondary); box-shadow: var(--tn-shadow-raised);
  font-size: .8125rem; font-weight: 600; transition: background-color .16s var(--tn-ease), color .16s var(--tn-ease), box-shadow .16s var(--tn-ease);
}
main > div:has(> .tn-card > [role="grid"]) > .tn-card > div:first-child > div > button:first-child { padding: 0 14px; color: var(--tn-text); }
main > div:has(> .tn-card > [role="grid"]) > .tn-card > div:first-child > div > button:hover { background: var(--tn-bg-hover); color: var(--tn-text); }
main > div:has(> .tn-card > [role="grid"]) > .tn-card > div:first-child > div > button:active { background: var(--tn-bg-tertiary); }
main > div:has(> .tn-card > [role="grid"]) > .tn-card > div:first-child > div > button[aria-label] { width: 34px; padding: 0; }

/* Grid */
main > div:has(> .tn-card > [role="grid"]) [role="grid"] { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
main > div:has(> .tn-card > [role="grid"]) [role="grid"] > [role="row"] { margin-bottom: 8px; gap: var(--cal-gap); }
main > div:has(> .tn-card > [role="grid"]) [role="columnheader"] {
  padding: 0 10px; text-align: left; font-size: .75rem; line-height: 1rem; font-weight: 600; color: var(--tn-text-tertiary);
}
main > div:has(> .tn-card > [role="grid"]) [role="rowgroup"] {
  flex: 1 1 auto; min-height: 0; gap: var(--cal-gap); grid-auto-rows: minmax(84px, 1fr);
}

/* Day cell */
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"] {
  position: relative; height: auto; min-height: 0; padding: 8px 8px 10px;
  align-items: flex-start; justify-content: space-between;
  border: 1px solid var(--tn-separator); border-radius: var(--cal-radius); background: var(--tn-bg);
  opacity: 1; cursor: pointer;
  transition: background-color .16s var(--tn-ease), border-color .16s var(--tn-ease), box-shadow .16s var(--tn-ease);
}
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"]:hover { background: var(--tn-bg-subtle); border-color: var(--tn-separator-strong); }
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"]:active { background: var(--tn-bg-tertiary); }
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"]:focus-visible { outline: none; box-shadow: var(--tn-shadow-focus); }

/* Day number */
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"] > span:first-child {
  width: 28px; height: 28px; font-size: .84375rem; font-weight: 550; color: var(--tn-text); letter-spacing: -0.01em;
  transition: background-color .16s var(--tn-ease), color .16s var(--tn-ease);
}

/* Days outside the month: quiet, still clickable */
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"].opacity-35 { background: var(--tn-bg-subtle); border-color: transparent; }
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"].opacity-35 > span:first-child { color: #a9b2bd; font-weight: 500; }
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"].opacity-35 > span:nth-child(2) { opacity: .5; }
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"].opacity-35:hover { border-color: var(--tn-separator); }

/* Selected day: frost fill, glacier hairline, accent number */
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"][aria-selected="true"] {
  background: var(--tn-accent-soft); border-color: var(--cal-sel-line);
}
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"][aria-selected="true"]:hover { background: var(--tn-accent-soft-hover); }
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"][aria-selected="true"] > span:first-child { color: var(--tn-accent-hover); font-weight: 700; }

/* Today: solid glacier disc (kept from the app), lifted slightly; it reads apart from the selection fill. */
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"] > span.bg-tn-accent:first-child {
  color: var(--tn-text-on-accent); font-weight: 650; box-shadow: 0 1px 2px rgb(11 122 143 / .35);
}
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"][aria-selected="true"] > span.bg-tn-accent:first-child { color: var(--tn-text-on-accent); }

/* Event markers (category colours, unchanged semantics) */
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"] > span:nth-child(2) { margin: 0 0 0 6px; gap: 4px; }
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"] > span:nth-child(2) > span.rounded-full { width: 7px; height: 7px; box-shadow: 0 0 0 1.5px var(--tn-bg); }
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"][aria-selected="true"] > span:nth-child(2) > span.rounded-full { box-shadow: 0 0 0 1.5px var(--tn-accent-soft); }
main > div:has(> .tn-card > [role="grid"]) [role="gridcell"] > span:nth-child(2) > span:not(.rounded-full) { margin-left: 2px; font-size: .6875rem; font-weight: 600; color: var(--tn-text-tertiary); }

/* Day panel: one column-tall surface that pairs with the month card */
main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  padding: 18px 16px 16px; border-radius: 14px; background: var(--tn-bg); box-shadow: var(--tn-shadow-card);
}
main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child > h2 {
  margin: 0 0 14px; padding: 4px 4px 14px; border-bottom: 1px solid var(--tn-separator);
  font-size: 1.0625rem; line-height: 1.5rem; font-weight: 650; letter-spacing: -0.015em; color: var(--tn-text);
}
main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child > .tn-card {
  background: transparent; box-shadow: none; border-radius: 0; padding: 0 4px; overflow: visible;
}
main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child > .tn-card > p { color: var(--tn-text-secondary); font-size: .8125rem; }

/* Event cards */
main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child ul { display: flex; flex-direction: column; gap: 8px; }
main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child ul > li {
  border: 1px solid var(--tn-separator); border-radius: 11px; background: var(--tn-bg); overflow: hidden;
  transition: border-color .16s var(--tn-ease), box-shadow .16s var(--tn-ease);
}
main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child ul > li:hover { border-color: var(--tn-separator-strong); box-shadow: 0 2px 8px -4px rgb(22 32 48 / .14); }
main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child ul > li > a {
  gap: 12px; padding: 12px 14px; align-items: center; transition: background-color .16s var(--tn-ease);
}
main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child ul > li > a:hover { background: var(--tn-bg-subtle); }
main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child ul > li > a > .tn-dot { align-self: flex-start; margin-top: 5px; box-shadow: 0 0 0 3px var(--tn-bg-tertiary); }
main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child ul > li > a > span:nth-child(2) > span:first-child {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; white-space: normal; overflow-wrap: anywhere;
  font-size: .875rem; line-height: 1.25rem; font-weight: 600; letter-spacing: -0.005em; color: var(--tn-text);
}
main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child ul > li > a > span:nth-child(2) > span:last-child {
  margin-top: 2px; font-size: .75rem; line-height: 1rem; color: var(--tn-text-tertiary);
}

/* ---------- sizes ---------- */
/* Desktop: the month and the day panel share one height that follows the window. */
@media (min-width: 64rem) {
  /* Height follows the window, but rows never grow past ~148px: 4- and 5-week months stay compact on tall screens. */
  main > div:has(> .tn-card > [role="grid"]):has(> div > h2) {
    --cal-weeks: 5;
    grid-template-columns: minmax(0, 1fr) 300px;
    height: min(clamp(560px, calc(100dvh - var(--tn-topbar-height) - var(--tn-safe-top) - 48px), 980px), calc(var(--cal-weeks) * 148px + 176px));
  }
  main > div:has(> .tn-card > [role="grid"]):has(> div > h2):has([role="rowgroup"] > :nth-child(36)) { --cal-weeks: 6; }
  main > div:has(> .tn-card > [role="grid"]):has(> div > h2):not(:has([role="rowgroup"] > :nth-child(29))) { --cal-weeks: 4; }
  main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child { overflow-y: auto; }
  main > div:has(> .tn-card > [role="grid"]) [role="rowgroup"] { grid-auto-rows: minmax(0, 1fr); }
}
@media (min-width: 80rem) {
  main > div:has(> .tn-card > [role="grid"]):has(> div > h2) { grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; }
  main > div:has(> .tn-card > [role="grid"]) > .tn-card { padding: 24px 24px 20px; }
  main > div:has(> .tn-card > [role="grid"]) { --cal-gap: 8px; }
}

/* Tablet: month on top, day panel below. */
@media (min-width: 40rem) and (max-width: 63.99rem) {
  main > div:has(> .tn-card > [role="grid"]) [role="rowgroup"] { grid-auto-rows: 88px; }
}

/* Phone: compact centred cells, comfortable touch targets. */
@media (max-width: 39.99rem) {
  main > div:has(> .tn-card > [role="grid"]) { --cal-gap: 3px; --cal-radius: 10px; }
  main > div:has(> .tn-card > [role="grid"]) > .tn-card { padding: 14px 8px 10px; border-radius: 14px; }
  main > div:has(> .tn-card > [role="grid"]) > .tn-card > div:first-child { margin-bottom: 12px; padding: 0 6px; }
  main > div:has(> .tn-card > [role="grid"]) > .tn-card > div:first-child > h1 { font-size: 1.375rem; line-height: 1.75rem; }
  main > div:has(> .tn-card > [role="grid"]) > .tn-card > div:first-child > div > button { height: 36px; min-width: 36px; }
  main > div:has(> .tn-card > [role="grid"]) > .tn-card > div:first-child > div > button[aria-label] { width: 36px; }
  main > div:has(> .tn-card > [role="grid"]) [role="grid"] > [role="row"] { margin-bottom: 6px; }
  main > div:has(> .tn-card > [role="grid"]) [role="columnheader"] { padding: 0; text-align: center; font-size: .6875rem; }
  main > div:has(> .tn-card > [role="grid"]) [role="rowgroup"] { grid-auto-rows: 52px; }
  main > div:has(> .tn-card > [role="grid"]) [role="gridcell"] {
    padding: 5px 0 6px; align-items: center; justify-content: flex-start; gap: 3px; border-color: transparent;
  }
  main > div:has(> .tn-card > [role="grid"]) [role="gridcell"].opacity-35 { background: transparent; }
  main > div:has(> .tn-card > [role="grid"]) [role="gridcell"] > span:nth-child(2) { margin: 0; gap: 3px; }
  main > div:has(> .tn-card > [role="grid"]) [role="gridcell"] > span:nth-child(2) > span.rounded-full { width: 5px; height: 5px; box-shadow: none; }
  main > div:has(> .tn-card > [role="grid"]):has(> div > h2) > div:last-child { padding: 16px 12px 12px; }
}

/* Phone in landscape: the app already switches to two columns; keep cells short. */
@media (orientation: landscape) and (max-height: 500px) {
  main > div:has(> .tn-card > [role="grid"]) [role="rowgroup"] { grid-auto-rows: 40px; }
  main > div:has(> .tn-card > [role="grid"]) [role="gridcell"] { padding: 0; align-items: center; justify-content: center; gap: 2px; border-color: transparent; }
  main > div:has(> .tn-card > [role="grid"]) [role="gridcell"].opacity-35 { background: transparent; }
  main > div:has(> .tn-card > [role="grid"]) [role="gridcell"] > span:nth-child(2) { margin: 0; }
  main > div:has(> .tn-card > [role="grid"]) [role="columnheader"] { padding: 0; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  main > div:has(> .tn-card > [role="grid"]) [role="gridcell"],
  main > div:has(> .tn-card > [role="grid"]) [role="gridcell"] > span:first-child,
  main > div:has(> .tn-card > [role="grid"]):has(> div > h2) ul > li { transition: none; }
}

/* ---------- treasure editor dialog ("Nowy / Zmień skarb biblijny") ----------
   Scoped to the dialog whose form holds the treasure textarea. Layout only: same fields, same buttons,
   same validation and saving. The dialog becomes a large workspace: header (title, verse), a writing
   area that takes the remaining height and scrolls inside, and a fixed action bar. */
[role="presentation"]:has(> [role="dialog"] textarea[placeholder^="Co odkryłeś"]) {
  background: rgb(16 24 36 / .32);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) {
  display: flex; flex-direction: column;
  width: min(88vw, 1520px); max-width: none;
  height: calc(var(--tn-vv-height) * .88); max-height: none;
  overflow: hidden;
  padding: 0 !important;                     /* the modal sets its padding inline */
  border-radius: 16px;
  background: var(--tn-bg);
  box-shadow: 0 0 0 1px rgb(22 32 48 / .08), 0 32px 80px -24px rgb(22 32 48 / .35);
}

/* Header: title, close */
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > div:first-child {
  flex: none; margin: 0; gap: 12px;
  padding: 20px 24px 0 32px;
}
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > div:first-child > svg {
  width: 22px; height: 22px; padding: 7px; box-sizing: content-box;
  border-radius: 10px; background: var(--tn-treasure-bg);
}
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > div:first-child > h2 {
  font-size: 1.25rem; line-height: 1.75rem; font-weight: 650; letter-spacing: -0.02em;
}
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > div:first-child > button { width: 36px; height: 36px; margin: 0; border-radius: 9px; }

/* Form fills the rest of the dialog */
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form {
  flex: 1 1 auto; min-height: 0; gap: 0;
}

/* Verse block: stays in the header zone, separated from the writing area by a hairline */
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:first-child {
  flex: none; padding: 16px 32px 18px; border-bottom: 1px solid var(--tn-separator);
}
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:first-child input { max-width: 560px; }

/* Writing area: full width, all remaining height, scrolls inside */
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:has(textarea) {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px;
  padding: 18px 32px 0;
}
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:has(textarea) label { flex: none; }
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) textarea[placeholder^="Co odkryłeś"] {
  flex: 1 1 auto; min-height: 180px; height: auto; width: 100%;
  resize: none; overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 24px; border-radius: 12px;
  font-size: 1.0625rem; line-height: 1.75; letter-spacing: -0.003em; color: var(--tn-text);
  background: var(--tn-bg-subtle); border-color: var(--tn-separator-strong);
  scrollbar-gutter: stable;
  transition: border-color .16s var(--tn-ease), box-shadow .16s var(--tn-ease), background-color .16s var(--tn-ease);
}
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) textarea[placeholder^="Co odkryłeś"]:focus { background: var(--tn-bg); }
/* Hint or error under the field (if the app shows one) stays compact */
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:has(textarea) > :not(label):not(textarea):not(div:has(textarea)) { flex: none; }
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:has(textarea) > div:has(> textarea) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* Save error sits just above the action bar */
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > [role="alert"] { flex: none; margin: 12px 32px 0; }

/* Action bar: always visible */
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:last-child {
  flex: none; margin-top: 18px; gap: 10px;
  padding: 14px 24px calc(14px + var(--tn-sheet-safe-bottom, var(--tn-safe-bottom))) 32px;
  border-top: 1px solid var(--tn-separator); background: var(--tn-bg-secondary);
}
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:last-child > button { min-width: 112px; height: 40px; }
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:last-child > button[type="button"] { background: var(--tn-bg); color: var(--tn-text); box-shadow: var(--tn-shadow-raised); }
[role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:last-child > button[type="button"]:hover { background: var(--tn-bg-hover); }

/* Tablet: nearly the whole screen */
@media (min-width: 40rem) and (max-width: 63.99rem) {
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) { width: 100%; height: calc(var(--tn-vv-height) - 32px); }
}

/* Phone: full-screen editor; height follows the visual viewport, so the keyboard shrinks the writing area, not the action bar. */
@media (max-width: 39.99rem) {
  [role="presentation"]:has(> [role="dialog"] textarea[placeholder^="Co odkryłeś"]) { -webkit-backdrop-filter: none; backdrop-filter: none; }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) {
    width: 100%; height: var(--tn-vv-height); border-radius: 0; box-shadow: none;
  }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > div:first-child {
    padding: max(12px, var(--tn-safe-top)) max(12px, var(--tn-safe-right)) 0 max(16px, var(--tn-safe-left));
  }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > div:first-child > svg { width: 18px; height: 18px; padding: 6px; border-radius: 8px; }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > div:first-child > h2 { font-size: 1.0625rem; line-height: 1.5rem; }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > div:first-child > button { width: 44px; height: 44px; }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:first-child { padding: 10px max(16px, var(--tn-safe-right)) 12px max(16px, var(--tn-safe-left)); }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:first-child input { max-width: none; }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:has(textarea) { padding: 12px max(16px, var(--tn-safe-right)) 0 max(16px, var(--tn-safe-left)); }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) textarea[placeholder^="Co odkryłeś"] { min-height: 120px; padding: 14px 16px; font-size: 1rem; line-height: 1.7; }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > [role="alert"] { margin: 10px 16px 0; }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:last-child {
    margin-top: 12px; padding: 10px max(16px, var(--tn-safe-right)) calc(10px + var(--tn-sheet-safe-bottom, var(--tn-safe-bottom))) max(16px, var(--tn-safe-left));
  }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:last-child > button { flex: 1 1 0; height: 44px; }
}

/* Phone with the on-screen keyboard open (the app sets .tn-keyboard on <html>): same elements, tighter spacing. */
@media (max-width: 63.99rem) {
  .tn-keyboard [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > div:first-child { padding-top: 6px; }
  .tn-keyboard [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > div:first-child > svg { width: 16px; height: 16px; padding: 5px; }
  .tn-keyboard [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > div:first-child > h2 { font-size: .9375rem; line-height: 1.25rem; }
  .tn-keyboard [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > div:first-child > button { width: 40px; height: 40px; }
  .tn-keyboard [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:first-child { padding-top: 4px; padding-bottom: 8px; }
  .tn-keyboard [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:first-child label { margin-bottom: 0; font-size: .75rem; }
  .tn-keyboard [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:first-child input { height: 38px; min-height: 38px; }
  .tn-keyboard [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:first-child > p { margin-top: 4px; font-size: .75rem; }
  .tn-keyboard [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:has(textarea) { padding-top: 8px; gap: 4px; }
  .tn-keyboard [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:has(textarea) label { font-size: .75rem; }
  .tn-keyboard [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) textarea[placeholder^="Co odkryłeś"] { min-height: 96px; padding: 10px 14px; }
  .tn-keyboard [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:last-child { margin-top: 8px; padding-top: 8px; padding-bottom: 8px; }
}

/* Short screens (phone in landscape, or keyboard open): give the writing area the room. */
@media (max-height: 500px) {
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) { width: 100%; height: var(--tn-vv-height); border-radius: 0; }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > div:first-child { padding-top: max(8px, var(--tn-safe-top)); }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) > form > div:first-child { padding-top: 8px; padding-bottom: 10px; }
  [role="dialog"]:has(textarea[placeholder^="Co odkryłeś"]) textarea[placeholder^="Co odkryłeś"] { min-height: 80px; }
}

/* ---------- Skarby biblijne: chapter view ----------
   The per-verse "Dodaj skarb" button in each verse card header is hidden on request;
   adding a treasure stays available from the page header button. */
button[aria-label^="Dodaj skarb: "] { display: none; }

/* ---------- Wydarzenia (/wydarzenia): tiles with pastel organic backgrounds ----------
   Scoped to the page that has the category filter row and month sections. Visual only:
   same links, same filter buttons, same text. Each tile's colour comes from its own category dot —
   the dot's pseudo-elements inherit its background colour, so any category colour (also custom)
   paints the waves, without changing any assigned colour. */

/* Filters: light capsules, the active one in ink */
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > .tn-scroll-fade.mb-4.pb-1 {
  gap: 8px; margin: -4px -4px 20px; padding: 4px 4px 10px;
}
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > .tn-scroll-fade.mb-4.pb-1 > button {
  height: 34px; padding: 0 14px; gap: 8px; border-radius: 999px;
  background: var(--tn-bg); color: var(--tn-text-secondary);
  font-size: .8125rem; font-weight: 550; letter-spacing: -0.003em;
  box-shadow: inset 0 0 0 1px var(--tn-separator-strong), 0 1px 2px rgb(22 32 48 / .04);
  transition: background-color .16s var(--tn-ease), color .16s var(--tn-ease), box-shadow .16s var(--tn-ease);
}
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > .tn-scroll-fade.mb-4.pb-1 > button:hover {
  background: var(--tn-bg-subtle); color: var(--tn-text);
  box-shadow: inset 0 0 0 1px #c3ccd6, 0 2px 6px -2px rgb(22 32 48 / .10);
}
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed="true"] {
  background: var(--tn-text); color: #ffffff;
  box-shadow: 0 1px 2px rgb(22 32 48 / .18), 0 6px 14px -8px rgb(22 32 48 / .45);
}
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed="true"] > .tn-dot { box-shadow: 0 0 0 2px rgb(255 255 255 / .9); }
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > .tn-scroll-fade.mb-4.pb-1 > button:focus-visible { box-shadow: var(--tn-shadow-focus); }
@media (pointer: coarse) {
  main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > .tn-scroll-fade.mb-4.pb-1 > button { height: 40px; padding: 0 16px; }
}

/* Month sections */
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section { margin-bottom: 32px; }
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > h2 {
  margin: 0 0 12px; padding: 0 2px; font-size: .9375rem; line-height: 1.375rem; font-weight: 650; letter-spacing: -0.012em; color: var(--tn-text);
}

/* The list card becomes a transparent grid */
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card {
  background: none; box-shadow: none; border-radius: 0; overflow: visible;
}
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px;
}
@media (min-width: 40rem) {
  main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
@media (min-width: 80rem) {
  main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul { gap: 20px; }
}
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li { display: flex; min-width: 0; border-width: 0; }

/* ---- the tile ---- */
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a {
  position: relative; isolation: isolate; overflow: hidden; flex: 1 1 auto; min-width: 0;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: 24px 1fr;
  align-items: start; column-gap: 10px;
  min-height: 184px; padding: 20px 22px 22px;
  border-radius: 20px; border: 1px solid rgb(22 32 48 / .07);
  background: linear-gradient(180deg, #ffffff 0%, #fcfdfd 55%, #fafbfc 100%);
  box-shadow: 0 1px 2px rgb(22 32 48 / .04), 0 10px 28px -20px rgb(22 32 48 / .22);
  color: var(--tn-text);
  transition: transform .2s var(--tn-ease), box-shadow .2s var(--tn-ease), border-color .2s var(--tn-ease);
}
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a:hover {
  transform: translateY(-2px); background: linear-gradient(180deg, #ffffff 0%, #fcfdfd 55%, #fafbfc 100%);
  border-color: rgb(22 32 48 / .10);
  box-shadow: 0 2px 4px rgb(22 32 48 / .05), 0 18px 36px -20px rgb(22 32 48 / .30);
}
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a:active { transform: translateY(0); }
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a:focus-visible { outline: none; box-shadow: var(--tn-shadow-focus); }

/* Category dot: top-left marker; its pseudo-elements paint the background in the dot's own colour */
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a > .tn-dot {
  grid-column: 1; grid-row: 1; align-self: center;
  width: 10px !important; height: 10px !important;
  box-shadow: 0 0 0 4px rgb(255 255 255 / .92), 0 0 0 5px rgb(22 32 48 / .07);
}
/* Layered waves (three translucent bands + an arc), anchored bottom-right */
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a > .tn-dot::before {
  content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none;
  background: inherit; opacity: .34;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 360 240'%3E%3Ccircle cx='318' cy='46' r='84' fill-opacity='.22'/%3E%3Cpath fill-opacity='.30' d='M360 0C306 26 262 84 240 146 222 198 178 226 112 240H360Z'/%3E%3Cpath fill-opacity='.55' d='M360 72C322 92 300 136 288 176 276 214 246 234 204 240H360Z'/%3E%3Cpath fill-opacity='.72' d='M360 150C338 160 324 186 316 210 308 230 296 238 282 240H360Z'/%3E%3C/svg%3E") right bottom / auto 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 360 240'%3E%3Ccircle cx='318' cy='46' r='84' fill-opacity='.22'/%3E%3Cpath fill-opacity='.30' d='M360 0C306 26 262 84 240 146 222 198 178 226 112 240H360Z'/%3E%3Cpath fill-opacity='.55' d='M360 72C322 92 300 136 288 176 276 214 246 234 204 240H360Z'/%3E%3Cpath fill-opacity='.72' d='M360 150C338 160 324 186 316 210 308 230 296 238 282 240H360Z'/%3E%3C/svg%3E") right bottom / auto 100% no-repeat;
  transition: opacity .2s var(--tn-ease);
}
/* Soft glow for depth */
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a > .tn-dot::after {
  content: ""; position: absolute; z-index: -2; pointer-events: none;
  width: 300px; aspect-ratio: 1; right: -120px; bottom: -150px;
  border-radius: 46% 54% 42% 58% / 52% 44% 56% 48%;
  background: inherit; opacity: .14; filter: blur(36px);
}
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a:hover > .tn-dot::before { opacity: .42; }

/* Counts (points / notes): a light pill at the top-right */
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a > p:last-child {
  grid-column: 3; grid-row: 1; align-self: center; margin: 0;
  padding: 4px 10px; border-radius: 999px;
  background: rgb(255 255 255 / .82); box-shadow: inset 0 0 0 1px rgb(22 32 48 / .08);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: .75rem; line-height: 1rem; font-weight: 600; color: var(--tn-text-secondary); white-space: nowrap;
}

/* Main block: title, then the info line at the bottom */
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a > div {
  grid-column: 1 / -1; grid-row: 2; align-self: stretch;
  display: flex; flex-direction: column; min-height: 100%; padding-top: 18px;
}
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a > div > p:first-child {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
  font-size: 1.1875rem; line-height: 1.6rem; font-weight: 650; letter-spacing: -0.022em; color: var(--tn-text);
  max-width: 34ch; text-wrap: balance;
}
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a > div > p:nth-child(2) {
  margin-top: auto; padding-top: 18px; padding-right: 44px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; white-space: normal;
  font-size: .8125rem; line-height: 1.25rem; font-weight: 500; color: var(--tn-text-secondary);
}
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a > div > p:nth-child(3) {
  margin-top: 8px; font-size: .75rem; font-weight: 600; color: var(--tn-text-secondary);
}

/* Open arrow: the tile already opens the event; the arrow only shows it */
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a::after {
  content: ""; position: absolute; right: 18px; bottom: 18px; width: 32px; height: 32px; border-radius: 50%;
  background: rgb(255 255 255 / .86) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f5a67' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / 15px no-repeat;
  box-shadow: inset 0 0 0 1px rgb(22 32 48 / .08), 0 2px 6px -2px rgb(22 32 48 / .14);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform .2s var(--tn-ease), background-color .2s var(--tn-ease);
}
main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a:hover::after { transform: translateX(2px); background-color: #ffffff; }

/* Phone */
@media (max-width: 39.99rem) {
  main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a { min-height: 156px; padding: 18px 18px 18px; border-radius: 18px; }
  main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a > div { padding-top: 14px; }
  main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a > div > p:first-child { font-size: 1.0625rem; line-height: 1.4rem; }
  main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a::after { right: 14px; bottom: 14px; width: 30px; height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a,
  main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a::after { transition: none; }
  main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a:hover,
  main div:has(> .tn-scroll-fade.mb-4.pb-1 > button[aria-pressed]):has(> section) > section > .tn-card > ul > li > a:hover::after { transform: none; }
}

/* ---------- Wyszukiwanie (/szukaj) ----------
   Scoped to the page whose first card holds the "Szukana fraza" field. Visual only: same inputs, filters,
   result links, highlighting and states. Three levels: (1) the search field, (2) scope capsules,
   (3) categories and parameters below a hairline. Results: one column of cards with a quiet pastel
   wave in the top-right corner, coloured by the existing content markers. */

/* ---- panel ---- */
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> label) {
  position: relative; isolation: isolate; overflow: hidden;
  gap: 16px; padding: 22px 24px 20px; margin-bottom: 0;
  border-radius: 20px; border: 1px solid rgb(22 32 48 / .06);
  background: linear-gradient(180deg, #ffffff 0%, #fdfefe 100%);
  box-shadow: 0 1px 2px rgb(22 32 48 / .04), 0 16px 40px -30px rgb(22 32 48 / .30);
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> label)::before {
  content: ""; position: absolute; z-index: -1; top: 0; right: 0; width: 420px; height: 150px; pointer-events: none;
  background: linear-gradient(120deg, var(--tn-accent) 20%, #4fbf9f 70%);
  opacity: .10;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 420 150'%3E%3Ccircle cx='392' cy='10' r='96' fill-opacity='.45'/%3E%3Cpath fill-opacity='.55' d='M420 0H120C170 30 230 58 300 66 352 72 392 66 420 58Z'/%3E%3Cpath d='M420 0H262C290 22 330 36 372 38 394 39 410 36 420 32Z'/%3E%3C/svg%3E") right top / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 420 150'%3E%3Ccircle cx='392' cy='10' r='96' fill-opacity='.45'/%3E%3Cpath fill-opacity='.55' d='M420 0H120C170 30 230 58 300 66 352 72 392 66 420 58Z'/%3E%3Cpath d='M420 0H262C290 22 330 36 372 38 394 39 410 36 420 32Z'/%3E%3C/svg%3E") right top / 100% 100% no-repeat;
}

/* (1) search field */
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card > label:has(input[aria-label="Szukana fraza"]) {
  height: 56px; padding: 0 10px 0 18px; gap: 12px; border-radius: 14px;
  background: var(--tn-bg); border: 1px solid var(--tn-separator-strong);
  box-shadow: 0 1px 2px rgb(22 32 48 / .05), 0 12px 30px -24px rgb(22 32 48 / .45);
  transition: border-color .16s var(--tn-ease), box-shadow .16s var(--tn-ease);
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card > label:has(input[aria-label="Szukana fraza"]):hover { border-color: #c3ccd6; }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card > label:has(input[aria-label="Szukana fraza"]):focus-within {
  background: var(--tn-bg); border-color: var(--tn-accent);
  box-shadow: 0 0 0 4px var(--tn-accent-soft), 0 12px 30px -24px rgb(11 122 143 / .55);
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card > label:has(input[aria-label="Szukana fraza"]) > svg { width: 20px; height: 20px; color: var(--tn-text-tertiary); transition: color .16s var(--tn-ease); }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card > label:has(input[aria-label="Szukana fraza"]):focus-within > svg { color: var(--tn-accent); }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) input[aria-label="Szukana fraza"] {
  font-size: 1.0625rem; font-weight: 450; letter-spacing: -0.01em; color: var(--tn-text);
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) input[aria-label="Szukana fraza"]::placeholder { color: var(--tn-text-tertiary); }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card > label > button[aria-label="Wyczyść"] {
  width: 32px; height: 32px; margin-right: 0; background: var(--tn-bg-tertiary); color: var(--tn-text-secondary);
  transition: background-color .16s var(--tn-ease), color .16s var(--tn-ease), transform .16s var(--tn-ease);
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card > label > button[aria-label="Wyczyść"]:hover { background: var(--tn-bg-hover); color: var(--tn-text); }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card > label > button[aria-label="Wyczyść"]:active { transform: scale(.94); }

/* (2) scope capsules */
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) [aria-label="Gdzie szukać"] { gap: 8px; padding-top: 2px; padding-bottom: 2px; }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) [aria-label="Gdzie szukać"] > button {
  height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--tn-bg); color: var(--tn-text-secondary);
  font-size: .8125rem; font-weight: 550;
  box-shadow: inset 0 0 0 1px var(--tn-separator-strong), 0 1px 2px rgb(22 32 48 / .04);
  transition: background-color .16s var(--tn-ease), color .16s var(--tn-ease), box-shadow .16s var(--tn-ease);
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) [aria-label="Gdzie szukać"] > button:hover { background: var(--tn-bg-subtle); color: var(--tn-text); box-shadow: inset 0 0 0 1px #c3ccd6, 0 2px 6px -2px rgb(22 32 48 / .10); }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) [aria-label="Gdzie szukać"] > button[aria-pressed="true"] {
  background: var(--tn-text); color: #ffffff; box-shadow: 0 1px 2px rgb(22 32 48 / .18), 0 6px 14px -8px rgb(22 32 48 / .45);
}

/* mobile "Filtry" toggle */
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) button[aria-controls="filtry-wyszukiwania"] {
  height: 44px; border-radius: 12px; background: var(--tn-bg); box-shadow: inset 0 0 0 1px var(--tn-separator-strong);
}

/* (3) categories and parameters, separated by a hairline */
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) #filtry-wyszukiwania {
  gap: 16px; padding-top: 16px; border-top: 1px solid var(--tn-separator);
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) #filtry-wyszukiwania button[aria-pressed] {
  height: 30px; padding: 0 12px; gap: 7px; border-radius: 999px;
  background: var(--tn-bg-subtle); color: var(--tn-text-secondary);
  font-size: .78125rem; font-weight: 550;
  box-shadow: inset 0 0 0 1px var(--tn-separator);
  transition: background-color .16s var(--tn-ease), color .16s var(--tn-ease), box-shadow .16s var(--tn-ease);
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) #filtry-wyszukiwania button[aria-pressed]:hover { background: var(--tn-bg); color: var(--tn-text); box-shadow: inset 0 0 0 1px var(--tn-separator-strong); }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) #filtry-wyszukiwania button[aria-pressed="true"] {
  background: var(--tn-accent-soft); color: var(--tn-accent-hover); box-shadow: inset 0 0 0 1px rgb(11 122 143 / .35);
}
@media (pointer: coarse) {
  main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) [aria-label="Gdzie szukać"] > button,
  main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) #filtry-wyszukiwania button[aria-pressed] { height: 40px; }
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) #filtry-wyszukiwania label {
  font-size: .75rem; font-weight: 600; color: var(--tn-text-tertiary); letter-spacing: 0;
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) #filtry-wyszukiwania input,
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) #filtry-wyszukiwania select {
  height: 40px; min-height: 40px; border-radius: 10px;
  background-color: var(--tn-bg-subtle); border: 1px solid var(--tn-separator-strong); box-shadow: none;
  font-size: .875rem; color: var(--tn-text);
  transition: border-color .16s var(--tn-ease), box-shadow .16s var(--tn-ease), background-color .16s var(--tn-ease);
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) #filtry-wyszukiwania input:hover,
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) #filtry-wyszukiwania select:hover { border-color: #c3ccd6; background-color: var(--tn-bg); }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) #filtry-wyszukiwania input:focus,
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) #filtry-wyszukiwania select:focus {
  outline: none; background-color: var(--tn-bg); border-color: var(--tn-accent); box-shadow: 0 0 0 3px var(--tn-accent-soft);
}

/* ---- results count: a quiet divider between panel and results ---- */
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > p[aria-live] {
  display: flex; align-items: center; gap: 14px; margin: 28px 2px 14px; padding: 0;
  font-size: .8125rem; font-weight: 600; color: var(--tn-text-secondary); font-variant-numeric: tabular-nums;
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > p[aria-live]::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--tn-separator); }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card.items-center { margin-top: 24px; border-radius: 20px; }

/* ---- results ---- */
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) {
  background: none; box-shadow: none; border-radius: 0; overflow: visible;
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul { display: flex; flex-direction: column; gap: 10px; }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li { border-width: 0; }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a {
  --res-c: var(--tn-text-tertiary);
  position: relative; isolation: isolate; overflow: hidden;
  padding: 16px 22px 18px; border-radius: 16px;
  border: 1px solid rgb(22 32 48 / .07); background: var(--tn-bg);
  box-shadow: 0 1px 2px rgb(22 32 48 / .04);
  transition: transform .18s var(--tn-ease), box-shadow .18s var(--tn-ease), border-color .18s var(--tn-ease);
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a:hover {
  transform: translateY(-1px); background: var(--tn-bg); border-color: rgb(22 32 48 / .11);
  box-shadow: 0 2px 4px rgb(22 32 48 / .04), 0 14px 30px -20px rgb(22 32 48 / .30);
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a:focus-visible { outline: none; box-shadow: var(--tn-shadow-focus); }

/* content-type colour, from the markers the app already renders */
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a:has(> svg.text-tn-treasure) { --res-c: var(--tn-treasure); }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a:has(> svg.text-tn-accent) { --res-c: var(--tn-accent); }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a:has(svg.text-tn-maxim) { --res-c: var(--tn-maxim); }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a:has(svg.text-tn-example) { --res-c: var(--tn-example); }

/* corner wave: top-right only, never under the text block */
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a:not(:has(.tn-dot))::before,
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a .tn-dot::before {
  content: ""; position: absolute; z-index: -1; top: 0; right: 0; width: 230px; height: 96px; pointer-events: none;
  background: var(--res-c); opacity: .16;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 230 96'%3E%3Ccircle cx='218' cy='6' r='54' fill-opacity='.38'/%3E%3Cpath fill-opacity='.5' d='M230 0H60C88 18 118 34 154 42 186 49 212 48 230 44Z'/%3E%3Cpath d='M230 0H150C164 14 184 22 204 25 216 27 224 26 230 24Z'/%3E%3C/svg%3E") right top / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 230 96'%3E%3Ccircle cx='218' cy='6' r='54' fill-opacity='.38'/%3E%3Cpath fill-opacity='.5' d='M230 0H60C88 18 118 34 154 42 186 49 212 48 230 44Z'/%3E%3Cpath d='M230 0H150C164 14 184 22 204 25 216 27 224 26 230 24Z'/%3E%3C/svg%3E") right top / 100% 100% no-repeat;
  transition: opacity .18s var(--tn-ease);
}
/* event and note results take the colour of their own category dot */
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a .tn-dot::before { background: inherit; opacity: .2; }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a:hover:not(:has(.tn-dot))::before,
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a:hover .tn-dot::before { opacity: .26; }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a .tn-dot {
  width: 9px !important; height: 9px !important; box-shadow: 0 0 0 3px rgb(255 255 255 / .9), 0 0 0 4px rgb(22 32 48 / .07);
}

/* type icon (treasures, documents) in a soft tile */
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a.flex { gap: 14px; align-items: flex-start; }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a > svg {
  width: 18px; height: 18px; padding: 9px; box-sizing: content-box; margin-top: 1px; border-radius: 11px;
  background: color-mix(in srgb, currentColor 11%, #ffffff);
}

/* text hierarchy inside a result */
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a .text-tn-xs:first-child {
  font-size: .78125rem; line-height: 1.125rem; font-weight: 500; color: var(--tn-text-tertiary); padding-right: 120px;
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a .font-medium {
  margin-top: 4px; font-size: .96875rem; line-height: 1.4rem; font-weight: 600; letter-spacing: -0.008em; color: var(--tn-text); overflow-wrap: anywhere;
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a .font-medium .font-normal { font-weight: 450; color: var(--tn-text-secondary); }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a .text-tn-sm {
  margin-top: 8px; max-width: 80ch; font-size: .90625rem; line-height: 1.65; color: #3a4552; overflow-wrap: anywhere;
}
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a p.flex-wrap.text-tn-xs:not(:first-child) { margin-top: 10px; gap: 6px; }
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a p.flex-wrap.text-tn-xs:not(:first-child) > span {
  padding: 3px 9px; border-radius: 999px; font-weight: 600; font-size: .71875rem;
}

/* found-word highlight: soft, rounded, high contrast */
main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) mark {
  padding: 0 3px; margin: 0 -1px; border-radius: 4px;
  background: #fcefc2; box-shadow: inset 0 -1.5px 0 #ecd27f;
  color: var(--tn-text); font-weight: 600;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ---- phone ---- */
@media (max-width: 39.99rem) {
  main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> label) { padding: 14px; gap: 12px; border-radius: 18px; }
  main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> label)::before { width: 260px; height: 100px; }
  main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card > label:has(input[aria-label="Szukana fraza"]) { height: 52px; padding-left: 14px; border-radius: 13px; }
  main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card > label > button[aria-label="Wyczyść"] { width: 40px; height: 40px; }
  main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a { padding: 14px 16px 16px; border-radius: 14px; }
  main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a .text-tn-xs:first-child { padding-right: 56px; }
  main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a:not(:has(.tn-dot))::before,
  main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a .tn-dot::before { width: 150px; height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a { transition: none; }
  main div:has(> .tn-card > label input[aria-label="Szukana fraza"]) > .tn-card:has(> ul) > ul > li > a:hover { transform: none; }
}

/* ---------- Sentencje i przykłady (/sentencje) ----------
   Scoped to the page with the "Sentencje i przykłady" tab list. Visual only: same links, buttons, filters,
   search and data. Tiles show the icon, categories, the text and the existing "Kategorie" action; the
   metadata line stays in the DOM (hidden on the tile, unchanged in data). Colours follow the content type:
   maxims lilac + powder pink, examples sage + pearl blue. */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) {
  --fk-ink: #7a4fa0; --fk-soft: #f4effa; --fk-a: #ddcdf3; --fk-b: #f6d7e4;
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]):has(> [role="tablist"] > [role="tab"]:last-child[aria-selected="true"]) {
  --fk-ink: #3d7558; --fk-soft: #edf5f0; --fk-a: #cfe6d7; --fk-b: #d5e5f4;
}

/* Sentencje / Przykłady switch */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > [role="tablist"] {
  margin-bottom: 16px; padding: 3px; gap: 2px; border-radius: 12px; background: var(--tn-bg-tertiary);
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > [role="tablist"] > [role="tab"] {
  height: 34px; padding: 0 14px; gap: 7px; border-radius: 9px; font-size: .84375rem; font-weight: 550; color: var(--tn-text-secondary);
  transition: background-color .16s var(--tn-ease), color .16s var(--tn-ease), box-shadow .16s var(--tn-ease);
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > [role="tablist"] > [role="tab"]:hover { color: var(--tn-text); }
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > [role="tablist"] > [role="tab"][aria-selected="true"] {
  background: var(--tn-bg); color: var(--tn-text); box-shadow: 0 0 0 1px rgb(22 32 48 / .06), 0 1px 3px rgb(22 32 48 / .10);
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > [role="tablist"] > [role="tab"][aria-selected="true"] > svg { color: var(--fk-ink); }
@media (pointer: coarse) { main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > [role="tablist"] > [role="tab"] { height: 40px; } }

/* Category filter capsules */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > [role="group"] { gap: 8px; margin-bottom: 14px; }
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > [role="group"] > button {
  height: 32px; padding: 0 13px; gap: 7px; border-radius: 999px;
  background: var(--tn-bg); color: var(--tn-text-secondary); font-size: .8125rem; font-weight: 550;
  box-shadow: inset 0 0 0 1px var(--tn-separator-strong), 0 1px 2px rgb(22 32 48 / .04);
  transition: background-color .16s var(--tn-ease), color .16s var(--tn-ease), box-shadow .16s var(--tn-ease);
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > [role="group"] > button:hover { background: var(--tn-bg-subtle); color: var(--tn-text); box-shadow: inset 0 0 0 1px #c3ccd6, 0 2px 6px -2px rgb(22 32 48 / .10); }
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > [role="group"] > button[aria-pressed="true"] {
  background: var(--fk-soft); color: var(--fk-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fk-ink) 35%, transparent);
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > [role="group"] > button > span { font-weight: 500; color: var(--tn-text-tertiary); opacity: 1; }
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > [role="group"] > button[aria-pressed="true"] > span { color: var(--fk-ink); opacity: .75; }
@media (pointer: coarse) { main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > [role="group"] > button { height: 40px; } }

/* Search within the tab */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > label:has(input[type="search"]) {
  height: 44px; padding: 0 12px 0 14px; gap: 10px; margin-bottom: 0; border-radius: 12px;
  background: var(--tn-bg); border: 1px solid var(--tn-separator-strong); box-shadow: 0 1px 2px rgb(22 32 48 / .04);
  transition: border-color .16s var(--tn-ease), box-shadow .16s var(--tn-ease);
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > label:has(input[type="search"]):hover { border-color: #c3ccd6; }
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > label:has(input[type="search"]):focus-within {
  border-color: var(--tn-accent); box-shadow: 0 0 0 4px var(--tn-accent-soft);
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > label:has(input[type="search"]):focus-within > svg { color: var(--tn-accent); }

/* Count: a quiet divider */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > p.text-tn-xs {
  display: flex; align-items: center; gap: 14px; margin: 22px 2px 12px;
  font-size: .8125rem; font-weight: 600; color: var(--tn-text-secondary); font-variant-numeric: tabular-nums;
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > p.text-tn-xs::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--tn-separator); }

/* ---- grid of tiles ---- */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 42rem) {
  main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}
@media (min-width: 80rem) { main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul { gap: 16px; } }

main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card {
  position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; min-width: 0;
  border-radius: 18px; border: 1px solid rgb(22 32 48 / .07);
  background: linear-gradient(180deg, #ffffff 0%, #fdfdfe 60%, #fbfbfd 100%);
  box-shadow: 0 1px 2px rgb(22 32 48 / .04), 0 10px 26px -22px rgb(22 32 48 / .25);
  content-visibility: auto; contain-intrinsic-size: auto 168px;
  transition: transform .2s var(--tn-ease), box-shadow .2s var(--tn-ease), border-color .2s var(--tn-ease);
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card:hover {
  transform: translateY(-2px); border-color: rgb(22 32 48 / .10);
  box-shadow: 0 2px 4px rgb(22 32 48 / .05), 0 16px 32px -20px rgb(22 32 48 / .30);
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card:has(> a:focus-visible) { box-shadow: var(--tn-shadow-focus); }

/* pastel waves, bottom-right: two-tone gradient through a layered wave mask */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card::before {
  content: ""; position: absolute; z-index: -1; right: 0; bottom: 0; width: min(78%, 360px); height: 150px; pointer-events: none;
  background: linear-gradient(135deg, var(--fk-a) 10%, var(--fk-b) 90%); opacity: .62;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 360 150' preserveAspectRatio='none'%3E%3Cpath fill-opacity='.35' d='M360 18C300 30 262 72 214 98 160 127 92 128 20 150H360Z'/%3E%3Cpath fill-opacity='.6' d='M360 66C318 76 288 108 250 126 220 140 186 146 150 150H360Z'/%3E%3Cpath d='M360 112C340 118 324 132 306 142 296 147 286 149 276 150H360Z'/%3E%3C/svg%3E") right bottom / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 360 150' preserveAspectRatio='none'%3E%3Cpath fill-opacity='.35' d='M360 18C300 30 262 72 214 98 160 127 92 128 20 150H360Z'/%3E%3Cpath fill-opacity='.6' d='M360 66C318 76 288 108 250 126 220 140 186 146 150 150H360Z'/%3E%3Cpath d='M360 112C340 118 324 132 306 142 296 147 286 149 276 150H360Z'/%3E%3C/svg%3E") right bottom / 100% 100% no-repeat;
  transition: opacity .2s var(--tn-ease);
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card::after {
  content: ""; position: absolute; z-index: -2; inset: 0; pointer-events: none;
  background: radial-gradient(60% 75% at 100% 100%, color-mix(in srgb, var(--fk-a) 38%, transparent) 0%, transparent 70%);
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card:hover::before { opacity: .8; }

/* head row (icon · categories · action) shown first */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > div {
  order: -1; gap: 6px; min-height: 28px; padding: 14px 12px 0 16px; border-left-width: 0;
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > div::before {
  content: ""; flex: none; width: 28px; height: 28px; margin-right: 4px; border-radius: 9px;
  background: var(--fk-soft) no-repeat center / 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a4fa0' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3Cpath d='M8 12a2 2 0 0 0 2-2V8H8M14 12a2 2 0 0 0 2-2V8h-2'/%3E%3C/svg%3E");
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card:has(> a.border-tn-example) > div::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233d7558' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5M9 18h6M10 22h4'/%3E%3C/svg%3E");
}
/* category labels */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > div > span.rounded-full {
  height: 22px; display: inline-flex; align-items: center; padding: 0 9px;
  background: var(--fk-soft); color: var(--fk-ink); font-size: .71875rem; font-weight: 600; letter-spacing: 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fk-ink) 14%, transparent);
}
/* "bez kategorii" placeholder: not shown on tiles */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > div > span.text-tn-text-tertiary { display: none; }
/* existing "Kategorie" action, as a quiet icon button (label stays as aria-label) */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > div > button {
  width: 32px; height: 32px; min-width: 32px; padding: 0; gap: 0; border-radius: 9px; font-size: 0;
  background: transparent; color: var(--tn-text-tertiary); box-shadow: none;
  transition: background-color .16s var(--tn-ease), color .16s var(--tn-ease);
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > div > button > svg { width: 16px; height: 16px; }
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > div > button:hover { background: rgb(22 32 48 / .06); color: var(--tn-text); }
@media (pointer: coarse) { main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > div > button { width: 40px; height: 40px; } }

/* body: the text is the hero; metadata line hidden on the tile */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > a {
  flex: 1 1 auto; display: block; padding: 12px 20px 20px 18px; border-left-width: 0; background: transparent; color: var(--tn-text);
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > a:hover { background: transparent; }
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > a:focus-visible { outline: none; box-shadow: none; }
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > a > p:first-child {
  font-size: 1rem; line-height: 1.65; font-weight: 450; letter-spacing: -0.006em; color: var(--tn-text);
  overflow-wrap: anywhere; hyphens: auto;
}
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > a > p:not(:first-child) { display: none; }
/* maxims: always in full */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > a.border-tn-maxim > p:first-child {
  display: block; -webkit-line-clamp: unset; overflow: visible; font-size: 1.0625rem; line-height: 1.6; font-weight: 500; letter-spacing: -0.012em;
}
/* examples: a preview clamped by lines (6 desktop, 5 tablet, 4 phone); the tile opens the full text */
main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > a.border-tn-example > p:first-child {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; overflow: hidden; text-overflow: ellipsis;
  white-space: normal; /* preview only: paragraphs run on, so the clamp never ends on an empty line */
}
@media (max-width: 63.99rem) {
  main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > a.border-tn-example > p:first-child { -webkit-line-clamp: 5; }
}
@media (max-width: 41.99rem) {
  main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > a.border-tn-example > p:first-child { -webkit-line-clamp: 4; }
  main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > a { padding: 10px 16px 18px 14px; }
  main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > div { padding: 12px 8px 0 14px; }
  main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card > a.border-tn-maxim > p:first-child { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card { transition: none; }
  main div:has(> [role="tablist"][aria-label="Sentencje i przykłady"]) > ul > li.tn-card:hover { transform: none; }
}
