/* ──────────────────────────────────────────────────────────────────────────
   course_detail.php — คำอธิบายรายวิชา
   โรงเรียนเทศบาล ๑ กิตติขจร

   รอบ 24 ก.ย. 2569: ภาษาภาพเดียวกับ /zerodropout/ และหน้าโครงสร้างหลักสูตร (course_st.php)
       หัวหน้าน้ำเงินไล่เฉดเต็มจอ รหัสวิชาจาง ๆ เป็นลายน้ำ การ์ดกระจก "รหัสวิชาบอกอะไร" + ความสอดคล้องของข้อมูล
       แถบตัวเลข แล้วแผงลอยทับขอบล่าง: คำอธิบาย ผลการเรียนรู้ รหัสตัวชี้วัด (ซ้าย)
       ครูผู้สอน แผนการเรียน รายวิชาในหมวดเดียวกัน (ขวา)

   ★ โทเคนของหน้าทุกตัวเป็น alias ที่ชี้ไป --tb1-* โหมดมืดจึงพลิกให้เอง
   ★ หน้านี้แนบ css/tb1-display-scale.css (ผ่าน nvabar) โหมดคอนทราสต์สูงพื้นฐานมาจากไฟล์นั้น
   ★ ธีมกลางบังคับ font-family บน span div li p a ด้วย !important ตัวเซริฟจึงอยู่ที่ h1–h3 และ b
   ★ ไม่มี opacity:0 เป็นสถานะพัก ที่ขยับได้มีแค่ตำแหน่ง (สคริปต์ติด crd-motion ก่อนเท่านั้น)
   ★ ห้ามใช้ <footer> ในหน้า (ไฟล์กลางทาพื้นดำให้ footer ทุกตัว)
   ★ ทุก selector ขึ้นต้นด้วย crd- (css/tb1-curriculum.css เดิมใช้ร่วมกับหน้าอื่น หน้านี้ไม่โหลดแล้ว)
   ────────────────────────────────────────────────────────────────────────── */

body.crd-page {
    margin: 0;
    background: var(--tb1-page, #f8fafc);
    color: var(--tb1-ink-2, #334155);
}

html:has(body.crd-page) {
    scroll-padding-top: 5rem;
}

/* ★ ลิงก์ข้ามไปเนื้อหาซ่อนด้วย clip ไม่ใช่ left:-9999px ซึ่งไปโดนตัวตรวจล้นแนวนอน */
body.crd-page a.crd-skip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10000;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

body.crd-page a.crd-skip:focus {
    width: auto;
    height: auto;
    padding: 10px 18px;
    clip-path: none;
    color: #ffffff;
    background: var(--tb1-banner-1, #1d4ed8);
    border-radius: 0 0 10px 0;
    font-weight: 600;
    text-decoration: none;
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

main.crd {
    display: block;
}

main.crd:focus {
    outline: none;
}

/* ── โทเคนของหน้า ─────────────────────────────────────────────────────── */
.crd {
    --crd-paper: var(--tb1-surface, #ffffff);
    --crd-paper-alt: var(--tb1-surface-alt, #f1f5f9);
    --crd-ink: var(--tb1-ink-1, #0f172a);
    --crd-ink-2: var(--tb1-ink-2, #334155);
    --crd-muted: var(--tb1-ink-3, #5a697f);
    --crd-line: var(--tb1-border, #e2e8f0);
    --crd-line-bold: var(--tb1-border-bold, #cbd5e1);
    --crd-field-line: color-mix(in srgb, var(--tb1-ink-3, #5a697f) 85%, var(--tb1-surface, #ffffff));
    --crd-brand: var(--tb1-brand, #1d4ed8);
    --crd-brand-soft: color-mix(in srgb, var(--tb1-brand, #1d4ed8) 10%, var(--tb1-surface, #ffffff));
    --crd-brand-line: color-mix(in srgb, var(--tb1-brand, #1d4ed8) 35%, var(--tb1-border, #e2e8f0));
    --crd-on-brand: var(--tb1-on-brand, #ffffff);
    /* ★ text-danger ของโหมดสว่าง (#dc2626) บนพื้นแดงอ่อนได้ 4.2:1 ไม่ผ่าน AA จึงใช้เฉดเข้มกว่า */
    --crd-err: #b91c1c;
    --crd-err-soft: color-mix(in srgb, #dc2626 8%, var(--tb1-surface, #ffffff));
    --crd-err-line: color-mix(in srgb, #dc2626 35%, var(--tb1-border, #e2e8f0));
    --crd-ok: var(--tb1-text-success, #047857);
    --crd-ok-soft: color-mix(in srgb, #10b981 11%, var(--tb1-surface, #ffffff));
    --crd-ok-line: color-mix(in srgb, #10b981 40%, var(--tb1-border, #e2e8f0));
    --crd-warn: #92400e;
    --crd-warn-soft: color-mix(in srgb, #f59e0b 13%, var(--tb1-surface, #ffffff));
    --crd-warn-line: color-mix(in srgb, #f59e0b 45%, var(--tb1-border, #e2e8f0));
    --crd-on-hero-2: #e0e7ff;
    --crd-gold-text: #fde68a;
    --crd-serif: var(--tb1-font-display, "Noto Serif Thai", serif);
    --crd-sans: var(--tb1-font-body, "Sarabun", system-ui, sans-serif);
    --crd-ease: cubic-bezier(.4, 0, .2, 1);
    --crd-spring: cubic-bezier(.22, 1, .36, 1);
    --crd-gap: clamp(16px, 2vw, 24px);
    --crd-gutter: var(--tb1-shell-gutter, 20px);
    --crd-shadow: 0 14px 32px -24px rgba(15, 23, 42, .55), inset 0 1px 0 rgba(255, 255, 255, .6);
    --crd-shadow-float: 0 30px 60px -34px rgba(15, 23, 42, .7), inset 0 1px 0 rgba(255, 255, 255, .6);
    --crd-hero-a: color-mix(in srgb, var(--tb1-banner-1, #1d4ed8) 60%, var(--tb1-ink-surface, #0f172a));
    --crd-hero-b: var(--tb1-banner-1, #1d4ed8);
    --crd-hero-c: color-mix(in srgb, var(--tb1-banner-1, #1d4ed8) 78%, var(--tb1-accent-strong, #0284c7));
    --crd-primary: var(--tb1-banner-1, #1d4ed8);
    --crd-primary-2: color-mix(in srgb, var(--tb1-banner-1, #1d4ed8) 70%, #020617);

    color: var(--crd-ink-2);
    font-family: var(--crd-sans);
    font-size: 1rem;
    line-height: 1.6;
}

:is(html.dark, html.dark-mode, html[data-theme="dark"],
    body.dark-mode, body[data-theme="dark"]) .crd {
    --crd-err: var(--tb1-text-danger, #fda4af);
    --crd-err-soft: color-mix(in srgb, #f87171 12%, var(--tb1-surface, #111c31));
    --crd-err-line: color-mix(in srgb, #f87171 40%, var(--tb1-border, #1e2d4a));
    --crd-ok-soft: color-mix(in srgb, #34d399 12%, var(--tb1-surface, #111c31));
    --crd-ok-line: color-mix(in srgb, #34d399 40%, var(--tb1-border, #1e2d4a));
    --crd-warn: var(--tb1-text-warning, #fbbf24);
    --crd-warn-soft: color-mix(in srgb, #f59e0b 13%, var(--tb1-surface, #111c31));
    --crd-warn-line: color-mix(in srgb, #f59e0b 42%, var(--tb1-border, #1e2d4a));
    --crd-brand-soft: color-mix(in srgb, var(--tb1-brand, #60a5fa) 16%, var(--tb1-surface, #111c31));
    --crd-field-line: color-mix(in srgb, var(--tb1-ink-3, #94a3b8) 70%, var(--tb1-surface, #111c31));
    --crd-shadow: 0 14px 32px -22px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .055);
    --crd-shadow-float: 0 30px 60px -30px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .06);
    /* โหมดมืด: banner เป็นกรมท่าเข้ม เติมน้ำเงินสดที่ปลายไล่เฉดให้หัวหน้ามีมิติ แบบเดียวกับหน้าแรก */
    --crd-hero-a: #050d22;
    --crd-hero-c: color-mix(in srgb, #1d4ed8 42%, var(--tb1-banner-1, #0e1f45));
    /* ปุ่มหลักบนแผงสีเข้ม: กรมท่าแทบกลืนกับพื้นแผง จึงใช้น้ำเงินสด (ตัวขาวได้ 5.2:1) */
    --crd-primary: #2563eb;
    --crd-primary-2: #1d4ed8;
    color-scheme: dark;
}

.crd *,
.crd *::before,
.crd *::after {
    box-sizing: border-box;
}

.crd :where(h1, h2, h3, h4, p, ul, ol, li, dl, dt, dd, figure, fieldset, legend) {
    margin: 0;
}

.crd :where(ul, ol) {
    list-style: none;
    padding: 0;
}

/* ธีมรวมตั้ง display ให้ element หลายชนิด [hidden] ต้องชนะเสมอ */
.crd [hidden] {
    display: none !important;
}

.crd .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.crd :focus-visible {
    outline: 3px solid var(--crd-brand);
    outline-offset: 2px;
}

.crd-icon {
    display: block;
    flex: none;
    width: 1.15em;
    height: 1.15em;
}

.crd-wrap {
    width: 100%;
    max-width: var(--tb1-page-max-width, 1440px);
    margin-inline: auto;
    padding-inline: var(--crd-gutter);
}

/* ── ปุ่ม ───────────────────────────────────────────────────────────────── */
.crd-acts {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.crd .crd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 2.75rem;
    padding: 0 1.2rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-size: .96rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s var(--crd-ease), border-color .2s var(--crd-ease), box-shadow .2s var(--crd-ease), color .2s var(--crd-ease);
}

.crd .crd-btn:active {
    transform: translateY(1px);
}

.crd .crd-btn-light {
    color: var(--tb1-banner-1, #1d4ed8);
    background: #ffffff;
    border-color: #ffffff;
    box-shadow: 0 12px 26px -16px rgba(2, 6, 23, .7);
}

.crd .crd-btn-light:hover {
    background: #eef2ff;
    border-color: #eef2ff;
}

/* ★ พื้นขาว .12 บนน้ำเงิน ตัวขาวยังเกิน 4.5:1 ชี้แล้วพื้นเข้มขึ้น (ถ้าสว่างขึ้นจะต่ำกว่า 4.5:1) */
.crd .crd-btn-glass {
    color: #ffffff;
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .45);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.crd .crd-btn-glass:hover {
    background: rgba(2, 6, 23, .2);
    border-color: #ffffff;
}

.crd .crd-link {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: var(--crd-brand);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}
/* ═══════════════════════════════════════════════════════════════════════
   หัวหน้า: น้ำเงินไล่เฉดเต็มจอ รหัสวิชาเป็นลายน้ำ
   ═══════════════════════════════════════════════════════════════════════ */

.crd-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding-block: clamp(26px, 3.4vw, 48px) clamp(92px, 8vw, 118px);
    color: #ffffff;
    /* ★ สีพื้นทึบอยู่ใต้ไล่เฉด ตัวตรวจคอนทราสต์อ่านค่านี้ และเป็นสีที่เห็นจริงตรงกลางหัวหน้า */
    background-color: var(--crd-hero-b);
    background-image: linear-gradient(135deg, var(--crd-hero-a) 0%, var(--crd-hero-b) 52%, var(--crd-hero-c) 100%);
}

.crd-hero.is-plain {
    padding-bottom: clamp(80px, 7vw, 100px);
}

.crd-hero::before,
.crd-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.crd-hero::before {
    background-image:
        radial-gradient(circle at 14% 22%, rgba(255, 255, 255, .09) 0%, transparent 42%),
        radial-gradient(circle at 58% 118%, rgba(56, 189, 248, .12) 0%, transparent 46%);
}

/* เส้นบรรทัดบางแบบใบคำอธิบายรายวิชา (ตกแต่ง) */
.crd-hero::after {
    background-image:
        linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: linear-gradient(180deg, #000000 30%, transparent);
    mask-image: linear-gradient(180deg, #000000 30%, transparent);
}

.crd-hero-fx {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.crd-orb {
    position: absolute;
    display: block;
    border-radius: 50%;
}

.crd-orb.is-a {
    top: -14rem;
    right: -10rem;
    width: 38rem;
    height: 38rem;
    background: radial-gradient(circle, rgba(96, 165, 250, .24) 0%, rgba(96, 165, 250, 0) 68%);
}

.crd-orb.is-b {
    bottom: -12rem;
    left: -10rem;
    width: 30rem;
    height: 30rem;
    background: radial-gradient(circle, rgba(56, 189, 248, .14) 0%, rgba(56, 189, 248, 0) 68%);
}

:is(html.dark, html.dark-mode, html[data-theme="dark"], body.dark-mode) .crd-orb.is-a {
    background: radial-gradient(circle, rgba(59, 130, 246, .32) 0%, rgba(59, 130, 246, 0) 68%);
}

/* รหัสวิชาเป็นลายน้ำ: ตัวกลวง (ขอบขาวจาง) ไม่ใช่ข้อความที่ต้องอ่าน จึงอยู่ใน aria-hidden */
.crd-watermark {
    position: absolute;
    right: clamp(-2rem, 2vw, 3rem);
    bottom: clamp(3.5rem, 6vw, 5.5rem);
    font-family: var(--crd-serif);
    font-size: clamp(5.5rem, 3rem + 9vw, 12rem);
    font-weight: 700;
    line-height: .8;
    letter-spacing: -.02em;
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(255, 255, 255, .13);
    white-space: nowrap;
    user-select: none;
}

.crd-hero :focus-visible {
    outline-color: #ffffff;
}

.crd-hero-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 26px clamp(28px, 3.6vw, 60px);
}

@media (min-width: 1024px) {
    .crd-hero-top {
        grid-template-columns: minmax(0, 1fr) minmax(21rem, 27rem);
    }
}

.crd-hero-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.crd-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.crd-tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 3px 14px;
    font-size: .86rem;
    font-weight: 500;
    line-height: 1.4;
    color: #ffffff;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/* ★ ตัวทองบนกระจกขาวได้แค่ 4.3:1 ในโหมดสว่าง ป้ายเตือนจึงเป็นกระจกเข้ม (เกิน 6:1) */
.crd-tag.is-warn {
    font-weight: 600;
    color: var(--crd-gold-text);
    background: rgba(2, 6, 23, .26);
    border-color: rgba(253, 230, 138, .45);
}

.crd-title {
    font-family: var(--crd-serif);
    font-size: clamp(2.1rem, 1.2rem + 3vw, 3.5rem);
    font-weight: 600;
    line-height: 1.15;
    color: #ffffff;
    text-wrap: balance;
    text-shadow: 0 2px 20px rgba(2, 6, 23, .3);
}

.crd-title-y {
    display: block;
    margin-top: 6px;
    font-size: .5em;
    font-weight: 500;
    color: #dbeafe;
}

.crd-lead {
    max-width: 42rem;
    margin-top: 12px;
    font-size: clamp(1rem, .95rem + .3vw, 1.12rem);
    line-height: 1.7;
    color: var(--crd-on-hero-2);
}

.crd-hero-main .crd-acts {
    margin-top: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════
   การ์ดกระจกขวา: รหัสวิชาบอกอะไร และความสอดคล้องของข้อมูล
   ═══════════════════════════════════════════════════════════════════════ */

.crd-glance {
    display: grid;
    gap: 14px;
    min-width: 0;
    padding: 18px;
    color: #ffffff;
    background: rgba(2, 6, 23, .3);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 24px;
    box-shadow: 0 30px 60px -32px rgba(2, 6, 23, .85), inset 0 1px 0 rgba(255, 255, 255, .14);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.crd-glance-sec + .crd-glance-sec {
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, .16);
}

.crd-glance-k {
    margin-bottom: 10px;
    font-family: var(--crd-serif);
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.4;
    color: #ffffff;
}

/* ── breadcrumb: ลิงก์กระจกเล็กเหนือป้าย ──────────────────────────────── */
.crd-crumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 4px;
    margin-bottom: 14px;
    font-size: .86rem;
    line-height: 1.4;
    color: var(--crd-on-hero-2);
}

.crd-crumbs li {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.crd-crumbs .crd-icon {
    width: .9rem;
    height: .9rem;
    color: #bfdbfe;
}

.crd .crd-crumbs a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 4px;
    color: #ffffff;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, .45);
    text-underline-offset: 3px;
    border-radius: 6px;
}

.crd .crd-crumbs a:hover {
    text-decoration-color: #ffffff;
}

.crd-crumbs [aria-current] span {
    padding: 0 4px;
    font-weight: 600;
    color: #ffffff;
}

/* ── รหัสวิชาบอกอะไร: แผ่นอักษรหนึ่งแผ่นต่อหนึ่งส่วนของรหัส ─────────────── */
.crd-glance-k {
    display: flex;
    align-items: center;
    gap: 8px;
}

.crd-glance-k .crd-icon {
    width: 1.05rem;
    height: 1.05rem;
    color: #bfdbfe;
}

.crd-code {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.35fr);
    gap: 6px;
}

.crd-code-p {
    display: grid;
    align-content: start;
    justify-items: center;
    gap: 6px;
    min-width: 0;
    padding: 10px 4px 10px;
    text-align: center;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 14px;
}

.crd-code-p b {
    display: grid;
    place-items: center;
    width: 100%;
    /* ★ สูงกว่ากล่องตัวอักษรของ Noto Serif Thai (ราว 1.43 เท่าของขนาดตัว) ตัวอักษรจึงอยู่บนแผ่นขาวทั้งตัว */
    min-height: 3.1rem;
    font-family: var(--crd-serif);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: #1e3a8a;
    background: linear-gradient(160deg, #ffffff 0%, #dbeafe 100%);
    border-radius: 10px;
    box-shadow: 0 12px 24px -16px rgba(2, 6, 23, .9);
    font-variant-numeric: tabular-nums;
}

.crd-code-p span {
    font-size: .72rem;
    line-height: 1.35;
    color: var(--crd-on-hero-2);
    overflow-wrap: anywhere;
}

.crd-code-plain b {
    display: inline-block;
    padding: 6px 16px;
    font-family: var(--crd-serif);
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e3a8a;
    background: linear-gradient(160deg, #ffffff 0%, #dbeafe 100%);
    border-radius: 12px;
}

.crd-glance-s {
    margin-top: 10px;
    font-size: .8rem;
    line-height: 1.55;
    color: var(--crd-on-hero-2);
}

/* ── ความสอดคล้อง: ถูก = ติ๊กเขียว ไม่ตรง = สามเหลี่ยมทอง พร้อมข้อความอธิบายเสมอ ── */
.crd-checks {
    display: grid;
    gap: 6px;
}

.crd-checks li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 9px;
    padding: 8px 12px 8px 10px;
    font-size: .86rem;
    line-height: 1.5;
    color: #ffffff;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 12px;
}

.crd-checks .crd-icon {
    margin-top: .1em;
}

.crd-checks .is-ok .crd-icon {
    color: #86efac;
}

/* ★ ตัวทองอยู่บนพื้นกระจกเข้มเท่านั้น */
.crd-checks .is-bad {
    color: var(--crd-gold-text);
    background: rgba(2, 6, 23, .3);
    border-color: rgba(253, 230, 138, .45);
}

.crd-checks .is-bad .crd-icon {
    color: var(--crd-gold-text);
}

/* ═══════════════════════════════════════════════════════════════════════
   แถบตัวเลข: กระจกเข้มแถวเดียว (แบบเดียวกับหน้าโครงสร้างหลักสูตร)
   ═══════════════════════════════════════════════════════════════════════ */

.crd-band {
    margin-top: clamp(24px, 2.6vw, 34px);
}

.crd-stats {
    display: grid;
    grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr));
    overflow: hidden;
    background: rgba(2, 6, 23, .28);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 22px;
    box-shadow: 0 30px 60px -34px rgba(2, 6, 23, .85), inset 0 1px 0 rgba(255, 255, 255, .12);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

/* เส้นคั่นเป็นเงานอกด้านซ้ายและบนของทุกช่อง ขอบแถบตัดส่วนที่ล้นทิ้ง เหลือเฉพาะเส้นระหว่างช่อง */
.crd-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
    padding: 16px clamp(14px, 1.4vw, 22px) 18px;
    box-shadow: -1px 0 0 0 rgba(255, 255, 255, .16), 0 -1px 0 0 rgba(255, 255, 255, .16);
}

.crd-stat-ic {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 4px;
    color: #1d4ed8;
    background: linear-gradient(150deg, #ffffff 0%, #dbeafe 100%);
    border-radius: 13px;
    box-shadow: 0 14px 26px -16px rgba(2, 6, 23, .9);
}

.crd-stat.is-warn .crd-stat-ic {
    color: #92400e;
    background: linear-gradient(150deg, #ffffff 0%, #fef3c7 100%);
}

.crd-stat-k {
    font-size: .86rem;
    line-height: 1.4;
    color: var(--crd-on-hero-2);
}

.crd-stat-v {
    font-size: .92rem;
    line-height: 1.25;
    color: var(--crd-on-hero-2);
}

.crd-stat-v b {
    font-family: var(--crd-serif);
    font-size: clamp(1.6rem, 1.15rem + 1.1vw, 2.15rem);
    font-weight: 600;
    line-height: 1.15;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}

/* ตัวเลขที่ต้องจัดการ: ทองบนกระจกเข้ม (ตัวทองอยู่บนพื้นเข้มเท่านั้น) */
.crd-stat.is-warn .crd-stat-v b {
    color: var(--crd-gold-text);
}

.crd-stat-s {
    font-size: .78rem;
    line-height: 1.45;
    color: var(--crd-on-hero-2);
}

/* ═══════════════════════════════════════════════════════════════════════
   ส่วนเนื้อหา: สองคอลัมน์บนจอกว้าง แผงแรกลอยทับขอบล่างของหัวหน้า
   ═══════════════════════════════════════════════════════════════════════ */

.crd-body {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: var(--crd-gap);
    margin-top: -68px;
    padding-bottom: clamp(40px, 5vw, 72px);
}

@media (min-width: 1100px) {
    .crd-body:not(.is-single) {
        grid-template-columns: minmax(0, 1.75fr) minmax(20rem, 1fr);
    }

    .crd-body > .crd-foot {
        grid-column: 1 / -1;
    }
}

.crd-main,
.crd-side {
    display: grid;
    gap: var(--crd-gap);
    min-width: 0;
}

.crd-panel {
    min-width: 0;
    background: var(--crd-paper);
    border: 1px solid var(--crd-line);
    border-radius: 22px;
    box-shadow: var(--crd-shadow-float);
    scroll-margin-top: 5.5rem;
}

.crd-panel:focus {
    outline: none;
}

.crd-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--crd-line);
    border-radius: 22px 22px 0 0;
    background: linear-gradient(180deg, var(--crd-brand-soft) 0%, var(--crd-paper) 100%);
}

.crd-panel-ic {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.6rem;
    height: 2.6rem;
    color: #ffffff;
    background: linear-gradient(145deg, var(--crd-hero-c) 0%, var(--crd-hero-b) 100%);
    border-radius: 14px;
    box-shadow: 0 12px 22px -14px rgba(15, 23, 42, .8);
}

.crd-panel-title {
    flex: 1 1 14rem;
    min-width: 0;
    font-family: var(--crd-serif);
    font-size: 1.18rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--crd-ink);
}

.crd-panel-sub {
    display: block;
    margin-top: 1px;
    font-size: .84rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--crd-muted);
}

.crd-panel-body {
    padding: 18px 20px 22px;
}

.crd-panel-note {
    margin-top: 14px;
    font-size: .86rem;
    line-height: 1.7;
    color: var(--crd-muted);
}

.crd-empty {
    padding: 16px;
    font-size: .92rem;
    line-height: 1.7;
    color: var(--crd-muted);
    background: var(--crd-paper-alt);
    border: 1px dashed var(--crd-line-bold);
    border-radius: 14px;
}

/* ── ประกาศ ─────────────────────────────────────────────────────────────── */
.crd-note {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    color: var(--crd-ink-2);
    background: var(--crd-paper);
    border: 1px solid var(--crd-line);
    border-radius: 18px;
    box-shadow: var(--crd-shadow-float), inset 5px 0 0 var(--crd-note-bar, var(--crd-brand));
}

.crd-note.is-warn {
    --crd-note-bar: #d97706;
    background: var(--crd-warn-soft);
    border-color: var(--crd-warn-line);
}

.crd-note-ic {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.4rem;
    height: 2.4rem;
    color: #ffffff;
    background: var(--crd-primary);
    border-radius: 50%;
}

.crd-note.is-warn .crd-note-ic {
    color: #422006;
    background: #fbbf24;
}

.crd-note p {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding-top: 2px;
}

.crd-note b {
    font-family: var(--crd-serif);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--crd-ink);
}

.crd-note span {
    font-size: .93rem;
    line-height: 1.65;
}

/* แจ้งเตือนในแผง: กระดาษปกติ สันซ้ายสีเตือน (พื้นสีเต็มใบทำให้ลิงก์ข้างในตกเกณฑ์) */
.crd-flag,
.crd-mismatch {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    font-size: .9rem;
    line-height: 1.6;
    color: var(--crd-ink-2);
    background: var(--crd-paper);
    border: 1px solid var(--crd-warn-line);
    border-radius: 12px;
    box-shadow: inset 4px 0 0 #d97706;
}

.crd-mismatch {
    margin-top: 14px;
}

.crd-flag .crd-icon,
.crd-mismatch .crd-icon {
    margin-top: .2em;
    color: var(--crd-warn);
}

/* ═══════════════════════════════════════════════════════════════════════
   คำอธิบายรายวิชา
   ═══════════════════════════════════════════════════════════════════════ */

.crd-prose {
    max-width: 46rem;
    font-size: 1.02rem;
    line-height: 1.95;
    color: var(--crd-ink-2);
}

.crd-prose p + p,
.crd-prose p + ol,
.crd-prose p + ul,
.crd-prose ol + p,
.crd-prose ul + p {
    margin-top: .85em;
}

/* ย่อหน้าแรกคือสาระของวิชา: ตัวใหญ่ขึ้นเล็กน้อยให้อ่านเป็นบทนำ */
.crd-prose > p:first-child {
    font-size: 1.06rem;
    color: var(--crd-ink);
}

.crd-prose :is(strong, b) {
    font-weight: 700;
    color: var(--crd-ink);
}

.crd-prose ol,
.crd-prose ul {
    padding-left: 1.6rem;
}

.crd-prose ol {
    list-style: decimal;
}

.crd-prose ul {
    list-style: disc;
}

.crd-prose li + li {
    margin-top: .3em;
}

/* ── ผลการเรียนรู้: การ์ดเลขข้อ ─────────────────────────────────────────── */
.crd-oc {
    display: grid;
    gap: 8px;
    counter-reset: none;
}

.crd-oc li {
    display: grid;
    grid-template-columns: 2.4rem minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    padding: 12px 16px 12px 12px;
    background: var(--crd-paper);
    border: 1px solid var(--crd-line);
    border-radius: 14px;
    transition: border-color .2s var(--crd-ease), background-color .2s var(--crd-ease);
}

.crd-oc li:hover {
    background: var(--crd-brand-soft);
    border-color: var(--crd-brand-line);
}

.crd-oc-n {
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    font-family: var(--crd-serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(145deg, var(--crd-hero-c) 0%, var(--crd-hero-b) 100%);
    border-radius: 12px;
}

.crd-oc-t {
    padding-top: .3rem;
    font-size: .98rem;
    line-height: 1.7;
    color: var(--crd-ink);
}

/* ── รหัสตัวชี้วัด: มาตรฐานหนึ่งแถว ตัวชี้วัดเป็นชิป ───────────────────── */
.crd-ind-groups {
    display: grid;
    gap: 18px;
}

@media (min-width: 760px) {
    .crd-ind-groups {
        grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    }
}

.crd-ind-h {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
    font-family: var(--crd-serif);
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--crd-ink);
}

.crd-ind-h span {
    font-family: var(--crd-sans);
    font-size: .82rem;
    font-weight: 500;
    color: var(--crd-muted);
}

.crd-ind {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--crd-line);
    border-radius: 14px;
}

.crd-ind-row {
    display: grid;
    grid-template-columns: 4.6rem minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
}

.crd-ind-row + .crd-ind-row {
    border-top: 1px solid var(--crd-line);
}

.crd-ind-row dt b {
    display: inline-block;
    padding: 2px 10px;
    font-size: .88rem;
    font-weight: 700;
    white-space: nowrap;
    color: var(--crd-brand);
    background: var(--crd-brand-soft);
    border: 1px solid var(--crd-brand-line);
    border-radius: 8px;
}

.crd-ind-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.crd-ind-chips li {
    padding: 1px 9px;
    font-size: .84rem;
    line-height: 1.6;
    color: var(--crd-ink-2);
    border: 1px solid var(--crd-line-bold);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

.crd-ind-none {
    font-size: .84rem;
    color: var(--crd-muted);
}

/* ═══════════════════════════════════════════════════════════════════════
   คอลัมน์ขวา: ครูผู้สอน แผนการเรียน รายวิชาในหมวดเดียวกัน
   ═══════════════════════════════════════════════════════════════════════ */

.crd-ts {
    display: grid;
    gap: 10px;
}

.crd-t {
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.crd-t-photo {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 0 0 2px var(--crd-paper), 0 0 0 3px var(--crd-line);
}

.crd-t-photo.is-initial {
    font-family: var(--crd-serif);
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(145deg, var(--crd-hero-c) 0%, var(--crd-hero-a) 100%);
}

.crd-t-body {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.crd .crd-t-name {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    font-weight: 600;
    color: var(--crd-brand);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--crd-brand) 35%, transparent);
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

.crd .crd-t-name:hover {
    text-decoration-color: currentColor;
}

.crd-rooms {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.crd-rooms li {
    padding: 0 8px;
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.7;
    color: var(--crd-ink-2);
    background: var(--crd-paper-alt);
    border: 1px solid var(--crd-line);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

.crd-rows,
.crd-fams {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--crd-line);
    border-radius: 14px;
}

.crd-rows li + li,
.crd-fams li + li {
    border-top: 1px solid var(--crd-line);
}

.crd .crd-row {
    display: grid;
    grid-template-columns: 2.8rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 3.2rem;
    padding: 8px 12px;
    color: var(--crd-ink);
    text-decoration: none;
    transition: background-color .2s var(--crd-ease);
}

.crd .crd-row:hover {
    background: var(--crd-brand-soft);
}

.crd-row.is-off {
    box-shadow: inset 4px 0 0 #d97706;
}

.crd-row-g {
    display: grid;
    place-items: center;
    height: 2.1rem;
    font-size: .84rem;
    font-weight: 700;
    color: var(--crd-ink);
    background: var(--crd-paper-alt);
    border: 1px solid var(--crd-line);
    border-radius: 10px;
}

.crd-row-t {
    display: grid;
    gap: 2px;
    min-width: 0;
    font-size: .92rem;
    font-weight: 600;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.crd-row-w {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--crd-warn);
}

.crd-row-w .crd-icon {
    width: .9rem;
    height: .9rem;
}

.crd-row-go {
    width: 1rem;
    height: 1rem;
    color: var(--crd-muted);
    transition: transform .2s var(--crd-ease);
}

.crd .crd-row:hover .crd-row-go {
    transform: translateX(3px);
}

.crd .crd-fam {
    display: grid;
    gap: 1px;
    padding: 9px 14px;
    color: var(--crd-ink);
    text-decoration: none;
    transition: background-color .2s var(--crd-ease);
}

.crd a.crd-fam:hover {
    background: var(--crd-brand-soft);
}

.crd a.crd-fam .crd-fam-t {
    color: var(--crd-brand);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--crd-brand) 35%, transparent);
    text-underline-offset: 3px;
}

.crd-fam-t {
    font-size: .92rem;
    font-weight: 600;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.crd-fam-m {
    font-size: .8rem;
    color: var(--crd-muted);
    font-variant-numeric: tabular-nums;
}

/* วิชาที่กำลังดู: อยู่ในลำดับด้วยแต่ไม่เป็นลิงก์ สันซ้ายน้ำเงิน */
.crd-fam.is-current {
    background: var(--crd-brand-soft);
    box-shadow: inset 4px 0 0 var(--crd-brand);
}

.crd-fam-now {
    display: inline-block;
    margin-left: 4px;
    padding: 0 8px;
    font-size: .74rem;
    font-weight: 700;
    line-height: 1.6;
    color: #ffffff;
    background: var(--crd-primary);
    border-radius: 999px;
    vertical-align: .1em;
}

.crd .crd-link {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: var(--crd-brand);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ── ท้ายหน้า (ไม่ใช่ <footer>: ไฟล์กลางทาพื้นดำให้ footer ทุกตัว) ──────── */
.crd-foot {
    padding: 16px 20px;
    font-size: .9rem;
    line-height: 1.7;
    color: var(--crd-ink-2);
    background: var(--crd-paper);
    border: 1px solid var(--crd-line);
    border-radius: 18px;
}

.crd-foot-t {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-weight: 700;
    color: var(--crd-ink);
}

.crd-foot-t .crd-icon {
    color: var(--crd-brand);
}

.crd-foot ul {
    display: grid;
    gap: 4px;
    padding-left: 1.2rem;
    list-style: disc;
}

.crd-foot li::marker {
    color: var(--crd-muted);
}

/* ═══════════════════════════════════════════════════════════════════════
   ช่วงจอ
   ═══════════════════════════════════════════════════════════════════════ */

/* แถบตัวเลข 5–6 ช่อง: จัดแถวตามจำนวนจริง ไม่ปล่อยช่องเดียวค้างท้ายแถว */
@media (max-width: 1099.98px) {
    .crd-stats[data-n="5"],
    .crd-stats[data-n="6"] {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .crd-stats[data-n="6"] > .crd-stat,
    .crd-stats[data-n="5"] > .crd-stat:nth-child(-n + 3) {
        grid-column: span 2;
    }

    .crd-stats[data-n="5"] > .crd-stat:nth-child(n + 4) {
        grid-column: span 3;
    }
}

@media (max-width: 1023.98px) {
    .crd-hero-top {
        align-items: start;
    }

    .crd-watermark {
        bottom: auto;
        top: 1rem;
        font-size: clamp(4.5rem, 2rem + 12vw, 8rem);
    }
}

@media (max-width: 759.98px) {
    .crd-hero {
        padding-bottom: 84px;
    }

    .crd-body {
        margin-top: -60px;
    }

    .crd-panel-head {
        padding: 14px 16px;
    }

    .crd-panel-body {
        padding: 14px 14px 18px;
    }

    .crd-glance {
        padding: 14px;
        border-radius: 20px;
    }

    .crd-note {
        padding: 14px 16px;
    }

    .crd-prose {
        font-size: .98rem;
        line-height: 1.9;
    }

    .crd-prose > p:first-child {
        font-size: 1rem;
    }

    .crd-oc li {
        grid-template-columns: 2.1rem minmax(0, 1fr);
        gap: 12px;
        padding: 10px 12px 10px 10px;
    }

    .crd-oc-n {
        width: 2.1rem;
        height: 2.1rem;
        font-size: .95rem;
    }
}

@media (max-width: 639.98px) {
    .crd-stats,
    .crd-stats[data-n] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* :nth-child(n) ยกความเฉพาะให้เท่ากฎ span ด้านบน ไม่งั้นกฎนั้นชนะแล้วทุกช่องกลายเป็นเต็มแถว */
    .crd-stats[data-n] > .crd-stat:nth-child(n) {
        grid-column: auto;
    }

    .crd-stats[data-n] > .crd-stat:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .crd-stat {
        padding: 14px 14px 16px;
    }
}

@media (max-width: 479.98px) {
    .crd-title {
        font-size: 1.9rem;
    }

    .crd-hero-main .crd-acts {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
    }

    .crd-code {
        gap: 4px;
    }

    .crd-code-p {
        padding: 8px 2px;
        border-radius: 12px;
    }

    .crd-code-p b {
        min-height: 2.6rem;
        font-size: 1.45rem;
    }

    .crd-code-p span {
        font-size: .68rem;
    }

    .crd-ind-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   การเคลื่อนไหว
   ★ ทุกอย่างมองเห็นได้ตั้งแต่แรก ที่ขยับมีแค่ตำแหน่งและความยาวแถบ (ไม่มี opacity 0 เป็นสถานะพัก)
   ★ มีผลเฉพาะเมื่อสคริปต์ติดคลาส crd-motion ที่ .crd-shell แล้วเท่านั้น
   ★ ทุกแอนิเมชันเล่นครั้งเดียวแล้วจบ
   ═══════════════════════════════════════════════════════════════════════ */

@keyframes crd-up {
    from {
        transform: translate3d(0, 18px, 0);
    }

    to {
        transform: none;
    }
}

@keyframes crd-drift {
    from {
        transform: translate3d(60px, -40px, 0) scale(.9);
    }

    to {
        transform: none;
    }
}

@keyframes crd-drift-b {
    from {
        transform: translate3d(-50px, 40px, 0) scale(.9);
    }

    to {
        transform: none;
    }
}

@keyframes crd-watermark {
    from {
        transform: translate3d(0, 40px, 0);
    }

    to {
        transform: none;
    }
}

.crd-motion .crd-hero-main > * {
    animation: crd-up .7s var(--crd-spring) backwards;
}

.crd-motion .crd-hero-main > :nth-child(2) {
    animation-delay: .06s;
}

.crd-motion .crd-hero-main > :nth-child(3) {
    animation-delay: .12s;
}

.crd-motion .crd-hero-main > :nth-child(4) {
    animation-delay: .18s;
}

.crd-motion .crd-hero-main > :nth-child(5) {
    animation-delay: .24s;
}

.crd-motion .crd-orb.is-a {
    animation: crd-drift 1.8s var(--crd-spring) backwards;
}

.crd-motion .crd-orb.is-b {
    animation: crd-drift-b 2.2s var(--crd-spring) .1s backwards;
}

.crd-motion .crd-watermark {
    animation: crd-watermark 1.6s var(--crd-spring) .1s backwards;
}

/* ส่วนที่เลื่อนเข้ามาในจอ: ยกขึ้นจากด้านล่าง ลูกในส่วนนั้นตามมาทีละตัว */
.crd-motion [data-crd-reveal] {
    transition: transform .75s var(--crd-spring), border-color .2s var(--crd-ease), box-shadow .2s var(--crd-ease);
}

.crd-motion [data-crd-reveal]:not(.is-in) {
    transform: translate3d(0, 28px, 0);
}

.crd-motion [data-crd-reveal] :is(.crd-stat, .crd-code-p, .crd-oc li) {
    transition: transform .6s var(--crd-spring), border-color .2s var(--crd-ease), background-color .2s var(--crd-ease);
    transition-delay: calc(min(var(--k, 0), 12) * 45ms + 100ms), 0s, 0s;
}

.crd-motion [data-crd-reveal]:not(.is-in) :is(.crd-stat, .crd-code-p, .crd-oc li) {
    transform: translate3d(0, 16px, 0);
}

/* เฟรมแรกหลังติดคลาส: กระโดดไปตำแหน่งเริ่มโดยไม่เล่นทรานสิชันย้อนกลับ */
.crd-motion.crd-arming [data-crd-reveal],
.crd-motion.crd-arming [data-crd-reveal] * {
    transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .crd *,
    .crd *::before,
    .crd *::after {
        animation: none !important;
        transition: none !important;
    }

    .crd [data-crd-reveal],
    .crd [data-crd-reveal] * {
        transform: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   โหมดคอนทราสต์สูง
   ไฟล์กลางบังคับพื้นดำ ตัวอักษรขาว ลิงก์และปุ่มเหลือง ที่นี่เขียนเฉพาะสิ่งที่ไฟล์กลางไม่รู้จัก
   ═══════════════════════════════════════════════════════════════════════ */

html.tb1-contrast-high body.crd-page {
    background: #000000;
}

html.tb1-contrast-high .crd {
    --crd-shadow: none;
    --crd-shadow-float: none;
    --crd-on-hero-2: #ffffff;
    --crd-gold-text: #facc15;
    --crd-warn: #facc15;
}

html.tb1-contrast-high .crd-hero {
    background: #000000 !important;
    border-bottom: 3px solid #ffffff;
}

html.tb1-contrast-high .crd .crd-hero {
    padding-bottom: 36px;
}

html.tb1-contrast-high .crd .crd-body {
    margin-top: 28px;
}

html.tb1-contrast-high .crd-hero::before,
html.tb1-contrast-high .crd-hero::after,
html.tb1-contrast-high .crd-hero-fx {
    display: none;
}

html.tb1-contrast-high .crd :where(.crd-tag, .crd-glance, .crd-code-p, .crd-code-p b, .crd-code-plain b, .crd-checks li,
    .crd-stats, .crd-stat-ic, .crd-panel, .crd-panel-head, .crd-panel-ic, .crd-note, .crd-note-ic, .crd-flag, .crd-mismatch,
    .crd-empty, .crd-oc li, .crd-oc-n, .crd-ind, .crd-ind-row dt b, .crd-ind-chips li, .crd-t-photo, .crd-rooms li,
    .crd-rows, .crd-row-g, .crd-fams, .crd-fam, .crd-fam-now, .crd-foot) {
    background: #000000 !important;
    border-color: #ffffff !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

html.tb1-contrast-high .crd :where(.crd-tag, .crd-glance, .crd-code-p, .crd-code-p b, .crd-code-plain b, .crd-checks li,
    .crd-stat-ic, .crd-panel, .crd-panel-ic, .crd-note, .crd-note-ic, .crd-flag, .crd-mismatch, .crd-empty, .crd-oc li, .crd-oc-n,
    .crd-ind, .crd-ind-row dt b, .crd-ind-chips li, .crd-t-photo, .crd-rooms li, .crd-rows, .crd-row-g, .crd-fams, .crd-fam-now, .crd-foot) {
    border: 1px solid #ffffff !important;
}

html.tb1-contrast-high .crd .crd-code-p b,
html.tb1-contrast-high .crd .crd-code-plain b,
html.tb1-contrast-high .crd .crd-ind-row dt b {
    color: #ffffff !important;
}

/* สิ่งที่ไม่ตรงกัน: เหลืองหนา */
html.tb1-contrast-high .crd .crd-tag.is-warn,
html.tb1-contrast-high .crd .crd-tag.is-warn *,
html.tb1-contrast-high .crd .crd-checks .is-bad,
html.tb1-contrast-high .crd .crd-checks .is-bad * {
    color: #facc15 !important;
    border-color: #facc15 !important;
}

html.tb1-contrast-high .crd .crd-checks .is-bad,
html.tb1-contrast-high .crd .crd-flag,
html.tb1-contrast-high .crd .crd-mismatch,
html.tb1-contrast-high .crd .crd-note.is-warn,
html.tb1-contrast-high .crd .crd-row.is-off {
    border: 3px solid #facc15 !important;
}

html.tb1-contrast-high .crd .crd-stat.is-warn .crd-stat-v b {
    color: #facc15 !important;
}

html.tb1-contrast-high .crd .crd-fam.is-current {
    border-left: 4px solid #facc15 !important;
}

/* ลิงก์ที่มีกรอบของตัวเอง: พื้นดำ ขอบเหลือง ชี้แล้วกลับสี */
html.tb1-contrast-high .crd :where(a.crd-btn) {
    color: #facc15 !important;
    background: #000000 !important;
    border: 2px solid #facc15 !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

html.tb1-contrast-high .crd :where(a.crd-btn, a.crd-row, a.crd-fam):hover,
html.tb1-contrast-high .crd :where(a.crd-btn, a.crd-row, a.crd-fam):hover * {
    color: #000000 !important;
    background: #facc15 !important;
    border-color: #facc15 !important;
}

html.tb1-contrast-high .crd :focus-visible,
html.tb1-contrast-high .crd-hero :focus-visible {
    outline: 3px solid #facc15;
    outline-offset: 3px;
}

html.tb1-contrast-high .crd .crd-title,
html.tb1-contrast-high .crd .crd-lead {
    text-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════════════
   ฉบับพิมพ์: ใบคำอธิบายรายวิชา ขาวดำ คอลัมน์เดียว
   ═══════════════════════════════════════════════════════════════════════ */
@media print {
    @page {
        size: A4;
        margin: 14mm;
    }

    body.crd-page {
        background: #ffffff;
    }

    body.crd-page a.crd-skip,
    .crd-hero-fx,
    .crd-hero::before,
    .crd-hero::after,
    .crd-acts,
    .crd-crumbs,
    .crd-band,
    .crd-row-go,
    .crd-panel-ic {
        display: none !important;
    }

    .crd {
        --crd-paper: #ffffff;
        --crd-paper-alt: #ffffff;
        --crd-ink: #000000;
        --crd-ink-2: #1f2937;
        --crd-muted: #374151;
        --crd-line: #9ca3af;
        --crd-line-bold: #6b7280;
        --crd-brand: #1e3a8a;
        --crd-brand-soft: #ffffff;
        --crd-brand-line: #9ca3af;
        --crd-on-hero-2: #1f2937;
        --crd-gold-text: #92400e;
        --crd-shadow: none;
        --crd-shadow-float: none;
        color: #000000;
    }

    .crd-wrap {
        max-width: none;
        padding-inline: 0;
    }

    .crd-hero {
        padding: 0 0 8px;
        color: #000000;
        background: none !important;
        border-bottom: 2px solid #000000;
    }

    .crd-hero-top {
        grid-template-columns: minmax(0, 1fr) 23rem;
        gap: 16px;
    }

    .crd-tag,
    .crd-tag.is-warn {
        color: #000000;
        background: none;
        border-color: #9ca3af;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .crd-title,
    .crd-title-y {
        color: #000000;
        text-shadow: none;
    }

    .crd-title {
        font-size: 1.6rem;
    }

    .crd-lead {
        margin-top: 4px;
        font-size: .88rem;
    }

    /* การ์ดรหัสวิชาพิมพ์เป็นกรอบเส้น */
    .crd-glance {
        padding: 8px;
        color: #000000;
        background: none;
        border: 1px solid #9ca3af;
        border-radius: 8px;
        box-shadow: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .crd-glance-k,
    .crd-glance-k .crd-icon,
    .crd-checks li,
    .crd-checks .is-ok .crd-icon {
        color: #000000;
    }

    .crd-code-p,
    .crd-checks li,
    .crd-checks .is-bad {
        background: none;
        border-color: #9ca3af;
    }

    .crd-checks .is-bad {
        border-color: #92400e;
    }

    .crd-code-p b,
    .crd-code-plain b {
        color: #000000;
        background: none;
        box-shadow: none;
    }

    .crd-body {
        display: block;
        margin-top: 12px;
        padding-bottom: 0;
    }

    .crd-main,
    .crd-side {
        display: block;
    }

    .crd-body .crd-panel,
    .crd-body .crd-foot {
        margin-top: 10px;
    }

    .crd-panel-head {
        padding: 6px 0;
        background: none;
        border: 0;
    }

    .crd-panel,
    .crd-note,
    .crd-foot {
        border: 0;
        border-radius: 0;
    }

    .crd-panel-body {
        padding: 0;
    }

    .crd-prose {
        max-width: none;
        font-size: .92rem;
        line-height: 1.75;
    }

    .crd-ind-group,
    .crd-oc li,
    .crd-ind-row,
    .crd-t,
    .crd-rows li,
    .crd-fams li {
        break-inside: avoid;
    }

    .crd-oc-n {
        color: #000000;
        background: none;
        border: 1px solid #000000;
    }

    .crd .crd-t-name,
    .crd a.crd-fam .crd-fam-t {
        color: #000000;
        text-decoration: none;
    }

    .crd-fam-now {
        color: #000000;
        background: none;
        border: 1px solid #000000;
    }

    .crd [data-crd-reveal],
    .crd [data-crd-reveal] *,
    .crd .crd-hero-main > * {
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }
}
