/*!
 * 练习纸系列公共样式（配合 tianzige.css 的 tz-* 布局类一起使用）
 * 覆盖：Canvas 纸张、DOM 题卡列表、闪卡翻转、听写播放器
 */

/* ---------------- Canvas 纸张 ---------------- */
.sp-canvas-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sp-canvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    background: #fff;
    border-radius: 4px;
}

@media print {
    .sp-canvas-wrap { overflow: visible !important; }
    .sp-canvas { max-width: 100% !important; height: auto !important; border: 0 !important; }
}

/* ---------------- DOM 题卡 / 词表列表 ---------------- */
.wp-list { margin: 0; padding: 0; list-style: none; }

.wp-item {
    display: flex;
    gap: 10px;
    padding: 11px 6px;
    border-bottom: 1px dashed #e2e8f0;
    font-size: 15.5px;
    line-height: 1.95;
    color: #0f172a;
    break-inside: avoid;
    page-break-inside: avoid;
}

.wp-item .no {
    flex: 0 0 auto;
    min-width: 32px;
    font-weight: 800;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.wp-item .blank {
    display: inline-block;
    min-width: 64px;
    border-bottom: 1px solid #94a3b8;
    vertical-align: bottom;
}

.wp-answers {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 2px solid #cbd5e1;
}

.wp-answers h3 {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 800;
    color: #334155;
}

.wp-answers ol {
    margin: 0;
    padding-left: 26px;
    font-size: 14px;
    line-height: 2;
    color: #334155;
}

/* ---------------- 作文稿纸题目栏 ---------------- */
.cg-topic {
    margin: 14px 0 18px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: .35em;
}

.cg-topic-line {
    display: inline-block;
    width: 120px;
    margin: 0 14px;
    border-bottom: 1.5px solid #374151;
    vertical-align: middle;
}

@media print {
    .cg-topic { font-size: 11pt; margin: 8pt 0 10pt; }
    .cg-topic-line { width: 90pt; border-bottom-color: #000; }
}

/* ---------------- 罚抄生成器（行式描红） ---------------- */
.pu-line {
    text-align: center;
    font-size: 24px;
    line-height: 2.4;
    color: #0f172a;
    break-inside: avoid;
    page-break-inside: avoid;
}

.pu-ch {
    display: inline-block;
    width: 2.2em;
    text-align: center;
}

.pu-ch b {
    font-family: "KaiTi", "STKaiti", "楷体", "Kaiti SC", serif;
    font-weight: 400;
    color: #c0392b;
    opacity: var(--pu-opacity, .42);
}

.pu-ch.is-blank {
    border-bottom: 1px solid #94a3b8;
    height: 1.55em;
    vertical-align: bottom;
}

.pu-sign {
    margin-top: 26px;
    text-align: center;
    font-size: 13px;
    color: #64748b;
    letter-spacing: .06em;
}

.pu-sign i {
    display: inline-block;
    width: 90px;
    border-bottom: 1px solid #94a3b8;
    vertical-align: bottom;
    margin: 0 6px;
}

@media print {
    .pu-line { font-size: 15pt; }
    .pu-ch b { color: #c0392b; }
    .pu-sign { font-size: 10.5pt; }
    .pu-sign i { width: 70pt; border-color: #000; }
}

/* ---------------- 闪卡自测（翻转卡） ---------------- */
.fc-stage {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}

.fc-card {
    perspective: 900px;
    height: 190px;
    cursor: pointer;
}

.fc-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform .5s;
}

.fc-card.is-flipped .fc-inner { transform: rotateY(180deg); }

.fc-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    padding: 10px;
}

.fc-face--front .fc-word {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    word-break: break-all;
    text-align: center;
}

.fc-face--back { transform: rotateY(180deg); }

.fc-face--back .fc-mean {
    font-size: 15px;
    line-height: 1.8;
    color: #334155;
    text-align: center;
}

.fc-face .fc-hint {
    position: absolute;
    right: 10px;
    bottom: 8px;
    font-size: 11px;
    color: #cbd5e1;
}

/* ---------------- 听写播放器 ---------------- */
.dh-player {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.dh-cell {
    padding: 16px 10px;
    text-align: center;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: var(--c-surface-soft, #f7f9fc);
}

.dh-cell b {
    display: block;
    font-size: 22px;
    font-variant-numeric: tabular-nums;
    color: var(--c-text, #0f172a);
}

.dh-cell span {
    font-size: 12px;
    color: var(--c-text-muted, #94a3b8);
}

.dh-big {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 26px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: var(--c-surface-soft, #f7f9fc);
}

.dh-big .dh-word {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: .1em;
    color: var(--c-text, #0f172a);
}

.dh-big .dh-word.is-hidden { color: transparent; text-shadow: 0 0 14px rgba(15, 23, 42, .55); }

.dh-big .dh-tip { font-size: 13px; color: var(--c-text-muted, #94a3b8); }

.dh-ctrl {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.dh-ctrl .tz-btn--ghost.is-primary {
    color: #fff;
    background: var(--c-primary, #0066ff);
    border-color: var(--c-primary, #0066ff);
}

/* ---------------- 简笔画临摹 ---------------- */
.ds-canvas-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

/* ---------------- 夜间模式微调（纸张依旧白底黑字） ---------------- */
[data-theme="dark"] .fc-face,
[data-theme="dark"] .dh-cell,
[data-theme="dark"] .dh-big {
    background: rgba(255, 255, 255, .04);
    border-color: rgba(255, 255, 255, .12);
}

[data-theme="dark"] .fc-face--front .fc-word { color: var(--c-text, #e5e7eb); }
[data-theme="dark"] .fc-face--back .fc-mean { color: var(--c-text-sub, #9ca3af); }
[data-theme="dark"] .dh-big .dh-word { color: var(--c-text, #e5e7eb); }
