/* =========================================================
   MyPrograme — Design System
   CSS variable ชุดเดียว คุมทั้งโหมดมืดและโหมดสว่าง
   สลับด้วย [data-theme="light"] บน <html>
   ========================================================= */

/* ---------- 1. Tokens ---------- */
:root {
    /* พื้นผิว */
    --bg: #0a0d14;
    --bg-glow: #101a33;
    --surface: #111826;
    --surface-2: #161f31;
    --surface-3: #1c2739;
    --border: #212c40;
    --border-strong: #2e3d57;

    /* ตัวอักษร */
    --text: #eaf0fa;
    --text-dim: #97a5be;
    --text-mute: #64748b;

    /* แบรนด์ */
    --brand: #4c6fff;
    --brand-hi: #6d8bff;
    --brand-soft: rgba(76, 111, 255, .14);
    --brand-line: rgba(76, 111, 255, .38);

    /* accent = ปุ่มดาวน์โหลด / สัญญาณ "ฟรี ปลอดภัย" */
    --accent: #21d4a4;
    --accent-hi: #3ae9bb;
    --accent-soft: rgba(33, 212, 164, .13);
    --accent-ink: #04231b;

    --warn: #ffb020;
    --danger: #ff5a65;
    --danger-soft: rgba(255, 90, 101, .12);

    /* เงา */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 8px 24px -8px rgba(0, 0, 0, .6);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .75);
    --ring: 0 0 0 3px rgba(76, 111, 255, .35);

    /* รูปทรง */
    --r-xs: 8px;
    --r-sm: 10px;
    --r: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --r-pill: 999px;

    /* ระยะ */
    --wrap: 1200px;
    --gutter: 20px;

    /* ฟอนต์ */
    --font: 'IBM Plex Sans Thai', 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Anuphan', 'IBM Plex Sans Thai', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Code', monospace;

    --ease: cubic-bezier(.22, .61, .36, 1);
    --dur: .22s;

    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #f4f6fb;
    --bg-glow: #dbe4ff;
    --surface: #ffffff;
    --surface-2: #f7f9fd;
    --surface-3: #eef2f9;
    --border: #e2e8f3;
    --border-strong: #cbd5e8;

    --text: #0f1729;
    --text-dim: #55637a;
    --text-mute: #8593aa;

    --brand: #2f53e6;
    --brand-hi: #4468f5;
    --brand-soft: rgba(47, 83, 230, .09);
    --brand-line: rgba(47, 83, 230, .25);

    --accent: #0d9e7a;
    --accent-hi: #0bb389;
    --accent-soft: rgba(13, 158, 122, .1);
    --accent-ink: #ffffff;

    --warn: #b76e00;
    --danger: #d92d3d;
    --danger-soft: rgba(217, 45, 61, .08);

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 10px 28px -12px rgba(16, 24, 40, .22);
    --shadow-lg: 0 24px 56px -22px rgba(16, 24, 40, .3);
    --ring: 0 0 0 3px rgba(47, 83, 230, .22);

    color-scheme: light;
}

/* ---------- 2. Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
}

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.7;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -.01em;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

ul,
ol {
    list-style: none;
}

:focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-radius: var(--r-xs);
}

::selection {
    background: var(--brand);
    color: #fff;
}

/* scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--r-pill);
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-mute);
}

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 200;
    background: var(--brand);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--r-sm);
    transition: top var(--dur) var(--ease);
}

.skip-link:focus {
    top: 12px;
}

/* ---------- 3. Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.site-header::after {
    content: '';
    position: absolute;
    inset: auto 0 -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brand-line), transparent);
}

.header-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    height: 68px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.brand img {
    height: 38px;
    width: auto;
    object-fit: contain;
    transition: transform var(--dur) var(--ease);
}

.brand:hover img {
    transform: scale(1.04);
}

.brand-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -.02em;
    white-space: nowrap;
}

.brand-text b {
    color: var(--brand);
}

/* ช่องค้นหาบนแถบหัว */
.header-search {
    flex: 1;
    max-width: 520px;
    margin-inline: auto;
}

.search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.search-field .fa-magnifying-glass,
.search-field .fa-search {
    position: absolute;
    left: 16px;
    font-size: .95rem;
    color: var(--text-mute);
    pointer-events: none;
    transition: color var(--dur) var(--ease);
}

.search-field input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    padding: 11px 106px 11px 44px;
    color: var(--text);
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.search-field input::placeholder {
    color: var(--text-mute);
}

.search-field input:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--surface);
    box-shadow: var(--ring);
}

.search-field:focus-within .fa-magnifying-glass,
.search-field:focus-within .fa-search {
    color: var(--brand);
}

.search-field button {
    position: absolute;
    right: 5px;
    border: 0;
    cursor: pointer;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    padding: 8px 18px;
    border-radius: var(--r-pill);
    transition: background-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.search-field button:hover {
    background: var(--brand-hi);
    transform: translateX(-1px);
}

/* ปุ่มค้นหาบนแถบหัว: จอกว้างโชว์คำว่า "ค้นหา" จอแคบเหลือแค่ไอคอน */
.header-search .search-field button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.header-search .search-field button i {
    display: none;
    font-size: .82rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-links a {
    padding: 8px 14px;
    border-radius: var(--r-sm);
    font-size: .95rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
    color: var(--text);
    background: var(--surface-2);
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-dim);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
}

.icon-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface-3);
}

.theme-toggle .fa-sun {
    display: none;
}

[data-theme="light"] .theme-toggle .fa-sun {
    display: block;
}

[data-theme="light"] .theme-toggle .fa-moon {
    display: none;
}

.menu-btn {
    display: none;
}

/* เมนูมือถือ */
.mobile-menu {
    display: none;
    border-top: 1px solid var(--border);
    padding: 12px var(--gutter) 18px;
    background: var(--surface);
}

.mobile-menu.open {
    display: block;
}

@media (min-width: 881px) {

    .mobile-menu,
    .mobile-menu.open {
        display: none;
    }
}

.mobile-menu .search-field {
    margin-bottom: 12px;
}

.mobile-menu nav {
    display: grid;
    gap: 2px;
}

.mobile-menu nav a {
    padding: 11px 14px;
    border-radius: var(--r-sm);
    color: var(--text-dim);
    font-weight: 500;
}

.mobile-menu nav a:hover,
.mobile-menu nav a[aria-current="page"] {
    background: var(--surface-2);
    color: var(--text);
}

/* ปุ่มสลับธีมในเมนูมือถือ — โผล่เฉพาะจอแคบมากที่ซ่อนปุ่มบนแถบหัวไปแล้ว */
.menu-theme {
    display: none;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 14px 14px 11px;
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-dim);
    font-weight: 500;
    cursor: pointer;
    margin-top: 4px;
}

.menu-theme i {
    width: 16px;
    text-align: center;
}

.menu-theme:hover {
    background: var(--surface-2);
    color: var(--text);
}

/* ---------- 4. Hero ---------- */
.hero {
    position: relative;
    padding: 64px 0 52px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.hero::before {
    content: '';
    position: absolute;
    top: -320px;
    left: 50%;
    width: 900px;
    height: 620px;
    transform: translateX(-50%);
    background: radial-gradient(closest-side, var(--bg-glow), transparent 72%);
    opacity: .75;
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000, transparent 75%);
    opacity: .5;
    pointer-events: none;
}

.hero-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 780px;
    margin-inline: auto;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 8px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    font-size: .85rem;
    font-weight: 500;
    margin-bottom: 22px;
}

.eyebrow .dot {
    width: 20px;
    height: 20px;
    border-radius: var(--r-pill);
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .65rem;
}

.hero h1 {
    font-size: clamp(1.9rem, 5.2vw, 3.05rem);
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.22;
    margin-bottom: 16px;
}

.hero h1 .hl {
    position: relative;
    color: var(--brand);
    white-space: nowrap;
}

.hero h1 .hl::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: .06em;
    height: .28em;
    background: var(--brand-soft);
    border-radius: 3px;
    z-index: -1;
}

.hero p.lede {
    font-size: clamp(.98rem, 2.2vw, 1.1rem);
    color: var(--text-dim);
    max-width: 620px;
    margin: 0 auto 30px;
}

.hero-search {
    max-width: 620px;
    margin: 0 auto;
}

.hero-search .search-field input {
    padding: 16px 132px 16px 50px;
    font-size: 1.02rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.hero-search .search-field button {
    padding: 11px 22px;
    right: 6px;
}

.hero-search .fa-magnifying-glass,
.hero-search .fa-search {
    left: 20px;
    font-size: 1rem;
}

/* สถิติ */
.hero-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 40px;
    margin-top: 30px;
}

.hero-stats li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: var(--text-mute);
    font-size: .92rem;
}

.hero-stats b {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.02em;
}

/* ---------- 5. หมวดหมู่ (chips) ---------- */
.cat-bar {
    position: sticky;
    top: 68px;
    z-index: 60;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

/* ไล่สีจางที่ขอบขวา เป็นสัญญาณว่ายังเลื่อนต่อได้ */
.cat-bar .wrap {
    position: relative;
}

.cat-bar .wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 56px;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--bg));
    pointer-events: none;
}

.chips {
    display: flex;
    gap: 8px;
    padding: 14px 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    font-size: .92rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all var(--dur) var(--ease);
}

.chip i {
    font-size: .88rem;
    opacity: .8;
}

.chip .n {
    font-size: .78rem;
    color: var(--text-mute);
    background: var(--surface-3);
    padding: 1px 7px;
    border-radius: var(--r-pill);
}

.chip:hover {
    color: var(--text);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.chip.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.chip.active i {
    opacity: 1;
}

.chip.active .n {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

/* ---------- 6. Section ---------- */
.section {
    padding: 54px 0;
}

.section.tight {
    padding: 38px 0;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 26px;
}

.section-head h2 {
    font-size: clamp(1.3rem, 3.2vw, 1.7rem);
    font-weight: 700;
    letter-spacing: -.025em;
    display: flex;
    align-items: center;
    gap: 11px;
}

.section-head h2 .ico {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    background: var(--brand-soft);
    color: var(--brand);
    font-size: .92rem;
}

.section-head p {
    color: var(--text-mute);
    font-size: .92rem;
    margin-top: 3px;
}

.section-head .link {
    color: var(--brand);
    font-weight: 500;
    font-size: .94rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.section-head .link:hover {
    gap: 10px;
}

.section-head .link i {
    transition: transform var(--dur) var(--ease);
}

/* ---------- 7. การ์ดโปรแกรม ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 18px;
}

.grid.cols-3 {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px;
    overflow: hidden;
    transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brand-line), transparent);
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

.card:hover::before {
    opacity: 1;
}

.card-top {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}

/* ไอคอนโปรแกรม */
.thumb {
    position: relative;
    width: 66px;
    height: 66px;
    flex-shrink: 0;
    border-radius: var(--r);
    background: var(--surface-3);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 9px;
    transition: transform .35s var(--ease);
}

.thumb i {
    font-size: 1.5rem;
    color: var(--text-mute);
}

.thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, .12), transparent 55%);
    pointer-events: none;
}

.card:hover .thumb img {
    transform: scale(1.09);
}

.card-heading {
    min-width: 0;
    flex: 1;
}

.card h3 {
    font-size: 1.03rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 7px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--dur) var(--ease);
}

.card:hover h3 {
    color: var(--brand);
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .74rem;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.tag.hot {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: transparent;
}

.tag.new {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: transparent;
}

.tag.brand {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: transparent;
}

.card p.desc {
    color: var(--text-dim);
    font-size: .89rem;
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
    flex: 1;
}

.card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.meta {
    display: flex;
    gap: 14px;
    font-size: .8rem;
    color: var(--text-mute);
}

.meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.meta i {
    font-size: .78rem;
    opacity: .75;
}

.get {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .86rem;
    font-weight: 600;
    color: var(--accent);
    padding: 6px 13px;
    border-radius: var(--r-pill);
    background: var(--accent-soft);
    transition: all var(--dur) var(--ease);
}

.card:hover .get {
    background: var(--accent);
    color: var(--accent-ink);
}

/* การ์ดยอดนิยม — มีเลขอันดับ */
.card.featured {
    background: linear-gradient(160deg, var(--surface-2), var(--surface));
}

.rank {
    position: absolute;
    top: -14px;
    right: 6px;
    font-family: var(--font-display);
    font-size: 4.4rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
    opacity: .05;
    pointer-events: none;
    user-select: none;
}

/* =========================================================
   7b. บล็อกโชว์เคสโปรแกรม — แบนเนอร์แบ่งซ้าย/ขวา + แถวเลื่อนแนวนอน
   ========================================================= */
.showcase {
    padding: 54px 0 6px;
}

/* พื้นสีสำรองเวลายังไม่ได้ใส่รูป */
.art-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

/* ---------------------------------------------------------------
   รูปโปรแกรมส่วนใหญ่เป็นโลโก้จัตุรัส ไม่ใช่ภาพปก
   ถ้าครอปเต็มกรอบ 2:3 หรือ 16:9 จะโดนตัดหัวท้ายจนเละ
   ตัวที่มีคลาส is-icon จึงแสดงแบบ contain พร้อมขอบหายใจแทน
   --------------------------------------------------------------- */
.sc-rank .art img.is-icon,
.sc-wide .art img.is-icon,
.sc-mini .th img.is-icon {
    object-fit: contain;
    padding: 14%;
}

.sc-wide .art img.is-icon {
    padding: 9%;
}

.sc-mini .th img.is-icon {
    padding: 12%;
}

/* กล่องที่ใส่โลโก้ ให้พื้นนวลขึ้นนิด จะได้ไม่ดูเป็นช่องว่างเปล่า */
.sc-rank .art,
.sc-wide .art,
.sc-mini .th {
    background:
        radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--brand) 7%, transparent), transparent 70%),
        var(--surface-3);
}

/* ช่องแนวนอนที่มีแค่โลโก้ — ใช้โลโก้เบลอเป็นพื้นหลัง ให้ได้โทนสีกลมกลืนกับตัวโลโก้
   ใช้ทั้งแบนเนอร์ใหญ่และการ์ดแถว 16:9 */
.art-icon-hero {
    position: absolute;
    inset: 0;
    display: block;
    overflow: hidden;
    background: var(--surface-2);
}

.sc-hero-art .art-icon-hero .bg,
.sc-wide .art .art-icon-hero .bg {
    position: absolute;
    inset: -12%;
    width: 124%;
    height: 124%;
    object-fit: cover;
    opacity: .45;
    filter: blur(34px) saturate(150%);
    transform: scale(1.1);
}

.sc-hero-art .art-icon-hero .fg,
.sc-wide .art .art-icon-hero .fg {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    max-width: 46%;
    max-height: 62%;
    object-fit: contain;
    filter: drop-shadow(0 14px 30px rgba(15, 23, 41, .3));
    transition: transform .5s var(--ease);
}

/* แบนเนอร์ใหญ่มีตัวหนังสืออยู่ฝั่งซ้าย เลยดันโลโก้ไปไว้ขวา */
.sc-hero-art .art-icon-hero .bg {
    filter: blur(50px) saturate(150%);
    opacity: .5;
}

.sc-hero-art .art-icon-hero .fg {
    left: auto;
    right: 7%;
    transform: translateY(-50%);
    max-width: min(32%, 230px);
    max-height: 64%;
}

.sc-wide .sc-item:hover .art-icon-hero .fg {
    transform: translate(-50%, -50%) scale(1.06);
}

@media (max-width: 880px) {

    /* จอเล็ก แบนเนอร์เตี้ยลงและข้อความย้ายไปอยู่ใต้รูป จัดโลโก้ไว้กลางแทน */
    .sc-hero-art .art-icon-hero .fg {
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%);
        max-width: min(44%, 190px);
        max-height: 70%;
    }
}

.art-fallback b {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, .82);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ---------- hero แบ่งสองฝั่ง ---------- */
.sc-split {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 18px;
    margin-bottom: 44px;
}

.sc-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
    background: var(--surface-2);
    box-shadow: var(--shadow);
    min-height: 400px;
}

.sc-hero-art {
    position: absolute;
    inset: 0;
}

.sc-hero-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sc-hero-art::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(15deg,
            color-mix(in srgb, var(--surface) 96%, transparent) 8%,
            color-mix(in srgb, var(--surface) 82%, transparent) 40%,
            transparent 80%);
}

.sc-hero-body {
    position: relative;
    z-index: 1;
    height: 100%;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 13px;
    padding: 36px 40px;
    /* กันตัวหนังสือวิ่งไปทับรูป/โลโก้ที่วางอยู่ฝั่งขวา */
    max-width: 66%;
}

.sc-hero-body h3 {
    font-size: clamp(1.5rem, 3.2vw, 2.35rem);
    font-weight: 700;
    letter-spacing: -.035em;
    line-height: 1.15;
}

.sc-hero-body .sum {
    color: var(--text-dim);
    font-size: .95rem;
    max-width: 470px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sc-flag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    font-size: .78rem;
    font-weight: 700;
    padding: 5px 13px;
    border-radius: var(--r-pill);
    background: var(--danger);
    color: #fff;
    letter-spacing: .04em;
}

.sc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    color: var(--text-dim);
    font-size: .88rem;
}

.sc-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sc-meta .st {
    color: var(--warn);
}

.sc-acts {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 3px;
}

/* ---------- กล่อง Top 3 ฝั่งขวา ---------- */
.sc-side {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.sc-side h3 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 12px;
}

.sc-side h3 i {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: var(--r-xs);
    background: var(--brand-soft);
    color: var(--brand);
    font-size: .78rem;
}

.sc-mini {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 8px;
    border-radius: var(--r);
    transition: background-color var(--dur) var(--ease);
}

.sc-mini:hover {
    background: var(--surface-2);
}

.sc-mini + .sc-mini {
    border-top: 1px solid var(--border);
}

.sc-mini .n {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    width: 38px;
    flex-shrink: 0;
    text-align: center;
    color: transparent;
    -webkit-text-stroke: 2px var(--border-strong);
    transition: all var(--dur) var(--ease);
}

.sc-mini:hover .n {
    -webkit-text-stroke-color: var(--brand);
    color: var(--brand-soft);
}

.sc-mini .th {
    display: block;
    position: relative;
    width: 58px;
    flex: 0 0 58px;
    aspect-ratio: 2 / 3;
    border-radius: var(--r-sm);
    overflow: hidden;
    background: var(--surface-3);
    box-shadow: var(--shadow-sm);
}

.sc-mini .th img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sc-mini .th .art-fallback b {
    font-size: 1rem;
}

.sc-mini .tx {
    min-width: 0;
}

.sc-mini .tx b {
    display: block;
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sc-mini .tx small {
    font-size: .78rem;
    color: var(--text-mute);
}

.sc-side .more {
    margin-top: auto;
    padding-top: 12px;
    text-align: center;
    font-size: .87rem;
    font-weight: 600;
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sc-side .more:hover {
    gap: 10px;
}

/* ---------- แถวเลื่อนแนวนอน ---------- */
.sc-row {
    position: relative;
    margin-bottom: 42px;
}

/* หมายเหตุ: ห้ามใส่ scroll-snap หรือ scroll-behavior:smooth ตรงนี้
   เคยทำให้ Chrome ค้างเวลากดลูกศรเลื่อน เพราะ snap ตีกับ smooth scroll
   ความนุ่มของการเลื่อนสั่งจาก JS ตอนกดปุ่มแทน */
.sc-rail {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding: 8px 10px 10px;
    margin: -8px -10px -10px;
}

.sc-rail::-webkit-scrollbar {
    display: none;
}

.sc-rail > * {
    flex: 0 0 auto;
}

.sc-nav {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    color: var(--text);
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(-50%);
    transition: all var(--dur) var(--ease);
}

.sc-row:hover .sc-nav,
.sc-nav:focus-visible {
    opacity: 1;
}

.sc-nav:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.sc-nav[disabled] {
    opacity: 0 !important;
    pointer-events: none;
}

.sc-nav.prev {
    left: -20px;
}

.sc-nav.next {
    right: -20px;
}

/* ---------- การ์ดอันดับ (เลขใหญ่ + ปกแนวตั้ง) ---------- */
.sc-rank .sc-item {
    display: flex;
    align-items: flex-end;
    width: 262px;
}

.sc-rank {
    gap: 6px;
}

.sc-rank .num {
    font-family: var(--font-display);
    font-size: 9.5rem;
    font-weight: 700;
    line-height: .78;
    letter-spacing: -.07em;
    color: transparent;
    -webkit-text-stroke: 3px var(--border-strong);
    margin-right: -14px;
    user-select: none;
    transition: all .28s var(--ease);
}

.sc-rank .sc-item:hover .num {
    -webkit-text-stroke-color: var(--brand);
    color: var(--brand-soft);
}

.sc-rank .art {
    display: block;
    position: relative;
    width: 150px;
    flex: 0 0 150px;
    aspect-ratio: 2 / 3;
    border-radius: var(--r);
    overflow: hidden;
    background: var(--surface-3);
    box-shadow: var(--shadow);
    transition: all .28s var(--ease);
}

.sc-rank .art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sc-rank .sc-item:hover .art {
    transform: translateY(-8px) scale(1.03);
    box-shadow: var(--shadow-lg);
}

.sc-rank .cap {
    position: absolute;
    inset: auto 0 0;
    padding: 32px 10px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .84));
    color: #fff;
}

.sc-rank .cap b {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sc-rank .cap small {
    font-size: .72rem;
    opacity: .85;
}

/* ---------- การ์ดแนวนอน 16:9 ---------- */
.sc-wide .sc-item {
    width: 288px;
}

.sc-wide .art {
    display: block;
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--r);
    overflow: hidden;
    background: var(--surface-3);
    box-shadow: var(--shadow-sm);
    transition: all .26s var(--ease);
}

.sc-wide .art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s var(--ease);
}

.sc-wide .sc-item:hover .art {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.sc-wide .sc-item:hover .art img {
    transform: scale(1.06);
}

.sc-wide .grab {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 41, .34);
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
}

.sc-wide .sc-item:hover .grab {
    opacity: 1;
}

.sc-wide .grab span {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #fff;
    color: var(--brand);
    display: grid;
    place-items: center;
    font-size: 1.05rem;
    box-shadow: var(--shadow);
}

.sc-wide .tx {
    padding-top: 12px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.sc-wide .tx .t {
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sc-wide .tx .sz {
    font-size: .78rem;
    color: var(--text-mute);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 1px 9px;
    border-radius: var(--r-pill);
    white-space: nowrap;
}

.sc-wide .tx .m {
    font-size: .8rem;
    color: var(--text-mute);
    width: 100%;
    margin-top: 2px;
}

.sc-wide .tx .st {
    color: var(--warn);
}

/* ---------- 8. Empty state ---------- */
.empty {
    text-align: center;
    padding: 70px 20px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-lg);
    background: var(--surface);
}

.empty .ico {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    display: grid;
    place-items: center;
    border-radius: var(--r-lg);
    background: var(--surface-3);
    color: var(--text-mute);
    font-size: 1.7rem;
}

.empty h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.empty p {
    color: var(--text-dim);
    max-width: 420px;
    margin: 0 auto 24px;
    font-size: .95rem;
}

/* ---------- 9. ปุ่ม ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 11px 22px;
    border-radius: var(--r-pill);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: .95rem;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    white-space: nowrap;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-hi);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -10px var(--brand);
}

.btn-ghost {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-dim);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface-3);
}

.btn-lg {
    padding: 15px 28px;
    font-size: 1.05rem;
    width: 100%;
}

.btn-download {
    background: linear-gradient(135deg, var(--accent), var(--accent-hi));
    color: var(--accent-ink);
    box-shadow: 0 12px 28px -12px var(--accent);
    position: relative;
    overflow: hidden;
}

.btn-download::after {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
    transform: skewX(-18deg);
}

.btn-download:hover::after {
    animation: sheen .8s var(--ease);
}

@keyframes sheen {
    to {
        left: 130%;
    }
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px -12px var(--accent);
}

.btn-download:disabled,
.btn-download.waiting {
    background: var(--surface-3);
    color: var(--text-mute);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-download.waiting::after {
    display: none;
}

/* ---------- 10. Pagination ---------- */
.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 42px;
    flex-wrap: wrap;
}

.pager a,
.pager span {
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    display: inline-grid;
    place-items: center;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    font-size: .93rem;
    font-weight: 500;
    transition: all var(--dur) var(--ease);
}

.pager a:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface-2);
}

.pager .current {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.pager .gap {
    border-color: transparent;
    background: transparent;
    color: var(--text-mute);
}

.pager .off {
    opacity: .4;
    pointer-events: none;
}

/* ---------- 11. Breadcrumb ---------- */
.crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: .88rem;
    color: var(--text-mute);
    padding: 20px 0 0;
}

.crumbs a {
    color: var(--text-dim);
    transition: color var(--dur) var(--ease);
}

.crumbs a:hover {
    color: var(--brand);
}

.crumbs i {
    font-size: .65rem;
    opacity: .6;
}

.crumbs .now {
    color: var(--text);
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- 12. หน้ารายละเอียดโปรแกรม ---------- */
.detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 0 28px;
    align-items: start;
    padding: 28px 0 60px;
}

.detail-head {
    grid-column: 1 / -1;
}

.detail-main {
    min-width: 0;
}

.detail-title {
    font-size: clamp(1.5rem, 4vw, 2.15rem);
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.28;
    margin-bottom: 12px;
}

.detail-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    color: var(--text-mute);
    font-size: .88rem;
    margin-bottom: 24px;
}

.detail-sub span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.panel + .panel {
    margin-top: 20px;
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
}

.panel-head i {
    color: var(--brand);
    font-size: .9rem;
}

.panel-head .head-note {
    margin-left: auto;
    font-family: var(--font);
    font-weight: 400;
    font-size: .8rem;
    color: var(--text-mute);
}

/* ---------- แกลเลอรีรูปตัวอย่างโปรแกรม ---------- */
.shots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
    gap: 12px;
}

.shot {
    position: relative;
    display: block;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    background: var(--surface-3);
    cursor: zoom-in;
    aspect-ratio: 16 / 10;
    transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.shot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .45s var(--ease);
}

.shot:hover {
    transform: translateY(-3px);
    border-color: var(--brand);
    box-shadow: var(--shadow);
}

.shot:hover img {
    transform: scale(1.05);
}

.shot .zoom {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 41, .38);
    color: #fff;
    font-size: 1.1rem;
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
}

.shot:hover .zoom,
.shot:focus-visible .zoom {
    opacity: 1;
}

/* ---------- หน้าต่างดูรูปขนาดเต็ม ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(6, 10, 18, .88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.lightbox.open {
    display: flex;
}

.lightbox img {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    border-radius: var(--r);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
    object-fit: contain;
}

.lightbox .lb-close,
.lightbox .lb-prev,
.lightbox .lb-next {
    position: absolute;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .12);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 1.05rem;
    transition: background-color var(--dur) var(--ease);
}

.lightbox .lb-close:hover,
.lightbox .lb-prev:hover,
.lightbox .lb-next:hover {
    background: rgba(255, 255, 255, .26);
}

.lightbox .lb-close {
    top: 18px;
    right: 18px;
}

.lightbox .lb-prev {
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox .lb-next {
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox .lb-count {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, .82);
    font-size: .88rem;
    background: rgba(0, 0, 0, .4);
    padding: 5px 14px;
    border-radius: var(--r-pill);
}

@media (max-width: 640px) {

    .shots {
        grid-template-columns: 1fr 1fr;
        gap: 9px;
    }

    .lightbox {
        padding: 12px;
    }

    .lightbox .lb-prev {
        left: 8px;
    }

    .lightbox .lb-next {
        right: 8px;
    }

    .lightbox .lb-close {
        top: 10px;
        right: 10px;
    }
}

.panel-body {
    padding: 22px;
}

.video {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* เนื้อหา HTML จากหลังบ้าน */
.prose {
    color: var(--text-dim);
    font-size: .97rem;
    line-height: 1.85;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5 {
    color: var(--text);
    margin: 26px 0 12px;
}

.prose h4 {
    font-size: 1.2rem;
}

.prose h5 {
    font-size: 1.03rem;
    color: var(--brand);
}

.prose > :first-child {
    margin-top: 0;
}

.prose p {
    margin-bottom: 14px;
}

.prose ul,
.prose ol {
    margin: 0 0 16px;
    padding-left: 4px;
    list-style: none;
}

.prose li {
    position: relative;
    padding-left: 26px;
    margin-bottom: 9px;
}

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

.prose ol {
    counter-reset: n;
}

.prose ol li {
    counter-increment: n;
}

.prose ol li::before {
    content: counter(n) '.';
    position: absolute;
    left: 0;
    color: var(--brand);
    font-weight: 600;
}

.prose a {
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.prose img {
    border-radius: var(--r);
    margin: 16px 0;
}

.prose strong {
    color: var(--text);
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.prose th,
.prose td {
    border: 1px solid var(--border);
    padding: 9px 12px;
    text-align: left;
}

.prose th {
    background: var(--surface-2);
    color: var(--text);
}

/* กล่องดาวน์โหลด */
.dl-card {
    position: sticky;
    top: 88px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 26px;
    text-align: center;
    box-shadow: var(--shadow);
}

.dl-art {
    width: 128px;
    height: 128px;
    margin: 0 auto 20px;
    border-radius: var(--r-lg);
    background: var(--surface-3);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    overflow: hidden;
    position: relative;
}

.dl-art img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 16px;
}

.dl-art i {
    font-size: 2.4rem;
    color: var(--text-mute);
}

.dl-art::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(140deg, rgba(255, 255, 255, .14), transparent 60%);
}

.dl-note {
    color: var(--text-mute);
    font-size: .82rem;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* รหัสแตกไฟล์ */
.pass-box {
    margin-top: 20px;
    padding: 16px;
    border-radius: var(--r);
    background: var(--surface-2);
    border: 1px dashed var(--border-strong);
}

.pass-box .lbl {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: .82rem;
    color: var(--text-mute);
    margin-bottom: 9px;
}

.pass-val {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pass-val code {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--warn);
}

.copy-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: var(--r-xs);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
}

.copy-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.copy-btn.done {
    color: var(--accent);
    border-color: var(--accent);
}

/* ตารางข้อมูล */
.facts {
    margin-top: 20px;
    border-top: 1px solid var(--border);
}

.facts div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 2px;
    border-bottom: 1px solid var(--border);
    font-size: .88rem;
}

.facts dt {
    color: var(--text-mute);
    display: flex;
    align-items: center;
    gap: 8px;
}

.facts dd {
    color: var(--text);
    font-weight: 500;
    text-align: right;
}

/* ---------- 13. Toast ---------- */
.toast-wrap {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 300;
    display: grid;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 18px;
    border-radius: var(--r);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lg);
    font-size: .92rem;
    max-width: 340px;
    animation: toast-in .28s var(--ease);
}

.toast.out {
    animation: toast-out .25s var(--ease) forwards;
}

.toast i {
    color: var(--accent);
    font-size: 1.05rem;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.97);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* ---------- 14. Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    margin-top: 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr repeat(3, 1fr);
    gap: 40px;
    padding: 54px 0 38px;
}

.footer-brand img {
    height: 42px;
    margin-bottom: 16px;
}

.footer-brand p {
    color: var(--text-dim);
    font-size: .91rem;
    line-height: 1.75;
    max-width: 340px;
}

.socials {
    display: flex;
    gap: 9px;
    margin-top: 20px;
}

.socials a {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-dim);
    transition: all var(--dur) var(--ease);
}

.socials a:hover {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
    transform: translateY(-3px);
}

.footer-col h4 {
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--text-mute);
    margin-bottom: 16px;
}

.footer-col li {
    margin-bottom: 10px;
}

.footer-col a {
    color: var(--text-dim);
    font-size: .92rem;
    transition: color var(--dur) var(--ease);
    display: inline-block;
}

.footer-col a:hover {
    color: var(--brand);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 22px 0 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-mute);
    font-size: .86rem;
}

.footer-bottom .disclaimer {
    display: flex;
    align-items: center;
    gap: 7px;
}

/* ---------- 15. ปุ่มขึ้นบน ---------- */
.to-top {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 90;
    width: 46px;
    height: 46px;
    border-radius: var(--r-sm);
    display: grid;
    place-items: center;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-dim);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    box-shadow: var(--shadow);
    transition: all var(--dur) var(--ease);
}

.to-top.show {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.to-top:hover {
    color: var(--text);
    background: var(--surface-2);
}

/* ---------- 16. Reveal on scroll ---------- */
.reveal {
    opacity: 0;
    transform: translateY(16px);
}

.reveal.in {
    opacity: 1;
    transform: none;
    transition: opacity .5s var(--ease), transform .5s var(--ease);
}

/* ---------- 17. หน้าเนื้อหา (เกี่ยวกับเรา) ---------- */
.lang-switch {
    display: inline-flex;
    gap: 3px;
    padding: 4px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.lang-switch button {
    padding: 6px 18px;
    border: 0;
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--text-mute);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
}

.lang-switch button.active {
    background: var(--brand);
    color: #fff;
}

.lang-content {
    display: none;
}

.lang-content.active {
    display: block;
}

.callout {
    display: flex;
    gap: 14px;
    padding: 18px 20px;
    border-radius: var(--r);
    background: var(--warn-soft, rgba(255, 176, 32, .08));
    border: 1px solid rgba(255, 176, 32, .28);
    color: var(--text-dim);
    font-size: .93rem;
    line-height: 1.75;
}

.callout i {
    color: var(--warn);
    font-size: 1.1rem;
    margin-top: 4px;
    flex-shrink: 0;
}

.callout b {
    color: var(--text);
}

.feature-list {
    display: grid;
    gap: 12px;
    margin-top: 6px;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text-dim);
    font-size: .95rem;
    line-height: 1.7;
}

.feature-list i {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 3px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .65rem;
}

/* ---------- 18. Responsive ---------- */
@media (max-width: 1024px) {
    .sc-split {
        grid-template-columns: 1fr;
    }

    .sc-hero,
    .sc-hero-body {
        min-height: 340px;
    }

    .detail {
        grid-template-columns: 1fr;
        gap: 24px 0;
    }

    /* จอเล็ก: เรียงเป็น หัวเรื่อง → กล่องดาวน์โหลด → เนื้อหา จะได้กดโหลดได้ทันที */
    .detail-head {
        order: -2;
    }

    .detail-side {
        order: -1;
    }

    .detail-main {
        order: 0;
    }

    .dl-card {
        position: static;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}

@media (max-width: 880px) {
    .nav-links {
        display: none;
    }

    .menu-btn {
        display: grid;
    }

    .header-bar {
        height: 62px;
        gap: 10px;
    }

    /* หน้าแรกไม่มีช่องค้นหาใหญ่แล้ว ช่องบนแถบหัวจึงต้องอยู่ต่อบนมือถือ */
    .header-search {
        max-width: none;
        margin-inline: 0;
    }

    .brand img {
        height: 32px;
    }

    .search-field input {
        padding: 10px 52px 10px 38px;
    }

    .search-field .fa-magnifying-glass,
    .search-field .fa-search {
        left: 13px;
        font-size: .85rem;
    }

    .header-search .search-field button {
        padding: 8px 13px;
    }

    .header-search .search-field button i {
        display: block;
    }

    .header-search .search-field button .txt {
        display: none;
    }

    .cat-bar {
        top: 62px;
    }

    .dl-card {
        max-width: 520px;
        margin-inline: auto;
    }

    /* จอเล็ก: เลิกวางตัวหนังสือทับรูป เปลี่ยนเป็นรูปบน–ข้อความล่าง อ่านง่ายกว่า */
    .sc-hero {
        min-height: 0;
        display: block;
    }

    .sc-hero-art {
        position: relative;
        inset: auto;
        aspect-ratio: 16 / 9;
    }

    .sc-hero-art::after {
        display: none;
    }

    /* ต้องล้าง height:100% ด้วย ไม่งั้นบนมือถือกล่องข้อความจะสูงเท่าการ์ดทั้งใบ
       (เบราว์เซอร์คิด 100% จากความสูงการ์ดที่รวมรูปไปแล้ว) ดันเนื้อหาลงไปจน
       ปุ่ม "ดาวน์โหลดเลย" โดน overflow:hidden ของการ์ดตัดหาย */
    .sc-hero-body {
        height: auto;
        min-height: 0;
        max-width: none;
        padding: 20px 22px 26px;
        background: var(--surface);
    }

    .sc-nav {
        display: none;
    }
}

/* จอแคบมาก: ยกปุ่มสลับธีมออกจากแถบหัว ให้ช่องค้นหากว้างขึ้น */
@media (max-width: 480px) {
    .header-actions .theme-toggle {
        display: none;
    }

    .menu-theme {
        display: flex;
    }

    .header-bar {
        gap: 8px;
    }

    .brand img {
        height: 28px;
    }
}

@media (max-width: 640px) {
    :root {
        --gutter: 16px;
    }

    .hero {
        padding: 44px 0 40px;
    }

    .hero-search .search-field input {
        padding: 14px 16px 14px 46px;
        font-size: .96rem;
    }

    .hero-search .search-field button {
        position: static;
        width: 100%;
        margin-top: 10px;
        padding: 13px;
    }

    .hero-search .search-field {
        display: block;
    }

    .hero-search .fa-magnifying-glass,
    .hero-search .fa-search {
        top: 17px;
    }

    .hero-stats {
        gap: 10px 26px;
    }

    .section {
        padding: 40px 0;
    }

    .showcase {
        padding: 38px 0 4px;
    }

    .sc-rank .sc-item {
        width: 218px;
    }

    .sc-rank .num {
        font-size: 7rem;
    }

    .sc-rank .art {
        width: 124px;
        flex-basis: 124px;
    }

    .sc-wide .sc-item {
        width: 250px;
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .card-foot {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .get {
        justify-content: center;
        padding: 9px 13px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 40px 0 30px;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .toast-wrap {
        left: 16px;
        right: 16px;
    }

    .toast {
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}
