/* ==========================================================
   正面管教子栏目 · 独立样式
   只引用 style.css 的 :root 变量，不改动任何全站样式
   ========================================================== */
[hidden] { display: none !important; }

.pd-main {
    min-height: 62vh;
    background:
        radial-gradient(circle at 12% 4%, rgba(214, 232, 245, .38), transparent 38%),
        radial-gradient(circle at 88% 22%, rgba(245, 236, 215, .45), transparent 42%),
        var(--warm-cream);
}

/* ---------- 通用小件 ---------- */
.pd-eyebrow {
    display: inline-block;
    font-size: .74rem;
    letter-spacing: .16em;
    color: var(--soft-blue-dark);
    font-weight: 600;
    text-transform: uppercase;
}
.pd-back {
    border: 0;
    background: none;
    color: var(--text-secondary);
    font-size: .86rem;
    cursor: pointer;
    padding: 6px 0;
    font-family: var(--font-main);
    transition: color .2s, transform .2s;
}
.pd-back:hover { color: var(--soft-blue-dark); transform: translateX(-3px); }

/* ---------- 入口态 ---------- */
.pd-hero { text-align: center; padding: 74px 0 48px; }
.pd-hero h1 {
    font-size: clamp(2.1rem, 5vw, 3.4rem);
    line-height: 1.32;
    letter-spacing: .04em;
    font-weight: 600;
    color: var(--text-primary);
    margin: 18px 0 20px;
}
.pd-hero-sub {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 2;
    letter-spacing: .02em;
}
.pd-hero-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 30px;
    color: var(--accent-gold);
    font-size: .82rem;
    letter-spacing: .22em;
}
.pd-hero-line span { width: 46px; height: 1px; background: var(--accent-gold); opacity: .55; }

.pd-entry-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    max-width: 880px;
    margin: 0 auto 34px;
}
.pd-entry-card {
    position: relative;
    text-align: left;
    display: block;
    width: 100%;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 34px 32px 30px;
    cursor: pointer;
    font-family: var(--font-main);
    color: var(--text-primary);
    overflow: hidden;
    transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s, border-color .35s;
}
.pd-entry-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--soft-blue), var(--accent-gold));
    opacity: 0;
    transition: opacity .35s;
}
.pd-entry-card:hover,
.pd-entry-card:focus-visible {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--soft-blue-light);
    outline: none;
}
.pd-entry-card:hover::before { opacity: 1; }
.pd-entry-num {
    display: block;
    font-size: .72rem;
    letter-spacing: .14em;
    color: var(--text-muted);
    margin-bottom: 22px;
}
.pd-entry-icon { display: block; height: 52px; margin-bottom: 20px; position: relative; }
.pd-entry-icon--cards i {
    position: absolute;
    top: 4px;
    width: 32px;
    height: 44px;
    border: 1.5px solid var(--soft-blue);
    background: var(--soft-blue-lighter);
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
}
.pd-entry-icon--cards i:nth-child(1) { left: 0; transform: rotate(-16deg); }
.pd-entry-icon--cards i:nth-child(2) { left: 14px; transform: rotate(-5deg); background: var(--white); }
.pd-entry-icon--cards i:nth-child(3) { left: 28px; transform: rotate(8deg); background: var(--accent-gold-light); border-color: var(--accent-gold); }
.pd-entry-icon--chat i {
    position: absolute;
    left: 0; top: 2px;
    width: 48px; height: 38px;
    border: 1.5px solid var(--soft-blue);
    border-radius: 12px 12px 12px 4px;
    background: var(--soft-blue-lighter);
}
.pd-entry-icon--chat i::after {
    content: '';
    position: absolute;
    left: 14px; top: 17px;
    width: 20px; height: 2px;
    background: var(--soft-blue-dark);
    box-shadow: 0 7px 0 var(--soft-blue-dark);
    opacity: .65;
    border-radius: 2px;
}
.pd-entry-card h3 { font-size: 1.32rem; font-weight: 600; letter-spacing: .02em; margin-bottom: 12px; }
.pd-entry-card p { font-size: .92rem; color: var(--text-secondary); line-height: 1.9; margin-bottom: 24px; }
.pd-entry-go { font-size: .86rem; color: var(--soft-blue-dark); font-weight: 600; }
.pd-entry-go b { display: inline-block; margin-left: 6px; transition: transform .3s; }
.pd-entry-card:hover .pd-entry-go b { transform: translateX(6px); }
.pd-footnote { text-align: center; font-size: .78rem; color: var(--text-muted); padding-bottom: 66px; letter-spacing: .04em; }

/* ---------- 抽卡态 ---------- */
.pd-view--cards { padding: 42px 0 80px; }
.pd-subhead { margin-bottom: 30px; }
.pd-subhead .pd-eyebrow { display: block; margin-top: 14px; }
.pd-subhead h2 { font-size: 1.9rem; font-weight: 600; margin: 8px 0 10px; letter-spacing: .03em; }
.pd-subhead p { color: var(--text-secondary); font-size: .94rem; }

.pd-board-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.pd-board {
    position: relative;
    text-align: left;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 22px 20px;
    cursor: pointer;
    font-family: var(--font-main);
    color: var(--text-primary);
    transition: transform .3s, box-shadow .3s, border-color .3s;
    overflow: hidden;
}
.pd-board::after {
    content: '';
    position: absolute;
    right: -26px; bottom: -34px;
    width: 92px; height: 92px;
    border-radius: 50%;
    background: var(--pd-tint, var(--soft-blue-lighter));
    opacity: .55;
    transition: transform .4s;
}
.pd-board:hover, .pd-board:focus-visible {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--pd-accent, var(--soft-blue));
    outline: none;
}
.pd-board:hover::after { transform: scale(1.25); }
.pd-board-idx {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--pd-tint, var(--soft-blue-lighter));
    color: var(--pd-accent, var(--soft-blue-dark));
    font-size: .76rem;
    font-weight: 700;
    margin-bottom: 12px;
}
.pd-board-name { display: block; font-size: 1.02rem; font-weight: 600; margin-bottom: 6px; position: relative; z-index: 1; }
.pd-board-desc { display: block; font-size: .82rem; color: var(--text-secondary); line-height: 1.7; position: relative; z-index: 1; }
.pd-board-count { display: block; margin-top: 12px; font-size: .74rem; color: var(--text-muted); position: relative; z-index: 1; }

/* 卡堆 */
.pd-draw { margin-top: 48px; }
.pd-draw-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 34px; }
.pd-draw-head h3 { font-size: 1.35rem; font-weight: 600; margin-top: 6px; }
.pd-deck {
    position: relative;
    height: 54px;
    width: 240px;
    margin: 0 auto 22px;
}
.pd-deck span {
    position: absolute;
    left: 50%; top: 0;
    width: 118px; height: 50px;
    margin-left: -59px;
    border: 1px solid var(--soft-blue-light);
    border-radius: 8px;
    background: repeating-linear-gradient(135deg, var(--soft-blue-lighter) 0 8px, var(--white) 8px 16px);
    box-shadow: var(--shadow-sm);
    transition: transform .4s;
}
.pd-deck span:nth-child(1) { transform: rotate(-12deg) translateX(-14px); }
.pd-deck span:nth-child(2) { transform: rotate(-4deg) translateX(-5px); }
.pd-deck span:nth-child(3) { transform: rotate(5deg) translateX(6px); }
.pd-deck span:nth-child(4) { transform: rotate(13deg) translateX(15px); }
.pd-deck.is-shuffling span:nth-child(1) { transform: rotate(-19deg) translateX(-22px); }
.pd-deck.is-shuffling span:nth-child(4) { transform: rotate(20deg) translateX(23px); }

/* 闪卡 */
.pd-stage { perspective: 1400px; display: flex; justify-content: center; }
.pd-flashcard {
    width: min(100%, 380px);
    height: 468px;
    cursor: pointer;
    outline: none;
    position: relative;
}
.pd-flashcard::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 22px;
    border: 1px solid var(--accent-gold);
    opacity: 0;
    pointer-events: none;
    transition: opacity .7s;
    box-shadow: 0 0 34px rgba(201,169,110,.28);
}
.pd-flashcard.is-flipped::after { opacity: .6; }
.pd-flashcard-inner {
    position: relative;
    width: 100%; height: 100%;
    transform-style: preserve-3d;
    transition: transform .85s cubic-bezier(.2,.75,.25,1);
}
.pd-flashcard.is-flipped .pd-flashcard-inner { transform: rotateY(180deg); }
.pd-flashcard.is-dealing { animation: pd-deal .62s cubic-bezier(.2,.8,.25,1) both; }
@keyframes pd-deal {
    0%   { transform: translateY(66px) scale(.78) rotate(-7deg); opacity: 0; }
    60%  { transform: translateY(-8px) scale(1.03) rotate(2deg); opacity: 1; }
    100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}
.pd-face {
    position: absolute;
    inset: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}
.pd-face--back {
    background:
        radial-gradient(circle at 50% 38%, rgba(255,255,255,.5), transparent 58%),
        linear-gradient(155deg, var(--soft-blue-lighter), var(--soft-blue-light));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    border-color: var(--soft-blue-light);
}
.pd-face--back::before {
    content: '';
    position: absolute;
    inset: 14px;
    border: 1px solid rgba(123,167,201,.42);
    border-radius: 12px;
}
.pd-face--back::after {
    content: '';
    position: absolute;
    top: -60%; left: -70%;
    width: 60%; height: 230%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent);
    transform: rotate(22deg);
    animation: pd-sheen 4.5s ease-in-out infinite;
}
@keyframes pd-sheen { 0%,68% { left: -70%; } 100% { left: 140%; } }
.pd-card-mark { font-size: .76rem; letter-spacing: .3em; color: var(--soft-blue-dark); z-index: 1; }
.pd-card-monogram {
    width: 108px; height: 108px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--soft-blue);
    border-radius: 50%;
    font-size: 3.2rem;
    font-weight: 300;
    color: var(--soft-blue-dark);
    background: rgba(255,255,255,.55);
    z-index: 1;
}
.pd-card-back-hint { font-size: .8rem; color: var(--text-secondary); letter-spacing: .08em; z-index: 1; }
.pd-face--front {
    transform: rotateY(180deg);
    background: var(--white);
    padding: 30px 28px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.pd-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.pd-card-board {
    font-size: .72rem;
    color: var(--pd-accent, var(--soft-blue-dark));
    background: var(--pd-tint, var(--soft-blue-lighter));
    padding: 5px 12px;
    border-radius: 20px;
    letter-spacing: .04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 72%;
}
.pd-card-no { font-size: .72rem; color: var(--text-muted); letter-spacing: .1em; }
.pd-card-title { font-size: 1.46rem; font-weight: 600; line-height: 1.4; margin-bottom: 16px; letter-spacing: .02em; }
.pd-card-one { font-size: .94rem; color: var(--text-secondary); line-height: 1.9; margin-bottom: 22px; }
.pd-card-quote {
    margin-top: auto;
    border-left: 2px solid var(--accent-gold);
    background: var(--warm-cream);
    padding: 14px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: .9rem;
    line-height: 1.85;
    color: var(--text-primary);
}
.pd-card-how {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
    font-size: .86rem;
    color: var(--text-secondary);
    line-height: 1.9;
    animation: pd-fade .4s ease both;
}
@keyframes pd-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.pd-draw-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.pd-btn {
    font-family: var(--font-main);
    font-size: .88rem;
    padding: 11px 26px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .25s;
}
.pd-btn:hover:not(:disabled) { border-color: var(--soft-blue); color: var(--soft-blue-dark); transform: translateY(-2px); }
.pd-btn:disabled { opacity: .42; cursor: not-allowed; }
.pd-btn--primary {
    background: var(--soft-blue-dark);
    border-color: var(--soft-blue-dark);
    color: var(--white);
    font-weight: 600;
    box-shadow: 0 3px 14px rgba(90,138,170,.28);
}
.pd-btn--primary:hover { background: #4A7A9A; color: var(--white); }
.pd-draw-progress { text-align: center; margin-top: 18px; font-size: .8rem; color: var(--text-muted); min-height: 1.4em; }

/* ---------- 伴学小助手 ---------- */
.pd-chat-mask {
    position: fixed; inset: 0;
    background: rgba(61,50,40,.34);
    backdrop-filter: blur(2px);
    z-index: 190;
    animation: pd-fade .3s ease both;
}
.pd-chat {
    position: fixed;
    top: 0; right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: var(--warm-cream);
    z-index: 200;
    display: flex;
    flex-direction: column;
    box-shadow: -12px 0 40px rgba(61,50,40,.16);
    transform: translateX(102%);
    transition: transform .42s cubic-bezier(.2,.8,.2,1);
}
.pd-chat.is-open { transform: translateX(0); }
.pd-chat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}
.pd-chat-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--soft-blue-lighter);
    color: var(--soft-blue-dark);
    font-size: 1.05rem;
    font-weight: 600;
    border: 1px solid var(--soft-blue-light);
}
.pd-chat-who { flex: 1; line-height: 1.4; }
.pd-chat-who strong { display: block; font-size: .96rem; font-weight: 600; }
.pd-chat-who span { font-size: .74rem; color: var(--text-muted); }
.pd-chat-who i {
    display: inline-block;
    width: 6px; height: 6px;
    background: #7BAE86;
    border-radius: 50%;
    margin-right: 3px;
}
.pd-chat-close {
    border: 0; background: none;
    font-size: 1.6rem; line-height: 1;
    color: var(--text-muted);
    cursor: pointer; padding: 4px 8px;
    transition: color .2s;
}
.pd-chat-close:hover { color: var(--text-primary); }

.pd-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}
.pd-msg { display: flex; gap: 9px; max-width: 100%; animation: pd-fade .3s ease both; }
.pd-msg--user { flex-direction: row-reverse; }
.pd-msg-avatar {
    flex: 0 0 28px;
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .74rem;
    background: var(--soft-blue-lighter);
    color: var(--soft-blue-dark);
    border: 1px solid var(--soft-blue-light);
}
.pd-msg--user .pd-msg-avatar { background: var(--warm-cream-dark); color: var(--text-secondary); border-color: var(--border); }
.pd-bubble {
    max-width: 84%;
    padding: 12px 15px;
    border-radius: 14px 14px 14px 4px;
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    font-size: .9rem;
    line-height: 1.85;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
}
.pd-msg--user .pd-bubble {
    background: var(--soft-blue-light);
    border-color: var(--soft-blue-light);
    border-radius: 14px 14px 4px 14px;
}
.pd-bubble.is-typing::after {
    content: '▍';
    color: var(--soft-blue-dark);
    animation: pd-blink .8s steps(1) infinite;
}
@keyframes pd-blink { 50% { opacity: 0; } }

.pd-chat-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 18px 12px;
}
.pd-chip {
    font-family: var(--font-main);
    font-size: .78rem;
    padding: 7px 13px;
    border-radius: 18px;
    border: 1px solid var(--soft-blue-light);
    background: var(--white);
    color: var(--soft-blue-dark);
    cursor: pointer;
    transition: all .2s;
}
.pd-chip:hover { background: var(--soft-blue-lighter); transform: translateY(-1px); }
.pd-chat-foot { background: var(--white); border-top: 1px solid var(--border); padding: 10px 16px 14px; }
.pd-chat-status { min-height: 18px; font-size: .76rem; color: var(--danger); padding: 0 2px 6px; }
.pd-chat-status.is-info { color: var(--soft-blue-dark); }
.pd-chat-input { display: flex; align-items: flex-end; gap: 8px; }
.pd-chat-input textarea {
    flex: 1;
    resize: none;
    font-family: var(--font-main);
    font-size: .9rem;
    line-height: 1.6;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    max-height: 120px;
    background: var(--warm-cream);
    outline: none;
    transition: border-color .2s;
}
.pd-chat-input textarea:focus { border-color: var(--soft-blue); }
.pd-voice-btn, .pd-send-btn {
    flex: 0 0 auto;
    height: 40px;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    cursor: pointer;
    transition: all .2s;
}
.pd-voice-btn {
    width: 40px;
    border: 1px solid var(--border);
    background: var(--white);
    font-size: 1.05rem;
}
.pd-voice-btn:hover { border-color: var(--soft-blue); }
.pd-voice-btn.is-recording {
    background: var(--danger-light);
    border-color: var(--danger);
    animation: pd-pulse 1.1s ease-in-out infinite;
}
@keyframes pd-pulse { 50% { box-shadow: 0 0 0 7px rgba(201,110,110,.16); } }
.pd-send-btn {
    padding: 0 18px;
    border: 0;
    background: var(--soft-blue-dark);
    color: var(--white);
    font-size: .86rem;
    font-weight: 600;
}
.pd-send-btn:hover:not(:disabled) { background: #4A7A9A; }
.pd-send-btn:disabled { opacity: .5; cursor: not-allowed; }
.pd-chat-tip { margin: 9px 2px 0; font-size: .7rem; color: var(--text-muted); text-align: center; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .pd-board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pd-hero { padding: 52px 0 36px; }
}
@media (max-width: 620px) {
    .pd-entry-grid { grid-template-columns: 1fr; gap: 16px; }
    .pd-entry-card { padding: 28px 24px; }
    .pd-board-grid { grid-template-columns: 1fr; gap: 12px; }
    .pd-board { padding: 18px; }
    .pd-flashcard { height: 420px; }
    .pd-face--front { padding: 24px 20px; }
    .pd-card-title { font-size: 1.26rem; }
    .pd-chat { width: 100vw; }
    .pd-draw { margin-top: 34px; }
    .pd-footnote { padding-bottom: 44px; font-size: .72rem; }
}

/* ---------- 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
    .pd-flashcard-inner { transition: none; }
    .pd-flashcard.is-dealing { animation: none; }
    .pd-face--back::after { animation: none; display: none; }
    .pd-chat { transition: none; }
    .pd-entry-card, .pd-board, .pd-btn, .pd-chip { transition: none; }
    * { scroll-behavior: auto !important; }
}
