:root {
  --academy-ink: #13242a;
  --academy-muted: #66767d;
  --academy-line: #e5eaeb;
  --academy-teal: #087d78;
  --academy-surface: #ffffff;
}

.academy-body { min-height: 100vh; }
.academy-page { width: min(100% - 48px, 1200px); min-height: calc(100vh - 148px); margin: 0 auto; padding: 52px 0 84px; }
.academy-app { text-align: left; }
.academy-state { min-height: 430px; display: grid; place-items: center; align-content: center; gap: 13px; padding: 42px; border-radius: 8px; background: var(--academy-surface); box-shadow: 0 20px 60px rgba(25, 43, 50, 0.07); text-align: center; }
.academy-state h1 { max-width: 620px; margin: 0; color: var(--academy-ink); font-size: 32px; line-height: 1.2; letter-spacing: 0; }
.academy-state > p:not(.page-eyebrow) { max-width: 560px; margin: 0 0 9px; color: var(--academy-muted); line-height: 1.65; }
.academy-state-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; }
.academy-state-actions > a:not(.primary-link) { color: var(--academy-muted); font-size: 14px; font-weight: 700; text-underline-offset: 4px; }
.academy-loader { width: 28px; height: 28px; border: 2px solid rgba(8, 125, 120, 0.16); border-top-color: var(--academy-teal); border-radius: 50%; animation: academySpin 0.7s linear infinite; }
@keyframes academySpin { to { transform: rotate(360deg); } }

.academy-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 48px; margin: 0 0 32px; }
.academy-heading > div { max-width: 700px; }
.academy-heading h1 { margin: 0; color: var(--academy-ink); font-size: 42px; font-weight: 720; line-height: 1.08; letter-spacing: 0; }
.academy-heading > div > p:not(.page-eyebrow) { margin: 12px 0 0; color: var(--academy-muted); font-size: 15px; line-height: 1.65; }
.academy-search { width: min(100%, 300px); display: grid; justify-self: end; flex: 0 0 auto; gap: 8px; color: #5c6d74; font-size: 14px; font-weight: 800; text-transform: uppercase; }
.academy-search input { width: 100%; height: 46px; padding: 0 15px; border: 1px solid transparent; border-radius: 8px; outline: none; background: #fff; color: var(--academy-ink); font: inherit; font-size: 14px; text-transform: none; box-shadow: 0 8px 28px rgba(27, 46, 53, 0.08); transition: border-color 0.18s ease, box-shadow 0.18s ease; }
.academy-search input:focus { border-color: rgba(8, 125, 120, 0.45); box-shadow: 0 0 0 3px rgba(8, 125, 120, 0.09), 0 10px 30px rgba(27, 46, 53, 0.08); }

.academy-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); align-items: start; gap: 24px; }
.academy-sidebar,
.academy-reader { min-width: 0; border-radius: 8px; background: var(--academy-surface); box-shadow: 0 18px 52px rgba(26, 44, 51, 0.07); }
.academy-sidebar { position: relative; padding: 10px; }
.academy-sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 10px 14px; }
.academy-sidebar-heading span { color: #6b7b82; font-size: 14px; font-weight: 800; text-transform: uppercase; }
.academy-sidebar-heading strong { color: #849197; font-size: 14px; font-weight: 700; }
.academy-module-list { display: grid; gap: 2px; padding: 0 0 12px; }
.academy-module-select { display: none; }
.academy-module-button { width: 100%; min-height: 48px; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 9px; margin: 0; padding: 7px 11px; border: 0; border-radius: 7px; background: transparent; color: #45575f; box-shadow: none; text-align: left; transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease; }
.academy-module-button:hover { background: #f1f5f5; color: #1d343b; transform: translateX(2px); }
.academy-module-button.active { background: #173037; color: #fff; }
.academy-module-button.active:hover { background: #173037; color: #fff; }
.academy-module-number { color: #829197; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.academy-module-button.active .academy-module-number { color: #8fd7d0; }
.academy-module-title { min-width: 0; font-size: 14px; font-weight: 700; line-height: 1.35; }
.academy-module-button.is-locked { color: #7b898f; }
.academy-module-button.is-locked:hover { background: #f7f3eb; color: #4d5559; }
.academy-module-lock { display: inline-flex; align-items: center; gap: 4px; color: #9a6f24; font-size: 10px; font-weight: 850; letter-spacing: 0.04em; text-transform: uppercase; }
.academy-module-lock::before { width: 8px; height: 7px; content: ""; border: 1.5px solid currentColor; border-radius: 2px; background: transparent; box-shadow: 0 -5px 0 -2px #fff, 0 -5px 0 -0.5px currentColor; }
.academy-resources { padding: 15px 10px 5px; border-top: 1px solid var(--academy-line); }
.academy-resources h2 { margin: 0 0 8px; color: #718087; font-size: 14px; text-transform: uppercase; }
.academy-resources a { min-height: 44px; display: flex; align-items: center; color: #52666e; font-size: 14px; text-decoration: none; transition: color 0.18s ease, transform 0.18s ease; }
.academy-resources a:hover { color: var(--academy-teal); transform: translateX(2px); }

.academy-reader { position: relative; min-height: 560px; padding: 48px clamp(34px, 5vw, 68px) 70px; }
.module-loading { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; align-content: center; gap: 12px; border-radius: inherit; background: rgba(255, 255, 255, 0.9); color: var(--academy-muted); font-size: 14px; backdrop-filter: blur(10px); }
.module-header { padding-bottom: 26px; }
.module-number { margin: 0 0 9px; color: var(--academy-teal); font-size: 14px; font-weight: 850; text-transform: uppercase; }
.module-header h2 { max-width: 760px; margin: 0; color: var(--academy-ink); font-size: 34px; font-weight: 720; line-height: 1.18; letter-spacing: 0; }
.module-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 20px; color: #7a898f; font-size: 14px; }
#viewerMark { max-width: 58%; margin-left: auto; overflow-wrap: anywhere; text-align: right; }
.academy-reader,
.academy-reader * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.academy-reader img { -webkit-user-drag: none; }
.academy-section-list { display: flex; gap: 20px; margin: 4px 0 6px; padding: 0 0 8px; overflow-x: auto; border-bottom: 1px solid var(--academy-line); scrollbar-width: thin; }
.academy-section-list::-webkit-scrollbar { height: 5px; }
.academy-section-list::-webkit-scrollbar-thumb { border-radius: 999px; background: #c6d0d3; }
.academy-section-list a { min-height: 44px; display: inline-flex; flex: 0 0 auto; align-items: center; border-bottom: 2px solid transparent; color: #64757c; font-size: 14px; font-weight: 700; text-decoration: none; transition: border-color 0.18s ease, color 0.18s ease; }
.academy-section-list a:hover { border-bottom-color: #6abcb5; color: var(--academy-teal); }
.academy-content { max-width: 780px; }
.academy-section { padding: 31px 0 14px; scroll-margin-top: 94px; border-top: 1px solid var(--academy-line); }
.academy-section-list:not(.hidden) + .academy-content .academy-section:first-child { border-top: 0; }
.academy-section:last-child { padding-bottom: 0; }
.academy-section h3 { margin: 0 0 18px; color: #21363d; font-size: 21px; font-weight: 720; line-height: 1.35; letter-spacing: 0; }
.academy-figure { max-width: 100%; margin: 2px 0 27px; overflow-x: auto; border: 1px solid #e1e7e9; border-radius: 10px; background: #fff; box-shadow: 0 12px 32px rgba(25, 43, 50, 0.07); scrollbar-width: thin; }
.academy-figure-link { display: block; width: 100%; color: inherit; cursor: zoom-in; }
.academy-figure-image { width: 100%; height: auto; display: block; }
.academy-section p { margin: 0 0 15px; color: #43565e; font-size: 14.5px; line-height: 1.8; }
.academy-section p.academy-subheading { margin-bottom: 7px; color: #20363d; font-weight: 760; }
.academy-definition-term { color: #20363d; font-weight: 760; }
.academy-section ul { display: grid; gap: 10px; margin: 5px 0 20px; padding: 0 0 0 20px; color: #43565e; }
.academy-section li { padding-left: 4px; font-size: 14.5px; line-height: 1.7; }
.academy-no-results { margin: 38px 0 0; color: var(--academy-muted); text-align: center; }
.academy-search-results h2 { margin: 0 0 26px; color: var(--academy-ink); font-size: 30px; }
.academy-search-result-list { display: grid; gap: 10px; }
.academy-search-result { width: 100%; display: grid; gap: 7px; padding: 17px 18px; border: 1px solid var(--academy-line); border-radius: 8px; background: #fff; color: var(--academy-ink); box-shadow: none; text-align: left; transition: border-color 0.18s ease, transform 0.18s ease; }
.academy-search-result:hover { border-color: rgba(8, 125, 120, 0.42); transform: translateY(-1px); }
.academy-search-result-module { color: var(--academy-teal); font-size: 14px; font-weight: 800; text-transform: uppercase; }
.academy-search-result strong { font-size: 15px; line-height: 1.35; }
.academy-search-result-excerpt { color: var(--academy-muted); font-size: 14px; font-weight: 400; line-height: 1.55; }
.academy-plan-note { color: #087d78; }
.academy-plan-note.is-premium { color: #8a651f; }
#moduleReader.is-entering { animation: academyContentIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes academyContentIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

body.academy-dialog-open { overflow: hidden; }
.academy-premium-dialog { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 20px; background: rgba(10, 23, 28, 0.72); backdrop-filter: blur(10px); }
.academy-premium-card { position: relative; width: min(100%, 590px); max-height: calc(100vh - 40px); overflow-y: auto; padding: 34px 38px 30px; border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 10px; background: #fff; box-shadow: 0 28px 80px rgba(9, 25, 31, 0.32); }
.academy-premium-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: #eef3f3; box-shadow: none; }
.academy-premium-close::before, .academy-premium-close::after { position: absolute; top: 17px; left: 10px; width: 16px; height: 2px; content: ""; border-radius: 2px; background: #52666e; transform: rotate(45deg); }
.academy-premium-close::after { transform: rotate(-45deg); }
.academy-premium-kicker { margin: 0 0 8px; color: #8a651f; font-size: 13px; font-weight: 850; letter-spacing: 0.06em; text-transform: uppercase; }
.academy-premium-card h2 { max-width: 500px; margin: 0 0 10px; color: #13242a; font-size: 28px; line-height: 1.2; }
.academy-premium-card > p:not(.academy-premium-kicker) { margin: 0; color: #617278; font-size: 14.5px; line-height: 1.6; }
.academy-premium-card ul { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 20px; margin: 22px 0; padding: 0; list-style: none; }
.academy-premium-card li { position: relative; padding-left: 23px; color: #354c54; font-size: 14px; line-height: 1.45; }
.academy-premium-card li::before { position: absolute; top: 3px; left: 0; width: 15px; height: 15px; display: grid; place-items: center; content: "✓"; border-radius: 50%; background: #e2f4ef; color: #087d78; font-size: 10px; font-weight: 900; }
.academy-premium-actions { display: grid; gap: 10px; }
.academy-premium-actions .primary-link { width: 100%; justify-content: center; text-align: center; }
.academy-premium-actions span { color: #75858b; font-size: 13px; text-align: center; }

@media (max-width: 1040px) {
  .academy-page { width: min(100% - 30px, 1200px); padding-top: 38px; }
  .academy-layout { grid-template-columns: 270px minmax(0, 1fr); gap: 16px; }
}

@media (max-width: 820px) {
  .academy-heading { align-items: stretch; flex-direction: column; gap: 22px; }
  .academy-heading h1 { font-size: 36px; }
  .academy-search { width: min(100%, 300px); justify-self: end; }
  .academy-layout { grid-template-columns: 1fr; }
  .academy-sidebar { position: static; }
  .academy-module-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .academy-reader { min-height: 520px; padding: 40px 34px 58px; }
}

@media (max-width: 560px) {
  .academy-page { width: min(100% - 20px, 1200px); padding: 30px 0 54px; }
  .academy-heading { margin-bottom: 24px; }
  .academy-heading h1 { font-size: 33px; }
  .academy-heading > div > p:not(.page-eyebrow) { font-size: 14px; }
  .academy-module-list { display: none; }
  .academy-module-select { display: grid; gap: 7px; padding: 14px 10px; color: var(--academy-muted); font-size: 14px; font-weight: 800; text-transform: uppercase; }
  .academy-module-select select { width: 100%; height: 43px; padding: 0 11px; border: 1px solid var(--academy-line); border-radius: 7px; outline: none; background: #f7f9f9; color: var(--academy-ink); font: inherit; font-size: 14px; text-transform: none; }
  .academy-resources { display: flex; flex-wrap: wrap; gap: 2px 14px; }
  .academy-resources h2 { width: 100%; }
  .academy-resources a { min-height: 44px; }
  .academy-reader { min-height: 460px; padding: 32px 22px 48px; }
  .module-header h2 { font-size: 27px; }
  .module-meta { align-items: flex-start; flex-direction: column; }
  #viewerMark { max-width: 100%; margin-left: 0; text-align: left; }
  .academy-section h3 { font-size: 19px; }
  .academy-figure-image { min-width: 560px; }
  .academy-section p,
  .academy-section li { font-size: 14px; }
  .academy-state { min-height: 360px; padding: 28px 20px; }
  .academy-state h1 { font-size: 27px; }
  .academy-premium-card { padding: 30px 22px 24px; }
  .academy-premium-card h2 { padding-right: 22px; font-size: 23px; }
  .academy-premium-card ul { grid-template-columns: 1fr; }
}

@media print {
  .academy-reader, .academy-sidebar { display: none !important; }
  .academy-app::after { display: block; padding: 40px; content: "Materiały Akademii OP są dostępne na koncie użytkownika."; }
}
