/* ==================================================================
   六级学习站 —— 设计系统与全部公共样式
   ================================================================== */

:root {
  --bg: #0b1220;
  --bg-2: #101a2c;
  --panel: #14203a;
  --panel-2: #1b2947;
  --line: #26365c;
  --text: #e6ecf7;
  --muted: #93a3c4;
  --brand: #4c8dff;
  --brand-2: #7c5cff;
  --ok: #35d07f;
  --warn: #ffb62e;
  --err: #ff6b6b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --sidebar-w: 232px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(76, 141, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 96% 0%, rgba(124, 92, 255, 0.14), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Source Han Sans SC', 'Noto Sans CJK SC', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.35;
  font-weight: 650;
}

h1 {
  font-size: 22px;
}
h2 {
  font-size: 18px;
}
h3 {
  font-size: 16px;
}

p {
  margin: 0 0 8px;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--brand);
}

em {
  font-style: normal;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

pre {
  margin: 0;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
}

::selection {
  background: rgba(76, 141, 255, 0.35);
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #2b3d68;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b5288;
  background-clip: content-box;
}

/* ==================================================================
   骨架布局
   ================================================================== */

#app {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 14px;
  background: linear-gradient(180deg, rgba(20, 32, 58, 0.96), rgba(13, 21, 38, 0.96));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(6px);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 14px;
  cursor: pointer;
  user-select: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 6px 16px rgba(76, 141, 255, 0.32);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: 0.3px;
}

.brand-text em {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-badge {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: 6px;
  color: #cfe0ff;
  background: rgba(76, 141, 255, 0.18);
  border: 1px solid rgba(76, 141, 255, 0.35);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  text-align: left;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}

.nav-item:hover {
  background: rgba(76, 141, 255, 0.1);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(76, 141, 255, 0.22), rgba(124, 92, 255, 0.16));
  border-color: rgba(76, 141, 255, 0.4);
  color: #fff;
  font-weight: 600;
}

.sidebar-ft {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.model-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #cfe0ff;
  padding: 6px 9px;
  border-radius: 9px;
  background: rgba(76, 141, 255, 0.12);
  border: 1px solid rgba(76, 141, 255, 0.25);
  overflow: hidden;
}

.model-chip span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: rgba(11, 18, 32, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.menu-btn {
  display: none;
}

.crumb {
  font-weight: 600;
  color: #dbe6fb;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.main {
  flex: 1 1 auto;
  padding: 22px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==================================================================
   通用工具类
   ================================================================== */

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.row.end {
  justify-content: flex-end;
}
.row.between {
  justify-content: space-between;
}
.row.center-v {
  align-items: center;
}
.col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gap8 {
  gap: 8px;
}
.gap4 {
  gap: 4px;
}
.wrap {
  flex-wrap: wrap;
}
.grow {
  flex: 1 1 auto;
  min-width: 0;
}
.muted {
  color: var(--muted);
}
.tiny {
  font-size: 12px;
}
.small {
  font-size: 13px;
}
.bold {
  font-weight: 650;
}
.nowrap {
  white-space: nowrap;
}
.center {
  text-align: center;
}
.hidden {
  display: none !important;
}
.mt8 {
  margin-top: 8px;
}
.mt12 {
  margin-top: 12px;
}
.mt16 {
  margin-top: 16px;
}
.mb0 {
  margin-bottom: 0;
}
.mono {
  font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
  font-size: 12.5px;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ==================================================================
   页头
   ================================================================== */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.page-title h1 {
  font-size: 24px;
  letter-spacing: 0.2px;
}

.page-title p {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==================================================================
   卡片
   ================================================================== */

.card {
  background: linear-gradient(180deg, rgba(27, 41, 71, 0.62), rgba(20, 32, 58, 0.62));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-hd {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.35);
  color: #dce7fb;
}

.card-hd .card-extra {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-bd {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-bd:empty {
  display: none;
}

.card-ft {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-bd {
  max-height: min(64vh, 560px);
  overflow: auto;
}

/* ==================================================================
   按钮
   ================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(27, 41, 71, 0.7);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s, border-color 0.16s, transform 0.1s, opacity 0.16s;
}

.btn:hover:not(:disabled) {
  background: rgba(40, 60, 100, 0.8);
  border-color: #38508a;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled,
.btn.busy {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(135deg, var(--brand), #3f74e0);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(76, 141, 255, 0.28);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #5c99ff, #4a7fe8);
}

.btn.ghost {
  background: transparent;
}

.btn.ghost:hover:not(:disabled) {
  background: rgba(76, 141, 255, 0.12);
}

.btn.danger {
  background: rgba(255, 107, 107, 0.14);
  border-color: rgba(255, 107, 107, 0.45);
  color: #ffd3d3;
}

.btn.danger:hover:not(:disabled) {
  background: rgba(255, 107, 107, 0.24);
}

.btn.ok {
  background: rgba(53, 208, 127, 0.16);
  border-color: rgba(53, 208, 127, 0.45);
  color: #c9f7de;
}

.btn.sm {
  padding: 5px 10px;
  font-size: 13px;
  border-radius: 8px;
}

.btn.icon-btn,
.btn.sm.icon-btn {
  padding: 6px;
  width: 32px;
  height: 32px;
}

.btn.active {
  border-color: var(--brand);
  background: rgba(76, 141, 255, 0.2);
}

.ic {
  flex: 0 0 auto;
}

/* ==================================================================
   Chips
   ================================================================== */

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 32, 58, 0.7);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.16s;
}

.chip:hover:not(.disabled) {
  border-color: #3a5794;
  color: var(--text);
}

.chip.active {
  background: linear-gradient(135deg, rgba(76, 141, 255, 0.28), rgba(124, 92, 255, 0.2));
  border-color: rgba(76, 141, 255, 0.6);
  color: #fff;
  font-weight: 600;
}

.chip.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chip-count {
  font-size: 11px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(11, 18, 32, 0.6);
  color: #cfe0ff;
}

/* ==================================================================
   标签 / 徽章
   ================================================================== */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.65;
  background: rgba(76, 141, 255, 0.14);
  border: 1px solid rgba(76, 141, 255, 0.3);
  color: #cfe0ff;
  white-space: nowrap;
}

.tag.ok {
  background: rgba(53, 208, 127, 0.14);
  border-color: rgba(53, 208, 127, 0.36);
  color: #b8f4d5;
}

.tag.warn {
  background: rgba(255, 182, 46, 0.14);
  border-color: rgba(255, 182, 46, 0.36);
  color: #ffe0a8;
}

.tag.err {
  background: rgba(255, 107, 107, 0.14);
  border-color: rgba(255, 107, 107, 0.4);
  color: #ffd0d0;
}

/* ==================================================================
   表单
   ================================================================== */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.label {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 13px;
  color: #cbd8f0;
  font-weight: 600;
}

.label .hint {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 400;
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.55);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(76, 141, 255, 0.18);
}

.textarea {
  resize: vertical;
  line-height: 1.7;
  min-height: 120px;
}

.input::placeholder,
.textarea::placeholder {
  color: #61729a;
}

.select {
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #93a3c4 50%),
    linear-gradient(135deg, #93a3c4 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.help {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--brand);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

input[type='file'] {
  color: var(--muted);
  font-size: 13px;
}

/* ==================================================================
   统计 / 数据
   ================================================================== */

.stat {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(27, 41, 71, 0.62), rgba(20, 32, 58, 0.5));
}

.stat-val {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
}

.stat-val .ic {
  align-self: center;
  color: var(--brand);
}

.stat-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.stat-label {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.stat-sub {
  font-size: 11.5px;
  color: #7e8fb5;
  margin-top: 4px;
}

.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(38, 54, 92, 0.7);
  font-size: 13.5px;
}

.kv:last-child {
  border-bottom: none;
}

.kv-k {
  color: var(--muted);
  flex: 0 0 auto;
}

.kv-v {
  text-align: right;
  min-width: 0;
  word-break: break-all;
}

/* ==================================================================
   进度条
   ================================================================== */

.progress {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(11, 18, 32, 0.75);
  border: 1px solid var(--line);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 0.35s ease;
}

.progress.grow {
  flex: 1 1 auto;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-row .progress {
  flex: 1 1 auto;
}

.progress-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* ==================================================================
   骨架屏 / 加载 / 空状态 / 错误
   ================================================================== */

@keyframes cet-shimmer {
  0% {
    opacity: 0.35;
  }
  50% {
    opacity: 0.75;
  }
  100% {
    opacity: 0.35;
  }
}

.skeleton-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.skeleton {
  display: block;
  height: 13px;
  border-radius: 6px;
  background: linear-gradient(90deg, #223256, #2c4370, #223256);
  animation: cet-shimmer 1.4s ease-in-out infinite;
}

.skeleton:first-child {
  height: 20px;
}

.loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13.5px;
  padding: 8px 0;
}

.spinner {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  border-radius: 50%;
  border: 2px solid rgba(76, 141, 255, 0.28);
  border-top-color: var(--brand);
  animation: cet-spin 0.75s linear infinite;
}

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

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.empty p {
  margin: 0;
  font-size: 13.5px;
}

.error-box {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.09);
}

.err-detail {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(11, 18, 32, 0.6);
  color: #ffc9c9;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 160px;
  overflow: auto;
}

/* ==================================================================
   Toast
   ================================================================== */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 11px;
  background: rgba(20, 32, 58, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13.5px;
  animation: cet-toast-in 0.22s ease;
  max-width: min(88vw, 520px);
}

.toast.out {
  animation: cet-toast-out 0.24s ease forwards;
}

.toast.ok {
  border-color: rgba(53, 208, 127, 0.5);
}
.toast.ok .ic {
  color: var(--ok);
}
.toast.err {
  border-color: rgba(255, 107, 107, 0.5);
}
.toast.err .ic {
  color: var(--err);
}
.toast.info .ic {
  color: var(--brand);
}

@keyframes cet-toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes cet-toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ==================================================================
   Modal
   ================================================================== */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(4, 8, 16, 0.66);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: cet-fade-in 0.16s ease;
}

.modal-mask.out {
  animation: cet-fade-out 0.17s ease forwards;
}

.modal {
  width: 560px;
  max-width: 100%;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1b2947, #131f38);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: cet-modal-in 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.modal .card-hd strong {
  flex: 1 1 auto;
}

@keyframes cet-fade-in {
  from {
    opacity: 0;
  }
}
@keyframes cet-fade-out {
  to {
    opacity: 0;
  }
}
@keyframes cet-modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

/* ==================================================================
   Markdown 渲染
   ================================================================== */

.markdown {
  color: #dbe5f7;
  font-size: 14.5px;
  line-height: 1.78;
  word-break: break-word;
}

.markdown > *:first-child {
  margin-top: 0;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4 {
  margin: 18px 0 8px;
  color: #fff;
}

.markdown h1 {
  font-size: 19px;
}
.markdown h2 {
  font-size: 17px;
  padding-left: 9px;
  border-left: 3px solid var(--brand);
}
.markdown h3 {
  font-size: 15.5px;
}
.markdown h4 {
  font-size: 14.5px;
  color: #cfe0ff;
}

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

.markdown ul,
.markdown ol {
  margin: 0 0 10px;
  padding-left: 22px;
}

.markdown li {
  margin-bottom: 4px;
}

.markdown code {
  padding: 1.5px 5px;
  border-radius: 5px;
  background: rgba(11, 18, 32, 0.8);
  border: 1px solid var(--line);
  font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
  font-size: 12.8px;
  color: #ffd9a0;
}

.markdown pre {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(8, 13, 24, 0.85);
  border: 1px solid var(--line);
  overflow: auto;
}

.markdown pre code {
  padding: 0;
  border: none;
  background: none;
  color: #cfe6ff;
}

.markdown blockquote {
  margin: 0 0 12px;
  padding: 8px 14px;
  border-left: 3px solid var(--brand-2);
  background: rgba(124, 92, 255, 0.09);
  border-radius: 0 8px 8px 0;
  color: #cdd9f0;
}

.markdown hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

.markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 12px;
  font-size: 13.5px;
}

.markdown th,
.markdown td {
  border: 1px solid var(--line);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}

.markdown th {
  background: rgba(11, 18, 32, 0.6);
  color: #dce7fb;
  font-weight: 650;
}

.markdown strong {
  color: #fff;
}

.markdown del {
  color: var(--muted);
}

.stream-box:empty::after {
  content: '正在生成…';
  color: var(--muted);
  font-size: 13px;
}

/* ==================================================================
   精读正文与标注
   ================================================================== */

.article {
  font-size: 16.5px;
  line-height: 1.95;
  color: #e9effb;
  font-family: Georgia, 'Times New Roman', 'Songti SC', serif;
  letter-spacing: 0.15px;
}

.article p {
  margin: 0 0 15px;
}

.article .para-cn {
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.85;
  color: #a9b8d6;
  padding-left: 12px;
  border-left: 2px solid rgba(76, 141, 255, 0.28);
  margin-bottom: 16px;
}

.article.translated {
  font-size: 14.5px;
  line-height: 1.85;
  color: #b9c7e2;
  font-family: inherit;
}

.w-mark,
.p-mark {
  cursor: pointer;
  border-radius: 3px;
  padding: 0 1px;
  transition: background 0.15s, color 0.15s;
}

/* 点词查义：正文里所有普通英文单词都可点，默认不打扰阅读，悬停才提示 */
.t-word {
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}

/* 悬停高亮只在真正有指针的设备上生效，避免手机上「点完一直残留高亮」 */
@media (hover: hover) and (pointer: fine) {
  .t-word:hover {
    background: rgba(53, 208, 127, 0.16);
    box-shadow: inset 0 -1px 0 rgba(53, 208, 127, 0.55);
    color: #dfffe9;
  }
}

.t-word.mark-active {
  background: rgba(53, 208, 127, 0.32);
  box-shadow: inset 0 -2px 0 var(--ok);
  color: #fff;
}

.t-word:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

/* 触屏设备：扩大点词的热区，内联元素的行内 padding 不会影响排版与换行 */
@media (pointer: coarse) {
  .t-word,
  .w-mark,
  .p-mark {
    padding: 4px 3px;
  }

  .article {
    line-height: 2.05;
  }
}

/* 点词查义状态条 */
.lookup-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(11, 18, 32, 0.45);
  border: 1px dashed var(--line);
}

/* ==================================================================
   例句区块（整句翻译 + 可点单词）
   ================================================================== */

.sx-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(11, 18, 32, 0.42);
  border: 1px solid var(--line);
}

.sx-block.sx-compact {
  padding: 8px 10px;
  gap: 4px;
}

.sx-sentence {
  font-size: 14.5px;
  line-height: 1.85;
  color: #e2eaf8;
  font-family: Georgia, 'Times New Roman', 'Songti SC', serif;
}

.sx-compact .sx-sentence {
  font-size: 13.8px;
  line-height: 1.8;
}

/* 可点单词：默认不打扰阅读，悬停才提示；触屏设备加大热区 */
.s-word {
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}

.s-word.s-hit {
  box-shadow: inset 0 -1px 0 rgba(76, 141, 255, 0.6);
}

@media (hover: hover) and (pointer: fine) {
  .s-word:hover {
    background: rgba(76, 141, 255, 0.18);
    color: #dce9ff;
  }
  .s-word.s-word-active {
    background: rgba(76, 141, 255, 0.3);
    box-shadow: inset 0 -2px 0 var(--brand);
    color: #fff;
  }
}

@media (pointer: coarse) {
  .s-word {
    padding: 4px 2px;
  }
}

.sx-cn {
  font-size: 13.5px;
  line-height: 1.8;
  color: #a9b8d6;
  padding-left: 10px;
  border-left: 2px solid rgba(76, 141, 255, 0.3);
}

.sx-note {
  color: #7e8fb5;
}

/* 句内点词弹出的迷你词条 */
.sx-pop {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(27, 41, 71, 0.96), rgba(16, 26, 44, 0.96));
  border: 1px solid rgba(76, 141, 255, 0.42);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sx-pop .sx-pop-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.sx-pop .sx-pop-word {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

.w-mark {
  border-bottom: 2px solid rgba(76, 141, 255, 0.75);
  color: #cfe0ff;
}

.w-mark:hover {
  background: rgba(76, 141, 255, 0.16);
}

.p-mark {
  background: rgba(255, 182, 46, 0.17);
  box-shadow: inset 0 -1px 0 rgba(255, 182, 46, 0.4);
  color: #ffe6b8;
}

.p-mark:hover {
  background: rgba(255, 182, 46, 0.3);
}

.w-mark.mark-active {
  background: rgba(76, 141, 255, 0.34);
  border-bottom-color: #fff;
  color: #fff;
}

.p-mark.mark-active {
  background: rgba(255, 182, 46, 0.44);
  color: #fff;
}

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(11, 18, 32, 0.45);
  border: 1px dashed var(--line);
}

.legend span.sample {
  display: inline-block;
  padding: 0 5px;
  border-radius: 3px;
}

/* 详解浮层/面板 */
.detail-panel {
  border: 1px solid rgba(76, 141, 255, 0.4);
  background: linear-gradient(180deg, rgba(27, 41, 71, 0.95), rgba(16, 26, 44, 0.95));
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 74px;
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-head .word {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
}

.phonetic {
  color: var(--muted);
  font-size: 13px;
  font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
}

.ex-en {
  color: #c1cfe8;
  font-size: 13.5px;
}

.ex-pair {
  border-left: 2px solid rgba(76, 141, 255, 0.35);
  padding-left: 10px;
  font-size: 13.5px;
}

.ex-pair .en {
  color: #dbe5f7;
}

.ex-pair .cn {
  color: var(--muted);
  font-size: 13px;
}

/* 阅读题 */
.quiz-q {
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.4);
}

.quiz-stem {
  font-weight: 600;
  margin-bottom: 10px;
  color: #eef4ff;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.opt {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(20, 32, 58, 0.6);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  line-height: 1.6;
  transition: all 0.15s;
}

.opt:hover:not(:disabled) {
  border-color: #3a5794;
  background: rgba(32, 48, 84, 0.8);
}

.opt .key {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(76, 141, 255, 0.18);
  color: #cfe0ff;
  margin-top: 1px;
}

.opt.correct {
  border-color: rgba(53, 208, 127, 0.6);
  background: rgba(53, 208, 127, 0.14);
}

.opt.correct .key {
  background: var(--ok);
  color: #04180d;
}

.opt.wrong {
  border-color: rgba(255, 107, 107, 0.6);
  background: rgba(255, 107, 107, 0.13);
}

.opt.wrong .key {
  background: var(--err);
  color: #2a0505;
}

.opt:disabled {
  cursor: default;
}

.explain-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(76, 141, 255, 0.08);
  border: 1px solid rgba(76, 141, 255, 0.24);
  font-size: 13.5px;
  color: #cfdcf3;
}

/* ==================================================================
   表格
   ================================================================== */

.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.data th,
table.data td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.data th {
  background: rgba(11, 18, 32, 0.6);
  color: #cbd8f0;
  font-weight: 650;
  white-space: nowrap;
}

table.data tr:last-child td {
  border-bottom: none;
}

table.data tbody tr:hover {
  background: rgba(76, 141, 255, 0.06);
}

/* ==================================================================
   单词卡片 / 答题
   ================================================================== */

.word-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: rgba(11, 18, 32, 0.42);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.word-card .w {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

.answer-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.blank {
  display: inline-block;
  min-width: 74px;
  border-bottom: 2px solid var(--brand);
  color: transparent;
  user-select: none;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(20, 32, 58, 0.5);
  transition: border-color 0.15s, background 0.15s;
}

.list-item:hover {
  border-color: #3a5794;
  background: rgba(32, 48, 84, 0.7);
}

.list-item .li-main {
  flex: 1 1 auto;
  min-width: 0;
}

.list-item .li-title {
  font-weight: 600;
  color: #eaf1ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item .li-sub {
  font-size: 12.5px;
  color: var(--muted);
}

.clickable {
  cursor: pointer;
}

/* 拆分区（左右两栏 + 侧栏） */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.split.wide-right {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
}

/* 设置页代码块 */
.code-block {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.code-block pre {
  flex: 1 1 auto;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(8, 13, 24, 0.85);
  border: 1px solid var(--line);
  color: #cfe6ff;
  overflow: auto;
  white-space: pre;
}

/* 数据看板图表 */
.chart-wrap {
  width: 100%;
  overflow-x: auto;
}

.chart-wrap svg {
  display: block;
  width: 100%;
  min-width: 420px;
  height: auto;
}

.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}

.chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 5px;
}

/* 对话 */
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 4px;
}

.msg {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.7;
}

.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(76, 141, 255, 0.3), rgba(63, 116, 224, 0.24));
  border: 1px solid rgba(76, 141, 255, 0.4);
  border-bottom-right-radius: 4px;
}

.msg.ai {
  align-self: flex-start;
  background: rgba(20, 32, 58, 0.8);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

/* 任务清单 */
.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.42);
}

.task-item .ti-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(76, 141, 255, 0.15);
  color: #cfe0ff;
}

.task-item.done .ti-icon {
  background: rgba(53, 208, 127, 0.18);
  color: var(--ok);
}

/* 分栏 Tab */
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
  flex-wrap: wrap;
}

.tab {
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: #fff;
  border-bottom-color: var(--brand);
  font-weight: 600;
}

/* 分数展示 */
.score-ring {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.score-big {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  letter-spacing: -1px;
}

.score-big em {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
  letter-spacing: 0;
}

.dimension {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dimension-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
}

/* 折叠块 */
details.fold {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(11, 18, 32, 0.4);
  overflow: hidden;
}

details.fold > summary {
  cursor: pointer;
  padding: 10px 12px;
  font-size: 13.5px;
  color: #cbd8f0;
  font-weight: 600;
  list-style: none;
}

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

details.fold > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 7px;
  transition: transform 0.18s;
  color: var(--brand);
}

details.fold[open] > summary::before {
  transform: rotate(90deg);
}

details.fold > .fold-bd {
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

/* ==================================================================
   响应式
   ================================================================== */

@media (max-width: 1000px) {
  .split,
  .split.wide-right {
    grid-template-columns: minmax(0, 1fr);
  }

  /* 详解面板在窄屏是堆叠在正文下方，去掉粘性定位 */
  .detail-panel {
    position: static;
  }

  .grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  #app {
    display: block;
  }

  /* 手机端内容区留出底部安全距离（iPhone 手势条） */
  .main {
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }

  /* 手机端菜单：加一层遮罩，点空白处才收起 */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(80vw, 280px);
    flex-basis: auto;
    transform: translateX(-104%);
    transition: transform 0.24s ease;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0);
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
  }

  .sidebar.open {
    transform: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  }

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

  .topbar {
    padding: 10px 14px;
  }

  .hide-sm {
    display: none;
  }

  .grid.cols-3,
  .grid.cols-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-title h1 {
    font-size: 20px;
  }

  /* 手机正文字号：缩小到 15.5px，行距同步收紧，长文更省眼力 */
  .article {
    font-size: 15.5px;
    line-height: 1.8;
  }

  .article p {
    margin-bottom: 15px;
  }

  /* 手机上按钮横向铺开，避免挤成一团 */
  .page-actions,
  .card-ft {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1 1 auto;
  }

  /* 弹窗接近全屏，方便看详解与批改结果 */
  .modal-mask {
    padding: 10px;
    align-items: flex-end;
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 88vh;
    border-radius: 16px 16px 12px 12px;
  }

  /* 详解面板：手机上改成底部抽屉，点词立即从底部滑出，不再被推到正文最下面 */
  .detail-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 80;
    max-height: 64vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 34px rgba(0, 0, 0, 0.55);
    animation: detail-sheet-up 0.2s ease-out;
  }

  @keyframes detail-sheet-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .chat-log {
    max-height: 40vh;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  /* 横屏：屏幕更矮，正文再收紧一点，详解抽屉降低高度避免遮满 */
  .article {
    font-size: 15px;
    line-height: 1.75;
  }

  .detail-panel {
    max-height: 76vh;
  }
}

@media (max-width: 520px) {
  .grid.cols-4 {
    grid-template-columns: minmax(0, 1fr);
  }

  .score-big {
    font-size: 32px;
  }

  .msg {
    max-width: 94%;
  }
}

/* 只在小屏显示的控件（如「横屏」按钮）；桌面端隐藏 */
.show-sm {
  display: none !important;
}

@media (max-width: 900px) {
  .show-sm {
    display: inline-flex !important;
  }
}

/* 打印：只保留正文 */
@media print {
  .sidebar,
  .topbar,
  .page-actions,
  .toast-host {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card {
    border-color: #bbb;
    box-shadow: none;
  }
}
