:root {
  --bg: #f3f3f3;
  --paper: #ffffff;
  --ink: #222222;
  --ink-soft: #666666;
  --line: #e6e6e6;
  --line-strong: #d8d8d8;
  --brand: #1a73c9;
  --brand-deep: #0e5ea9;
  --accent: #ff8a00;
  --subject-nav-offset: 74px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  line-height: 1.7;
}

.subject-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: 14px 12px 0;
  background: rgba(243, 243, 243, 0.96);
  backdrop-filter: blur(8px);
}

.subject-nav .inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0;
  background: linear-gradient(180deg, #1f8ef5 0%, #1b82eb 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset;
  border-radius: 0;
}

body > .subject-nav + .page-header,
body > .subject-nav + .basket-header,
body > .subject-nav + main {
  margin-top: calc(var(--subject-nav-offset) + 12px);
}

.subject-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  width: 100%;
  justify-content: flex-start !important;
  align-content: flex-start;
  align-items: stretch;
  gap: 0;
  overflow: visible;
}

.library-nav-item {
  position: relative;
  flex: 0 0 auto;
}
.nav-login-item {
  margin-left: auto;
}

.library-nav-trigger {
  position: relative;
  min-width: 112px;
  height: 60px;
  padding: 0 22px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.library-nav-link {
  text-decoration: none;
  color: #ffffff;
}

.library-nav-link.library-nav-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.library-nav-trigger:hover,
.library-nav-trigger.is-active {
  background: rgba(255, 255, 255, 0.16);
}

.library-nav-item.is-open .library-nav-trigger {
  background: rgba(255, 255, 255, 0.16);
}

.library-panel {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  display: none;
  min-width: 430px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 34px rgba(18, 66, 125, 0.18);
  border: 1px solid rgba(210, 223, 239, 0.9);
  z-index: 30;
}

.library-panel::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 34px;
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid rgba(210, 223, 239, 0.9);
  border-left: 1px solid rgba(210, 223, 239, 0.9);
  transform: rotate(45deg);
}

.library-nav-item.is-open .library-panel {
  display: block;
}

.library-level {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---- Mobile nav toggle (hamburger) ---- */
.mobile-nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  gap: 5px;
  margin: 5px 10px 5px auto;
}

.mobile-nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #ffffff;
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.stage-level {
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px dashed #e7eef8;
}

.library-stage-item,
.library-subject-item {
  height: 34px;
  padding: 0 14px;
  text-align: center;
  border: none;
  border-radius: 4px;
  background: #f4f8ff;
  color: #5c6b7d;
  font-size: 14px;
  font-weight: 500;
}

.library-stage-item:hover,
.library-stage-item.is-active,
.library-subject-item:hover,
.library-subject-item.is-active {
  background: #1a84e8;
  color: #ffffff;
}

.bg-shape {
  display: none;
}

.page-header {
  padding: 14px 12px 8px;
  border-bottom: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #ffffff 0%, #fdfdfd 100%);
}

.page-header .inner {
  max-width: 1180px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 16px 20px;
}

.crumb {
  margin: 0 0 8px;
  color: #8a8a8a;
  font-size: 13px;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.45;
  font-weight: 700;
  color: #1f1f1f;
}

.meta {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.export-word-btn {
  height: 34px;
  padding: 0 12px;
  border: 1px solid #bcd8f5;
  border-radius: 4px;
  background: #f7fbff;
  color: var(--brand);
  font-size: 14px;
  white-space: nowrap;
}

.export-word-btn:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ---- Export panel ---- */
.page-title-row {
  position: relative;
}

.export-word-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 200;
  background: #fff;
  border: 1px solid #c9d6eb;
  border-radius: 8px;
  padding: 14px 18px 12px;
  box-shadow: 0 8px 24px rgba(16, 52, 92, 0.13);
  min-width: 180px;
}

.export-panel-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: #1d2a3f;
}

.export-panel-option {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  font-size: 14px;
  color: #2f4057;
  cursor: pointer;
  user-select: none;
}

.export-panel-option input[type="radio"] {
  accent-color: var(--brand);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.export-panel-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  border-top: 1px solid #edf1f8;
  padding-top: 10px;
}

.export-panel-cancel,
.export-panel-confirm {
  height: 30px;
  padding: 0 14px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}

.export-panel-cancel {
  border: 1px solid #c9d6eb;
  background: #f7fbff;
  color: #48607d;
}

.export-panel-cancel:hover {
  background: #edf1f8;
}

.export-panel-confirm {
  border: none;
  background: var(--brand);
  color: #fff;
}

.export-panel-confirm:hover {
  background: var(--brand-deep);
}

.main-wrap {
  max-width: 1180px;
  margin: 10px auto 28px;
  padding: 0 12px;
}

.toolbar-card {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 12px 16px;
  margin-bottom: 10px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

label {
  color: #4d4d4d;
  font-size: 14px;
}

select,
button,
.admin-link {
  font: inherit;
  height: 34px;
  border: 1px solid #cfcfcf;
  padding: 0 10px;
  border-radius: 2px;
}

.library-nav-trigger,
.library-stage-item,
.library-subject-item {
  font: inherit;
  border: none;
}

.library-nav-trigger {
  height: 60px;
  padding: 0 22px;
  border-radius: 0;
}

select {
  min-width: 360px;
  max-width: 620px;
  background: #fff;
}

button {
  cursor: pointer;
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

button:hover {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
}

.admin-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--brand);
  background: #f7fbff;
  border-color: #bcd8f5;
}

.admin-link:hover {
  color: #fff;
  background: var(--brand);
}

.status-text {
  margin: 10px 0 0;
  font-size: 13px;
  color: #7a7a7a;
}

.question-list {
  background: #fff;
  border: 1px solid var(--line);
}

.question-card {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border-top: 1px dashed #d8d8d8;
  padding: 18px 22px 20px;
}

.question-card:first-child {
  border-top: none;
}

.question-head {
  margin-bottom: 0;
}

.question-no {
  font-size: 18px;
  line-height: 1.7;
  color: #252525;
  font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
}

.question-title-line {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 4px;
}

.question-number {
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1.72;
  color: #252525;
  font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
}

.question-title-body {
  display: block;
  flex: 0 0 100%;
  width: 100%;
  min-width: 0;
  margin-top: 4px;
  text-align: left;
}

.question-type-inline {
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1.72;
  color: #2a2a2a;
  font-family: "Times New Roman", "SimSun", serif;
  white-space: nowrap;
}

.question-title-body p {
  margin: 0;
}

.question-detail-page .question-title-line {
  flex-wrap: nowrap;
}

.question-detail-page .question-title-body {
  flex: 1 1 auto;
  width: auto;
  margin-top: 0;
}

@media (max-width: 640px) {
  .question-detail-page .question-title-line {
    flex-wrap: wrap;
  }

  .question-detail-page .question-title-body {
    flex: 0 0 100%;
    width: 100%;
    margin-top: 4px;
  }
}

.q-tag {
  font-size: 13px;
  color: #6f6f6f;
  background: transparent;
  border: none;
  padding: 0;
}

.q-tag:first-of-type {
  color: #242424;
  font-weight: 600;
}

.question-content {
  font-size: 16px;
  color: #2a2a2a;
  line-height: 1.72;
  font-family: "Times New Roman", "SimSun", serif;
}

.question-content p {
  margin: 8px 0;
}

.question-image {
  display: block;
  width: auto;
  max-width: min(100%, 320px);
  height: auto;
  margin: 10px 0;
  border: 1px solid #e2e2e2;
  background: #fff;
  cursor: zoom-in;
}

.image-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.image-zoom-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.image-zoom-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.image-zoom-overlay.is-visible img {
  transform: scale(1);
}

.question-table-wrap {
  margin: 10px 0;
  overflow-x: auto;
}

.question-table-wrap table {
  border-collapse: collapse;
  min-width: 320px;
  background: #fff;
}

.question-table-wrap td,
.question-table-wrap th {
  border: 1px solid #d7e1ee;
  padding: 8px 12px;
  font-size: 15px;
  line-height: 1.6;
  vertical-align: middle;
  white-space: nowrap;
}

.question-content mjx-container {
  font-size: 100% !important;
}

.option-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 3px;
}

.option-item {
  padding: 4px 0;
  border: none;
  background: transparent;
}

.option-key {
  margin-right: 8px;
  color: #111;
  font-weight: 700;
}

.fold {
  margin-top: 12px;
  border-top: 1px solid #efefef;
  padding-top: 8px;
}

.fold summary {
  cursor: pointer;
  font-size: 18px;
  color: #2d2d2d;
  font-weight: 700;
  list-style: none;
}

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

.fold summary::before {
  content: "▼ ";
  color: #3f3f3f;
  display: inline-block;
  margin-right: 6px;
  font-size: 12px;
  vertical-align: 1px;
}

.fold:not([open]) summary::before {
  content: "▲";
}

.answer,
.analysis {
  margin-top: 8px;
  padding: 0;
  border: none;
  background: transparent;
  color: #1f1f1f;
  font-size: 16px;
  line-height: 1.72;
  font-family: "Times New Roman", "SimSun", serif;
}

.answer strong,
.analysis strong {
  color: #101010;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  margin-right: 4px;
}

.analysis {
  margin-top: 4px;
}

.analysis p,
.answer p {
  margin: 6px 0;
}

.question-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.question-report-btn {
  height: 30px;
  padding: 0 12px;
  border: 1px solid #c9d6eb;
  border-radius: 15px;
  background: #f7fbff;
  color: #2f4057;
  cursor: pointer;
  font-size: 13px;
}

.question-report-btn:hover {
  border-color: #1a73c9;
  background: #ecf5ff;
  color: #1a73c9;
}


/* ---- Paper detail page: header actions bar ---- */
.question-header-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 22px 0;
}

.question-action-btn {
  height: 36px;
  min-width: 72px;
  padding: 0 16px;
  border: 1px solid #c9d6eb;
  border-radius: 18px;
  background: #f7fbff;
  color: #2f4057;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.question-action-btn:hover {
  border-color: #1a73c9;
  background: #ecf5ff;
  color: #1a73c9;
}

.question-action-btn:disabled {
  border-color: #d8e2f0;
  color: #9aa9bc;
  background: #f6f9fc;
  cursor: not-allowed;
}

.question-action-btn-outlined {
  border-color: #1a73c9;
  color: #1a73c9;
  background: #fff;
}

.question-action-btn-outlined:hover {
  background: #ecf5ff;
}

/* ---- Paper detail page: per-card actions ---- */
.question-card .question-select-checkbox {
  margin-top: 5px;
  width: 16px;
  height: 16px;
  accent-color: #1a73c9;
  cursor: pointer;
  vertical-align: middle;
}

.question-card-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.question-card-action-btn {
  height: 30px;
  padding: 0 12px;
  border: 1px solid #c9d6eb;
  border-radius: 15px;
  background: #f7fbff;
  color: #2f4057;
  cursor: pointer;
  font-size: 13px;
}

.question-card-action-btn:hover {
  border-color: #1a73c9;
  background: #ecf5ff;
  color: #1a73c9;
}

.question-card-action-btn.is-in-basket {
  border-color: #a8d4a8;
  background: #f2fbf2;
  color: #3a8a3a;
  cursor: default;
  opacity: 0.85;
}

.question-card-action-btn:disabled {
  cursor: default;
}

@media (max-width: 1024px) {
  .question-content,
  .answer,
  .analysis {
    font-size: 15px;
  }

  .fold summary {
    font-size: 17px;
  }
}

@media (max-width: 720px) {
  :root {
    --subject-nav-offset: 56px;
  }

  .subject-nav {
    padding: 0;
  }

  .subject-nav .inner {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }

  .mobile-nav-toggle {
    display: flex;
  }

  .subject-nav-list {
    display: none;
    flex-direction: column;
    width: 100%;
    background: linear-gradient(180deg, #1f8ef5 0%, #1b82eb 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding: 4px 0;
  }

  .subject-nav.is-mobile-open .subject-nav-list {
    display: flex;
  }

  .library-nav-item,
  .nav-login-item {
    min-width: 0;
    margin-left: 0;
    width: 100%;
  }

  .library-nav-trigger {
    min-width: 0;
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 15px;
    text-align: left;
    justify-content: flex-start;
  }

  .library-nav-link.library-nav-trigger {
    justify-content: flex-start;
  }

  .library-panel {
    position: relative;
    top: auto;
    left: auto;
    min-width: 0;
    width: calc(100% - 24px);
    margin: 6px 12px 10px;
    box-shadow: 0 4px 14px rgba(18, 66, 125, 0.12);
  }

  .library-panel::before {
    display: none;
  }

  .page-header .inner,
  .toolbar-card,
  .question-card {
    padding-left: 12px;
    padding-right: 12px;
  }

  h1 {
    font-size: 19px;
  }

  .page-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .export-word-btn {
    align-self: flex-end;
  }

  .question-no {
    font-size: 18px;
  }

  select {
    min-width: 0;
    width: 100%;
  }

  .toolbar-row {
    align-items: stretch;
  }

  button,
  .admin-link {
    justify-content: center;
  }

  .question-content,
  .answer,
  .analysis {
    font-size: 15px;
  }

  .fold summary {
    font-size: 16px;
  }
}

/* ---------- 公共消息提醒面板（与 question-basket.css 保持一致） ---------- */
.basket-alert-dialog {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.basket-alert-dialog[hidden] {
  display: none;
}

.basket-alert-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 24, 44, 0.42);
  backdrop-filter: blur(2px);
}

.basket-alert-panel {
  position: relative;
  z-index: 1;
  width: min(460px, calc(100vw - 40px));
  background: #ffffff;
  border: 1px solid rgba(187, 206, 230, 0.9);
  border-radius: 18px;
  box-shadow: 0 24px 56px rgba(14, 38, 68, 0.24);
  padding: 24px 24px 18px;
}

.basket-alert-title {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 700;
  color: #17304f;
}

.basket-alert-message {
  margin: 0;
  font-size: 16px;
  line-height: 1.75;
  color: #2f4057;
  word-break: break-word;
}

.basket-alert-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
}

.basket-alert-actions .basket-action-btn,
.basket-alert-actions .btn-primary {
  min-width: 96px;
  padding: 8px 18px;
  font-size: 14px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #1a73c9;
  color: #fff;
}

body.basket-alert-open {
  overflow: hidden;
}
