/* ==========================================================================
   Zadania — mati-it.pl
   Ciemny, „szklany” motyw z serifową typografią. Bez zewnętrznych fontów.
   ========================================================================== */

:root {
  --bg: #06080f;
  --bg-soft: #0a0e19;
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .018));
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .075);
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #eef1fb;
  --muted: #9aa4bb;
  --faint: #6d7791;
  --accent: #8b7bff;
  --accent-2: #4cd7e8;
  --accent-ink: #080b14;
  --success: #5ee0a0;
  --danger: #ff7288;
  --warn: #ffc857;
  --topbar-bg: rgba(6, 8, 15, .74);
  --input-bg: rgba(0, 0, 0, .22);
  --tabs-bg: rgba(0, 0, 0, .25);
  --drop-bg: rgba(255, 255, 255, .018);
  --code-bg: #05070d;
  --footer-bg: rgba(0, 0, 0, .16);
  --grid-line: rgba(255, 255, 255, .022);
  --radius: 22px;
  --radius-sm: 13px;
  --shadow: 0 32px 80px -34px rgba(0, 0, 0, .85);
  --font: "Segoe UI", system-ui, -apple-system, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --maxw: 1180px;
  --header-h: 70px;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f3f4f9;
  --bg-soft: #ffffff;
  --card-bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef0f7;
  --border: rgba(15, 23, 42, .1);
  --border-strong: rgba(15, 23, 42, .18);
  --text: #0e1327;
  --muted: #56607a;
  --faint: #7b8399;
  --accent: #5b4cf0;
  --accent-2: #0891b2;
  --accent-ink: #ffffff;
  --success: #0f9d63;
  --danger: #d92d4b;
  --warn: #a86a00;
  --topbar-bg: rgba(243, 244, 249, .86);
  --input-bg: #ffffff;
  --tabs-bg: #eceef6;
  --drop-bg: #f8f9fd;
  --code-bg: #0b1020;
  --footer-bg: #eceef6;
  --grid-line: rgba(15, 23, 42, .035);
  --shadow: 0 30px 70px -38px rgba(25, 35, 80, .38);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

/* Atrybut hidden musi wygrywać z display:flex/grid z poniższych reguł. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 12% -8%, rgba(139, 123, 255, .2), transparent 62%),
    radial-gradient(820px 480px at 96% 0%, rgba(76, 215, 232, .13), transparent 58%),
    radial-gradient(700px 620px at 48% 112%, rgba(184, 243, 91, .055), transparent 64%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[data-theme="light"] body {
  background-image:
    radial-gradient(900px 520px at 10% -10%, rgba(91, 76, 240, .13), transparent 62%),
    radial-gradient(820px 480px at 96% 0%, rgba(8, 145, 178, .09), transparent 58%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(75% 55% at 50% 0%, #000 10%, transparent 100%);
  mask-image: radial-gradient(75% 55% at 50% 0%, #000 10%, transparent 100%);
}

main { flex: 1; }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: 0; }
a { color: var(--text); }
button { font: inherit; }
img, svg { max-width: 100%; }
::selection { background: rgba(139, 123, 255, .4); }

.wrap {
  width: min(var(--maxw), calc(100% - 48px));
  margin-inline: auto;
}

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.dot { opacity: .5; }

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 700;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

/* --------------------------------------------------------------------------
   Nagłówek
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 26px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  color: #080b14;
  background: linear-gradient(135deg, #a99cff, #8b7bff 45%, #4cd7e8);
  box-shadow: 0 8px 24px -10px rgba(139, 123, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .45);
}
html[data-theme="light"] .brand-mark { color: #fff; }

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 17px; letter-spacing: -.01em; }
.brand-text span {
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 3px;
}

.nav { display: flex; align-items: center; gap: 2px; }

.nav-link {
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.is-active { color: var(--text); background: var(--surface); }
.nav-ext { color: var(--faint); }
.nav-ext span { font-size: 11px; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
html[data-theme="dark"] .i-moon { display: none; }
html[data-theme="light"] .i-sun { display: none; }

/* --------------------------------------------------------------------------
   Przyciski, chipy, formularze
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease, filter .16s ease;
}
.btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 12px 30px -14px rgba(124, 92, 255, .85), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.btn.primary:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn.tiny { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn.wide { width: 100%; height: 46px; font-size: 14.5px; }
.btn.icon { width: 40px; padding: 0; font-size: 20px; }
.btn.danger {
  color: var(--danger);
  border-color: rgba(255, 114, 136, .32);
  background: rgba(255, 114, 136, .08);
}
.btn.danger:hover { background: rgba(255, 114, 136, .15); border-color: rgba(255, 114, 136, .5); }
.btn.is-disabled { opacity: .38; pointer-events: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: none; }
.btn.is-flashing { color: var(--success); border-color: rgba(94, 224, 160, .5); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.chip span {
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.chip.is-active { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.chip.is-active span { color: var(--muted); }
.chip.is-active[data-subject] {
  color: rgb(var(--subj-rgb));
  border-color: rgba(var(--subj-rgb), .42);
  background: rgba(var(--subj-rgb), .13);
}

[data-subject="matematyka"] { --subj-rgb: 139, 123, 255; }
[data-subject="fizyka"] { --subj-rgb: 76, 215, 232; }
[data-subject="informatyka"] { --subj-rgb: 94, 224, 160; }
[data-subject="chemia"] { --subj-rgb: 255, 180, 84; }
[data-subject="biologia"] { --subj-rgb: 182, 227, 91; }
[data-subject="historia"] { --subj-rgb: 255, 143, 107; }
[data-subject="jezyki"] { --subj-rgb: 247, 139, 208; }
[data-subject="inne"] { --subj-rgb: 154, 164, 187; }

.subject {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(var(--subj-rgb), .3);
  border-radius: 7px;
  background: rgba(var(--subj-rgb), .12);
  color: rgb(var(--subj-rgb));
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pill.ok { color: var(--success); border-color: rgba(94, 224, 160, .3); background: rgba(94, 224, 160, .08); }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--faint);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { height: auto; padding: 11px 13px; resize: vertical; }
.field input::placeholder,
.field textarea::placeholder { color: var(--faint); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(139, 123, 255, .65);
  box-shadow: 0 0 0 3px rgba(139, 123, 255, .16);
}

.switch {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.35;
}
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 22px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .14);
  transition: background .16s ease;
}
html[data-theme="light"] .switch-track { background: rgba(15, 23, 42, .18); }
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .16s ease;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(139, 123, 255, .25); }

/* --------------------------------------------------------------------------
   Hero + upload
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: 1.02fr .98fr;
  gap: 60px;
  align-items: center;
  padding: 66px 0 54px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(94, 224, 160, .13);
  animation: pulse 2.8s ease-in-out infinite;
}

.hero h1 {
  font-family: var(--display);
  font-size: clamp(44px, 5.6vw, 72px);
  font-weight: 600;
  line-height: 1.01;
  letter-spacing: -.035em;
  margin: 18px 0 20px;
}
.grad {
  background: linear-gradient(100deg, #c0b6ff 0%, #71e3f0 52%, #c9f57c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
html[data-theme="light"] .grad {
  background: linear-gradient(100deg, #5b4cf0 0%, #0891b2 55%, #4d7c0f 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.lead {
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 54ch;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 22px;
  margin: 25px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
}
.hero-points li { display: inline-flex; align-items: center; gap: 7px; }
.tick {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(94, 224, 160, .12);
  color: var(--success);
  font-size: 10px;
  font-weight: 800;
}

.hero-stats {
  display: flex;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.stat { padding-right: 30px; margin-right: 30px; border-right: 1px solid var(--border); }
.stat:last-child { padding-right: 0; margin-right: 0; border-right: 0; }
.stat strong {
  display: block;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
}
.stat span {
  display: block;
  margin-top: 6px;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}

.upload-card {
  position: relative;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  scroll-margin-top: 96px;
}
.upload-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: 27px;
  padding: 1px;
  background: linear-gradient(145deg, rgba(139, 123, 255, .55), transparent 38%, transparent 62%, rgba(76, 215, 232, .35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
html[data-theme="light"] .upload-card { background: #fff; }

.upload-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.upload-head h2 { font-size: 19px; letter-spacing: -.01em; }
.upload-head p { margin-top: 3px; }

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(94, 224, 160, .26);
  border-radius: 99px;
  background: rgba(94, 224, 160, .07);
  color: var(--success);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-live span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(94, 224, 160, .15);
}

.upload-form { margin-top: 16px; }

.tabs {
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: 12px;
  background: var(--tabs-bg);
  margin-bottom: 14px;
}
.tab {
  flex: 1;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 188px;
  padding: 26px 18px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 18px;
  background: var(--drop-bg);
  text-align: center;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.drop:hover,
.drop.is-drag {
  border-color: rgba(139, 123, 255, .7);
  background: rgba(139, 123, 255, .075);
}
.drop.is-drag { transform: scale(1.01); }
.drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.drop-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 3px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(139, 123, 255, .95), rgba(76, 215, 232, .9));
  box-shadow: 0 12px 28px -14px rgba(139, 123, 255, .9);
}
.drop-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #080b14;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.drop strong { font-size: 15px; font-weight: 650; }
.drop-sub { font-size: 13px; color: var(--muted); }
.drop-sub u { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.drop-hint { margin-top: 3px; font-size: 11px; color: var(--faint); }

.picked {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.picked-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: rgba(139, 123, 255, .14);
  border: 1px solid rgba(139, 123, 255, .3);
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .06em;
}
.picked-info { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.picked-info strong {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picked-info span { font-size: 11.5px; color: var(--faint); }

.paste-area {
  width: 100%;
  min-height: 188px;
  padding: 13px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 18px;
  background: var(--drop-bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
}
.paste-area:focus { border-color: rgba(139, 123, 255, .7); background: rgba(139, 123, 255, .04); }

.upload-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
  animation: rise .3s ease both;
}
.subject-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.subject-picker .chip { height: 31px; padding: 0 11px; font-size: 12px; }

.advanced {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.advanced summary {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  line-height: 1;
}
.advanced[open] summary::before { content: "−"; }
.advanced[open] summary { color: var(--text); }
.advanced .field { margin-top: 2px; }

.form-hint { text-align: center; line-height: 1.45; }

.progress { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.progress-track {
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .1);
  overflow: hidden;
}
html[data-theme="light"] .progress-track { background: rgba(15, 23, 42, .1); }
.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .25s ease;
}
.progress span { font-size: 11.5px; color: var(--faint); text-align: center; }

.form-error {
  margin: 12px 0 0;
  padding: 10px 13px;
  border: 1px solid rgba(255, 114, 136, .3);
  border-radius: 11px;
  background: rgba(255, 114, 136, .09);
  color: #ffb3bf;
  font-size: 12.5px;
}
html[data-theme="light"] .form-error { color: #a3122c; }

.upload-success { padding: 18px 4px 4px; text-align: center; animation: rise .35s ease both; }
.success-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border: 1px solid rgba(94, 224, 160, .36);
  border-radius: 50%;
  background: rgba(94, 224, 160, .13);
  color: var(--success);
  font-size: 26px;
  font-weight: 700;
  animation: pop .4s cubic-bezier(.2, 1.4, .5, 1) both;
}
.upload-success h3 { font-size: 19px; letter-spacing: -.01em; }

.linkbox {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 15px 0;
  padding: 5px 5px 5px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
}
.linkbox input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
.success-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.noscript-note {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 200, 87, .3);
  border-radius: 10px;
  background: rgba(255, 200, 87, .08);
  color: var(--warn);
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Biblioteka
   -------------------------------------------------------------------------- */

.library { padding: 34px 0 80px; scroll-margin-top: 88px; }

.library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.library-head h2 {
  font-family: var(--display);
  font-size: 33px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.library-head p { margin-top: 4px; font-size: 13px; }

.library-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.sort-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.sort-tabs a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}
.sort-tabs a:hover { color: var(--text); }
.sort-tabs a.is-active { background: var(--surface-2); color: var(--text); }

.search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  min-width: 268px;
  padding: 0 5px 0 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}
.search svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.8;
  stroke-linecap: round;
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
}
.search input::placeholder { color: var(--faint); }
.search .btn { height: 30px; padding: 0 10px; }

.chips-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  margin-top: 22px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card-bg);
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
  animation: rise .45s ease both;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 100% at 0% 0%, rgba(var(--subj-rgb, 154, 164, 187), .15), transparent 56%);
  pointer-events: none;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--subj-rgb, 154, 164, 187), .36);
  box-shadow: 0 24px 54px -28px rgba(0, 0, 0, .9);
}
html[data-theme="light"] .card:hover { box-shadow: 0 22px 46px -26px rgba(25, 35, 80, .4); }

.card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  text-decoration: none;
  color: inherit;
  position: relative;
}
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}
.card-top time { font-size: 11px; color: var(--faint); white-space: nowrap; }
.card h3 {
  margin: 0 0 9px;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.36;
  letter-spacing: -.005em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card h3 a { text-decoration: none; color: inherit; }
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 15px;
  font-size: 11.5px;
  color: var(--muted);
}
.card-tags span { color: rgb(var(--subj-rgb, 154, 164, 187)); opacity: .85; }
.card-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  font-size: 11px;
  color: var(--faint);
}
.card-open { margin-left: auto; color: var(--muted); font-weight: 600; }
.card:hover .card-open { color: rgb(var(--subj-rgb, 154, 164, 187)); }

.grid .card:nth-child(2) { animation-delay: .03s; }
.grid .card:nth-child(3) { animation-delay: .06s; }
.grid .card:nth-child(4) { animation-delay: .09s; }
.grid .card:nth-child(5) { animation-delay: .12s; }
.grid .card:nth-child(6) { animation-delay: .15s; }
.grid .card:nth-child(7) { animation-delay: .18s; }
.grid .card:nth-child(8) { animation-delay: .21s; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 30px;
}
.pagination-info { font-size: 12px; color: var(--faint); }

.empty {
  margin-top: 22px;
  padding: 58px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: 20px;
  background: var(--drop-bg);
  text-align: center;
}
.empty-icon {
  font-family: var(--display);
  font-size: 42px;
  line-height: 1;
  color: var(--faint);
  opacity: .6;
  margin-bottom: 10px;
}
.empty h3 { font-size: 21px; margin-bottom: 7px; }
.empty p { max-width: 44ch; margin: 0 auto 18px; color: var(--muted); font-size: 13.5px; }

/* --------------------------------------------------------------------------
   Strona zadania
   -------------------------------------------------------------------------- */

.task-main { padding: 26px 0 68px; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--faint);
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }

.notice {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
  padding: 11px 14px;
  border: 1px solid rgba(94, 224, 160, .3);
  border-radius: 13px;
  background: rgba(94, 224, 160, .09);
  font-size: 13px;
}
.notice-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(94, 224, 160, .18);
  color: var(--success);
  font-size: 12px;
  font-weight: 800;
}
.notice .btn { margin-left: auto; flex-shrink: 0; }

.task-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 20px;
}
.task-heading { min-width: 0; }
.task-heading h1 {
  max-width: 24ch;
  margin: 10px 0 11px;
  font-family: var(--display);
  font-size: clamp(27px, 3.5vw, 40px);
  font-weight: 600;
  line-height: 1.13;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}
.task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 12px;
  color: var(--faint);
}
.task-meta .pill { margin-left: 3px; }
.task-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.task-tags a {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
}
.task-tags a:hover { color: var(--text); border-color: var(--border-strong); }

.task-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
  padding-top: 26px;
}

.viewer {
  border: 1px solid var(--border);
  border-radius: 19px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}
.viewer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 11px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.viewer-dots { display: flex; gap: 5px; flex-shrink: 0; }
.viewer-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.viewer-dots i:nth-child(1) { background: #ff5f57; }
.viewer-dots i:nth-child(2) { background: #febc2e; }
.viewer-dots i:nth-child(3) { background: #28c840; }
.viewer-url {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.viewer-badge {
  padding: 2px 7px;
  border: 1px solid rgba(255, 200, 87, .26);
  border-radius: 99px;
  background: rgba(255, 200, 87, .07);
  color: var(--warn);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.viewer iframe {
  display: block;
  width: 100%;
  height: clamp(520px, 74vh, 980px);
  border: 0;
  background: #fff;
}
.viewer-note { margin-top: 11px; line-height: 1.5; }
.viewer-note a { color: var(--muted); }
.viewer-note a:hover { color: var(--text); }
.viewer:fullscreen { background: #fff; border-radius: 0; width: 100vw; height: 100vh; }
.viewer:fullscreen iframe { height: calc(100vh - 39px); }
.viewer.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 120;
  border-radius: 0;
}
.viewer.is-expanded iframe { height: calc(100vh - 39px); }

/* --------------------------------------------------------------------------
   Dialog
   -------------------------------------------------------------------------- */

.dialog {
  width: min(500px, calc(100% - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}
.dialog::backdrop {
  background: rgba(3, 5, 12, .72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.dialog-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
}
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-head h2 { font-size: 19px; letter-spacing: -.01em; }
.dialog-actions { display: flex; justify-content: space-between; gap: 9px; flex-wrap: wrap; margin-top: 2px; }

/* --------------------------------------------------------------------------
   Strony: moje, bot, admin
   -------------------------------------------------------------------------- */

.page-head {
  padding: 52px 0 6px;
}
.page-head h1 {
  font-family: var(--display);
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.04;
  margin: 14px 0 14px;
}
.page-head .lead { font-size: 16px; max-width: 66ch; }
.page-body { padding: 30px 0 80px; }

.mine-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 30px;
}
.mine-toolbar p { font-size: 12.5px; }
.mine-loading {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 18px 0;
  color: var(--muted);
  font-size: 13px;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.mine-note { margin-top: 28px; max-width: 74ch; line-height: 1.55; }
.mine-card .card h3 { margin-bottom: 9px; }

.bot-page { display: flex; flex-direction: column; gap: 16px; }
.callout {
  padding: 13px 15px;
  border: 1px solid rgba(255, 200, 87, .28);
  border-radius: 13px;
  background: rgba(255, 200, 87, .07);
  color: var(--muted);
  font-size: 13px;
}
.callout strong { color: var(--warn); }
.bot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bot-card {
  min-width: 0;
  padding: 21px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card-bg);
}
.bot-card h2 { font-size: 18px; letter-spacing: -.01em; margin-bottom: 6px; }
.bot-card p { font-size: 13px; line-height: 1.55; margin-bottom: 12px; }

.codebox {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--code-bg);
  overflow: hidden;
}
.codebox pre {
  margin: 0;
  padding: 15px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  color: #d5dcf5;
  tab-size: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.codebox code { font-family: inherit; background: none; padding: 0; font-size: inherit; color: inherit; }
.copy-code {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .12);
  color: #dfe6ff;
}
.copy-code:hover { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .2); }

.params { margin: 0; display: flex; flex-direction: column; }
.params > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.params > div:last-child { border-bottom: 0; }
.params dt { color: var(--text); font-weight: 600; }
.params dd { margin: 0; color: var(--muted); }

code {
  font-family: var(--mono);
  font-size: .88em;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(139, 123, 255, .1);
  color: rgb(196, 187, 255);
}
html[data-theme="light"] code { color: #4b3ee0; background: rgba(91, 76, 240, .08); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 620px; }
.table th {
  padding: 10px 13px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .025);
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table td code { font-size: 11px; }
.table-empty { text-align: center; padding: 30px; color: var(--faint); }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.admin-stat {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}
.admin-stat span {
  display: block;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 5px;
}
.admin-stat strong { font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.admin-search { margin-bottom: 16px; max-width: 420px; }
.admin-table { min-width: 880px; }
.admin-title { color: var(--text); font-weight: 600; text-decoration: none; }
.admin-title:hover { text-decoration: underline; text-underline-offset: 2px; }
.admin-id { display: block; margin-top: 3px; font-size: 10.5px; color: var(--faint); }
.admin-id code { background: none; padding: 0; color: var(--faint); }
.admin-actions { display: flex; gap: 6px; }
.admin-actions form { margin: 0; }

.error-page { padding: 90px 0 100px; }
.error-code {
  display: block;
  font-family: var(--display);
  font-size: 84px;
  line-height: .9;
  color: var(--faint);
  opacity: .45;
  letter-spacing: -.04em;
}
.error-page h1 { font-family: var(--display); font-size: clamp(34px, 4.4vw, 50px); margin: 10px 0 12px; letter-spacing: -.02em; }
.error-page .lead { max-width: 56ch; }
.error-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 22px; }

/* --------------------------------------------------------------------------
   Stopka
   -------------------------------------------------------------------------- */

.footer {
  margin-top: auto;
  padding: 34px 0 28px;
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.1fr auto;
  gap: 18px 40px;
}
.footer-brand { display: flex; align-items: flex-start; gap: 11px; }
.footer-brand p { font-size: 12.5px; line-height: 1.5; }
.brand-mark.small { width: 33px; height: 33px; border-radius: 9px; font-size: 17px; flex-shrink: 0; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-content: flex-start;
  justify-content: flex-end;
  font-size: 12.5px;
}
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.footer-note {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 11px;
  line-height: 1.55;
  max-width: 110ch;
}
.footer-copy { grid-column: 1 / -1; margin: 0; color: var(--faint); font-size: 11px; }
.footer-copy a { color: var(--faint); }

/* --------------------------------------------------------------------------
   Animacje
   -------------------------------------------------------------------------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  0% { opacity: 0; transform: scale(.6); }
  60% { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(94, 224, 160, .12); }
  50% { box-shadow: 0 0 0 7px rgba(94, 224, 160, .04); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Responsywność
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .hero { gap: 40px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 34px;
    padding: 44px 0 40px;
  }
  .hero-copy { max-width: 640px; }
  .upload-card { width: 100%; max-width: 600px; }
  .task-header { flex-direction: column; gap: 12px; }
  .task-actions { justify-content: flex-start; padding-top: 2px; }
  .task-heading h1 { max-width: 30ch; }
  .bot-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  :root { --header-h: auto; }
  .topbar-inner {
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 10px 0;
  }
  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 1px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-link { padding: 6px 10px; }
  .topbar-actions { gap: 7px; }
  .brand-text span { display: none; }
  .btn-upload { height: 36px; padding: 0 12px; font-size: 12.5px; }
  .theme-toggle { width: 36px; height: 36px; }
  .library-tools { width: 100%; }
  .search { flex: 1; min-width: 0; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .wrap { width: calc(100% - 32px); }
  .hero { padding-top: 34px; }
  .hero h1 { font-size: clamp(38px, 12vw, 52px); }
  .lead { font-size: 15px; }
  .hero-stats { margin-top: 26px; padding-top: 18px; }
  .stat { padding-right: 20px; margin-right: 20px; }
  .stat strong { font-size: 25px; }
  .upload-card { padding: 16px; border-radius: 22px; }
  .drop { min-height: 168px; padding: 22px 14px; }
  .grid { grid-template-columns: 1fr; }
  .library-head h2 { font-size: 27px; }
  .library { padding-top: 26px; }
  .viewer iframe { height: 68vh; min-height: 420px; }
  .viewer-url { display: none; }
  .viewer-bar { justify-content: space-between; }
  .viewer-actions { margin-left: auto; }
  .task-actions .btn { flex: 1; }
  .task-actions .btn.icon { flex: 0 0 40px; }
  .page-head { padding-top: 34px; }
  .page-head h1 { font-size: clamp(32px, 10vw, 44px); }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bot-card { padding: 16px; }
  .params > div { grid-template-columns: 90px 1fr; gap: 10px; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { justify-content: flex-start; }
  .notice { flex-wrap: wrap; }
  .notice .btn { margin-left: 0; }
  .form-hint { font-size: 11.5px; }
  .success-actions .btn { flex: 1; }
}

@media (max-width: 420px) {
  .brand-text strong { font-size: 15px; }
  .btn-upload { font-size: 12px; }
  .sort-tabs { display: none; }
  .admin-actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  html { scroll-behavior: auto; }
}
