/* Item cards: group image / word / pronunciation / audio into one centered container */
.markdown-style .item {
  border: 1px solid var(--color-border-default);
  border-radius: 12px;
  background: var(--color-canvas-subtle);
  padding: 16px;
  margin: 14px auto;
  max-width: 560px;
  text-align: center;
}
.markdown-style .item > p {
  margin: 0 0 8px;
}
.markdown-style .item > p:last-child {
  margin-bottom: 0;
}
.markdown-style .item img {
  max-height: 140px;
  width: auto;
  border-radius: 8px;
  background: transparent;
  display: block;
  margin: 0 auto;
}
.markdown-style .item > p:has(> audio) {
  margin-top: 10px;
}
.markdown-style .item audio {
  width: 100%;
  max-width: 420px;
  display: block;
  margin: 0 auto;
}

/* Zagadka accordion: click prompt to reveal the answer + audio */
.markdown-style details.answer {
  border: 1px solid var(--color-border-default);
  border-radius: 12px;
  background: var(--color-canvas-subtle);
  margin: 14px auto;
  max-width: 560px;
  overflow: hidden;
  text-align: center;
}
.markdown-style details.answer > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 14px 16px;
  font-weight: 600;
  color: var(--color-fg-default);
  background: var(--color-canvas-subtle);
  border-bottom: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.markdown-style details.answer > summary::-webkit-details-marker {
  display: none;
}
.markdown-style details.answer > summary::after {
  content: "▾";
  color: var(--color-fg-muted);
  transition: transform .2s ease;
}
.markdown-style details.answer[open] > summary {
  border-bottom-color: var(--color-border-muted);
}
.markdown-style details.answer[open] > summary::after {
  transform: rotate(180deg);
}
.markdown-style details.answer > :not(summary) {
  padding: 12px 16px;
  text-align: center;
}
.markdown-style details.answer .answer-text {
  text-align: center;
  font-size: 1.1em;
}
.markdown-style details.answer p {
  margin: 0 0 8px;
}
.markdown-style details.answer p:last-child {
  margin-bottom: 0;
}
.markdown-style details.answer audio {
  width: 100%;
  max-width: 420px;
  display: block;
  margin: 0 auto;
}

/* Słowniczek: two-column glossary table */
.markdown-style .glossary,
.markdown-style table {
  border-collapse: collapse;
  width: 100%;
  max-width: 560px;
  margin: 10px auto;
  background: transparent;
  border: 1px solid var(--color-border-default);
  border-radius: 12px;
  overflow: hidden;
}
.markdown-style :is(table) th,
.markdown-style :is(table) td {
  border: none;
  padding: 8px 14px;
  text-align: left;
}
.markdown-style :is(table) thead th {
  color: var(--color-fg-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--color-border-default);
}
.markdown-style :is(table) tbody tr + tr td {
  border-top: 1px solid var(--color-border-muted);
}

/* Constrain the page to a comfortable reading width */
body {
  margin: 0 auto;
}
.markdown-style {
  max-width: 70ch !important;
}

/* Print: light theme, no switcher, answers revealed, no audio players */
@media print {
  /* Force light palette on <html>/<body> even when dark mode is active
     (!important: the dark-mode script injects its styles after this sheet) */
  [data-color-mode*='dark'],
  [data-color-mode*='dark'] body {
    color-scheme: light;
    background-color: #fff !important;
    color: #24292f !important;
  }
  /* Pin the light variables on the content itself: own declarations
     beat anything inherited from the dark theme selectors above */
  .markdown-style {
    --color-fg-default: #24292f;
    --color-fg-muted: #57606a;
    --color-fg-subtle: #6e7781;
    --color-canvas-default: #ffffff;
    --color-canvas-subtle: #f6f8fa;
    --color-border-default: #d0d7de;
    --color-border-muted: hsla(210, 18%, 87%, 1);
    --color-neutral-muted: rgba(175, 184, 193, 0.2);
    --color-accent-fg: #0969da;
    --color-accent-emphasis: #0969da;
    --color-attention-subtle: #fff8c5;
    --color-danger-fg: #cf222e;
  }

  /* Hide the fixed theme switcher */
  dark-mode {
    display: none !important;
  }

  /* Print answers: reveal accordion content even when collapsed */
  .markdown-style details.answer::details-content {
    content-visibility: visible;
    display: block;
  }
  /* Fallback for engines without ::details-content support */
  .markdown-style details.answer > *:not(summary) {
    display: block;
  }

  /* Hide audio players and the empty paragraphs that wrap them.
     !important: the screen rules (e.g. "details.answer audio", the
     details fallback above) have higher specificity and set block. */
  .markdown-style audio {
    display: none !important;
  }
  /* Wrapper <p> only when it holds nothing but audio (never hide accompanying text) */
  .markdown-style p:has(> audio):not(:has(*:not(audio))) {
    display: none !important;
  }
}