:root {
  color-scheme: light;
  --paper: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f7f7f5;
  --surface-hover: #fafafa;
  --ink: #171717;
  --muted: #686868;
  --faint: #767676;
  --line: #eeeeec;
  --line-strong: #dadad7;
  --green: #216e43;
  --green-soft: #eef7f1;
  --red: #a13d3d;
  --red-soft: #fbf0f0;
  --blue: #315efb;
  --blue-soft: #eef2ff;
  --attempt-accepted: #0f766e;
  --attempt-error: #be123c;
  --attempt-official: #0369a1;
  --attempt-running: #65655f;
  --attempt-card-line: #e7e7e3;
  --attempt-node-ring: #bfbfba;
  --code: #171717;
  --code-line: #303030;
  --page: 1120px;
  --header-height: 68px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

input,
select,
textarea {
  font: inherit;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  font-size: 16px;
  line-height: 1.5;
}

/* Collaborative editor: dense, desktop-first workspace that keeps the
   existing Contester palette and typography. */
.live-editor-document,
.live-editor-page {
  height: 100%;
  overflow: hidden;
}

.live-editor-page {
  min-height: 0;
  background: var(--surface-soft);
}

.live-shell {
  display: grid;
  grid-template-rows: 58px auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
}

.live-recovery {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 18px;
  border-bottom: 1px solid #e6d9b9;
  background: #fff9e9;
}

.live-recovery[hidden] {
  display: none;
}

.live-recovery > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.live-recovery strong {
  flex: 0 0 auto;
  font-size: 12px;
}

.live-recovery span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-recovery__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.live-recovery .button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 11px;
}

.live-toolbar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 22px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface);
}

.live-toolbar__room,
.live-toolbar__presence,
.live-toolbar__actions,
.live-toolbar__room > div,
.live-panel__header > div {
  display: flex;
  align-items: center;
}

.live-toolbar__room {
  min-width: 0;
  gap: 12px;
}

.live-toolbar__room > div {
  min-width: 0;
  align-items: baseline;
  gap: 9px;
}

.live-toolbar__room strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 660;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-toolbar__eyebrow {
  color: var(--faint);
  font-size: 11px;
  font-weight: 680;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.live-back {
  display: grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 17px;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.live-back:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--ink);
}

.live-toolbar__presence {
  justify-content: center;
  gap: 13px;
}

.live-connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.live-connection > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aaa;
  box-shadow: 0 0 0 3px #f1f1ef;
}

.live-connection b {
  font-weight: 560;
}

.live-connection.is-online > span {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.live-connection.is-offline > span {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.live-participants {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  padding-left: 7px;
}

.live-participant {
  display: grid;
  width: 26px;
  height: 26px;
  margin-left: -7px;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 50%;
  color: #fff;
  font-size: 9px;
  font-weight: 740;
}

.live-toolbar__actions {
  justify-content: flex-end;
  gap: 10px;
}

.live-shortcut {
  color: var(--faint);
  font: 11px/1 SFMono-Regular, Consolas, monospace;
}

.live-run {
  min-height: 34px;
  padding: 7px 13px;
}

.live-run__icon {
  margin-right: 5px;
  font-size: 9px;
}

.live-workspace {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  min-height: 0;
  gap: 8px;
  padding: 8px;
}

.live-side {
  display: grid;
  grid-template-rows: minmax(180px, 0.43fr) minmax(220px, 0.57fr);
  min-height: 0;
  gap: 8px;
}

.live-panel {
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 3%);
}

.live-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
  background: #fbfbfa;
}

.live-panel__header > div {
  min-width: 0;
  gap: 8px;
}

.live-panel__header h1,
.live-panel__header h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 660;
  letter-spacing: 0;
}

.live-panel__header > span {
  overflow: hidden;
  color: var(--faint);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-file-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--blue);
}

.live-editor-mount,
.live-editor-mount > .cm-editor {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
}
.live-editor-mount .cm-scroller { min-width: 0; }

.live-editor-mount--stdin .cm-content,
.live-editor-mount--stdin .cm-scroller {
  font-size: 12px;
}

.live-output {
  min-height: 0;
  overflow: auto;
  background: #fcfcfb;
}

.live-output__empty {
  display: grid;
  height: 100%;
  min-height: 140px;
  place-content: center;
  justify-items: center;
  padding: 26px;
  color: var(--faint);
  text-align: center;
}

.live-output__empty > span {
  margin-bottom: 13px;
  color: #999992;
  font: 20px/1 SFMono-Regular, Consolas, monospace;
}

.live-output__empty p {
  max-width: 290px;
  margin: 0;
  font-size: 12px;
}

.live-output__section {
  border-bottom: 1px solid var(--line);
}

.live-output__section h3 {
  margin: 0;
  padding: 9px 13px 0;
  color: var(--faint);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-output__section pre {
  min-height: 36px;
  margin: 0;
  overflow: auto;
  padding: 8px 13px 12px;
  color: var(--ink);
  font: 12px/1.55 SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.live-output__section.is-error pre {
  color: var(--red);
}

.live-output__stats {
  margin: 0;
  padding: 9px 13px;
  color: var(--faint);
  font: 10px/1.4 SFMono-Regular, Consolas, monospace;
}

.live-output__status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 17px;
  color: var(--muted);
}

.live-output__status > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.live-output__status.is-pending > span {
  background: var(--blue);
  animation: live-pulse 1.2s ease-in-out infinite;
}

.live-output__status.is-error > span {
  background: var(--red);
}

.live-output__status p {
  margin: 0;
  font-size: 12px;
}

@keyframes live-pulse {
  50% { opacity: 0.35; transform: scale(0.78); }
}

.cm-remoteSelection.is-blue { background: rgb(49 94 251 / 18%); }
.cm-remoteSelection.is-green { background: rgb(15 138 95 / 18%); }
.cm-remoteSelection.is-amber { background: rgb(154 91 19 / 18%); }
.cm-remoteSelection.is-violet { background: rgb(123 79 189 / 18%); }
.cm-remoteSelection.is-rose { background: rgb(179 58 91 / 18%); }

.cm-remoteCursor {
  position: relative;
  display: inline-block;
  width: 0;
  height: 1.35em;
  margin-left: -1px;
  border-left: 2px solid currentColor;
  pointer-events: none;
  vertical-align: text-bottom;
}

.cm-remoteCursor.is-blue { --live-remote-color: #315efb; --live-remote-text: #fff; color: var(--live-remote-color); }
.cm-remoteCursor.is-green { --live-remote-color: #0f8a5f; --live-remote-text: #000; color: var(--live-remote-color); }
.cm-remoteCursor.is-amber { --live-remote-color: #9a5b13; --live-remote-text: #fff; color: var(--live-remote-color); }
.cm-remoteCursor.is-violet { --live-remote-color: #7b4fbd; --live-remote-text: #fff; color: var(--live-remote-color); }
.cm-remoteCursor.is-rose { --live-remote-color: #b33a5b; --live-remote-text: #fff; color: var(--live-remote-color); }
.live-participant.is-blue { background: #315efb; }
.live-participant.is-green { background: #0f8a5f; }
.live-participant.is-amber { background: #9a5b13; }
.live-participant.is-violet { background: #7b4fbd; }
.live-participant.is-rose { background: #b33a5b; }

.live-rooms {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-soft);
}

.live-rooms .section__heading {
  align-items: flex-end;
}

.live-rooms .section__heading h2 {
  margin: 1px 0 0;
}

.live-rooms__connection,
.live-rooms__empty {
  color: var(--faint);
  font-size: 12px;
}

.live-rooms__empty {
  margin: 0;
  padding: 14px 0 2px;
}

.live-rooms__list {
  display: grid;
  gap: 8px;
}

.live-room-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 52px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  transition: border-color 140ms ease, transform 140ms ease;
}

.live-room-link:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.live-room-link__student {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 620;
}

.live-room-link__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.live-room-link__action {
  color: var(--blue);
  font-size: 12px;
  font-weight: 620;
}

@media (max-width: 820px) {
  .live-editor-document,
  .live-editor-page {
    height: auto;
    overflow: visible;
  }

  .live-shell {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto auto;
  }

  .live-recovery {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
  }

  .live-recovery > div:first-child {
    display: grid;
    gap: 2px;
  }

  .live-toolbar {
    position: sticky;
    top: 0;
    grid-template-columns: 1fr auto;
    min-height: 58px;
    padding: 8px 12px;
  }

  .live-toolbar__room > div {
    display: grid;
    gap: 0;
  }

  .live-toolbar__presence {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    padding-left: 42px;
  }

  .live-toolbar__eyebrow,
  .live-shortcut,
  .live-toolbar__actions .inline-form {
    display: none;
  }

  .live-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .live-panel--code {
    height: 62vh;
    min-height: 420px;
  }

  .live-side {
    grid-template-rows: 260px 360px;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  height: var(--header-height);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.topbar__inner {
  width: min(calc(100% - 64px), var(--page));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 34px;
}

.brand {
  display: inline-flex;
  align-items: center;
  font-size: 17px;
  font-weight: 760;
  letter-spacing: -0.035em;
}

.topbar__section,
.quiet-link,
.back-link,
.breadcrumbs a,
.text-action {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 140ms ease;
}

.topbar__section {
  position: relative;
}

.topbar__section.is-active {
  color: var(--ink);
}

.topbar__section.is-active::after {
  position: absolute;
  right: 0;
  bottom: -10px;
  left: 0;
  height: 2px;
  border-radius: 999px;
  background: #0f766e;
  content: "";
}

.topbar__section:hover,
.quiet-link:hover,
.back-link:hover,
.breadcrumbs a:hover,
.text-action:hover {
  color: var(--ink);
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 560;
}

.account__avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 720;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(36px, 4.2vw, 48px);
  font-weight: 650;
  line-height: 1.06;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.overline {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.page {
  width: min(calc(100% - 64px), var(--page));
  min-height: calc(100vh - 160px);
  margin: 0 auto;
  padding: 52px 0 96px;
}

.page--dashboard {
  padding-top: 72px;
}

.page-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 48px;
  padding-bottom: 82px;
  animation: reveal 360ms ease-out both;
}

.page-intro__copy {
  max-width: 690px;
}

.page--dashboard .page-intro {
  align-items: center;
  padding-bottom: 42px;
}

.page-intro h1 {
  margin-bottom: 18px;
}

.page--dashboard .page-intro h1 {
  margin-bottom: 0;
}

.page-intro__copy > p:last-child {
  max-width: 570px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

.page-intro__meta {
  padding-bottom: 7px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.page-intro__meta strong {
  color: var(--ink);
  font-size: 24px;
  font-weight: 520;
}

.dashboard-editor-link {
  display: flex;
  min-width: 286px;
  min-height: 66px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid #a7a7a0;
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  transition: border-color 150ms ease-out, transform 150ms ease-out;
}

.dashboard-editor-link:hover {
  border-color: var(--ink);
}

.dashboard-editor-link:active {
  transform: scale(0.985);
}

.dashboard-editor-link__icon {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
}

.dashboard-editor-link > span:nth-child(2) {
  white-space: nowrap;
}

.dashboard-editor-link__arrow {
  margin-left: auto;
  font-size: 19px;
  transition: transform 150ms ease-out;
}

.dashboard-editor-link:hover .dashboard-editor-link__arrow {
  transform: translateX(3px);
}

.dashboard-tabs {
  display: flex;
  gap: 32px;
  border-bottom: 1px solid var(--line-strong);
}

.dashboard-tabs__link {
  position: relative;
  display: inline-flex;
  min-height: 56px;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 560;
  touch-action: manipulation;
  transition: color 140ms ease, background-color 140ms ease;
}

.dashboard-tabs__link::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--ink);
  content: "";
  opacity: 0;
  transform: scaleX(0.72);
  transition: opacity 140ms ease, transform 140ms ease;
}

.dashboard-tabs__link:hover,
.dashboard-tabs__link.is-active {
  color: var(--ink);
}

.dashboard-tabs__link:active {
  background: var(--surface-hover);
}

.dashboard-tabs__link.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.dashboard-tabs__count {
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.section {
  border-top: 1px solid var(--line-strong);
  animation: reveal 420ms 50ms ease-out both;
}

.section--dashboard-list {
  border-top: 0;
}

.section__heading {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.section__hint {
  color: var(--faint);
  font-size: 14px;
}

.contest-list,
.problem-list {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.contest-list {
  counter-reset: contest-row;
}

.contest-list > li {
  counter-increment: contest-row;
}

.contest-row {
  --contest-row-hover-bleed: 16px;

  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 180px 24px;
  min-height: 116px;
  align-items: center;
  gap: 26px;
  margin-inline: calc(-1 * var(--contest-row-hover-bleed));
  padding: 20px calc(8px + var(--contest-row-hover-bleed)) 20px var(--contest-row-hover-bleed);
  border-top: 1px solid var(--line);
  border-radius: 6px;
  transition: background-color 150ms ease;
}

.contest-row:hover {
  background: var(--surface-hover);
}

.contest-row:active {
  background: var(--surface-soft);
  transition-duration: 0s;
}

.contest-row__index::before {
  content: counter(contest-row, decimal-leading-zero);
  font-size: 28px;
  font-weight: 430;
  letter-spacing: -0.035em;
}

.contest-row__body,
.problem-row__body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.contest-row__title,
.problem-row__title {
  font-size: 20px;
  font-weight: 610;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.contest-row__description,
.problem-row__hint {
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contest-row__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  color: var(--faint);
  font-size: 13px;
  text-align: right;
}

.thematic-progress {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.thematic-progress__label {
  color: var(--faint);
  font-size: 12px;
  font-weight: 610;
}

.thematic-progress__value {
  color: var(--ink);
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  font-weight: 630;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.thematic-progress__value small {
  color: var(--faint);
  font-size: 13px;
  font-weight: 520;
  letter-spacing: 0;
}

.arrow {
  color: var(--faint);
  font-size: 20px;
  transition: color 140ms ease, transform 140ms ease;
}

a:hover > .arrow,
.contest-row:hover .arrow,
.problem-row:hover .arrow,
.editorial-link:hover .arrow,
.attempt-row:hover .arrow {
  color: var(--ink);
  transform: translateX(3px);
}

.empty-state {
  padding: 52px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.empty-state p {
  margin: 0;
}

.site-footer {
  width: min(calc(100% - 64px), var(--page));
  min-height: 92px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 13px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 42px;
  color: var(--faint);
  font-size: 14px;
}

.breadcrumbs--compact {
  margin-bottom: 38px;
}

.contest-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 64px;
  padding: 18px 0 82px;
  animation: reveal 360ms ease-out both;
}

.contest-hero__main {
  max-width: 760px;
}

.contest-hero h1 {
  margin-bottom: 18px;
}

.contest-hero__main > p:not(.overline):not(.contest-progress) {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

.contest-progress {
  margin: 26px 0 0;
  color: var(--faint);
  font-size: 15px;
}

.contest-progress strong {
  color: var(--ink);
  font-weight: 610;
}

.contest-hero__status {
  display: flex;
  padding-bottom: 5px;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  color: var(--faint);
  font-size: 14px;
}

.availability {
  color: var(--ink);
  font-weight: 580;
}

.availability--muted {
  color: var(--muted);
}

.problem-list {
  counter-reset: problem-row;
}

.problem-list > li {
  position: relative;
  counter-increment: problem-row;
}

.problem-list > li:not(:last-child)::after {
  position: absolute;
  z-index: 0;
  top: 66px;
  bottom: -25px;
  left: 23px;
  width: 1px;
  background: var(--line);
  content: "";
}

.problem-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 24px;
  min-height: 94px;
  align-items: center;
  gap: 30px;
  padding: 16px 8px 16px 0;
  border-top: 1px solid var(--line);
  transition: background-color 150ms ease;
}

.problem-row:hover {
  background: var(--surface-hover);
}

.problem-row__letter {
  position: relative;
  z-index: 1;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: 14px;
}

.problem-row__letter::before {
  content: counter(problem-row);
}

.problem-row--solved .problem-row__letter {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.problem-state {
  color: var(--faint);
  font-size: 13px;
}

.problem-state--solved {
  color: var(--ink);
  font-weight: 570;
}

.workspace {
  width: min(calc(100% - 64px), 1420px);
  min-height: calc(100vh - var(--header-height));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 180px minmax(430px, 690px) minmax(360px, 470px);
  justify-content: center;
  gap: clamp(32px, 4vw, 62px);
  padding: 52px 0 88px;
}

.workspace-nav {
  min-width: 0;
  padding-top: 2px;
  animation: reveal 320ms ease-out both;
}

.workspace-nav .back-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-nav__label {
  margin: 43px 0 15px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 520;
}

.workspace-nav__list {
  position: relative;
  display: flex;
  margin: 0;
  padding: 0;
  flex-direction: column;
  list-style: none;
}

.workspace-nav__list::before {
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 17px;
  width: 1px;
  background: var(--line);
  content: "";
}

.workspace-nav__list a {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 7px 8px 7px 0;
  color: var(--muted);
  transition: background-color 140ms ease, color 140ms ease;
}

.workspace-nav__list a:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.workspace-nav__list a.is-current {
  background: var(--surface-soft);
  color: var(--ink);
}

.workspace-nav__list span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  font-size: 12px;
  font-weight: 600;
}

.workspace-nav__list a.is-current span {
  border-color: var(--ink);
}

.workspace-nav__list small {
  overflow: hidden;
  font-size: 12px;
  font-weight: 540;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-problem-nav {
  display: none;
}

.statement {
  min-width: 0;
  padding-bottom: 44px;
  animation: reveal 380ms 30ms ease-out both;
}

.statement__header {
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}

.statement__header h1 {
  margin-bottom: 28px;
  font-size: clamp(36px, 3.6vw, 46px);
}

.limits {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  margin: 0;
}

.limits div {
  display: flex;
  gap: 7px;
  font-size: 13px;
}

.limits dt {
  color: var(--faint);
}

.limits dd {
  margin: 0;
  font-weight: 570;
}

.prose {
  min-width: 0;
  color: #333;
  font-size: 17px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.statement .prose {
  padding: 36px 0 24px;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  color: var(--ink);
  font-family: inherit;
}

.prose h2 {
  margin: 34px 0 12px;
  font-size: 22px;
}

.prose h3 {
  margin: 30px 0 10px;
  font-size: 19px;
}

.prose h4 {
  margin: 22px 0 8px;
  font-size: 15px;
}

.prose p,
.prose ul,
.prose ol {
  margin-bottom: 18px;
}

.prose code {
  padding: 2px 5px;
  background: var(--surface-soft);
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86em;
}

.prose a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 20px 22px;
  border-radius: 6px;
  background: var(--code);
  color: #efefec;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.84em;
  line-height: 1.6;
  overflow-wrap: normal;
  -webkit-overflow-scrolling: touch;
}

.prose pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  white-space: pre;
}

.prose table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  -webkit-overflow-scrolling: touch;
}

.prose th,
.prose td {
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  text-align: left;
  white-space: nowrap;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
}

.editorial-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 28px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.editorial-link span:first-child {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.editorial-link small {
  color: var(--faint);
  font-size: 12px;
}

.editorial-link strong {
  font-size: 16px;
  font-weight: 610;
}

.editorial-link--locked {
  cursor: default;
  color: var(--faint);
}

.editorial-link--locked strong {
  color: var(--faint);
  font-weight: 560;
}

.editorial-link__lock {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: var(--faint);
  opacity: 0.7;
}

.editorial-link__lock svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
  vector-effect: non-scaling-stroke;
}

.attempts {
  margin-top: 58px;
  border-top: 1px solid var(--line-strong);
}

.attempts__heading {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.attempts__heading .overline {
  margin-bottom: 5px;
}

.attempts__heading > span {
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
}

.attempt-list {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.attempt-list > li {
  border-top: 1px solid var(--line);
}

.attempt-row {
  display: grid;
  min-height: 74px;
  grid-template-columns: minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 22px;
  padding: 12px 2px 12px 0;
  transition: background-color 140ms ease;
}

.attempt-row:hover {
  background: var(--surface-hover);
}

.attempt-row__main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.attempt-row__main strong {
  font-size: 15px;
  font-weight: 620;
}

.attempt-row__main time {
  color: var(--muted);
  font-size: 12px;
}

.attempt-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 580;
  white-space: nowrap;
}

.attempt-status__dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.attempt-status.status--accepted {
  color: var(--green);
}

.attempt-status.status--wrong-answer,
.attempt-status.status--compile-error,
.attempt-status.status--failed {
  color: var(--red);
}

.attempt-status.status--running,
.attempt-status.status--compiling {
  color: var(--ink);
}

.attempts__empty {
  margin: 0;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.submit-panel {
  position: sticky;
  top: 24px;
  overflow: hidden;
  align-self: start;
  border-radius: 7px;
  background: var(--code);
  color: #f6f6f3;
  animation: reveal 420ms 70ms ease-out both;
}

.submit-panel__head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 21px 22px 18px;
  border-bottom: 1px solid var(--code-line);
}

.submit-panel__head .overline {
  margin-bottom: 5px;
  color: #8f8f8b;
}

.submit-panel__head h2 {
  font-size: 18px;
}

.language-badge {
  display: inline-flex;
  min-height: 26px;
  flex: 0 0 auto;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 11px;
  font-weight: 680;
}

.submit-panel .language-badge {
  border-color: #454545;
  background: transparent;
  color: #c9c9c5;
}

.code-input {
  display: block;
  width: 100%;
  min-height: 390px;
  resize: vertical;
  padding: 20px 22px;
  border: 0;
  outline: 0;
  background: var(--code);
  color: #eeeeea;
  caret-color: #fff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.65;
  tab-size: 4;
}

.code-input:focus {
  box-shadow: inset 0 0 0 2px #777;
}

.submit-panel__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-top: 1px solid var(--code-line);
}

.shortcut-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #82827e;
  font-size: 11px;
}

kbd {
  padding: 2px 5px;
  border: 1px solid #444;
  border-radius: 4px;
  color: #bdbdb8;
  font-family: inherit;
  font-size: 10px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.button--primary {
  background: var(--ink);
  color: #fff;
}

.button--primary:hover {
  background: #333;
}

.submit-panel .button--primary {
  background: #f7f7f4;
  color: var(--ink);
}

.submit-panel .button--primary:hover {
  background: #deded9;
}

.submit-panel .button:focus-visible {
  outline-color: #fff;
}

.button--secondary {
  border-color: var(--line-strong);
  background: var(--paper);
  color: var(--ink);
}

.button--secondary:hover {
  border-color: var(--ink);
}

.button__arrow {
  font-size: 17px;
}

.submit-note {
  margin: 0;
  padding: 0 20px 17px;
  color: #858581;
  font-size: 11px;
  line-height: 1.5;
}

.mobile-task-nav {
  display: none;
}

.result-page,
.reading-page,
.run-page {
  width: min(calc(100% - 64px), 1020px);
  min-height: calc(100vh - var(--header-height));
  margin: 0 auto;
  padding: 52px 0 92px;
}

.run-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 48px;
  margin: 54px 0 42px;
  padding-bottom: 38px;
  border-bottom: 1px solid var(--line-strong);
  animation: reveal 340ms ease-out both;
}

.run-hero h1 {
  margin-bottom: 0;
  font-size: clamp(40px, 5vw, 54px);
}

.run-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 18px;
  padding-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.source-section {
  animation: reveal 380ms 40ms ease-out both;
}

.source-section__heading {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.source-section__heading > span {
  color: var(--faint);
  font-size: 12px;
}

.source-view {
  max-height: 68vh;
  overflow: auto;
  margin: 0;
  padding: 25px 28px;
  border-radius: 7px;
  outline: 0;
  background: var(--code);
  color: #eeeeea;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.7;
  tab-size: 4;
  white-space: pre;
}

.source-view:focus-visible {
  box-shadow: 0 0 0 2px #777;
}

.run-actions {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 28px;
}

.result-card {
  max-width: 760px;
  margin: 58px auto 0;
  padding: 30px 0 48px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  animation: reveal 360ms ease-out both;
}

.result-card__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.result-id {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.result-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 42px 0 28px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink);
  font-size: 25px;
  font-weight: 650;
}

.result-card[data-status="accepted"] .result-mark {
  border-color: #bcd9c8;
  background: var(--green-soft);
  color: var(--green);
}

.result-card[data-status="wrong_answer"] .result-mark,
.result-card[data-status="compile_error"] .result-mark,
.result-card[data-status="failed"] .result-mark {
  border-color: #e6c6c6;
  background: var(--red-soft);
  color: var(--red);
}

.spinner {
  width: 23px;
  height: 23px;
  border: 2px solid #d8d8d4;
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.result-card h1 {
  margin-bottom: 10px;
  font-size: clamp(40px, 5vw, 54px);
}

.result-message {
  margin-bottom: 30px;
  color: var(--muted);
}

.test-progress {
  margin: 34px 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.test-progress__labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.test-progress__labels strong {
  color: var(--ink);
}

progress {
  display: block;
  width: 100%;
  height: 4px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--line);
  appearance: none;
}

progress::-webkit-progress-bar {
  background: var(--line);
}

progress::-webkit-progress-value {
  background: var(--ink);
}

progress::-moz-progress-bar {
  background: var(--ink);
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 22px;
  margin-top: 36px;
}

.reading-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 680px);
  align-items: start;
  gap: 88px;
}

.reading-aside {
  position: sticky;
  top: 30px;
  padding-top: 5px;
}

.reading-aside h2 {
  margin-bottom: 6px;
  font-size: 18px;
}

.reading-aside > p:not(.overline) {
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 14px;
}

.editorial {
  padding-bottom: 54px;
  animation: reveal 380ms ease-out both;
}

.editorial header {
  margin-bottom: 36px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}

.editorial h1 {
  margin-bottom: 0;
  font-size: clamp(38px, 4.5vw, 48px);
}

.editorial-callout {
  margin: 34px 0 30px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.editorial-callout p {
  margin: 5px 0 0;
  color: var(--muted);
}

.error-page {
  width: min(calc(100% - 64px), 820px);
  margin: 0 auto;
  padding: 15vh 0;
  animation: reveal 340ms ease-out both;
}

.error-page h1 {
  font-size: clamp(48px, 7vw, 70px);
}

.error-page > p:not(.overline) {
  max-width: 520px;
  margin-bottom: 32px;
  color: var(--muted);
  font-size: 18px;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 150px minmax(380px, 1fr) minmax(320px, 410px);
    gap: 28px;
  }
}

@media (max-width: 980px) {
  .workspace {
    width: min(calc(100% - 48px), 780px);
    grid-template-columns: 1fr;
  }

  .workspace-nav {
    display: none;
  }

  .mobile-problem-nav {
    display: flex;
    gap: 9px;
    overflow-x: auto;
    margin: -10px 0 30px;
    padding: 2px 2px 9px;
  }

  .mobile-problem-nav a {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: var(--paper);
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
  }

  .mobile-problem-nav a.is-current {
    border-color: var(--ink);
    color: var(--ink);
  }

  .submit-panel {
    position: static;
  }

  .mobile-task-nav {
    display: block;
    width: min(calc(100% - 48px), 780px);
    margin: 0 auto 54px;
    font-size: 14px;
    font-weight: 600;
  }

  .reading-layout {
    display: block;
  }

  .reading-aside {
    position: static;
    margin-bottom: 44px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 700px) {
  .topbar__inner,
  .page,
  .site-footer,
  .workspace,
  .result-page,
  .reading-page,
  .run-page,
  .mobile-task-nav,
  .error-page {
    width: min(calc(100% - 32px), var(--page));
  }

  .topbar__nav {
    gap: 22px;
  }

  .page,
  .page--dashboard,
  .result-page,
  .reading-page,
  .run-page {
    padding-top: 36px;
  }

  .page-intro {
    display: block;
    padding-bottom: 54px;
  }

  .page--dashboard .page-intro {
    padding-bottom: 30px;
  }

  .dashboard-editor-link {
    width: 100%;
    min-width: 0;
    margin-top: 22px;
  }

  .page-intro h1,
  .contest-hero h1 {
    font-size: 34px;
  }

  .page-intro__meta {
    margin-top: 24px;
    padding-bottom: 0;
  }

  .dashboard-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .dashboard-tabs__link {
    justify-content: space-between;
    gap: 8px;
    padding-right: 8px;
  }

  .dashboard-tabs__link + .dashboard-tabs__link {
    padding-right: 0;
    padding-left: 8px;
  }

  .section__heading {
    min-height: 62px;
  }

  .contest-row {
    --contest-row-hover-bleed: 8px;

    grid-template-columns: 48px minmax(0, 1fr) 20px;
    min-height: 96px;
    gap: 14px;
    padding-right: calc(2px + var(--contest-row-hover-bleed));
    border-radius: 4px;
  }

  .contest-row__index::before {
    font-size: 24px;
  }

  .contest-row__meta {
    display: none;
  }

  .contest-row__title,
  .problem-row__title {
    font-size: 17px;
  }

  .contest-row__description,
  .problem-row__hint {
    white-space: normal;
  }

  .contest-hero {
    display: block;
    padding: 8px 0 56px;
  }

  .contest-hero__status {
    margin-top: 30px;
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }

  .section__hint {
    display: none;
  }

  .problem-row {
    grid-template-columns: 46px minmax(0, 1fr) 20px;
    gap: 16px;
    min-height: 92px;
    padding-right: 2px;
  }

  .problem-row__letter {
    width: 40px;
    height: 40px;
  }

  .problem-state {
    display: none;
  }

  .problem-row--solved .problem-state {
    display: block;
    overflow: hidden;
    width: 20px;
    justify-self: center;
    color: var(--ink);
    font-size: 0;
    text-align: center;
  }

  .problem-row--solved .problem-state span {
    font-size: 16px;
  }

  .problem-row--solved .arrow {
    display: none;
  }

  .problem-list > li:not(:last-child)::after {
    left: 20px;
  }

  .breadcrumbs {
    overflow: hidden;
    margin-bottom: 32px;
    white-space: nowrap;
  }

  .breadcrumbs > * {
    flex: 0 0 auto;
  }

  .breadcrumbs > :last-child {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .statement__header h1 {
    font-size: 34px;
  }

  .limits {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .prose {
    font-size: 16px;
  }

  .attempts {
    margin-top: 48px;
  }

  .attempts__heading {
    min-height: 76px;
  }

  .attempt-row {
    gap: 14px;
  }

  .code-input {
    min-height: 340px;
  }

  .submit-panel__footer {
    display: block;
  }

  .shortcut-hint {
    display: none;
  }

  .submit-panel__footer .button {
    width: 100%;
  }

  .result-card {
    margin-top: 34px;
    padding-top: 24px;
  }

  .result-card h1 {
    font-size: 40px;
  }

  .result-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .run-hero {
    display: block;
    margin: 32px 0 34px;
    padding-bottom: 30px;
  }

  .run-hero h1 {
    font-size: 40px;
  }

  .run-meta {
    margin-top: 24px;
    padding-bottom: 0;
    flex-wrap: wrap;
  }

  .source-view {
    max-height: none;
    padding: 20px;
    font-size: 12px;
  }

  .run-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
  }
}

/* Scored training dashboard */

.contest-row--training {
  grid-template-columns: 72px minmax(0, 1fr) 220px 24px;
}

.training-row__state {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.training-timer,
.training-phase {
  color: var(--muted);
  font-size: 12px;
  font-weight: 610;
  letter-spacing: 0.01em;
}

.training-timer {
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.training-score {
  color: var(--ink);
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  font-weight: 630;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.training-score small {
  color: var(--faint);
  font-size: 13px;
  font-weight: 520;
  letter-spacing: 0;
}

.training-score--empty {
  color: var(--faint);
}

.training-score__note {
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.training-history {
  margin-top: 84px;
  padding-bottom: 10px;
}

.training-history .section__heading {
  min-height: 92px;
}

.training-history .overline {
  margin-bottom: 5px;
}

.text-link {
  color: var(--muted);
  font-size: 13px;
  font-weight: 570;
  transition: color 140ms ease;
}

.text-link:hover {
  color: var(--ink);
}

.text-link:active,
.contest-row:active,
.training-history__list a:active,
.button:active,
.icon-button:active {
  transform: translateY(1px);
}

.training-chart {
  padding: 24px 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.training-chart svg {
  display: block;
  width: min(100%, 760px);
  height: auto;
  overflow: visible;
}

.training-chart__grid line {
  stroke: var(--line);
  stroke-width: 1;
}

.training-chart__axis text,
.training-chart__date {
  fill: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.training-chart__line {
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.training-chart__point circle {
  fill: var(--paper);
  stroke: var(--blue);
  stroke-width: 2.5;
}

.training-chart__value {
  fill: var(--ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  text-anchor: middle;
  transform: translateY(-12px);
}

.training-chart__date {
  text-anchor: middle;
}

.training-history__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.training-history__list a {
  display: grid;
  min-height: 82px;
  grid-template-columns: minmax(0, 1fr) 180px 24px;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  transition: background-color 140ms ease;
}

.training-history__list a:hover {
  background: var(--surface-hover);
}

.training-history__list a > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.training-history__list strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 620;
}

.training-history__list small {
  color: var(--faint);
  font-size: 12px;
}

.training-history__result {
  align-items: flex-end;
  text-align: right;
}

.training-history__empty {
  padding-top: 38px;
  padding-bottom: 38px;
}

/* Per-problem score groups in the administrator form */

.field-hint {
  margin: -2px 0 12px;
  color: var(--faint);
  font-size: 12px;
}

.score-group {
  padding: 18px 0 8px;
  border-top: 1px solid var(--line);
}

.score-group__heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 36px;
  align-items: end;
  gap: 12px;
}

.score-group__points input {
  font-variant-numeric: tabular-nums;
}

.score-groups .test-case {
  grid-template-columns: 36px 1fr 1fr 36px;
}

.test-case__remove {
  margin-top: 25px;
}

.score-groups__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line-strong);
}

.score-groups__footer output {
  color: var(--red);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 620;
}

.score-groups__footer output.is-valid {
  color: var(--green);
}

.score-group-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  background: var(--line);
}

.score-group-summary > span {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
}

.score-group-summary strong {
  color: var(--ink);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 620;
}

.score-group-summary small {
  color: var(--faint);
}

@media (max-width: 700px) {
  .contest-row--thematic {
    grid-template-columns: 38px minmax(0, 1fr) 68px 16px;
    gap: 10px;
  }

  .contest-row--thematic .contest-row__index::before {
    font-size: 20px;
  }

  .thematic-progress__label {
    font-size: 10px;
  }

  .thematic-progress__value {
    font-size: 20px;
  }

  .contest-row--training {
    grid-template-columns: 38px minmax(0, 1fr) 108px 16px;
    gap: 10px;
  }

  .contest-row--training .contest-row__index::before {
    font-size: 20px;
  }

  .contest-row--training .contest-row__description {
    display: none;
  }

  .training-timer,
  .training-phase,
  .training-score__note {
    font-size: 10px;
  }

  .training-score {
    font-size: 20px;
  }

  .training-history {
    margin-top: 58px;
  }

  .training-chart {
    overflow: visible;
  }

  .training-chart svg {
    min-width: 0;
  }

  .training-chart__axis text,
  .training-chart__date,
  .training-chart__value {
    font-size: 16px;
  }

  .training-history__list a {
    min-height: 76px;
    grid-template-columns: minmax(0, 1fr) 120px 16px;
    gap: 12px;
  }

  .score-group__heading,
  .score-groups .test-case {
    grid-template-columns: 1fr;
  }

  .score-group__heading .icon-button,
  .test-case__remove {
    margin-top: 0;
    justify-self: end;
  }

  .score-groups__footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .account__name {
    display: none;
  }

  .topbar__inner {
    width: calc(100% - 34px);
    gap: 12px;
  }

  .topbar__nav {
    gap: 16px;
  }

  .topbar__section {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    font-size: 12px;
  }

  .topbar__section.is-active::after {
    bottom: 5px;
  }

  .page-intro h1,
  .contest-hero h1,
  .statement__header h1 {
    font-size: 32px;
  }

  .attempts__heading {
    align-items: flex-start;
    padding: 20px 0;
  }

  .attempts__heading > span {
    padding-top: 4px;
    text-align: right;
    white-space: normal;
  }

  .attempt-row {
    min-height: 82px;
    grid-template-columns: minmax(0, 1fr) 20px;
    gap: 4px 12px;
    padding: 14px 2px 14px 0;
  }

  .attempt-status {
    grid-column: 1;
    grid-row: 2;
    font-size: 12px;
  }

  .attempt-row .arrow {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Authenticated platform */

.inline-form,
.inline-actions {
  margin: 0;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 18px;
}

.icon-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.notice {
  margin: -20px 0 36px;
  padding: 13px 16px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  color: #233b93;
  font-size: 14px;
}

.label,
.status {
  display: inline-flex;
  width: fit-content;
  min-height: 25px;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.label--blue {
  border-color: #c9d3ff;
  background: var(--blue-soft);
  color: #234bc8;
}

.status--accepted {
  border-color: #bcd9c8;
  background: var(--green-soft);
  color: var(--green);
}

.status--wrong-answer,
.status--compile-error,
.status--failed {
  border-color: #e6c6c6;
  background: var(--red-soft);
  color: var(--red);
}

.auth-page {
  display: grid;
  place-items: center;
}

.auth-shell {
  width: min(calc(100% - 40px), 430px);
  padding: 64px 0;
}

.auth-shell__brand {
  margin-bottom: 72px;
}

.auth-panel {
  border-top: 1px solid var(--line-strong);
  padding-top: 34px;
}

.auth-panel h1 {
  margin-bottom: 12px;
}

.auth-panel__intro {
  margin-bottom: 36px;
  color: var(--muted);
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 450;
}

.field textarea {
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.button--wide {
  width: 100%;
}

.button--small {
  min-height: 36px;
  padding: 7px 12px;
}

.button--quiet {
  border-color: var(--line-strong);
  background: var(--paper);
  color: var(--muted);
}

.button--quiet:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.form-error {
  margin-bottom: 22px;
  padding: 12px 14px;
  border-left: 3px solid var(--red);
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
}

.form-hint {
  margin: -4px 0 0;
  color: var(--faint);
  font-size: 12px;
}

.actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.module-header,
.problem-hero,
.result-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 56px;
  padding: 12px 0 70px;
}

.module-header__description {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
}

.module-header__state,
.problem-hero__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  padding-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.start-panel {
  max-width: 720px;
  padding: 40px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.start-panel h2 {
  margin-bottom: 14px;
  font-size: 24px;
}

.start-panel > p:not(.overline) {
  max-width: 600px;
  margin-bottom: 26px;
  color: var(--muted);
}

.problem-row--managed {
  grid-template-columns: 48px minmax(0, 1fr) 24px;
}

.problem-row__number {
  position: relative;
  z-index: 1;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.result-summary {
  display: flex;
  max-width: 720px;
  margin-top: 48px;
  padding: 28px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  flex-direction: column;
  gap: 5px;
}

.result-summary .overline {
  margin-bottom: 4px;
}

.result-summary strong {
  font-size: 30px;
  font-weight: 560;
}

.result-summary > span {
  color: var(--muted);
  font-size: 13px;
}

/* Student contest progress follows the approved linear workbench design. */
.student-contest-page {
  --contest-active: #176d68;
  --contest-good: #2d6b4f;
  --contest-bad: #9b3f49;
  --contest-checking: #315f91;
  --contest-faint: #85857f;

  width: min(calc(100% - 64px), 1180px);
}

.contest-header {
  gap: 58px;
  padding: 8px 0 64px;
}

.contest-header h1 {
  max-width: 810px;
  margin-bottom: 0;
  font-size: clamp(38px, 4.2vw, 64px);
  font-weight: 620;
  line-height: 1.02;
}

.contest-header .module-header__description {
  max-width: 700px;
  margin-top: 16px;
  font-size: 14px;
}

.contest-summary {
  display: flex;
  min-width: 128px;
  align-items: flex-end;
  padding-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.contest-summary--official,
.contest-summary--finishing,
.contest-summary--upsolve,
.contest-summary--legacy {
  flex-direction: column;
}

.contest-summary--official {
  gap: 14px;
}

.contest-summary__metric {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 3px;
}

.contest-summary__label,
.contest-summary__official-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.contest-summary__timer {
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
  line-height: 1;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.contest-summary__score {
  color: var(--ink);
  font-size: 29px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.contest-summary__score small {
  color: inherit;
  font-size: 1em;
  font-weight: inherit;
}

.contest-summary__phase {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.contest-summary__phase-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--contest-active);
}

.contest-summary--finishing,
.contest-summary--upsolve {
  gap: 10px;
}

.contest-summary--finishing .contest-summary__score {
  margin-top: 1px;
}

.contest-summary__note {
  max-width: 190px;
  color: var(--contest-faint);
  font-size: 10.5px;
}

.contest-summary__divider {
  width: 100%;
  margin-top: 1px;
  border-top: 1px solid var(--line-strong);
}

.contest-summary__official {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.contest-summary__official-score {
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
  white-space: nowrap;
}

.contest-summary__delta {
  color: var(--contest-active);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.contest-summary--thematic {
  align-items: baseline;
  gap: 8px;
}

.contest-summary--thematic strong {
  color: var(--ink);
  font-size: 27px;
  font-variant-numeric: tabular-nums;
  font-weight: 620;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.contest-summary--thematic strong small {
  font-size: 1em;
  font-weight: inherit;
}

.contest-summary--thematic > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.student-contest-page > .section {
  border-top: 0;
}

.student-contest-page .section__heading {
  min-height: 0;
  align-items: baseline;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-strong);
}

.student-contest-page .section__heading h2 {
  font-size: 19px;
}

.student-contest-page .section__hint {
  font-size: 12px;
}

.contest-problem-list {
  border-bottom: 0;
}

.contest-problem-list > li:not(:last-child)::after {
  display: none;
}

.contest-problem-row {
  position: relative;
  display: grid;
  min-height: 78px;
  grid-template-columns: 48px minmax(0, 1fr) minmax(240px, 280px) 24px;
  align-items: center;
  gap: 24px;
  padding: 14px 6px 14px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  animation: contest-problem-row-in 560ms cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.contest-problem-row::before {
  position: absolute;
  z-index: 0;
  inset: 4px -16px;
  background: transparent;
  content: "";
  pointer-events: none;
  transition: background-color 180ms ease;
}

.contest-problem-row > * {
  position: relative;
  z-index: 1;
}

.contest-problem-list > li:nth-child(2) .contest-problem-row {
  animation-delay: 55ms;
}

.contest-problem-list > li:nth-child(3) .contest-problem-row {
  animation-delay: 110ms;
}

.contest-problem-list > li:nth-child(4) .contest-problem-row {
  animation-delay: 165ms;
}

.contest-problem-row:hover {
  transform: translateX(2px);
}

.contest-problem-row:hover::before,
.contest-problem-row:focus-visible::before {
  background: var(--surface-soft);
}

.contest-problem-row:active::before {
  background: var(--surface-hover);
}

.contest-problem-row__number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease;
}

.contest-problem-row--solved .contest-problem-row__number {
  border-color: var(--contest-good);
  background: var(--contest-good);
  color: #fff;
}

.contest-problem-row--checking .contest-problem-row__number {
  border-color: var(--contest-checking);
  color: var(--contest-checking);
}

.contest-problem-row__title {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 17px;
  font-weight: 640;
  letter-spacing: -0.015em;
}

.contest-problem-row__progress {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.contest-problem-row__state {
  min-width: 0;
}

.contest-problem-status {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 7px;
  color: var(--contest-faint);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.contest-problem-status__dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.contest-problem-row--solved .contest-problem-status {
  color: var(--contest-good);
}

.contest-problem-row--attempted .contest-problem-status {
  color: var(--contest-bad);
}

.contest-problem-row--checking .contest-problem-status {
  color: var(--contest-checking);
}

.contest-problem-row__detail {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--contest-faint);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contest-problem-row__result {
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
  white-space: nowrap;
}

.contest-problem-row--idle .contest-problem-row__result,
.contest-problem-row--idle .contest-problem-status {
  color: var(--contest-faint);
  font-weight: 580;
}

.contest-problem-row:hover > .arrow {
  color: var(--ink);
  transform: translateX(3px);
}

@keyframes contest-problem-row-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.problem-hero {
  padding-bottom: 42px;
  border-bottom: 1px solid var(--line-strong);
}

.problem-hero h1,
.result-header h1 {
  margin-bottom: 0;
}

.statement.prose {
  max-width: 780px;
  padding: 42px 0 58px;
}

.statement--muted-examples pre {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: #555550;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.statement--muted-examples pre:hover {
  border-color: var(--line-strong);
  background: #f3f3f0;
}

.submission-section {
  border-top: 1px solid var(--line-strong);
}

.source-form {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  transition: border-color 220ms ease, box-shadow 220ms ease, transform 320ms cubic-bezier(.22, 1, .36, 1);
}

.source-form:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}

.source-form:focus-within {
  border-color: var(--attempt-accepted);
  box-shadow: 0 0 0 2px rgb(15 118 110 / 12%);
  transform: none;
}

.source-form__prompt {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 14px;
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: text;
  font-size: 11px;
  font-weight: 700;
  transition: opacity 160ms ease, transform 220ms cubic-bezier(.22, 1, .36, 1);
}

.source-form:focus-within .source-form__prompt {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.source-form .code-input {
  padding: 58px 22px 22px;
  background: var(--surface);
  color: var(--ink);
  caret-color: var(--ink);
}

.source-form .code-input:focus {
  box-shadow: none;
}

.source-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11px;
}

.source-form__shortcut {
  margin-left: auto;
}

.source-form__footer .button--primary {
  background: var(--ink);
  color: #fff;
}

.source-form__footer .button--primary:hover {
  background: #333;
}

.attempts-section {
  margin-top: 58px;
}

.attempts-section__heading {
  display: flex;
  min-height: 82px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0 16px;
  border-bottom: 1px solid var(--line);
}

.attempts-section__heading .overline {
  margin-bottom: 4px;
}

.attempts-section__meta {
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.attempt-timeline {
  position: relative;
  margin: 0;
  padding: 7px 0 5px;
  list-style: none;
}

.attempt-timeline::before {
  position: absolute;
  top: 28px;
  bottom: 28px;
  left: 121px;
  width: 1px;
  background: var(--line-strong);
  content: "";
  pointer-events: none;
}

.attempt-timeline__link {
  position: relative;
  display: grid;
  min-height: 76px;
  grid-template-columns: 100px 18px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 11px 0;
  touch-action: manipulation;
}

.attempt-timeline__link:focus-visible {
  z-index: 2;
  outline-offset: -3px;
}

.attempt-timeline__time {
  padding-top: 9px;
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.attempt-timeline__node {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  margin: 12px auto 0;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 1px var(--attempt-node-ring);
  color: var(--attempt-running);
}

.attempt-timeline__node--accepted {
  color: var(--attempt-accepted);
}

.attempt-timeline__node--wrong_answer,
.attempt-timeline__node--compile_error,
.attempt-timeline__node--failed {
  color: var(--attempt-error);
}

.attempt-timeline__card {
  display: grid;
  min-height: 64px;
  grid-template-columns: minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--attempt-card-line);
  border-radius: 6px;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.attempt-timeline__link:hover .attempt-timeline__card,
.attempt-timeline__link:active .attempt-timeline__card {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.attempt-timeline__link:hover .arrow {
  color: var(--ink);
  transform: translateX(3px);
}

.attempt-timeline__summary {
  min-width: 0;
}

.attempt-timeline__summary strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
  font-weight: 650;
}

.attempt-status {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--attempt-running);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.25;
}

.attempt-status.attempt-status--accepted {
  color: var(--attempt-accepted);
}

.attempt-status.attempt-status--wrong_answer,
.attempt-status.attempt-status--compile_error,
.attempt-status.attempt-status--failed {
  color: var(--attempt-error);
}

.attempt-status__dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.attempt-timeline__meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.attempt-timeline__tests {
  color: #64645f;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.attempt-timeline__phase {
  color: #6f6f69;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.075em;
  line-height: 1.25;
  text-transform: uppercase;
  white-space: nowrap;
}

.attempt-timeline__phase--official {
  color: var(--attempt-official);
}

.result-header {
  padding-bottom: 36px;
  border-bottom: 1px solid var(--line-strong);
}

.run-state {
  --run-state-color: #2c6866;
  --run-state-soft: #eaf3f1;

  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 160px;
  min-height: 240px;
  align-items: center;
  gap: 34px;
  margin-top: 34px;
  padding: 34px 38px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  animation: reveal 360ms ease-out both;
}

.run-state[data-status="accepted"] {
  --run-state-color: var(--green);
  --run-state-soft: #eaf5ee;
}

.run-state[data-status="wrong_answer"],
.run-state[data-status="compile_error"],
.run-state[data-status="failed"] {
  --run-state-color: var(--red);
  --run-state-soft: #f9eeee;
}

.run-state__orbit {
  position: relative;
  display: grid;
  width: 112px;
  height: 112px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--run-state-color);
  isolation: isolate;
}

.run-state__orbit::before,
.run-state__orbit::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.run-state__orbit::before {
  inset: 9px;
  border: 2px solid var(--run-state-soft);
  border-top-color: var(--run-state-color);
  animation: run-state-orbit 1.6s linear infinite;
}

.run-state__orbit::after {
  z-index: -1;
  inset: 25px;
  background: var(--run-state-soft);
  animation: run-state-breathe 1.35s cubic-bezier(.22, 1, .36, 1) infinite alternate;
}

.run-state[data-terminal="true"] .run-state__orbit::before,
.run-state[data-terminal="true"] .run-state__orbit::after {
  animation: none;
}

.run-state[data-terminal="true"] .run-state__orbit::before {
  border-color: var(--run-state-color);
  opacity: 0.28;
}

.run-state__orbit strong {
  position: relative;
  z-index: 1;
  font: 750 17px/1 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.run-state__copy .overline {
  margin-bottom: 7px;
}

.run-state__title {
  margin: 0 0 9px;
  color: var(--run-state-color);
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.run-state__detail {
  max-width: 500px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.run-state__metric {
  min-width: 0;
  padding-left: 26px;
  border-left: 1px solid var(--line);
}

.run-state__metric > span:first-child {
  display: block;
  color: var(--faint);
  font-size: 11px;
}

.run-state__metric > strong {
  display: block;
  margin: 7px 0 12px;
  font: 650 22px/1 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: nowrap;
}

.run-state__progress {
  display: block;
  width: 100%;
  height: 4px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  appearance: none;
  background: var(--line);
  color: var(--run-state-color);
}

.run-state__progress::-webkit-progress-bar {
  background: var(--line);
}

.run-state__progress::-webkit-progress-value {
  background: var(--run-state-color);
  transition: width 420ms cubic-bezier(.22, 1, .36, 1);
}

.run-state__progress::-moz-progress-bar {
  background: var(--run-state-color);
  transition: width 420ms cubic-bezier(.22, 1, .36, 1);
}

.run-state__progress--indeterminate {
  position: relative;
}

.run-state__progress--indeterminate::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: 34%;
  background: var(--run-state-color);
  content: "";
  animation: run-state-progress 1.45s cubic-bezier(.45, 0, .55, 1) infinite;
}

.run-state[data-terminal="true"] .run-state__progress--indeterminate::after {
  width: 100%;
  animation: none;
}

@keyframes run-state-orbit {
  to { transform: rotate(360deg); }
}

@keyframes run-state-breathe {
  from { opacity: 0.72; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1.04); }
}

@keyframes run-state-progress {
  from { transform: translateX(-105%); }
  to { transform: translateX(300%); }
}

.metadata-line {
  display: flex;
  flex-wrap: wrap;
  gap: 28px 54px;
  margin: 0;
  padding: 24px 0 46px;
}

.metadata-line div {
  display: flex;
  gap: 8px;
  font-size: 13px;
}

.metadata-line dt {
  color: var(--faint);
}

.metadata-line dd {
  margin: 0;
  font-weight: 560;
}

.code-view {
  border-top: 1px solid var(--line-strong);
}

.code-view pre {
  max-height: 68vh;
  overflow: auto;
  margin: 0;
  padding: 25px 28px;
  border-radius: 7px;
  background: var(--code);
  color: #eeeeea;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.7;
  tab-size: 4;
  white-space: pre;
}

.code-view code {
  font: inherit;
  white-space: pre;
}

.reading-header {
  max-width: 760px;
  padding: 18px 0 42px;
  border-bottom: 1px solid var(--line-strong);
}

.editorial-body {
  max-width: 760px;
  padding: 36px 0 60px;
}

.admin-section {
  margin-top: 54px;
}

.admin-list {
  border-bottom: 1px solid var(--line);
}

.admin-row {
  border-top: 1px solid var(--line);
}

.admin-row > summary,
.admin-row--static,
.admin-row--link {
  display: grid;
  min-height: 76px;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 24px;
  padding: 13px 2px 13px 0;
  cursor: pointer;
  list-style: none;
}

.admin-row > summary::-webkit-details-marker {
  display: none;
}

.admin-row--static {
  grid-template-columns: minmax(0, 1fr) auto;
  cursor: default;
}

.admin-row--link {
  transition: background-color 140ms ease;
}

.admin-row--link:hover {
  background: var(--surface-hover);
}

.admin-row--link:active {
  background: var(--surface-soft);
}

.admin-row--problem > summary,
.admin-row--problem.admin-row--link {
  grid-template-columns: 48px minmax(0, 1fr) auto 24px;
}

.admin-row[open] > summary .arrow {
  transform: rotate(180deg);
}

.admin-row__primary {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.admin-row__primary strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row__primary small {
  color: var(--faint);
  font-size: 12px;
}

.admin-row__body {
  padding: 12px 0 28px;
  border-top: 1px dashed var(--line);
}

.editorial-preview {
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.editorial-preview > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

.editorial-preview .prose {
  padding-top: 18px;
}

.admin-editorial-heading > div {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.admin-editorial-note {
  max-width: 680px;
  margin-top: 2px;
}

.admin-editorial-form {
  max-width: 860px;
  margin-top: 24px;
}

.admin-editorial-access {
  max-width: 860px;
  margin-top: 8px;
  border-top: 1px solid var(--line-strong);
}

.admin-editorial-access__list {
  border-bottom: 1px solid var(--line);
}

.admin-editorial-access__row {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
}

.admin-editorial-access__student {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.admin-editorial-access__student strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-editorial-access__student span {
  overflow: hidden;
  color: var(--faint);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-editorial-access__controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 14px;
}

.compact-form {
  display: grid;
  max-width: 560px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 16px;
}

.modal {
  width: min(calc(100% - 32px), 540px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 18px 70px rgb(0 0 0 / 12%);
}

.modal--wide {
  width: min(calc(100% - 32px), 820px);
}

.modal::backdrop {
  background: rgb(20 20 20 / 32%);
  backdrop-filter: blur(2px);
}

.modal__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 4px;
}

.modal__heading h2 {
  font-size: 24px;
}

.check-field,
.choice-group label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.check-field input,
.choice-group input {
  margin-top: 3px;
}

.choice-group,
.test-cases {
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-group legend,
.test-cases legend {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.choice-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice-group label span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.choice-group small {
  color: var(--faint);
}

.form-grid {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 14px;
}

.test-case {
  display: grid;
  grid-template-columns: 36px 1fr 1fr;
  align-items: start;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.test-case__number {
  padding-top: 31px;
  color: var(--faint);
  font-size: 12px;
}

@media (max-width: 860px) {
  .student-contest-page {
    width: min(calc(100% - 44px), 780px);
  }

  .contest-header {
    display: block;
    padding-bottom: 46px;
  }

  .contest-header h1 {
    font-size: clamp(34px, 7.4vw, 48px);
  }

  .contest-summary {
    width: fit-content;
    margin-top: 26px;
    margin-left: auto;
  }

  .contest-problem-row {
    grid-template-columns: 44px minmax(0, 1fr) 20px;
    gap: 16px;
    padding: 15px 2px 15px 0;
  }

  .contest-problem-row__progress {
    grid-column: 2 / -1;
    grid-row: 2;
    margin-top: -5px;
  }

  .contest-problem-row > .arrow {
    grid-column: 3;
    grid-row: 1;
  }

  .run-state {
    grid-template-columns: 120px minmax(0, 1fr);
  }

  .run-state__metric {
    grid-column: 1 / -1;
    padding: 18px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 700px) {
  .actions {
    margin-top: 26px;
  }

  .module-header,
  .problem-hero,
  .result-header {
    display: block;
    padding-bottom: 46px;
  }

  .module-header__state,
  .problem-hero__meta {
    margin-top: 24px;
    align-items: flex-start;
    text-align: left;
  }

  .contest-summary {
    align-items: flex-start;
    margin-left: 0;
    text-align: left;
  }

  .contest-summary__metric {
    align-items: flex-start;
  }

  .run-state {
    grid-template-columns: 74px minmax(0, 1fr);
    min-height: 0;
    gap: 18px;
    margin-top: 24px;
    padding: 24px 20px;
  }

  .run-state__orbit {
    width: 64px;
    height: 64px;
  }

  .run-state__orbit::before {
    inset: 5px;
  }

  .run-state__orbit::after {
    inset: 15px;
  }

  .run-state__title {
    font-size: 23px;
  }

  .problem-row--managed {
    grid-template-columns: 42px minmax(0, 1fr) 20px;
  }

  .attempts-section {
    margin-top: 48px;
  }

  .attempts-section__heading {
    min-height: 76px;
    align-items: flex-start;
    padding: 18px 0 14px;
  }

  .attempts-section__meta {
    max-width: 145px;
    line-height: 1.35;
  }

  .attempt-timeline::before {
    left: 6px;
  }

  .attempt-timeline__link {
    min-height: 98px;
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 9px;
    padding: 8px 0;
  }

  .attempt-timeline__time {
    grid-column: 2;
    grid-row: 1;
    padding: 0;
    text-align: left;
  }

  .attempt-timeline__node {
    grid-column: 1;
    grid-row: 1 / 3;
    margin-top: 4px;
  }

  .attempt-timeline__card {
    min-height: 64px;
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr) 18px;
    gap: 8px;
  }

  .attempt-timeline__meta {
    grid-column: 1;
    flex-wrap: wrap;
    gap: 5px 10px;
    margin-top: 5px;
  }

  .attempt-timeline__card > .arrow {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .source-form__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .source-form__footer > span {
    display: none;
  }

  .source-form:hover {
    transform: none;
  }

  .source-form .code-input {
    min-height: 340px;
    padding: 56px 16px 18px;
  }

  .source-form__footer .button {
    width: 100%;
  }

  .metadata-line {
    gap: 12px 28px;
  }

  .admin-row > summary,
  .admin-row--link {
    gap: 12px;
  }

  .admin-row--problem > summary,
  .admin-row--problem.admin-row--link {
    grid-template-columns: 42px minmax(0, 1fr) 20px;
  }

  .admin-row--problem > summary .label,
  .admin-row--problem.admin-row--link .label {
    display: none;
  }

  .admin-editorial-heading {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 0;
  }

  .admin-editorial-access__row {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    padding: 18px 0;
  }

  .admin-editorial-access__controls {
    justify-content: space-between;
  }

  .compact-form,
  .form-grid,
  .test-case {
    grid-template-columns: 1fr;
  }

  .test-case__number {
    padding-top: 0;
  }

  .modal {
    padding: 22px;
  }
}

@media (max-width: 520px) {
  .contest-header {
    padding: 4px 0 40px;
  }

  .contest-header h1 {
    font-size: 34px;
    line-height: 1.06;
  }

  .contest-header .module-header__description {
    font-size: 12px;
  }

  .contest-summary {
    width: 100%;
    gap: 10px;
    margin-top: 22px;
  }

  .contest-summary--thematic {
    width: auto;
  }

  .contest-summary__score {
    font-size: 25px;
  }

  .contest-summary__timer {
    font-size: 21px;
  }

  .contest-summary__official {
    flex-wrap: wrap;
  }

  .student-contest-page .section__heading {
    padding-bottom: 12px;
  }

  .student-contest-page .section__hint {
    display: none;
  }

  .contest-problem-row {
    min-height: 100px;
    grid-template-columns: 40px minmax(0, 1fr) 18px;
    gap: 12px;
  }

  .contest-problem-row__number {
    width: 36px;
    height: 36px;
  }

  .contest-problem-row__title {
    font-size: 15px;
  }

  .contest-problem-row__progress {
    display: block;
  }

  .contest-problem-row__detail {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .contest-problem-row__result {
    display: block;
    margin-top: 2px;
  }
}

/* AGE-84 Live Coding task context */
.live-shell { grid-template-rows: 64px auto auto minmax(0, 1fr); }
.live-toolbar { grid-row: 1; grid-template-columns: minmax(0, 1fr) auto; }
.live-recovery { grid-row: 2; }
.live-mobile-nav { grid-row: 3; }
.live-workspace { grid-row: 4; }
.live-toolbar__room > div { display: grid; align-items: center; gap: 2px; }
.live-toolbar__room .live-toolbar__presence { justify-content: flex-start; gap: 10px; }
.live-toolbar__actions .button { min-width: 112px; min-height: 38px; }
.live-submit-admin { color: var(--faint); font-size: 12px; }
.live-mobile-nav { display: none; }
.live-workspace { grid-template-columns: minmax(0, 1.55fr) minmax(320px, .9fr); }
.live-side { grid-template-rows: auto minmax(0, 1fr); }
.live-selector { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); }
.live-selector__row { display: grid; width: 100%; min-height: 54px; grid-template-columns: 64px minmax(0, 1fr) 66px; align-items: center; gap: 10px; padding: 7px 12px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.live-selector__row:last-child { border-bottom: 0; }
.live-selector__row:disabled { cursor: default; }
.live-selector__row > span:first-child { color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.live-selector__row strong { display: -webkit-box; overflow: hidden; font-size: 12px; text-align: center; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.live-selector__action { color: var(--muted); font-size: 11px; font-weight: 650; text-align: center; }
.live-selector__row:disabled .live-selector__action { color: var(--faint); }
.live-selector__row strong.is-confirmed { animation: live-context-confirm 360ms ease-out both; }
.live-context { grid-template-rows: 43px minmax(0, 1fr); }
.live-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: #fbfbfa; }
.live-tabs button { position: relative; min-width: 0; border: 0; background: transparent; color: var(--faint); font-size: 10px; font-weight: 680; cursor: pointer; }
.live-tabs button[aria-selected="true"] { color: var(--ink); }
.live-tabs button[aria-selected="true"]::after { position: absolute; right: 10px; bottom: -1px; left: 10px; height: 2px; background: var(--ink); content: ""; }
.live-tabpanel { min-width: 0; min-height: 0; overflow: auto; background: var(--surface); animation: live-tab-in 180ms ease-out both; }
.live-tabpanel[hidden] { display: none; }
.live-tabpanel > .live-editor-mount { height: 100%; min-height: 180px; }
.live-empty { display: grid; min-height: 180px; place-content: center; justify-items: center; padding: 28px; color: var(--faint); text-align: center; }
.live-empty strong { color: var(--muted); font-size: 13px; }
.live-empty p { max-width: 300px; margin: 7px 0; font-size: 11px; line-height: 1.5; }
.live-statement { padding: 22px 24px 40px; }
.live-focus { --live-status: #356c68; --live-status-soft: rgb(53 108 104 / 14%); display: grid; min-height: 100%; align-content: center; justify-items: center; gap: 11px; padding: 28px; text-align: center; }
.live-focus[data-status="idle"] { --live-status: #8a8a84; --live-status-soft: rgb(138 138 132 / 12%); }
.live-focus[data-status="wrong_answer"], .live-focus[data-status="compile_error"], .live-focus[data-status="failed"] { --live-status: var(--red); --live-status-soft: var(--red-soft); }
.live-focus__mark { position: relative; display: grid; width: 112px; height: 112px; margin-bottom: 10px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--live-status); font: 760 14px/1 SFMono-Regular, Consolas, monospace; animation: live-focus-lock 420ms ease-out both; }
.live-focus__mark::before { position: absolute; inset: 9px; border: 2px solid var(--live-status-soft); border-top-color: var(--live-status); border-radius: 50%; content: ""; animation: live-focus-orbit 1.35s linear infinite; }
.live-focus[data-terminal="true"] .live-focus__mark::before, .live-focus[data-status="idle"] .live-focus__mark::before { border-color: var(--live-status); opacity: .22; animation: none; }
.live-focus[data-status="accepted"] .live-focus__mark { background: var(--live-status-soft); animation: live-focus-accepted 520ms ease-out both; }
.live-focus[data-status="wrong_answer"] .live-focus__mark, .live-focus[data-status="compile_error"] .live-focus__mark, .live-focus[data-status="failed"] .live-focus__mark { background: var(--live-status-soft); animation: live-focus-wrong 360ms ease-out both; }
.live-focus__mark strong { position: relative; }
.live-focus__copy h2 { margin: 0; color: var(--live-status); font-size: 28px; letter-spacing: -.025em; }
.live-focus__copy p { max-width: 280px; margin: 7px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.live-focus__copy a { display: inline-block; margin-top: 5px; color: var(--ink); font-size: 11px; font-weight: 680; }
.live-dialog-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgb(27 27 25 / 35%); animation: live-backdrop-in 220ms ease-out both; }
.live-dialog-backdrop[hidden] { display: none; }
.live-dialog { display: grid; width: min(600px, 100%); max-height: min(620px, 100%); grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; border-radius: 10px; background: var(--surface); box-shadow: 0 18px 50px rgb(0 0 0 / 22%); animation: live-dialog-in 280ms ease-out both; }
.live-dialog > header { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.live-dialog__step { display: flex; align-items: center; gap: 7px; margin: 0; padding: 0; color: var(--faint); font-size: 9px; font-weight: 720; letter-spacing: .05em; list-style: none; text-transform: uppercase; }
.live-dialog__step [data-current] { color: var(--ink); }
.live-dialog__step-separator { width: 22px; height: 1px; background: var(--line-strong); }
.live-dialog h2 { margin: 10px 0 0; font-size: 20px; letter-spacing: -.025em; }
.live-dialog header p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.live-dialog__caption { padding: 10px 20px; border-bottom: 1px solid var(--line); color: var(--faint); font-size: 9px; font-weight: 720; letter-spacing: .06em; text-transform: uppercase; }
.live-dialog__list { min-height: 0; max-height: 360px; overflow: auto; overscroll-behavior: contain; }
.live-dialog__row { display: grid; width: 100%; min-height: 54px; grid-template-columns: 32px minmax(0, 1fr) 18px; align-items: center; gap: 10px; padding: 9px 20px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; transition: background-color 120ms ease-out, color 120ms ease-out; }
.live-dialog__row[hidden] { display: none; }
.live-dialog__contest { grid-template-columns: minmax(0, 1fr) 18px; }
.live-dialog__row:hover, .live-dialog__row[data-selected] { background: var(--surface-soft); }
.live-dialog__row[data-selected] { color: var(--teal, #356c68); }
.live-dialog__row::after { width: 7px; height: 12px; justify-self: center; border: solid currentColor; border-width: 0 2px 2px 0; content: ""; opacity: 0; transform: rotate(45deg); }
.live-dialog__row[data-selected]::after { opacity: 1; }
.live-dialog__row strong { display: block; color: var(--ink); font-size: 12px; }
.live-dialog__row small, .live-dialog__code { color: var(--faint); font-size: 9px; }
.live-dialog__empty { padding: 30px 20px; color: var(--faint); text-align: center; }
.live-dialog > footer { display: flex; justify-content: flex-end; gap: 7px; padding: 12px 20px 18px; border-top: 1px solid var(--line); }
.cm-remoteCursor { opacity: .46; transition: opacity 160ms ease-out; }
.cm-remoteCursor.is-active { opacity: 1; animation: live-remote-attention 960ms ease-out both; }
.cm-remoteCursor__bubble { position: absolute; z-index: 2; top: -4px; left: 5px; padding: 3px 6px; border-radius: 3px; background: var(--live-remote-color); color: var(--live-remote-text); font: 9px/1.2 system-ui, sans-serif; opacity: 0; pointer-events: none; white-space: nowrap; transform: translateY(-100%); }
.cm-remoteCursor.is-active .cm-remoteCursor__bubble { animation: live-remote-bubble 960ms ease-out both; }
@keyframes live-tab-in { from { opacity: 0; transform: translateY(3px); } }
@keyframes live-backdrop-in { from { opacity: 0; } }
@keyframes live-dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes live-context-confirm { from { opacity: .45; transform: translateY(2px); } }
@keyframes live-focus-lock { from { opacity: .45; transform: scale(.92); } }
@keyframes live-focus-orbit { to { transform: rotate(360deg); } }
@keyframes live-focus-accepted { 0% { transform: scale(.9); background: transparent; } 62% { transform: scale(1.04); } 100% { transform: scale(1); background: var(--live-status-soft); } }
@keyframes live-focus-wrong { 0% { transform: translateX(-3px); } 35% { transform: translateX(3px); } 70% { transform: translateX(-1px); } }
@keyframes live-remote-attention { 0%, 55% { opacity: 1; } 100% { opacity: .46; } }
@keyframes live-remote-bubble { 0% { opacity: 0; transform: translate(3px, -90%); } 12%, 55% { opacity: 1; transform: translate(3px, -100%); } 100% { opacity: 0; transform: translate(3px, -106%); } }
@media (max-width: 820px) and (min-width: 481px) { .live-editor-document, .live-editor-page { height: 100%; overflow: hidden; } .live-shell { height: 100%; min-height: 0; } .live-workspace { grid-template-columns: minmax(0, 1.4fr) minmax(300px, .9fr); min-height: 0; } .live-panel--code { height: auto; min-height: 0; } .live-side { grid-template-rows: auto minmax(0, 1fr); } }
@media (max-width: 480px) {
  .live-editor-document, .live-editor-page { height: 100%; overflow: hidden; }
  .live-shell { height: 100%; min-height: 0; grid-template-rows: auto auto auto minmax(0, 1fr); }
  .live-toolbar { position: static; grid-template-columns: 1fr; gap: 8px; padding: 9px 12px 0; }
  .live-toolbar__room { min-height: 42px; }
  .live-toolbar__actions { display: grid; grid-template-columns: 1fr 1fr; margin: 0 -12px; gap: 0; border-top: 1px solid var(--line); }
  .live-toolbar__actions .button { min-height: 44px; border: 0; border-right: 1px solid var(--line); border-radius: 0; }
  .live-mobile-nav { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); background: var(--surface); }
  .live-mobile-nav button { min-height: 44px; border: 0; background: transparent; color: var(--faint); font-size: 10px; }
  .live-mobile-nav button.is-active { color: var(--ink); box-shadow: inset 0 -2px var(--ink); }
  .live-workspace { display: block; min-height: 0; padding: 0; }
  .live-panel--code { height: 100%; min-height: 0; border: 0; border-radius: 0; }
  .live-side { display: none; height: 100%; gap: 0; }
  .live-shell[data-live-region="statement"] .live-panel--code, .live-shell[data-live-region="stdin"] .live-panel--code, .live-shell[data-live-region="check"] .live-panel--code, .live-shell[data-live-region="context"] .live-panel--code { display: none; }
  .live-shell:not([data-live-region="code"]) .live-side { display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .live-selector, .live-context { border-right: 0; border-left: 0; border-radius: 0; }
  .live-selector__row { min-height: 54px; }
  .live-selector__action { display: grid; min-height: 44px; place-items: center; }
  .live-tabs { display: none; }
  .live-context { grid-template-rows: minmax(0, 1fr); }
  .live-dialog-backdrop { padding: 0; }
  .live-dialog { width: 100vw; max-width: none; height: 100%; max-height: none; border-radius: 0; }
  .live-dialog__list { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  .live-tabpanel, .live-dialog-backdrop, .live-dialog, .live-dialog__list, .live-selector__row strong, .live-focus__mark, .live-focus__mark::before, .cm-remoteCursor.is-active, .cm-remoteCursor.is-active .cm-remoteCursor__bubble { animation: none !important; transform: none !important; transition-duration: 0s !important; }
  .cm-remoteCursor.is-active .cm-remoteCursor__bubble { opacity: 1; transition: opacity 650ms linear !important; }
}

/* AGE-84 frozen prototype conformance after staging visual audit. */
.live-editor-page {
  --paper: #fdfdfc;
  --surface: #fdfdfc;
  --surface-soft: #f4f4f1;
  --ink: #1b1b19;
  --muted: #666661;
  --faint: #777772;
  --line: #e3e3df;
  --line-strong: #cfcfca;
  --blue: #226b91;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.live-workspace { grid-template-columns: minmax(0, 2.1fr) minmax(360px, .78fr); }
.live-panel, .live-selector { border-radius: 9px; background: var(--paper); box-shadow: none; }
.live-panel__header { background: #fafaf8; }
.live-file-dot { background: #226b91; }
.live-editor-mount .cm-editor { font-size: 12.5px; }
.live-editor-mount .cm-scroller { line-height: 1.58; }
.live-editor-mount .cm-gutters { min-width: 50px; background: #fcfcfb; }
.live-editor-mount .cm-lineNumbers .cm-gutterElement { min-width: 49px; padding: 0 11px 0 6px; }
.live-toolbar__room { gap: 10px; }
.live-toolbar__room > div { justify-items: start; gap: 2px; }
.live-toolbar__room strong { justify-self: start; font-size: 13px; }
.live-toolbar__room .live-toolbar__presence { width: max-content; max-width: 100%; justify-self: start; justify-content: flex-start; text-align: left; }
.live-back { width: 44px; height: 44px; border-radius: 7px; background: var(--paper); }
.live-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.live-toolbar__presence { gap: 7px; }
.live-connection { gap: 7px; font-size: 10px; }
.live-connection > span, .live-connection.is-online > span { width: 7px; height: 7px; background: #147d76; box-shadow: 0 0 0 3px #e8f3f1; }
.live-participants { display: none; }
.live-toolbar__actions { gap: 7px; }
.live-toolbar__actions .button { min-width: 0; min-height: 36px; padding: 0 12px; border-radius: 7px; font-size: 11px; font-weight: 720; }
.live-selector__row { min-height: 58px; grid-template-columns: 62px minmax(0, 1fr) auto; padding: 8px 13px; }
.live-selector__row > span:first-child { font-size: 9px; font-weight: 720; letter-spacing: .06em; }
.live-selector__row strong { font-size: 11px; font-weight: 700; line-height: 1.3; }
.live-selector__action { min-width: 0; color: var(--muted); font-size: 9px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.live-tabs { display: flex; height: 45px; grid-template-columns: none; align-items: stretch; justify-content: flex-start; overflow-x: auto; overflow-y: hidden; background: #fafaf8; }
.live-tabs button { flex: 0 0 auto; min-height: 44px; padding: 0 12px; border-bottom: 2px solid transparent; font-size: 10px; }
.live-tabs button[aria-selected="true"] { border-bottom-color: var(--ink); }
.live-tabs button[aria-selected="true"]::after { display: none; }
.live-context { grid-template-rows: 45px minmax(0, 1fr); }
.live-tabpanel { animation: live-content-change 220ms cubic-bezier(.16,1,.3,1) both; }
.live-tabpanel[data-live-panel="check"]:not([hidden]) { display: grid; min-height: 0; place-items: center; overflow: hidden; }
.live-tabpanel[data-live-panel="check"] > [data-live-check] { width: 100%; height: 100%; min-height: 0; }
.live-focus { height: 100%; min-height: 100%; place-content: center; }
.live-focus[data-status="idle"] { --live-status: #777772; --live-status-soft: #eeeeeb; }
.live-empty strong { font-size: 17px; }
.live-output__empty > span { display: none; }
.live-tabpanel[data-live-panel="output"]:not([hidden]) { display: grid; min-height: 0; }
.live-output { height: 100%; min-height: 100%; }
.live-output__empty { height: 100%; min-height: 100%; }
.live-output__empty p { font-size: 11px; }
.live-dialog { animation: live-dialog-in-audit 280ms cubic-bezier(.16,1,.3,1) both; }
.live-dialog > header { min-height: 79.5px; padding: 18px 20px 14px; }
.live-dialog__row { min-height: 54px; padding: 9px 20px; }
.live-dialog__row::after { transform: rotate(45deg) scale(.72); transition: opacity 120ms ease-out, transform 120ms ease-out; }
.live-dialog__row[data-selected]::after { transform: rotate(45deg) scale(1); }
.live-dialog > footer { min-height: 67px; padding: 12px 20px 18px; }
.live-dialog > footer .button { min-height: 36px; }
.live-selector__row strong.is-confirmed { animation: live-context-reveal 360ms cubic-bezier(.16,1,.3,1) both; }
.cm-remoteCursor__bubble { left: 7px; top: -2px; padding: 3px 6px 4px; border-radius: 4px; box-shadow: 0 4px 12px rgb(27 27 25 / 16%); font-size: 10px; font-weight: 700; }
.cm-remoteCursor.is-active { animation: live-remote-attention-audit 960ms cubic-bezier(.16,1,.3,1) both; }
.cm-remoteCursor.is-active .cm-remoteCursor__bubble { animation: live-remote-bubble-audit 960ms cubic-bezier(.16,1,.3,1) both; }
@keyframes live-content-change { from { opacity: 0; clip-path: inset(0 0 5% 0); } }
@keyframes live-dialog-in-audit { from { opacity: 0; transform: translateY(10px) scale(.985); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes live-context-reveal { from { opacity: .35; clip-path: inset(0 18% 0 0); color: #147d76; } }
@keyframes live-remote-attention-audit { 0% { opacity: .46; filter: none; } 12%,68% { opacity: 1; filter: drop-shadow(0 0 3px rgb(123 79 189 / 42%)); } 100% { opacity: .46; filter: none; } }
@keyframes live-remote-bubble-audit { 0% { opacity: 0; transform: translate(-3px,2px) scale(.96); clip-path: inset(0 100% 0 0 round 4px); } 12%,68% { opacity: 1; transform: none; clip-path: inset(0 0 0 0 round 4px); } 100% { opacity: 0; transform: translateY(-2px); clip-path: inset(0 0 0 0 round 4px); } }
@keyframes live-remote-cursor-reduced { 0%,72% { opacity: 1; } 100% { opacity: .46; } }
@keyframes live-remote-bubble-reduced { 0%,72% { opacity: 1; } 100% { opacity: 0; } }
@media (max-width: 820px) and (min-width: 481px) {
  .live-workspace { grid-template-columns: minmax(0, 1.4fr) minmax(300px, .9fr); }
}
@media (max-width: 480px) {
  .live-shell { grid-template-rows: 106px auto 50px minmax(0, 1fr); }
  .live-toolbar { min-height: 106px; grid-template-rows: 48px 48px; gap: 0; padding: 5px 10px; }
  .live-toolbar__room { grid-column: 1; grid-row: 1; }
  .live-toolbar__actions { grid-column: 1 / -1; grid-row: 2; display: flex; margin: 0; gap: 7px; border: 0; }
  .live-toolbar__actions .button { flex: 1; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 7px; }
  .live-mobile-nav button { min-height: 50px; }
  .live-context { grid-template-rows: 45px minmax(0, 1fr); }
  .live-tabs { display: flex; }
  .live-dialog > header { min-height: 79.5px; padding: 18px 16px 14px; }
  .live-dialog__caption, .live-dialog__row { padding-right: 16px; padding-left: 16px; }
  .live-dialog > footer { min-height: 73px; padding: 12px 16px 16px; }
  .live-dialog > footer .button { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .live-tabpanel, .live-dialog, .live-selector__row strong { animation: none !important; clip-path: none !important; filter: none !important; }
  .cm-remoteCursor.is-active { animation: live-remote-cursor-reduced 650ms linear both !important; transform: none !important; filter: none !important; }
  .cm-remoteCursor.is-active .cm-remoteCursor__bubble { animation: live-remote-bubble-reduced 650ms linear both !important; transform: none !important; clip-path: none !important; }
}
