:root {
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --paper: #ffffff;
  --background: #f7f8fc;
  --blue: #3457d5;
  --blue-dark: #2947b8;
  --blue-pale: #eef2ff;
  --green: #168461;
  --green-pale: #e9f8f2;
  --amber: #a75d09;
  --amber-pale: #fff7e8;
  --red: #bd3b47;
  --shadow: 0 10px 28px rgba(28, 42, 76, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--background);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button { font: inherit; }

.site-header {
  height: 72px;
  padding: 0 max(24px, calc((100% - 1160px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 750; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--blue); color: white; }
.header-actions { display: flex; align-items: center; gap: 20px; }
.projects-link { color: var(--muted); font-size: 13px; font-weight: 700; text-decoration: none; }
.projects-link:hover, .projects-link:focus-visible { color: var(--blue); }
.header-score { color: var(--muted); font-size: 14px; }
.header-score span { color: var(--ink); font-weight: 750; }

#catalogue-view, .practice-view { width: min(1160px, calc(100% - 40px)); margin: 0 auto; }

.hero { display: grid; grid-template-columns: 1fr 390px; gap: 54px; padding: 66px 0 54px; align-items: center; }
.eyebrow { margin: 0 0 10px; color: var(--blue); font-weight: 750; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
.hero h1 { margin-bottom: 16px; max-width: 700px; font-size: clamp(36px, 5vw, 54px); line-height: 1.06; letter-spacing: -.04em; }
.hero-copy { margin-bottom: 0; max-width: 650px; color: var(--muted); font-size: 18px; line-height: 1.6; }

.progress-panel { padding: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.plan-primary { display: flex; align-items: baseline; gap: 8px; }
.plan-primary strong { color: var(--amber); font-size: 38px; line-height: 1; }
.plan-primary span { font-weight: 750; }
.evaluation-overview { margin-top: 12px !important; }
.evaluation-overview strong:first-child { color: var(--green); }
.practice-overview { margin-top: 7px !important; }
.progress-number { display: flex; align-items: baseline; gap: 8px; }
.progress-number strong { font-size: 32px; }
.progress-number span, .progress-panel p { color: var(--muted); font-size: 14px; }
.progress-track { height: 8px; margin: 16px 0 12px; overflow: hidden; background: #e9edf5; border-radius: 99px; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--blue); border-radius: inherit; transition: width .3s ease; }
.progress-panel p { margin: 0; }
.reset-button { padding: 7px 10px; border: 1px solid #e6b8bd; border-radius: 8px; color: var(--red); background: white; font-size: 12px; font-weight: 700; cursor: pointer; }
.reset-button:hover:not(:disabled) { border-color: var(--red); background: #fff1f2; }
.reset-button:disabled { opacity: .45; cursor: not-allowed; }
.reset-all { margin-top: 16px; }

.catalogue-heading { display: flex; justify-content: space-between; align-items: end; padding-bottom: 20px; }
.catalogue-heading h2 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.catalogue-tools { display: grid; justify-items: end; gap: 12px; }
.skill-filter { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.skill-filter button { padding: 7px 12px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 750; cursor: pointer; }
.skill-filter button.active { color: var(--blue); background: var(--blue-pale); }
.skill-filter span { display: inline-grid; min-width: 19px; height: 19px; margin-left: 4px; place-items: center; border-radius: 99px; color: white; background: var(--blue); font-size: 10px; }
.legend { display: flex; gap: 18px; color: var(--muted); font-size: 13px; }
.legend span { display: flex; gap: 7px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.active { background: var(--green); }
.dot.inactive { background: #aeb7c6; }

.topic-list { display: grid; gap: 16px; padding-bottom: 72px; }
.topic-section { overflow: hidden; content-visibility: auto; contain-intrinsic-size: auto 420px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 3px 14px rgba(28, 42, 76, .04); }
.topic-header { width: 100%; min-height: 84px; padding: 18px 22px; border: 0; display: grid; grid-template-columns: 46px 1fr auto 24px; gap: 14px; align-items: center; text-align: left; color: inherit; background: transparent; cursor: pointer; }
.topic-header:hover { background: #fbfcff; }
.topic-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--topic-pale); color: var(--topic-color); font-weight: 800; }
.topic-heading { display: grid; gap: 4px; }
.topic-heading strong { font-size: 17px; }
.topic-heading small { color: var(--muted); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; max-width: 700px; }
.topic-count { padding: 6px 10px; border-radius: 99px; color: var(--muted); background: #f1f4f8; font-size: 12px; font-weight: 700; }
.chevron { color: var(--muted); transition: transform .2s; }
.topic-header[aria-expanded="false"] .chevron { transform: rotate(180deg); }
.topic-header[aria-expanded="false"] + .topic-content { display: none; }

.topic-dashboard { margin: 0 22px 16px 82px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.topic-workflow-card { min-height: 168px; padding: 18px; display: flex; flex-direction: column; align-items: start; border: 1px solid var(--line); border-radius: 13px; background: #fafbfe; }
.topic-workflow-card.assessment-step { border-color: #bdc9f5; background: var(--blue-pale); }
.topic-workflow-card.practice-step { border-color: #d9dee8; background: white; }
.step-label { margin-bottom: 7px; color: var(--blue); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.topic-workflow-card h3 { margin: 0 0 7px; font-size: 17px; }
.topic-workflow-card > p:not(.step-label) { margin-bottom: 14px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.topic-test-button, .topic-practice-button { margin-top: auto; padding: 9px 12px; border: 0; border-radius: 8px; color: white; background: var(--blue); font-size: 12px; font-weight: 800; cursor: pointer; }
.topic-test-button:hover:not(:disabled) { background: var(--blue-dark); }
.topic-practice-button { background: var(--green); }
.topic-practice-button:hover:not(:disabled) { background: #116d50; }
.topic-test-button:disabled, .topic-practice-button:disabled { opacity: .45; cursor: not-allowed; }

.exercise-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 4px 22px 22px 82px; }
.exercise-card { width: 100%; min-height: 126px; padding: 18px; position: relative; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); text-align: left; }
.exercise-card.available { border-color: #bfcaf5; background: linear-gradient(145deg, white, #f7f8ff); }
.exercise-card.available:hover { transform: translateY(-2px); border-color: var(--blue); box-shadow: 0 8px 20px rgba(52, 87, 213, .10); }
.exercise-card.inactive { color: #7d8796; background: #fafbfc; }
.exercise-card h3 { margin: 8px 34px 7px 0; font-size: 16px; }
.exercise-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.card-progress { margin-top: 15px; }
.card-progress-label { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.card-progress-track, .skill-progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: #e6eaf2; }
.card-progress-track span, .skill-progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--blue); transition: width .3s ease; }
.exercise-card.completed .card-progress-track span { background: var(--green); }
.exercise-card.todo { border-color: #e7b35f; box-shadow: inset 4px 0 #d58b1d; }
.exercise-card.known { border-color: #8dd5bd; box-shadow: inset 4px 0 var(--green); }
.status { display: inline-flex; padding: 4px 8px; border-radius: 99px; font-size: 11px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.status.not_attempted { color: var(--blue); background: var(--blue-pale); }
.status.in_progress { color: var(--amber); background: var(--amber-pale); }
.status.done, .status.mastered { color: var(--green); background: var(--green-pale); }
.status.inactive { color: #778190; background: #edf0f4; }
.card-arrow, .lock { position: absolute; right: 18px; top: 18px; color: var(--blue); font-weight: 800; }
.lock { color: #a2abb7; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.card-action { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: white; font-size: 12px; font-weight: 750; cursor: pointer; }
.card-action:hover { color: var(--blue); border-color: var(--blue); }
.card-action.practice { color: white; border-color: var(--blue); background: var(--blue); }
.card-action.practice:hover { color: white; background: var(--blue-dark); }
.card-action.reset { color: var(--red); border-color: #e6b8bd; }
.card-action.reset:hover:not(:disabled) { color: var(--red); border-color: var(--red); background: #fff1f2; }
.card-action.todo-action.selected { color: #8a4c05; border-color: #e7b35f; background: var(--amber-pale); }
.card-action.known-action.selected { color: var(--green); border-color: #8dd5bd; background: var(--green-pale); }
.card-action:disabled { opacity: .45; cursor: not-allowed; }

.practice-view { padding: 40px 0 80px; }
.back-button { padding: 8px 0; color: var(--muted); background: none; border: 0; cursor: pointer; }
.back-button:hover { color: var(--blue); }
.practice-shell { --difficulty-color: var(--green); width: min(720px, 100%); margin: 30px auto; }
.practice-meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 14px; }
.practice-context { display: flex; align-items: center; gap: 10px; }
.topic-pill { padding: 6px 10px; border-radius: 99px; color: var(--difficulty-color); background: color-mix(in srgb, var(--difficulty-color) 11%, white); font-weight: 700; }
.difficulty-indicator { display: flex; gap: 4px; align-items: end; height: 18px; }
.difficulty-indicator i { display: block; width: 6px; border-radius: 4px; background: #dce1e9; }
.difficulty-indicator i:nth-child(1) { height: 7px; }
.difficulty-indicator i:nth-child(2) { height: 11px; }
.difficulty-indicator i:nth-child(3) { height: 16px; }
.difficulty-indicator[data-level="easy"] i:nth-child(1),
.difficulty-indicator[data-level="medium"] i:nth-child(-n+2),
.difficulty-indicator[data-level="hard"] i { background: var(--difficulty-color); }
.practice-shell[data-difficulty="easy"] { --difficulty-color: #168461; }
.practice-shell[data-difficulty="medium"] { --difficulty-color: #c06a18; }
.practice-shell[data-difficulty="hard"] { --difficulty-color: #8b4abb; }
.practice-shell > h1 { margin: 14px 0 24px; font-size: 36px; letter-spacing: -.03em; }
.skill-progress { margin: -8px 0 24px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.skill-progress-label { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 14px; }
.skill-progress-label span { color: var(--muted); }
.skill-progress-track { height: 10px; }
.skill-progress-track span { width: 0; background: var(--difficulty-color); }
.question-card { padding: clamp(24px, 5vw, 42px); background: white; border: 1px solid var(--line); border-top: 4px solid var(--difficulty-color); border-radius: 22px; box-shadow: var(--shadow); }
.question-label { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.question-card h2 { margin: 10px 0 28px; font-size: clamp(23px, 4vw, 31px); line-height: 1.35; }
.question-visual { margin: -4px 0 28px; padding: 16px 12px 8px; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fbfcff; }
.question-visual svg { display: block; width: 100%; min-width: 480px; height: auto; }
.visual-table { width: 100%; border-collapse: collapse; color: var(--ink); background: white; }
.visual-table th, .visual-table td { padding: 10px 12px; border: 1px solid #cfd7e5; text-align: center; }
.visual-table th { color: #263758; background: #eef2ff; font-weight: 800; }
.pictogram { display: grid; gap: 10px; padding: 4px 8px; }
.pictogram-row { display: grid; grid-template-columns: minmax(90px, 1fr) 3fr; align-items: center; gap: 14px; }
.pictogram-row span { color: var(--blue); font-size: 23px; letter-spacing: 5px; }
.pictogram-key { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.answer-options { display: grid; gap: 10px; }
.answer-button { width: 100%; padding: 15px 17px; display: flex; align-items: center; gap: 14px; text-align: left; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: white; cursor: pointer; }
.answer-button:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-pale); }
.answer-letter { display: grid; flex: 0 0 30px; height: 30px; place-items: center; border-radius: 8px; background: #f0f3f8; font-weight: 800; font-size: 13px; }
.answer-button.correct { border-color: var(--green); background: var(--green-pale); }
.answer-button.wrong { border-color: var(--red); background: #fff1f2; }
.feedback { margin-top: 20px; padding: 14px 16px; border-radius: 11px; font-weight: 700; }
.feedback.correct { color: var(--green); background: var(--green-pale); }
.feedback.wrong { color: var(--red); background: #fff1f2; }
.primary-button { width: 100%; margin-top: 14px; padding: 15px; border: 0; border-radius: 11px; color: white; background: var(--blue); font-weight: 800; cursor: pointer; }
.primary-button:hover { background: var(--blue-dark); }
.secondary-button, .text-button { border: 1px solid var(--line); color: var(--muted); background: white; font-weight: 750; cursor: pointer; }
.secondary-button { width: 100%; margin-top: 14px; padding: 14px; border-radius: 11px; }
.secondary-button:hover, .text-button:hover { color: var(--blue); border-color: var(--blue); }
.text-button { padding: 7px 9px; border-radius: 8px; font-size: 12px; }
.diagnostic-test-header { margin: 14px 0 8px; display: flex; justify-content: space-between; align-items: end; }
.diagnostic-test-header h1 { margin: 0; font-size: 34px; }
.diagnostic-test-header > strong { color: var(--muted); font-size: 14px; }
.diagnostic-progress { margin: 16px 0 10px; }
.diagnostic-section-meta { margin-bottom: 22px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; }
.diagnostic-evaluation { margin-top: 18px; padding: 13px 15px; display: flex; flex-wrap: wrap; gap: 10px 18px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: #fafbfc; }
.diagnostic-evaluation legend { padding: 0 5px; color: var(--ink); font-size: 12px; font-weight: 800; }
.diagnostic-evaluation label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.diagnostic-evaluation input { accent-color: var(--blue); }
.diagnostic-question-actions .primary-button { margin-top: 14px; }
.diagnostic-complete { padding: 42px; text-align: center; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: var(--shadow); }
.diagnostic-complete p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.error, .loading, .empty-filter { padding: 30px; color: var(--muted); text-align: center; }
.empty-filter { border: 1px dashed #cbd4e2; border-radius: 14px; background: white; }

.archetype-dialog { width: min(720px, calc(100% - 28px)); max-height: min(760px, calc(100vh - 40px)); padding: 0; color: var(--ink); border: 0; border-radius: 20px; box-shadow: 0 24px 80px rgba(16, 24, 40, .25); }
.archetype-dialog::backdrop { background: rgba(20, 29, 48, .55); backdrop-filter: blur(3px); }
.dialog-header { padding: 26px 28px 22px; display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin-bottom: 7px; font-size: 26px; }
.dialog-header p:last-child { margin: 0; color: var(--muted); }
.close-button { flex: 0 0 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: white; font-size: 25px; line-height: 1; cursor: pointer; }
.archetype-list { padding: 20px 28px 28px; display: grid; gap: 12px; overflow-y: auto; }
.archetype-item { padding: 17px; border: 1px solid var(--line); border-radius: 13px; }
.archetype-item-header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.archetype-item h3 { margin: 0 0 7px; font-size: 16px; }
.archetype-item p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.archetype-meta { margin-top: 13px; display: flex; flex-wrap: wrap; gap: 6px; }
.meta-badge { padding: 4px 7px; border-radius: 7px; color: var(--muted); background: #f0f3f7; font-size: 11px; font-weight: 750; }
.meta-badge.ready { color: var(--green); background: var(--green-pale); }
.try-type { flex: 0 0 auto; padding: 8px 10px; border: 0; border-radius: 8px; color: white; background: var(--blue); font-size: 12px; font-weight: 750; cursor: pointer; }
.try-type:hover { background: var(--blue-dark); }

@media (max-width: 760px) {
  .site-header { height: 64px; padding: 0 20px; }
  .header-actions { gap: 12px; }
  .projects-link { font-size: 12px; }
  #catalogue-view, .practice-view { width: min(100% - 28px, 1160px); }
  .hero { grid-template-columns: 1fr; gap: 28px; padding: 44px 0; }
  .catalogue-heading { display: block; }
  .catalogue-tools { margin-top: 16px; justify-items: start; }
  .legend { margin-top: 16px; }
  .topic-header { grid-template-columns: 44px 1fr 20px; padding: 16px; }
  .topic-heading small, .topic-count { display: none; }
  .exercise-grid { grid-template-columns: 1fr; padding: 2px 14px 16px; }
  .topic-dashboard { margin: 0 14px 14px; grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
