/* ==========================================================================
   试卷 / A4 打印 / 知识卡片
   ========================================================================== */

:root{
  --paper-font: "Kaiti SC", "KaiTi", "STKaiti", "楷体", "SimSun", "Songti SC", serif;
  --paper-num: "Times New Roman", "SimSun", "Songti SC", serif;
  --paper-ink:#111;
}

/* ------------------------------ 试卷容器 -------------------------------- */
.paper-scroll{ overflow-x:auto; padding:6px 0 18px; -webkit-overflow-scrolling:touch; }

.paper-sheet{
  width:210mm;
  min-height:297mm;
  padding:13mm 12mm 14mm;
  margin:0 auto 20px;
  background:#fff;
  color:var(--paper-ink);
  box-shadow:0 10px 34px rgba(24,33,54,.13);
  border-radius:3px;
  font-family:var(--paper-font);
  font-size:14.5px;
  line-height:1.9;
  position:relative;
  print-color-adjust:exact;
  -webkit-print-color-adjust:exact;
}

.paper-sheet *{ box-sizing:border-box; }

/* 试卷页眉 */
.p-head{ text-align:center; padding-bottom:8px; }
.p-head .p-school{ font-size:12px; letter-spacing:3px; color:#555; }
.p-head h1{
  font-family:var(--paper-font); font-size:23px; font-weight:700; letter-spacing:1px;
  margin:6px 0 4px; line-height:1.4;
}
.p-head .p-sub{ font-size:11.5px; color:#666; letter-spacing:1px; }
.p-meta{
  display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap;
  font-size:12px; color:#333; border-top:1.4px solid #222; border-bottom:1px solid #222;
  padding:5px 2px; margin-top:8px;
}
.p-meta span{ display:inline-flex; align-items:center; gap:4px; }
.p-meta .u{ display:inline-block; min-width:58px; border-bottom:1px solid #666; height:1em; }
.p-meta .score{ min-width:46px; }

.p-tip{
  font-size:11.5px; color:#555; background:#f7f7f7; border-left:3px solid #333;
  padding:5px 9px; margin:9px 0 0; line-height:1.7;
}

/* 大题 */
.p-sec{ margin-top:13px; }
.p-sec-title{
  font-size:15.5px; font-weight:700; letter-spacing:.4px;
  display:flex; align-items:baseline; gap:6px;
}
.p-sec-title .pts{ font-size:11px; font-weight:400; color:#666; letter-spacing:0; }
.p-sec-title .hintline{ font-size:11.5px; font-weight:400; color:#555; }

.p-qs{ margin-top:6px; }
.p-list{ counter-reset:none; }
.p-q{
  padding:5px 0 6px; break-inside:avoid; page-break-inside:avoid;
  font-size:14.5px; line-height:2.05;
}
.p-q .qno{ font-family:var(--paper-num); font-weight:700; margin-right:5px; }
.p-q .stem{ display:inline; }
.p-q .stem b{ font-weight:700; }
.p-q .stem u{ text-decoration:none; border-bottom:1px solid #333; padding:0 10px; }

.p-q.grid-item{ display:flex; gap:4px; align-items:baseline; }

/* 题目网格：口算、竖式、选择题 */
.q-grid{ display:grid; gap:2px 14px; }
.q-grid.c2{ grid-template-columns:repeat(2,minmax(0,1fr)); }
.q-grid.c3{ grid-template-columns:repeat(3,minmax(0,1fr)); }
.q-grid.c4{ grid-template-columns:repeat(4,minmax(0,1fr)); }
.q-grid.c5{ grid-template-columns:repeat(5,minmax(0,1fr)); }
.q-grid .p-q{ padding:6px 0; }

/* 填空横线 */
.blank{
  display:inline-block; min-width:56px; border-bottom:1px solid #222;
  margin:0 4px; height:1em; vertical-align:baseline;
}
.blank.w{ min-width:86px; }
.blank.s{ min-width:36px; }
.paren{ display:inline-block; min-width:2.4em; text-align:center; }

/* 选项 */
.p-opts{ display:flex; flex-wrap:wrap; gap:4px 22px; margin:2px 0 0 22px; }
.p-opts span{ font-size:14px; }

/* 括号写答案 */
.ans-box{ display:inline-block; width:2.2em; border-bottom:1px solid #222; text-align:center; }

/* 田字格 */
.tianzi-row{ display:flex; gap:6px; flex-wrap:wrap; margin:6px 0 2px 22px; }
.tianzi{
  width:34px; height:34px; border:1px solid #333; position:relative;
  background:
    linear-gradient(to right, transparent calc(50% - .5px), #bbb calc(50% - .5px), #bbb calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(to bottom, transparent calc(50% - .5px), #bbb calc(50% - .5px), #bbb calc(50% + .5px), transparent calc(50% + .5px));
  background-size:100% 100%;
  display:inline-block;
}
.tianzi::before,.tianzi::after{
  content:""; position:absolute; background:transparent;
}
.tianzi.dash{
  border-style:dashed;
}
.tianzi.big{ width:44px; height:44px; }

/* 拼音四线三格 */
.pinyin-lines{
  display:inline-block; width:100%; height:46px; margin:5px 0 3px 0;
  background-image:
    linear-gradient(#d33 0 1px, transparent 1px),
    linear-gradient(#999 0 1px, transparent 1px),
    linear-gradient(#999 0 1px, transparent 1px),
    linear-gradient(#d33 0 1px, transparent 1px);
  background-size:100% 100%;
  background-position:0 0, 0 33%, 0 66%, 0 100%;
  background-repeat:no-repeat;
  border-left:1px solid #eee; border-right:1px solid #eee;
}
.pinyin-line-single{ font-family:var(--paper-num); letter-spacing:1px; }

/* 竖式区 */
.v-box{
  width:82px; height:74px; border:1px dashed #b9b9b9; border-radius:4px;
  display:inline-block; margin:2px 8px 2px 0; position:relative;
}
.v-box .v-q{ position:absolute; top:4px; right:6px; font-size:12.5px; font-family:var(--paper-num); }

/* 写话方格 */
.write-box{
  border:1px solid #333; margin-top:6px; padding:0; position:relative;
  background-image:
    repeating-linear-gradient(to right, #cfcfcf 0 1px, transparent 1px 100%),
    repeating-linear-gradient(to bottom, #cfcfcf 0 1px, transparent 1px 100%);
  background-size:28px 28px;
}
.write-box .wb-h{ height:32px; display:flex; align-items:center; padding:0 8px; font-size:12px; color:#666; border-bottom:1px solid #333; background:#fff; }
.write-box .wb-body{ height:280px; background:rgba(255,255,255,.55); }

.write-lines{
  margin-top:8px;
  background-image:repeating-linear-gradient(to bottom, transparent 0 26px, #b9c0cc 26px 27px);
  height:calc(27px * 6);
}
.write-lines.small{ height:calc(27px * 3); }

/* 阅读材料 */
.passage{
  border:1px solid #d6d6d6; border-radius:4px; padding:10px 12px; margin:8px 0;
  font-size:13.5px; line-height:2; background:#fcfcfc;
}
.passage .passage-title{ text-align:center; font-weight:700; margin-bottom:4px; }
.passage p{ text-indent:2em; margin:0; }

/* 阅读小题 */
.subs{ margin-top:4px; }
.sub-q{ line-height:2.05; margin:3px 0 5px; }
.sub-q .p-opts{ margin-left:0; }
.q-hint{ font-size:12.5px; color:#555; }

/* 拼音、竖式、提示文字 */
.py{
  font-family:var(--paper-num); font-size:17px; letter-spacing:1.5px; color:#1c4ea8;
}
.v-wrap{ display:flex; flex-wrap:wrap; gap:10px; margin:6px 0 2px 22px; }

/* 表格 */
.p-table{ border-collapse:collapse; width:100%; margin:8px 0; font-size:13px; }
.p-table th,.p-table td{ border:1px solid #333; padding:6px 8px; text-align:center; }
.p-table th{ background:#f2f2f2; font-weight:700; }

/* 插图 */
.fig{ margin:8px 0; text-align:center; }
.fig svg{ margin:0 auto; max-width:100%; height:auto; }
.fig .fig-cap{ font-size:11.5px; color:#666; margin-top:2px; }

/* 题目内联小图 */
.inline-art{ display:inline-block; vertical-align:middle; }
.inline-art svg{ height:26px; width:auto; }

/* 答案区 */
.answer-sheet{
  margin-top:0 !important;
}
.cut-line{
  text-align:center; font-size:11px; color:#777; letter-spacing:1px;
  border-top:1px dashed #999; margin:2px 0 12px; padding-top:6px;
}
.answer-head{ text-align:center; margin-bottom:6px; }
.answer-head h2{ font-size:19px; letter-spacing:2px; }
.answer-head p{ font-size:11.5px; color:#666; }
.answer-body{ font-size:13px; line-height:1.95; }
.answer-sec{ margin-top:10px; }
.answer-sec h3{ font-size:14px; margin-bottom:3px; }
.ans-list{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1px 22px; }
.ans-list.c3{ grid-template-columns:repeat(3,minmax(0,1fr)); }
.ans-item{ font-size:12.8px; line-height:1.95; break-inside:avoid; }
.ans-item .ano{ font-family:var(--paper-num); font-weight:700; margin-right:4px; }
.ans-item .atip{ color:#555; font-size:12px; }
.ans-item.open{ grid-column:1/-1; }
.ans-item.open .atxt{ display:block; padding-left:1.6em; color:#222; }

/* 试卷页脚 */
.p-foot{
  position:absolute; left:12mm; right:12mm; bottom:7mm;
  display:flex; justify-content:space-between; align-items:center;
  font-size:10.5px; color:#888; border-top:1px solid #ddd; padding-top:3px;
}
.p-foot .pg::after{ content:attr(data-page); }

/* ------------------------------ 试卷工具条 ------------------------------ */
.paper-toolbar{
  position:sticky; top:66px; z-index:40;
  display:flex; align-items:center; gap:8px; flex-wrap:wrap;
  background:rgba(255,255,255,.94); backdrop-filter:blur(10px);
  border:1px solid var(--line); border-radius:14px; padding:9px 11px;
  box-shadow:var(--shadow-s); margin-bottom:18px;
}
.paper-toolbar .pt-title{ font-size:14px; font-weight:700; margin-right:4px; }
.paper-toolbar .pt-meta{ font-size:12px; color:var(--ink-3); }
.paper-toolbar .spacer{ flex:1 1 auto; }

/* ------------------------------ 知识卡片 -------------------------------- */
.card-deck{ display:flex; flex-wrap:wrap; gap:22px; justify-content:center; padding:8px 0 10px; overflow-x:auto; }
.card-deck .kcard{ flex:0 0 auto; }

.kcard{
  width:210mm; min-height:297mm; padding:0; position:relative; overflow:hidden;
  background:#fff; border-radius:4px; box-shadow:0 12px 32px rgba(24,33,54,.14);
  color:#222; print-color-adjust:exact; -webkit-print-color-adjust:exact;
}
.kcard-inner{
  position:relative; z-index:2; padding:15mm 13mm 13mm; min-height:297mm;
  display:flex; flex-direction:column;
}
.kcard .blob{ position:absolute; border-radius:50%; opacity:.55; filter:blur(1px); z-index:0; }
.kcard .blob.b1{ width:240px; height:240px; right:-80px; top:-70px; }
.kcard .blob.b2{ width:170px; height:170px; left:-60px; bottom:-50px; }
.kcard .blob.b3{ width:90px; height:90px; right:34px; bottom:110px; opacity:.35; }

.kcard-badge{
  display:inline-flex; align-items:center; gap:6px; align-self:flex-start;
  font-size:13.5px; font-weight:700; letter-spacing:1px;
  padding:6px 14px; border-radius:999px; background:rgba(255,255,255,.78);
  border:1px solid rgba(0,0,0,.06); color:#444;
}
.kcard h2{ font-size:35px; letter-spacing:1px; margin:16px 0 4px; line-height:1.32; font-weight:800; }
.kcard .kcard-sub{ font-size:14.5px; color:#666; letter-spacing:2px; }

.kcard-list{ margin-top:20px; display:flex; flex-direction:column; gap:14px; flex:1 1 auto; }
.kcard-item{
  display:flex; gap:14px; background:rgba(255,255,255,.86);
  border:1px solid rgba(0,0,0,.055); border-radius:16px; padding:16px 18px;
  box-shadow:0 4px 12px rgba(30,40,60,.05);
}
.kcard-num{
  flex:0 0 auto; width:32px; height:32px; border-radius:10px; display:grid; place-items:center;
  font-size:16px; font-weight:800; color:#fff; background:linear-gradient(135deg,#4c6ef5,#7c5cff);
}
.kcard-item .ki-body{ flex:1 1 auto; min-width:0; }
.kcard-item b{ font-size:19.5px; display:block; line-height:1.5; }
.kcard-item p{ font-size:16px; line-height:1.9; color:#333; margin-top:5px; }
.kcard-item em{
  display:block; font-style:normal; font-size:14px; color:#8a5a12;
  background:#fff8e6; border-radius:8px; padding:6px 10px; margin-top:8px; line-height:1.75;
}
.kcard-foot{
  margin-top:16px; padding-top:10px; border-top:1px dashed rgba(0,0,0,.16);
  display:flex; justify-content:space-between; align-items:center;
  font-size:12px; color:#777; letter-spacing:.5px;
}

/* 卡片主题 */
.kcard.theme-candy{ background:linear-gradient(165deg,#fff6fa 0%,#f3f6ff 55%,#eefaf5 100%); }
.kcard.theme-candy .blob.b1{ background:radial-gradient(circle at 30% 30%,#ffc9dd,#ffe7ef); }
.kcard.theme-candy .blob.b2{ background:radial-gradient(circle at 30% 30%,#c9d8ff,#e6ecff); }
.kcard.theme-candy .blob.b3{ background:#ffe3b0; }
.kcard.theme-candy .kcard-badge{ color:#b02a5b; }
.kcard.theme-forest{ background:linear-gradient(165deg,#f2fbf4 0%,#eef8ff 60%,#fbfaf0 100%); }
.kcard.theme-forest .blob.b1{ background:radial-gradient(circle at 30% 30%,#b9ecc4,#dcf6e2); }
.kcard.theme-forest .blob.b2{ background:radial-gradient(circle at 30% 30%,#cfe8ff,#e6f3ff); }
.kcard.theme-forest .blob.b3{ background:#ffe9a8; }
.kcard.theme-forest .kcard-badge{ color:#1e7b3c; }
.kcard.theme-ocean{ background:linear-gradient(165deg,#eff8ff 0%,#eef4ff 55%,#f0fbff 100%); }
.kcard.theme-ocean .blob.b1{ background:radial-gradient(circle at 30% 30%,#a9dcff,#d9efff); }
.kcard.theme-ocean .blob.b2{ background:radial-gradient(circle at 30% 30%,#c7d4ff,#e4ebff); }
.kcard.theme-ocean .blob.b3{ background:#b8f0e0; }
.kcard.theme-ocean .kcard-badge{ color:#14618f; }
.kcard.theme-sunset{ background:linear-gradient(165deg,#fff8ef 0%,#fff1f2 55%,#fdf5ff 100%); }
.kcard.theme-sunset .blob.b1{ background:radial-gradient(circle at 30% 30%,#ffd5a8,#ffe9cf); }
.kcard.theme-sunset .blob.b2{ background:radial-gradient(circle at 30% 30%,#ffc7cf,#ffe1e6); }
.kcard.theme-sunset .blob.b3{ background:#ffe08a; }
.kcard.theme-sunset .kcard-badge{ color:#a8560a; }
.kcard.theme-violet{ background:linear-gradient(165deg,#f8f4ff 0%,#f2f4ff 55%,#fdf3ff 100%); }
.kcard.theme-violet .blob.b1{ background:radial-gradient(circle at 30% 30%,#dcc9ff,#ece2ff); }
.kcard.theme-violet .blob.b2{ background:radial-gradient(circle at 30% 30%,#c9d6ff,#e2e9ff); }
.kcard.theme-violet .blob.b3{ background:#ffd6ef; }
.kcard.theme-violet .kcard-badge{ color:#5f3dc4; }

.kcard-toolbar{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-bottom:16px; }

/* 卡片预览列表 */
.card-thumbs{ display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:14px; }
.thumb{
  border:1px solid var(--line); border-radius:14px; overflow:hidden; background:#fff;
  cursor:pointer; transition:.18s;
}
.thumb:hover{ box-shadow:var(--shadow); transform:translateY(-2px); }
.thumb canvas{ width:100%; height:auto; display:block; }
.thumb .th-bar{ display:flex; align-items:center; justify-content:space-between; padding:8px 10px; font-size:12px; color:var(--ink-2); }

/* 打印时隐藏的网页元素 */
.print-only{ display:none; }