/* ──────────────────────────────────────────────────────────────────────────
   onet_analysis_dashboard.php — ลำดับการยกระดับผล O-NET
   โรงเรียนเทศบาล ๑ กิตติขจร

   รอบ 25 ก.ย. 2569: ภาษาภาพเดียวกับ /zerodropout/ และหน้ารายงาน (css/tb1-onet-report.css)
       หัวหน้าน้ำเงินไล่เฉดเต็มจอ ปีการศึกษาเป็นลายน้ำ การ์ดกระจก (วิชาอันดับหนึ่ง ม.3 กับ ม.6 รุ่นล่าสุด)
       แถบตัวเลขหกช่อง แล้วแผงลอยทับขอบล่าง: บัตรลำดับการลงมือ ตารางส่วนต่างรายปีแยกคู่เทียบ
       ผังสองแกนคู่กับ ม.3 กับ ม.6 ตารางรุ่นเดียวกัน กฎ และตารางหลักฐาน

   ★ กราฟทุกตัววาดฝั่งเซิร์ฟเวอร์ (HTML/CSS + inline SVG) สีที่เป็นข้อมูลต้องติดกระดาษตอนพิมพ์
   ★ ค่าที่ไม่มีคือขีดกลาง ไม่ใช่แท่งศูนย์ · ส่วนต่างเป็นคะแนน ไม่ใช่เปอร์เซ็นต์
   ★ ตารางส่วนต่างรายปีใช้แถบใต้ตัวเลขแทนการลงพื้นสี (ตามเอกสารบ้าน: เลี่ยง heatmap ถ้าทำได้)
   ★ ห้าสีประจำวิชาชุดเดียวกับ css/tb1-onet-priority.css (แดชบอร์ดวิเคราะห์) ทุกสีผ่าน 4.5:1 บนกระดาษทั้งสองโหมด
   ★ สีบอกวิชา ทิศทางบอกด้วยข้างของเส้นกลาง เครื่องหมาย + − ลูกศรสามเหลี่ยม และคำ (เขียว/แดงเป็นของเสริม)
   ★ โทเคนของหน้าทุกตัวเป็น alias ที่ชี้ไป --tb1-* โหมดมืดจึงพลิกให้เอง
   ★ ธีมกลางบังคับ font-family บน span div li p a ด้วย !important ตัวเซริฟจึงอยู่ที่ h1–h3 และ b
   ★ ไม่มี opacity:0 เป็นสถานะพัก ที่ขยับได้มีแค่ตำแหน่ง ความยาวแถบ และการลากเส้น (สคริปต์ติด oad-motion ก่อนเท่านั้น)
   ★ ห้ามตั้ง display บน <caption> · ห้ามใช้ <footer> ในหน้า (ไฟล์กลางทาพื้นดำให้ footer ทุกตัว)
   ★ ทุก selector ขึ้นต้นด้วย oad- (css/tb1-onet-priority.css ของรอบ 14 ก.ย. ใช้ oa- ไม่มีหน้าไหนโหลดแล้ว)
   ────────────────────────────────────────────────────────────────────────── */

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

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

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

body.oad-page a.oad-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.oad {
    display: block;
}

main.oad:focus {
    outline: none;
}

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

    /* ห้าสีประจำวิชา: หมวดจริงในข้อมูล ไม่ใช่สีที่วนตามลำดับ (ชุดเดียวกับแดชบอร์ดวิเคราะห์) */
    --oad-s-thai: var(--tb1-brand, #1d4ed8);
    --oad-s-math: #a84d08;
    --oad-s-sci: #0e7490;
    --oad-s-eng: #6d28d9;
    --oad-s-social: #047857;
    --oad-s-other: var(--tb1-ink-3, #5a697f);

    /* สี่สถานะของการลงมือ: ตัวอักษรบนกระดาษ ผ่าน 4.5:1 ทั้งสองโหมด (ใช้เป็นเส้นและตัวอักษร ไม่ถมพื้น) */
    --oad-a-urgent: #b91c1c;
    --oad-a-watch: #92400e;
    --oad-a-hold: #047857;
    --oad-a-unknown: var(--tb1-ink-3, #5a697f);

    color: var(--oad-ink-2);
    font-family: var(--oad-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"]) .oad {
    --oad-up: var(--tb1-text-success, #6ee7b7);
    --oad-down: var(--tb1-text-danger, #fda4af);
    --oad-up-soft: color-mix(in srgb, #34d399 12%, var(--tb1-surface, #111c31));
    --oad-down-soft: color-mix(in srgb, #f87171 12%, var(--tb1-surface, #111c31));
    --oad-warn: var(--tb1-text-warning, #fcd34d);
    --oad-warn-soft: color-mix(in srgb, #f59e0b 13%, var(--tb1-surface, #111c31));
    --oad-warn-line: color-mix(in srgb, #f59e0b 42%, var(--tb1-border, #243049));
    --oad-brand-soft: color-mix(in srgb, var(--tb1-brand, #60a5fa) 16%, var(--tb1-surface, #111c31));
    --oad-nation: #94a3b8;
    --oad-shadow: 0 14px 32px -22px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .055);
    --oad-shadow-float: 0 30px 60px -30px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .06);
    /* โหมดมืด: banner เป็นกรมท่าเข้ม เติมน้ำเงินสดที่ปลายไล่เฉดให้หัวหน้ามีมิติ แบบเดียวกับหน้าแรก */
    --oad-hero-a: #050d22;
    --oad-hero-c: color-mix(in srgb, #1d4ed8 42%, var(--tb1-banner-1, #0e1f45));
    --oad-primary: #2563eb;
    --oad-s-thai: #93c5fd;
    --oad-s-math: #fcd34d;
    --oad-s-sci: #67e8f9;
    --oad-s-eng: #c4b5fd;
    --oad-s-social: #6ee7b7;
    --oad-a-urgent: #fda4af;
    --oad-a-watch: #fcd34d;
    --oad-a-hold: #6ee7b7;
    color-scheme: dark;
}

.oad .is-thai {
    --oad-tone: var(--oad-s-thai);
}

.oad .is-math {
    --oad-tone: var(--oad-s-math);
}

.oad .is-sci {
    --oad-tone: var(--oad-s-sci);
}

.oad .is-eng {
    --oad-tone: var(--oad-s-eng);
}

.oad .is-social {
    --oad-tone: var(--oad-s-social);
}

.oad .is-other {
    --oad-tone: var(--oad-s-other);
}

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

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

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

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

.oad .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;
}

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

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

.oad-icon.is-flip {
    transform: scaleX(-1);
}

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

/* จุดสีประจำวิชา */
.oad-dot {
    display: inline-block;
    flex: none;
    width: .7rem;
    height: .7rem;
    border-radius: 3px;
    background: var(--oad-tone, var(--oad-muted));
}

/* ลูกศรสามเหลี่ยมทำจากกรอบ ไม่ใช่ตัวอักษร โปรแกรมอ่านหน้าจอจึงไม่อ่าน และรูปทรงยังอยู่เมื่อสีถูกถอด */
.oad-mark {
    display: inline-block;
    flex: none;
    width: 0;
    height: 0;
    vertical-align: .12em;
    border-left: .36rem solid transparent;
    border-right: .36rem solid transparent;
}

.oad-mark.is-up {
    border-bottom: .46rem solid currentColor;
}

.oad-mark.is-down {
    border-top: .46rem solid currentColor;
}

.oad-mark.is-flat {
    width: .7rem;
    border: 0;
    border-top: 3px solid currentColor;
    vertical-align: .28em;
}

.oad-mark.is-none {
    display: none;
}

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

.oad .oad-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(--oad-ease), border-color .2s var(--oad-ease), box-shadow .2s var(--oad-ease), color .2s var(--oad-ease);
}

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

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

:is(html.dark, html.dark-mode, html[data-theme="dark"], body.dark-mode) .oad .oad-btn-light {
    color: #1e3a8a;
}

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

/* ★ พื้นขาว .12 บนน้ำเงิน ตัวขาวยังเกิน 4.5:1 ชี้แล้วพื้นเข้มขึ้น (ถ้าสว่างขึ้นจะต่ำกว่า 4.5:1) */
.oad .oad-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);
}

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

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

/* ═══════════════════════════════════════════════════════════════════════
   หัวหน้า: น้ำเงินไล่เฉดเต็มจอ ปีการศึกษาเป็นลายน้ำ
   ═══════════════════════════════════════════════════════════════════════ */

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

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

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

.oad-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%);
}

/* เส้นกริดบางแบบกระดาษกราฟ (ตกแต่ง) */
.oad-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);
}

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

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

.oad-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%);
}

.oad-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) .oad-orb.is-a {
    background: radial-gradient(circle, rgba(59, 130, 246, .32) 0%, rgba(59, 130, 246, 0) 68%);
}

/* ปีการศึกษาเป็นลายน้ำ: ตัวกลวง (ขอบขาวจาง) ไม่ใช่ข้อความที่ต้องอ่าน จึงอยู่ใน aria-hidden */
/* ★ จอกว้าง: วางที่ว่างใต้ปุ่มทางลัด ชิดขอบซ้ายของการ์ดกระจก เหนือแถบตัวเลข */
.oad-watermark {
    position: absolute;
    right: calc(var(--oad-gutter) + clamp(22rem, 30vw, 28rem) + 1.5rem);
    bottom: calc(clamp(92px, 8vw, 118px) + 12.5rem);
    font-family: var(--oad-serif);
    font-size: clamp(7rem, 4rem + 11vw, 15rem);
    font-weight: 700;
    line-height: .8;
    letter-spacing: -.02em;
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(255, 255, 255, .12);
    white-space: nowrap;
    user-select: none;
}

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

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

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

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

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

.oad-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) */
.oad-tag.is-warn {
    font-weight: 600;
    color: var(--oad-gold-text);
    background: rgba(2, 6, 23, .26);
    border-color: rgba(253, 230, 138, .45);
}

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

.oad-title-y {
    display: block;
    margin-top: 8px;
    font-size: .46em;
    font-weight: 500;
    line-height: 1.35;
    color: #dbeafe;
}

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

/* ── เลือกระดับชั้นและปีการศึกษา: ชิปกระจก ลิงก์ธรรมดา ───────────────────── */
.oad-pick {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.oad-pick-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.oad-pick-k {
    min-width: 5.6rem;
    font-size: .86rem;
    color: var(--oad-on-hero-2);
}

.oad-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.oad .oad-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 2.5rem;
    padding: 0 14px;
    color: #ffffff;
    text-decoration: none;
    background: rgba(2, 6, 23, .18);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    transition: background-color .2s var(--oad-ease), border-color .2s var(--oad-ease), color .2s var(--oad-ease);
}

.oad .oad-chip:has(.oad-chip-n) {
    padding-right: 6px;
}

.oad .oad-chip b {
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.oad .oad-chip.is-year b {
    font-weight: 600;
}

.oad-chip-n {
    padding: 1px 9px;
    font-size: .8rem;
    font-weight: 600;
    color: #ffffff;
    background: rgba(255, 255, 255, .14);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

.oad .oad-chip:hover {
    background: rgba(2, 6, 23, .32);
    border-color: #ffffff;
}

/* ชิปของหน้าปัจจุบัน: แผ่นขาว ตัวน้ำเงิน */
.oad .oad-chip[aria-current="page"] {
    color: #1e3a8a;
    background: #ffffff;
    border-color: #ffffff;
    box-shadow: 0 12px 24px -16px rgba(2, 6, 23, .8);
}

.oad .oad-chip[aria-current="page"] .oad-chip-n {
    color: #1e3a8a;
    background: #dbeafe;
}

.oad-hero-main .oad-acts {
    margin-top: 22px;
}

/* ═══════════════════════════════════════════════════════════════════════
   การ์ดกระจกขวา: เฉลี่ยทุกวิชา · ส่วนต่างรายปี · วิชาที่ต้องดู
   ═══════════════════════════════════════════════════════════════════════ */

.oad-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);
}

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

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

.oad-glance-more,
.oad-glance-note {
    margin-top: 8px;
    font-size: .84rem;
    line-height: 1.6;
    color: var(--oad-on-hero-2);
}

.oad-glance-note {
    margin-top: 6px;
    font-size: .78rem;
}

.oad-glance-more b {
    font-family: var(--oad-serif);
    font-size: 1.1rem;
    color: #ffffff;
}

.oad .oad-glance-more a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-left: 4px;
    color: #ffffff;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.oad-tile {
    display: grid;
    place-items: center;
    align-content: center;
    min-width: 6.4rem;
    padding: 9px 12px;
    color: #064e3b;
    text-align: center;
    background: linear-gradient(160deg, #ffffff 0%, #d1fae5 100%);
    border-radius: 16px;
    box-shadow: 0 16px 30px -18px rgba(2, 6, 23, .9);
}

.oad-top-a.is-below .oad-tile {
    color: #7f1d1d;
    background: linear-gradient(160deg, #ffffff 0%, #fee2e2 100%);
}

.oad-top-a:not(.is-below) .oad-tile {
    color: #1e3a8a;
    background: linear-gradient(160deg, #ffffff 0%, #dbeafe 100%);
}

.oad-tile b {
    font-family: var(--oad-serif);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.oad-tile-k {
    font-size: .76rem;
    font-weight: 600;
    line-height: 1.3;
}


/* ── วิชาอันดับหนึ่ง ──────────────────────────────────────────────────────── */
.oad .oad-top-a {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 12px 14px 12px 12px;
    color: #ffffff;
    text-decoration: none;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 16px;
    transition: background-color .2s var(--oad-ease), border-color .2s var(--oad-ease);
}

.oad .oad-top-a:hover {
    background: rgba(2, 6, 23, .22);
    border-color: rgba(255, 255, 255, .5);
}

.oad-top-a .oad-tile {
    min-width: 5.6rem;
}

.oad-top-a .oad-tile b {
    font-size: 1.7rem;
}

.oad-top-t {
    display: grid;
    justify-items: start;
    gap: 2px;
    min-width: 0;
}

.oad-top-t > b {
    font-family: var(--oad-serif);
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.45;
}

.oad-top-t > span {
    font-size: .82rem;
    line-height: 1.5;
    color: var(--oad-on-hero-2);
}

.oad-top-t > span:first-of-type {
    font-weight: 600;
    color: #ffffff;
}

/* ── ชิประดับชั้น: ตัวเลขคือวิชาที่ต้องลงมือก่อน ─────────────────────────── */
.oad-pick-s {
    display: block;
    font-size: .74rem;
    line-height: 1.35;
    color: var(--oad-on-hero-2);
}

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

.oad .oad-chip[aria-current="page"] .oad-chip-n.is-warn {
    color: #422006;
    background: #fde68a;
}

/* ── ม.3 กับ ม.6 ในการ์ดกระจก: แถบยื่นจากเส้นกลางบนกระจก ────────────────── */
.oad-duo {
    display: grid;
    gap: 8px;
}

.oad-duo li {
    display: grid;
    grid-template-columns: 3.2rem minmax(0, 1fr) 3.8rem;
    align-items: center;
    gap: 10px;
}

.oad-duo-k {
    font-size: .86rem;
    font-weight: 600;
    color: var(--oad-on-hero-2);
}

.oad-duo .is-current .oad-duo-k {
    color: var(--oad-gold-text);
}

.oad-duo b {
    font-family: var(--oad-serif);
    font-size: 1.05rem;
    font-weight: 700;
    text-align: right;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}

/* ── รุ่นล่าสุด: ตอน ม.3 ลูกศร ตอน ม.6 และทิศทาง ─────────────────────────── */
.oad-cohort-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}

.oad-cohort-line > span:not(.oad-cohort-d) {
    display: grid;
    gap: 0;
}

.oad-cohort-line small {
    font-size: .74rem;
    color: var(--oad-on-hero-2);
}

.oad-cohort-line b {
    font-family: var(--oad-serif);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.15;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}

.oad-cohort-arrow {
    width: 1.3rem;
    height: 1.3rem;
    color: var(--oad-on-hero-2);
}

.oad-cohort-d {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 2px 12px;
    font-size: .86rem;
    font-weight: 600;
    color: #ffffff;
    background: rgba(2, 6, 23, .26);
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 999px;
}

.oad-cohort-d.is-down {
    color: var(--oad-gold-text);
    border-color: rgba(253, 230, 138, .5);
}

.oad-top-t > span + span {
    font-weight: 400;
    color: var(--oad-on-hero-2);
}

.oad .oad-glance-note a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-left: 4px;
    color: #ffffff;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

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

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

.oad-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);
}

/* เส้นคั่นเป็นเงานอกด้านซ้ายและบนของทุกช่อง ขอบแถบตัดส่วนที่ล้นทิ้ง เหลือเฉพาะเส้นระหว่างช่อง */
.oad-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);
}

.oad-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);
}

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

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

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

.oad-stat-v b {
    font-family: var(--oad-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;
}

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

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

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

.oad-body {
    position: relative;
    z-index: 1;
    display: grid;
    gap: var(--oad-gap);
    margin-top: -68px;
    padding-bottom: clamp(40px, 5vw, 72px);
}

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

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

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

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

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

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

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

.oad-panel-body > :last-child {
    margin-bottom: 0;
}

.oad-lede {
    max-width: 62rem;
    margin-bottom: 16px;
    font-size: .92rem;
    line-height: 1.75;
    color: var(--oad-ink-2);
}

.oad-lede b {
    color: var(--oad-ink);
}

.oad-small {
    margin-top: 14px;
    font-size: .84rem;
    line-height: 1.65;
    color: var(--oad-muted);
}

.oad-small b {
    color: var(--oad-ink-2);
}

.oad-muted {
    font-size: .88rem;
    color: var(--oad-muted);
}

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

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

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

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

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

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

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

.oad-flag {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px 14px;
    font-size: .9rem;
    line-height: 1.65;
    color: var(--oad-ink-2);
    background: var(--oad-warn-soft);
    border: 1px solid var(--oad-warn-line);
    border-radius: 12px;
}

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

.oad-flag b {
    color: var(--oad-ink);
}

.oad-flag.is-info {
    background: var(--oad-brand-soft);
    border-color: var(--oad-brand-line);
}

.oad-flag.is-info .oad-icon {
    color: var(--oad-brand);
}

/* ป้ายสีประจำวิชา */
.oad-keys {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}

.oad-keys li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .84rem;
    color: var(--oad-ink-2);
}

/* คำอธิบายรูปทรงเส้น */
.oad-shape-key {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-bottom: 14px;
}

.oad-shape-key li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .84rem;
    line-height: 1.5;
    color: var(--oad-ink-2);
}

.oad-shape {
    display: inline-block;
    flex: none;
    width: 1.9rem;
    height: 0;
    border-top: 3px solid var(--oad-ink-2);
    border-radius: 2px;
}

.oad-shape.is-nation {
    border-top: 2px dashed var(--oad-nation);
}

.oad-shape.is-sel {
    width: 1.2rem;
    height: .95rem;
    border: 0;
    border-radius: 4px;
    background: color-mix(in srgb, var(--oad-brand) 14%, transparent);
}

.oad-shape.is-area {
    width: 1.2rem;
    height: .95rem;
    border: 2px solid var(--oad-brand);
    border-radius: 3px;
    background: color-mix(in srgb, var(--oad-brand) 22%, transparent);
}

/* ═══════════════════════════════════════════════════════════════════════
   ตาราง (เทียบปีก่อน + คะแนนแยกตามระดับ)
   ═══════════════════════════════════════════════════════════════════════ */

/* ★ position: relative ให้ .sr-only ในช่องตาราง (position: absolute) ถูกตัดโดยกล่องเลื่อนนี้
     ไม่งั้นข้อความซ่อนของคอลัมน์ขวาสุดดันทั้งหน้าให้กว้างเกินจอบนมือถือ */
.oad-scroll {
    position: relative;
    overflow-x: auto;
    border: 1px solid var(--oad-line);
    border-radius: 16px;
}

.oad-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .92rem;
    font-variant-numeric: tabular-nums;
}

.oad-table th,
.oad-table td {
    padding: 11px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--oad-line);
}

.oad-table thead th {
    font-size: .8rem;
    font-weight: 600;
    color: var(--oad-muted);
    background: var(--oad-paper-alt);
    white-space: nowrap;
}

.oad-table tbody tr:last-child > * {
    border-bottom: 0;
}

.oad-table tbody tr:hover > * {
    background: color-mix(in srgb, var(--oad-brand) 4%, var(--oad-paper));
}

.oad-table .oad-num {
    text-align: right;
    white-space: nowrap;
}

.oad-table tbody th {
    font-weight: 600;
    color: var(--oad-ink);
}

/* ── ท้ายหน้า ─────────────────────────────────────────────────────────── */
.oad-foot {
    padding: 18px 22px;
    background: var(--oad-paper);
    border: 1px solid var(--oad-line);
    border-radius: 18px;
    box-shadow: var(--oad-shadow);
}

.oad-foot-t {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-family: var(--oad-serif);
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--oad-ink);
}

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

.oad-foot ul {
    display: grid;
    gap: 6px;
}

.oad-foot li {
    position: relative;
    padding-left: 18px;
    font-size: .88rem;
    line-height: 1.7;
    color: var(--oad-ink-2);
}

.oad-foot li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: .72em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--oad-brand);
}

/* ═══════════════════════════════════════════════════════════════════════
   ชิ้นส่วนที่ใช้ซ้ำ: แถบยื่นจากเส้นกลาง ข้อความหลายส่วน หัวข้อย่อย
   ═══════════════════════════════════════════════════════════════════════ */

/* แถบยื่นจากเส้นกลาง (ศูนย์) ขวาคือบวก ซ้ายคือลบ ความยาวตามสเกลของตารางหรือบัตรนั้น */
.oad-div {
    position: relative;
    display: block;
    height: 8px;
    min-width: 3rem;
    background: var(--oad-paper-alt);
    border-radius: 4px;
}

.oad-div-z {
    position: absolute;
    top: -3px;
    bottom: -3px;
    left: calc(50% - 1px);
    width: 2px;
    background: var(--oad-ink);
    border-radius: 1px;
    z-index: 1;
}

.oad-div-bar {
    position: absolute;
    top: 1px;
    bottom: 1px;
    display: block;
}

.oad-div-bar.is-up {
    left: 50%;
    background: var(--oad-up);
    border-radius: 0 3px 3px 0;
    transform-origin: left center;
}

/* ต่ำกว่า: ลายทแยง ไม่ใช่สีอย่างเดียว */
.oad-div-bar.is-down {
    right: 50%;
    background: repeating-linear-gradient(135deg, var(--oad-down) 0 3px, color-mix(in srgb, var(--oad-down) 55%, var(--oad-paper)) 3px 6px);
    border-radius: 3px 0 0 3px;
    transform-origin: right center;
}

/* บนการ์ดกระจกสีเข้ม */
.oad-div.is-glass {
    height: 10px;
    background: rgba(255, 255, 255, .12);
}

.oad-div.is-glass .oad-div-z {
    background: #ffffff;
}

.oad-div.is-glass .oad-div-bar.is-up {
    background: #4ade80;
}

.oad-div.is-glass .oad-div-bar.is-down {
    background: repeating-linear-gradient(135deg, #fca5a5 0 3px, #f87171 3px 6px);
}

/* ข้อความหลายส่วนในบรรทัดเดียว คั่นด้วยสันซ้าย (เอกสารบ้านห้ามจุดกลางคั่นข้อความ) */
.oad-spans {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 0;
}

.oad-spans > span {
    padding: 0 10px;
    border-left: 1px solid var(--oad-line-bold);
}

.oad-spans > span:first-child {
    padding-left: 0;
    border-left: 0;
}

.oad-sub-h {
    margin: 4px 0 10px;
    font-family: var(--oad-serif);
    font-size: 1.04rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--oad-ink);
}

.oad-k {
    margin-bottom: 6px;
    font-size: .78rem;
    line-height: 1.45;
    color: var(--oad-muted);
}

.oad-link {
    font-weight: 600;
}

.oad .oad-lede .oad-link {
    display: inline;
}

.oad-duet {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--oad-gap);
    align-items: start;
}

@media (min-width: 1100px) {
    .oad-duet:has(> :nth-child(2)) {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   บัตรลำดับการลงมือ
   ═══════════════════════════════════════════════════════════════════════ */

.oad-cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    counter-reset: none;
}

@media (min-width: 1180px) {
    .oad-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }
}

.oad-card {
    --oad-act: var(--oad-line-bold);
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 16px 16px 14px 18px;
    background: var(--oad-paper);
    border: 1px solid var(--oad-line);
    border-radius: 18px;
    box-shadow: inset 5px 0 0 var(--oad-act), var(--oad-shadow);
    scroll-margin-top: 6rem;
    transition: border-color .2s var(--oad-ease), box-shadow .2s var(--oad-ease);
}

.oad-card.act-urgent {
    --oad-act: var(--oad-a-urgent);
}

.oad-card.act-watch {
    --oad-act: var(--oad-a-watch);
}

.oad-card:hover {
    border-color: var(--oad-line-bold);
}

.oad-card:focus,
.oad-card:target {
    outline: none;
    border-color: var(--oad-tone);
    box-shadow: inset 5px 0 0 var(--oad-act), 0 0 0 3px color-mix(in srgb, var(--oad-tone) 30%, transparent);
}

.oad-card-h {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

/* วงลำดับ: วงแหวนสีวิชาบนกระดาษเปล่า ไม่ย้อมพื้น (บทเรียนรอบ 14 ก.ย.: ถมพื้นแล้วคอนทราสต์ตก) */
.oad-rank {
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    font-family: var(--oad-serif);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--oad-tone, var(--oad-ink));
    background: var(--oad-paper);
    border: 2.5px solid var(--oad-tone, var(--oad-line-bold));
    border-radius: 50%;
}

.oad-card-t {
    min-width: 0;
}

.oad-card-t h3 {
    font-family: var(--oad-serif);
    font-size: 1.22rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--oad-tone, var(--oad-ink));
}

.oad-card-s {
    margin-top: 2px;
    font-size: .84rem;
    line-height: 1.5;
    color: var(--oad-muted);
}

.oad-card-s b {
    color: var(--oad-ink);
    font-variant-numeric: tabular-nums;
}

/* ป้ายการลงมือ: ตัวอักษรและกรอบสีสถานะบนกระดาษเปล่า */
.oad-act {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 2px 12px;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    color: var(--oad-a-unknown);
    background: var(--oad-paper);
    border: 1.5px solid currentColor;
    border-radius: 999px;
}

.oad-act.act-urgent {
    color: var(--oad-a-urgent);
}

.oad-act.act-watch {
    color: var(--oad-a-watch);
}

.oad-act.act-hold {
    color: var(--oad-a-hold);
}

.oad-card-b {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.oad-peers ul {
    display: grid;
    gap: 5px;
}

.oad-peers li {
    display: grid;
    grid-template-columns: 5.4rem minmax(0, 1fr) 5.2rem;
    align-items: center;
    gap: 10px;
    font-size: .84rem;
}

.oad-pv-k {
    color: var(--oad-ink-2);
}

.oad-pv-n {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--oad-ink);
}

.oad-peers .is-up .oad-pv-n {
    color: var(--oad-up);
}

.oad-peers .is-down .oad-pv-n {
    color: var(--oad-down);
}

/* หลักฐานหกชิ้น */
.oad-facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.6rem), 1fr));
    gap: 6px;
}

/* บัตรสองใบต่อแถว: หลักฐานหกชิ้นเป็นสามคอลัมน์สองแถวพอดี ไม่เหลือช่องว่างครึ่งแถว */
@media (min-width: 1180px) {
    .oad-cards .oad-facts {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.oad-fact {
    display: grid;
    align-content: start;
    gap: 2px;
    min-width: 0;
    padding: 8px 10px 9px;
    background: var(--oad-paper-alt);
    border: 1px solid transparent;
    border-radius: 12px;
}

.oad-fact dt {
    font-size: .74rem;
    line-height: 1.4;
    color: var(--oad-muted);
}

.oad-fact dd {
    display: grid;
    gap: 1px;
    margin: 0;
}

.oad-fact dd b {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--oad-serif);
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--oad-ink);
    font-variant-numeric: tabular-nums;
}

.oad-fact dd span {
    font-size: .74rem;
    line-height: 1.45;
    color: var(--oad-muted);
}

/* ความชัดของส่วนต่าง: รูปทรงของกรอบ ไม่ใช่สี (ชัด = เส้นทึบ อยู่ในช่วงแกว่ง = เส้นประ) */
.oad-fact.is-clear {
    border-color: var(--oad-ink-2);
}

.oad-fact.is-noise {
    border: 1.5px dashed var(--oad-line-bold);
}

.oad-fact.is-bad {
    box-shadow: inset 3px 0 0 var(--oad-down);
}

.oad-card-f {
    display: grid;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--oad-line);
}

.oad-rec-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.oad-rec-wrap .oad-k {
    margin: 0;
}

.oad-record {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.oad-record li {
    display: grid;
    place-items: center;
    min-width: 1.9rem;
    height: 1.55rem;
    padding: 0 3px;
    font-size: .72rem;
    font-weight: 600;
    color: var(--oad-ink-2);
    background: var(--oad-paper);
    border: 1.5px solid var(--oad-line-bold);
    border-radius: 6px;
}

.oad-record li.is-up {
    color: var(--oad-up);
    border-color: var(--oad-up);
}

/* ปีที่ต่ำกว่า: กรอบหนาและขีดล่าง ไม่ถมพื้น (ตัวเลขปีต้องอ่านได้บนกระดาษ) */
.oad-record li.is-down {
    color: var(--oad-down);
    border: 2px solid var(--oad-down);
    box-shadow: inset 0 -3px 0 var(--oad-down);
}

.oad-record li.is-none {
    color: var(--oad-muted);
    border-style: dashed;
}

.oad-clar {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-left: auto;
    padding: 1px 10px;
    font-size: .76rem;
    font-weight: 600;
    color: var(--oad-ink-2);
    border: 1px solid var(--oad-line-bold);
    border-radius: 999px;
}

.oad-clar.is-noise {
    border-style: dashed;
}

.oad-clar.is-unknown {
    color: var(--oad-muted);
}

.oad-advice {
    display: grid;
    gap: 3px;
    padding: 9px 12px;
    font-size: .88rem;
    line-height: 1.65;
    color: var(--oad-ink-2);
    background: var(--oad-paper-alt);
    border-radius: 12px;
}

.oad-advice-k {
    font-size: .78rem;
    font-weight: 700;
    color: var(--oad-ink);
}

/* คำอธิบายสัญลักษณ์ */
.oad-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-top: 14px;
}

.oad-legend li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .82rem;
    color: var(--oad-ink-2);
}

.oad-key {
    display: inline-block;
    flex: none;
    width: 1.3rem;
    height: 1rem;
    background: var(--oad-paper);
    border: 1.5px solid var(--oad-line-bold);
    border-radius: 4px;
}

.oad-key.is-up {
    border-color: var(--oad-up);
}

.oad-key.is-down {
    border: 2px solid var(--oad-down);
    box-shadow: inset 0 -3px 0 var(--oad-down);
}

.oad-key.is-none {
    border-style: dashed;
}

.oad-key.is-bar {
    width: 1.8rem;
    height: 8px;
    border: 0;
    background:
        linear-gradient(var(--oad-ink), var(--oad-ink)) center / 2px 100% no-repeat,
        linear-gradient(90deg, transparent 50%, var(--oad-up) 50% 85%, transparent 85%);
}

/* ═══════════════════════════════════════════════════════════════════════
   ส่วนต่างรายปี: แท็บคู่เทียบ + ตาราง วิชา x ปี
   ═══════════════════════════════════════════════════════════════════════ */

.oad-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.oad .oad-tab {
    min-height: 2.4rem;
    padding: 0 16px;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    color: var(--oad-ink-2);
    background: var(--oad-paper);
    border: 1px solid var(--oad-line-bold);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .2s var(--oad-ease), border-color .2s var(--oad-ease), color .2s var(--oad-ease);
}

.oad .oad-tab:hover {
    border-color: var(--oad-brand);
    color: var(--oad-ink);
}

.oad .oad-tab[aria-selected="true"] {
    color: #ffffff;
    background: var(--oad-primary);
    border-color: var(--oad-primary);
}

.oad-hm-panel + .oad-hm-panel {
    margin-top: 18px;
}

.oad-hm-h {
    margin-bottom: 8px;
    font-size: .95rem;
    font-weight: 600;
    color: var(--oad-ink);
}

.oad-hmt th,
.oad-hmt td {
    padding: 8px 10px;
}

.oad-hmt thead th.oad-num {
    min-width: 5.6rem;
    text-align: center;
}

.oad-hm-name {
    min-width: 8.5rem;
    white-space: nowrap;
}

/* ตรึงคอลัมน์ชื่อวิชาไว้ทางซ้ายเมื่อตารางเลื่อนแนวนอน */
.oad-hmt .oad-hm-name {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--oad-paper);
    box-shadow: 1px 0 0 var(--oad-line);
}

.oad-hmt thead .oad-hm-name {
    background: var(--oad-paper-alt);
}

.oad-hm-name .oad-dot {
    margin-right: 8px;
    vertical-align: -.05em;
}

.oad-hmt .oad-hm {
    text-align: center;
}

.oad-hm-n {
    display: block;
    font-size: .92rem;
    font-weight: 700;
    color: var(--oad-ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.oad-hm.is-up .oad-hm-n {
    color: var(--oad-up);
}

.oad-hm.is-down .oad-hm-n {
    color: var(--oad-down);
}

.oad-hm.is-none .oad-hm-n {
    font-weight: 400;
    color: var(--oad-muted);
}

.oad-hm .oad-div {
    margin-top: 5px;
}

/* ปีที่เลือก: กรอบบนล่างของคอลัมน์ ไม่ทับสี */
.oad-hmt .is-sel {
    background: color-mix(in srgb, var(--oad-brand) 6%, var(--oad-paper));
}

.oad-hmt thead th.is-sel {
    color: var(--oad-ink);
    box-shadow: inset 0 3px 0 var(--oad-brand);
}

.oad-hm-tag {
    display: block;
    font-size: .7rem;
    font-weight: 600;
    color: var(--oad-brand);
}

/* ปีหลังปีที่เลือก: เส้นประบนหัวคอลัมน์ (แสดงไว้ให้เห็นภาพรวม ไม่ถูกใช้จัดลำดับ) */
.oad-hmt thead th.is-after {
    box-shadow: inset 0 -2px 0 var(--oad-paper-alt);
    background-image: linear-gradient(90deg, var(--oad-line-bold) 50%, transparent 50%);
    background-size: 8px 2px;
    background-repeat: repeat-x;
    background-position: left bottom;
}

.oad-hm-sum {
    font-weight: 700;
    white-space: nowrap;
}

.oad-hm-sum.is-bad {
    color: var(--oad-down);
    box-shadow: inset 3px 0 0 var(--oad-down);
}

.oad-hmt tfoot th,
.oad-hmt tfoot td {
    border-top: 2px solid var(--oad-line-bold);
    background: var(--oad-paper-alt);
}

.oad-hmt tfoot .oad-hm-name {
    background: var(--oad-paper-alt);
}

/* ═══════════════════════════════════════════════════════════════════════
   ผังสองแกน
   ═══════════════════════════════════════════════════════════════════════ */

.oad-quad {
    position: relative;
    max-width: 44rem;
    margin-inline: auto;
    overflow-x: auto;
}

/* จอแคบ: ผังไม่ย่อจนป้ายชื่อวิชาเล็กกว่า 11px ให้เลื่อนข้างแทน */
.oad-quad .oad-q-svg {
    min-width: 27rem;
}

.oad-nw {
    white-space: nowrap;
}

.oad-q-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.oad-q-svg text {
    font-family: var(--oad-sans);
}

.oad-q-urgent {
    fill: color-mix(in srgb, var(--oad-down) 7%, transparent);
}

.oad-q-frame {
    fill: none;
    stroke: var(--oad-line-bold);
    stroke-width: 1;
}

.oad-q-grid {
    stroke: var(--oad-line);
    stroke-width: 1;
}

.oad-q-axis {
    stroke: var(--oad-ink);
    stroke-width: 1.6;
}

.oad-q-tick {
    font-size: 11px;
    fill: var(--oad-muted);
    font-variant-numeric: tabular-nums;
}

.oad-q-lbg {
    fill: var(--oad-paper);
}

.oad-q-lbg.is-urgent {
    fill: color-mix(in srgb, var(--oad-down) 7%, var(--oad-paper));
}

/* ป้ายในผังมีขอบสีพื้น (วาดขอบก่อนตัวอักษร) เส้นตารางที่ลอดใต้จึงไม่ตัดผ่านตัวอักษร */
.oad-q-label,
.oad-q-name {
    paint-order: stroke fill;
    stroke: var(--oad-paper);
    stroke-width: 4px;
    stroke-linejoin: round;
}

.oad-q-label {
    font-size: 11.5px;
    fill: var(--oad-muted);
}

.oad-q-label.is-urgent {
    font-weight: 700;
    fill: var(--oad-down);
}

.oad-q-halo {
    fill: color-mix(in srgb, var(--oad-tone, var(--oad-brand)) 18%, transparent);
}

.oad-q-dot {
    fill: var(--oad-tone, var(--oad-brand));
    stroke: var(--oad-paper);
    stroke-width: 2;
}

.oad-q-lead {
    stroke: var(--oad-tone, var(--oad-ink));
    stroke-width: 1.2;
}

.oad-q-name {
    stroke-width: 5px;
    font-size: 13px;
    font-weight: 700;
    fill: var(--oad-tone, var(--oad-ink));
}

.oad-q-axis-t {
    font-size: 11.5px;
    font-weight: 600;
    fill: var(--oad-ink-2);
}

.oad-q-axis-t.is-mid {
    font-weight: 400;
    fill: var(--oad-muted);
}

/* ═══════════════════════════════════════════════════════════════════════
   สองจุดบนแกนเดียวกัน (ม.3 กับ ม.6 · รุ่นเดียวกัน)
   ═══════════════════════════════════════════════════════════════════════ */

.oad-pair {
    position: relative;
    display: block;
    height: 16px;
    min-width: 8rem;
    margin: 4px 0;
    background: linear-gradient(var(--oad-line), var(--oad-line)) center / 100% 2px no-repeat;
}

.oad-pair-z {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(50% - 1px);
    width: 2px;
    background: var(--oad-ink);
}

.oad-pair-line {
    position: absolute;
    top: 6px;
    height: 4px;
    background: color-mix(in srgb, var(--oad-tone, var(--oad-ink-2)) 45%, transparent);
    border-radius: 2px;
    transform-origin: left center;
}

.oad-pair-dot {
    position: absolute;
    top: 2px;
    display: block;
    width: 12px;
    height: 12px;
    margin-left: -6px;
}

.oad-pair-dot.is-lo {
    background: var(--oad-paper);
    border: 2.5px solid var(--oad-ink-2);
    border-radius: 50%;
}

.oad-pair-dot.is-hi {
    background: var(--oad-tone, var(--oad-ink));
    border: 1.5px solid var(--oad-paper);
    box-shadow: 0 0 0 1px var(--oad-tone, var(--oad-ink));
    transform: rotate(45deg) scale(.86);
    border-radius: 2px;
}

.oad-pair-dot.is-key {
    position: static;
    display: inline-block;
    margin: 0 2px;
}

.oad-pair-c {
    min-width: 13rem;
}

.oad-pair-d,
.oad-co-d {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--oad-ink-2);
    white-space: nowrap;
}

.oad-pair-d.is-up,
.oad-co-d.is-up {
    color: var(--oad-up);
}

.oad-pair-d.is-down,
.oad-co-d.is-down {
    color: var(--oad-down);
}

.oad-cross tbody th,
.oad-cohort tbody th {
    white-space: nowrap;
}

.oad-cross tbody th .oad-dot,
.oad-cohort thead th .oad-dot {
    margin-right: 8px;
    vertical-align: -.05em;
}

.oad-cross tfoot > * > * {
    font-weight: 700;
    color: var(--oad-ink);
    background: var(--oad-paper-alt);
    border-top: 2px solid var(--oad-line-bold);
}

.oad-cross tfoot .oad-pair-line,
.oad-cross tfoot .oad-pair-dot.is-hi {
    --oad-tone: var(--oad-ink-2);
}

.oad-cohort thead th:not(:first-child) {
    min-width: 10.5rem;
    color: var(--oad-tone, var(--oad-muted));
}

.oad-cohort thead th:last-child {
    color: var(--oad-ink);
}

.oad-co {
    vertical-align: top;
}

.oad-co-v {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: .88rem;
    font-weight: 700;
    color: var(--oad-ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.oad-co-v small {
    margin-right: 4px;
    font-size: .72rem;
    font-weight: 500;
    color: var(--oad-muted);
}

.oad-co-to,
.oad-co-cur {
    display: block;
    font-size: .76rem;
    font-weight: 500;
    color: var(--oad-muted);
}

.oad-co-cur {
    margin-top: 2px;
    font-weight: 700;
    color: var(--oad-brand);
}

.oad-cohort tr.is-current > th {
    box-shadow: inset 4px 0 0 var(--oad-brand);
}

.oad-cohort tr.is-current > * {
    background: color-mix(in srgb, var(--oad-brand) 5%, var(--oad-paper));
}

.oad-cohort tbody td:last-child {
    background: var(--oad-paper-alt);
}

/* ═══════════════════════════════════════════════════════════════════════
   กฎ และตารางหลักฐาน
   ═══════════════════════════════════════════════════════════════════════ */

.oad-rules-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px 28px;
    margin-bottom: 20px;
}

@media (min-width: 1000px) {
    .oad-rules-grid {
        grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    }
}

.oad-rules {
    display: grid;
    gap: 8px;
    counter-reset: oad-rule;
}

.oad-rules li {
    position: relative;
    padding: 10px 14px 10px 50px;
    font-size: .92rem;
    line-height: 1.65;
    color: var(--oad-ink-2);
    background: var(--oad-paper-alt);
    border-radius: 12px;
    counter-increment: oad-rule;
}

.oad-rules li::before {
    content: counter(oad-rule);
    position: absolute;
    left: 12px;
    top: 10px;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    font-weight: 700;
    color: var(--oad-brand);
    background: var(--oad-paper);
    border: 2px solid var(--oad-brand);
    border-radius: 50%;
}

.oad-rules b {
    color: var(--oad-ink);
}

.oad-defs {
    display: grid;
    gap: 8px;
}

.oad-defs > div {
    padding: 0 0 8px 12px;
    border-left: 3px solid var(--oad-brand-line);
    border-bottom: 1px solid var(--oad-line);
}

.oad-defs dt {
    font-size: .9rem;
    font-weight: 700;
    color: var(--oad-ink);
}

.oad-defs dd {
    margin: 2px 0 0;
    font-size: .86rem;
    line-height: 1.65;
    color: var(--oad-ink-2);
}

.oad-rule-t tbody th {
    min-width: 11rem;
}

.oad-rule-t td {
    min-width: 10rem;
    font-size: .88rem;
    line-height: 1.6;
}

.oad-rule-t tr.is-hit > th {
    box-shadow: inset 4px 0 0 var(--oad-brand);
}

.oad-evid th,
.oad-evid td {
    white-space: nowrap;
}

.oad-evid td:nth-last-child(-n+3) {
    white-space: normal;
    min-width: 9rem;
}

.oad-evid small {
    font-size: .74rem;
    color: var(--oad-muted);
}

.oad-evid .oad-stick-a,
.oad-evid .oad-stick-b {
    position: sticky;
    z-index: 2;
    background: var(--oad-paper);
}

.oad-evid thead .oad-stick-a,
.oad-evid thead .oad-stick-b {
    background: var(--oad-paper-alt);
}

.oad-evid .oad-stick-a {
    left: 0;
    width: 3.6rem;
    min-width: 3.6rem;
}

.oad-evid .oad-stick-b {
    left: 3.6rem;
    box-shadow: 1px 0 0 var(--oad-line);
}

.oad-evid tr.act-urgent > .oad-stick-a {
    box-shadow: inset 4px 0 0 var(--oad-a-urgent);
}

.oad-evid tr.act-watch > .oad-stick-a {
    box-shadow: inset 4px 0 0 var(--oad-a-watch);
}

.oad-sg.is-up {
    color: var(--oad-up);
}

.oad-sg.is-down {
    color: var(--oad-down);
    font-weight: 700;
}

/* ปุ่มทางลัดของหน้านี้มีหกปุ่ม ย่อลงให้อยู่แถวเดียวบนจอ 1366 */
.oad-hero-main .oad-acts {
    gap: .45rem;
}

.oad-hero-main .oad-acts .oad-btn {
    min-height: 2.6rem;
    padding: 0 .85rem;
    font-size: .92rem;
}

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

@media (max-width: 1099.98px) {
    .oad-stats[data-n="6"] {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1023.98px) {
    .oad-watermark {
        left: auto;
        right: -1rem;
        bottom: auto;
        top: 1rem;
        font-size: clamp(6rem, 3rem + 14vw, 10rem);
    }
}

/* การ์ดกระจกบนแท็บเล็ต: วิชาอันดับหนึ่งเต็มแถว ม.3 กับ ม.6 | รุ่นล่าสุด คู่กันแถวล่าง */
@media (min-width: 640px) and (max-width: 1023.98px) {
    .oad-glance {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 22px;
    }

    .oad-glance-sec:first-child {
        grid-column: 1 / -1;
    }

    .oad-glance-sec:nth-child(3) {
        padding-top: 14px;
        padding-left: 22px;
        border-left: 1px solid rgba(255, 255, 255, .16);
    }
}

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

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

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

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

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

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

    .oad-card {
        padding: 14px 12px 12px 16px;
    }

    .oad-card-h {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .oad-card-h .oad-act {
        grid-column: 2;
        justify-self: start;
    }

    .oad-table th,
    .oad-table td {
        padding: 8px 10px;
    }

    .oad-clar {
        margin-left: 0;
    }
}

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

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

    .oad-pick-k {
        min-width: 0;
        flex-basis: 100%;
    }

    .oad-peers li {
        grid-template-columns: 4.6rem minmax(0, 1fr) 4.8rem;
        gap: 8px;
    }
}

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

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

    .oad-chips.is-years {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(4.4rem, 1fr));
        width: 100%;
    }

    .oad .oad-chips.is-years .oad-chip {
        justify-content: center;
        padding: 0 8px;
    }

    .oad .oad-top-a {
        grid-template-columns: minmax(0, 1fr);
    }

    .oad-top-a .oad-tile {
        grid-auto-flow: column;
        justify-content: start;
        align-items: baseline;
        gap: 8px;
        min-width: 0;
        padding: 12px 16px;
    }
}

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

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

    to {
        transform: none;
    }
}

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

    to {
        transform: none;
    }
}

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

    to {
        transform: none;
    }
}

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

    to {
        transform: none;
    }
}

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

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

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

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

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

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

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

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

.oad-motion [data-oad-reveal] {
    transition: transform .75s var(--oad-spring), border-color .2s var(--oad-ease), box-shadow .2s var(--oad-ease);
}

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

.oad-motion [data-oad-reveal] .oad-stat,
.oad-motion [data-oad-reveal] .oad-card {
    transition: transform .6s var(--oad-spring), border-color .2s var(--oad-ease), box-shadow .2s var(--oad-ease);
}

.oad-motion [data-oad-reveal] .oad-stat {
    transition-delay: calc(var(--k, 0) * 45ms + 100ms);
}

.oad-motion [data-oad-reveal] .oad-card:nth-child(2) {
    transition-delay: .06s;
}

.oad-motion [data-oad-reveal] .oad-card:nth-child(3) {
    transition-delay: .12s;
}

.oad-motion [data-oad-reveal] .oad-card:nth-child(n+4) {
    transition-delay: .18s;
}

.oad-motion [data-oad-reveal]:not(.is-in) :is(.oad-stat, .oad-card) {
    transform: translate3d(0, 16px, 0);
}

/* แถบ: ยืดออกจากเส้นกลางเมื่อเข้ามาในจอ */
.oad-motion [data-oad-reveal] :is(.oad-div-bar, .oad-pair-line) {
    transition: transform 1s var(--oad-spring) .25s;
}

.oad-motion [data-oad-reveal]:not(.is-in) :is(.oad-div-bar, .oad-pair-line) {
    transform: scaleX(0);
}

.oad-motion.oad-arming [data-oad-reveal],
.oad-motion.oad-arming [data-oad-reveal] * {
    transition: none !important;
}

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

    .oad [data-oad-reveal],
    .oad [data-oad-reveal] :is(.oad-stat, .oad-card, .oad-div-bar, .oad-pair-line) {
        transform: none !important;
    }
}

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

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

html.tb1-contrast-high .oad {
    --oad-paper: #000000;
    --oad-paper-alt: #000000;
    --oad-ink: #ffffff;
    --oad-ink-2: #ffffff;
    --oad-muted: #ffffff;
    --oad-line: #ffffff;
    --oad-line-bold: #ffffff;
    --oad-brand: #ffffff;
    --oad-brand-soft: #000000;
    --oad-brand-line: #ffffff;
    --oad-primary: #000000;
    --oad-shadow: none;
    --oad-shadow-float: none;
    --oad-on-hero-2: #ffffff;
    --oad-gold-text: #facc15;
    --oad-up: #ffffff;
    --oad-down: #facc15;
    --oad-warn: #facc15;
    --oad-nation: #ffffff;
    --oad-s-thai: #ffffff;
    --oad-s-math: #ffffff;
    --oad-s-sci: #ffffff;
    --oad-s-eng: #ffffff;
    --oad-s-social: #ffffff;
    --oad-s-other: #ffffff;
    --oad-a-urgent: #facc15;
    --oad-a-watch: #facc15;
    --oad-a-hold: #ffffff;
    --oad-a-unknown: #ffffff;
}

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

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

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

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

html.tb1-contrast-high .oad :where(.oad-tag, .oad-glance, .oad-tile, .oad-stats, .oad-stat-ic, .oad-panel, .oad-panel-head,
    .oad-panel-ic, .oad-note, .oad-note-ic, .oad-scroll, .oad-table th, .oad-table td, .oad-flag, .oad-card, .oad-fact,
    .oad-advice, .oad-rules li, .oad-foot, .oad-chip-n, .oad-div, .oad-record li, .oad-clar, .oad-act, .oad-cohort-d) {
    background: #000000 !important;
    border-color: #ffffff !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

html.tb1-contrast-high .oad :where(.oad-glance, .oad-panel, .oad-note, .oad-flag, .oad-foot, .oad-scroll, .oad-card,
    .oad-tile, .oad-stat-ic, .oad-panel-ic, .oad-note-ic, .oad-advice, .oad-div) {
    border: 1px solid #ffffff !important;
}

/* สิ่งที่ต้องจัดการ: กรอบเหลืองหนา */
html.tb1-contrast-high .oad .oad-note.is-warn,
html.tb1-contrast-high .oad .oad-flag:not(.is-info),
html.tb1-contrast-high .oad .oad-card.act-urgent,
html.tb1-contrast-high .oad .oad-card.act-watch,
html.tb1-contrast-high .oad .oad-record li.is-down,
html.tb1-contrast-high .oad .oad-fact.is-bad {
    border: 3px solid #facc15 !important;
}

html.tb1-contrast-high .oad .oad-fact.is-noise,
html.tb1-contrast-high .oad .oad-record li.is-none,
html.tb1-contrast-high .oad .oad-clar.is-noise {
    border-style: dashed !important;
}

html.tb1-contrast-high .oad .oad-tag.is-warn,
html.tb1-contrast-high .oad .oad-tag.is-warn *,
html.tb1-contrast-high .oad .oad-act.act-urgent,
html.tb1-contrast-high .oad .oad-act.act-watch {
    color: #facc15 !important;
    border-color: #facc15 !important;
}

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

html.tb1-contrast-high .oad .oad-tile * {
    color: #ffffff !important;
}

html.tb1-contrast-high .oad .oad-top-a.is-below .oad-tile * {
    color: #facc15 !important;
}

/* ลิงก์และปุ่มที่มีกรอบของตัวเอง: พื้นดำ ขอบเหลือง ชี้แล้วกลับสี */
html.tb1-contrast-high .oad :where(a.oad-btn, button.oad-btn, a.oad-chip, a.oad-top-a, button.oad-tab) {
    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 .oad :where(a.oad-btn, button.oad-btn, a.oad-chip, a.oad-top-a, button.oad-tab) * {
    color: #facc15 !important;
}

/* ตัวที่กำลังถูกเลือก: กรอบหนากว่า (ไฟล์กลางทำทุกปุ่มเหมือนกันหมด) */
html.tb1-contrast-high .oad a.oad-chip[aria-current="page"],
html.tb1-contrast-high .oad button.oad-tab[aria-selected="true"] {
    border-width: 4px !important;
    text-decoration: underline;
}

html.tb1-contrast-high .oad :where(a.oad-btn, button.oad-btn, a.oad-chip, a.oad-top-a, button.oad-tab):hover,
html.tb1-contrast-high .oad :where(a.oad-btn, button.oad-btn, a.oad-chip, a.oad-top-a, button.oad-tab):hover * {
    color: #000000 !important;
    background: #facc15 !important;
    border-color: #facc15 !important;
}

/* ตัวเลขเตือนในชิประดับชั้นมีกฎสีเหลืองที่เจาะจงกว่า ต้องกลับสีตามชิปตอนชี้ด้วย */
html.tb1-contrast-high .oad a.oad-chip:hover .oad-chip-n,
html.tb1-contrast-high .oad a.oad-chip:hover .oad-chip-n.is-warn {
    color: #000000 !important;
    background: #facc15 !important;
}

html.tb1-contrast-high .oad a.oad-top-a:hover .oad-tile,
html.tb1-contrast-high .oad a.oad-top-a:hover .oad-tile * {
    color: #000000 !important;
    background: #facc15 !important;
}

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

html.tb1-contrast-high .oad .oad-div-bar.is-up,
html.tb1-contrast-high .oad .oad-div.is-glass .oad-div-bar.is-up {
    background: #ffffff !important;
}

html.tb1-contrast-high .oad .oad-div-bar.is-down,
html.tb1-contrast-high .oad .oad-div.is-glass .oad-div-bar.is-down {
    background: repeating-linear-gradient(135deg, #facc15 0 3px, #000000 3px 6px) !important;
}

html.tb1-contrast-high .oad .oad-div-z {
    background: #ffffff !important;
}

html.tb1-contrast-high .oad .oad-q-urgent,
html.tb1-contrast-high .oad .oad-q-lbg.is-urgent {
    fill: #222222;
}

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

/* ═══════════════════════════════════════════════════════════════════════
   ฉบับพิมพ์: หัวใบ การ์ดสรุป บัตรลำดับ ตารางส่วนต่างเทียบประเทศ ผัง ม.3 กับ ม.6 รุ่น กฎ ตารางหลักฐาน
   ═══════════════════════════════════════════════════════════════════════ */
@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

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

    /* ส่วนท้ายเว็บ (เมนู ที่อยู่ แผนที่) ไม่ใช่ส่วนของเอกสาร เฉพาะตอนพิมพ์หน้านี้ */
    body.oad-page .premium-footer,
    body.oad-page a.oad-skip,
    .oad-hero-fx,
    .oad-hero::before,
    .oad-hero::after,
    .oad-acts,
    .oad-pick,
    .oad-tabs,
    .oad-glance-note a,
    .oad-panel-ic,
    .oad-foot li:last-child {
        display: none !important;
    }

    /* ตารางส่วนต่างรายปี: พิมพ์เฉพาะที่เลือกอยู่ (ไม่มีสคริปต์ = พิมพ์ทุกคู่เทียบ) */
    .oad-hm-panel[hidden] {
        display: none !important;
    }

    /* บนกระดาษไม่มีแท็บ หัวตารางต้องกลับมาบอกว่าเทียบกับใคร */
    .oad .oad-hm-h.sr-only {
        position: static;
        width: auto;
        height: auto;
        margin: 0 0 6px;
        overflow: visible;
        clip: auto;
        clip-path: none;
        white-space: normal;
    }

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

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

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

    .oad-hero-top {
        display: block;
    }

    .oad-tags {
        margin-bottom: 6px;
    }

    .oad-tag,
    .oad-tag.is-warn {
        color: #000000;
        background: none;
        border-color: #6b7280;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

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

    .oad-title {
        font-size: 1.7rem;
    }

    .oad-lead {
        margin-top: 4px;
        font-size: .84rem;
    }

    .oad-glance {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
        margin-top: 10px;
        padding: 10px 12px;
        color: #000000;
        background: none;
        border: 1px solid #6b7280;
        border-radius: 10px;
        box-shadow: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        break-inside: avoid;
    }

    .oad-glance-sec:first-child {
        grid-column: auto;
    }

    .oad-glance-sec + .oad-glance-sec {
        padding-top: 0;
        padding-left: 12px;
        border-top: 0;
        border-left: 1px solid #9ca3af;
    }

    .oad-glance-k,
    .oad-duo b,
    .oad-cohort-line b,
    .oad-top-t > b,
    .oad-top-t > span:first-of-type,
    .oad-glance-more b,
    .oad-cohort-d {
        color: #000000;
    }

    .oad-glance-k {
        margin-bottom: 6px;
        font-size: .9rem;
    }

    .oad .oad-top-a {
        display: block;
        padding: 0;
        color: #000000;
        background: none;
        border: 0;
    }

    .oad-tile {
        justify-content: start;
        grid-auto-flow: column;
        align-items: baseline;
        gap: 6px;
        min-width: 0;
        padding: 0;
        color: #000000 !important;
        background: none !important;
        box-shadow: none;
    }

    .oad-tile b {
        font-size: 1.5rem;
    }

    .oad-top-t {
        margin-top: 4px;
    }

    .oad-div.is-glass {
        background: #e5e7eb;
    }

    .oad-div.is-glass .oad-div-z {
        background: #000000;
    }

    .oad-div.is-glass .oad-div-bar.is-up {
        background: #1f2937;
    }

    .oad-div.is-glass .oad-div-bar.is-down {
        background: repeating-linear-gradient(135deg, #1f2937 0 2px, #ffffff 2px 4px);
        outline: 1px solid #1f2937;
    }

    .oad-cohort-d {
        background: none;
        border-color: #6b7280;
    }

    .oad-band {
        margin-top: 10px;
    }

    .oad-stats,
    .oad-stats[data-n] {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        background: none;
        border: 1px solid #6b7280;
        border-radius: 10px;
        box-shadow: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        break-inside: avoid;
    }

    .oad-stat {
        gap: 2px;
        padding: 6px 8px;
        box-shadow: -1px 0 0 0 #9ca3af;
    }

    .oad-stat-ic {
        display: none;
    }

    .oad-stat-k,
    .oad-stat-v,
    .oad-stat-s {
        font-size: .7rem;
        color: #1f2937;
    }

    .oad-stat-v b,
    .oad-stat.is-warn .oad-stat-v b {
        font-size: 1.15rem;
        color: #000000;
    }

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

    .oad-body > * + *,
    .oad-duet > * + * {
        margin-top: 12px;
    }

    .oad-duet {
        display: block;
    }

    .oad-panel,
    .oad-note,
    .oad-foot {
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .oad-panel-head {
        padding: 4px 0;
        background: none;
        border: 0;
        border-bottom: 1.5px solid #000000;
        border-radius: 0;
        /* หัวข้อไม่ค้างท้ายหน้าโดยไม่มีเนื้อหาตาม */
        break-after: avoid;
        page-break-after: avoid;
    }

    .oad-panel-body > .oad-lede:first-child {
        break-before: avoid;
        page-break-before: avoid;
    }

    .oad-panel-title {
        font-size: 1.02rem;
    }

    .oad-panel-body {
        padding: 8px 0 0;
    }

    .oad-lede {
        margin-bottom: 8px;
        font-size: .8rem;
    }

    /* ★ หน้า A4 กว้างไม่ถึง 760px กฎจอแคบทำงานตอนพิมพ์ ต้องยืนยันหัวบัตรเป็นแถวเดียว */
    .oad-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .oad-card {
        gap: 6px;
        padding: 8px 8px 8px 12px;
        border-color: #9ca3af;
        break-inside: avoid;
    }

    .oad-card-h {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .oad-card-h .oad-act {
        grid-column: auto;
    }

    .oad-rank {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }

    .oad-card-t h3 {
        font-size: 1rem;
    }

    .oad-card-s,
    .oad-advice,
    .oad-peers li {
        font-size: .72rem;
    }

    .oad-fact {
        padding: 4px 6px;
    }

    .oad-fact dd b {
        font-size: .9rem;
    }

    .oad-fact dt,
    .oad-fact dd span {
        font-size: .64rem;
    }

    .oad-facts {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px;
    }

    .oad-advice {
        padding: 4px 8px;
    }

    .oad-scroll {
        overflow: visible;
        border-color: #9ca3af;
    }

    .oad-table {
        font-size: .72rem;
    }

    .oad-table th,
    .oad-table td {
        padding: 3px 6px;
    }

    .oad-hmt thead th.oad-num,
    .oad-cohort thead th:not(:first-child),
    .oad-pair-c,
    .oad-hm-name,
    .oad-rule-t tbody th,
    .oad-rule-t td,
    .oad-evid td:nth-last-child(-n+3) {
        min-width: 0;
    }

    .oad-evid th,
    .oad-evid td {
        white-space: normal;
    }

    .oad-hmt .oad-hm-name,
    .oad-evid .oad-stick-a,
    .oad-evid .oad-stick-b {
        position: static;
    }

    .oad-quad {
        max-width: 30rem;
        overflow: visible;
    }

    .oad-quad .oad-q-svg {
        min-width: 0;
    }

    .oad-quad-panel,
    .oad-cross-panel,
    .oad-rules-grid > div,
    .oad-table tbody tr,
    .oad-foot {
        break-inside: avoid;
    }

    .oad-foot {
        padding: 8px 0 0;
        border-top: 1px solid #9ca3af;
    }

    .oad-foot li {
        font-size: .72rem;
    }

    /* สีที่เป็นข้อมูลต้องติดกระดาษ */
    .oad-div,
    .oad-div-bar,
    .oad-div-z,
    .oad-dot,
    .oad-card,
    .oad-rank,
    .oad-record li,
    .oad-fact,
    .oad-pair,
    .oad-pair-dot,
    .oad-pair-line,
    .oad-hmt .is-sel,
    .oad-cohort tr.is-current > *,
    .oad-key {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

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

    .oad .oad-pair-dot.is-hi {
        transform: rotate(45deg) scale(.86) !important;
    }
}
