.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.join-card { width: 100%; max-width: 460px; display: grid; gap: 14px; }
.join-card h1 { font-size: 26px; margin: 0; }
.join-card p { margin: 0; }
a.button { display: inline-block; text-align: center; padding: 10px 18px; border-radius: var(--radius); background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; }

.app { height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); min-width: 0; }
.topbar .me { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.points { font: 600 20px var(--mono); color: var(--accent); white-space: nowrap; }
.points .muted { font: 14px var(--font); }
.tabs { display: flex; gap: 4px; padding: 8px 20px 0; background: var(--surface); border-bottom: 1px solid var(--line); }
.tab { background: transparent; color: var(--muted); border-radius: 10px 10px 0 0; padding: 8px 18px; border-bottom: 3px solid transparent; }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
.view { flex: 1; min-height: 0; }
.slide-view { position: relative; }

.task-view { display: grid; grid-template-columns: 260px 1fr; min-height: 0; }
.task-list { border-right: 1px solid var(--line); background: var(--surface); padding: 16px; overflow: auto; display: grid; gap: 6px; align-content: start; }
.task-list h3 { margin: 0 0 4px; }
.task-list .desc { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.task-item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: transparent; color: var(--ink); font-weight: 500; padding: 10px 12px; border-radius: 10px; }
.task-item.active { background: var(--accent-soft); color: var(--accent-ink); }
.task-item .mark .ico { width: 13px; height: 13px; vertical-align: 0; }
.task-item .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; border: 2px solid var(--line); flex: none; }
.task-item.solved .mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.task-item.failed .mark { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.task-pane { overflow: auto; padding: 28px; min-width: 0; }

.task-card { max-width: 820px; margin: 0 auto; display: grid; gap: 18px; }
.task-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.task-head h2 { margin: 0; }
.task-prompt { font-size: 20px; margin: 0; }
.task-body { display: grid; gap: 14px; justify-items: start; overflow-x: auto; padding: 4px; }
.bits-row { display: flex; gap: 8px; align-items: start; }
.divider { width: 100%; max-width: 560px; border-top: 2px solid var(--line); }
.sum { font-size: 18px; color: var(--muted); }
.answer { font-size: 22px; width: min(320px, 100%); }
.swatch { width: 120px; height: 60px; border-radius: 12px; border: 1px solid var(--line); }
.chmod-task { display: flex; gap: 32px; align-items: center; flex-wrap: wrap; }
.chmod-task .octal { font-size: 20px; color: var(--muted); margin-top: 8px; }
.choice button { min-width: 120px; font-size: 18px; }
.feedback { min-height: 28px; font-weight: 600; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }
.task-done { text-align: center; padding: 40px 0; }

.empty { height: 100%; display: grid; place-content: center; text-align: center; gap: 8px; color: var(--muted); padding: 24px; }

/* Редактор Python */
.py { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; height: 100%; min-height: 0; }
.py-main { display: grid; grid-template-rows: auto 1fr auto; gap: 10px; min-height: 0; }
.editor { position: relative; display: grid; grid-template-columns: auto 1fr; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; min-height: 360px; }
.editor .gutter { padding: 12px 8px 12px 12px; background: var(--surface-2); color: var(--muted); font: 14px/1.5 var(--mono); text-align: right; user-select: none; overflow: hidden; white-space: pre; }
.editor textarea { border: 0; border-radius: 0; resize: none; padding: 12px; font: 14px/1.5 var(--mono); white-space: pre; overflow: auto; tab-size: 4; box-shadow: none !important; height: 100%; }
.py-side { display: grid; gap: 10px; align-content: start; overflow: auto; min-height: 0; }
.stage-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.stage-item .title { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.stage-item .st { display: inline-flex; color: var(--muted); }
.stage-item .st.ok { color: var(--ok); }
.stage-item .st.bad { color: var(--bad); }
.stage-item .msg { font: 13px/1.4 var(--mono); color: var(--bad); margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.stage-item.solved { border-color: var(--ok); background: var(--ok-bg); }
.py-out { font: 13px/1.4 var(--mono); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; max-height: 140px; overflow: auto; }
.py-status { font-size: 14px; color: var(--muted); }
.py-task-pane { padding: 20px; }

@media (max-width: 900px) {
  .task-view { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .task-list { border-right: 0; border-bottom: 1px solid var(--line); grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .task-list h3, .task-list .desc { display: none; }
  .task-pane { padding: 16px; }
  .py { grid-template-columns: 1fr; }
  .bit { width: 40px; height: 48px; font-size: 20px; }
}
.small { font-size: 13px; }
.small-link { font-size: 14px; }

/* Микроанимации не меняют размеры элементов и не мешают вводу ответа. */
.task-item, .choice button, .task-actions button, .tab {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.answer { transition: border-color .2s ease, box-shadow .2s ease; }
.feedback { transform-origin: left center; }
.py-status[data-busy="true"]::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  vertical-align: -1px; animation: python-busy .8s linear infinite;
}
@keyframes python-busy { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: no-preference) {
  .join-card, .py-main { animation: pane-in .45s cubic-bezier(.22, 1, .36, 1) both; }
  .task-done, #task-pane > .badge.ok { animation: pane-in .4s ease-out both; }
  @keyframes pane-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
}

.slide-navigation { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.slide-navigation select { flex: 1; min-width: 0; width: 0; }
.slide-navigation button { flex: none; }
.calculator { position: relative; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 5; }
.calculator summary { cursor: pointer; padding: 10px 20px; color: var(--accent-ink); }
.calculator-body { position: absolute; right: 12px; top: 100%; width: min(340px, calc(100vw - 24px)); max-height: 65vh; overflow: auto; display: grid; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px #0003; }
.calculator-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.calculator-result { font: 16px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .slide-navigation { gap: 4px; padding: 8px; }
  .slide-navigation button { padding: 8px; font-size: 12px; }
}

.tabs { align-items: center; flex-wrap: wrap; }
.calculator-toggle { margin: 0 0 6px auto; background: var(--accent); color: #fff; }
.calculator:not([open]) { display: none; }
.slide-navigation select { min-height: 42px; }
@media (max-width: 600px) {
  .tabs { padding-left: 8px; padding-right: 8px; }
  .tab { padding: 8px; font-size: 13px; }
  .calculator-toggle { padding: 8px; font-size: 13px; }
}
