/*
Theme Name: Fanchok Dream
Theme URI: https://example.com/
Author: Your Name
Description: ธีมเว็บทำนายฝันพร้อมเลขนำโชค มีระบบ "คำทำนายฝัน" (Custom Post Type) ช่องกรอกเลข 2/3 ตัว, กล่องเลขเด็ดประจำวัน, ค้นหาความฝัน และบทความ
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: fanchok
*/

:root {
	--c-primary: #034592;
	--c-primary-dark: #02306a;
	--c-primary-deep: #011a3b;
	--c-gold: #e8b23a;
	--c-gold-light: #fde8b0;
	--c-bg: #f4f7fb;
	--c-surface: #ffffff;
	--c-text: #1c2533;
	--c-muted: #5f6b7d;
	--c-border: #dfe6f0;
	--radius: 16px;
	--shadow: 0 6px 24px rgba(3, 40, 90, .08);
	--max: 1200px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	font-family: "Noto Sans Thai", system-ui, sans-serif;
	background: var(--c-bg);
	color: var(--c-text);
	line-height: 1.7;
	font-size: 16px;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-dark); }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Header ---------- */
.site-header {
	position: sticky; top: 0; z-index: 50;
	background: var(--c-primary);
	color: #fff;
	box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.site-branding { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.25rem; }
.site-branding:hover { color: var(--c-gold-light); }
.site-branding img { max-height: 48px; width: auto; }
.site-logo .custom-logo-link { display: flex; align-items: center; }
.site-logo .brand-mark { width: 44px; height: 44px; font-size: 1.25rem; }
.brand-mark { width: 38px; height: 38px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--c-gold-light), var(--c-gold)); display: grid; place-items: center; color: var(--c-primary-dark); font-size: 1.1rem; }

.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.main-nav a { color: #fff; padding: 8px 12px; border-radius: 999px; font-size: .95rem; display: block; }
.main-nav a:hover, .main-nav .current-menu-item > a { background: rgba(255,255,255,.12); color: var(--c-gold-light); }

.menu-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.6rem; cursor: pointer; padding: 4px 8px; }

@media (max-width: 900px) {
	.menu-toggle { display: block; }
	.main-nav { position: absolute; left: 0; right: 0; top: 68px; background: var(--c-primary-dark); display: none; }
	.main-nav.is-open { display: block; }
	.main-nav ul { flex-direction: column; padding: 8px 16px 16px; }
	.main-nav a { border-radius: 8px; }
}

/* ---------- Hero ---------- */
.hero {
	background:
		radial-gradient(circle at 15% 20%, rgba(232,178,58,.25), transparent 40%),
		radial-gradient(circle at 85% 80%, rgba(232,178,58,.18), transparent 45%),
		linear-gradient(180deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
	color: #fff;
	padding: 56px 0 72px;
	text-align: center;
	position: relative;
	overflow: hidden;
}
.hero .eyebrow { display: inline-block; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); padding: 4px 14px; border-radius: 999px; font-size: .85rem; color: var(--c-gold-light); margin-bottom: 14px; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 3rem); margin-bottom: 12px; }
.hero h1 span { color: var(--c-gold); }
.hero p.lead { max-width: 640px; margin: 0 auto 28px; opacity: .9; }

.dream-search { max-width: 640px; margin: 0 auto; display: flex; background: #fff; border-radius: 999px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.dream-search input[type="search"] { flex: 1; min-width: 0; border: 0; outline: 0; padding: 10px 18px; font: inherit; color: var(--c-text); background: transparent; }
.dream-search button { border: 0; background: linear-gradient(135deg, var(--c-gold), #d1901c); color: var(--c-primary-deep); font: inherit; font-weight: 700; padding: 10px 26px; border-radius: 999px; cursor: pointer; }
.dream-search button:hover { filter: brightness(1.05); }

.popular-tags { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; font-size: .9rem; }
.popular-tags .label { opacity: .75; }
.popular-tags a { color: #fff; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); padding: 3px 12px; border-radius: 999px; }
.popular-tags a:hover { background: var(--c-gold); color: var(--c-primary-deep); }

/* ---------- Quick strip ---------- */
.quick-strip { margin-top: -36px; position: relative; z-index: 2; }
.quick-strip .inner { background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.quick-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border-radius: 12px; border: 1px solid var(--c-border); color: var(--c-text); text-align: center; }
.quick-item:hover { border-color: var(--c-gold); background: #f6f9fe; color: var(--c-primary); }
.quick-item small { color: var(--c-primary); font-weight: 600; }

/* ---------- Sections ---------- */
.section { padding: 48px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.section-head h2 { font-size: 1.5rem; margin: 0; display: flex; align-items: center; gap: 8px; }
.section-head a { font-size: .95rem; font-weight: 600; white-space: nowrap; }

.layout-2col { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
@media (max-width: 960px) { .layout-2col { grid-template-columns: 1fr; } }

/* ---------- Dream cards ---------- */
.dream-list { display: grid; gap: 16px; }
.dream-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: transform .15s; }
.dream-card:hover { transform: translateY(-2px); }
.dream-card h3 { font-size: 1.2rem; margin-bottom: 6px; }
.dream-card h3 a { color: var(--c-text); }
.dream-card h3 a:hover { color: var(--c-primary); }
.dream-card .excerpt { color: var(--c-muted); margin: 0 0 14px; }

.lucky-numbers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lucky-numbers .ln-label { font-size: .85rem; font-weight: 700; color: var(--c-primary); margin-right: 4px; }
.num { display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.num.n1 { background: var(--c-primary); color: #fff; border-radius: 50%; }
.num.n2 { background: var(--c-gold-light); color: var(--c-primary-dark); }
.num.n3 { background: #fff; color: var(--c-primary); border: 1.5px solid var(--c-gold); }

/* ---------- Daily numbers widget ---------- */
.daily-box { background: linear-gradient(160deg, var(--c-primary) 0%, var(--c-primary-deep) 100%); color: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); position: sticky; top: 88px; }
.daily-box h3 { color: var(--c-gold-light); margin-bottom: 2px; }
.daily-box .date { opacity: .8; font-size: .9rem; margin-bottom: 16px; }
.daily-box .group { margin-bottom: 14px; }
.daily-box .group-title { font-size: .85rem; opacity: .85; margin-bottom: 6px; }
.daily-box .row { display: flex; flex-wrap: wrap; gap: 6px; }
.daily-box .big { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; background: radial-gradient(circle at 35% 30%, #fff3cf, var(--c-gold)); color: var(--c-primary-deep); }
.daily-box .chip { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: 10px; padding: 4px 12px; font-weight: 700; }
.daily-box .note { font-size: .75rem; opacity: .65; margin: 10px 0 0; }

/* ---------- Posts grid ---------- */
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.post-card { background: var(--c-surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--c-border); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.post-card .thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, #d6e4f7, #8fb3e6); overflow: hidden; }
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card .thumb { display: grid; place-items: center; font-size: 2.4rem; color: var(--c-primary); max-width: 100%; }
.post-card .thumb.t1 { background: linear-gradient(135deg, #fde8b0, #f2c766); }
.post-card .thumb.t2 { background: linear-gradient(135deg, #d6e4f7, #8fb3e6); }
.post-card .thumb.t3 { background: linear-gradient(135deg, #e6edf7, #b9cbe4); }
.post-card .thumb.t4 { background: linear-gradient(135deg, #fbe2b8, #e8b23a); }
.post-card .body { padding: 16px; flex: 1; }
.post-card h3 { font-size: 1.05rem; }
.post-card h3 a { color: var(--c-text); }
.post-card .meta { color: var(--c-muted); font-size: .85rem; }

/* ---------- Features ---------- */
.features { background: var(--c-surface); border-top: 1px solid var(--c-border); border-bottom: 1px solid var(--c-border); }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.feature { text-align: center; padding: 8px; }
.feature .icon { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center; font-size: 1.6rem; background: #fff4dc; }
.feature h3 { font-size: 1.1rem; color: var(--c-primary); }
.feature p { color: var(--c-muted); margin: 0; font-size: .95rem; }

/* ---------- Single / content ---------- */
.content-wrap { padding: 36px 0 56px; }
.entry { background: var(--c-surface); border-radius: var(--radius); padding: clamp(20px, 4vw, 40px); border: 1px solid var(--c-border); box-shadow: var(--shadow); }
.entry-title { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.entry-meta { color: var(--c-muted); font-size: .9rem; margin-bottom: 20px; }
.entry-content > * { margin-top: 0; }
.entry-content h2 { margin-top: 1.5em; color: var(--c-primary); }
.entry-content blockquote { border-left: 4px solid var(--c-gold); margin: 1.5em 0; padding: .5em 1em; background: #fffaf0; }
.dream-numbers-panel { background: #fffaf0; border: 1px dashed var(--c-gold); border-radius: 14px; padding: 18px; margin: 20px 0; }
.dream-numbers-panel .lucky-numbers + .lucky-numbers { margin-top: 10px; }
.breadcrumbs { font-size: .85rem; color: var(--c-muted); margin-bottom: 12px; }
.breadcrumbs a { color: var(--c-muted); }

.page-header { background: linear-gradient(180deg, var(--c-primary), var(--c-primary-dark)); color: #fff; padding: 40px 0; }
.page-header h1 { margin: 0; }
.page-header p { margin: 6px 0 0; opacity: .85; }

/* ปุ่มหมวดหมู่ (หน้าทำนายฝัน / บทความ) */
.az-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 22px; }
.az-label { font-size: .85rem; font-weight: 700; color: var(--c-muted); margin-right: 4px; }
.az-filter a { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 18px; border-radius: 999px; background: var(--c-surface); border: 1.5px solid var(--c-border); color: var(--c-text); font-size: .95rem; font-weight: 600; box-shadow: 0 1px 2px rgba(3, 40, 90, .06); transition: border-color .15s, color .15s, background .15s; }
.az-filter a:hover { border-color: var(--c-primary); color: var(--c-primary); }
.az-filter a.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); box-shadow: 0 4px 12px rgba(3, 69, 146, .25); }

.pagination { margin-top: 28px; display: flex; justify-content: center; }
.pagination .nav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination .page-numbers { padding: 6px 14px; border-radius: 10px; background: var(--c-surface); border: 1px solid var(--c-border); color: var(--c-text); }
.pagination .page-numbers.current { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

.btn { display: inline-block; padding: 10px 24px; border-radius: 999px; background: var(--c-primary); color: #fff; font-weight: 600; }
.btn:hover { background: var(--c-primary-dark); color: #fff; }
.center { text-align: center; }
.mt-2 { margin-top: 20px; }

/* ---------- Footer ---------- */
.site-footer { background: linear-gradient(180deg, var(--c-primary-dark), var(--c-primary-deep)); color: rgba(255,255,255,.85); padding: 48px 0 0; margin-top: 0; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h4 { color: var(--c-gold-light); font-size: 1rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: rgba(255,255,255,.85); }
.site-footer a:hover { color: var(--c-gold); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 36px; padding: 18px 0; font-size: .85rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.footer-bottom ul { display: flex; gap: 14px; }
.social-btn { display: inline-block; margin-top: 8px; padding: 8px 18px; border-radius: 999px; background: #06c755; color: #fff !important; font-weight: 600; }

/* ---------- Dream card footer + article (บทความคำทำนายฝัน) ---------- */
.dream-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.read-more { display: inline-flex; align-items: center; gap: 4px; padding: 8px 16px; border-radius: 999px; background: var(--c-primary); color: #fff; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.read-more:hover { background: var(--c-primary-dark); color: #fff; }

/* บทความอ่านสบายตา: ตัวหนังสือใหญ่ขึ้น บรรทัดห่าง ไม่มีกล่องซ้อนกล่อง */
.dream-article { padding: clamp(20px, 5vw, 48px); }
.dream-article .entry-title { margin-bottom: 14px; }
.dream-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 24px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; border: 1px solid transparent; line-height: 1.6; }
.pill-cat { background: #fdecef; color: #b4234a; border-color: #f7cbd6; }
.pill-cat:hover { color: #8f1638; }
.pill-views { background: var(--c-bg); color: var(--c-muted); border-color: var(--c-border); font-weight: 500; }
.pill-rating { background: #fff8e6; color: #7a5200; border-color: #f5d98a; }
.pill-rating .stars { color: #f0a400; letter-spacing: 1px; }
.pill-rating .stars .off { color: #e6dcc4; }
.pill-rating.tone-mixed { background: #f4f6f9; color: #4a5568; border-color: #dfe3ea; }
.pill-rating.tone-warn { background: #fff3ea; color: #9a3c0c; border-color: #f6cfb3; }
.pill-rating.tone-warn .stars { color: #e8792b; }
.pill-rating.tone-bad { background: #fdeeee; color: #9b1c1c; border-color: #f3c4c4; }
.pill-rating.tone-bad .stars { color: #d64545; }
.dream-updated { font-size: .85rem; color: var(--c-muted); }

.dream-lead, .dream-body { max-width: 68ch; }
.dream-lead { font-size: 1.125rem; line-height: 1.9; color: var(--c-text); }
.dream-lead p { margin: 0 0 1em; }
.dream-hero-img { margin: 8px 0 24px; border-radius: 12px; overflow: hidden; }

.dream-toc { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 12px 0; margin: 4px 0 8px; border-top: 1px solid var(--c-border); border-bottom: 1px solid var(--c-border); font-size: .9rem; }
.dream-toc .toc-label { font-weight: 700; color: var(--c-muted); font-size: .8rem; letter-spacing: .03em; }
.dream-toc a { color: var(--c-primary); }
.dream-toc a:hover { text-decoration: underline; }

.dream-body { font-size: 1.0625rem; line-height: 1.9; }
.dream-sec { padding-top: 28px; scroll-margin-top: 90px; }
.dream-sec h2 { font-size: 1.25rem; margin: 0 0 10px; color: var(--c-primary-dark); display: flex; align-items: center; gap: 10px; }
.sec-icon { font-size: 1.05rem; width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--c-bg); }
.dream-sec p { margin: 0 0 1em; }
.dream-sec p:last-child { margin-bottom: 0; }
#caution h2 { color: #9a3c0c; }

.dream-variants { margin: 4px 0 0; }
.dream-variants > div { padding: 12px 0; border-bottom: 1px solid var(--c-border); }
.dream-variants > div:last-child { border-bottom: 0; }
.dream-variants dt { font-weight: 700; color: var(--c-text); }
.dream-variants dd { margin: 2px 0 0; color: var(--c-muted); }

.dream-article .dream-numbers-panel { margin-top: 32px; scroll-margin-top: 90px; }
.dream-numbers-panel h2 { font-size: 1.1rem; color: var(--c-primary); margin-bottom: 10px; }
.share-btn[aria-pressed="true"] { background: var(--c-gold); border-color: var(--c-gold); color: var(--c-primary-deep); }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.share-btn { flex: 1 1 140px; display: inline-flex; justify-content: center; align-items: center; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-align: center; }
.share-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.share-btn.fb { background: #1877f2; border-color: #1877f2; color: #fff; }
.share-btn.line { background: #06c755; border-color: #06c755; color: #fff; }
.share-btn.fb:hover, .share-btn.line:hover { color: #fff; filter: brightness(1.05); }
.related-dreams { margin-top: 28px; }
.related-dreams h2 { font-size: 1.2rem; }
.related-dreams ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.related-dreams a { display: flex; justify-content: space-between; gap: 8px; padding: 12px 16px; border-radius: 12px; background: var(--c-surface); border: 1px solid var(--c-border); color: var(--c-text); font-weight: 600; }
.related-dreams a:hover { border-color: var(--c-primary); color: var(--c-primary); }

/* ---------- ผลค้นหาที่เจอในเนื้อหา ---------- */
.search-hit { display: block; margin: -4px 0 14px; padding: 10px 14px; border-radius: 12px; background: #f3f7fd; border: 1px solid #d6e4f7; color: var(--c-text); font-size: .95rem; line-height: 1.6; }
.search-hit:hover { border-color: var(--c-primary); color: var(--c-text); }
.search-hit .hit-label { display: block; font-size: .78rem; font-weight: 700; color: var(--c-primary); letter-spacing: .02em; }
.search-hit strong { display: block; }
.search-hit .hit-text { display: block; color: var(--c-muted); }
.search-hit .hit-more { display: inline-block; margin-top: 2px; font-size: .85rem; font-weight: 600; color: var(--c-primary); }
mark { background: #fde8b0; color: inherit; padding: 0 2px; border-radius: 3px; }
.dream-variants > div { scroll-margin-top: 90px; transition: background .6s; }
.dream-variants > div:target { background: #fff6dc; border-radius: 8px; padding-left: 10px; padding-right: 10px; }

/* ---------- Blog article (บทความ) ---------- */
.article-body { max-width: 68ch; font-size: 1.0625rem; line-height: 1.9; }
.article-body > * { margin: 0 0 1.1em; }
.article-body h2 { font-size: 1.35rem; color: var(--c-primary-dark); margin: 1.8em 0 .6em; padding-top: 4px; scroll-margin-top: 90px; }
.article-body h3 { font-size: 1.1rem; color: var(--c-text); margin: 1.4em 0 .4em; }
.article-body ul, .article-body ol { padding-left: 1.4em; }
.article-body li { margin-bottom: .45em; }
.article-body li::marker { color: var(--c-primary); font-weight: 700; }
.article-body strong { color: var(--c-text); }
.article-body a { text-decoration: underline; text-underline-offset: 3px; }
.article-body blockquote, .article-body .tip { margin: 1.6em 0; padding: 14px 18px; border-left: 4px solid var(--c-gold); background: #fffaf0; border-radius: 0 12px 12px 0; }
.article-body blockquote p:last-child, .article-body .tip p:last-child { margin-bottom: 0; }
.article-body .tip-title { display: block; font-weight: 700; color: #8a6510; margin-bottom: 4px; }
.article-body figure { margin: 1.6em 0; }
.article-body figcaption { font-size: .85rem; color: var(--c-muted); text-align: center; margin-top: 6px; }
.table-wrap { overflow-x: auto; margin: 1.4em 0; }
.article-body table { width: 100%; border-collapse: collapse; font-size: .95rem; line-height: 1.6; min-width: 480px; }
.article-body th, .article-body td { padding: 10px 12px; border-bottom: 1px solid var(--c-border); text-align: left; vertical-align: top; }
.article-body thead th { background: var(--c-bg); color: var(--c-primary-dark); font-weight: 700; }
.article-body details { border: 1px solid var(--c-border); border-radius: 12px; padding: 0 16px; margin-bottom: 8px; background: var(--c-surface); }
.article-body summary { cursor: pointer; font-weight: 700; padding: 12px 0; }
.article-body details[open] summary { color: var(--c-primary); }
.article-body details p { margin: 0 0 12px; }
.article-body .note { font-size: .85rem; color: var(--c-muted); border-top: 1px solid var(--c-border); padding-top: 12px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.post-tags a { font-size: .85rem; padding: 3px 10px; border-radius: 999px; background: var(--c-bg); color: var(--c-muted); }
.post-tags a:hover { color: var(--c-primary); }
.related-posts { margin-top: 32px; }
.related-posts h2 { font-size: 1.2rem; }

/* ---------- Fortune sticks (เสี่ยงเซียมซี) ---------- */
.fortune-banner { background: radial-gradient(circle at 85% 20%, rgba(232,178,58,.3), transparent 45%), linear-gradient(135deg, var(--c-primary), var(--c-primary-deep)); color: #fff; border-radius: var(--radius); padding: clamp(22px, 4vw, 36px); margin-bottom: 24px; }
.fortune-banner .eyebrow { display: inline-block; background: var(--c-gold); color: var(--c-primary-deep); font-size: .8rem; font-weight: 700; padding: 2px 12px; border-radius: 999px; margin-bottom: 10px; }
.fortune-banner h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin-bottom: 6px; }
.fortune-banner p { margin: 0; opacity: .88; max-width: 60ch; }
.muted { color: var(--c-muted); }
.small { font-size: .85rem; }
.btn-gold { border: 0; cursor: pointer; font: inherit; font-weight: 700; background: linear-gradient(135deg, var(--c-gold), #d1901c); color: var(--c-primary-deep); padding: 12px 32px; }
.btn-gold:hover { color: var(--c-primary-deep); filter: brightness(1.05); background: linear-gradient(135deg, var(--c-gold), #d1901c); }
.btn-gold:disabled { opacity: .7; cursor: wait; }

.fortune-panel { text-align: center; overflow: hidden; background: radial-gradient(ellipse at 50% 55%, #fff6e0 0%, var(--c-surface) 60%); }
.fortune-head { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; position: relative; }
.fortune-head h2 { color: var(--c-primary); margin: 0; }
.sound-toggle { border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text); font: inherit; font-size: .8rem; padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.sound-toggle[aria-pressed="false"] { color: var(--c-muted); }
@media (min-width: 600px) { .fortune-head .sound-toggle { position: absolute; right: 0; } }
.fortune-panel > .muted { max-width: 46ch; margin: 8px auto 0; }

/* เวที + กระบอก */
.cup-stage { position: relative; height: 360px; display: grid; place-items: center; margin: 4px 0 8px; }
.cup-glow { position: absolute; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(232,178,58,.35), transparent 65%); animation: glow 3.2s ease-in-out infinite; }
.cup { position: relative; z-index: 1; width: 190px; padding: 0; border: 0; background: none; cursor: pointer; transform-origin: 50% 92%; animation: cup-idle 3.2s ease-in-out infinite; -webkit-tap-highlight-color: transparent; }
.cup:hover .cup-svg { filter: drop-shadow(0 10px 18px rgba(120, 10, 10, .28)) brightness(1.04); }
.cup:focus-visible { outline: 3px solid var(--c-gold); outline-offset: 6px; border-radius: 24px; }
.cup-svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 8px 14px rgba(120, 10, 10, .22)); transition: filter .2s; }
.cup-svg .stk { transform-box: fill-box; transform-origin: 50% 100%; }
.cup-shadow { position: absolute; bottom: 12px; width: 170px; height: 20px; border-radius: 50%; background: radial-gradient(rgba(40, 10, 10, .28), transparent 70%); }

.cup.shaking { animation: cup-shake .16s ease-in-out infinite alternate; }
.cup.shaking .stk { animation: stk-jig .1s ease-in-out infinite alternate; }
.cup.shaking .stk:nth-child(odd) { animation-delay: .05s; }
.cup.shaking .stk:nth-child(3n) { animation-duration: .13s; }

/* ไม้เซียมซีที่หล่นออกมา */
.fallen-stick { position: absolute; z-index: 2; left: calc(50% - 8px); top: 70px; width: 16px; height: 150px; border-radius: 5px; background: linear-gradient(90deg, #c79358, #f5deb2 50%, #bd8a4f); box-shadow: 0 4px 10px rgba(0,0,0,.18); opacity: 0; pointer-events: none; }
.fallen-stick::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 20px; border-radius: 5px 5px 2px 2px; background: #c62828; }
.fs-no { position: absolute; left: 0; right: 0; top: 34px; writing-mode: vertical-rl; text-orientation: upright; font-size: 11px; font-weight: 800; color: #7a0c0c; line-height: 16px; text-align: center; }
.cup-stage.dropped .fallen-stick { animation: stick-out .8s cubic-bezier(.25, .8, .3, 1) forwards; }

@keyframes glow { 0%, 100% { opacity: .7; transform: scale(.95); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes cup-idle { 0%, 100% { transform: rotate(0) translateY(0); } 50% { transform: rotate(-2.5deg) translateY(-4px); } }
@keyframes cup-shake { from { transform: rotate(-17deg) translate(-8px, -12px); } to { transform: rotate(-5deg) translate(5px, 0); } }
@keyframes stk-jig { from { transform: translateY(0); } to { transform: translateY(-10px); } }
@keyframes stick-out {
	0% { opacity: 1; transform: translate(-40px, 0) rotate(-14deg); }
	45% { opacity: 1; transform: translate(10px, -90px) rotate(25deg); }
	100% { opacity: 1; transform: translate(105px, 120px) rotate(78deg); }
}

.btn-shake { font-size: 1.1rem; padding: 14px 40px; box-shadow: 0 6px 18px rgba(209, 144, 28, .35); }
.btn-shake:not(:disabled) { animation: btn-pulse 2.4s ease-in-out infinite; }
@keyframes btn-pulse { 0%, 100% { box-shadow: 0 6px 18px rgba(209, 144, 28, .35); } 50% { box-shadow: 0 6px 26px rgba(209, 144, 28, .6); } }

/* ผลเซียมซี */
.fortune-result { margin-top: 20px; border: 1.5px solid var(--c-gold); background: #fffbf0; border-radius: 14px; padding: 20px; text-align: left; animation: pop-in .45s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.f-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.f-no { font-size: 1.1rem; color: var(--c-primary); }
.f-no strong { font-size: 2rem; font-variant-numeric: tabular-nums; }
.f-level { padding: 4px 14px; border-radius: 999px; font-weight: 700; font-size: .9rem; }
.f-level.lv1 { background: #1f8a4c; color: #fff; }
.f-level.lv2 { background: #d8f0e1; color: #1d6b3f; }
.f-level.lv3 { background: #fdf0c8; color: #8a6510; }
.f-level.lv4 { background: #fbdcdc; color: #9b1c1c; }
.f-text { font-size: 1.15rem; font-weight: 600; margin: 0 0 14px; }
.f-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 0 0 14px; }
.f-grid div { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 10px; padding: 10px 12px; }
.f-grid dt { font-size: .8rem; font-weight: 700; color: var(--c-primary); letter-spacing: .02em; }
.f-grid dd { margin: 0; }
.form-error { color: #b42318; text-align: center; margin: 10px 0 0; }

@media (prefers-reduced-motion: reduce) {
	.cup, .cup-glow, .btn-shake, .cup.shaking .stk { animation: none !important; }
	.cup.shaking { animation: cup-shake .3s ease-in-out 2 alternate !important; }
	.cup-stage.dropped .fallen-stick { animation-duration: .01s; }
}

/* ---------- Lottery checker (ตรวจหวย) ---------- */
.lotto-check-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.lotto-check-head h2 { margin: 0; color: var(--c-primary); }
.lotto-select { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lotto-select label { font-size: .85rem; font-weight: 600; color: var(--c-muted); }
.lotto-select select { font: inherit; padding: 8px 12px; border: 1px solid var(--c-border); border-radius: 10px; background: var(--c-surface); color: var(--c-text); max-width: 100%; }
.lotto-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.lotto-inputs input { font: inherit; font-size: 1.3rem; font-weight: 700; letter-spacing: .18em; text-align: center; font-variant-numeric: tabular-nums; padding: 10px; border: 1.5px solid var(--c-border); border-radius: 12px; background: var(--c-surface); color: var(--c-text); min-width: 0; }
.lotto-inputs input::placeholder { font-size: .95rem; font-weight: 500; letter-spacing: 0; color: #9aa5b5; }
.lotto-inputs input:focus { border-color: var(--c-primary); outline: none; box-shadow: 0 0 0 3px rgba(3, 69, 146, .15); }
.lotto-inputs input[aria-invalid="true"] { border-color: #b42318; }
.lotto-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 14px; }
.btn-ghost { border: 1px dashed var(--c-border); background: transparent; color: var(--c-primary); font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 999px; cursor: pointer; }
.btn-ghost:hover { border-color: var(--c-primary); }
.lotto-result { margin-top: 18px; display: grid; gap: 10px; }
.lotto-result h3 { margin: 0; color: var(--c-primary); font-size: 1.05rem; }
.lr-ticket { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--c-border); }
.lr-ticket.is-win { background: #fffbf0; border-color: var(--c-gold); }
.lr-ticket.is-lose { background: var(--c-bg); color: var(--c-muted); }
.lr-no { font-size: 1.4rem; font-weight: 800; letter-spacing: .12em; font-variant-numeric: tabular-nums; color: var(--c-text); }
.lr-detail { min-width: 0; }
.lr-detail strong { color: #1a7f37; }
.lr-total { text-align: right; font-size: 1.05rem; padding-top: 4px; }
.lr-total strong { color: #1a7f37; font-size: 1.3rem; }

.lotto-board h2 { color: var(--c-primary); }
.lt-top { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 18px; }
@media (max-width: 720px) { .lt-top { grid-template-columns: 1fr 1fr; } .lt-first { grid-column: 1 / -1; } }
.lt-first, .lt-small { border-radius: 14px; padding: 14px; text-align: center; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.lt-first { background: linear-gradient(160deg, var(--c-primary), var(--c-primary-deep)); color: #fff; }
.lt-small { background: var(--c-bg); border: 1px solid var(--c-border); }
.lt-label { font-size: .85rem; font-weight: 700; }
.lt-first .lt-label { color: var(--c-gold-light); }
.lt-small .lt-label { color: var(--c-primary); }
.lt-num { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.lt-first .lt-num { font-size: clamp(2rem, 6vw, 2.8rem); color: var(--c-gold); }
.lt-small .lt-num { font-size: 1.5rem; }
.lt-amt { font-size: .75rem; opacity: .75; }
.lt-h { font-size: 1.05rem; margin: 20px 0 8px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.lt-h small { font-size: .8rem; font-weight: 400; color: var(--c-muted); }
.lt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.lt-grid span { text-align: center; padding: 6px 4px; border-radius: 8px; background: var(--c-bg); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .05em; }
.lt-wait { color: var(--c-muted); font-weight: 400; font-size: .95rem; letter-spacing: 0; }

/* WP core */
.alignleft { float: left; margin: 0 1em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1em; }
.aligncenter { margin-left: auto; margin-right: auto; }
.wp-caption-text { font-size: .85rem; color: var(--c-muted); }
