:root {
  --green: #1c654f;
  --green-dark: #123f35;
  --green-soft: #e8f3ee;
  --blue: #183b66;
  --ink: #18231f;
  --muted: #617069;
  --line: #d8e2dd;
  --red: #c94747;
  --white: #fff;
  --shadow: 0 18px 45px rgba(19, 62, 49, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #f4f7f5;
  line-height: 1.65;
}
.hidden { display: none !important; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 100; background: #fff; padding: 10px; }

.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 10px 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-main {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr auto;
  gap: 18px;
  align-items: center;
}
.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  display: block;
}
.brand-wrap strong,
.brand-wrap span { display: block; }
.brand-wrap strong { color: var(--green-dark); font-size: 18px; }
.brand-wrap span { font-size: 12px; color: var(--muted); }
.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 9px 12px;
}
.header-funding {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.header-eu-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}
.header-eu-logo {
  width: 100%;
  max-width: 450px;
  max-height: 72px;
  object-fit: contain;
  display: block;
}
.header-partners-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
}
.header-partner {
  width: 62px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,.03);
}
.header-partner img {
  max-width: 50px;
  max-height: 36px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.header-partner-portrait img {
  max-width: 38px;
  max-height: 38px;
  border-radius: 50%;
}

.app-shell {
  max-width: 1440px;
  margin: auto;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: calc(100vh - 120px);
}
.sidebar { background: #fff; border-right: 1px solid var(--line); }
.sidebar-inner {
  position: sticky;
  top: 120px;
  padding: 28px 20px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 8px;
}
.progress-track { height: 8px; background: #e8eeeb; border-radius: 999px; overflow: hidden; }
.progress-track > div { height: 100%; width: 0; background: var(--green); transition: width .3s; }
.progress-text { font-size: 13px; color: var(--muted); margin: 8px 0 20px; }
#chapterNav { display: grid; gap: 4px; }
.chapter-nav-btn,
.nav-quiz-btn {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 9px 10px;
  border-radius: 8px;
  color: #35443e;
  cursor: pointer;
  font-size: 13px;
}
.chapter-nav-btn:hover,
.chapter-nav-btn.active { background: var(--green-soft); color: var(--green-dark); }
.chapter-nav-btn.completed::before { content: '✓'; margin-right: 7px; color: var(--green); font-weight: 700; }
.nav-quiz-btn {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding-top: 18px;
  font-weight: 700;
  color: var(--blue);
}

.main-content { padding: 50px clamp(24px, 6vw, 88px); min-width: 0; }
.view { max-width: 960px; margin: 0 auto; }
.hero-view {
  max-width: 1100px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 48px;
  align-items: center;
  min-height: 680px;
}
.hero-copy h1,
h1 {
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.08;
  margin: 0 0 20px;
  color: var(--green-dark);
  letter-spacing: -.03em;
}
#chapterTitle { font-size: clamp(32px, 4vw, 52px); }
.lead { font-size: 20px; color: #4b5c55; max-width: 750px; }
.hero-course-brand { margin-bottom: 20px; }
.hero-course-logo {
  width: min(170px, 42vw);
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.06));
}
.hero-actions,
.result-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0; }
.primary-btn,
.secondary-btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 13px 20px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.primary-btn { background: var(--green); color: #fff; }
.primary-btn:hover { background: var(--green-dark); }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; }
.secondary-btn { background: #fff; color: var(--green-dark); border: 1px solid var(--line); }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 38px;
}
.feature-grid div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.feature-grid strong { display: block; font-size: 28px; color: var(--blue); }
.feature-grid span { font-size: 13px; color: var(--muted); }
.intro-support-card {
  margin-top: 26px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.intro-eu-logo {
  max-width: min(100%, 470px);
  width: 100%;
  height: auto;
  display: block;
}
.hero-visual {
  min-height: 440px;
  background: linear-gradient(155deg, #d8eee3, #f6f2e5);
  border-radius: 30px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-end;
  padding: 34px;
}
.hero-visual span {
  position: relative;
  z-index: 2;
  font-size: 23px;
  line-height: 1.3;
  color: var(--green-dark);
  font-weight: 700;
}
.leaf { position: absolute; border-radius: 100% 0 100% 0; background: rgba(28, 101, 79, .22); transform: rotate(35deg); }
.leaf-a { width: 230px; height: 320px; top: -40px; right: -20px; }
.leaf-b { width: 160px; height: 250px; left: 20px; top: 80px; transform: rotate(-20deg); }
.leaf-c { width: 110px; height: 180px; right: 100px; bottom: 50px; transform: rotate(65deg); }

.chapter-topline { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.chapter-number { font-weight: 700; color: var(--green); }
.chapter-figure { margin: 30px 0; }
.chapter-figure img {
  display: block;
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.chapter-figure figcaption { text-align: center; color: var(--muted); font-size: 12px; margin-top: 8px; }
.chapter-text { font-size: 18px; }
.chapter-text p { margin: 0 0 18px; }
.key-message {
  background: var(--green-soft);
  border-left: 5px solid var(--green);
  border-radius: 12px;
  padding: 20px 22px;
  margin: 30px 0;
}
.key-message span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--green);
}
.key-message p { margin: 5px 0 0; font-size: 18px; font-weight: 700; color: var(--green-dark); }
.chapter-actions,
.quiz-actions { display: flex; justify-content: space-between; gap: 14px; margin-top: 36px; }
.narrow-view { max-width: 760px; }
.info-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin: 28px 0; }
.quiz-status { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.quiz-question { font-size: clamp(27px, 4vw, 40px); margin-top: 34px; }
.answer-list { display: grid; gap: 13px; margin: 28px 0; }
.answer-option {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 12px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font-size: 16px;
}
.answer-option:hover,
.answer-option.selected { border-color: var(--green); background: var(--green-soft); }
.answer-letter {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-weight: 700;
}
.answer-option.selected .answer-letter { background: var(--green); color: #fff; border-color: var(--green); }

.result-view { text-align: center; }
.result-chart { width: min(520px, 95vw); margin: 20px auto; }
.result-chart svg { width: 100%; height: auto; overflow: visible; }
.result-description { max-width: 650px; margin: 0 auto; color: var(--muted); font-size: 17px; }
.result-legend { display: flex; justify-content: center; gap: 22px; margin: 18px; }
.result-legend span { display: flex; align-items: center; gap: 7px; }
.correct-dot,
.incorrect-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.correct-dot { background: #42a56f; }
.incorrect-dot { background: var(--red); }
.result-actions { justify-content: center; }
.review-panel { text-align: left; margin-top: 35px; }
.review-item { background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--red); border-radius: 12px; padding: 18px; margin: 12px 0; }
.review-item.correct { border-left-color: #42a56f; }
.review-item h3 { margin: 0 0 9px; font-size: 16px; }
.review-item p { margin: 4px 0; font-size: 14px; }
.review-answer { font-weight: 700; }

.course-footer {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 28px 20px 24px;
}
.footer-inner { max-width: 1180px; margin: 0 auto; }
.footer-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.footer-publicity {
  display: flex;
  justify-content: flex-start;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.footer-eu-logo {
  width: min(100%, 540px);
  max-height: 90px;
  object-fit: contain;
  display: block;
}
.partner-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.partner-logo-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  min-width: 110px;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.03);
}
.partner-logo-card img {
  max-width: 110px;
  max-height: 56px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.maps-logo-card img { max-width: 76px; max-height: 76px; }
.portrait-card img { max-width: 64px; max-height: 64px; border-radius: 50%; }
.footer-note {
  margin: 20px auto 0;
  max-width: 1080px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.tooltip-logo { position: relative; }
.tooltip-logo::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(6px);
  background: rgba(24, 35, 31, .96);
  color: #fff;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  z-index: 5;
}
.tooltip-logo::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%) translateY(6px);
  border-width: 6px 6px 0 6px;
  border-style: solid;
  border-color: rgba(24, 35, 31, .96) transparent transparent transparent;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
  z-index: 5;
}
.tooltip-logo:hover::after,
.tooltip-logo:hover::before,
.tooltip-logo:focus-within::after,
.tooltip-logo:focus-within::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1100px) {
  .header-main { grid-template-columns: minmax(220px, 260px) 1fr; }
  .menu-btn { justify-self: end; }
  .header-funding { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .site-header { padding: 10px 16px; }
  .header-main { grid-template-columns: 1fr auto; align-items: start; }
  .menu-btn { display: block; justify-self: end; }
  .header-funding {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .header-partners-row { justify-content: center; flex-wrap: wrap; }
  .header-eu-wrap { justify-content: center; }
  .header-eu-logo { max-width: 420px; max-height: 68px; }
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 120px;
    bottom: 0;
    width: min(320px, 88vw);
    z-index: 15;
    transform: translateX(-105%);
    transition: .25s;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { padding: 36px 20px; }
  .hero-view { grid-template-columns: 1fr; min-height: auto; }
  .hero-visual { min-height: 300px; }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 560px) {
  .brand-wrap span { display: none; }
  .brand-logo { width: 50px; height: 50px; }
  .header-eu-logo { max-width: 320px; }
  .header-partner { width: 56px; height: 44px; }
  .header-partner img { max-width: 44px; max-height: 32px; }
  .hero-copy h1,
  h1 { font-size: 36px; }
  .lead { font-size: 18px; }
  .feature-grid { grid-template-columns: 1fr; }
  .chapter-actions,
  .quiz-actions { flex-direction: column-reverse; }
  .chapter-actions button,
  .quiz-actions button,
  .result-actions button { width: 100%; }
  .hero-visual { min-height: 240px; }
  .main-content { padding: 28px 16px; }
  .answer-option { grid-template-columns: 36px 1fr; padding: 14px; }
  .result-actions { flex-direction: column; }
  .partner-logo-card { min-width: calc(50% - 6px); }
  .partner-logo-card img { max-width: 92px; }
  .tooltip-logo::after { white-space: normal; width: max-content; max-width: 160px; text-align: center; }
}


/* Header tooltips open downward so they are never clipped by the top edge. */
.site-header,
.header-main,
.header-funding,
.header-partners-row,
.header-partner { overflow: visible; }
.header-partner.tooltip-logo::after {
  top: calc(100% + 10px);
  bottom: auto;
  transform: translateX(-50%) translateY(-6px);
  z-index: 1000;
}
.header-partner.tooltip-logo::before {
  top: calc(100% + 4px);
  bottom: auto;
  transform: translateX(-50%) translateY(-6px);
  border-width: 0 6px 6px 6px;
  border-color: transparent transparent rgba(24, 35, 31, .96) transparent;
  z-index: 1000;
}
.header-partner.tooltip-logo:hover::after,
.header-partner.tooltip-logo:hover::before,
.header-partner.tooltip-logo:focus-within::after,
.header-partner.tooltip-logo:focus-within::before {
  transform: translateX(-50%) translateY(0);
}

/* Improved compact mobile header and footer logo layout */
@media (max-width: 700px) {
  .site-header {
    position: relative;
    padding: 10px 12px 12px;
  }
  .header-main {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
  }
  .brand-wrap {
    min-width: 0;
  }
  .brand-wrap strong {
    font-size: 16px;
  }
  .menu-btn {
    display: block;
    align-self: center;
  }
  .header-funding {
    grid-column: 1 / -1;
    display: block;
    width: 100%;
    margin-top: 6px;
  }
  .header-eu-wrap {
    width: 100%;
    justify-content: center;
    padding: 4px 0 8px;
  }
  .header-eu-logo {
    width: min(100%, 300px);
    max-height: 58px;
  }
  .header-partners-row {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(48px, 1fr));
    gap: 6px;
    justify-content: stretch;
  }
  .header-partner {
    width: 100%;
    height: 50px;
    min-width: 0;
    padding: 4px;
  }
  .header-partner img {
    max-width: 44px;
    max-height: 36px;
  }
  .header-partner-portrait img {
    max-width: 38px;
    max-height: 38px;
  }
  .sidebar {
    top: 0;
    z-index: 50;
  }
  .main-content {
    padding-top: 24px;
  }
  .hero-course-logo {
    width: 128px;
    margin: 0 auto;
  }
  .hero-course-brand {
    text-align: center;
  }
  .intro-eu-logo {
    max-width: 100%;
  }
  .partner-logos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .partner-logo-card {
    width: 100%;
    min-width: 0;
    min-height: 82px;
  }
  .footer-publicity {
    justify-content: center;
  }
  .footer-eu-logo {
    max-width: 320px;
    width: 100%;
  }
  .footer-label,
  .footer-note {
    text-align: center;
  }
  .footer-note br {
    display: none;
  }
}

@media (max-width: 390px) {
  .header-partners-row {
    grid-template-columns: repeat(3, minmax(52px, 1fr));
  }
  .partner-logos {
    grid-template-columns: 1fr;
  }
}

/* v10 compact page heights: no forced empty scrolling on welcome, quiz or result views */
.app-shell {
  min-height: 0;
}
.main-content {
  padding-top: 34px;
  padding-bottom: 34px;
}
.hero-view {
  min-height: 0;
  padding-top: 12px;
  padding-bottom: 12px;
}
.narrow-view,
.result-view,
#chapterView {
  min-height: 0;
}
#quizIntroView,
#quizView,
#resultView {
  padding-top: 8px;
  padding-bottom: 8px;
}
.quiz-question {
  margin-top: 24px;
}
.answer-list {
  margin-top: 20px;
  margin-bottom: 20px;
}
.quiz-actions,
.result-actions {
  margin-top: 24px;
}
.course-footer {
  margin-top: 0;
}

@media (max-width: 900px) {
  .main-content {
    padding-top: 24px;
    padding-bottom: 24px;
  }
  .hero-view {
    gap: 28px;
  }
}

@media (max-width: 700px) {
  .main-content {
    padding-top: 18px;
    padding-bottom: 18px;
  }
  .hero-view {
    padding-top: 0;
    padding-bottom: 0;
    gap: 22px;
  }
  #quizIntroView,
  #quizView,
  #resultView {
    padding-top: 0;
    padding-bottom: 0;
  }
  .quiz-question {
    margin-top: 20px;
  }
}
