/* 红墨商业产品矩阵通用增强样式 */
:root {
  --xhs-top-offset: 56px;
}

html {
  scroll-padding-top: 60px;
}

.redink-web-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  z-index: 9940;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px;
  background: rgba(255, 253, 249, 0.96);
  border-bottom: 1px solid rgba(42, 28, 20, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.rw-bar-left,
.rw-bar-nav,
.rw-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rw-single-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #221916;
  white-space: nowrap;
}

.rw-single-dot {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #166534;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 14px;
}

html[data-theme="vermilion-arena"] .rw-single-dot {
  background: #c42034;
}

.rw-bar-home {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f3ece1;
  color: #261c18;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.rw-nav-tab {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  color: #5c4f47;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.rw-nav-tab.is-active {
  background: #231916;
  color: #fffdf9;
}

.rw-bar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(42, 28, 20, 0.16);
  background: #ffffff;
  color: #231916;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.rw-bar-btn-primary {
  background: #15803d;
  border-color: #15803d;
  color: #ffffff;
}

html[data-theme="vermilion-arena"] .rw-bar-btn-primary {
  background: #c42034;
  border-color: #c42034;
}

.rw-bar-btn-ghost {
  background: #f6f2ea;
  border-color: rgba(42, 28, 20, 0.12);
  color: #5c4f47;
  font-size: 11.5px;
  padding: 0 9px;
}

/* 产品 C（分年级同步字帖）专属年级+单元进度选择器面板 */
.rk-sync-panel {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(22, 101, 52, 0.16);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 6px 18px rgba(20, 44, 28, 0.05);
}

.rk-sync-grades {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(22, 101, 52, 0.1);
}

.rk-grade-pill {
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(22, 101, 52, 0.18);
  background: #f4faf6;
  color: #213529;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.rk-grade-pill.is-active {
  background: #166534;
  border-color: #166534;
  color: #ffffff;
}

.rk-sync-units {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
  max-height: 108px;
  overflow-y: auto;
}

.rk-unit-pill {
  min-height: 29px;
  padding: 3px 10px;
  border-radius: 9px;
  border: 1px solid rgba(34, 25, 22, 0.14);
  background: #ffffff;
  color: #2c2420;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.rk-unit-pill.is-active {
  background: #dcfce7;
  border-color: #166534;
  color: #14532d;
}

.rk-sync-extra {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed rgba(22, 101, 52, 0.14);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rk-sync-extra label {
  font-size: 12px;
  font-weight: 600;
  color: #4b5e52;
}

.rk-sync-mini-in {
  flex: 1;
  min-width: 130px;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(22, 101, 52, 0.22);
  font-size: 12.5px;
  background: #ffffff;
}

/* 产品 A & C 快捷四线三格注音开关条 */
.rk-pinyin-quick-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(22, 101, 52, 0.24);
  background: #eef8f2;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.rk-pinyin-quick-toggle.is-off {
  background: #f4f4f5;
  border-color: rgba(0,0,0,0.14);
  color: #52525b;
}

/* 产品 D（分年级易错笔顺特训）顶部学段年级快选条 */
.rk-trap-grade-bar {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 4px 0 8px;
  margin-bottom: 4px;
}

.rk-trap-gpill {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(196, 32, 52, 0.22);
  background: #fff7f8;
  color: #7f1d1d;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.rk-trap-gpill.is-active {
  background: #c42034;
  border-color: #c42034;
  color: #ffffff;
}

/* 通用底部弹窗 */
.rw-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(18, 14, 12, 0.56);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.rw-modal-backdrop[hidden] { display: none !important; }

.rw-modal-sheet {
  width: 100%;
  max-width: 540px;
  max-height: 86vh;
  overflow-y: auto;
  background: #fffdf9;
  border-radius: 22px 22px 0 0;
  padding: 18px 18px 26px;
  color: #231916;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.2);
}

.rw-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.rw-modal-title { margin: 0; font-size: 17px; font-weight: 700; }

.rw-modal-close {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: none;
  background: #f2ebe0;
  color: #231916;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.rw-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.rw-field-label {
  width: 92px;
  flex-shrink: 0;
  font-size: 13.5px;
  color: #5c4f47;
}

.rw-field-input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(42, 28, 20, 0.22);
  font-size: 14px;
  background: #ffffff;
  color: #231916;
}

.rw-export-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rw-export-big-btn {
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 14px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.rw-export-pdf { background: #15803d; color: #ffffff; }
.rw-export-png { background: #f2ebe0; color: #231916; }
.rw-export-tip { margin: 10px 0 0; font-size: 12.5px; line-height: 1.55; color: #65574e; }

@media (max-width: 580px) {
  .redink-web-bar { padding: 0 8px; gap: 4px; }
  .rw-bar-left, .rw-bar-nav, .rw-bar-right { gap: 4px; }
  .rw-hide-xs { display: none; }
  .rw-bar-home, .rw-nav-tab, .rw-bar-btn {
    min-height: 30px;
    padding: 0 7px;
    font-size: 12px;
  }
  .rw-single-brand { font-size: 13px; }
}

#redink-vector-print-root { display: none; }

@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 210mm !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    background: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body > *:not(#redink-vector-print-root) { display: none !important; }
  #redink-vector-print-root {
    display: block !important;
    width: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }
  .redink-print-sheet {
    width: 210mm;
    height: 296.6mm;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #ffffff;
    page-break-after: always;
    break-after: page;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .redink-print-sheet:last-child {
    page-break-after: auto;
    break-after: auto;
  }
  .redink-print-sheet svg {
    display: block;
    width: 100%;
    height: 100%;
  }
}
