:root {
  --accent: #f4741c;
  --accent-hover: #ff8533;
  --accent-soft: rgba(244, 116, 28, 0.13);
  --accent-line: rgba(244, 116, 28, 0.4);

  --ok: #3fb950;
  --ok-soft: rgba(63, 185, 80, 0.16);
  --bad: #f85149;
  --bad-soft: rgba(248, 81, 73, 0.16);

  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Code", Consolas, monospace;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root, [data-theme="dark"] {
  --bg: #191919;
  --topbar-bg: rgba(25, 25, 25, 0.7);
  --code: #232323;
  --ink: #f1f1f1;
  --muted: #a8a8a8;
  --line: #2f2f2f;
  --hairline: rgba(255, 255, 255, 0.075);
  --glass: rgba(255, 255, 255, 0.055);
  --glass-line: rgba(255, 255, 255, 0.12);
  --t-key: #9cdcfe;
  --t-str: #ce9178;
  --t-num: #b5cea8;
  --t-bool: #569cd6;
  --t-null: #569cd6;
}

[data-theme="light"] {
  --bg: #ffffff;
  --topbar-bg: rgba(255, 255, 255, 0.7);
  --code: #f7f6f3;
  --ink: #37352f;
  --muted: #787774;
  --line: #e9e9e7;
  --hairline: rgba(55, 53, 47, 0.09);
  --glass: rgba(55, 53, 47, 0.05);
  --glass-line: rgba(55, 53, 47, 0.12);
  --t-key: #0451a5;
  --t-str: #a31515;
  --t-num: #098658;
  --t-bool: #0000ff;
  --t-null: #0000ff;
}

* { box-sizing: border-box; }

html { scrollbar-gutter: stable both-edges; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
b, strong { font-weight: 600; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
}
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 14px 40px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -0.1px; }
.brand-logo { width: 30px; height: 30px; object-fit: contain; }
.theme-toggle {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  background: transparent; border: 0;
  color: var(--muted); cursor: pointer;
  transition: color .3s var(--ease), background .35s var(--ease), transform .35s var(--ease);
}
.theme-toggle:hover { color: var(--accent); background: var(--glass); transform: rotate(12deg); }
.theme-toggle:active { transform: scale(0.8) rotate(-20deg); }
.theme-toggle svg { width: 20px; height: 20px; animation: iconIn .5s var(--ease); }

.layout {
  width: 100%; max-width: 1240px; margin: 0 auto;
  padding: 44px 40px 90px;
  display: grid; grid-template-columns: 256px 1fr; gap: 60px; align-items: start;
}
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; gap: 24px; padding: 28px 20px 70px; }
  .nav { position: static !important; }
  .tabs {
    flex-direction: row !important; flex-wrap: wrap;
    max-height: none; overflow: visible; padding-bottom: 0;
    -webkit-mask-image: none; mask-image: none;
  }
}
#trainer:not([hidden]) { animation: fadeUp .5s var(--ease); }

.nav { position: sticky; top: 100px; align-self: start; }
.progress-row { display: flex; align-items: center; margin-bottom: 18px; padding: 0 14px; }
.progress { font-size: 13px; color: var(--muted); }
.progress b { color: var(--accent); font-weight: 700; }
.reset-mini { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; cursor: pointer; font-family: inherit; transition: color .25s var(--ease); }
.reset-mini:hover { color: var(--accent); }

.tabs {
  display: flex; flex-direction: column; gap: 3px;
  max-height: min(calc(100vh - 190px), 486px); overflow-y: auto; padding-bottom: 36px;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 52px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 52px), transparent);
}
.tabs::-webkit-scrollbar { width: 0; height: 0; }
.tabs { scrollbar-width: none; }
.tab {
  display: flex; align-items: center; width: 100%; text-align: left;
  padding: 11px 14px; border-radius: 11px; border: 0;
  background: transparent; color: var(--muted);
  font-size: 14.5px; font-weight: 500; cursor: pointer; font-family: inherit;
  transition: color .25s var(--ease), background .25s var(--ease);
}
.tab:hover { background: var(--glass); color: var(--ink); }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tab.done::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

.main { min-width: 0; }
.brief { margin-bottom: 30px; }
.brief-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--accent); font-weight: 700; }
.mode-title { font-weight: 700; font-size: 30px; line-height: 1.12; letter-spacing: -0.6px; margin: 12px 0 14px; }
.mode-desc { color: var(--ink); font-size: 16px; font-weight: 500; line-height: 1.6; margin: 0 0 18px; max-width: 760px; }

.theory { border-bottom: 1px solid var(--line); padding: 0 0 16px; margin-top: 4px; }
.theory-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.theory-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .42s var(--ease); }
.theory-wrap.open { grid-template-rows: 1fr; }
.theory-wrap > .brief-theory { overflow: hidden; min-height: 0; }
.theory-wrap.open > .brief-theory { padding-top: 12px; }
.theory-toggle { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 0; background: transparent; border: 0; color: var(--accent); font-size: 14px; font-weight: 500; cursor: pointer; font-family: inherit; transition: color .25s var(--ease); }
.theory-toggle:hover { color: var(--accent-hover); }
.theory-arrow { width: 16px; height: 16px; transition: transform .42s var(--ease); }
.theory-toggle.open .theory-arrow { transform: rotate(180deg); }
.brief-theory { color: var(--ink); font-size: 14.5px; line-height: 1.78; max-width: 760px; }
.brief-theory code { font-family: var(--mono); background: var(--code); color: var(--accent); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
.brief-theory b { color: var(--ink); }

.work { min-width: 0; }
.card { margin-bottom: 16px; }
.brief > *, .card > * { animation: fadeUp .4s var(--ease) backwards; }
.brief > *:nth-child(2), .card > *:nth-child(2) { animation-delay: .05s; }
.brief > *:nth-child(3), .card > *:nth-child(3) { animation-delay: .1s; }
.brief > *:nth-child(4), .card > *:nth-child(4) { animation-delay: .15s; }
.card > *:nth-child(5) { animation-delay: .2s; }
.json-grid > * { animation: fadeUp .4s var(--ease) backwards; }
.json-grid > *:nth-child(2) { animation-delay: .09s; }
.editor { margin-top: 14px; }
.task-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.task-bar .step { font-size: 13px; color: var(--muted); }
.task-bar .counter { font-size: 14px; color: var(--ink); }
.task-bar .counter b { color: var(--accent); }
.prompt { font-size: 16px; font-weight: 500; margin: 0 0 16px; color: var(--ink); line-height: 1.5; }
.prompt b { color: var(--accent); }

.json-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .json-grid { grid-template-columns: 1fr; } }
.json-box {
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  font-family: var(--mono); font-size: 14.5px; line-height: 1.85;
  overflow-x: auto; white-space: pre; color: var(--ink);
  transition: border-color .3s var(--ease);
}
.json-box .label { display: block; font-family: var(--sans); font-size: 10.5px; letter-spacing: 0.7px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
.tok { border-radius: 5px; padding: 0 2px; transition: background .3s var(--ease), outline-color .3s var(--ease); }
.tok[data-path] { cursor: pointer; }
.tok-key { color: var(--t-key); }
.tok-str { color: var(--t-str); }
.tok-num { color: var(--t-num); }
.tok-bool { color: var(--t-bool); }
.tok-null { color: var(--t-null); }
.tok.sel-ok { background: var(--ok-soft); outline: 1px solid var(--ok); animation: popIn .32s var(--ease); }
.tok.sel-bad { background: var(--bad-soft); outline: 1px solid var(--bad); }

.codeblock { white-space: normal; padding: 14px 12px; }
.codeline { display: block; white-space: pre; padding: 2px 10px; border-radius: 6px; cursor: pointer; transition: background .25s var(--ease); }
.codeline:hover { background: rgba(127, 127, 127, 0.12); }
.codeline.sel-ok { background: var(--ok-soft); outline: 1px solid var(--ok); animation: popIn .32s var(--ease); }
.codeline.sel-bad { background: var(--bad-soft); outline: 1px solid var(--bad); }

.editor {
  width: 100%; min-height: 220px;
  font-family: var(--mono); font-size: 14.5px; line-height: 1.7;
  padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--code);
  color: var(--ink); resize: none; tab-size: 2;
  transition: border-color .25s var(--ease);
}
.editor:focus { outline: none; border-color: var(--muted); }

.spec { margin: 0 0 14px; border: 1px solid var(--glass-line); border-radius: 16px; overflow: hidden; }
.spec-row { display: grid; grid-template-columns: 1fr 130px 1fr; border-top: 1px solid var(--line); }
.spec-row:first-child { border-top: 0; }
.spec-row > div { padding: 12px 16px; font-size: 14.5px; }
.spec-row .k { font-family: var(--mono); color: var(--accent); }
.spec-row .t { color: var(--muted); font-size: 12.5px; align-self: center; }
.spec-row .v { font-family: var(--mono); color: var(--ink); }
.spec-head { background: var(--glass); }
.spec-head > div { padding: 9px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }

.convert { display: flex; align-items: center; gap: 16px; margin: 4px 0 6px; flex-wrap: wrap; }
.convert .from { font-family: var(--mono); font-size: 16px; background: var(--code); color: var(--ink); padding: 11px 15px; border-radius: 11px; border: 1px solid var(--line); }
.convert .arrow { color: var(--accent); font-size: 18px; }
.answer-input { font-family: var(--mono); font-size: 16px; padding: 11px 15px; border-radius: 11px; border: 1px solid var(--line); background: var(--code); color: var(--ink); min-width: 240px; transition: border-color .25s var(--ease); }
.answer-input:focus { outline: none; border-color: var(--muted); }

.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn { border: 0; border-radius: 12px; padding: 11px 22px; font-size: 14.5px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background .25s var(--ease), transform .15s var(--ease), border-color .25s var(--ease); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--glass); color: var(--ink); border: 1px solid var(--glass-line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn-ghost:hover { border-color: var(--muted); }
.feedback { margin-top: 18px; padding: 13px 16px; border-radius: 12px; font-size: 14.5px; display: none; }
.feedback.show { display: block; animation: fadeUp .3s var(--ease); }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }

.intro { max-width: 740px; margin: 0 auto; padding: 40px 24px 40px; animation: fadeUp .5s var(--ease); }
.intro-eyebrow { font-size: 13px; color: var(--accent); font-weight: 600; letter-spacing: .3px; }
.intro-title { font-size: 44px; font-weight: 800; letter-spacing: -1.2px; margin: 10px 0 22px; }
.intro-hero {
  display: flex; align-items: center; gap: 22px;
  border: 1px solid var(--glass-line); border-radius: 22px;
  padding: 38px 36px; margin: 0 0 36px;
  background: linear-gradient(135deg, rgba(244, 116, 28, 0.16), rgba(244, 116, 28, 0.03));
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.hero-glyph { flex: 0 0 auto; width: 84px; height: 84px; border-radius: 20px; display: grid; place-items: center; font-family: var(--mono); font-size: 38px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.hero-name { line-height: 1.04; }
.hero-name span { display: block; font-size: 34px; font-weight: 800; letter-spacing: -1px; }
.hero-name b { display: block; font-size: 19px; font-weight: 500; color: var(--muted); }
.hero-tag { margin-left: auto; align-self: flex-start; font-size: 12px; color: var(--muted); border: 1px solid var(--glass-line); padding: 5px 12px; border-radius: 999px; }
.intro-block { margin-bottom: 20px; }
.intro-block h2 { font-size: 18px; font-weight: 700; margin: 0 0 8px; }
.intro-block p { color: var(--ink); font-size: 15.5px; font-weight: 500; line-height: 1.72; margin: 0 0 10px; }
.intro-block ul { color: var(--ink); font-size: 15.5px; font-weight: 500; line-height: 1.7; margin: 0; padding-left: 20px; }
.intro-block li { margin-bottom: 8px; }
.intro-block li::marker { color: var(--muted); }
.intro-start { display: block; margin: 22px auto 0; background: var(--ink); color: var(--bg); font-size: 15px; padding: 14px 32px; transition: filter .25s var(--ease); }
.intro-start:hover { filter: brightness(0.88); }
.intro-start:active { filter: brightness(0.78); }
@media (max-width: 640px) { .intro { padding: 34px 20px 70px; } .intro-title { font-size: 32px; } .intro-hero { padding: 26px 22px; flex-wrap: wrap; } }

.site-footer { margin-top: auto; position: relative; }
.site-footer::before { content: ""; position: absolute; top: 0; left: 44px; right: 44px; height: 1px; background: var(--line); }
.site-footer-inner {
  max-width: 1240px; margin: 0 auto; padding: 20px 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.footer-ver { font-size: 13px; color: var(--muted); letter-spacing: .2px; }
.footer-credit {
  font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none;
  transition: color .25s var(--ease);
}
.footer-credit:hover { color: var(--accent); }
@media (max-width: 640px) { .site-footer-inner { padding: 9px 20px; } }

@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes popIn { 0% { transform: scale(0.5); } 55% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes iconIn { from { opacity: 0; transform: rotate(-130deg) scale(0.35); } to { opacity: 1; transform: rotate(0) scale(1); } }

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

/* ---------- DevTools-тренажёр ---------- */
.where {
  font-size: 13.5px; color: var(--muted); line-height: 1.6;
  background: var(--glass); border: 1px solid var(--glass-line);
  border-radius: 12px; padding: 11px 15px; margin: 0 0 18px;
}
.where b { color: var(--ink); }
.where code,
.prompt code { font-family: var(--mono); background: var(--code); color: var(--accent); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
.feedback code { font-family: var(--mono); background: rgba(127, 127, 127, 0.16); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

.ran-note { font-size: 13px; color: var(--ok); align-self: center; }

.judge { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.btn-judge { background: var(--glass); border: 1px solid var(--glass-line); color: var(--ink); min-width: 134px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn-judge.bug:hover { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
.btn-judge.ok:hover { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }

.preview-wrap { margin: 2px 0 20px; }
.pv-card { background: var(--code); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; max-width: 360px; }
.pv-title { margin: 0 0 8px; font-weight: 700; line-height: 1.3; color: var(--ink); }
.pv-price { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.pv-btn { border: 0; border-radius: 10px; padding: 10px 20px; color: #fff; font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }

.pv-phone { width: 300px; border: 1px solid var(--glass-line); border-radius: 26px; padding: 14px 10px; background: var(--glass); }
.pv-screen { background: var(--bg); border-radius: 16px; padding: 14px; overflow-x: auto; }
.pv-phone .pv-card { background: var(--bg); }

.vform { display: flex; gap: 10px; margin: 6px 0 10px; flex-wrap: wrap; }
.vmsg { font-size: 13.5px; min-height: 18px; line-height: 1.5; }
.vmsg.ok { color: var(--ok); }
.vmsg.bad { color: var(--bad); }

/* ---------- DevTools: своя раскладка (не как в JSON) ---------- */
.intro { max-width: 900px; }
.intro-lead { font-size: 17px; font-weight: 500; line-height: 1.66; color: var(--ink); margin: 0 0 30px; max-width: 720px; }
.intro-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0 0 26px; }
@media (max-width: 700px) { .intro-cards { grid-template-columns: 1fr; } }
.intro-card {
  border: 1px solid var(--glass-line); border-radius: 18px; padding: 22px 20px;
  background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: fadeUp .5s var(--ease) backwards;
}
.intro-cards .intro-card:nth-child(2) { animation-delay: .08s; }
.intro-cards .intro-card:nth-child(3) { animation-delay: .16s; }
.ic-num { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 1px; }
.intro-card h2 { font-size: 16.5px; font-weight: 700; margin: 12px 0 7px; }
.intro-card p { font-size: 14px; font-weight: 500; line-height: 1.6; color: var(--muted); margin: 0; }
.intro-hint { font-size: 14px; color: var(--muted); line-height: 1.6; border-left: 2px solid var(--accent); padding: 4px 0 4px 14px; margin: 0 0 4px; }
.intro-hint b { color: var(--ink); }

.workbench { width: 100%; max-width: 880px; margin: 0 auto; padding: 40px 40px 90px; }
@media (max-width: 640px) { .workbench { padding: 26px 18px 70px; } }

.stepbar { display: flex; align-items: flex-end; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.steplist { display: flex; gap: 2px; overflow-x: auto; flex: 1 1 auto; scrollbar-width: none; }
.steplist::-webkit-scrollbar { height: 0; }
.stepbar-meta { display: flex; align-items: center; gap: 14px; padding-bottom: 12px; flex: 0 0 auto; }
@media (max-width: 640px) { .stepbar { flex-direction: column; align-items: stretch; gap: 10px; } .stepbar-meta { padding-bottom: 8px; } }

.step-pill {
  position: relative; white-space: nowrap; border: 0; background: transparent; cursor: pointer;
  font-family: inherit; color: var(--muted); font-size: 14px; font-weight: 500;
  padding: 11px 15px 14px; border-radius: 9px 9px 0 0;
  transition: color .25s var(--ease), background .25s var(--ease);
}
.step-pill:hover { color: var(--ink); background: var(--glass); }
.step-pill.active { color: var(--accent); font-weight: 600; }
.step-pill.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; animation: fadeUp .3s var(--ease); }
.step-pill .pn { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--muted); margin-right: 8px; }
.step-pill.active .pn { color: var(--accent); }
.step-pill.done .pn { color: var(--ok); }

.canvas { min-width: 0; animation: fadeUp .4s var(--ease); }

/* ---------- ревизия: минимализм + плавность ---------- */
.intro-cards { gap: 30px; }
.intro-card { border: 0; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0; }
.intro-card h2 { margin: 10px 0 6px; }
.ic-num { font-family: var(--sans); font-weight: 700; }

.steplist { flex: 1 1 0; min-width: 0; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); }
.step-pill .pn { font-family: var(--sans); font-size: 13px; font-weight: 500; margin-right: 7px; }

.where { background: transparent; border: 0; border-left: 2px solid var(--accent-line); border-radius: 0; padding: 3px 0 3px 14px; margin: 0 0 20px; }

.judge { gap: 12px; margin-top: 10px; }
.btn-judge { transition: color .3s var(--ease), background .3s var(--ease), border-color .3s var(--ease), transform .18s var(--ease); }
.btn-judge:active { transform: translateY(1px) scale(.985); }

.preview-wrap { animation: fadeUp .4s var(--ease); }

/* ---------- ревизия 2: тело задания как в референсе ---------- */
.card > .prompt { margin-bottom: 16px; }

.codebox { background: var(--code); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; font-family: var(--mono); font-size: 13.5px; line-height: 1.75; color: var(--ink); overflow-x: auto; margin: 0 0 20px; white-space: pre; }

.hint { margin: 0 0 20px; }
.hint-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.hint-body { font-size: 14.5px; color: var(--ink); line-height: 1.6; }

.formcard { background: var(--code); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; margin: 0 0 22px; max-width: 440px; }
.formcard-label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 13px; }
.formcard-body { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover { opacity: 0.9; }

.verdict-label { font-size: 13px; color: var(--muted); margin: 0 0 10px; }

.judge { gap: 12px; }
.btn-judge { background: var(--code); border: 1px solid var(--line); color: var(--ink); min-width: 142px; font-weight: 600; }
.btn-judge:hover,
.btn-judge.bug:hover,
.btn-judge.ok:hover { background: var(--glass); border-color: var(--muted); color: var(--ink); }

.prompt code, .hint-body code, .feedback code, .where code {
  font-family: var(--mono); font-size: 12.5px; padding: 1px 6px; border-radius: 6px;
  background: rgba(47, 111, 219, 0.13); color: #2f6fdb;
}
[data-theme="dark"] .prompt code, [data-theme="dark"] .hint-body code, [data-theme="dark"] .feedback code, [data-theme="dark"] .where code {
  background: rgba(121, 184, 255, 0.15); color: #79b8ff;
}
.hl { font-family: var(--mono); font-size: 12.5px; padding: 1px 6px; border-radius: 6px; }
.hl-g { background: rgba(46, 160, 67, 0.16); color: #2ea043; }
.hl-b { background: rgba(47, 111, 219, 0.14); color: #2f6fdb; }
.hl-p { background: rgba(137, 87, 229, 0.16); color: #8957e5; }

/* ---------- ревизия 3 ---------- */
.workbench { max-width: 1000px; }

.btn-judge { transition: color .3s var(--ease), background .3s var(--ease), border-color .3s var(--ease), transform .18s var(--ease); }
.btn-judge:disabled { cursor: default; }
.btn-judge.correct { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.btn-judge.wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); animation: shakeX .4s var(--ease); }
@keyframes shakeX { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.btn.loading { opacity: .6; }

.post { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.post:empty { margin: 0; }

.vform { margin: 0; }
.vmsg { margin-top: 10px; min-height: 0; }
.vmsg:empty { display: none; }

/* ---------- ревизия 4: сайдбар + полировка ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; gap: 52px; max-width: 1280px; margin: 0 auto; padding: 40px 44px 90px; align-items: start; }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; gap: 22px; padding: 26px 18px 70px; } }
#trainer:not([hidden]) { animation: fadeUp .5s var(--ease); }
.side { position: sticky; top: 88px; align-self: start; }
@media (max-width: 860px) { .side { position: static; } }
.side-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 0 12px; }
.sidenav { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 860px) { .sidenav { flex-direction: row; flex-wrap: wrap; } }
.snav-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer; font-family: inherit; color: var(--muted); font-size: 14.5px; font-weight: 500; padding: 10px 12px; border-radius: 9px; transition: color .22s var(--ease), background .22s var(--ease); }
.snav-item:hover { background: var(--glass); color: var(--ink); }
.snav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.snav-item .pn { font-size: 12.5px; color: var(--muted); min-width: 16px; text-align: right; }
.snav-item.active .pn { color: var(--accent); }
.snav-item.done .pn { color: var(--ok); }
.content { min-width: 0; }

.btn-judge:disabled { pointer-events: none; }
.btn-judge.bug:hover { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
.btn-judge.ok:hover { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }

.card > * { animation: fadeUp .42s var(--ease) backwards; }
.card > *:nth-child(1) { animation-delay: 0s; }
.card > *:nth-child(2) { animation-delay: .05s; }
.card > *:nth-child(3) { animation-delay: .1s; }
.card > *:nth-child(4) { animation-delay: .15s; }
.card > *:nth-child(5) { animation-delay: .2s; }
.card > *:nth-child(6) { animation-delay: .25s; }
.card > *:nth-child(7) { animation-delay: .3s; }

.preview-wrap .pv-card { max-width: 320px; }

/* ---------- ревизия 5: верхние табы + широкий контент + картинки ---------- */
.workbench { max-width: 1160px; }
.pv-imgwrap { margin: 0 0 4px; }
.pv-img { display: block; width: 320px; max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--code); min-height: 96px; }

/* ---------- ревизия 6: форма по содержимому + статус действия ---------- */
.formcard { width: -moz-fit-content; width: fit-content; max-width: 100%; }
.formcard-body { flex-wrap: wrap; align-items: center; }
.act-status { font-size: 13px; font-weight: 700; color: var(--ok); }

/* ---------- ревизия 7: две колонки «Стенд | Проверка» ---------- */
.bench { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 820px) { .bench { grid-template-columns: 1fr; gap: 22px; } }

.stage-body { min-height: 150px; overflow-x: auto; }
.stage-body .preview-wrap, .stage-body .pv-card { margin: 0; }
.stage-body .pv-imgwrap { display: flex; flex-direction: column; align-items: center; }
.pv-broken { width: 320px; max-width: 100%; min-height: 200px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border: 1px dashed var(--line); border-radius: 12px; background: var(--code); color: var(--muted); font-size: 13px; }
.stend { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--bg); }
.stend-bar { display: flex; align-items: center; gap: 9px; padding: 9px 12px; background: var(--code); border-bottom: 1px solid var(--line); }
.stend-dots { display: flex; gap: 5px; }
.stend-dots i { display: block; width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.stend-url { font-size: 11px; color: var(--muted); font-family: var(--mono, ui-monospace, monospace); }
.stend-body { box-sizing: border-box; padding: 20px 18px 22px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.stend-line { height: 10px; border-radius: 5px; background: var(--code); }
.stend-line.w1 { width: 58%; height: 14px; }
.stend-line.w2 { width: 88%; }
.stend-line.w3 { width: 66%; margin-bottom: 10px; }
.stend-body .btn-dark { margin-top: 2px; }
.btn-dark.spent { opacity: .5; cursor: default; }

.verdict .prompt { font-size: 15px; line-height: 1.55; margin: 0 0 14px; }
.verdict .codebox { margin: 0 0 14px; }
.verdict-q { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.verdict .judge { display: flex; gap: 10px; margin: 0; }
.verdict .judge .btn-judge { flex: 1 1 0; }
.btn-judge:disabled { opacity: .4; cursor: default; }

.result-slot { margin-top: 14px; min-height: 60px; box-sizing: border-box; display: flex; align-items: center; border: 1px dashed var(--line); border-radius: 12px; padding: 12px 16px; font-size: 14.5px; line-height: 1.6; color: var(--muted); transition: background .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease); }
.result-inner { flex: 1; min-width: 0; }
.result-slot.ok { border-style: solid; border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.result-slot.bad { border-style: solid; border-color: transparent; background: var(--bad-soft); color: var(--bad); }
.result-slot code { font-size: 13px; }
.post { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }

/* аккуратный перенос: не оставляем одинокое слово на последней строке */
.prompt, .mode-desc, .brief-theory, .intro-lead, .hint-body, .result-slot { text-wrap: pretty; }

/* стрелки прокрутки вкладок (для тачпада/мыши без горизонтального колеса) */
.tab-arrow { flex: 0 0 auto; align-self: flex-end; background: none; border: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 4px 11px; cursor: pointer; transition: color .15s var(--ease); }
.tab-arrow:hover { color: var(--accent); }
.tab-arrow[hidden] { display: none; }

/* ---------- ревизия 8: скелетон картинки + плавные поочерёдные появления ---------- */
html { scroll-behavior: smooth; }
.pv-skel { width: 320px; max-width: 100%; height: 220px; border-radius: 12px; background: var(--code); border: 1px solid var(--line); position: relative; overflow: hidden; }
.pv-skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(140, 140, 140, .16), transparent); animation: shimmer 1.25s var(--ease) infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.pv-img { opacity: 0; transition: opacity .45s var(--ease); }
.pv-img.loaded { opacity: 1; }
.pv-broken { animation: fadeUp .4s var(--ease) both; }

/* каждый элемент проявляется отдельно, с нарастающей задержкой */
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.brief > *, .bench .stage, .verdict > *, .intro > *, .intro-card { animation: riseIn .55s var(--ease) both; }
.brief > *:nth-child(1) { animation-delay: .02s; }
.brief > *:nth-child(2) { animation-delay: .07s; }
.brief > *:nth-child(3) { animation-delay: .12s; }
.brief > *:nth-child(4) { animation-delay: .17s; }
.bench .stage { animation-delay: .2s; }
.verdict > *:nth-child(1) { animation-delay: .26s; }
.verdict > *:nth-child(2) { animation-delay: .32s; }
.verdict > *:nth-child(3) { animation-delay: .38s; }
.verdict > *:nth-child(4) { animation-delay: .44s; }
.verdict > *:nth-child(5) { animation-delay: .5s; }
.verdict > *:nth-child(6) { animation-delay: .56s; }
.intro > *:nth-child(1) { animation-delay: .04s; }
.intro > *:nth-child(2) { animation-delay: .1s; }
.intro > *:nth-child(3) { animation-delay: .16s; }
.intro > *:nth-child(4) { animation-delay: .22s; }
.intro > *:nth-child(5) { animation-delay: .28s; }
.intro-cards .intro-card:nth-child(1) { animation-delay: .18s; }
.intro-cards .intro-card:nth-child(2) { animation-delay: .26s; }
.intro-cards .intro-card:nth-child(3) { animation-delay: .34s; }

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