:root {
  --ink: #1c2740;
  --muted: #5c677a;
  --line: #d7dee8;
  --teal: #0e7c73;
  --teal-dark: #0a5e57;
  --paper: #f4f7f8;
  --card: #fff;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Sen", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
a { color: var(--teal-dark); }
.container { width: min(1100px, calc(100% - 32px)); margin: 0 auto; }
.brand-bar { background: #fff; border-bottom: 1px solid var(--line); }
.brand-bar-inner { display: flex; align-items: center; gap: 20px; min-height: 72px; }
.brand-logo { height: 36px; width: auto; }
.brand-tagline { margin: 0; line-height: 1.25; }
.brand-tagline span { display: block; color: var(--muted); font-size: 0.9rem; }
.user-chip { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: #d7ecea; color: var(--teal-dark);
  display: grid; place-items: center; font-weight: 700; overflow: hidden; position: relative;
}
.user-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.user-meta { display: flex; flex-direction: column; font-size: 0.85rem; }
.user-meta span { color: var(--muted); }

#auth-screen.is-gate {
  min-height: 100vh; display: grid; place-items: center; background: var(--paper);
}
#auth-screen.is-landing { display: block; }
#auth-message { margin: 0; text-align: center; padding: 24px; }
.landing-hero { background: #12324d; color: #fff; padding: 48px 0; }
.landing-hero h1 { margin: 0 0 12px; font-size: clamp(1.6rem, 3vw, 2.2rem); max-width: 40rem; }
.grant, .landing-note { color: #c9d6e2; }
.landing-cta, .btn {
  display: inline-block; background: var(--teal); color: #fff; text-decoration: none;
  border: 0; border-radius: 6px; padding: 12px 18px; font: inherit; font-weight: 700; cursor: pointer;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--teal-dark); border: 1px solid var(--teal); }
.landing-facts, .landing-main { padding: 28px 0; }
.fact-grid, .split { display: grid; gap: 16px; }
@media (min-width: 800px) {
  .fact-grid { grid-template-columns: 1fr 1fr 1fr; }
  .split { grid-template-columns: 1.4fr 0.8fr; }
}
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.landing-footer { padding: 24px 0 40px; color: var(--muted); font-size: 0.9rem; }

.hero { background: #12324d; color: #fff; padding: 28px 0 18px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(1.4rem, 2.4vw, 2rem); }
.hero p { margin: 0; max-width: 46rem; color: #d5e2ec; }
.nav-wrap { margin-top: 18px; }
.nav-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: inline-block; background: rgba(255,255,255,0.12); color: #fff; text-decoration: none;
  border-radius: 999px; padding: 8px 12px; font-size: 0.9rem;
}
.nav-list a.active { background: #fff; color: #12324d; }
.nav-list a.is-locked { opacity: 0.45; pointer-events: none; }
.menu-toggle { display: none; }

main { padding: 24px 0 64px; }
.view h2 { margin-top: 0; }
.q { margin: 0 0 18px; }
.q legend { font-weight: 700; margin-bottom: 8px; }
.q label { display: block; margin: 6px 0; }
.status { min-height: 1.4em; color: var(--teal-dark); font-weight: 700; }
.mark-correct { outline: 2px solid var(--teal); border-radius: 4px; }
.frame-wrap { background: #000; border-radius: 10px; overflow: hidden; height: min(78vh, 760px); }
.frame-wrap iframe { width: 100%; height: 100%; border: 0; background: #111; }
.pdf-frame { width: 100%; height: min(78vh, 820px); border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }

.certificate {
  background: #fff; border: 8px solid #12324d; padding: 28px 32px 24px; max-width: 860px;
}
.cert-logos { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cert-logos img { height: 54px; width: auto; object-fit: contain; }
.certificate h2 { text-align: center; letter-spacing: 0.08em; font-size: 1.1rem; margin: 22px 0 8px; }
.certificate .who { text-align: center; font-size: 1.7rem; margin: 8px 0; }
.certificate .activity { text-align: center; font-size: 1.25rem; font-weight: 700; }
.certificate p { text-align: center; }
.cert-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 18px; text-align: left; }
.cert-foot p { text-align: left; font-size: 0.82rem; color: var(--muted); max-width: 34rem; }
@media print {
  .brand-bar, .hero, .no-print { display: none !important; }
  body { background: #fff; }
  .certificate { border-width: 6px; }
}

/* Landing: mirrors the Nexus HE course overview layout */
#landing { --nx: #5dad8e; --nx-dark: #499176; background: #fff; font-family: Bahnschrift, "Sen", "Segoe UI", sans-serif; color: #000; }
.nx-hero { padding: 32px 0 8px; }
.nx-card { display: grid; gap: 32px; background: rgba(205, 227, 187, 0.12); border-radius: 12px; padding: 40px; }
@media (min-width: 900px) { .nx-card { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.6fr); } }
.nx-thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; background: #e5efe0; }
.nx-tags { display: flex; flex-wrap: wrap; gap: 12px; }
.nx-tags span { background: rgba(73, 145, 118, 0.08); color: var(--nx-dark); border-radius: 999px; padding: 4px 10px; font-size: 0.8rem; }
.nx-info h1 { color: var(--nx-dark); font-weight: 300; font-size: clamp(1.6rem, 2.6vw, 2.15rem); line-height: 1.25; margin: 20px 0; }
.nx-meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px 16px; margin: 0 0 20px; font-size: 0.95rem; }
.nx-meta dt { font-weight: 600; }
.nx-meta dd { margin: 0; }
.nx-authors { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: #fff; border: 1px solid #e3e8e5; border-radius: 6px; padding: 14px 20px; }
.nx-avatars { display: flex; }
.nx-avatars img, .nx-avatars span { width: 44px; height: 44px; border-radius: 50%; border: 2px solid #fff; object-fit: cover; margin-right: -8px; background: #f0f2f1; display: grid; place-items: center; font-size: 0.8rem; color: #777; }
.nx-authors strong { margin-left: 12px; font-weight: 500; }
.nx-authors a { margin-left: auto; color: var(--nx); text-decoration: none; }
.nx-start { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
.nx-start p { margin: 0; color: #5c677a; font-size: 0.85rem; }
.nx-btn { display: inline-block; background: var(--nx); color: #fff; text-decoration: none; border-radius: 4px; padding: 10px 22px; font-weight: 600; font-size: 0.9rem; }
.nx-btn:hover { background: var(--nx-dark); }
.nx-tabs { display: grid; grid-template-columns: 1fr 1fr; margin: 48px 0 32px; border-bottom: 2px solid #e5e5e5; }
.nx-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -2px; padding: 14px; font: inherit; font-size: 0.95rem; cursor: pointer; color: #000; }
.nx-tabs button[aria-selected="true"] { border-bottom-color: var(--nx); }
.nx-overview { display: grid; gap: 32px; padding-bottom: 40px; }
@media (min-width: 900px) { .nx-overview { grid-template-columns: 220px minmax(0, 1fr); } }
.nx-side { display: none; }
@media (min-width: 900px) {
  .nx-side { display: flex; flex-direction: column; gap: 22px; position: sticky; top: 24px; align-self: start; padding-top: 8px; }
  .nx-side a { color: #000; text-decoration: none; font-size: 0.95rem; }
  .nx-side a:hover { color: var(--nx-dark); }
}
.nx-content h2 { font-weight: 400; font-size: 1.6rem; margin: 40px 0 16px; scroll-margin-top: 24px; }
.nx-content h2:first-child { margin-top: 0; }
.nx-content h3 { font-weight: 500; font-size: 1.1rem; margin: 24px 0 8px; }
.nx-content p, .nx-content li { line-height: 1.7; }
.nx-content a { color: var(--nx-dark); }
.nx-counts { display: flex; flex-wrap: wrap; gap: 32px; margin-bottom: 24px; }
.nx-counts div { display: flex; align-items: baseline; gap: 8px; }
.nx-counts strong { color: var(--nx-dark); font-size: 1.6rem; font-weight: 400; }
.nx-sections { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 16px; }
.nx-sections li { border: 1px solid #e3e8e5; border-radius: 10px; padding: 20px 24px; }
.nx-sections h3 { margin: 0 0 8px; font-weight: 500; font-size: 1.1rem; }
.nx-sections p { margin: 0 0 8px; line-height: 1.6; }
.nx-sections .nx-sub { margin: 0; color: var(--nx-dark); font-size: 0.85rem; }
@media (max-width: 600px) { .nx-card { padding: 20px; } .nx-meta { grid-template-columns: 1fr; } .nx-meta dd { margin-bottom: 6px; } }
.nx-side a { display: block; padding: 10px 24px; margin: -10px -24px; border-radius: 6px; border: 2px solid transparent; transition: border-color 0.2s, color 0.2s; }
.nx-side a.active { border-color: var(--nx); box-shadow: inset -4px 0 0 var(--nx); }
.nx-link { margin-left: auto; background: none; border: 0; padding: 0; font: inherit; color: var(--nx); cursor: pointer; }
.nx-dialog { width: min(960px, calc(100% - 32px)); max-height: calc(100vh - 48px); border: 0; border-radius: 8px; padding: 24px; font-family: Bahnschrift, "Sen", "Segoe UI", sans-serif; color: #333; }
.nx-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.nx-dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.nx-dialog-head h2 { margin: 0; font-weight: 400; font-size: 1.4rem; }
.nx-close { width: 40px; height: 40px; border: 2px solid var(--nx); border-radius: 8px; background: #fff; font-size: 1.6rem; line-height: 1; color: #333; cursor: pointer; }
.nx-author { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 24px; align-items: center; border: 1px solid #d6e8c8; border-radius: 8px; padding: 12px 24px; margin-bottom: 16px; }
.nx-author img, .nx-initials { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: #eef3ef; display: grid; place-items: center; color: var(--nx-dark); font-size: 1.3rem; }
.nx-author h3 { margin: 0 0 6px; font-weight: 500; font-size: 1.1rem; }
.nx-author p { margin: 0; color: #8a8f99; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nx-author.is-open p { display: block; }
.nx-author > button { background: none; border: 0; font: inherit; font-size: 1.05rem; color: var(--nx); cursor: pointer; white-space: nowrap; }
@media (max-width: 600px) {
  .nx-author { grid-template-columns: 56px minmax(0, 1fr); padding: 12px; gap: 12px; }
  .nx-author img, .nx-initials { width: 56px; height: 56px; }
  .nx-author > button { grid-column: 2; justify-self: start; padding: 0; }
}
