:root {
  --ink: #111;
  --ink-2: #555;
  --ink-3: #8a8a8a;
  --line: #e4e4e4;
  --paper: #fff;
  --soft: #f6f6f4;
  --link: #0b57d0;
  --link-line: rgba(11, 87, 208, .25);
  --ok: #1f8a4c;
  --ok-soft: #eaf6ee;
  --star: #f2b600;

  --water: #ffeb8a;
  --water-strong: #f5cf2a;
  --kanc: #ffd2c8;
  --kanc-strong: #ff9c86;
  --vague: #d4e4ff;
  --vague-strong: #8db5f5;
  --syntax: #b9a6d9;

  --font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --text: 19px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; border-bottom: 1px solid var(--link-line); transition: border-color .15s; }
a:hover { border-bottom-color: var(--link); }

h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 40px; }

/* Шапка */

.top { border-bottom: 1px solid var(--line); }
.top__in { display: flex; align-items: center; gap: 32px; height: 60px; }
.logo { font-weight: 700; font-size: 20px; letter-spacing: -.02em; color: var(--ink); border: 0; }
.top__nav { display: flex; gap: 24px; font-size: 15px; }
.top__nav a { color: var(--ink-2); border-bottom-color: transparent; }
.top__nav a:hover { color: var(--ink); border-bottom-color: var(--line); }
.top__nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.top__author { margin-left: auto; font-size: 15px; }

/* Вступление */

.intro { padding-top: 56px; padding-bottom: 40px; }
.intro h1 { font-size: 64px; line-height: 1.02; letter-spacing: -.035em; font-weight: 700; }
.lead { margin-top: 24px; max-width: 760px; font-size: 22px; line-height: 1.45; color: var(--ink); }
.intro__actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* Кнопки */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 18px;
  font: inherit; font-size: 15px; color: var(--ink); text-decoration: none;
  background: var(--paper); border: 1px solid #d6d6d6; border-radius: 4px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--ink); }
.btn--quiet { border-color: transparent; color: var(--link); padding: 0 8px; }
.btn--quiet:hover { border-color: transparent; text-decoration: underline; }
.btn--dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--dark:hover { background: #333; border-color: #333; }
.btn--big { height: 52px; padding: 0 26px; font-size: 17px; }

/* Проверка */

.check { padding-bottom: 88px; }
.check__head { padding: 28px 0 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; }
.check__title { font-size: 15px; color: var(--ink-3); }
.examples { display: flex; flex-wrap: wrap; gap: 8px; font-size: 15px; }
.pill {
  height: 32px; padding: 0 12px;
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px; cursor: pointer;
  transition: border-color .15s;
}
.pill:hover { border-color: #aaa; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start; }

.editor { position: relative; border: 1px solid #d6d6d6; border-radius: 4px; background: var(--paper); transition: border-color .15s, box-shadow .15s; }
.editor:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17, 17, 17, .06); }

.editor__layer,
.editor__input,
.text-view {
  margin: 0;
  padding: 32px 36px 40px;
  font: 400 var(--text)/1.65 var(--font);
  letter-spacing: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  tab-size: 4;
}
.editor__layer { position: absolute; inset: 0; color: transparent; pointer-events: none; overflow: hidden; }
.editor__input {
  position: relative; z-index: 2; display: block; width: 100%; min-height: 300px;
  color: var(--ink); background: transparent; border: 0; outline: 0; resize: none; overflow: hidden;
  caret-color: var(--ink);
}
.editor__input::placeholder { color: var(--ink-3); }

.editor mark, .text-view mark { border-radius: 2px; transition: background-color .15s; }
.editor mark { color: transparent; }
.text-view mark { color: inherit; }
.editor__layer--words mark.g-water, .text-view mark.g-water { background: var(--water); }
.editor__layer--words mark.g-kanc, .text-view mark.g-kanc { background: var(--kanc); }
.editor__layer--words mark.g-vague, .text-view mark.g-vague { background: var(--vague); }
.editor__layer--words mark.is-active.g-water { background: var(--water-strong); }
.editor__layer--words mark.is-active.g-kanc { background: var(--kanc-strong); }
.editor__layer--words mark.is-active.g-vague { background: var(--vague-strong); }
.editor__layer--sent mark, .text-view mark.g-syntax {
  background: none;
  text-decoration: underline; text-decoration-color: var(--syntax);
  text-decoration-thickness: 2px; text-underline-offset: 7px; text-decoration-skip-ink: none;
}
.editor__layer--sent mark.is-active { background: rgba(185, 166, 217, .25); }

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

/* Список замечаний */

.issues { margin-top: 40px; }
.kicker { font-size: 13px; color: var(--ink-3); letter-spacing: .02em; }
.issues__empty { margin-top: 8px; font-size: 16px; color: var(--ink-2); }
.issue-group { padding: 18px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; }
.kicker + .issue-group { margin-top: 10px; }
.issue-group__head { font-size: 15px; line-height: 1.4; }
.issue-group__name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.issue-group__count { color: var(--ink-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.issue-group__why { margin-top: 4px; color: var(--ink-2); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.chip {
  max-width: 100%; padding: 3px 9px; font: inherit; font-size: 15px; line-height: 1.45; color: var(--ink); text-align: left;
  border: 0; border-radius: 3px; cursor: pointer; transition: filter .15s;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
span.chip { cursor: default; }
button.chip:hover, .chip.is-active { filter: saturate(2.2) brightness(.96); }
.chip.g-water { background: var(--water); }
.chip.g-kanc { background: var(--kanc); }
.chip.g-vague { background: var(--vague); }
.chip.g-syntax { background: #ece6f6; }

.dot { flex: none; width: 10px; height: 10px; border-radius: 2px; }
.dot.g-water { background: var(--water-strong); }
.dot.g-kanc { background: var(--kanc-strong); }
.dot.g-vague { background: var(--vague-strong); }
.dot.g-syntax { background: var(--syntax); height: 3px; border-radius: 0; }

/* Панель показателей */

.panel { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; scrollbar-width: thin; }

.metrics { display: grid; gap: 16px; }
.metric__label { font-size: 14px; color: var(--ink-3); }
.metric__value { margin-top: 2px; font-size: 34px; line-height: 1.05; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric__value small { font-size: 17px; font-weight: 400; color: var(--ink-3); letter-spacing: 0; }
.metric__sub { margin-top: 2px; font-size: 14px; color: var(--ink-2); min-height: 21px; }
.bar { position: relative; height: 4px; margin-top: 10px; background: #eee; border-radius: 2px; }
.bar__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ink); border-radius: 2px; transition: width .25s ease, background .25s; }
.bar__fill.is-ok { background: var(--ok); }
.bar__goal { position: absolute; top: -4px; width: 2px; height: 12px; background: var(--ink); margin-left: -1px; }

.goals { list-style: none; margin: 20px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 15px; }
.goals:empty { display: none; }
.goals__title { font-size: 13px; color: var(--ink-3); letter-spacing: .02em; margin-bottom: 2px; }
.goals--mobile { display: none; }
.goal { display: flex; gap: 10px; color: var(--ink-2); }
.goal__mark { flex: none; width: 18px; height: 18px; margin-top: 2px; border: 1.5px solid #c8c8c8; border-radius: 50%; display: grid; place-items: center; font-size: 11px; line-height: 1; color: transparent; transition: all .2s; }
.goal.is-ok { color: var(--ink); }
.goal.is-ok .goal__mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.goal.is-bad .goal__mark { border-color: #e2a59a; color: #d0573f; }
.goal__hint { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-3); }

.note { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.5; }
.note__title { margin-top: 8px; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.note__frag { margin-top: 6px; font-size: 16px; }
.note__frag span { padding: 1px 4px; border-radius: 2px; }
.note__frag span.g-water { background: var(--water); }
.note__frag span.g-kanc { background: var(--kanc); }
.note__frag span.g-vague { background: var(--vague); }
.note__frag span.g-syntax { background: #ece6f6; }
.note__why { margin-top: 8px; color: var(--ink-2); }
.note__fix { margin-top: 8px; }
.note__fix b { font-weight: 600; }
.note__hint { margin-top: 8px; color: var(--ink-2); }
.legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; color: var(--ink-2); font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 8px; }

/* Приглашение в игру */

.promo { border-top: 1px solid var(--line); padding: 64px 0; }
.promo__in { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: end; }
.promo h2 { font-size: 40px; line-height: 1.1; letter-spacing: -.025em; font-weight: 700; }
.promo p { margin-top: 14px; max-width: 680px; font-size: 19px; line-height: 1.5; color: var(--ink-2); }

/* Правила */

.rules, .method { padding-top: 72px; padding-bottom: 72px; border-top: 1px solid var(--line); }
.rules h2, .method h2 { font-size: 40px; line-height: 1.1; letter-spacing: -.025em; font-weight: 700; }
.section-lead { margin-top: 16px; max-width: 720px; font-size: 19px; line-height: 1.5; color: var(--ink-2); }

.rules__list { list-style: none; margin: 48px 0 0; padding: 0; counter-reset: rule; }
.rule { display: grid; grid-template-columns: 56px minmax(0, 1fr) 380px; gap: 0 32px; padding: 28px 0; border-top: 1px solid var(--line); counter-increment: rule; }
.rule::before { content: counter(rule); font-size: 28px; font-weight: 700; line-height: 1.1; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rule__title { font-size: 22px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
.rule__text { margin-top: 8px; font-size: 17px; line-height: 1.55; }
.rule__tag { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--ink-3); }
.rule__tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #ccc; }
.rule__tag.is-auto { color: var(--ok); }
.rule__tag.is-auto::before { background: var(--ok); }
.rule__ex { font-size: 15px; line-height: 1.5; }
.rule__ex p + p { margin-top: 10px; }
.rule__ex .was { color: var(--ink-3); }
.rule__ex .was .t { text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .3); }
.rule__ex .now { color: var(--ink); }
.rule__ex .lbl { display: block; font-size: 12px; color: var(--ink-3); letter-spacing: .02em; }

/* Как считаем */

.method__grid { margin-top: 40px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; }
.method h3 { font-size: 20px; font-weight: 700; }
.method__grid p { margin-top: 8px; font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.method__warn { margin-top: 40px; max-width: 760px; font-size: 19px; line-height: 1.5; }
.method__tech { margin-top: 16px; max-width: 760px; font-size: 16px; line-height: 1.55; color: var(--ink-2); }

/* Подвал */

.footer { border-top: 1px solid var(--line); padding: 32px 0 48px; font-size: 15px; }
.footer__in { display: grid; gap: 6px; }
.footer__muted { color: var(--ink-3); max-width: 760px; }

/* ---------- Игра ---------- */

.play { padding-bottom: 96px; }

.start { max-width: 760px; padding: 56px 0 24px; }
.start h1 { font-size: 64px; line-height: 1.02; letter-spacing: -.035em; font-weight: 700; }
.steps { list-style: none; margin: 40px 0 0; padding: 0; counter-reset: step; display: grid; gap: 0; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; padding: 18px 0; border-top: 1px solid var(--line); font-size: 18px; line-height: 1.45; }
.steps li::before { content: counter(step); font-weight: 700; font-size: 22px; line-height: 1.2; color: var(--ink-3); }
.steps b { font-weight: 600; }
.start__actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.roles { margin-top: 56px; font-size: 15px; color: var(--ink-3); line-height: 1.6; }

.progress { display: flex; gap: 6px; padding: 24px 0 0; flex-wrap: wrap; }
.progress__cell {
  width: 44px; height: 44px; display: grid; place-items: center; gap: 0;
  font: inherit; font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums;
  background: var(--paper); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; padding: 0;
  transition: border-color .15s;
}
.progress__cell:hover { border-color: #aaa; }
.progress__cell.is-current { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.progress__cell.is-done { background: var(--soft); color: var(--ink); }
.progress__stars { display: block; font-size: 9px; line-height: 1; letter-spacing: 1px; color: var(--star); }
.progress__stars i { font-style: normal; color: #d8d8d8; }
.progress__num { display: block; line-height: 1.1; }

.task { padding: 32px 0 28px; max-width: 820px; }
.task__role { font-size: 15px; color: var(--ink-3); }
.task__title { margin-top: 6px; font-size: 40px; line-height: 1.1; letter-spacing: -.025em; font-weight: 700; }
.task__aud { margin-top: 14px; font-size: 20px; line-height: 1.45; }
.task__aud b { font-weight: 600; }
.task__hint { margin-top: 18px; font-size: 15px; color: var(--ink-2); }

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

/* Разбор */

.result { padding-top: 8px; }
.result__top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 32px; align-items: end; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.score { font-size: 96px; line-height: .9; font-weight: 700; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.score small { font-size: 22px; font-weight: 400; letter-spacing: 0; color: var(--ink-3); }
.stars { font-size: 28px; letter-spacing: 4px; color: var(--star); line-height: 1; }
.stars i { font-style: normal; color: #ddd; }
.verdict { margin-top: 10px; font-size: 20px; line-height: 1.4; max-width: 560px; }

.compare { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.compare__label { font-size: 14px; color: var(--ink-3); }
.compare__value { margin-top: 4px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.compare__value .arrow { color: var(--ink-3); font-weight: 400; }
.compare__value .was { color: var(--ink-3); font-weight: 400; }
.compare__goal { margin-top: 4px; font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.compare__goal.is-ok { color: var(--ok); }
.compare__pts { margin-top: 2px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.result__grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; padding-top: 32px; align-items: start; }
.text-view { border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
.result__aside .goals { margin-top: 0; padding-top: 0; border-top: 0; }
.result__aside .goals + .goals { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.result__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }

.ideal { margin-top: 28px; padding: 24px 28px; background: var(--soft); border-radius: 4px; }
.ideal__text { margin-top: 10px; font-size: 19px; line-height: 1.6; white-space: pre-wrap; }
.ideal__meta { margin-top: 14px; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ideal__note { margin-top: 6px; font-size: 14px; color: var(--ink-3); }

.final { max-width: 860px; padding: 56px 0 24px; }
.final h1 { font-size: 56px; line-height: 1.05; letter-spacing: -.035em; font-weight: 700; }
.final__score { margin-top: 28px; font-size: 22px; }
.final__list { list-style: none; margin: 36px 0 0; padding: 0; }
.final__list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 17px; align-items: baseline; }
.final__list .muted { color: var(--ink-3); font-size: 15px; }
.final__list .stars { font-size: 16px; letter-spacing: 2px; }

/* ---------- Адаптив ---------- */

@media (max-width: 1080px) {
  .rule { grid-template-columns: 44px minmax(0, 1fr); }
  .rule__ex { grid-column: 2; margin-top: 16px; padding-left: 16px; border-left: 2px solid var(--line); }
  .method__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  .workspace, .result__grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .result__aside { margin-top: 32px; }
  .panel { position: sticky; top: 0; z-index: 5; max-height: none; overflow: visible; order: -1; margin: 0 -40px 16px; padding: 12px 40px; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  .metrics { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 14px; grid-auto-flow: column; }
  .metric__value { font-size: 24px; }
  .metric__value small { font-size: 13px; }
  .metric__sub { font-size: 12px; line-height: 1.3; min-height: 2.6em; }
  .bar { margin-top: 6px; }
  .panel .goals, .panel .note { display: none; }
  .goals--mobile { display: grid; margin-top: 20px; }
  .goals--mobile:empty { display: none; }
  .issue-group { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .promo__in { grid-template-columns: minmax(0, 1fr); }
  .compare { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  :root { --text: 17px; }
  .wrap { padding: 0 16px; }
  .top__in { gap: 18px; }
  .top__nav { gap: 16px; }
  .top__author { display: none; }
  .intro { padding-top: 36px; padding-bottom: 28px; }
  .intro h1, .start h1 { font-size: 40px; }
  .lead { font-size: 18px; }
  .panel { margin: 0 -16px 12px; padding: 10px 16px; }
  .metrics { gap: 10px; }
  .metric__label { font-size: 12px; }
  .metric__value { font-size: 20px; }
  .metric__value small { display: none; }
  .metric__sub { font-size: 11px; }
  .editor__layer, .editor__input, .text-view { padding: 20px 18px 28px; }
  .editor__input { min-height: 240px; }
  .rules h2, .method h2, .promo h2 { font-size: 30px; }
  .rules, .method { padding-top: 48px; padding-bottom: 48px; }
  .rule { grid-template-columns: 32px minmax(0, 1fr); gap: 0 12px; }
  .rule::before { font-size: 20px; }
  .rule__title { font-size: 19px; }
  .rule__ex { padding-left: 12px; }
  .method__grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .task__title { font-size: 30px; }
  .task__aud { font-size: 17px; }
  .progress { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 16px 16px 0; scrollbar-width: none; }
  .progress::-webkit-scrollbar { display: none; }
  .progress__cell { flex: none; width: 40px; height: 40px; }
  .score { font-size: 72px; }
  .result__top { grid-template-columns: minmax(0, 1fr); }
  .compare__value { font-size: 22px; }
  .final h1 { font-size: 36px; }
}
