@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+Thai:wght@500;700&family=Sarabun:wght@400;500;600;700&display=swap');

:root{
    --paper:#f8f2e6; --ink:#34302a; --muted:#6f6656;
    --gold:#b9862e; --gold-bright:#d9a441; --gold-deep:#8a6a1e;
    --emerald:#0f6f57;
    --card:#fffdf7; --tint:#fbf6ea; --line:#e7ddc7;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Sarabun', -apple-system, "Segoe UI", sans-serif;
    background: var(--paper);
    color: var(--ink);
    min-height: 100vh;
    padding: 16px;
    line-height: 1.7;
    background-image:
        radial-gradient(130% 45% at 50% -8%, rgba(217,164,65,.18), transparent 62%),
        radial-gradient(90% 40% at 50% 0%, rgba(15,111,87,.06), transparent 58%);
    background-repeat: no-repeat;
}
.wrap {
    max-width: 480px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px 26px;
    box-shadow: 0 10px 26px rgba(120,90,20,.10);
    margin: 20px auto;
}
.wrap-wide { max-width: 700px; }

h1 {
    margin: 0 0 8px 0;
    font-family: 'Noto Serif Thai', serif;
    font-weight: 700;
    color: var(--gold-deep);
    font-size: 23px;
    line-height: 1.4;
}
h3 {
    font-family: 'Noto Serif Thai', serif;
    font-weight: 700;
    color: var(--gold-deep);
    font-size: 17px;
    margin: 20px 0 8px 0;
}
.tagline { color: var(--muted); margin: 0 0 14px 0; font-size: 14px; }

a { color: var(--gold-deep); }

/* เมนูนำทาง */
.nav {
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Noto Serif Thai', serif;
    font-weight: 700;
    color: var(--gold-deep);
    font-size: 20px;
    text-decoration: none;
    margin-bottom: 10px;
}
.brand-mark { height: 30px; width: auto; }
.nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    font-size: 13.5px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}
.nav-links a { color: var(--gold-deep); text-decoration: none; font-weight: 500; }
.nav-links a:hover { text-decoration: underline; }
.nav-user { color: var(--muted); }

/* Hero (หน้าแรก) */
.hero { text-align: center; padding: 8px 0 10px 0; }
.hero-logo { height: 64px; width: auto; margin-bottom: 10px; }
.hero h1 { font-size: 26px; }
.hero .tagline { font-size: 14px; margin-bottom: 16px; }

.status-box {
    padding: 11px 14px;
    border-radius: 10px;
    margin: 14px 0;
    font-size: 14px;
}
.status-ok { background: #e9f5f1; color: var(--emerald); }
.status-wait { background: var(--tint); color: var(--gold-deep); }
.checklist ul { padding-left: 20px; line-height: 1.9; }
code { background: var(--tint); padding: 2px 6px; border-radius: 4px; }

/* ฟอร์ม */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 13px; color: var(--ink); }
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: var(--card);
    color: var(--ink);
}
.form-group textarea { resize: vertical; }
.hint { font-size: 12.5px; color: var(--muted); margin: -6px 0 12px 0; line-height: 1.6; }

.btn {
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    color: #3a2c08;
    border: none;
    padding: 11px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 8px 18px rgba(185,134,46,.28);
}
.btn:hover { filter: brightness(0.97); }

/* ปุ่ม LINE Login (สีตามแบรนด์ LINE คงเดิม) */
.btn-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #06C755;
    color: #fff;
    padding: 11px 18px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    width: 100%;
}
.btn-line:hover { background: #05a648; }
.line-icon { font-size: 12px; letter-spacing: 0.5px; }

.divider {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    margin: 14px 0;
    position: relative;
}
.divider::before, .divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 42%;
    border-top: 1px solid var(--line);
}
.divider::before { left: 0; }
.divider::after { right: 0; }

.alert { padding: 10px 13px; border-radius: 10px; margin-bottom: 12px; font-size: 13.5px; }
.alert-ok { background: #e9f5f1; color: var(--emerald); }
.alert-err { background: #fdeaea; color: #a83232; }

/* ค้นหา / ผลลัพธ์ */
.search-form { display: flex; gap: 8px; margin-bottom: 16px; }
.search-form input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: var(--card);
}
.result-count { color: var(--muted); font-size: 13px; }
.result-card {
    background: var(--tint);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}
.result-card h3 { margin: 0 0 6px 0; font-size: 17px; }
.result-card h3 a { color: var(--gold-deep); text-decoration: none; }
.result-card h3 a:hover { text-decoration: underline; }
.result-card p { margin: 0 0 8px 0; line-height: 1.75; color: var(--ink); font-size: 14.5px; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag {
    background: var(--tint);
    color: var(--gold-deep);
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 999px;
    text-decoration: none;
    border: 1px solid var(--line);
}
a.tag:hover { background: #f2e6c8; }

.related-list { padding-left: 18px; line-height: 1.9; font-size: 14px; }
.related-list a { color: var(--gold-deep); text-decoration: none; }
.related-list a:hover { text-decoration: underline; }

/* เนื้อหาที่มีหัวข้อย่อย (คำทำนายหลัก/ด้านการงาน/ฯลฯ) */
.result-card .dream-section { margin: 0 0 14px 0; }
.result-card .dream-section:last-child { margin-bottom: 0; }
.dream-label {
    color: var(--gold-deep);
    display: block;
    margin-bottom: 2px;
    font-size: 13.5px;
    font-weight: 700;
}

/* ปุ่มเรื่องก่อนหน้า/ถัดไป — แบบการ์ด */
.prev-next-nav {
    display: flex;
    gap: 10px;
    margin: 18px 0;
}
.prev-next-link {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--line);
    text-decoration: none;
    font-size: 13px;
    color: var(--gold-deep);
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.prev-next-link:hover { border-color: var(--gold); }
.next-link { text-align: right; }

/* ปุ่มแชร์ */
.share-box {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 18px 0;
}
.share-label { font-size: 13px; color: var(--muted); }
.share-btn {
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 999px;
    text-decoration: none;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    font-weight: 600;
}
.share-fb { background: #1877f2; color: #fff; border-color: #1877f2; }
.share-line { background: #06C755; color: #fff; border-color: #06C755; }
.share-native { background: var(--tint); }
.share-copy { background: var(--tint); }
.share-copy.copied { background: var(--emerald); color: #fff; border-color: var(--emerald); }

/* ปุ่มเลื่อนขึ้นบนสุด */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    color: #3a2c08;
    border: none;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(120,90,20,.30);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.back-to-top.show { opacity: 1; pointer-events: auto; }

/* ตารางหลังบ้าน */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    font-size: 13px;
}
.admin-table th, .admin-table td {
    text-align: left;
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
}
.admin-table th { color: var(--muted); font-weight: 700; font-size: 12px; }
.admin-table a { color: var(--gold-deep); text-decoration: none; }
.admin-table a:hover { text-decoration: underline; }

/* Dashboard — การ์ดสรุปสถิติ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin: 14px 0 6px 0;
}
.stat-card {
    background: var(--tint);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}
.stat-number { font-family: 'Noto Serif Thai', serif; font-size: 22px; font-weight: 700; color: var(--gold-deep); }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* Dashboard — ประวัติแบบพับเก็บได้ */
.history-item {
    background: var(--tint);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 14px;
    margin-bottom: 8px;
}
.history-item summary { cursor: pointer; font-size: 13px; color: var(--ink); }
.history-date { color: var(--muted); font-size: 12px; }
.history-detail { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.history-detail p { line-height: 1.7; color: var(--ink); font-size: 14px; }

/* กล่องแสดงโควตาการวิเคราะห์ */
.quota-box {
    background: var(--tint);
    color: var(--gold-deep);
    padding: 9px 13px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
}
.quota-box a { color: var(--gold-deep); font-weight: 700; }
.quota-unlimited { background: #e9f5f1; color: var(--emerald); border-color: #cdeade; }
.quota-unlimited a { color: var(--emerald); }

/* หน้าอัปเกรดสมาชิก — การ์ดแพ็กเกจ */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 14px;
}
.plan-card {
    background: var(--tint);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    text-align: center;
}
.plan-card h3 { margin-top: 0; }
.plan-price { font-family: 'Noto Serif Thai', serif; font-size: 22px; font-weight: 700; color: var(--gold-deep); margin-bottom: 10px; }
.qr-image {
    width: 100%;
    max-width: 200px;
    border-radius: 10px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
}
.qr-caption { text-align: center; margin-bottom: 14px; }
.qr-phone { font-weight: 700; color: var(--gold-deep); font-size: 14px; }
.qr-name { font-size: 12px; color: var(--muted); margin-top: 2px; }
.qr-note { font-size: 11px; color: var(--emerald); margin-top: 5px; }

/* นโยบายความเป็นส่วนตัว */
.policy-content h3 { margin-top: 22px; }
.policy-content ul { padding-left: 18px; line-height: 1.85; color: var(--ink); font-size: 14px; }
.policy-content p { line-height: 1.8; color: var(--ink); font-size: 14px; }

/* ท้ายเว็บกลาง */
.site-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
}
.footer-brand {
    font-family: 'Noto Serif Thai', serif;
    font-weight: 700;
    color: var(--gold-deep);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}
.footer-logo { height: 18px; width: auto; }
.footer-links { margin-bottom: 5px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; color: var(--gold-deep); }

/* กล่องความหมายเฉพาะของแต่ละคำที่จับได้ในผลวิเคราะห์ (โทนเขียวมรกต ให้ต่างจากกล่องเลขนำโชคสีทอง) */
.meaning-box {
    background: #eef7f4;
    border: 1px solid #cdeade;
    border-radius: 12px;
    padding: 14px 16px;
    margin: 14px 0;
}
.meaning-box p { margin: 0 0 10px 0; line-height: 1.75; font-size: 14px; color: var(--ink); }
.meaning-box p:last-child { margin-bottom: 0; }
.meaning-box .dream-label { color: var(--emerald); margin-right: 4px; }

/* กล่องเลขนำโชค */
.lucky-box {
    background: radial-gradient(120% 100% at 50% 0%, rgba(217,164,65,.14), transparent 72%), var(--card);
    border: 1px solid var(--gold);
    border-radius: 14px;
    padding: 18px;
    margin: 16px 0;
    text-align: center;
}
.lucky-label { font-weight: 700; color: var(--gold-deep); font-size: 14px; margin-bottom: 10px; font-family: 'Noto Serif Thai', serif; }
.lucky-numbers { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.lucky-num {
    background: var(--card);
    border: 1px solid var(--gold);
    color: var(--gold-deep);
    font-weight: 700;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 10px;
    font-family: 'Noto Serif Thai', serif;
}
.lucky-disclaimer { font-size: 11px; color: var(--muted); margin: 0; }

/* กล่องสินค้าแนะนำ (Affiliate) */
.affiliate-box {
    background: var(--tint);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    margin: 16px 0;
}
.affiliate-label {
    font-weight: 700;
    color: var(--emerald);
    font-size: 13px;
    margin-bottom: 10px;
}
.affiliate-card {
    display: flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
}
.affiliate-image {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #fff;
}
.affiliate-info { flex: 1; min-width: 0; }
.affiliate-name {
    font-size: 14px;
    color: var(--ink);
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 4px;
}
.affiliate-price { font-size: 13px; color: var(--gold-deep); font-weight: 700; margin-bottom: 4px; }
.affiliate-cta { font-size: 12px; color: var(--emerald); font-weight: 600; }
.affiliate-disclosure {
    font-size: 10.5px;
    color: var(--muted);
    margin: 8px 0 0 0;
    line-height: 1.5;
}

/* ภาพประกอบเรื่องความฝัน */
.dream-illustration-wrap {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 14px;
    margin: 12px 0 16px 0;
    border: 1px solid var(--line);
}
.dream-illustration {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0;
    border: none;
    border-radius: 0;
}

/* ช่อง honeypot กันบอทสมัครสมาชิก — ซ่อนจากคนจริงแต่ยังอยู่ใน DOM (ไม่ใช้ display:none
   เพราะบอทบางตัวฉลาดพอจะข้ามช่องที่ display:none ไป) */
.honeypot-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* แถบเลขหน้า (Pagination) หลังบ้าน */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 18px 0;
    align-items: center;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid var(--line);
    color: var(--gold-deep);
}
.pagination a:hover { background: var(--tint); }
.pagination-current {
    background: var(--gold);
    color: #fff;
    font-weight: 700;
    border-color: var(--gold);
}
.pagination-dots { border: none; color: var(--muted); padding: 6px 4px; }


/* ===== วณิพก AI: จัดรูปแบบเนื้อหาแยกสถานการณ์เป็นบล็อกชัดเจน ===== */
.mktg-scenario {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(120,90,20,.06);
}
.mktg-scenario-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gold);
}
.mktg-scenario-num {
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    color: #3a2c08;
    font-weight: 700;
    font-family: 'Noto Serif Thai', serif;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
}
.mktg-scenario-title {
    font-family: 'Noto Serif Thai', serif;
    font-weight: 700;
    color: var(--gold-deep);
    font-size: 16px;
    line-height: 1.4;
}

/* หัวข้อย่อยแต่ละสี ให้สะดุดตาแยกจากกันชัดเจน */
.mktg-sub-block { margin: 0 0 14px 0; }
.mktg-sub-block:last-child { margin-bottom: 0; }
.mktg-sub-label {
    display: block;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 3px;
}
.mktg-sub-text {
    display: block;
    line-height: 1.75;
    font-size: 14.5px;
    color: var(--ink);
}

.mktg-label-belief   .mktg-sub-label { color: var(--gold-deep); }
.mktg-label-strategy .mktg-sub-label { color: var(--emerald); }
.mktg-label-ai        .mktg-sub-label { color: #2b6cb0; }
.mktg-label-warning   .mktg-sub-label { color: #b5471f; }
.mktg-label-tip        .mktg-sub-label { color: #a3238e; }

/* กล่อง AI Prompt คัดลอกได้ */
.mktg-prompt-box {
    background: #eef4fb;
    border: 1.5px dashed #2b6cb0;
    border-radius: 10px;
    padding: 12px 14px;
    margin: 8px 0 14px 0;
}
.mktg-prompt-label { font-weight: 700; color: #2b6cb0; font-size: 12.5px; margin-bottom: 8px; }
.mktg-prompt-text {
    font-size: 13.5px;
    color: var(--ink);
    line-height: 1.7;
    background: #fff;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 10px;
    word-break: break-word;
}
.mktg-copy-btn {
    background: #2b6cb0;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}
.mktg-copy-btn:active { opacity: 0.8; }

/* ตัวคั่นก่อนเข้าสู่ช่วงสรุปส่งท้าย */
.mktg-closing-divider {
    text-align: center;
    margin: 28px 0 10px 0;
    position: relative;
}
.mktg-closing-divider span {
    background: var(--paper);
    position: relative;
    z-index: 1;
    padding: 0 14px;
    color: var(--gold-deep);
    font-weight: 700;
    font-size: 13px;
}
.mktg-closing-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 2px dashed var(--gold);
}
.mktg-closing-block {
    background: var(--tint);
    border: 2px solid var(--gold);
    border-radius: 14px;
    padding: 18px;
    margin: 0 0 20px 0;
}
.mktg-closing-title {
    font-family: 'Noto Serif Thai', serif;
    color: var(--gold-deep);
    margin: 0 0 12px 0;
}


