/* Czcionki dołączone lokalnie: Atkinson Hyperlegible Next (interfejs i tekst na tablicy), Zilla Slab (nagłówki), Caveat (pismo odręczne na tablicy). */
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(/fonts/atkinson-latin-ext.woff2) format("woff2-variations");
  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: "Atkinson Hyperlegible Next"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(/fonts/atkinson-latin.woff2) format("woff2-variations");
  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; }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: italic; font-display: swap; font-weight: 200 800;
  src: url(/fonts/atkinson-latin-ext-italic.woff2) format("woff2-variations");
  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: "Atkinson Hyperlegible Next"; font-style: italic; font-display: swap; font-weight: 200 800;
  src: url(/fonts/atkinson-latin-italic.woff2) format("woff2-variations");
  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; }
@font-face { font-family: "Zilla Slab"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(/fonts/zilla-latin-ext-400.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: "Zilla Slab"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(/fonts/zilla-latin-400.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; }
@font-face { font-family: "Zilla Slab"; font-style: italic; font-display: swap; font-weight: 400;
  src: url(/fonts/zilla-latin-ext-400-italic.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: "Zilla Slab"; font-style: italic; font-display: swap; font-weight: 400;
  src: url(/fonts/zilla-latin-400-italic.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; }
@font-face { font-family: "Zilla Slab"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(/fonts/zilla-latin-ext-500.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: "Zilla Slab"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(/fonts/zilla-latin-500.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; }
@font-face { font-family: "Zilla Slab"; font-style: normal; font-display: swap; font-weight: 600;
  src: url(/fonts/zilla-latin-ext-600.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: "Zilla Slab"; font-style: normal; font-display: swap; font-weight: 600;
  src: url(/fonts/zilla-latin-600.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; }
@font-face { font-family: "Caveat"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(/fonts/caveat-latin-ext-500.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: "Caveat"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(/fonts/caveat-latin-500.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; }
@font-face { font-family: "Caveat"; font-style: normal; font-display: swap; font-weight: 700;
  src: url(/fonts/caveat-latin-ext-700.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: "Caveat"; font-style: normal; font-display: swap; font-weight: 700;
  src: url(/fonts/caveat-latin-700.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; }

/* Papier, atrament i jedna zieleń jak szkolna tablica. Płaskie kolory, bez gradientów. */
:root {
  --bg: #f3f0e8;
  --surface: #fbfaf6;
  --surface-2: #eeeae0;
  --border: #dfd9cc;
  --text: #1c1b18;
  --muted: #6f695e;
  --accent: #2c5a46;
  --accent-hover: #234a39;
  --accent-soft: rgba(44, 90, 70, .1);
  --on-accent: #f7f5ee;
  --chalk: #e9b949;
  --danger: #b4432e;
  --danger-soft: #f7e6e1;
  --ok: #2c7a55;
  --radius: 8px;
  --shadow: 0 1px 0 rgba(28, 27, 24, .04), 0 2px 8px rgba(28, 27, 24, .05);
  --shadow-lg: 0 16px 40px rgba(28, 27, 24, .16);
  --font: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --serif: "Zilla Slab", Rockwell, Georgia, serif;
  --hand: "Caveat", "Segoe Print", cursive;
  --stage-bg: #e6e1d6;
  --tool-fg: #3a3730;
  --page-bg: #ffffff;
  --editor-bg: rgba(255, 255, 255, .6);
  --blocker-bg: rgba(230, 225, 214, .92);
  --toast-bg: #1c1b18;
  --hover-border: #cfc7b6;
  --tag-ok-bg: #e4ede6; --tag-ok-fg: #2c5a46;
  --tag-warn-bg: #f6ecd3; --tag-warn-fg: #82601a;
  --tag-off-bg: #eeeae0; --tag-off-fg: #6f695e;
  --grid-line: rgba(28, 27, 24, .035);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #141513;
  --surface: #1b1c1a;
  --surface-2: #242522;
  --border: #31332f;
  --text: #ebe8e0;
  --muted: #9a958a;
  --accent: #8cc2a5;
  --accent-hover: #a2d1b7;
  --accent-soft: rgba(140, 194, 165, .13);
  --on-accent: #10221a;
  --chalk: #e9c46a;
  --danger: #e2826c;
  --danger-soft: rgba(226, 130, 108, .13);
  --ok: #8cc2a5;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 2px 10px rgba(0, 0, 0, .25);
  --shadow-lg: 0 16px 44px rgba(0, 0, 0, .55);
  --stage-bg: #0f100e;
  --tool-fg: #d4d0c6;
  --page-bg: #1d2027;
  --editor-bg: rgba(29, 32, 39, .6);
  --blocker-bg: rgba(15, 16, 14, .92);
  --toast-bg: #2b2d29;
  --hover-border: #44473f;
  --tag-ok-bg: rgba(140, 194, 165, .13); --tag-ok-fg: #9fcdb3;
  --tag-warn-bg: rgba(233, 196, 106, .13); --tag-warn-fg: #e9c46a;
  --tag-off-bg: #242522; --tag-off-fg: #9a958a;
  --grid-line: rgba(255, 255, 255, .03);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

/* Przyciski */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--text);
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, .icon-btn:focus-visible, .tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: #f3c4c4; }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg, .icon-btn svg { width: 18px; height: 18px; flex: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }

/* Formularze */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input {
  height: 38px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.error-msg { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0 10px; }

/* Modale */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 10, 15, .5);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px;
  animation: fade .12s ease-out;
}
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 460px; padding: 22px; max-height: 90vh; overflow: auto;
}
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } }

/* Toasty */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--toast-bg); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 14px; animation: fade .15s; }
.toast.error { background: var(--danger); }

/* Logowanie */
.auth-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 30px 28px; border: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.brand-logo svg { width: 20px; height: 20px; }
.auth-card h1 { font-size: 22px; margin: 22px 0 6px; }
.auth-card p.sub { color: var(--muted); margin: 0 0 22px; }
.auth-card .btn.primary { width: 100%; height: 40px; }

/* Segmentowany wybór */
.segmented { display: flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 3px; }
.segmented button { flex: 1; border: 0; background: transparent; padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--muted); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }

.hint { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }

/* Udostępnianie */
.share-link { display: flex; gap: 8px; }
.share-link .input { font-size: 13px; }
.share-qr { display: flex; gap: 16px; align-items: center; margin-top: 16px; padding: 14px; background: var(--surface-2); border-radius: 10px; }
.share-qr .qr { width: 120px; height: 120px; background: #fff; border-radius: 8px; flex: none; }
.share-qr .qr svg { width: 100%; height: 100%; display: block; }
.share-off { padding: 16px; background: var(--surface-2); border-radius: 10px; color: var(--muted); margin-top: 14px; }


/* Przełącznik motywu */
.theme-toggle svg { transition: transform .25s; }
.theme-toggle:hover svg { transform: rotate(-20deg); }

/* Etykiety */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag svg { width: 12px; height: 12px; }
.tag.ok { background: var(--tag-ok-bg); color: var(--tag-ok-fg); }
.tag.warn { background: var(--tag-warn-bg); color: var(--tag-warn-fg); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }

/* Okno PDF / stron */
.pdf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-height: 46vh; overflow-y: auto; padding: 4px; margin: 0 -4px; }
.pdf-card { position: relative; border: 2px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface); transition: border-color .12s, opacity .12s; }
.pdf-card canvas { display: block; width: 100%; aspect-ratio: 1600 / 1000; background: var(--page-bg); }
.pdf-card .cap { display: flex; align-items: center; gap: 6px; padding: 5px 8px; font-size: 12.5px; border-top: 1px solid var(--border); }
.pdf-card .cap span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-card input { margin: 0; accent-color: var(--accent); }
.pdf-card.on { border-color: var(--accent); }
.pdf-card:not(.on) { opacity: .55; }
.pdf-opts { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0 0; }
.pdf-opts select { height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); padding: 0 8px; }
.pdf-opts label { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }

/* Dane logowania */
.cred { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 8px 12px; align-items: center; font-size: 14px; }
.cred .k { color: var(--muted); font-size: 13px; }
.cred .v { font-family: Consolas, "Cascadia Mono", monospace; font-size: 14.5px; word-break: break-all; }
.cred .icon-btn { width: 30px; height: 30px; }
.cred .icon-btn svg { width: 16px; height: 16px; }
.callout { background: var(--accent-soft); color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin: 12px 0; }
.cred .v .hint { font-family: var(--font); font-size: 13px; }


/* ===================== Wykończenie: spokojnie, papierowo ===================== */
body { font-size: 14.5px; }
h1, h2, .serif { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; font-optical-sizing: auto; }
.hand { font-family: var(--hand); font-weight: 700; }

/* Tło stron panelu: delikatna kratka jak w zeszycie */
body.paper {
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 24px 24px;
}
/* Kółka połączone liniami (js/bgdots.js) – pod całą treścią, jak w kursie */
.bg-dots { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
/* Wysokość największego widoku – chowający się pasek adresu (tablet, telefon) nie zmienia rozmiaru tła. */
@supports (height: 100lvh) { .bg-dots { bottom: auto; height: 100lvh; } }

.btn { border-radius: var(--radius); font-weight: 500; transition: background .12s, border-color .12s, color .12s; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); filter: none; }
.icon-btn { border-radius: var(--radius); }
.input { border-radius: var(--radius); }
.input:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.modal { border-radius: 14px; border: 1px solid var(--border); }
.modal h2 { font-size: 22px; }
.toast { border-radius: 10px; }
.segmented button.active { color: var(--accent); }
.tag { font-weight: 500; }

/* Logo: prosty kafel jak kawałek tablicy */
.brand { font-weight: 600; letter-spacing: -.01em; }
.brand-logo { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: var(--on-accent); }
.brand-logo svg { width: 20px; height: 20px; }
.brand .brand-text { font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.05; }
.brand small { display: block; font-family: var(--font); font-size: 11.5px; font-weight: 400; color: var(--muted); letter-spacing: .02em; margin-top: 2px; }

/* Logowanie: z lewej szkolna tablica z rysunkami kredą */
.auth-split { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); }
.auth-hero {
  position: relative; overflow: hidden; padding: 44px 48px; display: flex; flex-direction: column; justify-content: space-between;
  background-color: #23392f; color: #f1eee6;
  border-right: 10px solid #6e5034; /* rama tablicy */
}
.auth-hero::before { /* kredowy kurz */
  content: ''; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.auth-hero .brand { color: #f1eee6; position: relative; }
.auth-hero .brand-logo { background: rgba(241, 238, 230, .12); color: #f1eee6; }
.auth-hero .brand small { color: rgba(241, 238, 230, .6); }
.auth-hero h2 { font-family: var(--serif); font-weight: 500; font-size: 46px; line-height: 1.08; margin: 0; max-width: 460px; letter-spacing: -.02em; }
.auth-hero h2 em { font-style: italic; color: var(--chalk); }
.auth-hero p { color: rgba(241, 238, 230, .72); max-width: 420px; font-size: 15px; line-height: 1.6; }
.auth-hero .doodles { position: absolute; inset: 0; pointer-events: none; }
.auth-hero .doodles svg { width: 100%; height: 100%; }
.auth-side { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-side .auth-card { box-shadow: none; border: 0; background: transparent; max-width: 380px; padding: 0; }
.auth-card h1 { font-size: 32px; margin-bottom: 6px; }
.auth-card .hand-note { font-size: 14.5px; color: var(--muted); margin: 0 0 26px; display: block; }
@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { min-height: 230px; padding: 26px; border-right: 0; border-bottom: 8px solid #6e5034; }
  .auth-hero h2 { font-size: 34px; }
  .auth-hero p { display: none; }
}

/* Okno PDF */
.pdf-card { border-radius: 10px; }

/* Puste stany z rysunkiem */
.empty .doodle { width: 170px; height: 112px; margin: 0 auto 12px; display: block; color: var(--muted); }
.empty h2 { font-size: 22px; }

.insecure { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.45; margin-bottom: 16px; }

/* Stopka z regulaminem i polityką prywatności – na wszystkich stronach poza tablicą lekcji */
.site-foot { max-width: 900px; margin: 0 auto; padding: 18px 16px 32px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
/* Krótka strona: stopka na dole okna, nie w połowie ekranu tuż pod treścią. */
body.paper:has(> .site-foot) { height: auto; min-height: 100%; display: flex; flex-direction: column; }
body.paper:has(> .site-foot) > :is(header, main, .site-foot) { width: 100%; }
body.paper:has(> .site-foot) > main { flex: 1 0 auto; }
body.paper:has(> .site-foot) > .site-foot { flex-shrink: 0; }
.site-foot a { color: inherit; }
.site-foot a:hover, .site-foot a[aria-current] { color: var(--accent); }
.auth-card .site-foot { margin-top: 22px; padding: 16px 0 0; }

/* Łamanie wierszy: bez pojedynczych słów w ostatnim wierszu akapitu, nagłówki wyrównane (tam, gdzie przeglądarka to umie) */
p, li, dd, summary { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }

/* ===================== Telefon i tablet (dotyk, iPhone/iPad) ===================== */
/* Bez szarego błysku po dotknięciu (iOS) i bez opóźnienia „czy to podwójne dotknięcie” na przyciskach.
   Powiększanie palcami stron z tekstem zostaje. */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button, label, summary, select, input, textarea, [role="button"] { touch-action: manipulation; }
/* Modale: wysokość widocznego ekranu (pasek adresu Safari nie ucina dołu okna), przewijanie tylko w oknie */
.modal { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
body:has(.modal-backdrop) { overflow: hidden; }
#toasts { bottom: calc(18px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); }
.toast { text-align: center; }

@media (pointer: coarse) {
  /* Cele dotyku ~44 px */
  .btn { min-height: 40px; }
  .btn.small { height: auto; min-height: 36px; }
  .icon-btn { width: 44px; height: 44px; }
  .input { height: 44px; }
  .segmented button { min-height: 36px; }
  /* iOS powiększa stronę przy fokusie na polu z czcionką < 16 px */
  body.paper :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) { font-size: 16px !important; }
  /* Natywne pola daty i godziny w Safari: czytelne, równe z innymi polami */
  input.input[type="date"], input.input[type="time"] { -webkit-appearance: none; appearance: none; display: flex; align-items: center; min-width: 0; line-height: 44px; }
  input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
  select.input { -webkit-appearance: none; appearance: none; padding-right: 32px; background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f695e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
  .pdf-opts select { min-height: 40px; }
}

@media (max-width: 600px) {
  /* Okna jak arkusz od dołu ekranu: pełna szerokość, przyciski pod kciukiem, margines na pasek home */
  .modal-backdrop { align-items: flex-end; padding: 0; padding-top: env(safe-area-inset-top); }
  .modal {
    max-width: none !important; border-radius: 18px 18px 0 0; border-bottom: 0;
    padding: 20px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    max-height: calc(100vh - 12px); max-height: calc(100dvh - 12px - env(safe-area-inset-top));
    animation: sheet-up .2s ease-out;
  }
  .modal h2 { font-size: 20px; margin-bottom: 12px; }
  .modal .actions { flex-wrap: wrap; position: sticky; bottom: 0; z-index: 1; margin: 16px -16px calc(-16px - env(safe-area-inset-bottom)); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
  .modal .actions > .btn, .modal .actions > a.btn { flex: 1 1 auto; min-height: 44px; }
  .share-qr { flex-direction: column; text-align: center; }
  .share-link { flex-wrap: wrap; }
  .share-link .input { flex: 1 1 100%; }
  .cred { grid-template-columns: auto 1fr; }
  .cred .icon-btn { grid-column: 2; justify-self: end; margin-top: -6px; }
  .pdf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 40dvh; }
  .site-foot { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .site-foot a { padding: 6px 0; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }

/* Notch i zaokrąglone rogi w poziomie (viewport-fit=cover) */
.auth-side { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); padding-bottom: max(32px, env(safe-area-inset-bottom)); }
@media (max-width: 860px) {
  .auth-hero { min-height: 0; padding: max(22px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 22px max(22px, env(safe-area-inset-left)); gap: 18px; }
  .auth-hero h2 { font-size: 30px; }
  .auth-side { align-items: flex-start; padding-top: 24px; }
  .auth-card h1 { font-size: 28px; margin-top: 8px; }
  .auth-side .auth-card .btn.primary { height: 48px !important; font-size: 16px; }
}
