:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-line: #bfdbfe;
  --text-main: #111827;
  --text-sub: #4b5563;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --border-soft: #edf2f7;
  --bg: #f8fafc;
  --white: #ffffff;
  --green: #16a34a;
  --orange: #f97316;
  --purple: #7c3aed;
  --red: #dc2626;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 8px 22px rgba(15, 23, 42, 0.06);

  /* 页面宽度规范 */
  --llx-container-main: 1180px;
  --llx-container-workspace: 1380px;
  --llx-container-readable: 960px;

  /* 页面左右安全边距：PC 左右各 20px */
  --llx-page-gutter: 20px;

  /* 页面主体上下留白 */
  --llx-page-padding-top: 24px;
  --llx-page-padding-bottom: 40px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  background: var(--bg);
  line-height: 1.65;
}

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

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* ================================
   页面基础布局
   ================================ */

.base-portal-page {
  overflow-x: hidden;
}

/* 页面主体：只负责背景和上下留白，不负责左右间距 */
.base-main {
  padding: var(--llx-page-padding-top) 0 var(--llx-page-padding-bottom);
  background: var(--bg);
  min-height:calc(100vh - 73px - 83px);
  box-sizing: border-box;
}

/* 公众浏览类页面：首页、试卷库、试卷详情页 */
.base-container {
  width: min(var(--llx-container-main), calc(100% - var(--llx-page-gutter) - var(--llx-page-gutter)));
  margin: 0 auto;
}

/* 用户工作台类页面：我的题库、我的组卷、管理中心 */
.base-container-workspace {
  width: min(var(--llx-container-workspace), calc(100% - var(--llx-page-gutter) - var(--llx-page-gutter)));
  margin: 0 auto;
}

/* 阅读类页面：文章、协议、帮助文档 */
.base-container-readable {
  width: min(var(--llx-container-readable), calc(100% - var(--llx-page-gutter) - var(--llx-page-gutter)));
  margin: 0 auto;
}

.fn-hide,.is-hidden {
  display: none !important;
}


/* ================================
   网站顶部 Header
   ================================ */

.base-site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.75);
}

.base-header-inner {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.base-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0;
  white-space: nowrap;
}

.base-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
}

.base-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 0 0 auto;
  color: var(--text-sub);
  font-size: 15px;
  white-space: nowrap;
}

.base-nav a {
  position: relative;
  padding: 23px 0;
  white-space: nowrap;
}

.base-nav a:hover,
.base-nav a.base-active {
  color: var(--primary);
}

.base-nav a.base-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 17px;
  height: 3px;
  border-radius: 999px;
  background: var(--primary);
}

.base-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.base-header-search {
  flex: 0 1 240px;
  max-width: 260px;
  min-width: 170px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 14px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.base-header-search:focus-within,
.base-header-search:hover {
  border-color: #bfdbfe;
  background: #fff;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.1);
}

.base-header-search-icon {
  width: 18px;
  height: 18px;
  color: #94a3b8;
  flex: 0 0 auto;
}

.base-header-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
}

.base-header-search input::placeholder {
  color: #94a3b8;
}

.base-header-search button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.base-header-search button:hover {
  background: #dbeafe;
}

.base-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  background: transparent;
}

.base-btn-primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.22);
}

.base-btn-primary:hover {
  background: var(--primary-dark);
}

.base-btn-ghost {
  color: var(--text-sub);
  background: #fff;
  border-color: var(--border);
}

.base-btn-ghost:hover {
  color: var(--primary);
  border-color: #bfdbfe;
  background: var(--primary-soft);
}

/* 危险按钮：删除、移入回收站、清空等 */
.base-btn-danger {
  color: #fff;
  background: var(--red);
  box-shadow: 0 12px 22px rgba(220, 38, 38, 0.18);
}

.base-btn-danger:hover {
  background: #b91c1c;
}

/* 小号按钮：列表、卡片、表格里的轻量操作 */
.base-btn-sm {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
}

/* 整行按钮：弹窗、侧栏、移动端常用 */
.base-btn-block {
  width: 100%;
}

/* 禁用状态 */
.base-btn:disabled,
.base-btn.base-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  pointer-events: none;
}

/* 键盘聚焦状态 */
.base-btn:focus-visible,
.base-user-trigger:focus-visible,
.base-header-search button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.base-header-workbench {
  padding: 0 16px;
}

.base-user-menu {
  position: relative;
  flex: 0 0 auto;
}

.base-user-trigger {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.base-user-trigger:hover,
.base-user-menu:focus-within .base-user-trigger {
  border-color: #bfdbfe;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.base-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
  overflow: hidden;
}

.base-user-name {
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 800;
}

.base-user-arrow {
  width: 14px;
  height: 14px;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.base-user-menu:hover .base-user-arrow,
.base-user-menu:focus-within .base-user-arrow {
  transform: rotate(180deg);
}

.base-user-dropdown {
  position: absolute;
  top: calc(100% + 0px);
  right: 0;
  width: 216px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
  transition: all 0.18s ease;
  z-index: 30;
}

.base-user-dropdown::before {
  content: "";
  position: absolute;
  top: -8px;
  right: 22px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}

.base-user-menu:hover .base-user-dropdown,
.base-user-menu:focus-within .base-user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.base-dropdown-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 6px;
}

.base-dropdown-user strong {
  display: block;
  line-height: 1.2;
  font-size: 14px;
}

.base-dropdown-user span:not(.base-avatar-circle) {
  display: block;
  color: var(--text-light);
  font-size: 12px;
  margin-top: 2px;
}

.base-user-dropdown a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 700;
}

.base-user-dropdown a:hover {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.base-dropdown-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 6px 0;
}

.base-dropdown-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fee2e2;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}


/* ================================
   网站底部 Footer
   ================================ */

.base-footer {
  background: #020617;
  color: #94a3b8;
  padding: 30px 0;
  font-size: 14px;
}

.base-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.base-footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.base-footer a:hover {
  color: #fff;
}

.base-mobile-menu-btn {
  display: none;
}

/* ================================
   响应式适配
   ================================ */

@media (max-width: 1180px) {
  .base-header-inner {
    gap: 12px;
  }

  .base-nav {
    gap: 16px;
  }

  .base-header-search {
    flex-basis: 210px;
    min-width: 150px;
  }

  .base-header-search button {
    display: none;
  }

  .base-btn {
    padding: 0 12px;
  }
}

@media (max-width: 960px) {
  .base-nav,
  .base-header-workbench,
  .base-header-actions > .base-btn-ghost:not(.base-mobile-menu-btn) {
    display: none;
  }

  .base-mobile-menu-btn {
    display: inline-flex;
  }
}

@media (max-width: 640px) {
  :root {
    --llx-page-gutter: 16px;
  }

  .base-header-inner {
    height: 64px;
    gap: 10px;
  }

  .base-brand {
    font-size: 20px;
  }

  .base-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .base-header-search {
    flex: 1 1 auto;
    min-width: 118px;
    height: 38px;
    padding-left: 12px;
  }

  .base-user-name,
  .base-user-arrow {
    display: none;
  }

  .base-user-trigger {
    padding: 3px;
  }

  .base-header-actions {
    width: auto;
    gap: 8px;
  }

  .base-header-actions > .base-btn-primary {
    display: none;
  }
}
