/* BASICS */

.CodeMirror {
  /* Set height, width, borders, and global font properties here */
  font-family: monospace;
  height: 300px;
  color: black;
  direction: ltr;
}

/* PADDING */

.CodeMirror-lines {
  padding: 4px 0; /* Vertical padding around content */
}
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
  padding: 0 4px; /* Horizontal padding of content */
}

.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
  background-color: white; /* The little square between H and V scrollbars */
}

/* GUTTER */

.CodeMirror-gutters {
  border-right: 1px solid #ddd;
  background-color: #f7f7f7;
  white-space: nowrap;
}
.CodeMirror-linenumbers {}
.CodeMirror-linenumber {
  padding: 0 3px 0 5px;
  min-width: 20px;
  text-align: right;
  color: #999;
  white-space: nowrap;
}

.CodeMirror-guttermarker { color: black; }
.CodeMirror-guttermarker-subtle { color: #999; }

/* CURSOR */

.CodeMirror-cursor {
  border-left: 1px solid black;
  border-right: none;
  width: 0;
}
/* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor {
  border-left: 1px solid silver;
}
.cm-fat-cursor .CodeMirror-cursor {
  width: auto;
  border: 0 !important;
  background: #7e7;
}
.cm-fat-cursor div.CodeMirror-cursors {
  z-index: 1;
}
.cm-fat-cursor .CodeMirror-line::selection,
.cm-fat-cursor .CodeMirror-line > span::selection, 
.cm-fat-cursor .CodeMirror-line > span > span::selection { background: transparent; }
.cm-fat-cursor .CodeMirror-line::-moz-selection,
.cm-fat-cursor .CodeMirror-line > span::-moz-selection,
.cm-fat-cursor .CodeMirror-line > span > span::-moz-selection { background: transparent; }
.cm-fat-cursor { caret-color: transparent; }
@-moz-keyframes blink {
  0% {}
  50% { background-color: transparent; }
  100% {}
}
@-webkit-keyframes blink {
  0% {}
  50% { background-color: transparent; }
  100% {}
}
@keyframes blink {
  0% {}
  50% { background-color: transparent; }
  100% {}
}

/* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror-overwrite .CodeMirror-cursor {}

.cm-tab { display: inline-block; text-decoration: inherit; }

.CodeMirror-rulers {
  position: absolute;
  left: 0; right: 0; top: -50px; bottom: 0;
  overflow: hidden;
}
.CodeMirror-ruler {
  border-left: 1px solid #ccc;
  top: 0; bottom: 0;
  position: absolute;
}

/* DEFAULT THEME */

.cm-s-default .cm-header {color: blue;}
.cm-s-default .cm-quote {color: #090;}
.cm-negative {color: #d44;}
.cm-positive {color: #292;}
.cm-header, .cm-strong {font-weight: bold;}
.cm-em {font-style: italic;}
.cm-link {text-decoration: underline;}
.cm-strikethrough {text-decoration: line-through;}

.cm-s-default .cm-keyword {color: #708;}
.cm-s-default .cm-atom {color: #219;}
.cm-s-default .cm-number {color: #164;}
.cm-s-default .cm-def {color: #00f;}
.cm-s-default .cm-variable,
.cm-s-default .cm-punctuation,
.cm-s-default .cm-property,
.cm-s-default .cm-operator {}
.cm-s-default .cm-variable-2 {color: #05a;}
.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
.cm-s-default .cm-comment {color: #a50;}
.cm-s-default .cm-string {color: #a11;}
.cm-s-default .cm-string-2 {color: #f50;}
.cm-s-default .cm-meta {color: #555;}
.cm-s-default .cm-qualifier {color: #555;}
.cm-s-default .cm-builtin {color: #30a;}
.cm-s-default .cm-bracket {color: #997;}
.cm-s-default .cm-tag {color: #170;}
.cm-s-default .cm-attribute {color: #00c;}
.cm-s-default .cm-hr {color: #999;}
.cm-s-default .cm-link {color: #00c;}

.cm-s-default .cm-error {color: #f00;}
.cm-invalidchar {color: #f00;}

.CodeMirror-composing { border-bottom: 2px solid; }

/* Default styles for common addons */

div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
.CodeMirror-activeline-background {background: #e8f2ff;}

/* STOP */

/* The rest of this file contains styles related to the mechanics of
   the editor. You probably shouldn't touch them. */

.CodeMirror {
  position: relative;
  overflow: hidden;
  background: white;
}

.CodeMirror-scroll {
  overflow: scroll !important; /* Things will break if this is overridden */
  /* 50px is the magic margin used to hide the element's real scrollbars */
  /* See overflow: hidden in .CodeMirror */
  margin-bottom: -50px; margin-right: -50px;
  padding-bottom: 50px;
  height: 100%;
  outline: none; /* Prevent dragging from highlighting the element */
  position: relative;
  z-index: 0;
}
.CodeMirror-sizer {
  position: relative;
  border-right: 50px solid transparent;
}

/* The fake, visible scrollbars. Used to force redraw during scrolling
   before actual scrolling happens, thus preventing shaking and
   flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
  position: absolute;
  z-index: 6;
  display: none;
  outline: none;
}
.CodeMirror-vscrollbar {
  right: 0; top: 0;
  overflow-x: hidden;
  overflow-y: scroll;
}
.CodeMirror-hscrollbar {
  bottom: 0; left: 0;
  overflow-y: hidden;
  overflow-x: scroll;
}
.CodeMirror-scrollbar-filler {
  right: 0; bottom: 0;
}
.CodeMirror-gutter-filler {
  left: 0; bottom: 0;
}

.CodeMirror-gutters {
  position: absolute; left: 0; top: 0;
  min-height: 100%;
  z-index: 3;
}
.CodeMirror-gutter {
  white-space: normal;
  height: 100%;
  display: inline-block;
  vertical-align: top;
  margin-bottom: -50px;
}
.CodeMirror-gutter-wrapper {
  position: absolute;
  z-index: 4;
  background: none !important;
  border: none !important;
}
.CodeMirror-gutter-background {
  position: absolute;
  top: 0; bottom: 0;
  z-index: 4;
}
.CodeMirror-gutter-elt {
  position: absolute;
  cursor: default;
  z-index: 4;
}
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }

.CodeMirror-lines {
  cursor: text;
  min-height: 1px; /* prevents collapsing before first draw */
}
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
  /* Reset some styles that the rest of the page might have set */
  -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
  border-width: 0;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  margin: 0;
  white-space: pre;
  word-wrap: normal;
  line-height: inherit;
  color: inherit;
  z-index: 2;
  position: relative;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-variant-ligatures: contextual;
  font-variant-ligatures: contextual;
}
.CodeMirror-wrap pre.CodeMirror-line,
.CodeMirror-wrap pre.CodeMirror-line-like {
  word-wrap: break-word;
  white-space: pre-wrap;
  word-break: normal;
}

.CodeMirror-linebackground {
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 0;
  z-index: 0;
}

.CodeMirror-linewidget {
  position: relative;
  z-index: 2;
  padding: 0.1px; /* Force widget margins to stay inside of the container */
}

.CodeMirror-widget {}

.CodeMirror-rtl pre { direction: rtl; }

.CodeMirror-code {
  outline: none;
}

/* Force content-box sizing for the elements where we expect it */
.CodeMirror-scroll,
.CodeMirror-sizer,
.CodeMirror-gutter,
.CodeMirror-gutters,
.CodeMirror-linenumber {
  -moz-box-sizing: content-box;
  box-sizing: content-box;
}

.CodeMirror-measure {
  position: absolute;
  width: 100%;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}

.CodeMirror-cursor {
  position: absolute;
  pointer-events: none;
}
.CodeMirror-measure pre { position: static; }

div.CodeMirror-cursors {
  visibility: hidden;
  position: relative;
  z-index: 3;
}
div.CodeMirror-dragcursors {
  visibility: visible;
}

.CodeMirror-focused div.CodeMirror-cursors {
  visibility: visible;
}

.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-crosshair { cursor: crosshair; }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }

.cm-searching {
  background-color: #ffa;
  background-color: rgba(255, 255, 0, .4);
}

/* Used to force a border model for a node */
.cm-force-border { padding-right: .1px; }

@media print {
  /* Hide the cursor when printing */
  .CodeMirror div.CodeMirror-cursors {
    visibility: hidden;
  }
}

/* See issue #2901 */
.cm-tab-wrap-hack:after { content: ''; }

/* Help users use markselection to safely style text background */
span.CodeMirror-selectedtext { background: none; }

/* Пробный КЕГЭ — внешний вид станции КЕГЭ (единая светлая тема, как на экзамене) */
:root {
  --navy: #22365B;
  --navy-2: #2f4775;
  --head-fg: #E2F3FF;
  --teal: #087475;
  --bg: #E7EDF9;
  --card: #FFFFFF;
  --line: #C9D3E6;
  --line-2: #DDE4F1;
  --fg: #1E2A40;
  --muted: #5B6880;
  --green: #00E1A5;
  --green-fg: #01584A;
  --green-soft: #E3FBF3;
  --red: #F89187;
  --red-fg: #B23A2E;
  --amber: #B86E00;
  --amber-soft: #FFF4E0;
  --shadow: 0 2px 6px rgba(0, 0, 0, .15);
  --mono: "Cascadia Mono", Consolas, "Liberation Mono", Menlo, monospace;
  color-scheme: light;
}
/* Станция КЕГЭ всегда светлая: поля ввода и полосы прокрутки не темнеют и в тёмной теме просмотрщика. */
html:root, html:root[data-theme], html:root[data-theme="dark"], html body { color-scheme: light !important; }
input, textarea, select { background-color: #fff; color: var(--fg); }
input[type="checkbox"] { accent-color: var(--navy); }
.instr code, .taskbody code { font-family: var(--mono); font-size: .92em; background: #EEF2FA; padding: 0 4px; border-radius: 3px; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 "Segoe UI", "Segoe UI Variable", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #6aa7ff; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  background: var(--navy); color: var(--head-fg);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  min-height: 64px;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 31; background: var(--navy); }
.brand { font-size: 26px; font-weight: 300; text-transform: uppercase; letter-spacing: .04em; line-height: 1.1; margin-right: auto; min-width: 0; }
.brand small { display: block; font-size: 12px; letter-spacing: .12em; opacity: .75; margin-top: 3px; }
.net { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--head-fg); background: rgba(255, 255, 255, .08); border-radius: 18px; padding: 5px 12px; }
.net i { width: 9px; height: 9px; border-radius: 50%; background: #39d98a; flex: none; }
.net.off i { background: #ff8a7a; }
.net.wait i { background: #ffc24a; }
.timer { background: #fff; border: 1px solid var(--teal); color: var(--teal); font-size: 22px; font-variant-numeric: tabular-nums; padding: 2px 14px; border-radius: 4px; letter-spacing: .03em; }
.timer.low { color: var(--red-fg); border-color: var(--red-fg); }
.btn-finish { background: transparent; border: 1px solid var(--head-fg); color: var(--head-fg); border-radius: 4px; padding: 7px 14px; font-size: 15px; }
.btn-finish:hover { background: rgba(255, 255, 255, .12); }

/* ---------- макетная панель ---------- */
.mock {
  display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap;
  background: #FFF8E6; border-bottom: 1px solid #F0DCA8; color: #6B4A00; font-size: 13px;
  padding-block: 6px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.mock b { font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 11px; background: #F0DCA8; padding: 1px 7px; border-radius: 3px; }
.mock label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.mock button { background: none; border: none; color: #6B4A00; text-decoration: underline; padding: 0; font-size: 13px; }

/* ---------- общие экраны ---------- */
.screen { padding-block: 28px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.sheet { max-width: 860px; margin: 0 auto; background: var(--card); border-radius: 8px; box-shadow: var(--shadow); padding: 28px clamp(18px, 4vw, 40px); }
.sheet h1 { font-size: 26px; font-weight: 600; color: var(--navy); margin: 0 0 6px; text-wrap: balance; }
.sheet h2 { font-size: 19px; color: var(--navy); margin: 26px 0 8px; }
.sheet p { margin: 8px 0; max-width: 68ch; }
.lead { color: var(--muted); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 18px; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field span { font-size: 13px; color: var(--muted); }
.field input, .field select { height: 42px; border: 1px solid var(--line); border-radius: 5px; padding: 0 12px; background: #fff; width: 100%; }
.field input:focus, .field select:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(34, 54, 91, .15); }
.row-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 22px; }
.btn { border-radius: 5px; padding: 10px 20px; border: 1px solid transparent; font-size: 16px; line-height: 1.2; }
.btn-main { background: var(--navy); color: #fff; }
.btn-main:hover { background: var(--navy-2); }
.btn-main:disabled { opacity: .55; cursor: default; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--navy); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-green { background: var(--green); color: var(--green-fg); font-weight: 600; }
.btn-green:hover { filter: brightness(.96); }
.btn-red { background: #fff; border-color: var(--red); color: var(--red-fg); }
.btn-red:hover { background: #FFF3F1; }
.hint { font-size: 14px; color: var(--muted); }
.err { color: var(--red-fg); font-size: 14px; min-height: 1.4em; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 18px 0 4px; }
.fact { border: 1px solid var(--line-2); border-radius: 6px; padding: 10px 14px; }
.fact b { display: block; font-size: 22px; color: var(--navy); font-variant-numeric: tabular-nums; }
.fact span { font-size: 13px; color: var(--muted); }
.instr ol { padding-left: 22px; max-width: 70ch; }
.instr li { margin: 7px 0; }

/* ---------- экзамен: приложение на весь экран, прокрутка внутри панелей ---------- */
body.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.app #app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.app .top { position: static; }
.exam { display: flex; align-items: stretch; flex: 1; min-height: 0; }
.side { width: 116px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 0 16px; min-height: 0; }
.side .given { text-align: center; color: var(--navy); line-height: 1.15; }
.side .given small { display: block; font-size: 13px; }
.side .given b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.navlist { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 12px; scrollbar-width: thin; }
.sq { width: 30px; height: 30px; flex: none; border-radius: 6px; border: 1px solid transparent; background: #fff; color: var(--navy); box-shadow: var(--shadow); font-size: 14px; line-height: 28px; text-align: center; padding: 0; font-variant-numeric: tabular-nums; position: relative; }
.sq:hover { border-color: var(--navy); }
.sq.done { background: transparent; box-shadow: none; border-color: var(--navy); }
.sq.cur { background: var(--navy); color: #fff; box-shadow: none; }
.sq.att::after { content: ""; position: absolute; right: -3px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); border: 1px solid #fff; }
.sq.arrow, .sq.info { font-weight: 700; }
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 16px 16px 16px 4px; }
.taskcard { background: var(--card); border-radius: 8px; box-shadow: var(--shadow); flex: 1; display: flex; flex-direction: column; min-height: 0; }
.taskscroll { flex: 1; min-height: 0; overflow: auto; }
.taskhead { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 16px 22px 10px; border-bottom: 1px solid var(--line-2); }
.taskhead h2 { font-size: 21px; margin: 0; color: var(--navy); margin-right: auto; }
.tool { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 5px; padding: 6px 12px; font-size: 14px; }
.tool:hover { border-color: var(--navy); }
.tool.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.tool .dot { width: 8px; height: 8px; border-radius: 50%; background: #b8c2d6; }
.tool .dot.ready { background: #2fbf71; }
.tool .dot.load { background: #ffb020; }
.taskbody { padding: 18px 22px 22px; overflow-wrap: anywhere; }
.taskbody p { margin: 0 0 10px; max-width: 78ch; }
.taskbody .center { text-align: center; max-width: none; }
.taskbody .f { font-family: "Cambria Math", "Cambria", "Times New Roman", serif; font-size: 17px; white-space: nowrap; }
.taskbody ul.dash { list-style: none; padding-left: 4px; margin: 4px 0 12px; }
.taskbody ul.dash li::before { content: "— "; }
.taskbody ol.steps, .taskbody ol.cmds { margin: 4px 0 12px; padding-left: 26px; }
.taskbody pre.code { background: #F5F7FC; border: 1px solid var(--line-2); border-radius: 6px; padding: 10px 14px; font: 14px/1.45 var(--mono); overflow-x: auto; max-width: 100%; }
.tblwrap { overflow-x: auto; max-width: 100%; margin: 6px 0 12px; }
table.t { border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
table.t th, table.t td { border: 1px solid #8a96ad; padding: 3px 9px; text-align: center; min-width: 30px; }
table.t th { background: #EEF2FA; font-weight: 600; }
.fig, .fig2 { margin: 8px 0 14px; overflow-x: auto; max-width: 100%; }
.fig2 { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; }
.fig svg, .fig2 svg { max-width: 100%; height: auto; }
.files { margin: 16px 0 0; border-top: 1px dashed var(--line); padding-top: 12px; }
.files h3 { font-size: 15px; margin: 0 0 8px; color: var(--navy); }
.flist { display: flex; flex-wrap: wrap; gap: 8px; }
.fchip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; background: #F8FAFE; font-size: 14px; max-width: 100%; }
.fchip .nm { font-weight: 600; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip .sz { color: var(--muted); font-size: 12px; }
.fchip button { border: none; background: none; color: var(--teal); padding: 0 2px; font-size: 13px; text-decoration: underline; }
.fchip button.rm { color: var(--red-fg); }
.fchip .st { font-size: 12px; }
.st.ok { color: #1e8a55; }
.st.wait { color: var(--amber); }
.mine-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.dropzone { border: 2px dashed var(--line); border-radius: 8px; padding: 8px 10px; color: var(--muted); font-size: 14px; margin-top: 10px; display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.dropzone.over { border-color: var(--teal); background: #EFFAF9; color: var(--teal); }

/* ---------- поле ответа ---------- */
.answer { flex: none; background: var(--card); border-top: 1px solid var(--line-2); border-radius: 0 0 8px 8px; padding: 14px 22px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; box-shadow: 0 -4px 10px rgba(30, 42, 64, .05); }
.answer label { font-weight: 600; color: var(--navy); }
.answer .ainput { height: 40px; border: 1px solid #8a96ad; border-radius: 4px; padding: 0 12px; width: min(340px, 100%); font-size: 17px; font-variant-numeric: tabular-nums; }
.answer .ainput:focus, .agrid input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(34, 54, 91, .15); }
.agrid { border-collapse: collapse; }
.agrid td, .agrid th { padding: 2px 3px; }
.agrid th { font-size: 12px; color: var(--muted); font-weight: 400; }
.agrid input { width: 74px; height: 25px; border: 1px solid #8a96ad; border-radius: 3px; padding: 0 4px; font-size: 14px; text-align: center; font-variant-numeric: tabular-nums; }
.agrid-wrap { max-height: 220px; overflow: auto; }
.abtns { display: flex; gap: 10px; flex: 1 1 260px; }
.abtns .btn-green { flex: 1; max-width: 50%; min-width: 150px; }
.astate { font-size: 14px; color: var(--muted); flex-basis: 100%; }
.astate.saved { color: #1e8a55; }
.astate.draft { color: var(--amber); }

/* ---------- редактор ---------- */
.ed { width: 46%; max-width: 760px; min-width: 380px; flex: none; display: flex; flex-direction: column; background: #fff; border-left: 1px solid var(--line); min-height: 0; }
.ed[hidden] { display: none; }
.edhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line-2); background: #F6F8FC; }
.edhead h3 { margin: 0 auto 0 0; font-size: 15px; color: var(--navy); }
.edbtn { border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 5px 11px; font-size: 14px; color: var(--navy); }
.edbtn.run { background: var(--green); border-color: var(--green); color: var(--green-fg); font-weight: 600; }
.edbtn.stop { border-color: var(--red); color: var(--red-fg); }
.edbtn:disabled { opacity: .5; cursor: default; }
.edwrap { flex: 1; min-height: 160px; position: relative; overflow: hidden; }
.edwrap textarea.plain { position: absolute; inset: 0; width: 100%; height: 100%; border: none; resize: none; padding: 10px 12px; font: 14px/1.5 var(--mono); tab-size: 4; outline: none; }
.edwrap .CodeMirror { height: 100%; font: 14px/1.5 var(--mono); }
.edstdin { border-top: 1px solid var(--line-2); padding: 6px 12px; font-size: 13px; }
.edstdin summary { cursor: pointer; color: var(--navy); }
.edstdin textarea { width: 100%; height: 70px; margin-top: 6px; border: 1px solid var(--line); border-radius: 4px; font: 13px/1.4 var(--mono); padding: 6px; resize: vertical; }
.edout { height: 34%; min-height: 120px; border-top: 1px solid var(--line); background: #0F1B2E; color: #DCE6F7; font: 13px/1.45 var(--mono); padding: 8px 12px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.edout .e { color: #FF9C8F; }
.edout .echo { color: #9EF0C8; }
.edout input.cin { background: rgba(255, 255, 255, .06); color: #fff; border: none; border-bottom: 1px solid #8FB4E8; border-radius: 2px; font: inherit; padding: 0 4px; min-width: 14ch; width: 50%; outline: none; caret-color: #fff; }
.edout input.cin:focus { background: rgba(143, 180, 232, .16); }
.edhint { background: #FFF4E0; color: #6B4A00; font-size: 13px; padding: 5px 12px; border-top: 1px solid #F0DCA8; }
.edhint[hidden] { display: none; }
.edstdin[hidden] { display: none; }
.edstdin .hint { font-size: 12px; margin: 4px 0 0; }
.edout .s { color: #8FB4E8; }
.edfoot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 6px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line-2); }
.edfoot code { font-family: var(--mono); background: #EEF2FA; padding: 0 4px; border-radius: 3px; }

/* ---------- модальные окна ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(15, 27, 46, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.dlg { background: #fff; border-radius: 8px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px 24px; }
.dlg.wide { width: min(900px, 100%); }
.dlg h3 { margin: 0 0 10px; color: var(--navy); font-size: 20px; }
.dlg p { margin: 8px 0; }
.dlg pre { white-space: pre-wrap; font: 13px/1.45 var(--mono); background: #F5F7FC; border: 1px solid var(--line-2); border-radius: 6px; padding: 10px; overflow-x: auto; }

/* ---------- результаты ---------- */
.score { margin: 16px 0; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.score .fact b { font-size: 30px; }
.rtable-wrap { overflow-x: auto; max-width: 100%; }
.rtable { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
.rtable th, .rtable td { border-bottom: 1px solid var(--line-2); padding: 6px 10px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.rtable th { color: var(--muted); font-weight: 600; font-size: 13px; }
.rtable td.n { color: var(--navy); font-weight: 600; width: 48px; }
.rtable td.pt { text-align: center; width: 70px; }
.rtable tr.ok td.pt { color: #1e8a55; font-weight: 700; }
.rtable tr.part td.pt { color: var(--amber); font-weight: 700; }
.rtable tr.no td.pt { color: var(--red-fg); }
.mail { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; background: #FAFBFE; margin-top: 16px; }
.mail .mh { font-size: 13px; color: var(--muted); }
.banner { border-radius: 8px; padding: 12px 16px; margin: 14px 0; font-size: 15px; }
.banner.wait { background: var(--amber-soft); color: #6B4A00; }
.banner.ok { background: var(--green-soft); color: var(--green-fg); }

/* ---------- узкие экраны ---------- */
@media (max-width: 1100px) {
  .ed { position: fixed; inset: 0; width: auto; max-width: none; min-width: 0; z-index: 50; border-left: none; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
}
@media (max-width: 760px) {
  .brand { font-size: 18px; }
  .brand small { display: none; }
  .top { gap: 8px 10px; min-height: 56px; }
  .timer { font-size: 18px; padding: 1px 10px; }
  .btn-finish { padding: 5px 10px; font-size: 14px; }
  .net span { display: none; }
  .exam { flex-direction: column; }
  .side { width: auto; flex-direction: row; align-items: center; padding: 8px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); gap: 10px; }
  .side .given { flex: none; }
  .side .given b { font-size: 20px; }
  .navlist { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 6px 4px 10px; }
  .sq.arrow { display: none; }
  .main { padding: 4px max(16px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
  .taskhead, .taskbody { padding-left: 14px; padding-right: 14px; }
  .answer { padding: 12px 14px 14px; }
  .abtns .btn-green { max-width: none; }
}

/* ---------- прочее ---------- */
.top-exam { display: flex; align-items: center; gap: 12px; }
.top-exam[hidden] { display: none; }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70; background: #1E2A40; color: #fff; padding: 10px 18px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-size: 15px; max-width: calc(100% - 32px); }
.fact b small { font-size: 15px; font-weight: 400; color: var(--muted); }
.screen[hidden], .exam[hidden] { display: none; }

/* ---------- сайт: ссылка назад и согласие ---------- */
.back { display: inline-block; margin-bottom: 14px; color: var(--navy); font-size: 14px; text-decoration: none; }
.back:hover { text-decoration: underline; }
.consent { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 13px; line-height: 1.45; color: var(--muted); max-width: 70ch; cursor: pointer; }
.consent input { width: 18px; height: 18px; flex: none; margin: 1px 0 0; }
.consent a { color: inherit; }
