:root {
  color-scheme: light;
  --ink: #101728;
  --ink-soft: #263047;
  --muted: #667085;
  --paper: #f5f7fa;
  --white: #ffffff;
  --line: #dfe3ea;
  --line-strong: #c9ced8;
  --yellow: #ffd64a;
  --blue: #275ee8;
  --red: #e95d48;
  --green: #16836f;
  --violet: #7357c8;
  --max: 1380px;
  --header-height: 70px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Aptos, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.icon-sprite,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#start,
#zadania,
#dzialy,
#plan {
  scroll-margin-top: calc(var(--header-height) + 18px);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  min-height: var(--header-height);
  padding: 0 clamp(1rem, 3vw, 2.6rem);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  width: fit-content;
}

.brand-symbol {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}

.brand-copy {
  display: grid;
  gap: 0.05rem;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 0.94rem;
  font-weight: 800;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.72rem;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.8rem;
}

.main-nav a {
  position: relative;
  padding: 0.55rem 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.main-nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0.25rem;
  left: 0;
  height: 2px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 160ms ease;
}

.main-nav a:hover::after,
.main-nav a:focus-visible::after {
  transform: scaleX(1);
}

.header-random {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0 0.9rem;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: var(--white);
  font-size: 0.86rem;
  font-weight: 750;
}

.header-random:hover,
.header-random:focus-visible {
  background: var(--blue);
  border-color: var(--blue);
  outline: none;
}

.hero {
  position: relative;
  isolation: isolate;
  min-height: 555px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #eef2f6;
}

.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 49% 0 0;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(1px);
}

.hero-image {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-content {
  width: min(var(--max), calc(100% - 2rem));
  min-height: 555px;
  margin: 0 auto;
  padding: clamp(3.4rem, 7vw, 6rem) 0 3.4rem;
}

.hero-content > * {
  max-width: 610px;
}

.hero-kicker,
.section-kicker,
.sidebar-heading p {
  margin: 0;
  color: var(--blue);
  font-size: 0.73rem;
  font-weight: 850;
  text-transform: uppercase;
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.hero-kicker span {
  width: 28px;
  height: 3px;
  background: var(--red);
}

.hero h1 {
  margin: 1rem 0 0;
  font-size: 7rem;
  font-weight: 850;
  line-height: 0.84;
}

.hero-lead {
  max-width: 530px;
  margin: 1.5rem 0 0;
  color: var(--ink-soft);
  font-size: 1.18rem;
}

.hero-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 58px;
  margin-top: 2rem;
  border: 2px solid var(--ink);
  background: var(--white);
  box-shadow: 7px 7px 0 var(--yellow);
}

.hero-search > svg {
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 1rem;
  color: var(--blue);
}

.hero-search input {
  width: 100%;
  min-width: 0;
  height: 54px;
  padding: 0 0.8rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.hero-search input::placeholder,
.task-search input::placeholder {
  color: #8a93a5;
}

.hero-search a {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-left: 1px solid var(--line);
  background: var(--ink);
  color: var(--white);
}

.hero-search a:hover,
.hero-search a:focus-visible {
  background: var(--blue);
  outline: none;
}

.hero-stats {
  display: flex;
  gap: 2rem;
  margin-top: 2rem;
}

.hero-stats div {
  display: grid;
  gap: 0.05rem;
}

.hero-stats strong {
  font-size: 1.3rem;
  line-height: 1;
}

.hero-stats span {
  color: var(--muted);
  font-size: 0.78rem;
}

.collection-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: var(--max);
  margin: 0 auto;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--white);
}

.collection-bar > div {
  display: grid;
  gap: 0.2rem;
  min-height: 92px;
  padding: 1.25rem clamp(1rem, 3vw, 2rem);
  border-right: 1px solid var(--line);
}

.collection-bar > div:last-child {
  border-right: 0;
}

.collection-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.collection-bar strong {
  font-size: 0.94rem;
}

.collection-bar strong span {
  color: var(--blue);
  font-size: 1.2rem;
}

.library {
  padding: clamp(3.5rem, 7vw, 6rem) 1rem clamp(4rem, 8vw, 7rem);
  border-top: 1px solid var(--line);
}

.library-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 4rem);
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
}

.subject-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  max-height: calc(100vh - var(--header-height) - 48px);
  max-height: calc(100svh - var(--header-height) - 48px);
  align-self: start;
  position: sticky;
  top: calc(var(--header-height) + 24px);
  padding-right: 1.5rem;
  border-right: 1px solid var(--line-strong);
}

.sidebar-heading {
  margin-bottom: 1rem;
}

.sidebar-heading h2,
.browser-heading h2,
.study-heading h2 {
  margin: 0.3rem 0 0;
  font-size: 2.55rem;
  line-height: 1.02;
}

.category-strip {
  display: grid;
  grid-auto-rows: max-content;
  gap: 2px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.55rem;
  scrollbar-color: #9ba5b7 transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.category-strip::-webkit-scrollbar {
  width: 8px;
}

.category-strip::-webkit-scrollbar-track {
  background: transparent;
}

.category-strip::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: #9ba5b7;
  background-clip: padding-box;
}

.category-strip::-webkit-scrollbar-thumb:hover {
  background: #707c91;
  background-clip: padding-box;
}

.strip-button {
  --category: var(--blue);
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  min-height: 62px;
  padding: 0.55rem 0.55rem 0.55rem 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
}

.strip-button[data-category="dynamika"],
.strip-button[data-category="energia"],
.task-card[data-category-id="dynamika"],
.task-card[data-category-id="energia"] {
  --category: var(--red);
}

.strip-button[data-category="mechanika-bryly"],
.strip-button[data-category="termodynamika"],
.task-card[data-category-id="mechanika-bryly"],
.task-card[data-category-id="termodynamika"] {
  --category: #cf8f00;
}

.strip-button[data-category="hydrostatyka"],
.strip-button[data-category="prad-staly"],
.task-card[data-category-id="hydrostatyka"],
.task-card[data-category-id="prad-staly"] {
  --category: var(--green);
}

.strip-button[data-category="magnetyzm"],
.strip-button[data-category="drgania-fale"],
.task-card[data-category-id="magnetyzm"],
.task-card[data-category-id="drgania-fale"] {
  --category: var(--violet);
}

.strip-button[data-category="optyka"],
.strip-button[data-category="grawitacja"],
.task-card[data-category-id="optyka"],
.task-card[data-category-id="grawitacja"] {
  --category: #1976ad;
}

.strip-button[data-category="fizyka-jadrowa-atomowa"],
.task-card[data-category-id="fizyka-jadrowa-atomowa"] {
  --category: #a54187;
}

.strip-button[data-category="ciekawe"],
.task-card[data-category-id="ciekawe"] {
  --category: #b33c67;
}

.nav-indicator {
  width: 4px;
  height: 28px;
  background: var(--category);
}

.strip-copy {
  display: grid;
  min-width: 0;
}

.strip-copy strong {
  overflow-wrap: break-word;
  font-size: 0.93rem;
  font-weight: 760;
  line-height: 1.2;
}

.strip-copy small {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
  white-space: normal;
}

.strip-count {
  min-width: 36px;
  align-self: start;
  padding-top: 0.1rem;
  color: var(--muted);
  font-size: 0.81rem;
  font-weight: 750;
  text-align: right;
}

.strip-button:hover,
.strip-button:focus-visible {
  background: #e9edf4;
  outline: none;
}

.strip-button.is-active {
  background: var(--ink);
  color: var(--white);
}

.strip-button.is-active .strip-copy small,
.strip-button.is-active .strip-count {
  color: #cbd2df;
}

.sidebar-note {
  margin: 1.2rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.task-browser {
  min-width: 0;
}

.browser-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.result-count {
  margin: 0;
  padding-bottom: 0.2rem;
  color: var(--blue);
  font-size: 0.93rem;
  font-weight: 800;
  white-space: nowrap;
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(230px, 1.4fr) repeat(3, minmax(112px, 0.7fr));
  gap: 0.65rem;
  align-items: end;
  padding: 1rem 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line-strong);
}

.task-search,
.select-field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 800;
  text-transform: uppercase;
}

.input-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--white);
  color: var(--blue);
}

.task-search input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.select-field select {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 1.8rem 0 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.82rem;
  text-transform: none;
}

.input-shell:focus-within,
.select-field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(39, 94, 232, 0.13);
  outline: none;
}

.reset-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0 0.75rem;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 750;
}

.reset-button:hover,
.reset-button:focus-visible {
  background: var(--ink);
  color: var(--white);
  outline: none;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.8rem 0;
}

.active-filters[hidden] {
  display: none;
}

.active-filters span {
  padding: 0.28rem 0.58rem;
  border: 1px solid #bdcaf4;
  border-radius: 999px;
  background: #eef2ff;
  color: #274aa7;
  font-size: 0.73rem;
  font-weight: 750;
}

.task-list-heading {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 100px;
  gap: 1rem;
  padding: 0.8rem 1rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.task-list-heading span:last-child {
  text-align: right;
}

.task-grid {
  border-top: 1px solid var(--line-strong);
}

.task-card {
  --category: var(--blue);
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  min-height: 116px;
  padding: 1.1rem 1rem;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  background: transparent;
  transition: background 140ms ease, border-color 140ms ease;
}

.task-card:hover {
  border-left-color: var(--category);
  background: var(--white);
}

.task-card.is-highlighted {
  border-left-color: var(--red);
  background: #fff8dc;
  box-shadow: inset 0 0 0 2px var(--yellow);
}

.task-number {
  color: var(--category);
  font-size: 0.82rem;
  font-weight: 850;
}

.task-content {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
}

.task-content h3 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 1.12rem;
  line-height: 1.35;
}

.task-meta,
.topic-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
}

.task-meta {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.task-meta .category-label {
  color: var(--category);
  font-weight: 800;
}

.task-meta .level-label {
  color: var(--ink);
  font-weight: 800;
}

.task-meta .source-year {
  font-weight: 800;
}

.task-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 0.65rem;
  color: #a6adba;
}

.topic-tags span {
  color: #70798b;
  font-size: 0.78rem;
  line-height: 1.35;
}

.topic-tags span::before {
  content: "#";
  color: var(--category);
}

.open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  min-width: 96px;
  min-height: 42px;
  padding: 0 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.open-link:hover,
.open-link:focus-visible {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
  outline: none;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 0.45rem;
  min-height: 240px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-state svg {
  width: 2rem;
  height: 2rem;
  color: var(--red);
}

.empty-state h3,
.empty-state p {
  margin: 0;
}

.empty-state h3 {
  color: var(--ink);
}

.study-guide {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.4fr);
  gap: clamp(2.5rem, 7vw, 7rem);
  padding: clamp(4rem, 8vw, 7rem) max(1rem, calc((100vw - var(--max)) / 2));
  background: var(--ink);
  color: var(--white);
}

.study-heading .section-kicker {
  color: var(--yellow);
}

.study-heading h2 {
  max-width: 430px;
  color: var(--white);
}

.study-heading > p:last-child {
  max-width: 430px;
  margin: 1.1rem 0 0;
  color: #aeb7c8;
}

.study-steps {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.study-steps li {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.4rem 0;
  border-top: 1px solid #384156;
}

.study-steps li:last-child {
  border-bottom: 1px solid #384156;
}

.study-steps > li > span {
  color: var(--yellow);
  font-weight: 850;
}

.study-steps h3,
.study-steps p {
  margin: 0;
}

.study-steps h3 {
  font-size: 1.04rem;
}

.study-steps p {
  margin-top: 0.3rem;
  color: #aeb7c8;
  font-size: 0.88rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem max(1rem, calc((100vw - var(--max)) / 2));
  border-top: 1px solid #30394e;
  background: var(--ink);
  color: #9fa9bc;
  font-size: 0.8rem;
}

.footer-brand {
  color: var(--white);
  font-weight: 800;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}

.footer-meta strong {
  color: var(--yellow);
}

.footer-separator {
  color: #566178;
}

@media (max-width: 1180px) {
  .hero h1 {
    font-size: 5.8rem;
  }

  .filter-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .task-search {
    grid-column: span 2;
  }
}

@media (max-width: 940px) {
  :root {
    --header-height: 64px;
  }

  .site-header {
    grid-template-columns: 1fr auto;
  }

  .main-nav {
    display: none;
  }

  .hero,
  .hero-content {
    min-height: 520px;
  }

  .hero::after {
    inset: 0 34% 0 0;
    background: rgba(255, 255, 255, 0.78);
  }

  .hero-image {
    object-position: 58% center;
  }

  .collection-bar {
    width: 100%;
    border-right: 0;
    border-left: 0;
  }

  .library-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .subject-sidebar {
    display: block;
    max-height: none;
    position: static;
    padding: 0 0 1.4rem;
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .category-strip {
    display: flex;
    gap: 0.4rem;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 0.4rem;
    scrollbar-gutter: auto;
    scroll-snap-type: x proximity;
  }

  .strip-button {
    flex: 0 0 285px;
    scroll-snap-align: start;
  }

  .sidebar-note {
    display: none;
  }

  .study-guide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-header {
    padding: 0 0.8rem;
  }

  .brand-copy small {
    display: none;
  }

  .header-random span {
    display: none;
  }

  .header-random {
    width: 42px;
    padding: 0;
  }

  .hero,
  .hero-content {
    min-height: 570px;
  }

  .hero::after {
    inset: 0;
    background: rgba(255, 255, 255, 0.78);
  }

  .hero-image {
    object-position: 68% center;
  }

  .hero-content {
    width: min(100% - 1.5rem, var(--max));
    padding-top: 3rem;
  }

  .hero h1 {
    font-size: 4.4rem;
  }

  .hero-search {
    box-shadow: 5px 5px 0 var(--yellow);
  }

  .hero-search input {
    font-size: 0.88rem;
  }

  .hero-stats {
    gap: 1rem;
  }

  .collection-bar {
    grid-template-columns: 1fr;
  }

  .collection-bar > div {
    min-height: 72px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-search {
    grid-column: 1 / -1;
  }

  .reset-button {
    align-self: end;
  }

  .task-list-heading {
    display: none;
  }

  .task-grid {
    margin-top: 1rem;
  }

  .task-card {
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: start;
    min-height: 0;
    padding: 1rem 0.65rem;
  }

  .open-link {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 470px) {
  .brand-copy strong {
    max-width: 140px;
    font-size: 0.82rem;
  }

  .hero h1 {
    font-size: 3.85rem;
  }

  .hero-lead {
    font-size: 1rem;
  }

  .sidebar-heading h2,
  .browser-heading h2,
  .study-heading h2 {
    font-size: 2rem;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-stats strong {
    font-size: 1.06rem;
  }

  .filter-panel {
    grid-template-columns: 1fr;
  }

  .task-search {
    grid-column: auto;
  }

  .browser-heading,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-meta {
    justify-content: flex-start;
  }

  .study-steps li {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 0.8rem;
  }
}
