:root {
  color-scheme: light dark;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #eef3ff;
  --text: #162033;
  --muted: #5a6783;
  --line: #d7e0f2;
  --accent: #0b63ce;
  --accent-strong: #074a9a;
  --accent-warm: #b3341f;
  --shadow: 0 12px 32px rgba(12, 27, 62, 0.1);
  --page-bg: radial-gradient(circle at 0% 0%, #ffffff 0, #eef3ff 35%, #f3f6fb 100%);
  --card-shadow: 0 8px 24px rgba(12, 27, 62, 0.06);
  --panel-bg: #f8fbff;
  --panel-bg-strong: #ffffff;
  --panel-border: #d5e0f5;
  --panel-bg-hover: #eef4ff;
  --panel-border-hover: #bfd1f2;
  --photo-border: #bfd1f2;
  --group-bg: linear-gradient(180deg, #f8fbff 0%, #f2f7ff 100%);
  --group-border: #c9d9f5;
  --input-bg: #fbfdff;
  --heading: #123a78;
  --heading-soft: #1f355d;
  --example-border: #0b63ce;
  --example-text: #0a2f66;
  --chip-bg: #eef3ff;
  --chip-border: #b9caee;
  --chip-text: #103d84;
  --chip-bg-hover: #dfe9ff;
  --chip-border-hover: #9fb8e9;
  --chip-text-hover: #0b2d63;
  --badge-bg: #eaf2fd;
  --badge-border: #a6c6ee;
  --badge-text: #0a3b82;
  --badge-bg-hover: #d9e8fb;
  --badge-border-hover: #84ade4;
  --badge-text-hover: #073066;
  --help-bg: #f1ecfd;
  --help-border: #c1b3e8;
  --help-text: #43297f;
  --help-bg-hover: #e7dffb;
  --help-border-hover: #a897dd;
  --help-text-hover: #351f68;
  --sol-bg: #e9f8ee;
  --sol-border: #a3d5b3;
  --sol-text: #14653a;
  --sol-bg-hover: #daf1e2;
  --sol-border-hover: #86c69b;
  --sol-text-hover: #0e522d;
  --back-bg: #fdeef3;
  --back-border: #dfa5b9;
  --back-text: #7a1f3c;
  --back-bg-hover: #fadfe8;
  --back-border-hover: #cf8ba3;
  --back-text-hover: #64162f;
  --theory-bg: #fff3df;
  --theory-border: #e4c08a;
  --theory-text: #6b3f00;
  --theory-bg-hover: #ffeaca;
  --theory-border-hover: #d7ab6c;
  --theory-text-hover: #583300;
  --coll-bg: #e3f5fa;
  --coll-border: #8fc9da;
  --coll-text: #08485a;
  --coll-bg-hover: #d0eef6;
  --coll-border-hover: #6fb5cc;
  --coll-text-hover: #063848;
  --sbirka-bg: #ffd59c;
  --sbirka-border: #e89f3a;
  --sbirka-text: #6f3900;
  --sbirka-bg-hover: #ffe9cd;
  --mark-bg: #fff2b2;
  --mark-text: #162033;
  --img-bg: transparent;
  --img-pad: 0;
  --img-radius: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  background: var(--page-bg);
}

body {
  min-height: 100vh;
  font-family: "Segoe UI", "Trebuchet MS", "Verdana", sans-serif;
  color: var(--text);
  line-height: 1.45;
  background: var(--page-bg);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.hero {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(130deg, #0a3b82 0%, #0b63ce 56%, #3f8cf0 100%);
  color: #fff;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero img {
  max-width: 100%;
  height: auto;
}

.hero p {
  margin: 12px 0 0;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.95);
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.quick-links a {
  text-decoration: none;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  padding: 9px 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.2s ease, transform 0.2s ease;
}

.quick-links a:hover,
.quick-links a:focus {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

.card-head {
  margin: 0;
  padding: 16px 18px 10px;
  font-size: 1.1rem;
}

.chapter-list {
  list-style: none;
  margin: 0;
  padding: 4px 12px 14px;
}

.chapter-list li {
  margin: 0;
}

.chapter-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  border-radius: 12px;
  padding: 10px 10px;
}

.chapter-list a:hover,
.chapter-list a:focus {
  background: var(--surface-soft);
}

.chapter-list a.chapter-sbirka:hover,
.chapter-list a.chapter-sbirka:focus {
  background: var(--sbirka-bg-hover);
}

.num {
  min-width: 2rem;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.num.num-sbirka {
  border-color: var(--sbirka-border);
  background: var(--sbirka-bg);
  color: var(--sbirka-text);
}

.chapter-title {
  font-size: 1rem;
}

.side-content {
  padding: 14px 16px 16px;
}

.side-content p {
  margin: 0 0 12px;
  color: var(--muted);
}

.plain-links {
  list-style: none;
  margin: 0;
  padding: 4px 12px 14px;
}

.plain-links li {
  margin: 0;
}

.plain-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  border-radius: 12px;
  padding: 10px 10px;
}

.plain-links a:hover,
.plain-links a:focus {
  background: var(--surface-soft);
  text-decoration: none;
}

.footer {
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .page {
    padding: 14px 10px 28px;
  }

  .hero {
    padding: 16px 14px;
    border-radius: 14px;
  }

  .hero-header {
    justify-content: center;
  }

  .hero p {
    font-size: 0.95rem;
    text-align: center;
  }

  .quick-links {
    grid-template-columns: 1fr 1fr;
  }

  .chapter-list a {
    padding: 10px 8px;
    gap: 10px;
  }

  .chapter-title {
    font-size: 0.98rem;
  }
}

.article-shell {
  max-width: 960px;
}

.article-header {
  margin-bottom: 14px;
}

.article-title {
  margin: 0;
  text-align: center;
}

.article-title-main {
  margin: 0;
  text-align: left;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffffff;
}

.sbirka .hero {
  background: linear-gradient(130deg, #0a5a6b 0%, #0e8ba3 56%, #3fb5cf 100%);
}

.article-section-title {
  margin: 0.4rem 0 1rem;
  text-align: center;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--heading);
}

.article-next-link {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-text);
  font-weight: 700;
  text-decoration: none;
}

.article-next-link:hover,
.article-next-link:focus {
  background: var(--chip-bg-hover);
  color: var(--chip-text-hover);
  text-decoration: none;
}

.article-content {
  padding: 18px 22px;
}

.article-content p {
  margin: 0 0 1rem;
  color: var(--text);
  font-size: 1.02rem;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.article-content td {
  padding: 6px 4px;
}

/* --- náhrada prezentačních atributů (align, valign, border, cellspacing…) --- */
.stred {
  text-align: center;
}

.vpravo {
  text-align: right;
}

.article-content td.nahoru,
.article-content th.nahoru {
  vertical-align: top;
}

.article-content div.stred {
  overflow-x: auto;
}

.article-content table.tab-holy,
.article-content table.tab-ram {
  width: auto;
  margin-inline: auto;
}

.article-content table.tab-ram {
  border: 1px solid var(--text);
}

.article-content table.tab-ram td,
.article-content table.tab-ram th {
  border: 1px solid var(--text);
  padding: 4px 10px;
}

.article-content table.tab-sirka-50 {
  width: 50%;
}

.article-content table.tab-sirka-100 {
  width: 100%;
}

.article-content table.tab-mezery-5,
.article-content table.tab-mezery-20 {
  border-collapse: separate;
}

.article-content table.tab-mezery-5 {
  border-spacing: 5px;
}

.article-content table.tab-mezery-20 {
  border-spacing: 20px;
}

.article-content .bez-zlomu {
  white-space: nowrap;
}

.article-content td.soucet-cara {
  border-bottom: 1px solid currentColor;
}

.article-content img.obr-vlevo {
  float: left;
  margin: 0 12px 8px 0;
}

.article-content img.obr-vpravo {
  float: right;
  margin: 0 0 8px 12px;
}

.article-content img.obr-mezera {
  margin-inline: 5px;
}

/* svislé zarovnání vsazených obrázků (náhrada za align u <img>) */
.article-content img.obr-nahoru {
  vertical-align: top;
}

.article-content img.obr-stred {
  vertical-align: middle;
}

.article-content img.obr-text-nahoru {
  vertical-align: text-top;
}

.article-content td.sirka-50 {
  width: 50%;
}

.article-content td.sirka-100 {
  width: 100%;
}

.zvyr-tyrkys {
  color: var(--coll-text);
}

/* --- barevné zvýraznění v číselných příkladech (náhrada <font color>) --- */
.zvyr-modra {
  color: var(--accent);
}

.zvyr-cervena {
  color: var(--accent-warm);
}

.vetsi {
  font-size: 1.15em;
}

.article-content hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

.article-content a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.article-content a:hover,
.article-content a:focus {
  color: var(--accent-strong);
  text-decoration: underline;
}

.article-content img {
  max-width: 100%;
  height: auto;
  background: var(--img-bg);
  padding: var(--img-pad);
  border-radius: var(--img-radius);
}

.article-nav,
.chapter-links {
  text-align: center;
}

.chapter-links {
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.chapter-index .obsah {
  margin: 0.2rem 0 1rem;
  text-align: left;
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  color: var(--heading);
}

.chapter-index .menu {
  margin: 0;
}

.chapter-index .menu + .menu {
  margin-top: 0.5rem;
}

.chapter-index .menu a {
  display: block;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel-bg);
  color: var(--text);
  text-decoration: none;
  padding: 9px 12px;
}

.chapter-index .menu a:hover,
.chapter-index .menu a:focus {
  background: var(--panel-bg-hover);
  border-color: var(--panel-border-hover);
}

.chapter-index .menu-sublevel {
  margin-left: 1rem;
}

.chapter-index .menu-group {
  margin: 1rem 0 0.5rem;
  font-weight: 700;
  color: var(--heading);
  font-size: clamp(1.02rem, 1.9vw, 1.15rem);
}

.chapter-index .menu-group:first-child {
  margin-top: 0;
}

.chapter-index .navig {
    margin-top: 1.2rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--line);
    text-align: left;
}

.chapter-article h2 {
  margin: 1.6rem 0 0.8rem;
  color: var(--heading);
}

.chapter-article h3 {
  margin: 1.2rem 0 0.6rem;
  color: var(--heading-soft);
}

.chapter-article h4.example-highlight {
  display: block;
  margin: 1.35rem 0 0.7rem;
  padding: 0.5rem 0 0;
  border-top: 3px solid var(--example-border);
  color: var(--example-text);
  font-weight: 800;
  font-size: clamp(1.12rem, 1.6vw, 1.34rem);
  letter-spacing: 0.01em;
}

.chapter-article .menu {
  margin: 0;
}

.chapter-article .menu + .menu {
  margin-top: 0.45rem;
}

.chapter-article .menu + :not(.menu) {
  margin-top: 1.2rem;
}

.chapter-article .menu a {
  display: block;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--panel-bg);
  color: var(--text);
  text-decoration: none;
  padding: 8px 11px;
  font-weight: 600;
}

.chapter-article .menu a:hover,
.chapter-article .menu a:focus {
  background: var(--panel-bg-hover);
  border-color: var(--panel-border-hover);
}

.chapter-article .chapter-group {
  margin: 1rem 0;
  border: 1px solid var(--group-border);
  border-radius: 12px;
  background: var(--group-bg);
  padding: 12px;
}

.chapter-article .chapter-group h3 {
  margin: 0 0 0.65rem;
  color: var(--heading);
}

.chapter-article .chapter-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chapter-article .chapter-sublist li + li {
  margin-top: 0.5rem;
}

.chapter-article .chapter-sublist a {
  display: block;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--panel-bg-strong);
  color: var(--text);
  text-decoration: none;
  padding: 8px 11px;
  font-weight: 600;
}

.chapter-article .chapter-sublist a:hover,
.chapter-article .chapter-sublist a:focus {
  background: var(--panel-bg-hover);
  border-color: var(--panel-border-hover);
}

.chapter-article .obr,
.chapter-article .vzorec,
.chapter-article .rovnice {
  text-align: center;
  overflow-x: auto;
  overflow-y: hidden;
}

.chapter-article .cislo-rovnice {
  float: right;
  color: var(--muted);
  font-size: 0.95em;
}

.chapter-article .navig {
  margin-top: 1.3rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  text-align: left;
}

.chapter-article p {
  overflow-wrap: anywhere;
}

.article-content .task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 1rem 0;
}

.article-content .task-actions-right {
  justify-content: flex-end;
}

.article-content .task-action-btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-text);
  font-weight: 700;
  text-decoration: none;
  line-height: 1.2;
}

.article-content .task-action-btn:hover,
.article-content .task-action-btn:focus {
  background: var(--chip-bg-hover);
  border-color: var(--chip-border-hover);
  color: var(--chip-text-hover);
  text-decoration: none;
}

.article-content .task-action-help {
  border-color: var(--help-border);
  background: var(--help-bg);
  color: var(--help-text);
}

.article-content .task-action-help:hover,
.article-content .task-action-help:focus {
  border-color: var(--help-border-hover);
  background: var(--help-bg-hover);
  color: var(--help-text-hover);
}

.article-content .task-action-solution {
  border-color: var(--sol-border);
  background: var(--sol-bg);
  color: var(--sol-text);
}

.article-content .task-action-solution:hover,
.article-content .task-action-solution:focus {
  border-color: var(--sol-border-hover);
  background: var(--sol-bg-hover);
  color: var(--sol-text-hover);
}

.article-content .task-action-back {
  border-color: var(--back-border);
  background: var(--back-bg);
  color: var(--back-text);
}

.article-content .task-action-back:hover,
.article-content .task-action-back:focus {
  border-color: var(--back-border-hover);
  background: var(--back-bg-hover);
  color: var(--back-text-hover);
}

.article-content .task-action-theory {
  border-color: var(--theory-border);
  background: var(--theory-bg);
  color: var(--theory-text);
}

.article-content .task-action-theory:hover,
.article-content .task-action-theory:focus {
  border-color: var(--theory-border-hover);
  background: var(--theory-bg-hover);
  color: var(--theory-text-hover);
}

.article-content .task-action-collection {
  border-color: var(--coll-border);
  background: var(--coll-bg);
  color: var(--coll-text);
}

.article-content .task-action-collection:hover,
.article-content .task-action-collection:focus {
  border-color: var(--coll-border-hover);
  background: var(--coll-bg-hover);
  color: var(--coll-text-hover);
}

.article-content .task-action-main {
  border-color: var(--badge-border);
  background: var(--badge-bg);
  color: var(--badge-text);
}

.article-content .task-action-main:hover,
.article-content .task-action-main:focus {
  border-color: var(--badge-border-hover);
  background: var(--badge-bg-hover);
  color: var(--badge-text-hover);
}

.about-page h2 {
  margin: 1.4rem 0 0.8rem;
  color: var(--heading);
}

.about-page h3 {
  margin: 1.1rem 0 0.7rem;
  color: var(--heading-soft);
}

.about-profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel-bg);
  padding: 12px;
  margin: 0.8rem 0 1.1rem;
}

.about-profile img {
  border-radius: 10px;
  border: 1px solid var(--photo-border);
}

.about-profile p {
  margin: 0 0 0.45rem;
}

.about-profile-text {
  grid-template-columns: 1fr;
}

.search-form {
  margin: 0 0 1rem;
}

.search-label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.search-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.search-input {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  color: var(--text);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--input-bg);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 99, 206, 0.16);
}

.search-row .task-action-btn {
  margin: 0;
  white-space: nowrap;
}

.search-scope {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 0.92rem;
  color: var(--muted);
}

.search-scope label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.search-status {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-hit {
  border-top: 1px solid var(--line);
  padding: 12px 0 10px;
}

.search-hit-badge {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 9px;
  border-radius: 999px;
  border: 1px solid var(--badge-border);
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.75rem;
  vertical-align: 2px;
}

.search-hit-badge-sbirka {
  border-color: var(--coll-border);
  background: var(--coll-bg);
  color: var(--coll-text);
}

.search-hit-title {
  font-weight: 600;
}

.search-hit-snippet {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.search-hit-snippet mark {
  background: var(--mark-bg);
  color: var(--mark-text);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.search-mini {
  margin: 0 0 1.1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.search-mini .search-input {
  padding: 8px 12px;
  font-size: 0.95rem;
}

.search-mini-btn {
  flex: 0 0 auto;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--badge-text);
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}

.search-mini-btn:hover,
.search-mini-btn:focus {
  background: var(--badge-bg-hover);
  border-color: var(--accent);
}

/* --- matematické vzorce (MathML) --- */
math {
  font-size: 1.12em;
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", serif;
}

math[display="block"] {
  margin: 0.2rem 0;
}

/* logická negace - nadtržítko (čitelnější než MathML mover) */
.negace {
  border-top: 0.06em solid currentColor;
  padding-inline: 0.06em;
  padding-top: 0.08em;
}

@media (max-width: 600px) {
  .article-content {
    padding: 14px 12px;
  }

  .search-row {
    flex-direction: column;
  }

  .article-content p {
    font-size: 0.98rem;
  }

  .article-title img {
    max-width: 88%;
    height: auto;
  }

  .about-profile {
    grid-template-columns: 1fr;
  }
}

/* --- tisk --- */
/* --- přepínač světlého a tmavého režimu --- */
.theme-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.26);
  border-color: #ffffff;
}

.theme-toggle-ikona {
  font-size: 1.05em;
  line-height: 1;
}

@media (max-width: 600px) {
  .theme-toggle-text {
    display: none;
  }

  .theme-toggle {
    padding: 7px 10px;
  }
}

@media print {
  html,
  body {
    background: #ffffff;
    color: #000000;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 0;
    border-radius: 0;
    break-inside: auto;
  }

  .hero,
  .sbirka .hero {
    background: none;
    color: #000000;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    padding: 0;
  }

  .hero .article-title-main,
  .article-title-main {
    color: #000000;
  }

  /* navigační a ovládací prvky se netisknou */
  .quick-links,
  .search-mini,
  .search-row,
  .search-label,
  .search-mini-btn,
  .search-status,
  .theme-toggle,
  .navig,
  .task-actions,
  .task-action-btn,
  .article-content .task-actions,
  .article-content .task-action-btn,
  .article-nav,
  .article-next-link,
  .chapter-links,
  .footer {
    display: none;
  }

  /* žádné orámování nadpisů ani rámečky kolem obsahu */
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  .article-header,
  .article-title,
  .article-section-title,
  .chapter-article h4.example-highlight,
  .chapter-article .chapter-group,
  .chapter-index .menu a,
  .chapter-article .menu a,
  .chapter-article .chapter-sublist a,
  .about-profile,
  .about-profile img {
    border: 0;
    box-shadow: none;
    background: none;
  }

  .article-content img {
    background: none;
    padding: 0;
  }

  .article-content a {
    color: #000000;
    text-decoration: underline;
  }

  .article-content img,
  .vzorec,
  .obr,
  table,
  tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  h1,
  h2,
  h3,
  h4 {
    break-after: avoid;
    page-break-after: avoid;
  }
}

/* --- omezení animací --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- tmavý režim ---
   Hodnoty se definují na dvou místech: podle nastavení systému
   (pokud uživatel nezvolil ručně světlý) a podle ručního přepínače. */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #0f1420;
  --surface: #161d2c;
  --surface-soft: #1b2436;
  --text: #e3eaf7;
  --muted: #9fadc6;
  --line: #2b3650;
  --accent: #6fa8ff;
  --accent-strong: #a5c8ff;
  --accent-warm: #ff9c82;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  --page-bg: radial-gradient(circle at 0% 0%, #1a2438 0, #131b2a 35%, #0f1420 100%);
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --panel-bg: #18212f;
  --panel-bg-strong: #18212f;
  --panel-border: #2b3650;
  --panel-bg-hover: #212c40;
  --panel-border-hover: #3d4d6f;
  --photo-border: #2b3650;
  --group-bg: linear-gradient(180deg, #19222f 0%, #151d2a 100%);
  --group-border: #2b3650;
  --input-bg: #18212f;
  --heading: #a9c8f7;
  --heading-soft: #c4d3ea;
  --example-border: #6fa8ff;
  --example-text: #bcd6ff;
  --chip-bg: #1c2942;
  --chip-border: #33507e;
  --chip-text: #b7d2ff;
  --chip-bg-hover: #26375a;
  --chip-border-hover: #47679b;
  --chip-text-hover: #d5e6ff;
  --badge-bg: #1c2942;
  --badge-border: #33507e;
  --badge-text: #b7d2ff;
  --badge-bg-hover: #26375a;
  --badge-border-hover: #47679b;
  --badge-text-hover: #d5e6ff;
  --help-bg: #262040;
  --help-border: #4d3f77;
  --help-text: #cfbff5;
  --help-bg-hover: #322a55;
  --help-border-hover: #6a58a0;
  --help-text-hover: #e2d6ff;
  --sol-bg: #142b1f;
  --sol-border: #2f5f42;
  --sol-text: #a4dfba;
  --sol-bg-hover: #1c3b2a;
  --sol-border-hover: #438159;
  --sol-text-hover: #c6efd5;
  --back-bg: #2e1e26;
  --back-border: #6d4356;
  --back-text: #eeb6c8;
  --back-bg-hover: #3d2833;
  --back-border-hover: #8f5b72;
  --back-text-hover: #ffd0dd;
  --theory-bg: #2d2413;
  --theory-border: #6b5227;
  --theory-text: #ebc693;
  --theory-bg-hover: #3c301a;
  --theory-border-hover: #8d6d36;
  --theory-text-hover: #ffdcae;
  --coll-bg: #122c35;
  --coll-border: #2e5f6f;
  --coll-text: #a3d8e5;
  --coll-bg-hover: #193c47;
  --coll-border-hover: #40808f;
  --coll-text-hover: #c4ecf6;
  --sbirka-bg: #362813;
  --sbirka-border: #7a5a24;
  --sbirka-text: #edc78d;
  --sbirka-bg-hover: #362813;
  --mark-bg: #6b5a12;
  --mark-text: #fff6c8;
  --img-bg: #ffffff;
  --img-pad: 4px;
  --img-radius: 6px;
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1420;
  --surface: #161d2c;
  --surface-soft: #1b2436;
  --text: #e3eaf7;
  --muted: #9fadc6;
  --line: #2b3650;
  --accent: #6fa8ff;
  --accent-strong: #a5c8ff;
  --accent-warm: #ff9c82;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  --page-bg: radial-gradient(circle at 0% 0%, #1a2438 0, #131b2a 35%, #0f1420 100%);
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --panel-bg: #18212f;
  --panel-bg-strong: #18212f;
  --panel-border: #2b3650;
  --panel-bg-hover: #212c40;
  --panel-border-hover: #3d4d6f;
  --photo-border: #2b3650;
  --group-bg: linear-gradient(180deg, #19222f 0%, #151d2a 100%);
  --group-border: #2b3650;
  --input-bg: #18212f;
  --heading: #a9c8f7;
  --heading-soft: #c4d3ea;
  --example-border: #6fa8ff;
  --example-text: #bcd6ff;
  --chip-bg: #1c2942;
  --chip-border: #33507e;
  --chip-text: #b7d2ff;
  --chip-bg-hover: #26375a;
  --chip-border-hover: #47679b;
  --chip-text-hover: #d5e6ff;
  --badge-bg: #1c2942;
  --badge-border: #33507e;
  --badge-text: #b7d2ff;
  --badge-bg-hover: #26375a;
  --badge-border-hover: #47679b;
  --badge-text-hover: #d5e6ff;
  --help-bg: #262040;
  --help-border: #4d3f77;
  --help-text: #cfbff5;
  --help-bg-hover: #322a55;
  --help-border-hover: #6a58a0;
  --help-text-hover: #e2d6ff;
  --sol-bg: #142b1f;
  --sol-border: #2f5f42;
  --sol-text: #a4dfba;
  --sol-bg-hover: #1c3b2a;
  --sol-border-hover: #438159;
  --sol-text-hover: #c6efd5;
  --back-bg: #2e1e26;
  --back-border: #6d4356;
  --back-text: #eeb6c8;
  --back-bg-hover: #3d2833;
  --back-border-hover: #8f5b72;
  --back-text-hover: #ffd0dd;
  --theory-bg: #2d2413;
  --theory-border: #6b5227;
  --theory-text: #ebc693;
  --theory-bg-hover: #3c301a;
  --theory-border-hover: #8d6d36;
  --theory-text-hover: #ffdcae;
  --coll-bg: #122c35;
  --coll-border: #2e5f6f;
  --coll-text: #a3d8e5;
  --coll-bg-hover: #193c47;
  --coll-border-hover: #40808f;
  --coll-text-hover: #c4ecf6;
  --sbirka-bg: #362813;
  --sbirka-border: #7a5a24;
  --sbirka-text: #edc78d;
  --sbirka-bg-hover: #362813;
  --mark-bg: #6b5a12;
  --mark-text: #fff6c8;
  --img-bg: #ffffff;
  --img-pad: 4px;
  --img-radius: 6px;
}

html[data-theme="light"] {
  color-scheme: light;
}
