:root {
  --bg: #f7f8f9;
  --panel: #ffffff;
  --line: #d9dee3;
  --line-deep: #bfc7cf;
  --text: #2e343c;
  --muted: #667280;
  --brand: #e53742;
  --ok: #2f9f69;
  --ok-soft: #eaf8f0;
  --warn-soft: #fff4dc;
  --warn-hard: #ffd9de;
  --nav-dark: #101214;
  --nav-dark-border: #2a2f36;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: Arial, "Helvetica Neue", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

.app {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 46px 1fr 56px;
}

.app.is-loading #bottomBar {
  opacity: 0.65;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 0 8px;
  height: 46px;
}

.topbar.warning-soft {
  background: linear-gradient(0deg, var(--panel), var(--warn-soft));
}

.topbar.warning-critical {
  background: linear-gradient(0deg, var(--panel), var(--warn-hard));
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 210px;
}

.logo {
  color: var(--brand);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.6px;
  line-height: 1;
}

.candidate-id {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
}

.test-status {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.topbar-center {
  text-align: left;
  justify-self: start;
  padding-left: 6px;
  font-size: 12px;
  color: #505a68;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #374051;
  border-radius: 3px;
  min-width: 26px;
  height: 24px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
}

.icon-btn:hover {
  border-color: var(--line-deep);
}

.icon-btn.ghost {
  border-color: transparent;
  background: transparent;
  padding: 0 4px;
  font-weight: 600;
  color: #4f5967;
}

.icon-btn.close {
  min-width: 30px;
  font-size: 14px;
  font-weight: 700;
}

.icon-btn svg,
.mini-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.main {
  position: relative;
  overflow: auto;
  padding: 8px 8px 62px;
}

.loading {
  max-width: 560px;
  margin: 120px auto 0;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 6px;
  text-align: center;
  padding: 18px;
}

.precheck-banner {
  max-width: 680px;
  margin: 12px auto 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 4px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
}

.precheck-card {
  max-width: 680px;
  margin: 8px auto 24px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 4px;
  padding: 16px;
}

.precheck-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.precheck-card h1 {
  margin: 0;
  font-size: 30px;
}

.precheck-ok {
  color: var(--ok);
  font-weight: 700;
  font-size: 18px;
}

.precheck-test-card {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8f9fb;
  padding: 12px;
}

.precheck-testinfo {
  display: flex;
  gap: 8px;
  color: #6a7483;
  font-size: 13px;
  margin-bottom: 6px;
}

.precheck-flag {
  color: #c04753;
}

.precheck-card h2 {
  margin: 0 0 4px;
  font-size: 24px;
}

.precheck-muted {
  color: #c04753;
  font-size: 14px;
}

.precheck-time {
  color: #576272;
  font-size: 14px;
  margin-top: 6px;
}

.precheck-section {
  margin: 12px 0 6px;
}

.precheck-list-wrap {
  margin: 8px 0 4px;
}

.precheck-subtitle {
  font-size: 26px;
  line-height: 1;
}

.precheck-subtext {
  color: #576272;
  margin-top: 4px;
}

.precheck-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #4b5564;
}

.audio-note {
  color: #6b7684;
  font-size: 12px;
  margin-bottom: 4px;
}

.audio-block audio {
  width: 100%;
  height: 32px;
}

.audio-block {
  border: 1px solid var(--line);
  background: #f8f9fb;
  border-radius: 4px;
  padding: 8px;
  margin: 10px 0 0;
}

.confirm-row {
  margin-top: 14px;
}

.confirm-btn {
  border: 1px solid #0f1316;
  background: #0f1316;
  color: #fff;
  border-radius: 3px;
  padding: 8px 14px;
  cursor: pointer;
}

.confirm-btn:hover {
  background: #242a31;
}

.exam-shell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}

.part-strip {
  border: 1px solid #e2e6da;
  background: #fbfcf7;
  border-radius: 2px;
  padding: 6px 10px;
  min-height: 46px;
}

.part-strip h2 {
  margin: 0 0 2px;
  font-size: 28px;
  line-height: 0.95;
}

.part-strip p {
  margin: 0;
  color: #4c5562;
  font-size: 15px;
}

.workspace {
  --split-left: 50;
  min-height: calc(100vh - 160px);
}

.workspace.single {
  display: block;
}

.workspace.split,
.workspace.writing {
  display: grid;
  grid-template-columns: minmax(320px, calc(var(--split-left) * 1%)) 20px minmax(320px, calc((100 - var(--split-left)) * 1%));
  align-items: stretch;
}

.doc-pane {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 2px;
  overflow: auto;
  min-height: 0;
}

.doc-content {
  padding: 12px;
  font-size: 15px;
  line-height: 1.45;
}

.doc-content p {
  margin: 0 0 9px;
}

.doc-content ul,
.doc-content ol {
  margin: 6px 0 10px 20px;
  padding: 0;
}

.doc-content img {
  max-width: 100%;
  height: auto;
  border: 1px solid #cfd5dc;
}

.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 9px 0;
  font-size: 15px;
}

.doc-content td,
.doc-content th {
  border: 1px solid #4b545f;
  padding: 4px 6px;
  vertical-align: top;
}

.inline-answer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 2px;
}

.inline-answer-num {
  font-size: 12px;
  color: #57616f;
  font-weight: 700;
}

.inline-answer-input {
  width: 118px;
  max-width: 118px;
  height: 24px;
  border: 1px solid #c0c7cf;
  border-radius: 2px;
  padding: 0 6px;
  background: #fff;
  font-size: 14px;
}

.inline-answer-input:focus {
  outline: 2px solid #d8eee3;
  border-color: #56a179;
}

.choice-table .table-choice-btn {
  width: 22px;
  height: 22px;
  border-radius: 99px;
  border: 1px solid #bec7d1;
  background: #fff;
  cursor: pointer;
  font-size: 10px;
}

.choice-table .table-choice-btn.active {
  border-color: #5ba8cc;
  background: #bfe9ff;
}

.choice-table td,
.choice-table th {
  text-align: center;
}

.choice-table td:first-child,
.choice-table th:first-child {
  text-align: left;
  width: 52%;
}

.choice-table tr:first-child td {
  font-weight: 700;
  background: #f6f7f9;
}

.single-choice {
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
}

.option-row {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  align-items: center;
}

.option-row .table-choice-btn {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.option-row span {
  line-height: 1.4;
}

.gap-questions {
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
}

.gap-questions p {
  margin: 0;
}

.drag-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 24px;
  padding: 0 6px;
  border: 1px dashed #c2cad3;
  border-radius: 2px;
  background: #fff;
  font-weight: 700;
  margin-left: 6px;
  color: #2a3b4c;
  user-select: none;
}

.drag-gap:empty::before {
  content: attr(data-placeholder);
  color: #9aa5b1;
  font-weight: 600;
}

.drag-gap.filled {
  border-style: solid;
  border-color: #9db7d1;
  background: #eef4fb;
}

.drag-gap.drag-over {
  border-color: #5ba8cc;
  background: #e6f5ff;
}

.drag-options {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 10px;
  border: 1px solid #d6dde6;
  border-radius: 8px;
  background: #fafbfc;
}

.drag-options.drag-over {
  border-color: #5ba8cc;
  background: #f0f8ff;
}

.drag-option {
  width: 100%;
  border: 1px solid #c8cfd7;
  border-radius: 6px;
  background: #fff;
  padding: 10px 12px;
  font-size: 14px;
  text-align: left;
  cursor: grab;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.drag-option:active {
  cursor: grabbing;
}

.drag-option.used {
  opacity: 0.6;
}

.drag-option .opt {
  width: 24px;
  height: 24px;
  border-radius: 99px;
  border: 1px solid #b7c1cb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #4b5664;
  background: #f8fafc;
}

.gap-select {
  margin-left: 6px;
  min-width: 64px;
  height: 24px;
  border: 1px solid #c0c7cf;
  border-radius: 2px;
  background: #fff;
  font-size: 13px;
}

.option-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.option-list li {
  margin: 4px 0;
}

.multi-choice {
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
}

.multi-choice-btn {
  width: 100%;
  border: 1px solid #c8cfd7;
  border-radius: 6px;
  background: #fff;
  padding: 10px 12px;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
}

.multi-choice-btn .opt {
  width: 24px;
  height: 24px;
  border-radius: 99px;
  border: 1px solid #b7c1cb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #4b5664;
  background: #f8fafc;
}

.multi-choice-btn.active {
  border-color: #5ba8cc;
  background: #e6f5ff;
}

.multi-choice-btn.active .opt {
  border-color: #5ba8cc;
  background: #bfe9ff;
  color: #2a3b4c;
}

.split-handle {
  margin: 0;
  width: 16px;
  height: 100%;
  border: 0;
  background: transparent;
  color: #3f4854;
  cursor: col-resize;
  display: block;
  position: relative;
  user-select: none;
}

.split-handle::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #c2cad3;
}

.split-handle::after {
  content: "\2194";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border: 1px solid #bfc7cf;
  background: #fff;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
}

.writing-shell {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 2px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  padding: 10px;
}

.writing-input {
  width: 100%;
  height: 100%;
  min-height: 320px;
  border: 1px solid #7acdc4;
  outline: 0;
  padding: 10px;
  resize: none;
  font: inherit;
  font-size: 15px;
}

.word-count {
  text-align: right;
  color: #505a68;
  font-size: 18px;
}

.floating-nav {
  position: fixed;
  right: 16px;
  top: 54%;
  transform: translateY(-50%);
  display: flex;
  gap: 6px;
  z-index: 8;
}

.nav-btn {
  width: 40px;
  height: 36px;
  border: 1px solid var(--nav-dark-border);
  border-radius: 2px;
  background: var(--nav-dark);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.nav-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.notes-panel {
  position: fixed;
  right: 0;
  top: 46px;
  bottom: 56px;
  width: 280px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  transform: translateX(100%);
  transition: transform 0.18s ease-out;
  z-index: 10;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.notes-panel.open {
  transform: translateX(0);
}

.app.notes-open .topbar,
.app.notes-open .main,
.app.notes-open .bottombar {
  margin-right: 280px;
}

.app.notes-open .floating-nav {
  right: 300px;
}

.notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
}

.notes-title {
  font-weight: 700;
}

.notes-meta {
  padding: 8px 10px;
  color: #4f5a67;
  font-size: 14px;
}

.notes-input {
  width: calc(100% - 20px);
  margin: 0 10px 10px;
  border: 1px solid #c0c8d1;
  border-radius: 3px;
  resize: none;
  padding: 8px;
  font: inherit;
}

.text-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #333c49;
  border-radius: 3px;
  padding: 7px 10px;
  cursor: pointer;
}

.text-btn.delete {
  margin: 0 10px 10px auto;
}

.bottombar {
  border-top: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 4px 8px;
  height: 56px;
}

.bottom-left {
  color: #6b7684;
  font-size: 12px;
}

.bottom-mid {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.part-tabs {
  display: flex;
  gap: 4px;
  min-height: 24px;
  overflow-x: auto;
}

.part-tab {
  border: 1px solid transparent;
  border-bottom: 2px solid #d3d9df;
  background: transparent;
  color: #4f5a68;
  font-size: 12px;
  padding: 1px 6px 2px;
  cursor: pointer;
  white-space: nowrap;
  min-width: 96px;
  text-align: left;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.part-tab .title-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.part-tab .title {
  color: #334050;
  font-weight: 600;
}

.part-tab .subline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.part-tab .meta {
  color: #7f8998;
  font-size: 9px;
}

.part-tab .done-mark {
  color: var(--ok);
  font-size: 12px;
  margin-right: 1px;
}

.part-tab .range {
  color: #6a7583;
  font-size: 9px;
}

.part-tab.active {
  color: #2f3a46;
  border-bottom-color: var(--ok);
  background: #f6fcf8;
}

.part-tab.active .title {
  color: #2f3a46;
}

.part-tab.done {
  border-bottom-color: #66b98e;
}

.part-tab.done .title {
  color: #2f8159;
}

.question-strip {
  min-width: 0;
  display: block;
}

.question-nav {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  min-height: 24px;
}

.question-chip {
  width: 22px;
  height: 22px;
  border: 1px solid #c8cfd7;
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  color: #4b5664;
  font-weight: 600;
}

.question-chip.answered {
  border-color: #66b98e;
  background: var(--ok-soft);
  color: #2f8159;
}

.question-chip.active {
  border-color: #53a1ce;
  background: #daf1ff;
  color: #2a3b4c;
}

.bottom-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.system-clock {
  font-size: 20px;
  line-height: 1;
  min-width: 52px;
  text-align: right;
}

.mini-icon {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: #46505f;
  cursor: pointer;
}

@media (max-width: 1200px) {
  .workspace.split,
  .workspace.writing {
    grid-template-columns: 1fr;
  }

  .split-handle {
    display: none;
  }

  .bottombar {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .bottom-left {
    display: none;
  }

  .bottom-right {
    justify-content: flex-end;
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 6px 8px;
    height: auto;
  }

  .topbar-center {
    text-align: left;
  }

  .main {
    padding: 8px 6px 120px;
  }

  .notes-panel {
    width: min(92vw, 320px);
  }

  .app.notes-open .topbar,
  .app.notes-open .main,
  .app.notes-open .bottombar {
    margin-right: 0;
  }

  .app.notes-open .floating-nav {
    right: 10px;
  }

  .floating-nav {
    right: 10px;
    top: auto;
    bottom: 116px;
    transform: none;
  }
}

.single-choice {
  margin: 10px 0 16px;
}

.single-choice .option-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
}

.single-choice .option-row span {
  font-size: 14px;
  line-height: 1.5;
  color: #384452;
}

