/* Balloon — светлый задачник команды. Графит + мятный цвет «Accepted». */

:root {
  --bg: #f3f4f7;
  --surface: #ffffff;
  --sunken: #f6f7f9;
  --ink: #11131a;
  --ink-2: #545b6e;
  --ink-3: #8a90a2;
  --line: #e6e8ee;
  --line-2: #d8dbe3;

  --mint: #12a86b;
  --mint-hover: #0f975f;
  --mint-ink: #0b7a4d;
  --mint-soft: #e2f5eb;
  --red: #e5484d;
  --red-soft: #fdeced;
  --amber: #c27400;
  --amber-soft: #fff2d9;
  --violet: #6e4ff0;
  --violet-soft: #efebfe;
  --sky: #2f7de1;
  --sky-soft: #e5f0fd;

  --code-bg: #12141b;
  --code-line: #20232d;

  --font: "Geologica", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-card: 20px;
  --r-ctl: 11px;
  --r-tile: 9px;

  --shadow: 0 1px 2px rgb(17 19 26 / .04), 0 4px 16px -8px rgb(17 19 26 / .08);
  --shadow-lift: 0 2px 4px rgb(17 19 26 / .04), 0 16px 32px -16px rgb(17 19 26 / .18);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a.link { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a.link:hover { text-decoration-color: var(--ink); }

:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; border-radius: 8px; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }

.i { width: 20px; height: 20px; flex: none; }

.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.nums { font-variant-numeric: tabular-nums; }

/* ---------- оболочка ---------- */

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

.side {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 22px 16px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; font-weight: 700; font-size: 18px; letter-spacing: -.03em; }
.brand svg { width: 32px; height: 32px; flex: none; }

.side__group { display: grid; gap: 2px; }
.side__group + .side__group { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.side__caption { padding: 0 12px 6px; font-size: 13px; color: var(--ink-3); }

.side a.nav {
  display: flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 12px;
  border-radius: var(--r-ctl);
  color: var(--ink-2);
  font-weight: 500;
  transition: background-color .15s, color .15s;
}
.side a.nav:hover { background: var(--sunken); color: var(--ink); }
.side a.nav[aria-current="page"] { background: var(--ink); color: #fff; }

.side__foot { margin-top: auto; display: grid; gap: 10px; }
.me { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 14px; background: var(--sunken); }
.me__text { min-width: 0; flex: 1; line-height: 1.25; }
.me__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me__role { font-size: 13px; color: var(--ink-3); }
.me form { display: contents; }

.guest { display: grid; gap: 8px; }

/* узкая боковая панель на странице задачи */
.app--rail { grid-template-columns: 76px minmax(0, 1fr); }
.app--rail .side { padding-inline: 12px; align-items: center; }
.app--rail .brand { padding: 0 0 22px; }
.app--rail .brand span, .app--rail .nav span, .app--rail .side__caption, .app--rail .me__text, .app--rail .guest .btn span { display: none; }
.app--rail .side a.nav { width: 46px; justify-content: center; padding: 0; }
.app--rail .side__group + .side__group { width: 100%; display: flex; flex-direction: column; align-items: center; }
.app--rail .me { padding: 6px; background: none; flex-direction: column; }
.app--rail .guest .btn { width: 46px; padding: 0; }

.main { min-width: 0; padding: 30px 40px 72px; }
.page { max-width: 1180px; margin: 0 auto; }

/* ---------- элементы ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border: 0; border-radius: var(--r-ctl);
  background: var(--ink); color: #fff;
  font: 500 15px/1 var(--font);
  white-space: nowrap; cursor: pointer;
  transition: background-color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: #2a2e3b; }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn .i { width: 18px; height: 18px; }
.btn--mint { background: var(--mint); }
.btn--mint:hover { background: var(--mint-hover); }
.btn--light { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn--light:hover { background: var(--sunken); }
.btn--soft { background: var(--sunken); color: var(--ink); }
.btn--soft:hover { background: #eceef2; }
.btn--danger { background: var(--surface); color: var(--red); box-shadow: inset 0 0 0 1px #f4c7c9; }
.btn--danger:hover { background: var(--red-soft); }
.btn--sm { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn--lg { height: 48px; padding: 0 22px; font-size: 15.5px; border-radius: 13px; }
.btn--icon { width: 34px; padding: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px;
  border-radius: 999px;
  background: var(--sunken);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-2);
  font-size: 13.5px; font-weight: 500;
  white-space: nowrap;
}
.chip .i { width: 15px; height: 15px; }
.chip--mint, .chip--live { background: var(--mint-soft); box-shadow: none; color: var(--mint-ink); }
.chip--live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--mint); animation: live 1.6s ease-in-out infinite; }
.chip--amber { background: var(--amber-soft); box-shadow: none; color: var(--amber); }
@keyframes live { 50% { opacity: .35; } }

.avatar {
  --a: #d9f3e6; --a-ink: #0b7a4d;
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--a); color: var(--a-ink);
  font-weight: 600; font-size: 13.5px;
}
.avatar--sm { width: 28px; height: 28px; border-radius: 9px; font-size: 12px; }
.avatar[data-a="sky"] { --a: #e1edfc; --a-ink: #1f63bd; }
.avatar[data-a="violet"] { --a: #ece7fe; --a-ink: #5a3bd6; }
.avatar[data-a="amber"] { --a: #fdefd2; --a-ink: #9a5b00; }
.avatar[data-a="rose"] { --a: #fde4e6; --a-ink: #c22f3f; }
.avatar[data-a="slate"] { --a: #e7e9ef; --a-ink: #3d4354; }

/* плитка задачи: буква + статус */
.tile {
  --t-bg: var(--surface); --t-fg: var(--ink); --t-ring: var(--line-2);
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; flex: none;
  border-radius: var(--r-tile);
  background: var(--t-bg); color: var(--t-fg);
  box-shadow: inset 0 0 0 1px var(--t-ring);
  font-weight: 600; font-size: 14px;
}
.tile--solved { --t-bg: var(--mint); --t-fg: #fff; --t-ring: transparent; }
.tile--tried { --t-bg: var(--red-soft); --t-fg: var(--red); --t-ring: #f6cdd0; }
.tile--lg { width: 48px; height: 48px; border-radius: 14px; font-size: 20px; }
.tile--sm { width: 26px; height: 26px; border-radius: 8px; font-size: 12.5px; }
.tile.is-pop { animation: pop .6s ease-out; }
@keyframes pop { from { background: var(--surface); color: var(--ink); } }

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

.bar { height: 6px; border-radius: 6px; background: #eceef2; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--mint); }

/* полоса прогресса из отрезков: одна задача — один отрезок */
.segments { display: flex; gap: 4px; height: 10px; }
.segments i { flex: 1; min-width: 4px; border-radius: 3px; background: #e6e8ee; }
.segments i.solved { background: var(--mint); }
.segments i.tried { background: #f3b5b8; }

/* ---------- заголовок страницы ---------- */

.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.phead h1 { font-size: 30px; letter-spacing: -.03em; }
.phead p { margin: 6px 0 0; color: var(--ink-2); }
.crumbs { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--ink-3); font-size: 14px; }
.crumbs a:hover { color: var(--ink); }
.crumbs .i { width: 14px; height: 14px; }

.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------- главная ---------- */

.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: center; gap: 24px;
  padding: 34px 36px;
  overflow: hidden;
}
.hero h1 { font-size: 34px; letter-spacing: -.035em; }
.hero p { margin: 10px 0 0; max-width: 52ch; color: var(--ink-2); font-size: 16px; }
.hero .segments { margin-top: 24px; max-width: 520px; }
.hero__count { margin-top: 10px; font-size: 14px; color: var(--ink-3); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero__art { width: 330px; height: 290px; margin: -40px -24px -48px 0; object-fit: contain; justify-self: end; }

.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; margin-top: 32px; align-items: start; }
.dash--single { grid-template-columns: minmax(0, 1fr); }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.block-head h2 { font-size: 19px; }

.contests { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ccard { display: flex; flex-direction: column; gap: 14px; padding: 22px; transition: box-shadow .2s, border-color .2s; }
.ccard:hover { box-shadow: var(--shadow-lift); border-color: var(--line-2); }
.ccard__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ccard h3 { font-size: 18px; }
.ccard__desc { margin: -6px 0 0; color: var(--ink-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ccard__foot { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 4px; font-size: 13.5px; color: var(--ink-3); }
.ccard__foot .bar { flex: 1; }

.aside { display: grid; gap: 16px; }
.panel { padding: 20px 20px 10px; }
.panel h2 { font-size: 16px; margin-bottom: 8px; }
.feed { list-style: none; margin: 0 -8px; padding: 0; }
.feed li a { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 12px; }
.feed li a:hover { background: var(--sunken); }
.feed__text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.35; }
.feed__text b { font-weight: 600; }
.feed__text span { display: block; color: var(--ink-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed__empty { padding: 2px 0 12px; color: var(--ink-3); font-size: 14px; }


.empty { display: grid; justify-items: center; text-align: center; padding: 34px 28px 40px; }
.empty img { width: 160px; height: 160px; object-fit: contain; margin-bottom: 4px; }
.empty h2 { font-size: 20px; }
.empty p { margin: 8px 0 20px; max-width: 44ch; color: var(--ink-2); }
.empty p:last-child { margin-bottom: 0; }

/* ---------- контест ---------- */

.chead { margin-bottom: 22px; }
.chead__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.chead h1 { font-size: 30px; letter-spacing: -.03em; }

.timer { display: grid; gap: 10px; min-width: 250px; padding: 14px 18px 16px; }
.timer__row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.timer__label { font-size: 13.5px; color: var(--ink-3); }
.timer__value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.timer--upcoming .timer__value { color: var(--amber); }
.timer--finished .timer__value { font-size: 15px; color: var(--ink-2); }

.tabs { display: flex; gap: 4px; margin-top: 22px; padding: 4px; width: fit-content; max-width: 100%; overflow-x: auto; border-radius: 14px; background: #e8eaef; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(17 19 26 / .08); }
.tabs .i { width: 17px; height: 17px; }

.plist { list-style: none; margin: 0; padding: 6px; }
.plist li + li { border-top: 1px solid var(--line); }
.plist a { display: grid; grid-template-columns: auto minmax(0, 1fr) 150px auto auto; align-items: center; gap: 16px; padding: 14px; border-radius: 14px; }
.plist a:hover { background: var(--sunken); }
.plist__name { font-weight: 600; font-size: 16px; }
.plist__limits { color: var(--ink-3); font-size: 13.5px; margin-top: 2px; }
.plist__stat { display: grid; gap: 6px; font-size: 13px; color: var(--ink-3); }
.plist__me { justify-self: end; min-width: 0; }
.plist .i { color: var(--ink-3); }

.about { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.rules { padding: 22px; }
.rules h3 { font-size: 15px; margin-bottom: 12px; }
.rules ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; font-size: 14px; color: var(--ink-2); }
.rules b { color: var(--ink); font-weight: 600; }
.rules .prose { font-size: 14px; color: var(--ink-2); margin-bottom: 18px; }

.gate { display: grid; justify-items: center; text-align: center; padding: 44px 28px; }
.gate img { width: 150px; height: 150px; object-fit: contain; }
.gate h2 { font-size: 22px; margin-top: 8px; }
.gate p { margin: 8px 0 0; color: var(--ink-2); }
.gate .timer__value { font-size: 40px; margin-top: 18px; color: var(--amber); }

/* ---------- задача ---------- */

.ptop { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.ptop .crumbs { margin: 0; }
.pnav { display: flex; gap: 6px; flex-wrap: wrap; }
.pnav a { border-radius: var(--r-tile); }
.pnav a[aria-current="page"] .tile { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }

.solve { display: grid; grid-template-columns: minmax(0, 1fr) minmax(460px, 47%); gap: 20px; align-items: start; }

.statement { padding: 34px 38px 38px; min-width: 0; }
.statement__head { display: flex; align-items: center; gap: 16px; }
.statement__head h1 { font-size: 26px; letter-spacing: -.025em; }
.statement__limits { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.prose { max-width: 72ch; font-size: 16px; line-height: 1.7; color: #262a36; }
.prose p { margin: 0 0 .85em; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 600; color: var(--ink); }
.prose code { font: 400 .88em var(--mono); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); padding: .1em .4em; border-radius: 6px; }
.prose pre { background: var(--sunken); border-radius: 12px; padding: 14px 16px; overflow-x: auto; }
.prose pre code { background: none; box-shadow: none; padding: 0; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 .85em; }
.prose table { border-collapse: collapse; margin: 0 0 1em; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 12px; }
.prose .katex { font-size: 1.05em; }

.part { margin-top: 30px; }
.part > h2 { font-size: 16px; margin-bottom: 10px; }

.samples { display: grid; gap: 12px; }
.sample { display: grid; grid-template-columns: 1fr 1fr; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--sunken); }
.sample__col + .sample__col { border-left: 1px solid var(--line); }
.sample__head { display: flex; align-items: center; justify-content: space-between; height: 38px; padding: 0 6px 0 14px; color: var(--ink-3); font-size: 13px; font-weight: 500; border-bottom: 1px solid var(--line); background: var(--surface); }
.sample pre { margin: 0; padding: 12px 14px 14px; font: 400 13.5px/1.6 var(--mono); font-variant-ligatures: none; overflow-x: auto; white-space: pre; }
.copy { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); font: 500 13px var(--font); cursor: pointer; }
.copy:hover { background: var(--sunken); color: var(--ink); }
.copy .i { width: 15px; height: 15px; }
.copy.is-done { color: var(--mint-ink); }

.workbench { position: sticky; top: 24px; display: grid; gap: 14px; }

.editor { border-radius: var(--r-card); background: var(--code-bg); overflow: hidden; box-shadow: 0 20px 40px -24px rgb(17 19 26 / .55); }
.editor__bar { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--code-line); }
.editor__dots { display: flex; gap: 6px; margin-right: 6px; }
.editor__dots i { width: 10px; height: 10px; border-radius: 50%; background: #2c303c; }
.editor__lang { color: #e9eaf0; font-weight: 500; font-size: 14px; }
.editor__lang span { color: #6c7286; margin-left: 6px; font-weight: 400; }
.editor__file { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 9px; color: #b6bacb; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.editor__file:hover { background: #1d2029; color: #fff; }
.editor__file .i { width: 16px; height: 16px; }

.code {
  --lh: 21px;
  position: relative;
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  height: clamp(320px, calc(100vh - 330px), 680px);
  font: 400 13.5px/var(--lh) var(--mono);
  font-variant-ligatures: none;
  tab-size: 4;
}
.code__gutter { margin: 0; padding: 14px 12px 14px 16px; min-width: 50px; text-align: right; color: #434858; overflow: hidden; user-select: none; white-space: pre; font: inherit; }
.code__area { position: relative; overflow: hidden; }
.code__hl, .code__input {
  position: absolute; inset: 0;
  margin: 0; padding: 14px 16px 14px 4px;
  font: inherit; letter-spacing: 0; tab-size: inherit;
  white-space: pre; overflow-wrap: normal; word-break: normal;
  border: 0;
}
.code__hl { pointer-events: none; color: #dfe1ea; overflow: hidden; }
.code__hl code { font: inherit; display: block; will-change: transform; }
.code__input { width: 100%; height: 100%; resize: none; outline: none; background: transparent; color: transparent; caret-color: #fff; overflow: auto; }
.code__input::selection { background: rgb(18 168 107 / .35); color: transparent; }
.code__input::placeholder { color: #434858; }
.tok-k { color: #c792ea; }
.tok-t { color: #7fdbca; }
.tok-s { color: #ecc48d; }
.tok-n { color: #f78c6c; }
.tok-c { color: #5c637a; font-style: italic; }
.tok-p { color: #82aaff; }

.editor__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 18px; border-top: 1px solid var(--code-line); }
.editor__hint { color: #6c7286; font-size: 13px; }
.editor__hint kbd { font: 500 12px var(--font); padding: 2px 6px; border-radius: 5px; background: #1d2029; color: #b6bacb; }

.locked { display: grid; justify-items: center; text-align: center; padding: 30px 28px 34px; }
.locked img { width: 130px; height: 130px; object-fit: contain; }
.locked p { color: var(--ink-2); margin: 6px 0 18px; }

.mine { padding: 8px; }
.mine__head { padding: 8px 10px 10px; font-weight: 600; font-size: 15px; }
.mine__list { list-style: none; margin: 0; padding: 0; max-height: 264px; overflow-y: auto; }
.mine__list a { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 9px 10px; border-radius: 12px; font-size: 14px; }
.mine__list a:hover { background: var(--sunken); }
.mine__empty { padding: 0 10px 12px; color: var(--ink-3); font-size: 14px; }

/* ---------- вердикты ---------- */

.verdict { --v: var(--ink-2); --v-bg: #eceef2; display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px 0 9px; border-radius: 999px; background: var(--v-bg); color: var(--v); font-weight: 500; font-size: 13.5px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.verdict::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.verdict--ok { --v: var(--mint-ink); --v-bg: var(--mint-soft); }
.verdict--wa { --v: #c9323a; --v-bg: var(--red-soft); }
.verdict--tl, .verdict--ml { --v: var(--amber); --v-bg: var(--amber-soft); }
.verdict--re { --v: var(--violet); --v-bg: var(--violet-soft); }
.verdict--pending { --v: var(--sky); --v-bg: var(--sky-soft); }
.verdict--pending::before { animation: live 1s ease-in-out infinite; }

/* ---------- таблицы ---------- */

.table-card { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { height: 46px; padding: 0 16px; text-align: left; font-weight: 500; font-size: 13px; color: var(--ink-3); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .12s; }
.table tbody tr:hover { background: #fafbfc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .center { text-align: center; }
.who { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
.pcell { display: inline-flex; align-items: center; gap: 10px; }

.board th.pcol, .board td.cell { width: 74px; text-align: center; padding-inline: 4px; }
.board th.pcol .tile { vertical-align: middle; }
.board td { height: 64px; }
.board .rank { width: 64px; text-align: center; }
.rank-badge { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rank-badge--1 { background: var(--ink); box-shadow: none; color: #fff; }
.board .solved { width: 80px; text-align: center; font-weight: 700; font-size: 18px; }
.board .penalty { width: 96px; text-align: center; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.board tr.is-me { background: #f6fbf8; }
.board tfoot td { height: 46px; color: var(--ink-3); font-size: 13px; text-align: center; background: var(--sunken); border-top: 1px solid var(--line); border-bottom: 0; }

.hit { display: grid; place-content: center; gap: 1px; width: 58px; height: 46px; margin: 0 auto; border-radius: 12px; line-height: 1.15; }
.hit b { font-weight: 600; font-size: 15px; }
.hit small { font-size: 11.5px; font-variant-numeric: tabular-nums; opacity: .8; }
.hit--ok { background: var(--mint-soft); color: var(--mint-ink); }
.hit--first { background: var(--mint); color: #fff; }
.hit--no { color: var(--red); }
.hit--wait { color: var(--sky); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 16px; color: var(--ink-3); font-size: 13.5px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 16px; height: 16px; border-radius: 5px; }


/* ---------- посылка ---------- */

.sub-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.sub-head h1 { font-size: 26px; }
.sub-head .verdict { height: 36px; padding: 0 16px 0 13px; font-size: 15px; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin: 22px 0 0; }
.facts div { padding: 16px 20px; }
.facts div + div { border-left: 1px solid var(--line); }
.facts dt { color: var(--ink-3); font-size: 13px; }
.facts dd { margin: 4px 0 0; font-weight: 600; font-size: 16px; }

.tests { display: flex; flex-wrap: wrap; gap: 5px; padding: 18px 20px; border-top: 1px solid var(--line); }
.tests i { width: 26px; height: 26px; border-radius: 8px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; font: 500 11px var(--font); color: var(--ink-3); font-style: normal; }
.tests i.pass { background: var(--mint-soft); box-shadow: none; color: var(--mint-ink); }
.tests i.fail { background: var(--red); box-shadow: none; color: #fff; font-weight: 600; }

.listing { margin-top: 16px; border-radius: var(--r-card); background: var(--code-bg); overflow: auto; }
.listing pre { margin: 0; padding: 18px 0; font: 400 13.5px/21px var(--mono); font-variant-ligatures: none; color: #dfe1ea; counter-reset: ln; }
.listing pre span { display: block; padding: 0 20px 0 0; }
.listing pre span::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 52px; padding-right: 18px; text-align: right; color: #434858; user-select: none; }
.log { margin: 16px 0 0; padding: 16px 18px; border-radius: 16px; background: var(--red-soft); border: 1px solid #f6cdd0; font: 400 13px/1.6 var(--mono); white-space: pre-wrap; overflow-x: auto; color: #8f1d24; }

/* ---------- вход ---------- */

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; }
.auth { display: grid; grid-template-columns: 1fr 1fr; width: min(940px, 100%); overflow: hidden; }
.auth__form { padding: 40px 44px; }
.auth__form .brand { padding: 0 0 36px; }
.auth h1 { font-size: 28px; letter-spacing: -.03em; }
.auth__lead { color: var(--ink-2); margin: 8px 0 26px; }
.auth form { display: grid; gap: 16px; }
.auth form .btn { width: 100%; margin-top: 6px; }
.auth__alt { margin-top: 20px; color: var(--ink-2); font-size: 14px; }
.auth__art { display: grid; place-items: center; background: var(--sunken); border-left: 1px solid var(--line); padding: 32px; }
.auth__art img { width: 100%; max-width: 360px; aspect-ratio: 1; object-fit: contain; }

.field { display: grid; gap: 7px; }
.field > span { font-weight: 500; font-size: 14px; }
.field small { color: var(--ink-3); font-size: 13px; }
.input, .textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  padding: 10px 13px;
  transition: border-color .15s, box-shadow .15s;
}
.input { height: 44px; }
.input:hover, .textarea:hover { border-color: #c4c8d3; }
.input:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgb(17 19 26 / .07); }
.textarea { resize: vertical; min-height: 110px; }
.textarea--code { font: 400 13.5px/1.55 var(--mono); font-variant-ligatures: none; background: var(--sunken); }

.notice { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin: 0 0 20px; border-radius: 12px; background: var(--mint-soft); color: var(--mint-ink); font-weight: 500; }
.notice--error { background: var(--red-soft); color: #c9323a; }

/* ---------- настройки (администратор) ---------- */

.form-card { padding: 28px; }
.form-card + .form-card { margin-top: 16px; }
.form-card > h2 { font-size: 18px; }
.form-card > p { color: var(--ink-2); margin: 6px 0 0; }
.form-grid { display: grid; gap: 18px; margin-top: 22px; }
.form-grid--2 { grid-template-columns: 1fr 1fr; }
.form-grid--3 { grid-template-columns: 2fr 1fr 1fr; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 22px; }
.form-actions .spacer { flex: 1; }

.switch { display: flex; align-items: flex-start; gap: 14px; padding: 16px; border-radius: 14px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.switch input { appearance: none; flex: none; width: 40px; height: 24px; margin: 0; border-radius: 999px; background: #cdd1db; position: relative; cursor: pointer; transition: background-color .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: transform .15s; }
.switch input:checked { background: var(--mint); }
.switch input:checked::after { transform: translateX(16px); }
.switch b { display: block; font-weight: 600; }
.switch span { color: var(--ink-2); font-size: 14px; }
.timing[hidden] { display: none; }

.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; font-size: 14.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--mint); }

.adminlist { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.adminlist li { display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 12px; border-radius: 14px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
.adminlist__title { flex: 1; min-width: 0; }
.adminlist__title a { font-weight: 600; }
.adminlist__title div { color: var(--ink-3); font-size: 13.5px; margin-top: 1px; }
.adminlist form { display: contents; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: #e6e8ee; color: var(--ink); }
.icon-btn.is-active { background: #e6e8ee; color: var(--ink); }
.icon-btn[disabled] { opacity: .3; pointer-events: none; }
.icon-btn .i { width: 18px; height: 18px; }

.ttable td.io { max-width: 280px; }
.ttable td.io code { display: block; font: 400 12.5px/1.5 var(--mono); color: var(--ink-2); white-space: pre; overflow: hidden; text-overflow: ellipsis; max-height: 3em; }
.ttable .actions { display: flex; gap: 4px; justify-content: flex-end; }
.ttable form { display: inline; }
.tag { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font: 500 12.5px var(--font); background: var(--mint-soft); color: var(--mint-ink); border: 0; cursor: pointer; }
.tag--off { background: var(--surface); color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line-2); }

.drop { display: grid; gap: 12px; padding: 20px; border: 1.5px dashed var(--line-2); border-radius: 14px; color: var(--ink-2); font-size: 14px; }
.drop code { font: 400 12.5px var(--mono); background: var(--sunken); padding: 1px 5px; border-radius: 5px; }
.drop input[type=file] { color: var(--ink-2); font: 14px var(--font); }
.drop input[type=file]::file-selector-button { margin-right: 12px; height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: var(--ink); color: #fff; font: 500 14px var(--font); cursor: pointer; }

.danger-zone { border-color: #f6d3d5; box-shadow: none; }

/* ---------- тост «задача решена» ---------- */

.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px 14px 14px;
  border-radius: 16px;
  background: var(--ink); color: #fff;
  box-shadow: 0 20px 40px -12px rgb(17 19 26 / .45);
  animation: toast-in .35s ease-out;
}
.toast__check { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--mint); }
.toast b { display: block; font-weight: 600; }
.toast span { color: #9da3b6; font-size: 13.5px; }
.toast.is-out { animation: toast-out .3s ease forwards; }
@keyframes toast-in { from { opacity: 0; } }
@keyframes toast-out { to { opacity: 0; } }

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

@media (max-width: 1180px) {
  .dash { grid-template-columns: 1fr; }
  .aside { grid-template-columns: 1fr 1fr; }
  .solve { grid-template-columns: 1fr; }
  .workbench { position: static; }
  .about { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app, .app--rail { grid-template-columns: 1fr; }
  .side, .app--rail .side {
    position: sticky; top: 0; z-index: 30;
    height: auto; flex-direction: row; align-items: center; gap: 4px;
    padding: 10px 14px; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand, .app--rail .brand { padding: 0 8px 0 0; }
  .brand span { display: none; }
  .side__group, .side__group + .side__group, .app--rail .side__group + .side__group { display: flex; flex-direction: row; margin: 0; padding: 0; border: 0; width: auto; }
  .side__caption { display: none; }
  .side a.nav, .app--rail .side a.nav { width: auto; height: 38px; padding: 0 12px; }
  .side a.nav span { display: none; }
  .side__foot { margin: 0 0 0 auto; display: flex; }
  .me, .app--rail .me { padding: 4px; background: none; flex-direction: row; }
  .me__text { display: none; }
  .guest { display: flex; }
  .guest .btn span { display: none; }
  .main { padding: 22px 16px 56px; }
  .hero { grid-template-columns: 1fr; padding: 26px 22px; }
  .hero__art { display: none; }
  .aside { grid-template-columns: 1fr; }
  .plist a { grid-template-columns: auto minmax(0, 1fr) auto; }
  .plist__stat, .plist a > .i { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth__art { display: none; }
  .auth__form { padding: 32px 26px; }
  .form-grid--2, .form-grid--3 { grid-template-columns: 1fr; }
  .statement { padding: 24px 20px; }
  .sample { grid-template-columns: 1fr; }
  .sample__col + .sample__col { border-left: 0; border-top: 1px solid var(--line); }
  .facts div + div { border-left: 0; }
}

/* ---------- теги ---------- */

.tag-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: #eef0f4; color: var(--ink-2); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.statement__limits .tag-chip { height: 28px; padding: 0 10px; border-radius: 999px; font-size: 13.5px; }
.plist__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.filter { height: 30px; padding: 0 11px; border: 0; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink-2); font: 500 13.5px var(--font); cursor: pointer; transition: background-color .15s, color .15s; }
.filter:hover { color: var(--ink); background: var(--sunken); }
.filter.is-on { background: var(--ink); color: #fff; box-shadow: none; }
.plist li[hidden] { display: none; }

/* ---------- анимации ---------- */

/* появление при загрузке: блоки и строки плавно проявляются по очереди */
.rise { animation: rise .5s ease-out both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; } }

/* полосы прогресса заполняются */
.bar > i { transform-origin: left center; animation: grow 1s cubic-bezier(.2, .8, .2, 1) .3s both; }
@keyframes grow { from { transform: scaleX(0); } }
.segments i { animation: seg .45s ease-out both; animation-delay: calc(.25s + var(--i, 0) * 45ms); }
.segments i.solved, .segments i.tried { animation-name: seg, seg-fill; animation-duration: .45s, .6s; }
@keyframes seg { from { opacity: 0; } }
@keyframes seg-fill { from { background: #e6e8ee; } }

/* по клику на иллюстрацию главной вылетают шарики */
.hero__art { cursor: pointer; }

.pnav .tile { transition: box-shadow .15s, background-color .15s; }
.pnav a:hover .tile:not(.tile--solved):not(.tile--tried) { background: var(--sunken); }

/* блик на кнопке отправки */
.btn--mint { position: relative; overflow: hidden; }
.btn--mint::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / .35) 50%, transparent 70%); transform: translateX(-120%); }
.btn--mint:hover::after { transform: translateX(120%); transition: transform .7s ease; }

/* новый вердикт подсвечивается */
.mine__list li.is-fresh a { animation: flash 1.4s ease-out; }
.mine__list li.is-fresh-ok a { animation: flash-ok 1.6s ease-out; }
@keyframes flash { from { background: #eceef2; } }
@keyframes flash-ok { from { background: var(--mint-soft); } }

/* «решил первым» поблёскивает */
.hit--first { background: linear-gradient(110deg, var(--mint) 42%, #4fd19a 50%, var(--mint) 58%) var(--mint); background-size: 300% 100%; animation: shimmer 3.2s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }

/* стайка шариков при решении задачи */
.sky { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.flyer {
  position: absolute; left: 0; top: 0;
  width: var(--w);
  animation: fly var(--dur) cubic-bezier(.4, .05, .5, 1) var(--delay) both;
}
.flyer img {
  display: block; width: 100%; height: auto;
  transform-origin: 50% 25%;
  filter: drop-shadow(0 12px 18px rgb(17 19 26 / .16));
  animation: sway var(--sway) ease-in-out var(--delay) infinite alternate;
}
@keyframes fly {
  0% { transform: translate(calc(var(--x) - 50%), calc(var(--y) + 30px)) scale(.3); opacity: 0; }
  12% { transform: translate(calc(var(--x) - 50%), calc(var(--y) - 40px)) scale(1); opacity: 1; }
  100% { transform: translate(calc(var(--x) - 50% + var(--drift)), -140vh) scale(1); opacity: 1; }
}
@keyframes sway { from { transform: rotate(calc(var(--rot) * -1)); } to { transform: rotate(var(--rot)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.oops { max-width: 560px; margin: 60px auto 0; }
.mine__list .verdict, .table .verdict { justify-self: start; }
