/* =====================================================================
   duduangfree.buzz — หน้าแรก (home.css)
   ใช้ตัวแปรสีจาก style.css เท่านั้น / มือถือมาก่อน / เคารพ reduced-motion
   ===================================================================== */

/* ระยะห่างระหว่าง section ของหน้าแรกให้กระชับ (หน้าไม่ยาวเกิน) */
body[data-page="home"] main > .section { padding-top: 30px; padding-bottom: 30px; }

/* ---------- HERO ---------- */
.home-hero {
  position: relative; display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 24px;
  padding-top: 44px; padding-bottom: 28px; overflow-x: clip;
}
.hero-copy { position: relative; z-index: 1; min-width: 0; }
.hero-title { margin: 12px 0 10px; line-height: 1.12; }
.hero-title .glitch { font-size: clamp(2.6rem, 7vw, 4.6rem); font-weight: 600; letter-spacing: .01em; padding-bottom: .06em; }
.hero-title-sub { display: block; margin-top: 6px; font-size: clamp(1.15rem, 2.6vw, 1.7rem); font-weight: 500; color: var(--text); }
.hero-type {
  min-height: 1.8em; margin: 0 0 22px; font-family: var(--font-head); font-size: clamp(1rem, 2vw, 1.15rem); color: var(--text-2);
}
.hero-prompt { font-family: var(--font-latin); color: var(--red); text-shadow: 0 0 8px var(--red-glow); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* ฉากลูกแก้ว + โคม + เหรียญ */
.hero-scene {
  --scene: min(420px, 100%);
  position: relative; width: var(--scene); aspect-ratio: 1; margin: 0 auto; justify-self: center;
}
.scene-ring { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 90s linear infinite; filter: drop-shadow(0 0 10px var(--red-glow)); }
.scene-ring text { font-family: 'Noto Sans Symbols', 'Segoe UI Symbol', serif; font-size: 5px; fill: var(--gold-2); }
.scene-orbit { position: absolute; inset: 15%; border-radius: 50%; border: 1px dashed rgba(247, 197, 72, .28); animation: spin 16s linear infinite; }
.scene-orbit .coin { position: absolute; transform: translate(-50%, -50%); }
.scene-orbit .coin:nth-child(1) { left: 50%; top: 0; }
.scene-orbit .coin:nth-child(2) { left: 7%; top: 75%; }
.scene-orbit .coin:nth-child(3) { left: 93%; top: 75%; }
.scene-beam {
  position: absolute; left: 50%; bottom: 6%; width: 46%; height: 30%; transform: translateX(-50%); pointer-events: none;
  background: linear-gradient(0deg, rgba(247, 197, 72, .35), rgba(168,85,247, .08) 70%, transparent);
  clip-path: polygon(38% 100%, 62% 100%, 100% 0, 0 0); opacity: .7;
}
.scene-beam::after {
  content: ''; position: absolute; left: 30%; right: 30%; bottom: 0; height: 10px; border-radius: 50%;
  background: radial-gradient(ellipse, var(--gold-2), rgba(247, 197, 72, 0) 70%);
}
.orb-btn {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 50%; -webkit-tap-highlight-color: transparent;
}
.orb-btn .orb { --orb-size: clamp(120px, 34vw, 168px); }
.orb-btn .orb > span { font-size: calc(var(--orb-size) * .34); }
/* เส้นโฮโลแกรมทับลูกแก้ว */
.orb-holo {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none; mix-blend-mode: screen; opacity: .55;
  background: repeating-linear-gradient(0deg, rgba(79, 227, 255, .14) 0 1px, transparent 1px 4px);
  animation: holoFlicker 3.2s steps(1) infinite;
}
@keyframes holoFlicker { 0%, 100% { opacity: .5; } 47% { opacity: .5; } 48% { opacity: .15; } 50% { opacity: .65; } 52% { opacity: .4; } }
.orb-btn:hover .orb { filter: brightness(1.12); }
.orb-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 10px; }
.orb-btn.charging .orb { animation: orbCharge .35s ease-in-out infinite alternate; }
.orb-btn.charging .orb::after { animation-duration: 1.2s; border-color: var(--gold-2); }
@keyframes orbCharge { from { transform: scale(1); filter: brightness(1); } to { transform: scale(1.06); filter: brightness(1.35) saturate(1.2); } }
.scene-lantern { position: absolute; top: -8px; z-index: 1; }
.scene-lantern::before { content: ''; position: absolute; left: 50%; top: -30px; width: 1px; height: 46px; background: linear-gradient(var(--gold-3), var(--gold)); }
.scene-lantern .lantern { margin-top: 10px; margin-bottom: 0; }
.scene-lantern.l1 { left: 2%; }
.scene-lantern.l2 { right: 2%; top: 4%; }
.scene-hud {
  position: absolute; font-family: var(--font-latin); font-size: .58rem; letter-spacing: .22em; color: var(--red-2);
  padding: 3px 7px; border: 1px solid var(--border); background: rgba(7,3,15, .7); border-radius: 3px; white-space: nowrap; pointer-events: none;
}
.scene-hud b { color: var(--gold-2); }
.hud-a { left: 0; top: 58%; }
.hud-b { right: 0; top: 30%; }
.orb-cap { position: absolute; left: 0; right: 0; bottom: -4px; margin: 0; text-align: center; font-size: .86rem; color: var(--text-2); }
.orb-cap b { color: var(--gold-2); font-weight: 500; }

/* ---------- TICKER ---------- */
.home-ticker-wrap { margin-top: 6px; }
.home-ticker { box-shadow: 0 0 30px -12px var(--red-glow); }
.home-ticker .marquee-track span { font-family: var(--font-head); font-size: .9rem; color: var(--text-2); }
.home-ticker .marquee-track b { font-family: var(--font-latin); font-weight: 700; font-size: .82rem; color: var(--gold-2); letter-spacing: .04em; }
.tk-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; box-shadow: 0 0 8px currentColor; border: 1px solid rgba(255, 255, 255, .35); }

/* ---------- FEATURED ---------- */
.featured { padding-top: 40px; }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feat-grid > * { min-width: 0; }
.feat-card {
  --rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 0%;
  display: flex; flex-direction: column; gap: 8px; color: var(--text); overflow: hidden; padding: 22px 22px 20px;
  /* ปิด blur เพื่อให้ tilt ลื่น */
  backdrop-filter: none; -webkit-backdrop-filter: none;
  background: linear-gradient(180deg, rgba(168,85,247, .12), rgba(14,6,24, .92) 45%), var(--bg-2);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .45s var(--ease-out), border-color .25s, box-shadow .25s;
}
.feat-card.tilting { transition: transform .08s linear, border-color .25s, box-shadow .25s; }
.feat-card:hover { color: var(--text); border-color: rgba(168,85,247, .6); box-shadow: 0 30px 60px -28px #000, 0 0 40px -10px var(--red-glow); }
.feat-card.gold:hover { border-color: var(--border-2); box-shadow: 0 30px 60px -28px #000, 0 0 40px -10px var(--gold-glow); }
.feat-glare {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--gx) var(--gy), rgba(255, 227, 154, .14), transparent 45%);
}
.feat-card:hover .feat-glare { opacity: 1; }
.feat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.feat-card h3 { font-size: 1.45rem; margin: 4px 0 0; }
.feat-card p { color: var(--text-2); font-size: .95rem; margin: 0; flex: 1; }
.feat-meta { font-size: .88rem; color: var(--text-3); padding: 8px 10px; border: 1px dashed var(--border); border-radius: 8px; background: rgba(6,2,12, .5); }
.feat-meta b { color: var(--gold-2); font-weight: 500; }
.feat-meta .lotto-cd { font-family: var(--font-latin); font-size: .82rem; letter-spacing: .03em; }
.feat-go { font-family: var(--font-head); color: var(--gold); }
.feat-go i { display: inline-block; font-style: normal; transition: transform .25s; }
.feat-card:hover .feat-go i { transform: translateX(5px); }
.feat-preview { height: 140px; display: grid; place-items: center; margin: 4px 0 2px; position: relative; }
.feat-preview::before { /* พื้นวง grid HUD จางๆ */
  content: ''; position: absolute; inset: 6px 10%; border-radius: 50%;
  background: radial-gradient(circle, rgba(168,85,247, .16), transparent 65%);
}

/* วงล้อจิ๋ว */
.mini-wheel-wrap { position: relative; width: 124px; height: 124px; }
.mini-pointer { position: absolute; left: 50%; top: -6px; z-index: 2; width: 0; height: 0; transform: translateX(-50%);
  border-left: 9px solid transparent; border-right: 9px solid transparent; border-top: 16px solid var(--gold); filter: drop-shadow(0 0 6px var(--gold)); }
.mini-wheel { width: 100%; height: 100%; border-radius: 50%; transition: transform 2.2s cubic-bezier(.15, .85, .25, 1); }
.mw-idle {
  position: relative; width: 100%; height: 100%; border-radius: 50%;
  background: conic-gradient(var(--red-3) 0 60deg, #2a1048 0 120deg, var(--red-3) 0 180deg, #2a1048 0 240deg, var(--red-3) 0 300deg, #2a1048 0);
  box-shadow: 0 0 0 4px var(--gold-3), 0 0 0 6px rgba(255, 227, 154, .4), 0 0 28px var(--red-glow), inset 0 0 18px rgba(0, 0, 0, .6);
}
.mw-idle::after { content: ''; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c4, var(--gold) 50%, var(--gold-3)); box-shadow: 0 0 10px var(--gold-glow); }
.mw-idle span { position: absolute; left: 50%; top: 50%; font-size: 1.15rem; line-height: 1;
  transform: translate(-50%, -50%) rotate(var(--a)) translateY(-38px) rotate(calc(var(--a) * -1)); }
.feat-card.is-live .mw-idle { animation: spin 18s linear infinite; }

/* สล็อตจิ๋ว */
.mini-slot .slot-reel { --slot-h: 64px; }
.mini-slot .slot-strip > span { font-size: calc(var(--slot-h) * .56); }

/* กระบอกเซียมซีจิ๋ว */
.mini-tube { position: relative; width: 90px; height: 128px; transform-origin: 50% 100%; }
.tube-body {
  position: absolute; left: 8px; right: 8px; bottom: 0; height: 78px; border-radius: 8px 8px 14px 14px; z-index: 2;
  background: linear-gradient(90deg, var(--crimson), var(--red) 35%, #c4a1ff 50%, var(--red-3) 70%, var(--crimson));
  box-shadow: inset 0 0 0 2px rgba(247, 197, 72, .55), 0 0 26px var(--red-glow); display: grid; place-items: center;
}
.tube-body::before { content: ''; position: absolute; left: -3px; right: -3px; top: -4px; height: 8px; border-radius: 50%; background: var(--gold-3); box-shadow: 0 0 6px var(--gold-glow); }
.tube-body span { font-family: var(--font-head); font-size: 1.6rem; color: var(--gold-2); text-shadow: 0 0 8px rgba(255, 220, 140, .9); }
.stick { position: absolute; bottom: 40px; width: 7px; height: 76px; border-radius: 3px 3px 0 0; z-index: 1;
  background: linear-gradient(180deg, #ffe7b0, #c99a4a); box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25); transform-origin: 50% 100%; }
.stick.s1 { left: 22px; transform: rotate(-8deg); } .stick.s2 { left: 34px; transform: rotate(-3deg); height: 82px; }
.stick.s3 { left: 52px; transform: rotate(4deg); height: 80px; } .stick.s4 { left: 62px; transform: rotate(9deg); }
.stick.win { left: 42px; height: 84px; width: 10px; background: linear-gradient(180deg, var(--red-2), var(--red) 40%, #c99a4a 40%); transition: transform .6s var(--ease-out); }
.stick.win em { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-style: normal; font-family: var(--font-latin); font-weight: 700; font-size: .74rem;
  color: #2a1503; background: var(--gold); border-radius: 4px; padding: 2px 5px; box-shadow: 0 0 10px var(--gold-glow); opacity: 0; transition: opacity .3s .5s; white-space: nowrap; }
.mini-tube.shaking { animation: tubeShake .9s ease-in-out; }
.mini-tube.shaking .stick.win, .mini-tube.done .stick.win { transform: translateY(-14px); transition-delay: .8s; }
.mini-tube.shaking .stick.win em { opacity: 1; transition-delay: 1.2s; }
@keyframes tubeShake {
  0%, 100% { transform: rotate(0); } 15% { transform: rotate(-12deg); } 30% { transform: rotate(10deg); }
  45% { transform: rotate(-9deg); } 60% { transform: rotate(7deg); } 75% { transform: rotate(-4deg); }
}

/* ---------- SECONDARY GRID ---------- */
.more-sec { padding-top: 20px; }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.more-grid > * { min-width: 0; }
.more-tile {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: var(--text); border-radius: var(--radius-sm);
  background: linear-gradient(120deg, rgba(168,85,247, .08), rgba(255, 255, 255, .015)); border: 1px solid var(--border);
  transition: border-color .2s, background .2s, transform .2s, box-shadow .2s;
}
.more-tile:hover { color: var(--text); border-color: rgba(168,85,247, .55); background: rgba(168,85,247, .12); transform: translateY(-2px); box-shadow: 0 0 24px -8px var(--red); }
.more-ico { flex: none; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 1.3rem;
  background: linear-gradient(135deg, rgba(168,85,247, .3), rgba(247, 197, 72, .14)); border: 1px solid var(--border); }
.more-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.more-txt b { font-family: var(--font-head); font-weight: 500; font-size: 1.05rem; }
.more-txt small { color: var(--text-3); font-size: .82rem; }
.more-tile > i { font-style: normal; color: var(--gold); transition: transform .2s; }
.more-tile:hover > i { transform: translateX(4px); }

/* ---------- QUICK FORTUNE ---------- */
.quick-card { padding: 24px; }
.quick-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.quick-head h2 { margin: 0; }
.quick-sub { display: inline-block; font-size: .9rem; color: var(--text-3); font-weight: 400; margin-left: 6px; }
.quick-tabs button { padding: 7px 14px; }
.quick-screen {
  display: flex; align-items: flex-start; gap: 10px; min-height: 84px; padding: 16px 18px; border-radius: 8px;
  background: rgba(4,1,10, .78); border: 1px solid rgba(247, 197, 72, .22);
  box-shadow: inset 0 0 30px -10px rgba(168,85,247, .45);
  background-image: linear-gradient(rgba(168,85,247, .06) 1px, transparent 1px); background-size: 100% 4px;
}
.quick-caret { font-family: var(--font-latin); color: var(--red); text-shadow: 0 0 8px var(--red); line-height: 1.6; }
.quick-line { margin: 0; font-family: var(--font-head); font-size: clamp(1.05rem, 2.4vw, 1.3rem); color: var(--gold-2); text-shadow: 0 0 12px var(--gold-glow); overflow-wrap: anywhere; }
.quick-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.quick-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.quick-btns .btn-red.is-loading { opacity: .75; }

/* ---------- ZODIAC ---------- */
.home-zgrid .zodiac-tile { padding: 12px 4px 10px; font: inherit; }
.home-zgrid .zodiac-tile .glyph { font-size: 1.5rem; }
.zscore { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; font-size: .7rem; color: var(--c); }
.zscore::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }
.zpanel-wrap { margin-top: 18px; min-height: 60px; }
.zpanel-hint, .zpanel-loading { text-align: center; color: var(--text-3); margin: 18px 0 0; }
.zpanel-loading { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 20px 0; }
.zpanel-loading .spinner { width: 36px; height: 36px; }
.zpanel-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.zpanel-head > div:nth-child(2) { flex: 1; min-width: 0; }
.zpanel-head h3 { margin: 0; font-size: 1.4rem; }
.zpanel-head .hud-label { margin-bottom: 2px; }
.zpanel-head .gauge { margin: 0; flex: none; }
.zpanel-glyph { flex: none; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  font-family: 'Noto Sans Symbols', 'Segoe UI Symbol', serif; font-size: 2rem; color: #fff6dc;
  background: radial-gradient(circle at 40% 35%, rgba(247, 197, 72, .4), rgba(168,85,247, .2) 60%, transparent);
  border: 1px solid var(--border-2); text-shadow: 0 0 12px var(--gold), 0 0 24px var(--ember); }
.zpanel-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 22px; align-items: start; }
.zbars .bar-row { grid-template-columns: 96px 1fr 34px; margin: 8px 0; }
.zread .zlead { color: var(--text); font-size: 1rem; line-height: 1.8; min-height: 3.6em; }
.zread .zlucky { margin: 0; color: var(--gold-2); font-size: .95rem; }
.zpanel-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---------- WHY ---------- */
.why-sec { padding-top: 16px; }
.why-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.why-grid > * { min-width: 0; }
.why-item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 16px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(6,2,12, .55); }
.why-ico { font-size: 1.6rem; line-height: 1.2; filter: drop-shadow(0 0 8px var(--red-glow)); }
.why-item b { font-family: var(--font-head); font-weight: 500; color: var(--gold-2); }
.why-item small { font-size: .82rem; line-height: 1.45; }
.why-note { text-align: center; color: var(--text-3); font-size: .85rem; margin: 18px auto 0; max-width: 620px; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 960px) {
  .feat-grid { grid-template-columns: 1fr 1fr; }
  .feat-grid > :last-child { grid-column: 1 / -1; }
  .more-grid { grid-template-columns: 1fr 1fr; }
  .why-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .home-hero { grid-template-columns: 1fr; text-align: center; padding-top: 18px; gap: 4px; }
  .hero-scene { --scene: min(300px, 86vw); order: -1; }
  .hero-cta, .hero-badges { justify-content: center; }
  .zpanel-body { grid-template-columns: 1fr; gap: 6px; }
}
@media (max-width: 640px) {
  .feat-grid { grid-template-columns: 1fr; gap: 14px; }
  .feat-card { padding: 18px; }
  /* มือถือ: การ์ดเด่นวางพรีวิวด้านข้างให้หน้าสั้นลง */
  .feat-card { display: grid; grid-template-columns: 1fr 108px; grid-template-areas: "top top" "title prev" "text prev" "meta meta" "go go"; column-gap: 12px; row-gap: 6px; }
  .feat-top { grid-area: top; }
  .feat-card h3 { grid-area: title; font-size: 1.3rem; }
  .feat-card p { grid-area: text; font-size: .9rem; }
  .feat-preview { grid-area: prev; height: 112px; margin: 0; }
  .feat-meta { grid-area: meta; }
  .feat-go { grid-area: go; }
  .mini-wheel-wrap { width: 96px; height: 96px; }
  .mw-idle span { font-size: .95rem; transform: translate(-50%, -50%) rotate(var(--a)) translateY(-29px) rotate(calc(var(--a) * -1)); }
  .mini-slot { gap: 4px; padding: 6px; }
  .mini-slot .slot-reel { --slot-h: 36px; }
  .mini-tube { transform: scale(.82); }
  .more-grid { grid-template-columns: 1fr; gap: 8px; }
  .more-tile { padding: 11px 12px; }
  .more-ico { width: 40px; height: 40px; }
  .quick-card { padding: 18px; }
  .quick-head { align-items: stretch; }
  .quick-tabs { width: 100%; justify-content: space-between; }
  .quick-tabs button { flex: 1; padding: 7px 4px; }
  .quick-btns, .quick-btns .btn-red { width: 100%; }
  .quick-btns .btn-red { flex: 1; }
  .home-zgrid .zodiac-tile .dates { display: none; }
  .zpanel-head { gap: 12px; }
  .zpanel-glyph { width: 48px; height: 48px; font-size: 1.6rem; }
  .zbars .bar-row { grid-template-columns: 86px 1fr 30px; font-size: .9rem; }
  .zpanel-actions .btn { flex: 1 1 100%; }
  .scene-orbit .coin:nth-child(3) { display: none; }
  .scene-hud { font-size: .5rem; }
}
@media (max-width: 400px) {
  .hero-cta .btn-lg { padding: 13px 18px; font-size: 1rem; }
  .feat-card { grid-template-columns: 1fr 92px; }
  .mini-slot .slot-reel { --slot-h: 30px; }
  .mini-slot { gap: 3px; padding: 5px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .feat-card { transform: none !important; }
  .scene-ring, .scene-orbit, .orb-holo, .feat-card.is-live .mw-idle { animation: none !important; }
}
