/* ============================================================
   goodapp.pro — main.css
   Layout + components หน้าเว็บ (ใช้ตัวแปรจาก theme.css)
   ============================================================ */

  *{box-sizing:border-box; margin:0; padding:0;}
  html{scroll-behavior:smooth;}
  body{
    background:var(--bg);
    color:var(--ink);
    font-family:var(--font-body);
    line-height:1.5;
    -webkit-font-smoothing:antialiased;
    position:relative;
    overflow-x:hidden;
  }
  img{max-width:100%; display:block;}
  a{color:inherit; text-decoration:none;}
  ul{list-style:none;}
  ::selection{background:rgba(34,211,238,.35); color:#fff;}
  ::-webkit-scrollbar{width:8px; height:6px;}
  ::-webkit-scrollbar-thumb{background:rgba(34,211,238,.3); border-radius:8px;}

  .wrap{max-width:1240px; margin:0 auto; padding:0 20px; position:relative; z-index:2;}

  /* ---------- Atmosphere background (fixed, behind everything) ---------- */
  @keyframes grid-travel{0%{background-position:0 0;}100%{background-position:0 50px;}}
  .atmosphere{position:fixed; inset:0; z-index:0; pointer-events:none; overflow:hidden;}
  .atmosphere .grid{
    position:absolute; inset:0;
    background-size:50px 50px;
    background-image:
      linear-gradient(to right, rgba(var(--grid-rgb),var(--grid-opacity)) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(var(--grid-rgb),var(--grid-opacity)) 1px, transparent 1px);
    animation:grid-travel 16s linear infinite;
    mask-image:radial-gradient(circle at 50% 50%, rgba(0,0,0,1) 20%, rgba(0,0,0,.1) 85%);
    -webkit-mask-image:radial-gradient(circle at 50% 50%, rgba(0,0,0,1) 20%, rgba(0,0,0,.1) 85%);
    opacity:.8;
  }
  .atmosphere .dots{
    position:absolute; inset:0;
    background-size:25px 25px;
    background-image:radial-gradient(rgba(var(--dots-rgb),var(--dots-opacity)) 1px, transparent 1px);
    mask-image:radial-gradient(circle at 50% 50%, rgba(0,0,0,.8) 30%, rgba(0,0,0,0) 75%);
    -webkit-mask-image:radial-gradient(circle at 50% 50%, rgba(0,0,0,.8) 30%, rgba(0,0,0,0) 75%);
    opacity:.6;
  }
  .atmosphere .orb{position:absolute; border-radius:50%; filter:blur(10px);}
  .atmosphere .orb.cyan{width:640px; height:640px; top:-120px; left:-140px; background:radial-gradient(circle, rgba(var(--grid-rgb),.16) 0%, rgba(2,6,23,0) 70%);}
  .atmosphere .orb.purple{width:680px; height:680px; bottom:-160px; right:-160px; background:radial-gradient(circle, rgba(168,85,247,.16) 0%, rgba(2,6,23,0) 70%);}
  #atmosphere-canvas{position:absolute; inset:0; width:100%; height:100%;}
  @media (prefers-reduced-motion:reduce){ .atmosphere .grid{animation:none;} #atmosphere-canvas{display:none;} }

  /* ---------- Placeholder art (no real images) ---------- */
  .art{position:relative; width:100%; overflow:hidden; background:var(--card-solid); border:1px solid var(--line);}
  .art::before{content:""; position:absolute; inset:0; background-size:22px 22px; background-image:radial-gradient(rgba(255,255,255,.10) 1px, transparent 1px); opacity:.5;}
  .art::after{content:attr(data-tag); position:absolute; right:12px; bottom:10px; font-family:var(--font-mono); font-size:10.5px; letter-spacing:.06em; color:rgba(255,255,255,.5); text-transform:uppercase;}
  .art.ratio-16-9{aspect-ratio:16/9;} .art.ratio-4-3{aspect-ratio:4/3;} .art.ratio-1-1{aspect-ratio:1/1;}
  .art.tech{background:radial-gradient(circle at 30% 20%, rgba(34,211,238,.35), transparent 55%), linear-gradient(135deg,#020617,#0B2530);}
  .art.ev{background:radial-gradient(circle at 30% 20%, rgba(52,211,153,.35), transparent 55%), linear-gradient(135deg,#020617,#062B1D);}
  .art.review{background:radial-gradient(circle at 30% 20%, rgba(168,85,247,.35), transparent 55%), linear-gradient(135deg,#020617,#1E1035);}
  .art.game{background:radial-gradient(circle at 30% 20%, rgba(236,72,153,.35), transparent 55%), linear-gradient(135deg,#020617,#2B0A1E);}
  .art.trend{background:radial-gradient(circle at 30% 20%, rgba(251,191,36,.30), transparent 55%), linear-gradient(135deg,#020617,#2A1E05);}
  .art.life{background:radial-gradient(circle at 30% 20%, rgba(45,212,191,.30), transparent 55%), linear-gradient(135deg,#020617,#052A26);}
  .art.hero{background:radial-gradient(circle at 25% 25%, rgba(34,211,238,.4), transparent 50%), radial-gradient(circle at 80% 70%, rgba(168,85,247,.35), transparent 50%), #020617;}

  /* ---------- Topbar ---------- */
  .topbar{background:var(--topbar-bg); backdrop-filter:blur(10px); border-bottom:1px solid var(--line); font-family:var(--font-mono); font-size:12px; position:relative; z-index:3;}
  .topbar .wrap{display:flex; align-items:center; justify-content:space-between; height:34px;}
  .topbar .live{display:flex; align-items:center; gap:8px; letter-spacing:.05em; color:var(--muted);}
  .dot{width:7px; height:7px; border-radius:50%; background:var(--c-tech); box-shadow:0 0 0 0 rgba(34,211,238,.6); animation:pulse 1.8s infinite;}
  @keyframes pulse{0%{box-shadow:0 0 0 0 rgba(34,211,238,.55);} 70%{box-shadow:0 0 0 6px rgba(34,211,238,0);} 100%{box-shadow:0 0 0 0 rgba(34,211,238,0);}}
  .topbar .social{display:flex; gap:14px; color:var(--heading);}
  .topbar .social a{display:flex; color:var(--heading);}
  .topbar .social svg{width:15px; height:15px;}

  /* ---------- Header ---------- */
  header.site{background:var(--header-bg); backdrop-filter:blur(14px); border-bottom:1px solid var(--line); position:sticky; top:0; z-index:50;}
  header.site .wrap{display:flex; align-items:center; justify-content:space-between; height:76px; gap:20px;}
  .logo{display:flex; align-items:center; gap:10px; white-space:nowrap; text-decoration:none; color:inherit;}
  .logo-mark{
    width:38px; height:38px; border-radius:11px;
    background:linear-gradient(135deg, var(--c-tech), #2563EB);
    display:flex; align-items:center; justify-content:center;
    box-shadow:0 0 20px rgba(34,211,238,.25);
    flex-shrink:0;
  }
  .logo-mark svg{width:20px; height:20px; color:#020617;}
  .logo-mark-fallback{color:#fff; font-family:var(--font-display); font-weight:800; font-size:19px;}
  .logo-mark-img{object-fit:cover;}
  .logo-text-wrap{display:flex; flex-direction:column; line-height:1.15;}
  .logo-text{font-family:var(--font-display); font-weight:800; font-size:22px; color:var(--heading); letter-spacing:-.01em;}
  .logo-text .accent{color:var(--c-tech);}
  .logo-tagline{font-size:11px; color:var(--muted); font-weight:500; margin-top:1px;}

  nav.primary{display:flex; align-items:center; gap:4px; font-size:14px; font-weight:500; position:relative;}
  nav.primary > a{padding:9px 13px; border-radius:999px; color:var(--muted); position:relative; z-index:1; transition:color .15s;}
  nav.primary > a.active{
    font-weight:700; background-image:linear-gradient(90deg, var(--active-grad-1), var(--active-grad-2));
    -webkit-background-clip:text; background-clip:text; color:transparent; -webkit-text-fill-color:transparent;
  }
  .nav-indicator{
    position:absolute; top:0; height:100%; border-radius:999px; z-index:0;
    background:transparent; border:1.5px solid rgba(var(--nav-hover-rgb),.8);
    box-shadow:0 0 14px rgba(var(--nav-hover-rgb),.5), inset 0 0 10px rgba(var(--nav-hover-rgb),.12);
    opacity:0; pointer-events:none;
    transition:left .25s cubic-bezier(.4,0,.2,1), width .25s cubic-bezier(.4,0,.2,1), opacity .15s;
  }
  nav.primary:hover .nav-indicator{opacity:1;}
  nav.primary > a:hover{color:var(--heading);}

  .head-actions{display:flex; align-items:center; gap:12px;}
  .btn-cta{
    background:linear-gradient(135deg, var(--c-tech), #2563EB);
    color:#020617; font-family:var(--font-display); font-weight:700; font-size:13.5px;
    padding:10px 20px; border-radius:999px; box-shadow:0 0 22px rgba(34,211,238,.25);
    transition:filter .15s;
  }
  .btn-cta:hover{filter:brightness(1.08);}
  .burger{display:none; width:38px; height:38px; border:1px solid var(--line); border-radius:10px; background:transparent; cursor:pointer; align-items:center; justify-content:center;}
  .burger span{display:block; width:16px; height:2px; background:var(--heading); position:relative; transition:background .15s;}
  .burger span::before,.burger span::after{content:"";position:absolute;left:0;width:16px;height:2px;background:var(--heading); transition:background .15s;}
  .burger span::before{top:-5px;} .burger span::after{top:5px;}

  /* ---------- Mobile nav dropdown (ซ่อนเป็น default, เปิดผ่าน JS ใส่ class .open) ---------- */
  .mobile-nav{
    display:none; flex-direction:column; background:var(--card); border-bottom:1px solid var(--line);
    padding:8px 20px 14px; position:relative; z-index:5;
  }
  .mobile-nav a{padding:12px 6px; border-bottom:1px solid var(--line); color:var(--ink); font-size:15px; font-weight:500;}
  .mobile-nav a:last-child{border-bottom:none;}
  .mobile-nav.open{display:flex;}

  /* ---------- Section headings ---------- */
  .section{padding:56px 0; position:relative; z-index:2;}
  .section.tight{padding:40px 0;}
  .section-head{display:flex; align-items:flex-end; justify-content:space-between; margin-bottom:24px; border-bottom:1px solid var(--line); padding-bottom:14px;}
  .section-head h2{font-family:var(--font-display); font-size:26px; font-weight:700; color:var(--heading); display:flex; align-items:center; gap:10px;}
  .section-head .see-all{font-family:var(--font-mono); font-size:12px; letter-spacing:.05em; color:var(--muted); border-bottom:1px solid transparent;}
  .section-head .see-all:hover{color:var(--c-tech); border-color:var(--c-tech);}
  .swatch{width:11px;height:11px;border-radius:3px;display:inline-block;}

  /* eyebrow / category chip — glass pill style */
  .chip{display:inline-flex; align-items:center; gap:6px; font-family:var(--font-mono); font-size:10.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; padding:4px 10px; border-radius:999px;}
  .chip.tech{background:rgba(var(--c-tech-rgb),.12); color:var(--c-tech); border:1px solid rgba(var(--c-tech-rgb),.3);}
  .chip.ev{background:rgba(var(--c-ev-rgb),.12); color:var(--c-ev); border:1px solid rgba(var(--c-ev-rgb),.3);}
  .chip.review{background:rgba(var(--c-review-rgb),.12); color:var(--c-review); border:1px solid rgba(var(--c-review-rgb),.3);}
  .chip.game{background:rgba(var(--c-game-rgb),.12); color:var(--c-game); border:1px solid rgba(var(--c-game-rgb),.3);}
  .chip.trend{background:rgba(var(--c-trend-rgb),.12); color:var(--c-trend); border:1px solid rgba(var(--c-trend-rgb),.3);}
  .chip.life{background:rgba(var(--c-life-rgb),.12); color:var(--c-life); border:1px solid rgba(var(--c-life-rgb),.3);}

  /* ---------- Hero ---------- */
  .hero-grid{display:grid; grid-template-columns:1fr 360px; gap:22px;}
  .hero-main .art{border-radius:22px;}
  .hero-main .cap{padding-top:18px;}
  .hero-main h1{font-family:var(--font-display); font-size:32px; line-height:1.25; font-weight:700; color:var(--heading); margin:12px 0 10px;}
  .hero-main h1 .grad{background:linear-gradient(90deg, var(--c-tech), var(--c-review)); -webkit-background-clip:text; background-clip:text; color:transparent;}
  .hero-main p.dek{color:var(--muted); font-size:15px; max-width:60ch;}
  .meta{font-family:var(--font-mono); font-size:11.5px; color:var(--muted); display:flex; gap:14px; align-items:center; margin-top:12px;}

  .hero-side{display:flex; flex-direction:column; gap:16px;}
  .hero-side .rank-panel{height:100%;}

  /* ---------- Pulse ticker ---------- */
  .ticker{padding:14px 0; position:relative; z-index:2;}
  .ticker-row{display:flex; align-items:center; height:46px; background:var(--topbar-bg); backdrop-filter:blur(10px); border:1px solid rgba(var(--accent-rgb),.4); border-radius:14px; overflow:hidden;}
  .ticker-label{font-family:var(--font-display); font-weight:700; font-size:13px; background:linear-gradient(135deg, var(--accent-grad-1), var(--accent-grad-2)); color:#020617; height:100%; display:flex; align-items:center; padding:0 18px; white-space:nowrap; letter-spacing:.03em; z-index:2;}
  .ticker-track-wrap{overflow:hidden; flex:1; position:relative; height:100%;}
  .ticker-track{display:flex; align-items:center; gap:36px; position:absolute; white-space:nowrap; animation:scroll-left 32s linear infinite; height:100%;}
  .ticker-track span.item{font-family:var(--font-mono); font-size:13px; display:inline-flex; align-items:center; gap:10px; color:var(--ink);}
  .ticker-track span.item::before{content:"▸"; color:var(--c-trend);}
  @keyframes scroll-left{0%{transform:translateX(0);} 100%{transform:translateX(-50%);}}
  @media (prefers-reduced-motion:reduce){ .ticker-track{animation:none;} .dot{animation:none;} }

  /* ---------- Article grid cards ---------- */
  .grid-4{display:grid; grid-template-columns:repeat(4,1fr); gap:20px;}
  .grid-3{display:grid; grid-template-columns:repeat(3,1fr); gap:20px;}
  .card{background:var(--card); border:1px solid var(--line); border-radius:22px; overflow:hidden; backdrop-filter:blur(8px); transition:transform .2s ease, border-color .2s ease, box-shadow .2s ease;}
  .card:hover{transform:translateY(-6px); border-color:rgba(34,211,238,.4); box-shadow:0 12px 30px rgba(0,0,0,.35), 0 0 24px rgba(34,211,238,.12);}
  .card .art{border-radius:22px 22px 0 0;}
  .card .body{padding:16px 18px 20px;}
  .card .chip{margin-bottom:12px;}
  .card h3{font-family:var(--font-display); font-size:16px; font-weight:600; line-height:1.35; margin-bottom:10px; min-height:44px; color:var(--heading);}

  /* การ์ดสีขอบ/พื้นหลังแยกตามหมวด (ครอบที่ grid container) */
  .grid-tech .card{border-color:rgba(var(--c-tech-rgb),.28); background:linear-gradient(180deg, rgba(var(--c-tech-rgb),.07), var(--card));}
  .grid-review .card{border-color:rgba(var(--c-review-rgb),.28); background:linear-gradient(180deg, rgba(var(--c-review-rgb),.07), var(--card));}
  .grid-game .card{border-color:rgba(var(--c-game-rgb),.28); background:linear-gradient(180deg, rgba(var(--c-game-rgb),.07), var(--card));}
  .grid-trend .card{border-color:rgba(var(--c-trend-rgb),.28); background:linear-gradient(180deg, rgba(var(--c-trend-rgb),.07), var(--card));}
  .grid-watch .card{border-color:rgba(var(--c-watch-rgb),.28); background:linear-gradient(180deg, rgba(var(--c-watch-rgb),.07), var(--card));}
  .grid-tech .card:hover{border-color:rgba(var(--c-tech-rgb),.5);}
  .grid-review .card:hover{border-color:rgba(var(--c-review-rgb),.5);}
  .grid-game .card:hover{border-color:rgba(var(--c-game-rgb),.5);}
  .grid-trend .card:hover{border-color:rgba(var(--c-trend-rgb),.5);}
  .grid-watch .card:hover{border-color:rgba(var(--c-watch-rgb),.5);}

  /* ---------- Two column layout: category + ranking ---------- */
  .split{display:grid; grid-template-columns:1fr 360px; gap:26px; align-items:start;}
  .rank-panel{background:var(--card); border:1px solid var(--line); border-radius:22px; padding:24px; backdrop-filter:blur(8px);}
  .rank-panel h2{font-family:var(--font-display); font-size:18px; color:var(--heading); margin-bottom:18px; display:flex; align-items:center; gap:8px; border-bottom:1px solid var(--line); padding-bottom:14px;}
  .rank-item{display:flex; align-items:flex-start; gap:12px; padding:12px 0; border-bottom:1px solid var(--line);}
  .rank-item:last-child{border-bottom:none; padding-bottom:0;}
  .rank-num{font-family:var(--font-mono); font-weight:700; font-size:19px; color:var(--c-trend); min-width:26px;}
  .rank-item h4{font-family:var(--font-display); font-size:14px; font-weight:600; line-height:1.4; color:var(--heading);}
  .rank-item .meta{color:var(--muted); font-size:10.5px; margin-top:6px;}

  /* ---------- Video thumbnail overlay (ใช้ร่วมกับ .card ทุกกริด) ---------- */
  .play-btn{position:absolute; inset:0; display:flex; align-items:center; justify-content:center;}
  .play-btn svg{width:40px; height:40px; filter:drop-shadow(0 2px 10px rgba(0,0,0,.5));}
  .art .dur{position:absolute; left:10px; bottom:10px; background:rgba(2,6,23,.8); color:#fff; font-family:var(--font-mono); font-size:10.5px; padding:2px 7px; border-radius:6px;}
  /* Playlist card (รับชม) — ชื่อเล็กกว่าการ์ดข่าวทั่วไป */
  .card.playlist h3{font-size:13px; min-height:auto; margin-bottom:6px;}
  .card.playlist .body{padding:12px 14px 16px;}

  /* ---------- Newsletter ---------- */
  .newsletter{background:linear-gradient(120deg, var(--accent-grad-1), var(--accent-grad-2)); color:#020617; border-radius:26px; padding:38px 42px; display:flex; align-items:center; justify-content:space-between; gap:24px; flex-wrap:wrap;}
  .newsletter h2{font-family:var(--font-display); font-size:24px; font-weight:800; max-width:420px;}
  .newsletter p{font-size:13px; opacity:.85; margin-top:6px; max-width:420px;}
  .nl-form{display:flex; gap:10px; flex-wrap:wrap;}
  .nl-form input{background:rgba(2,6,23,.15); border:1.5px solid rgba(2,6,23,.3); padding:12px 18px; border-radius:999px; font-family:var(--font-body); font-size:14px; width:240px; color:#020617;}
  .nl-form input::placeholder{color:rgba(2,6,23,.6);}
  .nl-form button{background:#020617; color:#fff; border:none; padding:12px 24px; border-radius:999px; font-family:var(--font-display); font-weight:700; font-size:14px; cursor:pointer;}
  .nl-form button:hover{background:#0B1220;}

  /* ---------- Footer ---------- */
  footer{background:var(--footer-bg); backdrop-filter:blur(10px); border-top:1px solid var(--line); padding:52px 0 24px; margin-top:20px; position:relative; z-index:2;}
  .foot-grid{display:grid; grid-template-columns:1.4fr repeat(4,1fr); gap:28px; padding-bottom:32px; border-bottom:1px solid var(--line);}
  .foot-about{font-size:12.5px; color:var(--muted); margin-top:14px; max-width:32ch;}
  .foot-col h5{font-family:var(--font-mono); font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); margin-bottom:14px;}
  .foot-col ul li{margin-bottom:9px;}
  .foot-col ul li a{font-size:13.5px; color:var(--ink);}
  .foot-col ul li a:hover{color:var(--c-tech);}
  .foot-bottom{display:flex; align-items:center; justify-content:space-between; padding-top:22px; font-size:12px; color:var(--muted); flex-wrap:wrap; gap:12px;}
  .foot-copyright{display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:12px; color:var(--muted);}
  .foot-copyright a{color:var(--muted); transition:color .15s;}
  .foot-copyright a:hover{color:var(--nav-hover);}
  .foot-copyright .sep{color:var(--line);}
  .foot-social{display:flex; gap:12px;}
  .foot-social a{width:32px; height:32px; border:1px solid var(--line); border-radius:50%; display:flex; align-items:center; justify-content:center; color:var(--ink);}
  .foot-social a svg{width:15px; height:15px;}
  .foot-social a:hover{border-color:var(--c-tech); color:var(--c-tech);}

  /* ---------- Responsive ---------- */
  @media (max-width:980px){
    .grid-4{grid-template-columns:repeat(2,1fr);}
    .grid-3{grid-template-columns:repeat(2,1fr);}
    .split{grid-template-columns:1fr;}
    .hero-grid{grid-template-columns:1fr;}
    .foot-grid{grid-template-columns:1fr 1fr; row-gap:28px;}
  }
  @media (max-width:720px){
    nav.primary{display:none;}
    .burger{display:flex;}
    .grid-4, .grid-3{grid-template-columns:repeat(3,1fr); gap:12px;}
    .grid-4 > *:nth-child(n+7), .grid-3 > *:nth-child(n+7){display:none;}
    .card .body{padding:10px;}
    .card h3{font-size:13px;}
    .newsletter{flex-direction:column; align-items:flex-start;}
    .foot-grid{grid-template-columns:1fr 1fr; row-gap:24px;}
    .foot-grid > div:first-child{grid-column:1/-1; margin-bottom:4px;}
    .foot-about{max-width:none;}

    /* ลดความรก: ตัดเนื้อหาส่วนเกินบนมือถือ */
    .section{padding:32px 0;}
    .section.tight{padding:24px 0;}
    .hero-side .rank-panel{padding:20px;}
    .rank-item:nth-child(n+7){display:none;}
    .card h3{
      min-height:0;
      display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
    }
    .hero-main p.dek{
      display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
    }
  }
  @media (max-width:520px){
    .hero-main h1{font-size:24px;}
    .logo-text{font-size:19px;}
    .section-head h2{font-size:21px;}
    .foot-grid{grid-template-columns:1fr;}
  }

  /* ==========================================================
     Toggle switch UI (sun/moon) — ใช้ร่วมกันทั้ง 2 โหมด
     เทคนิค: hidden checkbox + :has() ให้ body ปรับ custom properties เอง
     ========================================================== */
  #darkmode-toggle{width:0; height:0; visibility:hidden; display:none;}
  .darkmode-label{
    display:flex; align-items:center; position:relative; cursor:pointer;
    width:52px; height:28px; border-radius:28px; background:var(--line);
    box-shadow:inset 0 1px 3px rgba(0,0,0,.3); transition:.3s; flex-shrink:0;
  }
  .thumb{
    position:absolute; top:2px; left:2px; width:24px; height:24px; border-radius:50%;
    background:linear-gradient(180deg,#E7EAF0,#94A3B8); box-shadow:0 1px 3px rgba(0,0,0,.35);
    display:flex; align-items:center; justify-content:center; transition:transform .3s;
  }
  .thumb .sun,.thumb .moon{
    position:absolute; width:14px; height:14px; display:flex; align-items:center; justify-content:center;
    transition:opacity .2s; pointer-events:none;
  }
  .thumb .moon{opacity:1; color:#475569;}
  .thumb .sun{opacity:0; color:#F59E0B;}
  .thumb svg{width:14px; height:14px;}

  body:has(#darkmode-toggle:checked) .thumb{transform:translateX(24px); background:linear-gradient(180deg,#FDE68A,#F59E0B);}
  body:has(#darkmode-toggle:checked) .thumb .moon{opacity:0;}
  body:has(#darkmode-toggle:checked) .thumb .sun{opacity:1; color:#7C2D12;}

  /* ---------- Nav indicator (วงรีตาม active/hover) ต้องมีขอบขาวเพิ่ม เฉพาะ Light mode เพื่อให้เห็นชัดบนพื้นครีม ---------- */
  body:has(#darkmode-toggle:checked) .nav-indicator{
    background:#fff;
    outline:1.5px solid #fff;
    outline-offset:-1px;
  }

  /* ---------- โลโก้: ไล่สีตาม active-grad ของธีม เฉพาะ Light mode (เดิม fix เป็นฟ้า-น้ำเงินตลอด) ---------- */
  body:has(#darkmode-toggle:checked) .logo-mark-fallback{
    background:linear-gradient(135deg, var(--active-grad-1), var(--active-grad-2));
    box-shadow:0 0 20px rgba(var(--nav-hover-rgb),.35);
  }
  body:has(#darkmode-toggle:checked) .logo-text .accent{
    background-image:linear-gradient(90deg, var(--active-grad-1), var(--active-grad-2));
    -webkit-background-clip:text; background-clip:text; color:transparent; -webkit-text-fill-color:transparent;
  }

  /* ---------- โลโก้: ไล่สีส้มตาม theme เฉพาะ Light mode (Dark mode ยังเป็น cyan→blue เดิม) ---------- */
  body:has(#darkmode-toggle:checked) .logo-mark:not(.logo-mark-img){
    background:linear-gradient(135deg, var(--active-grad-1), var(--active-grad-2));
    box-shadow:0 0 20px rgba(245,158,11,.25);
  }
  body:has(#darkmode-toggle:checked) .logo-text .accent{
    background-image:linear-gradient(90deg, var(--active-grad-1), var(--active-grad-2));
    -webkit-background-clip:text; background-clip:text; color:transparent; -webkit-text-fill-color:transparent;
  }

  /* ---------- Social icons: สีแบรนด์จริงเฉพาะ Light mode (Dark mode ยังใช้สีเดียว currentColor เหมือนเดิม) ---------- */
  body:has(#darkmode-toggle:checked) .social-facebook{color:#1877F2;}
  body:has(#darkmode-toggle:checked) .social-instagram{color:#E4405F;}
  body:has(#darkmode-toggle:checked) .social-youtube{color:#FF0000;}
  body:has(#darkmode-toggle:checked) .social-tiktok{color:#000000;}
  body:has(#darkmode-toggle:checked) .social-x{color:#000000;}
  body:has(#darkmode-toggle:checked) .foot-social a.social-facebook:hover{border-color:#1877F2;}
  body:has(#darkmode-toggle:checked) .foot-social a.social-instagram:hover{border-color:#E4405F;}
  body:has(#darkmode-toggle:checked) .foot-social a.social-youtube:hover{border-color:#FF0000;}
  body:has(#darkmode-toggle:checked) .foot-social a.social-tiktok:hover{border-color:#000000;}
  body:has(#darkmode-toggle:checked) .foot-social a.social-x:hover{border-color:#000000;}


  /* ---------- Ad zones (IAB standard sizes) ---------- */
  /* zone รองรับทั้ง custom affiliate banner และ Google AdSense — ใส่โค้ด/รูปแทนกล่องนี้ได้โดยไม่กระทบ layout */
  .ad-zone{
    position:relative; overflow:hidden;
    background:
      radial-gradient(circle at 25% 25%, rgba(34,211,238,.4), transparent 50%),
      radial-gradient(circle at 80% 70%, rgba(168,85,247,.35), transparent 50%),
      #020617;
    border:1px solid var(--line); border-radius:14px; margin:0 auto;
    display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
  }
  .ad-zone::before{content:""; position:absolute; inset:0; background-size:22px 22px; background-image:radial-gradient(rgba(255,255,255,.10) 1px, transparent 1px); opacity:.5;}
  .ad-zone .ad-name{position:relative; z-index:1; font-family:var(--font-mono); font-size:11px; font-weight:700; letter-spacing:.05em; color:#fff;}
  .ad-zone .ad-size{position:relative; z-index:1; font-family:var(--font-mono); font-size:10px; color:rgba(255,255,255,.6);}
  .ad-wrap{padding:0 0 8px; display:flex; justify-content:center;}

  .ad-leaderboard{width:728px; max-width:100%; height:90px;}
  .ad-rect-lg{width:336px; max-width:100%; height:280px;}   /* Large Rectangle — sidebar */
  .ad-billboard{width:970px; max-width:100%; height:250px;}
  .ad-infeed{width:100%; aspect-ratio:4/3; border-radius:22px;}     /* แทรกในคอนเทนต์ ใช้สัดส่วนเดียวกับการ์ด ไม่มี body ตามหลัง จึงโค้งเต็ม 4 มุม */

  @media (max-width:760px){
    .ad-leaderboard{width:320px; height:50px;}
    .ad-billboard{width:320px; height:100px;}
  }

/* ---------- Post detail page (v2 — sidebar 360px) ---------- */
.post-wrap{max-width:1240px; margin:0 auto; padding:32px 20px 60px;}
.post-layout{display:grid; grid-template-columns:1fr 360px; gap:32px; align-items:start;}
.post-main{max-width:760px;}
.post-crumb{font-size:13px; color:var(--muted); margin-bottom:16px;}
.post-crumb a{color:var(--muted);}
.post-main h1{font-family:var(--font-display); font-size:clamp(24px,4vw,36px); font-weight:800; line-height:1.3; margin:14px 0 10px; color:var(--heading);}
.post-dek{font-size:16px; color:var(--muted); margin-bottom:14px;}
.post-meta{display:flex; gap:8px; align-items:center; font-size:13px; color:var(--muted); margin-bottom:22px; flex-wrap:wrap;}
.post-cover{width:100%; aspect-ratio:16/9; border-radius:16px; margin-bottom:26px; background-size:cover; background-position:center;}
.post-body{font-size:16px; line-height:1.85; color:var(--ink);}
.post-body p{margin-bottom:18px;}
.post-body img{max-width:100%; border-radius:12px; margin:18px 0;}
.post-sidebar{display:flex; flex-direction:column; gap:16px;}
.post-latest{margin-top:56px; grid-column:1/-1;}
.post-latest h2{font-family:var(--font-display); font-size:20px; margin-bottom:18px; color:var(--heading);}
.post-404{max-width:600px; margin:80px auto; text-align:center; padding:0 20px;}
.post-404 h1{font-size:28px; margin-bottom:10px; color:var(--heading);}
.post-404 a{color:var(--nav-hover);}
@media (max-width:860px){
  .post-layout{grid-template-columns:1fr;}
  .post-sidebar{position:static;}
}

/* ---------- Category listing page (v1) ---------- */
.cat-head{padding:36px 0 20px;}
.cat-head h1{font-family:var(--font-display); font-size:clamp(24px,4vw,34px); font-weight:800; color:var(--heading);}
.cat-head .count{color:var(--muted); font-size:14px; margin-top:6px;}
.pagination{display:flex; justify-content:center; gap:8px; margin:32px 0 12px; flex-wrap:wrap;}
.pagination a, .pagination span{
  min-width:38px; height:38px; display:flex; align-items:center; justify-content:center;
  border-radius:10px; font-size:13px; font-weight:600; text-decoration:none;
  border:1px solid var(--line); color:var(--ink);
}
.pagination a:hover{border-color:var(--nav-hover);}
.pagination .current{background:var(--nav-hover); color:#020617; border-color:var(--nav-hover);}
.cat-empty{text-align:center; padding:60px 20px; color:var(--muted);}

/* ---------- Cookie preferences page: แถว 1 = Necessary เต็มความกว้าง, แถว 2 = Analytics+Advertising คู่กัน ---------- */
.cookie-prefs{display:flex; flex-direction:column; gap:16px; margin-top:24px;}
.cookie-row-2{display:grid; grid-template-columns:1fr 1fr; gap:16px;}
.cookie-card{background:var(--card); border:1px solid var(--line); border-radius:16px; padding:20px; display:flex; justify-content:space-between; align-items:center; gap:16px;}
.ck-title{font-weight:700; color:var(--heading); margin-bottom:4px;}
.ck-desc{font-size:13px; color:var(--muted);}
.ck-always{font-size:13px; color:var(--muted); flex-shrink:0;}
.ck-check input{width:20px; height:20px; cursor:pointer;}
.ck-save-btn{margin-top:24px; padding:12px 28px; background:linear-gradient(135deg,var(--nav-hover),#F59E0B); color:#020617; border:none; border-radius:12px; font-weight:700; font-size:14px; cursor:pointer;}
@media (max-width:600px){ .cookie-row-2{grid-template-columns:1fr;} }

/* ---------- Sitemap page: 4 กลุ่มลิงก์เมนู เรียง 2 คอลัมน์ ---------- */
.sitemap-groups{display:grid; grid-template-columns:1fr 1fr; gap:32px; margin-top:32px;}
.sitemap-group h3{font-family:var(--font-display); font-size:17px; color:var(--heading); margin-bottom:12px; padding-bottom:8px; border-bottom:1px solid var(--line);}
.sitemap-group ul{list-style:none; display:flex; flex-direction:column; gap:8px;}
.sitemap-group a{color:var(--ink); font-size:14px;}
.sitemap-group a:hover{color:var(--nav-hover);}
@media (max-width:600px){ .sitemap-groups{grid-template-columns:1fr;} }

/* ---------- Sponsor ad card (ad_type='sponsor') ---------- */
.sponsor-card{display:block; border-radius:16px; overflow:hidden; border:1px solid var(--line); text-decoration:none; background:var(--card);}
.sponsor-cover{position:relative; aspect-ratio:16/9; width:100%;}
.sponsor-badge{position:absolute; top:10px; left:10px; background:rgba(249,115,22,.92); color:#1F0A00; font-family:var(--font-mono); font-size:10px; font-weight:700; letter-spacing:.04em; padding:3px 9px; border-radius:6px;}
.sponsor-body{padding:14px 16px;}
.sponsor-body h4{font-family:var(--font-display); font-size:15px; font-weight:600; color:var(--heading); margin-bottom:4px; line-height:1.35;}
.sponsor-body p{font-size:13px; color:var(--muted); line-height:1.5;}

/* ---------- Sponsor Carousel (ad_type='sponsor_carousel') — desktop drag-scroll ---------- */
.sponsor-carousel-wrap{position:relative; display:flex; align-items:center; gap:8px;}
.sponsor-carousel{
  display:flex; gap:16px; overflow-x:auto; scroll-behavior:smooth;
  padding:4px 2px 8px; cursor:grab; user-select:none;
  scrollbar-width:none;
}
.sponsor-carousel::-webkit-scrollbar{display:none;}
.sponsor-carousel.dragging{cursor:grabbing; scroll-behavior:auto;}
.sponsor-carousel .sponsor-card{flex:0 0 260px; scroll-snap-align:start;}
.sponsor-carousel{scroll-snap-type:x proximity;}
.sc-arrow{
  flex-shrink:0; width:36px; height:36px; border-radius:50%; border:1px solid var(--line);
  background:var(--card); color:var(--ink); cursor:pointer; display:flex; align-items:center; justify-content:center;
  transition:background .15s;
}
.sc-arrow:hover{background:var(--nav-hover); color:#020617;}
.sc-arrow svg{width:16px; height:16px;}
@media (max-width:760px){
  .sc-arrow{display:none;} /* มือถือใช้ swipe แทนปุ่ม — ปรับเพิ่มเติมทีหลัง */
  .sponsor-carousel .sponsor-card{flex-basis:220px;}
}

/* ---------- Ads Preview Mode (?ads_preview=1 จากปุ่มในหน้า admin) ---------- */
.ad-zone.ads-previewing{outline:2px dashed #F59E0B; outline-offset:2px;}
.ad-preview-tag{
  position:absolute; z-index:2; top:6px; left:6px;
  background:rgba(245,158,11,.92); color:#1F1300;
  font-family:var(--font-mono); font-size:10px; font-weight:700;
  padding:3px 8px; border-radius:6px; letter-spacing:.03em;
}
