/* ═══════════════════════════════════════════════════════════
   Public sale page — link-in-bio, minimal, mobile-first
   สีถูกฉีดจาก PHP ผ่าน :root (--bg, --text, --primary, --card)
   ═══════════════════════════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: var(--font);
    background: var(--bg);
    background-image: linear-gradient(165deg, var(--bg) 0%, var(--bg2) 100%);
    background-attachment: fixed;
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* scrollbar เข้ากับธีม */
html { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 35%, transparent) transparent; }
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 30%, transparent); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text) 50%, transparent); }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.sp-wrap {
    max-width: 620px;
    margin: 0 auto;
    padding: 0 20px calc(48px + env(safe-area-inset-bottom));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── ตกแต่งพื้นหลังเบา ๆ (ไม่ให้หน้าดูว่าง) ───────────────── */
body::before {
    content: '';
    position: fixed; inset: 0;
    background:
        radial-gradient(620px 340px at 50% -90px, color-mix(in srgb, var(--primary) 10%, transparent), transparent 70%),
        radial-gradient(520px 300px at 88% 112%, color-mix(in srgb, var(--primary) 8%, transparent), transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.sp-wrap { position: relative; z-index: 1; }

/* ── Banner ─────────────────────────────────────────────── */
.sp-banner {
    width: 100vw;
    max-width: none;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    aspect-ratio: 16 / 7;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ── Profile ────────────────────────────────────────────── */
.sp-profile { text-align: center; padding: 38px 0 26px; }
.sp-banner + .sp-profile { padding-top: 0; margin-top: -38px; }

.sp-avatar {
    width: 84px; height: 84px; border-radius: 50%;
    object-fit: cover; object-position: center;
    display: block;
    margin: 0 auto 14px;
    border: 3px solid var(--bg);
    background: var(--card);
    box-shadow: 0 8px 24px var(--shadow-c);
}
.sp-banner + .sp-profile .sp-avatar { box-shadow: 0 4px 14px rgba(0, 0, 0, .1); }

.sp-name {
    font-size: 22px; font-weight: 600;
    letter-spacing: -.02em; line-height: 1.3;
    word-break: break-word;
}
.sp-bio {
    font-size: 14.5px; margin-top: 7px;
    opacity: .72; line-height: 1.6;
    max-width: 420px; margin-left: auto; margin-right: auto;
    white-space: pre-line;
}

.sp-meta {
    display: flex; flex-wrap: wrap; gap: 6px 12px;
    justify-content: center; align-items: center;
    margin-top: 12px;
}
.sp-meta span {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px;
    padding: 4px 11px;
    border-radius: 99px;
    background: var(--icon-bg);
    border: 1px solid var(--line);
    opacity: .85;
}
.sp-meta i { font-size: 13px; color: var(--primary); }

/* ── Links ──────────────────────────────────────────────── */
.sp-links { display: grid; gap: 11px; flex: 1; align-content: start; }

/* ปุ่มเว็บไซต์หลัก (โดดเด่นสุด) */
.sp-offer {
    display: flex; align-items: center; gap: 13px;
    background: var(--primary);
    color: var(--bg);
    border-radius: 16px;
    padding: 17px 18px;
    min-height: 66px;
    box-shadow: 0 8px 26px var(--shadow-c);
    transition: transform .14s ease, box-shadow .14s ease;
    cursor: pointer;
    position: relative;
}
.sp-offer:hover { transform: translateY(-2px); box-shadow: 0 12px 32px var(--shadow-c); }
.sp-offer:active { transform: translateY(0) scale(.99); }
.sp-offer .oi-ico {
    width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center;
    font-size: 20px; flex-shrink: 0;
    background: rgba(255, 255, 255, .18);
}
.sp-offer .oi-text { flex: 1; min-width: 0; text-align: left; }
.sp-offer .oi-label { font-size: 15.5px; font-weight: 600; display: block; }
.sp-offer .oi-url { font-size: 12px; opacity: .72; display: block; word-break: break-all; }
.sp-offer .oi-arrow { opacity: .5; font-size: 19px; flex-shrink: 0; transition: transform .14s; }
.sp-offer:hover .oi-arrow { transform: translateX(3px); }

.sp-link {
    display: flex; align-items: center; gap: 13px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 15px 16px;
    min-height: 58px;
    transition: transform .14s ease, box-shadow .14s ease, border-color .14s;
    cursor: pointer;
    position: relative;
    backdrop-filter: blur(6px);
}
.sp-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-c);
    border-color: var(--primary);
}
.sp-link:active { transform: translateY(0) scale(.99); }

.sp-link .li-icon {
    width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center;
    font-size: 19px; flex-shrink: 0;
    background: var(--icon-bg);
    color: var(--primary);
    overflow: hidden;
}
.sp-link .li-icon img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: inherit;
}
.sp-link .li-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sp-link .li-title { font-size: 15px; font-weight: 500; word-break: break-word; line-height: 1.4; }
.sp-link .li-desc { font-size: 12.5px; opacity: .65; word-break: break-word; line-height: 1.5; }
.sp-link .li-arrow { opacity: .3; font-size: 18px; flex-shrink: 0; transition: opacity .14s, transform .14s; }
.sp-link:hover .li-arrow { opacity: .6; transform: translateX(2px); }

.sp-empty { text-align: center; padding: 40px 20px; opacity: .5; font-size: 14px; }
.sp-empty i { font-size: 34px; display: block; margin-bottom: 10px; }

/* ── Footer ─────────────────────────────────────────────── */
.sp-foot {
    text-align: center; padding-top: 30px; font-size: 12.5px; opacity: .7;
    margin-top: 18px;
    border-top: 1px solid var(--line);
}
.sp-foot a { text-decoration: underline; }
.sp-foot .made { margin-top: 8px; opacity: .8; }

.sp-share {
    display: inline-flex; align-items: center; gap: 7px;
    margin-top: 12px;
    padding: 9px 18px;
    border-radius: 99px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: transform .15s, border-color .15s;
}
.sp-share:hover { transform: translateY(-2px); border-color: var(--primary); }
.sp-share i { font-size: 15px; color: var(--primary); }

/* ── Floating LINE button ───────────────────────────────── */
.sp-line-fab {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: 7px;
    background: #06C755; color: #fff;
    padding: 12px 18px; border-radius: 99px;
    font-size: 14.5px; font-weight: 500;
    box-shadow: 0 6px 20px rgba(6, 199, 85, .38);
    z-index: 30;
    transition: transform .15s;
}
.sp-line-fab:hover { transform: translateY(-2px); }
.sp-line-fab:active { transform: scale(.97); }
.sp-line-fab i { font-size: 20px; }

/* ── Toast (คลิกแล้วแจ้งเตือน) ──────────────────────────── */
.sp-toast {
    position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(12px);
    background: rgba(9, 9, 11, .92); color: #fff;
    padding: 11px 18px; border-radius: 99px;
    font-size: 13.5px; z-index: 100;
    opacity: 0; transition: opacity .2s, transform .2s;
    backdrop-filter: blur(8px); pointer-events: none;
    max-width: calc(100vw - 40px); text-align: center;
}
.sp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
    .sp-link:hover { transform: none; }
}

/* ── Larger screens ─────────────────────────────────────── */
@media (min-width: 640px) {
    .sp-wrap { padding-bottom: 56px; }
    .sp-name { font-size: 25px; }
    .sp-avatar { width: 94px; height: 94px; }
    .sp-link { padding: 16px 18px; min-height: 62px; }
    .sp-banner { border-radius: 0 0 18px 18px; }
}

/* ── PC: หน้าเซลเพจแสดงเป็นการ์ดตรงกลาง ไม่เต็มจอ ────────── */
@media (min-width: 700px) {
    body {
        padding: 30px 0;
    }
    .sp-wrap {
        max-width: 520px;
        min-height: 0;
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: 24px;
        box-shadow: 0 24px 70px var(--shadow-c);
        padding: 0 26px 30px;
        overflow: hidden;
    }
    .sp-banner {
        width: calc(100% + 52px);
        max-width: none;
        margin: 0 -26px;
        border-radius: 0;
    }
    .sp-profile { padding-top: 40px; }
}
