:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d7dce3;
  --accent: #11695d;
  --accent-ink: #ffffff;
  --warn: #9a3412;
  --error: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  font-weight: 700;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-problem-menu,
.drawer-close {
  display: none;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, 0.38);
}

.layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  min-height: calc(100vh - 76px);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 16px;
}

.sidebar-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.sidebar-head .sidebar-title {
  margin-bottom: 0;
}

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

.admin-page .sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.admin-list-tools {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.admin-test-search {
  position: relative;
  display: block;
}

.admin-test-search input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 38px 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.admin-test-search input:focus {
  outline: 3px solid rgba(17, 105, 93, 0.16);
  border-color: var(--accent);
}

.admin-test-search input::-webkit-search-cancel-button {
  appearance: none;
}

.list-status {
  min-height: 22px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.list-status[hidden] {
  display: none;
}

.list-status.loading::before {
  content: "";
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border: 2px solid #cbd5e1;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: list-spin 650ms linear infinite;
}

.list-status.error {
  color: var(--error);
}

.list-status button {
  width: auto;
  height: auto;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: underline;
}

.list-skeleton {
  display: grid;
  gap: 8px;
}

.list-skeleton-item {
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(90deg, #f3f5f7 20%, #fafbfc 45%, #f3f5f7 70%);
  background-size: 220% 100%;
  animation: list-shimmer 1.2s ease-in-out infinite;
}

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

@keyframes list-shimmer {
  to { background-position: -220% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .list-status.loading::before,
  .list-skeleton-item {
    animation: none;
  }
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 28px;
  height: 28px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transform: translateY(-50%);
}

.search-clear:hover {
  background: #eef2f5;
  color: var(--ink);
}

.admin-list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.text-button {
  width: auto;
  height: auto;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.text-button:hover {
  text-decoration: underline;
}

.sidebar-search {
  margin-bottom: 14px;
}

.sidebar-search input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.sidebar-search input:focus {
  outline: 3px solid rgba(17, 105, 93, 0.16);
  border-color: var(--accent);
}

.contest-series-filter {
  min-inline-size: 0;
  margin: -2px 0 14px;
  padding: 0;
  border: 0;
}

.contest-series-filter legend {
  margin-bottom: 7px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.contest-series-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.contest-series-options label {
  display: flex;
  min-width: 0;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.contest-series-options label:hover {
  border-color: #94a3b8;
}

.contest-series-options label:has(input:checked) {
  border-color: rgba(17, 105, 93, 0.55);
  background: rgba(17, 105, 93, 0.08);
  color: var(--accent);
}

.contest-series-options input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

.contest-series-options input:focus-visible {
  outline: 3px solid rgba(17, 105, 93, 0.18);
  outline-offset: 2px;
}

.problem-list {
  display: grid;
  gap: 10px;
}

.problem-pagination {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.pagination-summary {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.pagination-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.pagination-actions button {
  min-width: 0;
  padding-inline: 10px;
}

.pagination-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.test-list {
  display: grid;
  gap: 16px;
}

.admin-page .test-list {
  flex: 1 1 auto;
  min-height: 0;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 8px;
  margin: 0 -6px;
  padding: 12px 6px;
  overflow: auto;
  overscroll-behavior: contain;
}

.admin-list-empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 24px 14px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.admin-list-pagination {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.admin-list-pagination[hidden] {
  display: none;
}

.admin-list-pagination button {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
}

.admin-list-pagination span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.test-group {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.admin-contest {
  gap: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.admin-contest.expanded {
  border-color: #aac8c3;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.admin-contest-toggle {
  width: 100%;
  height: auto;
  min-height: 58px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 9px 10px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.admin-contest-toggle:hover {
  background: #f6f9f9;
}

.admin-contest-toggle:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid rgba(17, 105, 93, 0.2);
  outline-offset: -3px;
}

.admin-contest-arrow {
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transition: transform 120ms ease;
}

.admin-contest.expanded .admin-contest-arrow {
  transform: rotate(90deg);
}

.admin-contest-label {
  min-width: 0;
}

.admin-contest-label strong,
.admin-contest-label span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-contest-label strong {
  color: var(--ink);
  font-size: 14px;
}

.admin-contest-label span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.admin-contest-toggle em {
  max-width: 96px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
  line-height: 1.3;
  text-align: right;
}

.admin-contest-body {
  display: grid;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.admin-contest-body[hidden] {
  display: none;
}

.admin-contest-body .test-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.admin-contest-body .problem-list {
  gap: 7px;
}

.admin-contest-body .problem-item.compact {
  min-height: 52px;
  padding: 8px 10px;
}

.admin-contest-body .problem-item strong {
  font-size: 13px;
}

.admin-contest-body .problem-item span {
  font-size: 11px;
}

.view-contest {
  gap: 8px;
}

.contest-toggle {
  width: 100%;
  height: auto;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  color: var(--ink);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.contest-toggle:hover {
  border-color: #94a3b8;
  background: #f3f7f8;
}

.contest-toggle:focus-visible {
  outline: 3px solid rgba(17, 105, 93, 0.18);
  outline-offset: 2px;
}

.contest-toggle strong,
.contest-toggle > div > span {
  display: block;
}

.contest-toggle strong {
  font-size: 15px;
  color: var(--ink);
}

.contest-toggle > div > span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.contest-toggle em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
  white-space: nowrap;
}

.contest-arrow {
  color: var(--muted);
  font-size: 18px;
  transform: rotate(0deg);
  transition: transform 120ms ease;
}

.view-contest.expanded .contest-arrow {
  transform: rotate(90deg);
}

.contest-problems {
  padding-left: 10px;
  border-left: 2px solid #d8e1ea;
}

.problem-card {
  display: grid;
  gap: 6px;
}

.test-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.test-header strong,
.test-header span,
.test-header em {
  display: block;
}

.test-header strong {
  font-size: 15px;
  color: var(--ink);
}

.test-header span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.test-header em {
  margin-top: 6px;
  color: var(--accent);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.test-actions {
  display: flex;
  gap: 6px;
}

.test-actions button {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.problem-item {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 6px;
  height: auto;
  min-height: 68px;
  overflow: hidden;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.problem-item:hover {
  border-color: #94a3b8;
  background: #fbfcfd;
}

.problem-item.active {
  border-color: var(--accent);
  background: #eef7f5;
}

.problem-item:focus-visible {
  outline: 3px solid rgba(17, 105, 93, 0.18);
  outline-offset: 2px;
}

.problem-item strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 750;
  color: var(--ink);
  white-space: normal;
  overflow-wrap: break-word;
}

.problem-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: break-word;
}

.problem-item.compact {
  min-height: 58px;
  padding: 10px 12px;
}

.analysis-entry {
  width: 100%;
  height: auto;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-color: #cbd5e1;
  background: #fff;
  color: var(--accent);
  text-align: left;
}

.analysis-entry:hover,
.analysis-entry.active {
  border-color: var(--accent);
  background: #eef7f5;
}

.analysis-entry span {
  font-size: 13px;
  font-weight: 850;
}

.analysis-entry em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.workspace {
  padding: 20px;
}

@media (min-width: 861px) {
  .admin-page,
  .view-page {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .admin-page .topbar,
  .view-page .topbar {
    flex: 0 0 auto;
  }

  .admin-page .layout,
  .view-page .layout {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }

  .admin-page .sidebar,
  .view-page .sidebar {
    align-self: stretch;
    min-height: 0;
    height: auto;
    overflow: auto;
  }

  .admin-page .sidebar {
    overflow: hidden;
  }

  .admin-page .workspace,
  .view-page .workspace {
    min-height: 0;
    overflow: auto;
  }

  .admin-page .workspace,
  .view-page .workspace {
    padding-top: 0;
  }

  .view-page .editor-head {
    top: 0;
  }
}

.empty,
.editor {
  max-width: 1180px;
}

.empty {
  color: var(--muted);
  padding: 32px;
}

.settings-panel {
  max-width: 1180px;
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.settings-panel .compact-title {
  padding: 0;
  border: 0;
}

.settings-panel p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.settings-panel textarea {
  width: 100%;
  min-height: 48px;
  max-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfcfd;
  font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.env-panel {
  display: block;
  align-items: start;
}

.env-panel-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  cursor: pointer;
  list-style: none;
}

.env-panel-summary::-webkit-details-marker {
  display: none;
}

.env-panel-summary > div {
  min-width: 0;
}

.env-panel-summary::after {
  content: "展开";
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--accent);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
}

.env-panel[open] > .env-panel-summary::after {
  content: "收起";
}

.env-panel-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-top: 12px;
}

.env-panel:not([open]) > .env-panel-body {
  display: none;
}

.env-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.env-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.env-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.env-grid input,
.env-grid select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fbfcfd;
  color: var(--ink);
  font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.env-grid input:focus,
.env-grid select:focus {
  outline: 3px solid rgba(17, 105, 93, 0.16);
  border-color: var(--accent);
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-actions span {
  min-width: 130px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.settings-actions span[data-state="error"] {
  color: var(--error);
}

.settings-actions span[data-state="pending"] {
  color: var(--muted);
}

.audit-panel {
  max-width: 1180px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.audit-page {
  padding: 20px;
}

.audit-panel.standalone {
  max-width: none;
  margin: 0;
}

.audit-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.audit-head .compact-title {
  padding: 0;
  border: 0;
}

.audit-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.audit-report {
  display: grid;
  gap: 14px;
}

.audit-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.audit-card {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.audit-card strong,
.audit-card span {
  display: block;
}

.audit-card strong {
  font-size: 20px;
  line-height: 1.2;
}

.audit-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.audit-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
}

.audit-table-wrap {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 12px;
}

.audit-table th,
.audit-table td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.audit-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 800;
}

.compact-empty {
  padding: 14px;
}

.hidden {
  display: none;
}

.editor-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  margin-inline: -20px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(8px);
}

.editor-head > div:first-child {
  flex: 1 1 360px;
  min-width: 0;
}

.editor-head h2 {
  font-size: 20px;
  line-height: 1.25;
}

.editor-head a {
  display: inline-block;
  margin-top: 6px;
  color: var(--accent);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-head > .actions {
  flex: 1 1 620px;
  min-width: 0;
  max-width: 100%;
}

.reader-actions {
  display: flex;
  justify-content: flex-end;
  min-width: max-content;
}

.analysis-unavailable {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: max-content;
}

.save-status {
  min-width: 72px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.save-status[data-state="pending"] {
  color: var(--muted);
}

.save-status[data-state="error"] {
  color: var(--error);
}

select,
button,
textarea {
  font: inherit;
}

select,
button {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 10px;
}

button {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  cursor: pointer;
  font-weight: 700;
}

button.secondary {
  background: #fff;
  color: var(--accent);
}

button.danger {
  background: #fff;
  color: var(--error);
  border-color: #f1b4ad;
}

.contest-title {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 24px;
}

.login-panel h1 {
  font-size: 22px;
}

.login-panel p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.login-form input {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
}

.login-error {
  min-height: 20px;
  margin-top: 10px;
  color: var(--error);
  font-size: 14px;
}

.issues {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.issue {
  border-left: 4px solid var(--warn);
  background: #fff7ed;
  padding: 10px 12px;
  color: var(--warn);
}

.issue.error {
  border-color: var(--error);
  color: var(--error);
  background: #fff1f0;
}

.issue.repair-result {
  border-color: #2563eb;
  color: #1d4ed8;
  background: #eff6ff;
}

.issue.repair-result.passed {
  border-color: #16a34a;
  color: #15803d;
  background: #f0fdf4;
}

.issue-repair {
  margin-top: 8px;
  color: var(--text);
}

.issue-repair summary {
  cursor: pointer;
  font-weight: 700;
}

.issue-repair pre {
  max-height: 320px;
  margin: 8px 0 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--text);
}

.sections {
  display: grid;
  gap: 16px;
}

.brief-editor {
  display: grid;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.analysis-editor {
  margin-top: 16px;
}

.analysis-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.analysis-source-list span {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.analysis-source-list a {
  color: var(--accent);
}

.analysis-source-list strong,
.analysis-sources strong {
  color: var(--text);
  font-weight: 800;
}

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

.sync-panel {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.sync-panel pre {
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.5;
}

.brief-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.section-title {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}

.section-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.section-panel {
  min-width: 0;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.source-raw,
.target {
  border-right: 1px solid var(--line);
}

.source,
.source-raw,
.target,
.target-preview {
  background: #fbfcfd;
}

.target,
.target-preview {
  border-bottom: 0;
}

.source pre {
  white-space: pre-wrap;
  margin: 0;
}

.source-rendered {
  line-height: 1.75;
}

textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  line-height: 1.6;
}

textarea[readonly] {
  color: var(--muted);
  background: #f8fafc;
  cursor: default;
}

.preview-title {
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.preview {
  min-height: 90px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.read-sections {
  display: grid;
  gap: 14px;
  max-width: 900px;
}

.brief {
  max-width: 900px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.brief h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.analysis {
  max-width: 900px;
  margin-top: 0;
}

.analysis h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.analysis-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.analysis-sources span {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.analysis-sources a {
  color: var(--accent);
}

.analysis-empty {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.analysis-empty p {
  margin: 0;
  color: var(--muted);
}

.analysis-official-code {
  margin: 0 0 18px;
}

.analysis-official-code h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.official-code-title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.official-code-title h3,
.official-code-title .section-title {
  margin-bottom: 0;
}

.official-code-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.official-code-title a {
  color: var(--accent);
}

.official-code-block {
  margin: 12px 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.official-code-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.official-code-head small,
.official-code-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.official-code-block pre {
  overflow-x: auto;
  margin: 8px 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  line-height: 1.5;
}

.official-code-block code {
  display: block;
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  white-space: pre;
}

.official-code-block code.hljs,
.translated pre code.hljs {
  background: transparent;
}

.analysis-code-fold {
  margin: 10px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.official-code-block .analysis-code-fold {
  margin: 8px 0 12px;
}

.analysis-code-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(140px, 0.8fr);
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 9px 12px;
  color: #334155;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  list-style: none;
}

.analysis-code-summary::-webkit-details-marker {
  display: none;
}

.analysis-code-summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid #9fb4ca;
  border-radius: 50%;
  color: #4b6682;
  font-size: 14px;
  line-height: 1;
}

.analysis-code-fold[open] > .analysis-code-summary::before {
  content: "-";
}

.analysis-code-summary-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.analysis-code-summary-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-code-summary-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 700;
}

.analysis-code-summary-preview {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-code-fold > pre,
.translated .analysis-code-fold > pre,
.official-code-block .analysis-code-fold > pre {
  margin: 0;
  border-width: 1px 0 0;
  border-radius: 0;
}

.analysis-code-fold:not([open]) > pre {
  display: none;
}

pre code.syntax-highlighted,
pre code.hljs {
  color: #1f2937;
}

pre code .syntax-keyword,
pre code .hljs-keyword,
pre code .hljs-built_in {
  color: #8f2f8f;
  font-weight: 700;
}

pre code .syntax-type,
pre code .hljs-type,
pre code .hljs-title.class_,
pre code .hljs-title.function_ {
  color: #0f6f7a;
  font-weight: 700;
}

pre code .syntax-string,
pre code .hljs-string {
  color: #116329;
}

pre code .syntax-number,
pre code .hljs-number,
pre code .hljs-literal {
  color: #9a5b00;
}

pre code .syntax-comment,
pre code .hljs-comment {
  color: #6a737d;
  font-style: italic;
}

pre code .syntax-meta,
pre code .hljs-meta {
  color: #005cc5;
  font-weight: 700;
}

.read-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.read-section h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.translated {
  line-height: 1.75;
}

.translated p {
  margin: 0 0 10px;
}

.translated ul,
.translated ol {
  margin: 0 0 10px 22px;
  padding: 0;
}

.translated blockquote {
  margin: 10px 0 14px;
  padding: 10px 14px;
  border-left: 4px solid #9fb4ca;
  background: #f7f9fb;
}

.translated blockquote > :last-child {
  margin-bottom: 0;
}

.translated img {
  display: block;
  max-width: min(100%, 760px);
  height: auto;
  margin: 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.translated details.analysis-hint {
  margin: 10px 0 14px;
  border: 1px solid #d8e1ea;
  border-radius: 8px;
  background: #f8fafc;
}

.translated details.analysis-hint > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 12px;
  color: #24415f;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.translated details.analysis-hint > summary::-webkit-details-marker {
  display: none;
}

.translated details.analysis-hint > summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 1px solid #9fb4ca;
  border-radius: 50%;
  color: #4b6682;
  font-size: 14px;
  line-height: 1;
}

.translated details.analysis-hint[open] > summary::before {
  content: "-";
}

.translated .analysis-hint-body {
  padding: 0 12px 12px 38px;
  border-top: 1px solid #e3eaf1;
  color: #334155;
}

.translated .analysis-hint-body > :first-child {
  margin-top: 10px;
}

.translated .analysis-hint-body > :last-child {
  margin-bottom: 0;
}

.translated pre {
  overflow-x: auto;
  margin: 10px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  line-height: 1.5;
}

.translated code,
.translated var {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.translated code,
.translated .inline-code {
  display: inline;
  padding: 1px 5px;
  border: 1px solid #d9e0e8;
  border-radius: 5px;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 0.94em;
  white-space: nowrap;
}

.translated pre code {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  white-space: pre;
}

.translated .math-inline,
.translated var {
  display: inline;
  padding: 0 2px;
  font-style: italic;
  white-space: nowrap;
}

.translated .math-block-source {
  display: block;
  overflow-x: auto;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-style: normal;
  white-space: pre;
}

.math-block {
  overflow-x: auto;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.math-block var.math {
  display: block;
  white-space: pre;
}

.translated .katex {
  font-size: 1.03em;
}

.translated .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 10px 0;
  padding: 2px 0;
}

.translated table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
}

.translated th,
.translated td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .editor-head,
  .section-body,
  .brief-grid,
  .audit-grid,
  .audit-cards {
    grid-template-columns: 1fr;
    display: grid;
  }

  .editor-head {
    top: 0;
    align-items: stretch;
  }

  .editor-head a {
    max-width: 100%;
  }

  .actions {
    justify-content: flex-start;
    min-width: 0;
  }

  .reader-actions {
    justify-content: flex-start;
    min-width: 0;
  }

  .source,
  .source-raw,
  .target,
  .target-preview {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-page.drawer-open,
  .view-page.drawer-open {
    overflow: hidden;
  }

  .admin-page .topbar,
  .view-page .topbar {
    min-height: 64px;
    height: auto;
    gap: 12px;
    padding: 10px 12px;
  }

  .admin-page .topbar p,
  .view-page .topbar p {
    display: none;
  }

  .admin-page .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  .admin-page .layout,
  .view-page .layout {
    display: block;
    min-height: calc(100vh - 64px);
  }

  .admin-page .sidebar,
  .view-page .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    width: min(88vw, 360px);
    max-width: 360px;
    height: 100dvh;
    padding: 14px;
    overflow: auto;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: 18px 0 36px rgba(15, 23, 42, 0.2);
    transform: translateX(-104%);
    transition: transform 180ms ease;
  }

  .admin-page .sidebar {
    overflow: hidden;
  }

  .admin-page .sidebar.open,
  .view-page .sidebar.open {
    transform: translateX(0);
  }

  .admin-page .sidebar-head,
  .view-page .sidebar-head {
    margin-bottom: 12px;
  }

  .admin-page .mobile-problem-menu,
  .admin-page .drawer-close,
  .view-page .mobile-problem-menu,
  .view-page .drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .admin-page .workspace,
  .view-page .workspace {
    padding: 12px;
  }

  .admin-page .workspace,
  .view-page .workspace {
    padding-top: 0;
  }

  .admin-page .settings-panel {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .admin-page .env-panel {
    padding: 12px;
  }

  .admin-page .env-panel-summary {
    min-height: 40px;
  }

  .admin-page .env-panel-summary p {
    display: none;
  }

  .admin-page .env-panel-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-page .env-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .admin-page .env-grid label {
    min-width: 0;
  }

  .admin-page .env-grid input,
  .admin-page .env-grid select {
    height: 42px;
  }

  .admin-page .env-panel .settings-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .admin-page .env-panel .settings-actions span {
    min-width: 0;
  }

  .admin-page .env-panel .settings-actions button {
    width: 100%;
  }

  .admin-page .editor-head,
  .view-page .editor-head {
    margin-inline: -12px;
    padding: 12px;
  }

  .view-page .reader-actions {
    width: 100%;
  }

  .view-page .reader-actions button,
  .view-page .reader-actions .analysis-unavailable {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .analysis-code-summary {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .analysis-code-summary-preview {
    display: none;
  }
}
