/* Default palettes: mirrored by player_appearance.COLOR_FIELDS. */
:root {
  --sv-page: #cfd2d4;
  --sv-surface: #ffffff;
  --sv-text: #1d2a32;
  --sv-title: #344c5d;
  --sv-button: #4b88df;
  --sv-button-text: #ffffff;
  --sv-button-hover: #3174d3;
  --sv-active: #174f9c;
  --sv-active-text: #ffffff;
  --sv-active-hover: #123d78;
  --sv-focus: #245ccb;
  --sv-stage: #111b23;
  --sv-border: #d8e0e7;
  --sv-sidebar: #f5f8fa;
  --sv-sidebar-header: #eef3f6;
  --sv-heading: #315b7c;
  --sv-subtle-hover: #dfeaf2;
  --sv-input-border: #afbdc8;
  --sv-muted: #526b7c;
  --sv-thumbnail-text: #233746;
  --sv-thumbnail-hover-border: #8bb8e8;
  --sv-highlight-text: #164e71;
  --sv-thumbnail-hover: #f7fbff;
  --sv-selection-text: #123d61;
  --sv-selection: #dceffc;
  --sv-thumbnail-border: #cdd7df;
  --sv-secondary: #607281;
  --sv-caption: #f8fafc;
  --sv-caption-empty: #57636e;
  --sv-caption-hover: #edf4fb;
  --sv-card-stage: #edf3f8;
  --sv-card: #ffffff;
  --sv-card-border: #d5e2eb;
  --sv-card-text: #213747;
  --sv-eyebrow: #326581;
  --sv-instruction: #506578;
  --sv-option-border: #cad9e5;
  --sv-option: #f8fbfd;
  --sv-option-selected: #e3effc;
  --sv-accent: #508cce;
  --sv-warning: #8b3a16;
  --sv-summary: #e8f1fc;
  --sv-success: #e8f5ee;
  --sv-success-border: #469477;
  --sv-incorrect: #fff3df;
  --sv-incorrect-border: #c08b40;
  --sv-secondary-button: #edf2f7;
  --sv-secondary-button-text: #29405b;
  --sv-question-thumb-border: #bdcedd;
  --sv-gradient-start: #e8f5fc;
  --sv-gradient-end: #dce9fa;
  --sv-info: #245b86;
  --sv-badge-text: #174b70;
  --sv-video: #10202b;
  --sv-video-thumbnail: #e6f1fa;
  --sv-shadow: #000000;
  --sv-card-shadow: #16364f;
  --sv-attachment-button: #4b88df;
  --sv-attachment-icon: #ffffff;
  --sv-attachment-hover: #3174d3;
  --sv-attachment-active: #174f9c;
  --sv-attachment-active-icon: #ffffff;
  --sv-attachment-active-hover: #123d78;
  --sv-attachment-panel: #ffffff;
  --sv-attachment-text: #1d2a32;
  --sv-attachment-link: #174f9c;
  --sv-attachment-border: #d8e0e7;
  --sv-attachment-backdrop: #000000;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --sv-page: #111820;
  --sv-surface: #1d2935;
  --sv-text: #e5edf5;
  --sv-title: #dbe9f6;
  --sv-button: #326ab5;
  --sv-button-text: #ffffff;
  --sv-button-hover: #407ecb;
  --sv-active: #174f9c;
  --sv-active-text: #ffffff;
  --sv-active-hover: #205fae;
  --sv-focus: #8dbbff;
  --sv-stage: #0b1118;
  --sv-border: #405364;
  --sv-sidebar: #18232e;
  --sv-sidebar-header: #243443;
  --sv-heading: #bbd7ef;
  --sv-subtle-hover: #33495d;
  --sv-input-border: #63788b;
  --sv-muted: #b3c5d6;
  --sv-thumbnail-text: #e0ebf5;
  --sv-thumbnail-hover-border: #79ace8;
  --sv-highlight-text: #e6f3ff;
  --sv-thumbnail-hover: #2c4052;
  --sv-selection-text: #e6f3ff;
  --sv-selection: #284b69;
  --sv-thumbnail-border: #405364;
  --sv-secondary: #afc1d2;
  --sv-caption: #18232e;
  --sv-caption-empty: #b3c5d6;
  --sv-caption-hover: #2b4054;
  --sv-card-stage: #15222f;
  --sv-card: #1d2935;
  --sv-card-border: #405364;
  --sv-card-text: #e5edf5;
  --sv-eyebrow: #9dc6e7;
  --sv-instruction: #b6c8d9;
  --sv-option-border: #52687b;
  --sv-option: #253544;
  --sv-option-selected: #284b69;
  --sv-accent: #83b6f0;
  --sv-warning: #ffd39d;
  --sv-summary: #263f56;
  --sv-success: #1e4236;
  --sv-success-border: #74c6a1;
  --sv-incorrect: #493822;
  --sv-incorrect-border: #e5b469;
  --sv-secondary-button: #34485b;
  --sv-secondary-button-text: #e2edf8;
  --sv-question-thumb-border: #52687b;
  --sv-gradient-start: #2b475e;
  --sv-gradient-end: #233950;
  --sv-info: #acd1f3;
  --sv-badge-text: #d9edff;
  --sv-video: #080f16;
  --sv-video-thumbnail: #263f56;
  --sv-shadow: #000000;
  --sv-card-shadow: #000000;
  --sv-attachment-button: #326ab5;
  --sv-attachment-icon: #ffffff;
  --sv-attachment-hover: #407ecb;
  --sv-attachment-active: #174f9c;
  --sv-attachment-active-icon: #ffffff;
  --sv-attachment-active-hover: #205fae;
  --sv-attachment-panel: #1d2935;
  --sv-attachment-text: #e5edf5;
  --sv-attachment-link: #9dc6e7;
  --sv-attachment-border: #405364;
  --sv-attachment-backdrop: #000000;
  color-scheme: dark;
}

:root {
  --page-padding: clamp(12px, 3vw, 36px);
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--sv-page);
  color: var(--sv-text);
  scrollbar-gutter: stable both-edges;
}

* { box-sizing: border-box; }

/* Karta dopasowuje się do szerokości i treści. Długie pytania przewijamy
   razem ze stroną playera, bez drugiego paska wewnątrz slajdu. */
.stage img[hidden], .question-screen[hidden], .question-check[hidden] { display: none; }
.stage.is-question { display: grid; height: auto; max-height: none; background: var(--sv-card-stage); }
.question-screen {
  display: grid;
  width: 100%;
  min-height: clamp(300px, calc(100cqw / var(--question-aspect-ratio, 1.7777778)), 640px);
  padding: clamp(10px, 2cqw, 28px);
  background-position: center top;
  background-repeat: no-repeat;
  background-size: contain;
  overflow-wrap: anywhere;
}
.question-card {
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 0;
  margin: 0;
  padding: clamp(12px, 2cqw, 26px);
  border: 1px solid var(--sv-card-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--sv-card) 96%, transparent);
  box-shadow: 0 6px 24px color-mix(in srgb, var(--sv-card-shadow) 10%, transparent);
  color: var(--sv-card-text);
  line-height: 1.45;
  font-size: clamp(1rem, 1.7cqw, 1.375rem);
}
.question-body { min-width: 0; overflow: visible; }
.question-card fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
.question-prompt { font-weight: 650; font-size: 1.3em; line-height: 1.3; white-space: pre-wrap; }
.question-eyebrow { color: var(--sv-eyebrow); font-size: .8em; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 .8em; }
.question-instruction { color: var(--sv-instruction); font-size: .9em; margin: .75em 0; }
.question-option {
  display: flex; align-items: flex-start; gap: clamp(8px, 1cqw, 12px);
  min-height: 44px; padding: clamp(8px, 1cqw, 12px);
  margin: 8px 0; border: 1px solid var(--sv-option-border); border-radius: 9px;
  background: var(--sv-option); cursor: pointer; white-space: pre-wrap;
}
.question-option > span { min-width: 0; }
.question-option:has(input:checked) { background: var(--sv-option-selected); border-color: var(--sv-accent); }
.question-option:focus-within { outline: 3px solid var(--sv-focus); outline-offset: 2px; }
.question-option input { flex: 0 0 auto; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--sv-focus); }
.question-message { color: var(--sv-warning); }
.question-message:empty, .question-audio-message:empty { display: none; }
.question-feedback-title { font-size: 1.3em; line-height: 1.3; margin: 0 0 .75em; }
.question-context { font-size: .9em; color: var(--sv-instruction); white-space: pre-wrap; }
.question-summary { white-space: pre-wrap; border-left: 4px solid var(--sv-accent); border-radius: 8px; padding: clamp(12px, 2cqw, 20px); background: var(--sv-summary); }
.question-explanation { padding: clamp(10px, 1.5cqw, 16px); margin: 12px 0; border-radius: 8px; border-left: 4px solid; }
.question-explanation p { margin: 7px 0 0; white-space: pre-wrap; }
.question-explanation .question-answer-status { margin: 0 0 10px; font-size: .8em; }
.question-explanation strong { white-space: pre-wrap; }
.question-explanation.is-correct { background: var(--sv-success); border-color: var(--sv-success-border); }
.question-explanation.is-incorrect { background: var(--sv-incorrect); border-color: var(--sv-incorrect-border); }
.question-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--sv-card-border); }
.question-continue { margin-left: auto; }
.question-card button { min-height: 44px; height: auto; max-width: 100%; white-space: normal; font-size: .95em; }
.question-retry, .question-back { background: var(--sv-secondary-button); color: var(--sv-secondary-button-text); }
@container (max-width: 600px) {
  .question-screen { min-height: 0; padding: 8px; }
  .question-card { padding: 12px; border-radius: 10px; }
  .question-card button { padding: 8px 10px; }
  .question-check { width: 100%; }
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: var(--page-padding);
}

#player {
  --sidebar-external-width: clamp(154px, 15.4vw, 196px);
  --player-main-limit: min(
    1400px,
    calc(100vw - var(--page-padding) - var(--page-padding) - var(--sidebar-external-width))
  );
  --player-main-width: var(--fitted-player-main-width, var(--player-main-limit));
  display: flex;
  width: 100%;
  min-width: 0;
  justify-content: center;
}

.shell {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.player-composite {
  position: relative;
  width: var(--player-main-width);
  overflow: hidden;
  border-radius: 12px;
  background: var(--sv-surface);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--sv-shadow) 12%, transparent);
  transition: width 180ms ease;
}

.shell.sidebar-open .player-composite {
  width: calc(var(--player-main-width) + var(--sidebar-external-width));
}

.player-content {
  width: var(--player-main-width);
  min-width: 0;
  padding: clamp(12px, 1.6vw, 24px);
  background: var(--sv-surface);
}

.viewer-layout {
  position: relative;
  width: 100%;
}

.viewer-main { min-width: 0; container-type: inline-size; }

.shell:fullscreen {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  align-items: safe center;
  overflow-y: auto;
  padding: 24px 32px;
  border-radius: 0;
  background: var(--sv-page);
  box-shadow: none;
}

.shell:fullscreen .player-composite {
  width: min(100%, var(--fullscreen-player-width, 100%));
  box-shadow: none;
}

.shell:fullscreen.sidebar-open .player-composite {
  width: calc(var(--fullscreen-player-width, 100%) + var(--sidebar-external-width));
}

.shell:fullscreen .player-content {
  width: min(100%, var(--fullscreen-player-width, 100%));
}

.shell:fullscreen .stage {
  min-height: 0;
  background: transparent;
}

.shell:fullscreen .stage img {
  width: 100%;
  max-height: none;
}

.player-header {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 2px 14px;
}

.player-header > * { min-width: 0; }

.header-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}

.presentation-name {
  max-width: min(520px, 44vw);
  overflow: hidden;
  color: var(--sv-title);
  font-size: 1.02rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-toggle { flex: 0 0 auto; }
.sidebar-toggle.is-active { background: var(--sv-active); }

.sidebar-icon {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.brand-logo {
  display: block;
  width: auto;
  max-width: min(300px, 42vw);
  height: 48px;
  object-fit: contain;
  object-position: left center;
}

.brand-logo[hidden] { display: none; }

.stage {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  background: var(--sv-stage);
}

.stage img {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  backface-visibility: hidden;
}

.stage img.slide-transition {
  animation-duration: var(--slide-transition-duration, 420ms);
  animation-fill-mode: both;
  animation-timing-function: cubic-bezier(.22, 1, .36, 1);
}

.stage img.slide-transition-fade { animation-name: slide-fade-in; }

.stage img.slide-transition-slide {
  --slide-enter-offset: 6%;
  animation-name: slide-move-in;
}

.stage img.slide-transition-slide.is-backward { --slide-enter-offset: -6%; }
.stage img.slide-transition-zoom { animation-name: slide-zoom-in; }

.stage img.slide-transition-wipe {
  --slide-wipe-start: inset(0 100% 0 0);
  animation-name: slide-wipe-in;
  animation-duration: var(--slide-transition-duration, 500ms);
}

.stage img.slide-transition-wipe.is-backward {
  --slide-wipe-start: inset(0 0 0 100%);
}

@keyframes slide-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-move-in {
  from { opacity: .25; transform: translateX(var(--slide-enter-offset)); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slide-zoom-in {
  from { opacity: 0; transform: scale(.965); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slide-wipe-in {
  from { clip-path: var(--slide-wipe-start); }
  to { clip-path: inset(0 0 0 0); }
}

.slide-sidebar {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  width: var(--sidebar-external-width);
  min-width: 0;
  max-height: none;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--sv-border);
  border-radius: 0 12px 12px 0;
  background: var(--sv-sidebar);
  box-shadow: -3px 0 10px color-mix(in srgb, var(--sv-shadow) 7%, transparent);
}

.slide-sidebar[hidden] { display: none; }

.slide-sidebar-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 6px 4px 10px;
  color: var(--sv-heading);
  background: var(--sv-sidebar-header);
  font-size: .76rem;
  font-weight: 700;
}

.sidebar-close {
  display: grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  color: var(--sv-heading);
  background: transparent;
}

.sidebar-close:hover { background: var(--sv-subtle-hover); }
.about-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; min-height: 44px;
  padding: 5px 2px; color: var(--sv-heading); background: transparent;
  font-size: .76rem; font-weight: 700; text-align: left; line-height: 1.25;
}
.about-toggle:hover { background: var(--sv-subtle-hover); }
.about-toggle svg { width: 19px; height: 19px; flex: 0 0 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.slide-sidebar-title { flex: 0 0 auto; margin: 0; padding: 8px 10px; color: var(--sv-heading); background: var(--sv-sidebar-header); font-size: .82rem; }
.slide-sidebar-divider { flex: 0 0 auto; margin: 0; width: 100%; border: 0; border-top: 1px solid var(--sv-border); }
.sidebar-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.slide-sidebar-tabs {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 5px;
  border-bottom: 1px solid var(--sv-border);
  background: var(--sv-sidebar-header);
}

.sidebar-view-button {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 5px;
  border-radius: 5px;
  color: var(--sv-heading);
  background: transparent;
  font-size: .76rem;
  font-weight: 700;
}

.sidebar-view-button:hover { color: var(--sv-active); background: var(--sv-subtle-hover); }
.sidebar-view-button.is-active { color: var(--sv-active-text); background: var(--sv-button); }
.sidebar-view-button.is-active:hover { background: var(--sv-button-hover); }

.sidebar-search-icon {
  display: block;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.slide-sidebar-view {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.slide-sidebar-view[hidden] { display: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.slide-search-form {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--sv-border);
  background: var(--sv-sidebar);
}

.slide-search-input {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--sv-input-border);
  border-radius: 5px;
  color: var(--sv-text);
  background: var(--sv-surface);
  font: inherit;
  font-size: .76rem;
}

.slide-search-submit {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  font-size: .76rem;
}

.slide-search-status {
  flex: 0 0 auto;
  padding: 7px 8px 2px;
  color: var(--sv-muted);
  font-size: .72rem;
  line-height: 1.3;
}

.slide-thumbnail-list,
.slide-search-results {
  flex: 1 1 auto;
  min-height: 0;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}

.slide-thumbnail {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 6px;
  border: 2px solid transparent;
  color: var(--sv-thumbnail-text);
  background: var(--sv-surface);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--sv-shadow) 10%, transparent);
  text-align: left;
}

.slide-thumbnail:hover {
  border-color: var(--sv-thumbnail-hover-border);
  color: var(--sv-highlight-text);
  background: var(--sv-thumbnail-hover);
}

.slide-thumbnail.is-current {
  border-color: var(--sv-button);
  color: var(--sv-selection-text);
  background: var(--sv-selection);
}

.slide-thumbnail-title {
  display: -webkit-box;
  margin-bottom: 5px;
  overflow: hidden;
  font-size: .78rem;
  font-weight: 650;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.slide-thumbnail img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--slide-aspect-ratio, 16 / 9);
  object-fit: contain;
  border: 1px solid var(--sv-thumbnail-border);
  background: var(--sv-stage);
}

/* Własne tło zostaje pod grafiką; symbol rozpoznajemy także bez tła. */
.question-thumbnail {
  position: relative;
  display: flex;
  width: 100%;
  aspect-ratio: var(--slide-aspect-ratio, 16 / 9);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  border: 1px solid var(--sv-question-thumb-border);
  border-radius: 5px;
  background: linear-gradient(140deg, var(--sv-gradient-start), var(--sv-gradient-end));
}
.question-thumbnail img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .3; border: 0; }
.question-thumbnail svg { position: relative; width: 46%; max-height: 60%; color: var(--sv-info); }
.question-thumbnail-label {
  position: relative; max-width: 96%; padding: 3px 6px; border-radius: 4px;
  color: var(--sv-badge-text); background: color-mix(in srgb, var(--sv-card) 92%, transparent); font-size: 10px; font-weight: 700;
  line-height: 1.2; text-align: center;
}

.slide-thumbnail-number {
  display: block;
  margin-top: 4px;
  color: var(--sv-secondary);
  font-size: .7rem;
  font-weight: 600;
}

.caption-panel {
  max-height: 180px;
  margin-top: 12px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  border: 1px solid var(--sv-border);
  border-radius: 6px;
  background: var(--sv-caption);
}

.caption-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 12px;
  border-bottom: 1px solid var(--sv-border);
  color: var(--sv-heading);
  background: var(--sv-caption);
  font-size: .9em;
  font-weight: 700;
}

.caption-list {
  --caption-base-size: 1.03rem;
  padding: 12px 14px 14px;
  color: var(--sv-text);
  font-size: calc(var(--caption-base-size) * var(--caption-scale, 1));
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.caption-empty {
  margin: 0;
  padding: 10px 12px;
  color: var(--sv-caption-empty);
  font-style: italic;
}

.caption-text { margin: 0; white-space: normal; }

.caption-cue {
  display: inline;
  padding: 1px 2px;
  border: 0;
  color: inherit;
  background: transparent;
  border-radius: 3px;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.caption-cue:hover { background: var(--sv-caption-hover); color: var(--sv-highlight-text); }
.caption-cue.is-current { background: var(--sv-selection); color: var(--sv-highlight-text); }
.caption-cue:focus-visible { outline: 3px solid var(--sv-active); outline-offset: 2px; }

.controls {
  --control-size: 44px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-areas: "transport transport transport playback playback playback" "tools tools tools tools navigation navigation";
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--sv-button-text);
  background: var(--sv-button);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover { background: var(--sv-button-hover); }
button:focus-visible, input:focus-visible { outline: 3px solid var(--sv-active); outline-offset: 2px; }
button[disabled] { cursor: not-allowed; opacity: .55; }

.square-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.controls .square-button { width: var(--control-size); height: var(--control-size); }
.play { font-size: 18px; }
.transport-controls { grid-area: transport; display: flex; gap: 4px; }

.playback-panel {
  grid-area: playback;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  align-items: center;
  min-width: 0;
  font-size: .72rem;
}

.progress { grid-column: 1; grid-row: 3; width: 100%; min-width: 0; height: 12px; margin: 0; accent-color: var(--sv-button); }
.time { grid-column: 1; grid-row: 2; }
.time, .counter { font-variant-numeric: tabular-nums; white-space: nowrap; }
.utility-controls { grid-area: tools; display: flex; gap: 4px; }
.utility-button { color: var(--sv-button-text); }
.utility-button.is-active { background: var(--sv-active); }
.utility-button.is-active:hover { background: var(--sv-active-hover); }
.utility-button.placeholder { font-size: 17px; }
.navigation-spacer { grid-area: spacer; display: none; min-width: 148px; }
.navigation { grid-area: navigation; display: flex; gap: 4px; justify-content: flex-end; }
.navigation button {
  display: inline-flex;
  width: var(--control-size);
  min-width: 0;
  height: var(--control-size);
  padding: 0;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}
.nav-label { display: none; }
.nav-arrow { width: 30px; height: 30px; flex: 0 0 30px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* Keep the three primary controls together; adapt to the player width in Moodle too. */
@container (min-width: 420px) {
  .playback-panel { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 6px; font-size: .8rem; }
  .counter { grid-column: 1; grid-row: 1; }
  .time { grid-column: 2; grid-row: 1; }
  .progress { grid-column: 1 / -1; grid-row: 2; height: 24px; }
}
@container (min-width: 720px) {
  .controls { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "transport playback tools navigation"; gap: 8px; margin-top: 14px; }
  .navigation { gap: 8px; }
}
/* Reserve space for navigation text before giving the remaining width to progress. */
@container (min-width: 800px) {
  .navigation button { width: auto; min-width: 108px; padding: 0 8px; gap: 4px; font-size: .9rem; }
  .nav-label { display: inline; }
  .nav-arrow { width: 20px; height: 20px; flex-basis: 20px; }
}
@container (min-width: 960px) {
  .transport-controls, .utility-controls { gap: 8px; }
  .navigation button { width: auto; min-width: 112px; padding: 0 10px; gap: 8px; font-size: .9rem; }
  .nav-label { display: inline; }
  .nav-arrow { width: 32px; height: 32px; flex-basis: 32px; }
}

@media (max-width: 820px) {
  :root { scrollbar-gutter: auto; }
  body { place-items: start center; }
  #player {
    --player-main-limit: 100%;
    --player-main-width: var(--fitted-player-main-width, var(--player-main-limit));
  }
  .shell { width: 100%; min-height: 0; }
  .shell.sidebar-open .player-composite { width: 100%; }
  .slide-sidebar {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    height: 380px;
    max-height: min(60dvh, 420px);
    min-height: 280px;
    border-left: 0;
    border-top: 1px solid var(--sv-border);
    border-radius: 0 0 12px 12px;
    box-shadow: none;
  }
  .sidebar-close { width: 44px; height: 44px; }
  .sidebar-view-button, .slide-search-submit { min-height: 44px; }
  .slide-search-input { min-height: 44px; font-size: 16px; }
  .slide-search-form { grid-template-columns: minmax(0, 1fr) auto; }
  .slide-search-status { overflow-wrap: anywhere; }
  .slide-thumbnail-list, .slide-search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr));
    gap: 8px;
    align-content: start;
  }
  .slide-thumbnail { margin: 0; }
  .shell:fullscreen { padding: 8px; overflow-y: auto; place-items: start center; }
  .shell:fullscreen .player-composite,
  .shell:fullscreen.sidebar-open .player-composite,
  .shell:fullscreen .player-content { width: 100%; }
}

@media (max-width: 680px) {
  body { padding: 0; }
  .player-content { padding: 8px; }
  .player-header { min-height: 52px; gap: 8px; padding-bottom: 8px; }
  .brand-logo { height: 36px; max-width: 36%; }
  .sidebar-toggle { width: 44px; height: 44px; }
  .header-actions { gap: 8px; }
  .presentation-name { max-width: 100%; font-size: .88rem; }
  .caption-panel { max-height: 160px; }
  .caption-list { padding: 10px; --caption-base-size: .95rem; }
}

@media (prefers-reduced-motion: reduce) {
  .stage img.slide-transition { animation: none; }
}

/* Film zachowuje proporcje także w ramce i na telefonie. */
.video-screen[hidden] { display: none; }
.stage.is-video { display: block; height: auto; max-height: none; background: var(--sv-card-stage); }
.video-screen { width: 100%; min-width: 0; padding: clamp(8px, 2cqw, 28px); background: center top / contain no-repeat; overflow-wrap: anywhere; }
.video-card { min-width: 0; padding: clamp(10px, 1.6cqw, 22px); border: 1px solid var(--sv-card-border); border-radius: 14px; background: color-mix(in srgb, var(--sv-card) 96%, transparent); color: var(--sv-card-text); font-size: clamp(1rem, 1.6cqw, 1.2rem); line-height: 1.45; }
.video-title { margin: 0 0 .65em; font-size: 1.35em; line-height: 1.3; white-space: pre-wrap; }
.video-media { display: block; width: 100%; max-width: 100%; height: auto; max-height: 65dvh; aspect-ratio: var(--video-aspect, 16 / 9); object-fit: contain; background: var(--sv-video); border-radius: 8px; }
.video-message:empty { display: none; }
.video-message { margin: .7em 0; color: var(--sv-warning); }
.video-thumbnail { background: var(--sv-video-thumbnail); }
@container (max-width: 600px) { .video-card { border-radius: 10px; } }
/* Shown only when the browser requires a click before audio playback. */
.playback-notice { margin: 6px 0; color: var(--sv-info); font-size: 0.9rem; }
.playback-notice[hidden] { display: none; }

.theme-toggle { flex: 0 0 auto; }
.theme-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-sun { display: block; }
:root[data-theme="dark"] .theme-moon { display: none; }
.caption-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.caption-title { min-width: 0; overflow-wrap: anywhere; }
.caption-font-controls { display: flex; flex: 0 0 auto; gap: 4px; }
.caption-font-controls button { min-width: 36px; min-height: 36px; padding: 4px 6px; }
.caption-empty { font-size: inherit; }
.utility-button.is-active, .sidebar-toggle.is-active { color: var(--sv-active-text); }
@media (max-width: 680px) {
  .theme-toggle { width: 44px; height: 44px; }
  .caption-font-controls button { min-width: 44px; min-height: 44px; }
}

/* The theme policy also applies when a different preference was saved locally. */
.theme-toggle[hidden], .attachments-toggle[hidden] { display: none; }
.attachments-toggle { justify-self: end; background: var(--sv-attachment-button); color: var(--sv-attachment-icon); }
.attachments-toggle:hover { background: var(--sv-attachment-hover); }
.attachments-toggle.is-active { background: var(--sv-attachment-active); color: var(--sv-attachment-active-icon); }
.attachments-toggle.is-active:hover { background: var(--sv-attachment-active-hover); }
.attachments-dialog {
  width: min(620px, calc(100vw - 24px)); max-height: 80dvh; overflow: auto;
  margin: auto; padding: 20px; border: 1px solid var(--sv-attachment-border); border-radius: 12px;
  background: var(--sv-attachment-panel); color: var(--sv-attachment-text); overflow-wrap: anywhere;
}
.attachments-dialog::backdrop { background: color-mix(in srgb, var(--sv-attachment-backdrop) 55%, transparent); }
.attachments-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.attachments-heading h2 { margin: 0; font-size: 1.2rem; }
.attachments-close { flex: 0 0 auto; min-width: 44px; min-height: 44px; background: var(--sv-attachment-button); color: var(--sv-attachment-icon); font-size: 1.3rem; }
.attachments-close:hover { background: var(--sv-attachment-hover); }
.attachments-list { list-style: none; padding: 0; margin: 0; }
.attachments-list li { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--sv-attachment-border); }
.attachments-list a { display: block; flex: 1; min-width: 0; padding: 14px 0; color: var(--sv-attachment-link); }
.attachments-list a:focus-visible { outline: 3px solid var(--sv-focus); outline-offset: 2px; }
.attachments-list span { flex: 0 0 auto; font-size: .8rem; }
.language-toggle { flex: 0 0 44px; font-size: 13px; font-weight: 700; }
.language-toggle[hidden] { display: none; }

.about-dialog {
  width: min(760px, calc(100vw - 24px)); max-height: 85dvh; overflow: auto;
  margin: auto; padding: 20px; border: 1px solid var(--sv-border); border-radius: 12px;
  background: var(--sv-surface); color: var(--sv-text); overflow-wrap: anywhere; line-height: 1.55;
}
.about-dialog::backdrop { background: color-mix(in srgb, var(--sv-shadow) 55%, transparent); }
.about-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; color: var(--sv-heading); }
.about-close { flex: 0 0 auto; min-width: 44px; min-height: 44px; padding: 0; font-size: 1.3rem; }
.about-masthead { margin-top: 14px; padding: 12px 16px; border-radius: 8px; background: var(--sv-button); color: var(--sv-button-text); font-size: .78rem; font-weight: 700; letter-spacing: .04em; }
.about-content { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: start; margin: 22px 0; }
.about-logo { width: 100%; height: auto; background: white; border-radius: 10px; }
.about-content h2 { margin: 0; color: var(--sv-title); font-size: 1.65rem; line-height: 1.2; }
.about-subtitle { color: var(--sv-heading); font-weight: 700; }
.about-description { font-size: .94rem; }
.about-version { color: var(--sv-muted); font-size: .8rem; }
.about-credits { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--sv-border); }
.about-credits span { display: block; color: var(--sv-muted); font-size: .8rem; }
.about-author { display: block; font-size: .9rem; }
.about-email { color: var(--sv-info); font-size: .9rem; align-self: center; }
.about-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.about-footer > span { color: var(--sv-muted); font-size: .75rem; }
.about-dismiss { min-height: 44px; flex: 0 0 auto; }
@media (max-width: 600px) {
  .about-dialog { padding: 14px; }
  .about-content { grid-template-columns: minmax(0, 1fr); gap: 16px; margin: 16px 0; }
  .about-logo { width: 100px; justify-self: center; }
}

.speed-icon, .volume-icon { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.volume-off { display: none; }
.is-muted .volume-waves { display: none; }
.is-muted .volume-off { display: block; }
.speed-toggle.is-active { background: var(--sv-active); color: var(--sv-active-text); }
.speed-menu { position: fixed; inset: auto; margin: 0; padding: 0; width: min(220px, calc(100vw - 16px)); overflow-y: auto; border: 1px solid var(--sv-border); border-radius: 12px; background: var(--sv-surface); color: var(--sv-text); box-shadow: 0 8px 26px color-mix(in srgb, var(--sv-shadow) 28%, transparent); }
.speed-title { padding: 14px 18px; border-bottom: 1px solid var(--sv-border); font-size: 1rem; font-weight: 700; }
.speed-menu button { display: flex; width: 100%; min-height: 48px; gap: 16px; align-items: center; padding: 10px 18px; color: var(--sv-text); background: transparent; border-radius: 0; font-weight: 400; }
.speed-menu button:hover, .speed-menu button:focus-visible { background: var(--sv-subtle-hover); outline-offset: -3px; }
.speed-menu button[aria-checked="true"] { background: var(--sv-selection); color: var(--sv-selection-text); }
.speed-menu button svg { visibility: hidden; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.speed-menu button[aria-checked="true"] svg { visibility: visible; }
