:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #d9e2ec;
  --accent: #0d6b75;
  --accent-2: #1f5eff;
  --dark: #101f2b;
  --soft: #e9f7f8;
  --good: #0f7a45;
  --bad: #b42318;
  --shadow: 0 12px 34px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

body.protected,
body.protected * {
  user-select: none;
}

button,
input,
a {
  font: inherit;
}

.watermark {
  position: fixed;
  right: 24px;
  bottom: 16px;
  color: rgba(13, 107, 117, 0.14);
  font-weight: 800;
  pointer-events: none;
  z-index: 50;
}

.app-shell {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--dark);
  color: #f8fbff;
  padding: 22px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #d7fc70;
  color: #0f2530;
  font-weight: 900;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand p {
  color: #b7c6d1;
  margin-top: 3px;
  font-size: 13px;
}

.access-card,
.toggle-row {
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.access-card span {
  display: block;
  color: #b7c6d1;
  margin-top: 3px;
  font-size: 13px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chapter-nav {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.chapter-btn {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e5f1f8;
  background: transparent;
  border-radius: 8px;
  padding: 10px 11px;
  cursor: pointer;
}

.chapter-btn.active,
.chapter-btn:hover {
  color: #0f2530;
  background: #f8fbff;
}

.chapter-btn small {
  display: block;
  margin-top: 4px;
  opacity: 0.72;
}

.main {
  padding: 24px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 850;
}

h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

#searchBox {
  width: min(430px, 40vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.primary-btn,
.secondary-btn,
.support-btn,
.tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.support-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: #ffffff;
  color: var(--accent);
  font-weight: 750;
  white-space: nowrap;
}

.primary-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 750;
}

.compact {
  padding: 8px 10px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.tab.active {
  color: #ffffff;
  border-color: var(--dark);
  background: var(--dark);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat,
.content-panel,
.card,
.term-card,
.question-card,
.objective-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat {
  padding: 14px;
}

.stat strong {
  display: block;
  font-size: 24px;
}

.stat span,
.muted {
  color: var(--muted);
}

.content-panel {
  padding: 18px;
  min-height: 540px;
}

.customer-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  margin-top: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.customer-help span {
  color: var(--muted);
  margin-left: 6px;
}

.help-actions,
.gate-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 16px;
}

.note-box,
.tutorial-box {
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.note-box {
  background: var(--soft);
  border: 1px solid #cfe9ec;
}

.tutorial-box {
  background: #fff8e6;
  border: 1px solid #f1d282;
}

.term-card,
.question-card,
.objective-card,
.card {
  padding: 14px;
  margin-bottom: 12px;
}

.section-title {
  margin: 0 0 10px;
  font-size: 18px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef3f8;
  color: #294256;
  font-size: 12px;
  font-weight: 700;
}

.flashcard {
  width: 100%;
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
  padding: 24px;
  cursor: pointer;
}

.flashcard strong {
  display: block;
  font-size: 30px;
  margin-bottom: 10px;
}

.answer-option,
.match-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  margin: 8px 0;
  cursor: pointer;
}

.answer-option.correct,
.match-item.matched {
  border-color: #74c69d;
  background: #e9fbf1;
}

.answer-option.wrong {
  border-color: #f2aaa5;
  background: #fff1f0;
}

.answer-option.selected {
  border-color: var(--accent-2);
  background: #eef4ff;
}

.exam-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.exam-card,
.score-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  box-shadow: var(--shadow);
}

.exam-card h3,
.score-box h3 {
  margin: 0 0 8px;
}

.exam-header,
.exam-nav,
.exam-meta {
  display: flex;
  gap: 10px;
  align-items: center;
}

.exam-header {
  justify-content: space-between;
  margin-bottom: 12px;
}

.exam-nav {
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.exam-meta {
  color: var(--muted);
  flex-wrap: wrap;
}

.score-box {
  margin-bottom: 12px;
}

.score-box strong {
  display: block;
  font-size: 42px;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.match-item.selected {
  border-color: var(--accent-2);
  background: #eef4ff;
}

.feedback {
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  background: #eef3f8;
}

.fill-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.fill-actions input {
  min-width: 220px;
}

.attempt-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  background: #fff;
}

.attempt-box ol {
  margin: 8px 0 0 20px;
  padding: 0;
}

.progress-bar {
  height: 10px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
}

.gate {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(16, 31, 43, 0.72);
  z-index: 100;
  padding: 20px;
}

.gate.locked {
  display: grid;
}

.gate-panel {
  width: min(520px, 100%);
  background: #ffffff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.gate-links {
  margin-top: 14px;
}

.gate-links a,
.link-btn,
.info-panel a {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-weight: 750;
  padding: 0;
  text-decoration: underline;
}

.fineprint {
  color: var(--muted);
  font-size: 13px;
}

.info-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(16, 31, 43, 0.72);
  z-index: 120;
  padding: 20px;
}

.info-modal[hidden] {
  display: none;
}

.info-panel {
  width: min(760px, 100%);
  max-height: min(760px, 90vh);
  overflow: auto;
  background: #ffffff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.info-close {
  float: right;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
  cursor: pointer;
}

.policy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.policy-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

@media (max-width: 980px) {
  .app-shell,
  .stats-grid,
  .grid-2,
  .exam-grid,
  .match-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .top-actions,
  .customer-help {
    align-items: stretch;
    flex-direction: column;
  }

  #searchBox {
    width: 100%;
  }

  .policy-grid {
    grid-template-columns: 1fr;
  }
}
