:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #152033;
  background: #f4f7fb;
}

* { box-sizing: border-box; }

body { margin: 0; background: linear-gradient(180deg, #edf4ff 0, #f8fafc 240px); }

.header-controls { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-left: auto; }
.language-switch { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 2px; flex: none; padding: 3px; border: 1px solid #d4deec; border-radius: 10px; background: rgba(239,244,251,.94); }
.language-switch button { min-width: 52px; min-height: 30px; border: 0; border-radius: 7px; padding: 4px 9px; background: transparent; color: #64758b; font-size: 11px; font-weight: 800; cursor: pointer; transition:background .18s ease,color .18s ease,box-shadow .18s ease; }
.language-switch button.active { background: #fff; color: #285db7; box-shadow: 0 2px 8px rgba(32,62,105,.13); }
.language-switch button:focus-visible { outline: 2px solid #4a70d8; outline-offset: 2px; }
.language-change-notice { position:fixed; z-index:300; top:18px; left:50%; max-width:calc(100vw - 28px); padding:10px 16px; border:1px solid #cbdcf6; border-radius:999px; background:rgba(255,255,255,.96); box-shadow:0 12px 36px rgba(28,52,89,.2); color:#284b78; font-size:12px; font-weight:750; text-align:center; opacity:0; pointer-events:none; transform:translate(-50%,-12px); transition:opacity .18s ease,transform .18s ease; }
.language-change-notice.show { opacity:1; transform:translate(-50%,0); }

.shell { max-width: 560px; margin: 0 auto; padding: 22px 18px 36px; }

.hero { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.hero h1 { margin: 0; font-size: 22px; letter-spacing: .02em; }
.hero p { margin: 4px 0 0; color: #637083; font-size: 13px; }
.mark {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px;
  color: white; font-weight: 700; font-size: 20px;
  background: linear-gradient(135deg, #2864dc, #7347d8);
  box-shadow: 0 8px 22px rgba(45, 87, 190, .24);
}

.panel { background: rgba(255,255,255,.9); border: 1px solid #dce5f2; border-radius: 14px; padding: 14px; box-shadow: 0 8px 28px rgba(23,45,80,.06); }
.settings label:first-child { display: block; font-size: 13px; font-weight: 650; margin-bottom: 7px; }
input[type="password"], input[type="search"], input[type="text"] { width: 100%; height: 40px; border: 1px solid #cbd7e8; border-radius: 9px; padding: 0 11px; outline: none; background: white; }
input[type="password"]:focus, input[type="search"]:focus, input[type="text"]:focus { border-color: #3f6fde; box-shadow: 0 0 0 3px rgba(63,111,222,.12); }
.check-row { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; font-size: 12px; line-height: 1.45; color: #3f4c5f; }
.check-row input { margin-top: 2px; }
.hint { margin: 8px 0 0; color: #7a8798; font-size: 11px; }
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.option-grid label span { display: block; margin-bottom: 5px; color: #536175; font-size: 11px; font-weight: 650; }
.option-grid select, .option-grid input { width: 100%; height: 36px; border: 1px solid #cbd7e8; border-radius: 8px; padding: 0 9px; background: white; color: #28384f; }

button { font: inherit; cursor: pointer; }
.analyze-actions { display: flex; gap: 8px; margin-top: 14px; }
.primary { flex: 1; border: 0; border-radius: 12px; padding: 12px 16px; color: white; font-weight: 700; background: linear-gradient(100deg, #2864dc, #6849d8); box-shadow: 0 8px 20px rgba(54,82,186,.22); }
.primary:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-1px); }
.primary:disabled { cursor: wait; opacity: .55; }
.secondary { border: 1px solid #c8d4e6; border-radius: 8px; padding: 6px 10px; background: white; color: #31507c; font-size: 12px; }
.danger { border: 1px solid #e3b7b3; border-radius: 10px; padding: 0 13px; background: #fff7f6; color: #a53d35; font-size: 12px; }

.status { min-height: 38px; padding: 11px 3px 3px; color: #5f6d80; font-size: 12px; line-height: 1.45; }
.status.error { color: #b3261e; }
.status.success { color: #25754a; }
.hidden { display: none; }
.result-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0 10px; }
.result-head h2 { margin: 0; font-size: 16px; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.result-list { display: grid; gap: 10px; }
.slide-card { background: white; border: 1px solid #dce5f2; border-radius: 12px; padding: 13px 14px; box-shadow: 0 5px 18px rgba(24,51,90,.05); }
.slide-card h3 { margin: 0 0 7px; font-size: 14px; color: #29466d; }
.slide-card p { margin: 0; font-size: 13px; line-height: 1.65; color: #344054; white-space: pre-wrap; }
.point-section { margin-top: 12px; padding-top: 10px; border-top: 1px solid #edf1f6; }
.point-section h4 { margin: 0 0 6px; color: #38527a; font-size: 12px; }
.point-section ul { margin: 0; padding-left: 19px; }
.point-section li { margin: 4px 0; color: #3b4658; font-size: 12px; line-height: 1.55; }
.point-section .empty-note { color: #8994a4; font-size: 12px; }
.knowledge-term { display: block; color: #203f70; font-weight: 700; }
.knowledge-explanation { display: block; margin-top: 2px; color: #4d596a; }
.knowledge-actions { margin-top: 7px; }
.knowledge-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.knowledge-section-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:12px; }
.knowledge-section-heading h4 { margin:0 0 4px; color:#254875; font-size:14px; }
.knowledge-section-heading p { margin:0; color:#75849a; font-size:11px; line-height:1.55; }
.knowledge-section-heading>span { flex:none; padding:5px 9px; border-radius:999px; background:#edf3ff; color:#40679f; font-size:10px; font-weight:800; white-space:nowrap; }
.point-section .knowledge-card-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:0; padding:0; list-style:none; }
.point-section .knowledge-concept-card { display:grid; align-content:start; gap:11px; min-width:0; margin:0; padding:14px; border:1px solid #dfe7f2; border-radius:13px; background:linear-gradient(145deg,#fff,#fafcff); box-shadow:0 5px 16px rgba(34,63,104,.055); color:#34445b; transition:border-color .18s ease,box-shadow .18s ease,transform .18s ease; }
.point-section .knowledge-concept-card:hover { border-color:#b7c9e6; box-shadow:0 9px 24px rgba(34,63,104,.09); transform:translateY(-1px); }
.knowledge-concept-head { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:start; gap:9px; }
.knowledge-concept-index { display:grid; place-items:center; width:27px; height:27px; border-radius:8px; background:linear-gradient(135deg,#e8f1ff,#eeeaff); color:#4568b8; font-size:10px; font-weight:900; letter-spacing:.04em; }
.knowledge-concept-card .knowledge-term { padding-top:2px; color:#1f416f; font-size:14px; line-height:1.55; overflow-wrap:anywhere; }
.knowledge-explanation-card { display:grid; gap:5px; padding:10px 11px; border-left:3px solid #7b91df; border-radius:0 9px 9px 0; background:#f4f7fd; }
.knowledge-explanation-card b { color:#526fa2; font-size:10px; letter-spacing:.04em; }
.knowledge-explanation-card p { margin:0; color:#45546a; font-size:12px; line-height:1.72; white-space:pre-wrap; overflow-wrap:anywhere; }
.knowledge-concept-card .knowledge-actions { margin-top:auto; padding-top:2px; }
.knowledge-concept-card .knowledge-actions button { min-height:35px; border-radius:9px; padding-inline:11px; }
.knowledge-concept-card .explain-button { border-color:#aebfe3; background:#edf3ff; color:#285caf; font-weight:750; }
.knowledge-concept-card .detail-explanation { margin-top:0; }
.explain-button { border: 1px solid #bfcde2; border-radius: 7px; padding: 5px 9px; background: #f8faff; color: #2d5dac; font-size: 11px; }
.explain-button:hover:not(:disabled) { background: #edf3ff; }
.detail-explanation { margin-top: 8px; border-left: 3px solid #5d75d8; border-radius: 0 8px 8px 0; padding: 9px 10px; background: #f2f5ff; color: #35445c; font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.study-tools { margin-top: 8px; }
.study-tools > label { display: block; margin-bottom: 7px; color: #2d466b; font-size: 13px; font-weight: 700; }
.study-tools .question-label { margin-top: 15px; }
.query-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.query-row .secondary { min-width: 54px; }
.query-answer { margin-top: 10px; border-radius: 9px; padding: 11px; background: #f1f5fc; color: #33445e; font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.favorites-toolbar { display: flex; gap: 7px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #e7edf5; }
.favorites-panel { margin-top: 9px; border-radius: 10px; padding: 8px; background: #fffaf0; }
.favorite-entry { padding: 8px; border-bottom: 1px solid #eee4c9; }
.favorite-entry:last-child { border-bottom: 0; }
.favorite-entry strong { display: block; color: #775812; font-size: 12px; }
.favorite-entry p { margin: 4px 0 7px; color: #5c6470; font-size: 11px; line-height: 1.5; }
.favorite-entry-actions { display: flex; gap: 6px; }
.favorite-empty { margin: 4px; color: #8b8066; font-size: 11px; }
.slide-card.filtered-out { display: none; }
.slide-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.slide-title-row .page-question-button { margin-right: auto; border-color: #9bb5df; background: #f2f6ff; color: #285a9d; font-weight: 700; }
.page-question-panel { display: grid; gap: 9px; margin: 0 0 14px; padding: 12px; border: 1px solid #d8e4f5; border-radius: 11px; background: #f8fbff; }
.page-question-panel.hidden { display: none !important; }
.page-question-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.page-question-form input { min-width: 0; min-height: 38px; padding: 8px 10px; border: 1px solid #ccd9eb; border-radius: 9px; background: #fff; }
.page-question-form button { min-width: 64px; }
.page-question-answer { padding: 11px 12px; border-radius: 9px; background: #edf3fc; color: #334963; font-size: 12px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.page-question-answer.hidden { display: none !important; }
.slide-copy { flex: none; border: 0; background: transparent; color: #62718a; font-size: 11px; }
.point-copy, .favorite-button { border: 1px solid #d1dae8; border-radius: 7px; padding: 5px 8px; background: white; color: #5a6980; font-size: 11px; }
.favorite-button.active { border-color: #e0b957; background: #fff8dd; color: #8a6510; }
.quiz-section { margin: 0 0 14px; }
.results > .quiz-section { padding: 14px; border-color: #cfdcf0; background: linear-gradient(180deg, #fff, #f8faff); box-shadow: 0 8px 22px rgba(38, 67, 108, .07); }
.results > .quiz-section .result-head { margin-top: 0; }
.quiz-list { display: grid; gap: 9px; }
.quiz-item { border: 1px solid #dbe4f1; border-radius: 10px; padding: 11px; background: #fbfcff; }
.quiz-item h3 { margin: 0; color: #2d466b; font-size: 13px; line-height: 1.5; }
.quiz-source { margin: 5px 0; color: #7a8798; font-size: 11px; }
.quiz-answer { margin-top: 8px; padding-top: 8px; border-top: 1px solid #e5ebf4; color: #3d4d64; font-size: 12px; line-height: 1.6; white-space: pre-wrap; }

@media (prefers-reduced-motion: no-preference) {
  .primary { transition: transform .16s ease, filter .16s ease; }
  .slide-card { animation: rise .24s ease both; }
  @keyframes rise { from { opacity: 0; transform: translateY(5px); } }
}

@media (max-width: 620px) {
  .knowledge-section-heading { align-items:stretch; flex-direction:column; gap:8px; }
  .knowledge-section-heading>span { align-self:flex-start; }
  .point-section .knowledge-card-grid { grid-template-columns:1fr; }
  .point-section .knowledge-concept-card { padding:12px; }
  .knowledge-concept-card .knowledge-actions button { flex:1 1 calc(33.333% - 6px); padding-inline:7px; }
  .slide-title-row .page-question-button { flex: 1 1 100% !important; margin-right: 0; }
  .page-question-form { grid-template-columns: 1fr; }
  .page-question-form button { width: 100%; min-height: 40px; }
}

/* 3.38 context-rich knowledge cards */
.point-section .knowledge-card-grid { grid-template-columns:1fr; }
.knowledge-detail-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.knowledge-detail-block { min-width:0; padding:10px 11px; border:1px solid #e1e8f2; border-radius:10px; background:#f8faff; }
.knowledge-detail-block.definition { grid-column:1/-1; border-color:#ccdaf0; background:linear-gradient(135deg,#f3f7ff,#fafcff); }
.knowledge-detail-block.example { border-color:#d5eadc; background:#f3faf6; }
.knowledge-detail-block.context { border-color:#e5dcf3; background:#faf7ff; }
.knowledge-detail-block.source { grid-column:1/-1; border-color:#e4e7ec; background:#f8f8f9; }
.knowledge-detail-block b { display:block; margin-bottom:5px; color:#526fa2; font-size:10px; letter-spacing:.04em; }
.knowledge-detail-block.example b { color:#347055; }
.knowledge-detail-block.context b { color:#715995; }
.knowledge-detail-block.source b { color:#697386; }
.knowledge-detail-block p { margin:0; color:#3f4e63; font-size:12px; line-height:1.7; white-space:pre-wrap; overflow-wrap:anywhere; }
.knowledge-detail-block.source p { color:#5c6675; font-style:italic; }
@media (max-width:680px) {
  .knowledge-detail-grid { grid-template-columns:1fr; }
  .knowledge-detail-block.definition,.knowledge-detail-block.source { grid-column:auto; }
}
