/* nongsuk.css — ภาพประกอบ ลูกเล่น Dashboard และเมนูล่างแบบใหม่
   ใช้ token จาก theme.css เท่านั้น (สี/มุม/เงาเดิม) */

[x-cloak] { display: none !important; }
.ic { flex: none; vertical-align: middle; }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { width: 0; } }
@keyframes ring-draw { from { stroke-dashoffset: var(--c); } }
@keyframes float-y { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(255, 90, 54, .45); } 100% { box-shadow: 0 0 0 18px rgba(255, 90, 54, 0); } }
@keyframes confetti { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }
@keyframes shine { from { transform: translateX(-120%); } to { transform: translateX(220%); } }

.reveal { animation: rise .65s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 70ms); }
.progress-fill { animation: grow 1.1s cubic-bezier(.2, .8, .2, 1) both .25s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Header ---------- */
.site-header.is-scrolled { box-shadow: 0 6px 20px rgba(44, 36, 33, .08); }
.brand img { transition: transform .35s cubic-bezier(.2, .9, .3, 1.4); }
.brand:hover img { transform: rotate(-8deg) scale(1.06); }
.brand, .brand-text, .top-nav__link, .hdr-btn, .lang-btn { white-space: nowrap; }
.brand { flex: none; }
.header-actions { gap: 8px; flex: none; }
.header-actions .btn-sep { flex: none; }
.hdr-btn { gap: 6px; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; padding-inline: 10px; }
#themeToggleHeader { min-width: 40px; padding-inline: 10px; }
.hdr-btn, #themeToggleHeader { height: 40px; min-height: 40px; padding-block: 0; display: inline-flex; align-items: center; justify-content: center; }
.hdr-btn__label { display: none; }
@media (min-width: 1500px) { .hdr-btn__label { display: inline; } }
/* มือถือ: เหลือโลโก้ + ปุ่มเล็ก (ชื่อแบรนด์ยังอ่านได้ด้วยโปรแกรมอ่านหน้าจอ) */
@media (max-width: 520px) {
  .brand-text {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .header-actions { gap: 6px; }
  .lang-btn { min-width: 40px; }
}

.top-nav { display: none; }
@media (min-width: 1200px) {
  .top-nav { display: flex; align-items: center; gap: 4px; margin-inline: auto 12px; }
  .top-nav__link {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px; padding: 0 16px; border-radius: var(--r-pill);
    color: var(--c-ink-soft); text-decoration: none; font-weight: 700; font-size: 15px;
    transition: background .2s, color .2s;
  }
  .top-nav__link:hover { background: var(--c-cream); color: var(--c-ink); }
  .top-nav__link.is-active { background: color-mix(in srgb, var(--c-primary) 16%, transparent); color: var(--c-primary); }
  .top-nav__cta { margin-left: 8px; display: inline-flex; gap: 6px; align-items: center; }
}

/* ---------- Bottom nav + ปุ่ม + กลาง + ชีตทางลัด ---------- */
.nav-shell { display: contents; }
.bottom-nav {
  position: sticky; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: 1fr 1fr 84px 1fr 1fr; align-items: center;
  background: color-mix(in srgb, var(--c-surface) 94%, transparent);
  backdrop-filter: blur(14px);
  border: 0; border-top: 1px solid var(--c-hairline);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -10px 28px rgba(44, 36, 33, .07);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav__item {
  display: grid; justify-items: center; align-content: center; gap: 3px;
  min-height: 56px; color: var(--c-muted);
  font-size: 11px; font-weight: 700; line-height: 1.1; text-align: center; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.bn-ico {
  width: 52px; height: 32px; border-radius: 16px; display: grid; place-items: center;
  transition: background .25s, color .25s, transform .3s cubic-bezier(.2, .9, .3, 1.4);
}
.bottom-nav__item:active .bn-ico { transform: scale(.9); }
.bottom-nav__item.is-active { color: var(--c-primary); }
.bottom-nav__item.is-active .bn-ico {
  background: color-mix(in srgb, var(--c-primary) 18%, transparent);
  transform: translateY(-2px);
}

.nav-fab {
  justify-self: center; align-self: start; margin-top: -34px;
  width: 64px; height: 64px; border-radius: 50%;
  border: 5px solid var(--c-surface);
  background: var(--c-primary); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 10px 22px rgba(255, 90, 54, .42);
  animation: pulse-ring 1.8s ease-out 3;
  transition: transform .35s cubic-bezier(.2, .9, .3, 1.4), background .2s;
}
.nav-fab:active { transform: scale(.92); }
.nav-fab.is-open { transform: rotate(135deg); background: var(--c-btn-dark); animation: none; }
.nav-fab:focus-visible { outline-offset: 4px; }

.quick-backdrop { position: fixed; inset: 0; z-index: 40; background: var(--c-scrim); backdrop-filter: blur(2px); }
.quick-sheet {
  position: fixed; z-index: 50; left: 12px; right: 12px; margin-inline: auto; max-width: 520px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  background: var(--c-surface); border: 1px solid var(--c-hairline);
  border-radius: 28px; padding: 18px 16px 20px; box-shadow: 0 24px 60px rgba(44, 36, 33, .28);
}
.quick-sheet__title { margin: 0 0 12px; text-align: center; color: var(--c-ink); }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-tile {
  display: grid; justify-items: center; gap: 8px; padding: 14px 6px;
  border-radius: 20px; background: var(--c-cream); color: var(--c-ink);
  text-decoration: none; font-size: 13px; font-weight: 700; text-align: center;
  transition: transform .2s, box-shadow .2s;
  animation: pop .45s cubic-bezier(.2, .9, .3, 1.3) both; animation-delay: calc(var(--i, 0) * 45ms + 60ms);
}
.quick-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.quick-tile:active { transform: scale(.95); }
.quick-tile__ico {
  width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center;
  background: var(--bg, var(--c-yellow)); color: var(--c-on-light);
}
.qs-enter { transition: transform .32s cubic-bezier(.2, .9, .3, 1.15), opacity .22s; }
.qs-enter-start { transform: translateY(40px) scale(.96); opacity: 0; }
.qs-enter-end { transform: none; opacity: 1; }
.qs-leave { transition: transform .2s ease-in, opacity .18s; }
.qs-leave-start { transform: none; opacity: 1; }
.qs-leave-end { transform: translateY(30px) scale(.97); opacity: 0; }

@media (min-width: 1200px) {
  .bottom-nav, .quick-sheet, .quick-backdrop { display: none !important; }
}

/* ---------- Ring (วงแหวนความคืบหน้า) ---------- */
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring > svg { display: block; transform: rotate(-90deg); }
.ring__bg { fill: none; stroke: color-mix(in srgb, #2C2421 14%, transparent); }
.ring__fg {
  fill: none; stroke: var(--c-primary); stroke-linecap: round;
  animation: ring-draw 1.3s cubic-bezier(.2, .8, .2, 1) both .2s;
}
.ring--over .ring__fg { stroke: var(--c-violet); }
.ring--water .ring__bg, .ring--steps .ring__bg { stroke: rgba(255, 255, 255, .45); }
.ring--water .ring__fg { stroke: var(--c-btn-dark); }
.ring--steps .ring__fg { stroke: #fff; }
.ring--steps .ring__bg { stroke: rgba(255, 255, 255, .28); }
.ring__center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.05; }

/* ---------- Illustration / Mascot ---------- */
.hero-art { display: block; width: 100%; max-width: 460px; height: auto; margin-inline: auto; }
.mascot { width: 84px; height: 84px; flex: none; }
.mascot--sm { width: 56px; height: 56px; }

/* ---------- Home ---------- */
.home-hero { display: grid; gap: 20px; align-items: center; overflow: hidden; position: relative; }
@media (min-width: 768px) { .home-hero { grid-template-columns: 1.1fr .9fr; } }
.home-hero__text { display: grid; gap: 14px; justify-items: start; }
.home-hero__text h1 { margin: 0; color: var(--c-on-light); }
.home-hero__text p { margin: 0; color: var(--c-on-light); }
.home-hero .hero-art { animation: pop .9s cubic-bezier(.2, .9, .3, 1.2) both .15s; }
.home-features { display: grid; gap: 14px; margin-top: 24px; }
.home-features > h2 { margin: 8px 0 0; color: var(--c-ink); }
.feature-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .feature-grid { grid-template-columns: repeat(4, 1fr); } }
.feature-card { display: grid; gap: 10px; align-content: start; transition: transform .25s, box-shadow .25s; }
.feature-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-card); }
.feature-card h3 { margin: 0; color: var(--c-ink); font-size: var(--fs-title); }
.feature-card p { margin: 0; }
.feature-ico {
  width: 56px; height: 56px; border-radius: 20px; display: grid; place-items: center;
  background: var(--bg, var(--c-yellow)); color: var(--c-on-light);
  transition: transform .35s cubic-bezier(.2, .9, .3, 1.5);
}
.feature-card:hover .feature-ico { transform: rotate(-8deg) scale(1.08); }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; gap: 16px; }
.dash-hero { position: relative; overflow: hidden; display: grid; gap: 18px; align-items: center; grid-template-columns: 1fr; }
.dash-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .5) 50%, transparent 65%);
  transform: translateX(-120%); animation: shine 2.2s ease-out 1.1s 1 both;
}
.dash-hero__text { display: grid; gap: 8px; justify-items: start; }
.dash-hero__greet { display: flex; align-items: center; gap: 12px; }
.dash-hero__greet .mascot { animation: float-y 4.5s ease-in-out infinite; }
.dash-hero__kicker { margin: 0; font-size: 14px; font-weight: 700; opacity: .8; }
.dash-hero h1 { font-size: var(--fs-heading); line-height: 1.25; }
.dash-hero__ring { display: grid; justify-items: center; gap: 6px; }
.ring__num { font-size: 40px; font-weight: 800; color: var(--c-on-light); letter-spacing: -.02em; }
.ring__unit { font-size: 13px; font-weight: 700; color: var(--c-on-light); opacity: .75; }
.dash-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .6); color: var(--c-on-light); font-size: 14px; font-weight: 700;
}
.dash-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.dash-cta .btn-sep { display: inline-flex; align-items: center; gap: 8px; }
@media (min-width: 520px) {
  .dash-hero { grid-template-columns: 1fr auto; }
}

.stat-tile { display: grid; gap: 12px; align-content: space-between; position: relative; overflow: hidden; transition: transform .25s, box-shadow .25s; }
.stat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.stat-tile__head { display: flex; align-items: center; gap: 14px; }
.stat-tile__title { margin: 0; font-weight: 700; font-size: 15px; opacity: .9; }
.stat-tile__value { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.15; }
.stat-tile__sub { margin: 0; font-size: 13px; opacity: .85; }
.stat-tile .btn-sep { display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.stat-tile form { margin: 0; }
.stat-tile.is-done::before {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: rgba(255, 255, 255, .28);
}
.dash-side { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .dash-side { grid-template-columns: 1fr; } }

.macro-card { display: grid; gap: 14px; }
.macro-row { display: grid; gap: 6px; }
.macro-row__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--c-ink); font-weight: 700; }
.macro-row__head span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.macro-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c-green); }
.macro-dot--carb { background: var(--c-amber); }
.macro-dot--fat { background: var(--c-orange); }
.macro-row .progress-track { margin-top: 0; height: 12px; }
.macro-row__val { color: var(--c-ink-soft); font-weight: 600; font-size: 14px; }

.week-card canvas { max-height: 220px; }

.quick-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (min-width: 768px) { .quick-tiles { grid-template-columns: repeat(6, 1fr); } }
.qtile {
  display: grid; justify-items: center; align-content: start; gap: 10px; padding: 16px 8px;
  background: var(--c-surface); border: 1px solid var(--c-hairline); border-radius: var(--r-card);
  color: var(--c-ink); text-decoration: none; font-weight: 700; font-size: 14px; text-align: center; line-height: 1.25;
  transition: transform .25s cubic-bezier(.2, .9, .3, 1.3), box-shadow .25s, border-color .25s;
}
.qtile:hover { transform: translateY(-5px); box-shadow: var(--shadow-card); border-color: var(--c-primary); }
.qtile:active { transform: scale(.96); }
.qtile__ico {
  width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center;
  background: var(--bg, var(--c-yellow)); color: var(--c-on-light);
  transition: transform .35s cubic-bezier(.2, .9, .3, 1.5);
}
.qtile:hover .qtile__ico { transform: rotate(-8deg) scale(1.1); }

.dash-section-title { margin: 4px 0 -4px; color: var(--c-ink); }
.insight-head { display: flex; align-items: center; gap: 12px; }
.insight-head h2 { margin: 0; }

@media (min-width: 992px) {
  .dash-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
  .dash-hero { grid-column: span 8; padding: 28px 32px; }
  .dash-side { grid-column: span 4; grid-template-columns: 1fr; }
  .macro-card { grid-column: span 5; }
  .week-card { grid-column: span 7; }
  .dash-wide { grid-column: 1 / -1; }
  .ring__num { font-size: 48px; }
}

/* ---------- Confetti ---------- */
.confetti {
  position: fixed; z-index: 120; pointer-events: none; width: 9px; height: 14px; border-radius: 2px;
  animation: confetti 1.3s cubic-bezier(.15, .8, .3, 1) forwards;
}
.toast-cheer {
  position: fixed; left: 50%; top: 84px; z-index: 121; transform: translateX(-50%);
  background: var(--c-btn-dark); color: #fff; padding: 10px 18px; border-radius: var(--r-pill);
  font-weight: 700; box-shadow: var(--shadow-card); animation: pop .5s both;
}

/* ---------- Press feedback ทั่วทั้งเว็บ ---------- */
.btn-sep { transition: transform .15s, box-shadow .2s, background .2s; }
.btn-sep:active { transform: scale(.97); }
.card-plain, .panel { transition: box-shadow .25s; }

/* เว้นที่ด้านล่างให้ปุ่ม + ที่ลอยเหนือเมนู */
body.is-authed .site-main { padding-bottom: 28px; }


/* ===== v2: CTA, AI compose, page art, avatar picker, add-own cards ===== */
.top-nav__cta { white-space: nowrap; flex: none; }
.top-nav__link { white-space: nowrap; }

.ai-compose { display: grid; gap: 12px; }
.ai-compose label { display: grid; gap: 8px; width: 100%; }
.ai-compose textarea { width: 100%; min-height: 120px; resize: vertical; font-size: 1rem; line-height: 1.5; padding: 14px 16px; border-radius: 16px; }
.ai-compose__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ai-compose__actions .btn-sep { flex: 1 1 160px; justify-content: center; white-space: nowrap; }

.panel:has(.page-art)::after { content: ""; display: block; clear: both; }
.page-art { float: right; width: 112px; height: auto; margin: -6px -6px 6px 10px; pointer-events: none; user-select: none; }
@media (min-width: 768px) { .page-art { width: 168px; margin: -14px -8px 4px 18px; } }

.badge-mine { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--c-primary); color: #fff; font-size: .72rem; font-weight: 700; letter-spacing: .02em; }
.inline-form { margin-top: 8px; }
.add-own > summary { cursor: pointer; list-style: none; }
.add-own > summary::-webkit-details-marker { display: none; }
.add-own[open] > summary { margin-bottom: 12px; }
.add-own__ai { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0; }
.btn-sep--accent { background: linear-gradient(135deg, #8E6BFF, #FF5A36); color: #fff; border-color: transparent; }
.btn-sep--accent:disabled { opacity: .55; }
.add-own select { width: 100%; }

.body-avatar { display: grid; place-items: center; padding: 8px 0; }
.body-avatar .avatar-svg { max-width: 100%; height: auto; filter: drop-shadow(0 8px 14px rgba(58,46,42,.12)); }
.avatar-picker { display: grid; gap: 12px; }
.avatar-picker__styles { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 10px; }
.avatar-opt { cursor: pointer; }
.avatar-opt input, .skin-opt input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-opt__card { display: grid; justify-items: center; gap: 4px; padding: 10px 6px; border: 2px solid var(--c-hairline, #eadfd6); border-radius: 18px; background: var(--c-cream, #fff8f3); transition: transform .15s, border-color .15s, box-shadow .15s; }
.avatar-opt:hover .avatar-opt__card { transform: translateY(-2px); }
.avatar-opt input:checked + .avatar-opt__card { border-color: var(--c-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-primary) 22%, transparent); }
.avatar-opt input:focus-visible + .avatar-opt__card, .skin-opt input:focus-visible + .skin-opt__dot { outline: 3px solid #8E6BFF; outline-offset: 2px; }
.avatar-opt__name { font-weight: 700; font-size: .9rem; }
.avatar-picker__skins { display: flex; gap: 12px; }
.skin-opt { cursor: pointer; }
.skin-opt__dot { display: block; width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--c-hairline, #d9cfc6); transition: transform .15s; }
.skin-opt input:checked + .skin-opt__dot { box-shadow: 0 0 0 3px var(--c-primary); transform: scale(1.1); }
