:root {
  --paper: #f7f3ea;
  --card: #fffdf8;
  --ink: #2c2a26;
  --muted: #7d766b;
  --line: #ded5c4;
  --accent: #b4552d;
  --accent-2: #8c3f22;
  --soft: #efe7d8;
  --green: #3f6b4f;
  --blue: #3d5a80;
  --red: #a33a2c;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 "Segoe UI", system-ui, -apple-system, sans-serif;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; line-height: 1.15; }
h1 { font-size: 2.4rem; margin: .2em 0 .3em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; margin: .2em 0 .4em; }
p { margin: .5em 0; }
small, .small { font-size: .86rem; }

.top {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px;
  background: rgba(255,253,248,.92);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); font-size: 22px; }
.brand small { display: block; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; gap: 18px; margin-left: 12px; }
.nav a { color: var(--ink); font-size: .95rem; }
.who { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: .9rem; color: var(--muted); }
.quiet { color: var(--muted); font-size: .88rem; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.foot {
  max-width: 1180px; margin: 0 auto; padding: 24px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 20px;
  color: var(--muted); font-size: .8rem;
}

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; color: var(--accent); margin: 0; }
.lead { font-size: 1.12rem; color: #4d473d; max-width: 62ch; }
.muted { color: var(--muted); }
.tight { margin-bottom: .2em; }
.pre { white-space: pre-wrap; font-family: "Segoe UI", sans-serif; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 1px 0 rgba(44,42,38,.03);
}
.card.soft { background: var(--soft); }
.card.accent { background: #fff4ec; border-color: #e7c3b1; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: 1.15fr .85fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap { gap: 10px; flex-wrap: wrap; }
.side { min-width: 0; }

.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff;
  color: var(--ink); padding: 9px 16px; border-radius: 10px;
  cursor: pointer; font: inherit; font-size: .95rem;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 11px; font-size: .86rem; }
.btn.tiny { padding: 3px 9px; font-size: .78rem; }
.big-btn { padding: 13px 24px; font-size: 1.05rem; }

label { display: block; margin: 12px 0; font-size: .92rem; color: #4d473d; }
input, textarea, select {
  width: 100%; margin-top: 5px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font: inherit;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid #e7c3b1; border-color: var(--accent); }

.inline { display: flex; gap: 10px; }
.inline input { margin: 0; }
.inline.big { margin: 18px 0 24px; }
.inline.big input { font-size: 1.05rem; padding: 14px; }
.inline.big .btn { white-space: nowrap; }

.login-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 48px; align-items: center; padding: 40px 0; }
.login-text h1 { font-size: 3.2rem; }
.login-card { max-width: 420px; }
.clean { padding-left: 18px; color: #4d473d; }
.clean li { margin: 6px 0; }

.progress { height: 9px; background: #e8dfcf; border-radius: 6px; overflow: hidden; margin: 12px 0 18px; }
.progress span { display: block; height: 100%; background: var(--accent); }
.badge { display: inline-block; background: var(--soft); color: #6b5c46; border-radius: 999px; padding: 3px 10px; font-size: .74rem; letter-spacing: .04em; }
.tags { color: var(--muted); font-size: .8rem; }

.status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .74rem; background: #ece6da; color: #6a6154; }
.status.available, .status.submitted { background: #f6e0d3; color: #8c3f22; }
.status.in_progress, .status.in_review { background: #e3e8f1; color: #3d5a80; }
.status.completed, .status.accepted { background: #dfe9df; color: #3f6b4f; }
.status.locked { background: #ece6da; color: #8a8174; }
.status.revision { background: #f7ead0; color: #8a6416; }
.status.redo, .status.rejected { background: #f3dcd8; color: #a33a2c; }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.table th, .table td { padding: 9px 6px; border-bottom: 1px solid #eee6d8; vertical-align: top; }

.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; font-size: .92rem; }
.flash.ok { background: #dfe9df; color: #2f563d; }
.flash.error { background: #f3dcd8; color: #7f2b20; }

.lesson-grid { grid-template-columns: 1.35fr .65fr; align-items: start; }
.lesson-body { line-height: 1.65; }
.lesson-body h1 { font-size: 1.9rem; }
.lesson-body h2 { font-size: 1.35rem; margin-top: 1.2em; }
.lesson-body h3 { font-size: 1.08rem; margin-top: 1.1em; }
.lesson-body ul, .lesson-body ol { padding-left: 22px; }
.lesson-body blockquote { border-left: 3px solid var(--accent); margin: 1em 0; padding: .2em 0 .2em 14px; color: var(--muted); }
.lesson-body table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.lesson-body td, .lesson-body th { border: 1px solid var(--line); padding: 7px 9px; }

.sub-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eee6d8; font-size: .9rem; }
.sub-row:last-child { border-bottom: 0; }

.verdict { font-size: 1.1rem; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; background: var(--soft); }
.verdict.accepted { background: #dfe9df; color: #2f563d; }
.verdict.revision { background: #f7ead0; color: #7a5a12; }
.verdict.redo { background: #f3dcd8; color: #7f2b20; }

.node-card { display: block; color: var(--ink); }
.node-card:hover { text-decoration: none; border-color: var(--accent); }
.node-card h3 { margin-top: 6px; }

.map-level { margin: 26px 0; }
.map-level h2 { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.map-line { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.map-node { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.map-node.locked { opacity: .62; }
.map-node.available { border-color: #e0a583; box-shadow: 0 0 0 2px #f6e0d3; }

.diag .card { margin-bottom: 12px; }
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.opt { display: flex; gap: 9px; align-items: center; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.opt input { width: auto; margin: 0; }
.opt:hover { border-color: var(--accent); }

.case-img { display: block; margin: 10px 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.case-img img { display: block; width: 100%; height: auto; }

/* профиль и аватары */
.who-link { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.who-link:hover { text-decoration: none; color: var(--accent-2); }
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); background: var(--soft); }
.avatar-xs { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); background: var(--soft); vertical-align: middle; margin-right: 6px; }
.avatar-lg { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); background: var(--soft); display: block; margin-bottom: 14px; }
.profile-card { text-align: left; }
.profile-strip { display: flex; gap: 16px; align-items: center; }
.profile-strip .grow { flex: 1; min-width: 0; }
.avatar-md { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); background: var(--soft); }
.role-line { color: var(--accent-2); font-size: .95rem; margin-top: -.2em; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.stats div { text-align: center; }
.stats b { display: block; font-size: 1.3rem; font-family: Georgia, serif; }
.stats span { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

@media (max-width: 600px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .profile-strip { flex-wrap: wrap; }
  .profile-strip .grow { flex: 1 1 calc(100% - 80px); }
  .profile-strip > .btn { flex-basis: 100%; text-align: center; margin-top: 4px; }
  .row.between { flex-wrap: wrap; gap: 6px; }
}

@media (max-width: 900px) {
  .grid.two, .lesson-grid, .login-grid { grid-template-columns: 1fr; }
  .grid.three, .map-line { grid-template-columns: repeat(2, 1fr); }
  .login-text h1 { font-size: 2.4rem; }
  .top { flex-wrap: wrap; gap: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
}
@media (max-width: 600px) {
  .grid.three, .map-line, .options { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 2rem; }
  .wrap { padding: 20px 14px 50px; }
}
