:root {
  --blue: #1464f4;
  --blue-dark: #0d47c8;
  --green: #18a558;
  --green-dark: #0b7c42;
  --ink: #152238;
  --muted: #607083;
  --line: #e5eaf2;
  --bg: #f5f8fc;
  --white: #ffffff;
  --danger: #c9362b;
  --warning: #9a5c00;
  --shadow: 0 16px 48px rgba(35, 58, 89, 0.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, .primary-button, .secondary-outline, .primary-link { transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease; }
button:hover, .primary-button:hover, .secondary-outline:hover { transform: translateY(-1px); }
button:disabled { opacity: .6; cursor: wait; transform: none; }

header { position: sticky; top: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 20px 7%; background: rgba(255,255,255,.94); border-bottom: 1px solid rgba(229,234,242,.9); backdrop-filter: blur(14px); }
.logo { color: var(--blue); font-size: 25px; font-weight: 850; letter-spacing: -0.04em; text-decoration: none; white-space: nowrap; }
nav { display: flex; align-items: center; justify-content: flex-end; gap: 24px; flex-wrap: wrap; }
nav a { text-decoration: none; color: #304159; font-weight: 650; }
nav a[aria-current="page"] { color: var(--blue); }
.nav-button { border: 0; border-radius: 999px; padding: 10px 17px; background: #edf4ff; color: var(--blue); font-weight: 750; cursor: pointer; }

h1, h2, h3, p { margin-top: 0; }
h1 { letter-spacing: -0.045em; line-height: 1.03; }
p { color: var(--muted); line-height: 1.65; }
.eyebrow { display: inline-block; margin-bottom: 15px; color: var(--blue); font-size: 13px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }

.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr); align-items: center; gap: 70px; min-height: 620px; padding: 80px 8%; }
.hero-text h1 { max-width: 760px; margin-bottom: 24px; font-size: clamp(46px, 6vw, 76px); }
.hero-text p { max-width: 680px; margin-bottom: 32px; font-size: 20px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.primary-button, .secondary-outline { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 24px; border-radius: 16px; font-weight: 800; text-decoration: none; }
.primary-button { background: var(--blue); color: white; box-shadow: 0 10px 26px rgba(20,100,244,.22); }
.secondary-outline { background: white; border: 1px solid var(--line); color: var(--ink); }
.science-card { min-height: 360px; border-radius: 36px; background: linear-gradient(145deg, #fff, #eef5ff); box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr 1fr; place-items: center; font-size: 80px; overflow: hidden; }
.science-card span:first-child { transform: rotate(-8deg); }
.science-card span:last-child { transform: rotate(8deg); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 0 8% 90px; }
.card { background: white; padding: 30px; border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 10px 32px rgba(35,58,89,.05); }
.card h2 { margin-bottom: 12px; font-size: 22px; }
.card p { margin: 0; }

.auth-page { min-height: calc(100vh - 82px); display: grid; place-items: center; padding: 56px 20px; }
.auth-card { width: min(100%, 480px); padding: 40px; background: white; border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 10px; font-size: 42px; }
.auth-card > p { margin-bottom: 28px; }
.auth-card form, .admin-form, #profileEditForm { display: grid; gap: 12px; }
.field-label, .admin-form label, .filter-bar label { display: grid; gap: 8px; color: #33465f; font-size: 14px; font-weight: 780; }
input, select, textarea { width: 100%; border: 1px solid #d8e0eb; border-radius: 13px; background: white; color: var(--ink); padding: 13px 14px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #8eb7ff; box-shadow: 0 0 0 4px rgba(20,100,244,.08); }
textarea { resize: vertical; line-height: 1.55; }
.auth-card button, .admin-form button[type="submit"], #profileEditForm button, .inline-form button, .panel-toolbar > button, #taskAnswerForm button, #selfCheckForm button { border: 0; border-radius: 14px; padding: 14px 20px; background: var(--blue); color: white; font-weight: 800; cursor: pointer; }
.auth-card button { margin-top: 6px; width: 100%; }
.form-status { min-height: 24px; margin: 17px 0 0; font-size: 14px; line-height: 1.5; }
.error { color: #b42318 !important; }
.success { color: #087443 !important; }
.form-status.error, .page-status.error { color: #b42318; }
.form-status.success, .page-status.success { color: #087443; }
.divider { margin: 24px 0 14px; border-top: 1px solid var(--line); padding-top: 18px; text-align: center; color: #7a8796; font-size: 14px; }
.text-link { color: var(--blue); font-weight: 780; text-decoration: none; }
.auth-links { display: flex; justify-content: space-between; gap: 16px; margin-top: 22px; font-size: 14px; }

.catalog-page, .profile-page, .admin-page, .article-page, .task-page { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 90px; }
.catalog-hero { max-width: 760px; margin-bottom: 30px; }
.catalog-hero h1, .admin-heading h1 { margin-bottom: 15px; font-size: clamp(40px, 5vw, 58px); }
.catalog-hero p { font-size: 18px; }
.filter-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 28px; padding: 18px; background: white; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 8px 24px rgba(35,58,89,.04); }
.filter-bar.theory-filter { grid-template-columns: repeat(3, 1fr); }
.filter-bar select { padding: 10px 11px; }
.page-status { margin: 0 0 22px; padding: 14px 18px; background: white; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); }
.page-status:empty { display: none; }
.catalog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.catalog-card { min-height: 265px; display: flex; flex-direction: column; padding: 25px; background: white; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 8px 26px rgba(35,58,89,.05); }
.catalog-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #728096; font-size: 13px; }
.catalog-card h2 { margin: 22px 0 10px; font-size: 23px; }
.catalog-card p { margin-bottom: 20px; font-size: 15px; }
.catalog-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); color: #5f6e81; font-size: 13px; }
.stars { color: #e69b16; letter-spacing: 1px; }
.primary-link { margin-top: 18px; color: var(--blue); font-weight: 800; text-decoration: none; }
.subject-pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 999px; background: #edf8f2; color: var(--green-dark); font-size: 12px; font-weight: 850; }
.subject-pill.chemistry { background: #edf4ff; color: var(--blue-dark); }
.empty-panel { padding: 35px; border: 1px dashed #cdd6e2; border-radius: 20px; text-align: center; color: var(--muted); background: rgba(255,255,255,.55); }

.theory-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.theory-card { overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 8px 26px rgba(35,58,89,.05); }
.theory-card img, .theory-card-cover-empty { width: 100%; height: 200px; object-fit: cover; }
.theory-card-cover-empty { display:grid; place-items:center; background:linear-gradient(145deg, #eef6ff, #f0fbf5); color:#7c8798; font-size:14px; font-weight:800; text-align:center; padding:24px; }
.theory-card-cover-empty span { max-width: 180px; line-height: 1.45; }
.theory-card-body { padding: 23px; }
.theory-card-body h2 { margin: 19px 0 9px; font-size: 23px; }
.theory-card-body p { min-height: 48px; margin-bottom: 0; font-size: 15px; }

.article-page { width: min(900px, calc(100% - 40px)); }
.theory-article { background: white; border: 1px solid var(--line); border-radius: 28px; padding: clamp(24px, 5vw, 54px); box-shadow: var(--shadow); }
.article-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 24px; color: #718095; font-size: 13px; }
.theory-article h1 { margin-bottom: 18px; font-size: clamp(40px, 6vw, 62px); }
.article-lead { font-size: 20px; }
.article-cover, .content-image { display: block; width: 100%; max-height: 520px; object-fit: cover; margin: 30px 0; border-radius: 20px; }
.rich-text { color: #2f4057; font-size: 17px; line-height: 1.8; }
.rich-text p { color: inherit; font-size: inherit; line-height: inherit; margin: 0 0 20px; }
.article-body { margin-top: 38px; }

.task-heading { margin-bottom: 28px; }
.task-heading > div:first-child { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.task-heading h1 { margin: 20px 0 8px; font-size: clamp(38px, 5vw, 58px); }
.topic-line { margin-bottom: 0; font-weight: 700; }
.muted-inline { color: #718095; font-size: 13px; }
.content-card { margin-bottom: 22px; padding: 30px; background: white; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 8px 25px rgba(35,58,89,.045); }
.content-card h2 { margin-bottom: 20px; }
.content-card textarea { width: 100%; }
.wide-input { margin-bottom: 14px; }
.choice-list { display: grid; gap: 10px; margin-bottom: 18px; }
.choice-list label { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; }
.choice-list input { width: auto; margin-top: 3px; }
.prompt-note { padding: 13px 15px; background: #f3f7ff; border-radius: 12px; color: #33465f; }
.result-box { margin-top: 18px; padding: 16px 18px; border-radius: 14px; background: #eef4ff; color: #22456f; }
.result-box.success { background: #edf9f2; color: #07683a; }
.result-box.warning { background: #fff6e8; color: #82510a; }
.result-box a { color: var(--blue); font-weight: 800; }
.solution-card { border-color: #cfeadd; }
.criterion { padding: 18px 0; border-top: 1px solid var(--line); }
.criterion:first-of-type { border-top: 0; }
.criterion h3 { margin-bottom: 7px; }
.criterion p { margin-bottom: 12px; font-size: 14px; }
.score-options { display: flex; gap: 12px; flex-wrap: wrap; }
.score-options label { display: flex; gap: 6px; align-items: center; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; }
.score-options input { width: auto; }

.profile-header-card { display: flex; align-items: center; gap: 24px; padding: 30px; background: white; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.avatar { width: 88px; height: 88px; display: grid; place-items: center; border-radius: 24px; background: #edf4ff; font-size: 48px; }
.profile-identity h1 { margin: 7px 0; font-size: 44px; }
.profile-identity p { margin: 2px 0; font-size: 15px; }
.profile-role { display: inline-block; padding: 6px 10px; border-radius: 999px; background: #eaf8f0; color: var(--green-dark); font-size: 12px; font-weight: 800; }
.profile-email { color: var(--blue) !important; font-weight: 750; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 22px 0; }
.stat-card { padding: 24px; background: white; border: 1px solid var(--line); border-radius: 20px; text-align: center; }
.stat-card h2 { margin-bottom: 5px; font-size: 34px; }
.stat-card p { margin: 0; font-size: 14px; }
.profile-columns { display: grid; grid-template-columns: 1.25fr .75fr; gap: 20px; }
.progress-row + .progress-row { margin-top: 28px; }
.progress-heading { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.progress-heading h3 { margin: 0; }
.progress-heading span { color: var(--muted); font-size: 13px; }
.bar { height: 11px; margin-top: 12px; overflow: hidden; border-radius: 999px; background: #edf0f4; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; transition: width .35s ease; }
.progress-fill.biology { background: var(--green); }
.progress-fill.chemistry { background: var(--blue); }
.recent { margin-top: 28px; }
.recent-list { display: grid; gap: 12px; }
.recent-card { padding: 16px 18px; background: white; border: 1px solid var(--line); border-radius: 15px; }
.recent-link { display: grid; grid-template-columns: 1fr auto; gap: 5px 20px; text-decoration: none; }
.recent-link strong { font-size: 15px; }
.recent-link span { color: var(--muted); font-size: 13px; }
.recent-link b { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--blue); }

.admin-heading { display: flex; justify-content: space-between; gap: 40px; align-items: end; margin-bottom: 8px; }
.admin-heading p { max-width: 450px; }
.admin-stats { margin-top: 28px; }
.admin-tabs { display: flex; gap: 8px; margin: 30px 0 16px; padding: 6px; border-radius: 16px; background: #e9eef5; width: fit-content; }
.tab-button { border: 0; background: transparent; color: #506177; border-radius: 11px; padding: 11px 17px; font-weight: 800; cursor: pointer; }
.tab-button.active { background: white; color: var(--blue); box-shadow: 0 3px 12px rgba(35,58,89,.08); }
.admin-panel { padding: 26px; background: white; border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 8px 25px rgba(35,58,89,.04); }
.panel-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.panel-toolbar h2 { margin-bottom: 6px; }
.panel-toolbar p { margin: 0; font-size: 14px; }
.search-input { max-width: 420px; margin-bottom: 16px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 15px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 14px; }
th { background: #f8fafc; color: #66758a; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; margin-top: 3px; color: #7b8999; }
.table-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.small-button { border: 0; border-radius: 9px; padding: 8px 10px; background: #eaf2ff; color: var(--blue-dark); font-size: 12px; font-weight: 800; cursor: pointer; }
.small-button.ghost { background: #eef1f5; color: #4c5f75; }
.small-button.danger { background: #fff0ef; color: var(--danger); }
.status-chip { display: inline-block; padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 850; }
.status-chip.published { background: #eaf8f0; color: var(--green-dark); }
.status-chip.draft { background: #eef2f7; color: #596b80; }
.status-chip.archived { background: #fff1ed; color: #a83c25; }
.cover-ok { display:inline-block; margin-top:6px; color:#2f7b4f; font-size:12px; font-weight:800; }
.cover-missing { display:inline-block; margin-top:6px; color:#aa6a00; font-size:12px; font-weight:800; }
.editor-card { margin-top: 22px; padding: 26px; border: 1px solid #ccd8e8; border-radius: 20px; background: #fbfdff; }
.editor-title { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.editor-title h2 { margin: 0; }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #edf1f6; color: #47596e; font-size: 24px; cursor: pointer; }
.admin-form { gap: 16px; }
.admin-form label > small { color: #7c8897; font-weight: 500; line-height: 1.4; }
.form-grid { display: grid; gap: 12px; }
.form-grid.two { grid-template-columns: repeat(2, 1fr); }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid.four { grid-template-columns: repeat(4, 1fr); }
.subform { padding: 16px; border-radius: 14px; background: #f4f7fb; border: 1px solid #e3e9f1; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }
.secondary-action { border: 1px solid var(--line) !important; background: white !important; color: #465971 !important; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; max-width: 680px; }
.admin-user-result { margin-top: 18px; }
.admin-user-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; max-width: 680px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; }
.admin-user-card div { display: grid; gap: 4px; }
.admin-user-card span { color: var(--muted); font-size: 13px; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 60px; }
  .science-card { min-height: 260px; }
  .features, .catalog-grid, .theory-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { grid-template-columns: repeat(2, 1fr); }
  .profile-columns { grid-template-columns: 1fr; }
  .form-grid.four, .form-grid.three { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  header { position: static; align-items: flex-start; padding: 18px 20px; }
  .logo { font-size: 21px; }
  nav { gap: 10px 14px; font-size: 13px; }
  .hero { padding: 50px 20px; gap: 35px; }
  .hero-text h1 { font-size: 44px; }
  .science-card { min-height: 220px; font-size: 58px; }
  .features { grid-template-columns: 1fr; padding: 0 20px 60px; }
  .catalog-page, .profile-page, .admin-page, .article-page, .task-page { width: min(100% - 28px, 1180px); padding-top: 35px; }
  .catalog-grid, .theory-grid, .stats { grid-template-columns: 1fr; }
  .filter-bar, .filter-bar.theory-filter { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 22px; }
  .auth-card h1 { font-size: 36px; }
  .profile-header-card { align-items: flex-start; }
  .profile-identity h1 { font-size: 35px; }
  .recent-link { grid-template-columns: 1fr; }
  .recent-link b { grid-row: auto; grid-column: auto; }
  .admin-heading, .panel-toolbar, .admin-user-card { align-items: flex-start; flex-direction: column; }
  .admin-tabs { width: 100%; overflow-x: auto; }
  .form-grid.two, .form-grid.three, .form-grid.four, .inline-form { grid-template-columns: 1fr; }
  .admin-panel, .editor-card, .content-card { padding: 20px; }
}

/* Theory editor v2.1 */
.article-figure { margin: 30px 0; }
.article-figure img { display: block; width: 100%; border-radius: 20px; }
.article-figure .article-cover, .article-figure .content-image { margin: 0; }
.article-figure figcaption { margin-top: 10px; color: #748296; font-size: 13px; line-height: 1.5; text-align: center; }
.inline-figure { margin: 34px 0; }

.rich-text h2 { margin: 38px 0 14px; color: var(--ink); font-size: 30px; line-height: 1.2; letter-spacing: -0.025em; }
.rich-text h3 { margin: 30px 0 12px; color: var(--ink); font-size: 23px; line-height: 1.3; }
.rich-text ul { margin: 0 0 22px; padding-left: 24px; }
.rich-text li { margin: 7px 0; }
.rich-text blockquote { margin: 28px 0; padding: 18px 20px; border-left: 4px solid var(--blue); border-radius: 0 14px 14px 0; background: #f2f7ff; color: #29405d; }
.rich-text strong { color: #172b45; }
.theory-mark { padding: .08em .2em; border-radius: .3em; background: #fff0a8; color: inherit; }
.text-serif { font-family: Georgia, "Times New Roman", serif; font-size: 1.05em; }
.text-mono { padding: .08em .28em; border-radius: 6px; background: #f1f4f8; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .92em; }
.text-blue { color: var(--blue); }
.text-green { color: var(--green-dark); }
.text-red { color: var(--danger); }
.text-small { font-size: .88em; }

.image-field-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rich-editor-field { display: grid; gap: 9px; }
.field-heading-row, .inline-images-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; }
.field-heading-row > div, .inline-images-heading > div { display: grid; gap: 5px; color: #33465f; font-size: 14px; }
.field-heading-row small, .inline-images-heading small, .inline-images-section > small, .format-help { color: #7c8897; font-size: 12px; font-weight: 500; line-height: 1.45; }
.format-toolbar { display: flex; flex-wrap: wrap; gap: 7px; padding: 9px; border: 1px solid #d8e0eb; border-bottom: 0; border-radius: 13px 13px 0 0; background: #f5f8fc; }
.format-toolbar button { min-width: 38px; border: 1px solid #d9e2ef; border-radius: 8px; padding: 7px 10px; background: white; color: #33465f; font-size: 12px; font-weight: 750; cursor: pointer; }
.format-toolbar + textarea { border-radius: 0 0 13px 13px; }
.inline-images-section { display: grid; gap: 12px; padding: 16px; border: 1px solid #e1e7ef; border-radius: 15px; background: #f7f9fc; }
.inline-images-editor { display: grid; gap: 10px; }
.inline-image-row { display: grid; grid-template-columns: 110px minmax(180px, 1fr) minmax(200px, 1.2fr) 150px auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid #dfe6ef; border-radius: 13px; background: white; }
.inline-image-preview { width: 110px; height: 82px; display: grid; place-items: center; overflow: hidden; border: 1px dashed #cdd6e2; border-radius: 10px; background: #f7f9fb; color: #8a96a5; font-size: 11px; }
.inline-image-preview img { width: 100%; height: 100%; object-fit: cover; }
.inline-image-row label { margin: 0; }
.inline-image-row .inline-image-remove { align-self: center; }

@media (max-width: 980px) {
  .inline-image-row { grid-template-columns: 100px 1fr 1fr; }
  .inline-image-row .inline-image-remove { grid-column: 3; }
}

@media (max-width: 680px) {
  .image-field-group { grid-template-columns: 1fr; }
  .field-heading-row, .inline-images-heading { align-items: flex-start; flex-direction: column; }
  .inline-image-row { grid-template-columns: 1fr; }
  .inline-image-preview { width: 100%; height: 150px; }
  .inline-image-row .inline-image-remove { grid-column: auto; }
}

/* Theory block builder v2.2 */
.block-builder-shell { display: grid; gap: 14px; padding: 18px; border: 1px solid #dce5f0; border-radius: 18px; background: #f7faff; }
.block-builder-heading, .theory-preview-heading { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.block-builder-heading > div, .theory-preview-heading > div { display: grid; gap: 5px; }
.block-builder-heading small, .theory-preview-heading small { color: #758398; font-size: 12px; font-weight: 500; line-height: 1.45; }
.block-palette { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border: 1px dashed #cbd8e8; border-radius: 14px; background: white; }
.block-palette button { border: 1px solid #d7e2f0; border-radius: 10px; padding: 9px 12px; background: #eef5ff; color: #214d86; font-size: 12px; font-weight: 800; cursor: pointer; }
.block-palette button:hover { background: #e3efff; }
.theory-blocks-editor { display: grid; gap: 12px; }
.block-builder-empty { padding: 28px 16px; border: 1px dashed #cbd5e1; border-radius: 14px; color: #7b8898; text-align: center; background: white; }
.theory-block-card { overflow: hidden; border: 1px solid #dce4ef; border-radius: 15px; background: white; box-shadow: 0 4px 14px rgba(34, 57, 87, .035); }
.theory-block-card-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 10px 12px; border-bottom: 1px solid #e6ebf2; background: #f5f8fc; }
.theory-block-card-head > div:first-child { display: flex; align-items: center; gap: 9px; color: #243a57; }
.block-grip { color: #98a5b5; font-size: 17px; letter-spacing: -4px; user-select: none; }
.block-actions { display: flex; gap: 5px; }
.block-actions button { width: 31px; height: 31px; border: 1px solid #dce4ed; border-radius: 8px; background: white; color: #51647a; font-weight: 900; cursor: pointer; }
.block-actions button:hover { background: #edf3fa; }
.block-actions button.danger { color: #b44435; background: #fff6f4; }
.theory-block-card-body { display: grid; gap: 11px; padding: 14px; }
.theory-block-card-body label { margin: 0; }
.block-inline-toolbar { display: flex; flex-wrap: wrap; gap: 6px; }
.block-inline-toolbar button { border: 1px solid #d8e2ee; border-radius: 8px; padding: 6px 9px; background: #f9fbfd; color: #33475f; font-size: 11px; font-weight: 800; cursor: pointer; }
.block-image-grid { display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: start; }
.block-image-preview { min-height: 150px; display: grid; place-items: center; overflow: hidden; border: 1px dashed #c9d5e3; border-radius: 12px; background: #f5f8fb; color: #8592a2; font-size: 12px; }
.block-image-preview img { width: 100%; height: 180px; object-fit: cover; }
.block-image-grid > div:last-child { display: grid; gap: 10px; }
.block-note { margin: 0; padding: 12px; border-radius: 10px; background: #f4f6f9; font-size: 13px; }
.task-picker { display: grid; gap: 9px; }
.block-task-search { max-width: none; }
.block-task-options { display: grid; gap: 7px; max-height: 260px; overflow: auto; padding: 4px; }
.block-task-options label { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 10px; border: 1px solid #e0e6ee; border-radius: 10px; background: #fbfcfe; cursor: pointer; }
.block-task-options input { width: auto; margin-top: 3px; }
.block-task-options span { display: grid; gap: 3px; }
.block-task-options small { color: #7d8998; font-size: 11px; }
.theory-preview-panel { display: grid; gap: 16px; margin-top: 4px; padding: 20px; border: 1px solid #cddaea; border-radius: 18px; background: white; }
.theory-preview-panel .article-body { max-width: 850px; margin: 0 auto; width: 100%; }

/* Reading experience v2.2 */
.article-reading-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 42px; align-items: start; margin-top: 34px; }
.article-toc { position: sticky; top: 92px; padding: 16px; border: 1px solid #e0e7f0; border-radius: 14px; background: #f8fafc; }
.article-toc > strong { display: block; margin-bottom: 10px; color: #243a57; font-size: 13px; }
.article-toc nav { display: grid; gap: 4px; }
.article-toc a { display: block; padding: 7px 8px; border-radius: 8px; color: #607086; font-size: 12px; line-height: 1.35; text-decoration: none; }
.article-toc a:hover { background: #eaf2ff; color: var(--blue); }
.article-toc .toc-level-3 { padding-left: 18px; font-size: 11px; }
.article-body { min-width: 0; }
.article-body h2, .article-body h3 { scroll-margin-top: 100px; }
.theory-text-block p { margin-bottom: 18px; }

.theory-callout { display: grid; grid-template-columns: 38px 1fr; gap: 12px; margin: 28px 0; padding: 18px; border: 1px solid #dce5f0; border-radius: 16px; background: #f7faff; }
.theory-callout-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: #e8f1ff; color: #1d64d8; font-weight: 900; }
.theory-callout strong { display: block; margin-bottom: 5px; color: #20364f; font-size: 15px; }
.theory-callout p { margin: 0; color: #4e6075; }
.theory-callout.remember { border-color: #cfe8dc; background: #f1faf5; }
.theory-callout.remember .theory-callout-icon { background: #dff4e8; color: #167243; }
.theory-callout.example { border-color: #d9e5f8; background: #f4f8ff; }
.theory-callout.example .theory-callout-icon { background: #e4eeff; color: #245fb8; }
.theory-callout.error { border-color: #f0d2ce; background: #fff6f4; }
.theory-callout.error .theory-callout-icon { background: #ffe4df; color: #b74434; }
.theory-callout.tip { border-color: #eadfc4; background: #fffaf0; }
.theory-callout.tip .theory-callout-icon { background: #fff0c9; color: #95670a; }

.theory-table-wrap { margin: 30px 0; overflow-x: auto; }
.theory-table { min-width: 540px; border: 1px solid #dfe6ee; border-radius: 14px; overflow: hidden; background: white; }
.theory-table th { background: #f1f5fa; color: #344b66; text-transform: none; letter-spacing: 0; font-size: 13px; }
.theory-table td { color: #44576d; }
.theory-table-caption { margin-top: 8px; color: #7c8998; font-size: 12px; text-align: center; }
.theory-formula-block { margin: 28px 0; padding: 18px 20px; overflow-x: auto; border: 1px solid #dfe7f1; border-radius: 14px; background: #fafcff; text-align: center; }
.theory-formula-block small { display: block; margin-top: 10px; color: #7b8797; }
.theory-list-block { margin: 26px 0; }
.theory-list-block h3 { margin-bottom: 10px; }
.theory-list-block ol, .theory-list-block ul { padding-left: 24px; }
.theory-list-block li { margin: 8px 0; color: #41536a; line-height: 1.6; }

.related-tasks-block { margin: 38px 0 12px; padding: 22px; border: 1px solid #dce6f2; border-radius: 18px; background: #f7faff; }
.related-tasks-heading span { color: var(--blue); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.related-tasks-heading h2 { margin: 5px 0 15px !important; font-size: 24px !important; }
.related-task-grid { display: grid; gap: 10px; }
.related-task-card { display: grid; gap: 8px; padding: 14px; border: 1px solid #dfe7f0; border-radius: 13px; background: white; text-decoration: none; }
.related-task-card > div { display: flex; justify-content: space-between; gap: 10px; align-items: center; color: #788596; font-size: 11px; }
.related-task-card strong { color: #213751; font-size: 15px; }
.related-task-card small { color: #718094; }
.related-task-card b { color: var(--blue); font-size: 12px; }
.related-task-card:hover { border-color: #b9d0ef; box-shadow: 0 6px 16px rgba(36, 91, 170, .07); }

@media (max-width: 980px) {
  .article-reading-layout { grid-template-columns: 1fr; gap: 20px; }
  .article-toc { position: static; }
  .block-image-grid { grid-template-columns: 160px 1fr; }
}

@media (max-width: 680px) {
  .block-builder-heading, .theory-preview-heading { align-items: flex-start; flex-direction: column; }
  .block-palette { display: grid; grid-template-columns: repeat(2, 1fr); width: 100%; }
  .block-image-grid { grid-template-columns: 1fr; }
  .block-image-preview img { height: 210px; }
  .theory-callout { grid-template-columns: 34px 1fr; padding: 15px; }
  .theory-callout-icon { width: 34px; height: 34px; }
  .related-tasks-block { padding: 16px; }
}


/* ===== v2.3 learning progress ===== */
.theory-progress-summary{margin:22px 0 26px;padding:18px 20px;background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:0 8px 24px rgba(35,58,89,.04)}
.theory-progress-summary>div:first-child{display:flex;align-items:baseline;gap:10px;margin-bottom:10px}.theory-progress-summary strong{font-size:28px;color:var(--blue)}.theory-progress-summary span,.theory-progress-summary small{color:var(--muted)}.theory-progress-summary .bar{margin-bottom:8px}.progress-fill.theory{background:linear-gradient(90deg,var(--blue),var(--green))}
.learning-chip{display:inline-flex;margin-top:14px;padding:7px 10px;border-radius:999px;font-size:12px;font-weight:700}.learning-chip.completed{background:#e8f8ef;color:#168348}.learning-chip.started{background:#fff5d9;color:#936400}
.article-learning-card{margin-top:36px;padding:24px;border:1px solid #dce7f3;border-radius:20px;background:linear-gradient(135deg,#f7fbff,#f6fff9);display:flex;align-items:center;justify-content:space-between;gap:24px}.article-learning-card h2{margin:4px 0 6px}.article-learning-card p{margin:0;color:var(--muted)}.article-learning-card button{flex:0 0 auto}.article-learning-card button.secondary{background:#eef3f8;color:#36516f}
.article-next-steps{margin-top:34px}.article-next-steps h2{margin:5px 0 16px}.next-step-grid,.recommendation-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px}.next-step-card,.recommendation-card{display:flex;flex-direction:column;gap:8px;padding:18px;border:1px solid var(--line);border-radius:16px;background:#fff;text-decoration:none;color:inherit;box-shadow:0 6px 20px rgba(35,58,89,.04)}.next-step-card:hover,.recommendation-card:hover{transform:translateY(-2px);box-shadow:0 10px 25px rgba(35,58,89,.08)}.next-step-card small,.next-step-card span,.recommendation-card small,.recommendation-card span{color:var(--muted);font-size:12px}.next-step-card strong,.recommendation-card strong{font-size:17px}.next-step-card b,.recommendation-card b{margin-top:auto;color:var(--blue);font-size:13px}
.profile-theory-progress{margin-top:28px}.section-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:18px}.section-heading h2{margin:4px 0 0}.section-heading>span{color:var(--muted);font-size:13px}.profile-recommendations{margin-top:32px}.recommendation-subtitle{margin:28px 0 14px;font-size:22px}.recommendation-empty{padding:20px;border:1px dashed var(--line);border-radius:16px;color:var(--muted);background:#fff}
@media(max-width:700px){.article-learning-card{align-items:stretch;flex-direction:column}.article-learning-card button{width:100%}.section-heading{align-items:flex-start;flex-direction:column;gap:6px}}

/* ===== v2.4: источники, экспертная проверка, курсы ===== */
.source-fieldset{border:1px solid #dbe4f0;border-radius:18px;padding:18px;background:#f8fbff}.source-fieldset legend{font-weight:800;padding:0 8px}.check-line{display:flex!important;gap:10px;align-items:flex-start}.check-line input{width:auto!important;margin-top:4px}.difficulty-rubric{padding:12px 14px;border-radius:12px;background:#eef4ff;color:#34435e;font-size:13px;line-height:1.5}.task-source-box{margin-top:20px;padding:14px 16px;border-left:4px solid #7697d8;background:#f5f8ff;border-radius:8px;font-size:14px;line-height:1.55;color:#3e4b64}.task-source-box a{font-weight:700}.written-answer-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}.review-hint{font-size:13px;color:#697386;margin-top:10px;max-width:760px}.tab-badge{display:inline-flex;min-width:20px;height:20px;align-items:center;justify-content:center;border-radius:999px;padding:0 6px;background:#d73a49;color:white;font-size:11px;margin-left:5px}.review-queue{display:grid;gap:18px}.review-card{background:white;border:1px solid #dde5ef;border-radius:20px;padding:22px;box-shadow:0 8px 30px rgba(29,50,80,.05)}.review-card-head h3{margin:10px 0 4px}.review-card-head p{margin:0;color:#778195;font-size:13px}.review-answer,.review-auto,.review-solution{margin:16px 0;padding:15px;border-radius:14px;background:#f7f9fc}.review-answer>b{display:block;margin-bottom:8px}.review-solution summary{cursor:pointer;font-weight:700}.review-criterion{border-top:1px solid #e3e8ef;padding:15px 0}.review-criterion:first-child{border-top:0}.review-criterion h4{margin:0 0 6px}.review-criterion p{margin:0 0 10px;color:#5f6978}.course-admin-list{display:grid;gap:12px}.course-admin-card{display:flex;justify-content:space-between;gap:20px;align-items:center;background:white;border:1px solid #dfe6ef;border-radius:16px;padding:18px}.course-admin-card h3{margin:8px 0}.course-admin-card p{margin:0;color:#657084}.course-builder{border:1px solid #dce4ee;border-radius:16px;padding:16px;background:#fbfcfe}.course-builder-add{display:grid;grid-template-columns:150px 1fr 1.2fr auto;gap:10px}.course-items-editor{display:grid;gap:8px;margin-top:14px}.course-item-row{display:grid;grid-template-columns:90px 1fr auto;gap:12px;align-items:center;background:white;border:1px solid #e0e6ee;border-radius:12px;padding:12px}.course-item-row small{display:block;color:#758094;margin-top:3px}.course-item-kind{font-size:12px;font-weight:800;text-transform:uppercase;color:#5576b8}.course-item-actions{display:flex;gap:6px}.courses-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:18px}.course-card{display:flex;flex-direction:column;min-height:220px;padding:22px;border:1px solid #dce4ef;background:white;border-radius:20px;text-decoration:none;color:inherit;box-shadow:0 10px 30px rgba(30,55,90,.05);transition:.2s transform,.2s box-shadow}.course-card:hover{transform:translateY(-3px);box-shadow:0 16px 40px rgba(30,55,90,.1)}.course-card h2{margin:15px 0 8px}.course-card p{color:#667085;line-height:1.55}.course-card-footer{display:flex;justify-content:space-between;gap:12px;margin-top:auto;padding-top:20px;color:#52617a}.course-page{max-width:960px;margin:0 auto;padding:38px 22px 80px}.course-hero{background:white;border:1px solid #dfe6ef;border-radius:24px;padding:30px;margin-bottom:22px}.course-hero h1{font-size:clamp(32px,5vw,54px);margin:16px 0 10px}.course-hero>p{color:#627087;max-width:760px;line-height:1.6}.course-progress{display:grid;grid-template-columns:auto auto 1fr;gap:10px;align-items:center;margin-top:24px}.progress-track{height:10px;background:#e8edf4;border-radius:999px;overflow:hidden}.progress-track i{display:block;height:100%;background:linear-gradient(90deg,#446fb9,#69a1e8);border-radius:inherit}.course-timeline{display:grid;gap:10px}.course-timeline-item{display:grid;grid-template-columns:44px 1fr auto;gap:14px;align-items:center;background:white;border:1px solid #dfe6ef;border-radius:16px;padding:16px;text-decoration:none;color:inherit}.course-timeline-item.done{border-color:#b8ddc7;background:#fbfffc}.course-step{width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:#edf2f9;font-weight:800}.course-timeline-item.done .course-step{background:#dff3e7;color:#1d7544}.course-timeline-item h3{margin:3px 0}.course-timeline-item p,.course-timeline-item small{margin:0;color:#758094}
@media (max-width:760px){.course-builder-add{grid-template-columns:1fr}.course-item-row{grid-template-columns:1fr}.course-admin-card{align-items:flex-start;flex-direction:column}.course-timeline-item{grid-template-columns:42px 1fr}.course-timeline-item>b{grid-column:2}.course-progress{grid-template-columns:auto 1fr}.course-progress .progress-track{grid-column:1/-1}}
.expert-comment{display:block;margin-top:6px;color:#59667a;line-height:1.45}


/* ===== v2.5: task attachments, progressive hints, solution quality ===== */
.task-attachments{display:grid;gap:16px;margin-top:22px}.task-attachment{margin:0;padding:12px;border:1px solid #dfe7f1;border-radius:16px;background:#f8fbff}.task-attachment img{display:block;max-width:100%;width:auto;max-height:680px;margin:0 auto;border-radius:12px}.task-attachment figcaption{padding:10px 8px 2px;color:#69778b;font-size:13px;text-align:center;line-height:1.45}.task-file-attachment{display:grid;grid-template-columns:auto 1fr;gap:3px 12px;align-items:center;padding:14px 16px;border:1px solid #dbe5f1;border-radius:14px;background:#f8fbff;text-decoration:none;color:inherit}.task-file-attachment>span{grid-row:1/3;padding:8px 10px;border-radius:10px;background:#eaf2ff;color:#3765a9;font-size:12px;font-weight:900}.task-file-attachment small{color:#718097}.task-hints{margin-top:20px;padding:16px;border:1px solid #d9e5f3;border-radius:16px;background:linear-gradient(135deg,#f8fbff,#fbfffd)}.task-hints-head{display:flex;justify-content:space-between;gap:16px;align-items:center}.task-hints-head>div{display:grid;gap:4px}.task-hints-head small{color:#758398;font-size:12px}.revealed-hints{display:grid;gap:10px;margin-top:14px}.revealed-hint{display:grid;grid-template-columns:30px 1fr;gap:10px;align-items:start;padding:12px;border-radius:12px;background:white;border:1px solid #e0e7f0}.revealed-hint>span{width:28px;height:28px;display:grid;place-items:center;border-radius:50%;background:#eaf2ff;color:#3765a9;font-size:12px;font-weight:900}.revealed-hint .rich-text p:last-child{margin-bottom:0}.task-attachments-editor{display:grid;gap:12px;padding:16px;border:1px solid #dbe5f0;border-radius:16px;background:#f8fbff}.task-attachments-editor-head>div{display:grid;gap:4px}.task-attachments-editor-head small{color:#748196;font-size:12px;font-weight:500}.existing-task-attachments{display:grid;gap:8px}.attachment-empty{padding:12px;border:1px dashed #ccd7e5;border-radius:12px;color:#7b8797;background:white;font-size:13px}.admin-attachment-row{display:grid;grid-template-columns:72px 1fr auto;gap:12px;align-items:center;padding:10px;border:1px solid #dfe6ef;border-radius:12px;background:white}.admin-attachment-preview{width:72px;height:56px;display:grid;place-items:center;overflow:hidden;border-radius:9px;background:#edf3fa;color:#65758b;font-size:12px;font-weight:800}.admin-attachment-preview img{width:100%;height:100%;object-fit:cover}.admin-attachment-row>div:nth-child(2){display:grid;gap:3px}.admin-attachment-row small{color:#7b8798;font-size:11px}
@media(max-width:680px){.task-hints-head{align-items:stretch;flex-direction:column}.task-hints-head button{width:100%}.admin-attachment-row{grid-template-columns:58px 1fr}.admin-attachment-row>button{grid-column:2}.admin-attachment-preview{width:58px;height:50px}}

/* v2.6: student image answers + admin formula review */
.student-solution-upload{margin-top:16px;padding:16px;border:1px solid #dbe5f0;border-radius:16px;background:#f8fbff;display:grid;gap:8px}.student-solution-upload input[type=file]{background:white}.student-solution-upload small{color:#748196;font-size:12px;line-height:1.45}.optional-label{font-size:11px;font-weight:700;color:#8290a3;margin-left:5px}.answer-image-preview{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:10px;margin-top:8px}.answer-image-preview-item{margin:0;border:1px solid #dce5ef;border-radius:12px;padding:8px;background:white;overflow:hidden}.answer-image-preview-item img{display:block;width:100%;height:110px;object-fit:cover;border-radius:8px}.answer-image-preview-item figcaption{margin-top:6px;font-size:11px;color:#69778b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.review-answer-files{margin:16px 0;padding:15px;border-radius:14px;background:#f7f9fc}.review-answer-files>b{display:block;margin-bottom:10px}.review-answer-images{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px}.review-answer-image{display:block;border:1px solid #dbe4ef;border-radius:12px;padding:8px;background:white;text-decoration:none;color:inherit}.review-answer-image img{display:block;width:100%;height:180px;object-fit:contain;border-radius:8px;background:#f4f6f9}.review-answer-image span{display:block;margin-top:7px;font-size:12px;color:#65758a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.review-answer-image.unavailable{min-height:80px;display:grid;place-items:center;color:#8b5e5e}.review-criterion-description p{margin:0 0 10px;color:#5f6978}.review-solution .katex,.review-answer .katex,.review-criterion .katex{font-size:1.05em}
@media (max-width:640px){.answer-image-preview{grid-template-columns:repeat(2,minmax(0,1fr))}.review-answer-images{grid-template-columns:1fr}.review-answer-image img{height:auto;max-height:420px}}

/* v2.7: attachments for reference/model solutions */
.solution-reference-editor{background:linear-gradient(135deg,#fbfcff,#f7fbff)}
.solution-reference-editor .admin-attachment-row{grid-template-columns:72px 1fr auto auto}
.solution-reference-attachments{margin-top:24px;padding-top:20px;border-top:1px solid #e0e7f0}
.solution-reference-heading{display:grid;gap:4px;margin-bottom:12px}
.solution-reference-heading>b{font-size:16px}.solution-reference-heading small{color:#748196;font-size:12px}
.solution-reference-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px}
.solution-reference-image{margin:0;padding:10px;border:1px solid #dce5ef;border-radius:14px;background:#f8fbff}
.solution-reference-image a{display:block}.solution-reference-image img{display:block;width:100%;max-height:520px;object-fit:contain;border-radius:10px;background:white}
.solution-reference-image figcaption{padding:9px 4px 2px;color:#64748b;font-size:12px;line-height:1.45;text-align:center}
.solution-reference-file{display:grid;grid-template-columns:auto 1fr;gap:10px;align-items:center;min-height:76px;padding:14px;border:1px solid #dce5ef;border-radius:14px;background:#f8fbff;text-decoration:none;color:inherit}
.solution-reference-file>span{padding:8px 10px;border-radius:9px;background:#e9f1ff;color:#3865a7;font-weight:900;font-size:12px}
.solution-reference-file>div{display:grid;gap:3px}.solution-reference-file small{color:#748196;font-size:11px}.solution-reference-file.unavailable{display:grid;color:#8b5e5e}
.review-reference-files{background:#f8fbff;border:1px solid #e1e8f1}.review-file-tile{min-height:90px;display:grid;place-items:center}.review-file-tile span{white-space:normal;text-align:center;margin:0}
@media(max-width:680px){.solution-reference-editor .admin-attachment-row{grid-template-columns:58px 1fr}.solution-reference-editor .admin-attachment-row>a,.solution-reference-editor .admin-attachment-row>button{grid-column:2}.solution-reference-grid{grid-template-columns:1fr}}

/* v2.8 content pack importer */
.content-import-card{display:grid;gap:18px}.import-grid{display:grid;grid-template-columns:minmax(280px,1fr) minmax(320px,1.3fr);gap:18px;align-items:start}.import-summary{min-height:92px;border:1px solid var(--border,#dbe4f0);background:#f8fafc;border-radius:16px;padding:16px;display:flex;flex-wrap:wrap;gap:8px 16px;align-content:flex-start}.import-summary b{width:100%;font-size:17px}.import-summary span{font-weight:700}.import-summary small{width:100%;color:#64748b;line-height:1.5}.import-actions{display:flex;gap:10px;flex-wrap:wrap}.content-import-progress{border:1px solid #dbe4f0;border-radius:16px;padding:16px;background:#fff}.content-import-progress .progress-track{height:10px;background:#e9eef5;border-radius:999px;overflow:hidden;margin-bottom:10px}.content-import-progress .progress-track i{display:block;height:100%;background:#2563eb;border-radius:999px;transition:width .15s ease}.content-import-progress b{display:block;margin-bottom:5px}.content-import-progress p{margin:0;color:#64748b}.content-import-log{display:grid;gap:8px}.import-log-error,.import-log-success{border-radius:14px;padding:12px 14px;display:grid;gap:4px}.import-log-error{border:1px solid #fecaca;background:#fff1f2;color:#9f1239}.import-log-success{border:1px solid #bbf7d0;background:#f0fdf4;color:#166534}.error-text{color:#b91c1c;font-weight:700}@media(max-width:760px){.import-grid{grid-template-columns:1fr}}


/* ===== v2.9 encyclopedia visuals + smart review ===== */
.theory-image-source{margin-top:5px;font-size:11px;color:#8793a4;line-height:1.45}.theory-image-source a{color:#5674a5;text-decoration:underline;text-underline-offset:2px}.article-toc{max-height:calc(100vh - 120px);overflow:auto}.review-due-nav{color:#b55820!important;font-weight:900!important}.smart-review-profile{margin-top:28px}.review-summary-line{margin:12px 0 14px;color:#5f6f83}.review-summary-line strong{color:#d46b2d;font-size:24px}.review-reminder-grid,.review-page-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px}.review-reminder-card,.review-page-card{display:flex;flex-direction:column;gap:8px;padding:16px;border:1px solid #dfe6ef;border-radius:16px;background:#fff;text-decoration:none;color:inherit}.review-reminder-card.due,.review-page-card.due{border-color:#efc9ae;background:#fffaf6;box-shadow:0 8px 24px rgba(199,99,36,.08)}.review-reminder-card small,.review-page-card small,.review-reminder-card span,.review-page-card span{color:#748196;font-size:12px}.review-reminder-card b,.review-page-card b{margin-top:auto;color:#1f65cc;font-size:13px}.article-review-session{margin-top:22px;padding:22px;border:1px solid #eadccf;border-radius:20px;background:linear-gradient(135deg,#fffaf4,#f7fbff);display:flex;justify-content:space-between;gap:22px;align-items:center}.article-review-session h2{margin:5px 0 6px}.article-review-session p{margin:0;color:#69778b}.review-rating-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.review-rating-actions button{white-space:nowrap}.review-page{max-width:1180px;margin:0 auto;padding:38px 22px 80px}.review-hero{padding:28px;border:1px solid #dfe6ef;border-radius:24px;background:linear-gradient(135deg,#f7fbff,#fffaf6);margin-bottom:24px}.review-hero h1{margin:6px 0 10px;font-size:clamp(36px,5vw,58px)}.review-hero>p{max-width:850px;color:#637187;line-height:1.65}.review-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:22px}.review-stats>div{display:grid;gap:4px;padding:14px;background:#fff;border:1px solid #e1e7ef;border-radius:14px}.review-stats strong{font-size:28px;color:#245fab}.review-stats span{font-size:12px;color:#748196}.review-page-card>div{display:flex;justify-content:space-between;gap:10px;align-items:center}.review-page-card strong{font-size:17px}.review-upcoming-heading{margin-top:34px}.review-empty{padding:20px;border:1px dashed #cfd9e5;border-radius:16px;color:#748196;background:#fff}.content-image{max-height:760px;object-fit:contain;background:#fff}
@media(max-width:720px){.article-review-session{align-items:stretch;flex-direction:column}.review-rating-actions{justify-content:stretch;display:grid;grid-template-columns:1fr 1fr}.review-stats{grid-template-columns:1fr}.review-page-card>div{align-items:flex-start;flex-direction:column}}

/* ===== v3.0 active recall before theory review ===== */
.theory-article.recall-checking .article-cover-figure,
.theory-article.recall-checking .article-reading-layout,
.theory-article.recall-checking .article-learning-card,
.theory-article.recall-checking .article-review-session,
.theory-article.recall-checking .article-next-steps,
.theory-article.recall-locked .article-cover-figure,
.theory-article.recall-locked .article-reading-layout,
.theory-article.recall-locked .article-learning-card,
.theory-article.recall-locked .article-review-session,
.theory-article.recall-locked .article-next-steps{display:none!important}
.active-recall-gate{margin:28px 0 12px;padding:26px;border:1px solid #d9e4f0;border-radius:24px;background:linear-gradient(145deg,#f7fbff,#fffaf5);box-shadow:0 14px 40px rgba(45,73,110,.06)}
.active-recall-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}.active-recall-head h2{margin:6px 0 8px;font-size:clamp(24px,3vw,34px)}.active-recall-head p{margin:0;max-width:760px;color:#68778b;line-height:1.6}.recall-memory-icon{width:54px;height:54px;border-radius:18px;display:grid;place-items:center;background:#e8f1ff;color:#2d66b3;font-size:28px;font-weight:900;flex:0 0 auto}
.recall-progress{display:grid;grid-template-columns:1fr auto;gap:14px;align-items:center;margin:24px 0 18px}.recall-progress b{font-size:13px;color:#66758a}.recall-progress .progress-track{height:9px;background:#e5ebf3;border-radius:999px;overflow:hidden}.recall-progress .progress-track i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#2f6fc4,#71a7ef)}
.recall-question-stage{display:grid;gap:16px}.recall-question-prompt{padding:20px;border:1px solid #dfe7f0;border-radius:18px;background:#fff}.recall-question-prompt p{margin:0;font-size:19px;line-height:1.65;font-weight:700;color:#18253b}.recall-answer-label{display:grid;gap:8px;font-weight:800}.recall-answer-label textarea{min-height:132px;resize:vertical;background:#fff}.recall-question-actions,.recall-self-rating{display:flex;gap:10px;flex-wrap:wrap}.recall-reference{padding:20px;border:1px solid #cfe1d6;border-radius:18px;background:#fbfffc}.recall-reference>.eyebrow{color:#287d4c}.recall-reference .rich-text p{margin:8px 0 0;line-height:1.65}.recall-explanation{margin-top:12px;padding:12px 14px;border-radius:12px;background:#f4f7fb;color:#607086}.recall-rate-prompt{margin:18px 0 10px;color:#59687c;font-size:13px}.recall-self-rating button{min-width:120px}.recall-summary{padding:22px;border:1px solid #dfe6ef;border-radius:18px;background:#fff}.recall-summary h3{margin:6px 0 10px;font-size:24px}.recall-summary p{color:#637187;line-height:1.6}.recall-summary strong{color:#1e5fae}.recall-recommendation{font-weight:800;color:#7a5a35!important}.review-rating-actions button.recall-recommended{box-shadow:0 0 0 3px rgba(46,111,196,.18);transform:translateY(-1px)}
@media(max-width:700px){.active-recall-gate{padding:18px}.active-recall-head{flex-direction:column}.recall-memory-icon{display:none}.recall-progress{grid-template-columns:1fr}.recall-question-actions,.recall-self-rating{display:grid;grid-template-columns:1fr}.recall-self-rating button{width:100%}}


/* ===== v3.1 legal + privacy controls ===== */
.site-legal-footer{margin-top:56px;border-top:1px solid #e1e7ef;background:#f8fafc}.legal-footer-inner{max-width:1180px;margin:0 auto;padding:28px 22px;display:grid;grid-template-columns:minmax(220px,.8fr) minmax(320px,1.2fr);gap:28px;align-items:start}.legal-footer-inner>div{display:grid;gap:8px}.legal-footer-logo{width:max-content}.legal-footer-inner small{max-width:520px;color:#758196;line-height:1.55}.legal-footer-inner nav{display:flex;flex-wrap:wrap;gap:10px 18px;justify-content:flex-end}.legal-footer-inner nav a{font-size:12px;font-weight:700;color:#5f6f83;text-decoration:none}.legal-footer-inner nav a:hover{color:#1d62c7;text-decoration:underline}.technical-storage-notice{position:fixed;z-index:1000;left:18px;right:18px;bottom:18px;max-width:980px;margin:0 auto;padding:15px 16px;border:1px solid #cfd9e6;border-radius:16px;background:rgba(255,255,255,.97);box-shadow:0 14px 40px rgba(32,52,80,.16);display:flex;align-items:center;justify-content:space-between;gap:18px}.technical-storage-notice>div:first-child{display:grid;gap:4px}.technical-storage-notice span{font-size:12px;color:#65758a;line-height:1.45}.technical-storage-actions{display:flex;gap:8px;align-items:center;white-space:nowrap}.technical-storage-actions a{font-size:12px;color:#2867bd}.technical-storage-actions button{padding:8px 12px;font-size:12px}.legal-page{max-width:1050px;margin:0 auto;padding:42px 22px 80px}.legal-document{padding:34px;border:1px solid #dfe6ef;border-radius:24px;background:#fff;box-shadow:0 10px 34px rgba(40,60,85,.04)}.legal-document h1{margin:7px 0 16px;font-size:clamp(34px,5vw,54px);line-height:1.08}.legal-document h2{margin:32px 0 10px;font-size:22px}.legal-document p,.legal-document li{color:#495b70;line-height:1.72}.legal-document ul{padding-left:22px}.legal-lead{font-size:17px!important;color:#35475d!important}.legal-warning{padding:16px 18px;border:1px solid #efc7a9;border-radius:14px;background:#fff8f2;color:#6c4c34}.legal-warning p{margin:5px 0 0!important;color:#73563e!important}.legal-action-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:24px 0}.legal-action-card{display:grid;gap:6px;padding:18px;border:1px solid #dce5f0;border-radius:16px;background:#f8fbff;text-decoration:none;color:inherit}.legal-action-card strong{font-size:17px}.legal-action-card span{font-size:13px;color:#68778b;line-height:1.5}.legal-separate-consents{display:grid;gap:10px;margin:18px 0}.legal-check{display:grid;grid-template-columns:auto 1fr;gap:11px;align-items:start;padding:13px;border:1px solid #dfe6ef;border-radius:13px;background:#fbfcfe;cursor:pointer}.legal-check input{width:auto;margin-top:3px}.legal-check span{display:grid;gap:4px}.legal-check small{color:#6e7c8e;line-height:1.45}.legal-check-emphasis{border-color:#b9d1f1;background:#f4f8ff}.field-help{display:block;margin:-5px 0 12px;color:#7b8797;line-height:1.4}.registration-consents{margin-top:18px}.personal-data-card{margin-top:28px}.personal-data-card>p{color:#65758a}.personal-data-actions{display:flex;gap:10px;flex-wrap:wrap}.danger-button{background:#b42318!important;color:#fff!important;border-color:#b42318!important}.danger-button:hover{background:#8f1c14!important}.legal-consent-card{max-width:720px}.legal-consent-card .legal-separate-consents{margin:22px 0}.legal-document code{padding:2px 6px;border-radius:6px;background:#eef2f7}
@media(max-width:760px){.legal-footer-inner{grid-template-columns:1fr}.legal-footer-inner nav{justify-content:flex-start}.technical-storage-notice{align-items:stretch;flex-direction:column}.technical-storage-actions{justify-content:space-between}.legal-document{padding:22px}.legal-action-grid{grid-template-columns:1fr}.personal-data-actions{display:grid}.personal-data-actions>*{width:100%}}


/* v3.2: username auth, emoji avatars, public leaderboard */
.field-help { display:block; margin:-5px 0 5px; color:#718095; font-size:12px; line-height:1.5; }
.privacy-min-card { margin:18px 0 24px; padding:18px; border:1px solid var(--line); border-radius:16px; background:#f8fbff; }
.privacy-min-card p { margin:7px 0 0; }
.profile-emoji-avatar { display:grid; place-items:center; font-size:46px; }
.profile-login-line, .profile-rating-line { margin:5px 0 0; font-size:14px; }
.profile-login-line strong { color:var(--ink); }
.avatar-picker { display:grid; grid-template-columns:repeat(9,minmax(0,1fr)); gap:8px; margin-top:9px; }
.avatar-option { position:relative; cursor:pointer; }
.avatar-option input { position:absolute; opacity:0; pointer-events:none; }
.avatar-option span { display:grid; place-items:center; min-height:46px; border:1px solid var(--line); border-radius:13px; background:#fff; font-size:24px; transition:.16s ease; }
.avatar-option:hover span { transform:translateY(-1px); border-color:#abc6f7; }
.avatar-option.selected span { border-color:var(--blue); box-shadow:0 0 0 3px rgba(20,100,244,.10); background:#f4f8ff; }
.rating-optin { display:flex; gap:12px; align-items:flex-start; padding:15px; border:1px solid #dce6f5; border-radius:15px; background:#f8fbff; cursor:pointer; }
.rating-optin input { width:18px; height:18px; margin-top:2px; flex:0 0 auto; }
.rating-optin span { display:grid; gap:5px; }
.rating-optin small { color:#69798e; line-height:1.45; }
.profile-rating-link { display:inline-block; margin-top:17px; }
.photo-privacy-warning { margin:12px 0 16px; padding:14px 16px; border:1px solid #f0d4a1; border-radius:14px; background:#fffaf0; color:#684513; }
.photo-privacy-warning > strong, .photo-privacy-warning > span { display:block; }
.photo-privacy-warning > span { margin-top:5px; font-size:13px; line-height:1.5; }
.photo-privacy-warning label { display:flex; gap:9px; align-items:flex-start; margin-top:11px; font-size:13px; line-height:1.4; cursor:pointer; }
.photo-privacy-warning input { width:17px; height:17px; margin:1px 0 0; flex:0 0 auto; }
.rating-page { width:min(1080px,calc(100% - 40px)); margin:0 auto; padding:58px 0 90px; }
.rating-hero { max-width:800px; }
.rating-podium { display:grid; grid-template-columns:repeat(3,1fr); gap:18px; align-items:end; margin:32px 0; }
.podium-card { text-align:center; padding:28px 20px; background:#fff; border:1px solid var(--line); border-radius:24px; box-shadow:var(--shadow); }
.podium-card.place-1 { transform:translateY(-13px); }
.podium-medal { font-size:34px; }
.podium-avatar { margin:10px 0 7px; font-size:48px; }
.podium-card small { color:#74839a; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
.podium-card h2 { margin:8px 0; font-size:21px; overflow-wrap:anywhere; }
.podium-card strong { color:var(--blue-dark); }
.leaderboard-card { padding:0; overflow:hidden; }
.leaderboard-head, .leaderboard-row { display:grid; grid-template-columns:90px minmax(200px,1fr) 120px 140px; align-items:center; gap:16px; }
.leaderboard-head { padding:15px 22px; background:#f4f7fb; color:#718095; font-size:12px; font-weight:850; text-transform:uppercase; letter-spacing:.05em; }
.leaderboard-row { min-height:72px; padding:12px 22px; border-top:1px solid var(--line); }
.leaderboard-row.is-me { background:#f4f8ff; }
.leaderboard-place { font-size:20px; }
.leaderboard-user { display:flex; align-items:center; gap:12px; min-width:0; }
.leaderboard-user strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.leaderboard-user small { color:var(--blue); font-weight:800; }
.leaderboard-avatar { display:grid; place-items:center; width:42px; height:42px; border-radius:13px; background:#f4f7fb; font-size:24px; flex:0 0 auto; }
.rating-formula-note { max-width:760px; margin:18px auto 0; text-align:center; font-size:13px; }
.rating-empty { grid-column:1/-1; padding:32px; text-align:center; background:#fff; border:1px dashed #cad6e5; border-radius:20px; color:var(--muted); }
@media (max-width: 760px) {
  .avatar-picker { grid-template-columns:repeat(6,1fr); }
  .rating-podium { grid-template-columns:1fr; }
  .podium-card.place-1 { transform:none; order:-1; }
  .leaderboard-head { display:none; }
  .leaderboard-row { grid-template-columns:46px minmax(0,1fr) 70px; gap:10px; padding:12px 14px; }
  .leaderboard-row > strong:last-child { grid-column:2/4; color:var(--blue-dark); }
}

.cover-manager-card{margin:0 0 22px;padding:18px;border:1px solid #dbe5f0;border-radius:18px;background:linear-gradient(135deg,#fbfdff,#f6fbf8);display:grid;gap:14px}.cover-manager-head>div{display:grid;gap:5px}.cover-manager-head b{font-size:16px}.cover-manager-head small{color:#6f7e92;line-height:1.5}.cover-manager-actions{display:flex;flex-wrap:wrap;gap:10px}.cover-manager-summary{display:flex;flex-wrap:wrap;gap:9px 16px;padding:12px 14px;border-radius:12px;background:white;border:1px solid #e2e8f0;color:#5d6b7f;font-size:13px}.cover-manager-summary b{color:#18304d}.cover-manager-preview{width:86px;height:58px;object-fit:cover;border-radius:9px;border:1px solid #dde5ef}.cover-log-ok{padding:8px 10px;border-radius:10px;background:#f3fbf6;color:#2d6845;font-size:12px}.cover-log-warn{padding:8px 10px;border-radius:10px;background:#fff8eb;color:#8a621a;font-size:12px}.cover-log-error{padding:8px 10px;border-radius:10px;background:#fff1ef;color:#984231;font-size:12px}

/* v3.5 courses + homework */
.course-module{margin:28px 0 42px}.course-module-head{margin:0 0 14px;padding:18px 20px;border:1px solid var(--line,#dfe3ea);border-radius:18px;background:var(--panel,#fff)}.course-module-head>span{font-size:.78rem;text-transform:uppercase;letter-spacing:.08em;opacity:.6}.course-module-head h2{margin:4px 0 6px}.course-module-head p{margin:0;opacity:.75}.course-module-items{display:grid;gap:10px}.course-continue{display:inline-flex;margin-top:12px;font-weight:700;text-decoration:none}.course-finished{display:block;margin-top:10px}.course-homework{margin:34px 0;padding:24px;border:1px solid var(--line,#dfe3ea);border-radius:22px;background:var(--panel,#fff)}.course-homework-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:20px}.course-homework-head h2{margin:3px 0 7px}.course-homework-head p{margin:0;max-width:760px;opacity:.78}.course-homework-list{display:grid;gap:16px}.course-homework-question{padding:18px;border:1px solid var(--line,#dfe3ea);border-radius:16px;background:rgba(127,127,127,.035)}.homework-question-head{display:flex;justify-content:space-between;gap:10px;margin-bottom:10px;font-weight:700}.homework-question-head small{font-weight:500;opacity:.6}.course-homework-question textarea{width:100%;margin-top:8px;resize:vertical}.homework-reference{margin-top:14px;padding-top:14px;border-top:1px dashed var(--line,#dfe3ea)}.homework-reference p{margin:12px 0 8px}.homework-explanation{margin-top:8px;opacity:.8}.homework-rating-actions{display:flex;gap:8px;flex-wrap:wrap}.homework-rating-actions button.selected{outline:3px solid rgba(72,99,255,.18);transform:translateY(-1px)}.course-homework-footer{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-top:18px;flex-wrap:wrap}.course-homework-footer p{margin:0;opacity:.75}.success-text{font-weight:700;color:#197047}.course-timeline-item small{display:block;margin-bottom:4px}
@media(max-width:720px){.course-homework-head{display:block}.course-homework-head .secondary-action{display:inline-flex;margin-top:12px}.course-homework{padding:16px}.course-homework-footer{align-items:stretch}.course-homework-footer button{width:100%}}
