/* ================================================================
   DongKaichon v2 — ส่วนเพิ่มจาก style.css (โหลดหลัง style.css)
   1) ธีมสี [data-theme] ที่ <html> (prefs.js ใส่ให้)   2) ขนาดตัวอักษร [data-text]   3) ระดับแอนิเมชัน [data-motion]
   4) มือถือแบบแอป: แถบบน + แถบเมนูล่าง (ปุ่ม Home กลาง) + กล่องเลื่อนขึ้นจากล่าง (bottom sheet)
   5) ชุดควบคุม: checkbox / radio / switch / range / dropdown (controls.js) / ปฏิทินเลือกวันที่ (controls.js)
   6) toast สีตามสถานะ   7) เอฟเฟกต์ (ripple หัวใจ confetti เปลี่ยนหน้า โหลด)   8) หน้าตั้งค่า
   ================================================================ */

/* ----- 1) ธีมสี: พื้นดำแบบธีมหลักทุกธีม เปลี่ยนเฉพาะสีเน้น (ปุ่ม เส้นกรอบ ราคา ไอคอน) ----- */
html[data-theme="gold"] { --accent: #e7b53c; --accent-2: #f5d27a; --accent-dark: #b8860b; --accent-rgb: 231, 181, 60; --on-accent: #000; }
html[data-theme="red"] { --accent: #e5383b; --accent-2: #ff6b6e; --accent-dark: #b5171a; --accent-rgb: 229, 56, 59; --on-accent: #fff; }
html[data-theme="emerald"] { --accent: #10b981; --accent-2: #4fd1a5; --accent-dark: #047857; --accent-rgb: 16, 185, 129; --on-accent: #000; }
html[data-theme="blue"] { --accent: #3b82f6; --accent-2: #7aa8ff; --accent-dark: #1d4ed8; --accent-rgb: 59, 130, 246; --on-accent: #fff; }
html[data-theme="purple"] { --accent: #a855f7; --accent-2: #c792ff; --accent-dark: #7e22ce; --accent-rgb: 168, 85, 247; --on-accent: #fff; }
.ch-flag { color: var(--on-accent); opacity: .75; }
body { transition: background-color .35s, color .35s; }

/* ----- 2) ขนาดตัวอักษร ----- */
html[data-text="s"] { font-size: 93.75%; }
html[data-text="l"] { font-size: 112.5%; }
html[data-text="xl"] { font-size: 125%; }

/* ----- 3) ระดับแอนิเมชัน: off = ไม่มีการเคลื่อนไหว ----- */
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
html[data-motion="off"] .js .reveal { opacity: 1; transform: none; }

/* เปลี่ยนหน้าแบบลื่น (เบราว์เซอร์ที่รองรับ View Transitions ระหว่างหน้า) */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
::view-transition-old(root) { animation: vt-out .18s ease both; }
::view-transition-new(root) { animation: vt-in .32s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
html[data-motion="off"]::view-transition-group(*), html[data-motion="off"]::view-transition-old(*), html[data-motion="off"]::view-transition-new(*) { animation: none !important; }
.site-header { view-transition-name: header; }
.tabbar { view-transition-name: tabbar; }
main { animation: page-in .45s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(12px); } }

/* ----- ปุ่มตั้งค่าที่แถบบน + หัวข้อหน้า ----- */
.hdr-icon[data-settings-open] .icon { transition: transform .5s var(--ease); }
.hdr-icon[data-settings-open]:hover .icon { transform: rotate(90deg); }

/* ----- 4) แอปมือถือ ----- */
.tabbar { display: none; }
@media (max-width: 760px) {
  :root { --tab-h: 64px; }
  body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px); -webkit-tap-highlight-color: transparent; }
  body.adm-body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
  /* แถบบนแบบแอป: โลโก้ + ไอคอนสำคัญ ไม่มีเมนูยาว (ย้ายไปแถบล่าง) */
  .site-header { padding-top: env(safe-area-inset-top); }
  .hdr-nav, .hdr-burger, .hdr-cta, [data-favs-open], [data-search-open] { display: none !important; }
  .hdr { gap: 10px; }
  .hdr-tools .hdr-user { display: none; }
  .hdr-title { display: block; }
  .site-footer { padding-block: 32px 18px; }
  .ftr-contacts { gap: 14px 26px; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
    background: var(--header-bg); border-top: 1px solid var(--line); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
    box-shadow: 0 -10px 30px -18px var(--shadow);
  }
  .tab {
    position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; height: var(--tab-h); padding: 0; border: 0;
    background: none; color: var(--muted); font-size: .7rem; font-weight: 500; text-decoration: none; cursor: pointer; transition: color .2s;
  }
  .tab .icon { width: 24px; height: 24px; transition: transform .35s var(--ease); }
  .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab[aria-current="page"] { color: var(--accent); }
  .tab[aria-current="page"] .icon { transform: translateY(-2px) scale(1.12); }
  .tab[aria-current="page"]::after { content: ''; position: absolute; top: 6px; width: 34px; height: 3px; border-radius: 3px; background: var(--accent); animation: tab-dot .35s var(--ease); }
  @keyframes tab-dot { from { width: 0; } }
  .tab:active .icon { transform: scale(.86); }
  .tab .badge { top: 6px; right: calc(50% - 22px); }
  /* ปุ่ม Home กลาง: วงกลมใหญ่ ยกขึ้น เรืองแสง */
  .tab-home { align-content: end; padding-bottom: 6px; color: var(--text); }
  .tab-home::after { display: none; }
  .tab-home b {
    display: grid; place-items: center; width: 62px; height: 62px; margin-top: -30px; margin-bottom: 1px; border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, var(--accent-2), var(--accent) 55%, var(--accent-dark)); color: var(--on-primary);
    border: 4px solid var(--bg); box-shadow: 0 10px 22px -6px rgba(var(--accent-rgb), .75), 0 0 0 1px rgba(var(--accent-rgb), .3);
    transition: transform .35s var(--ease), box-shadow .3s;
  }
  .tab-home b .icon { width: 28px; height: 28px; }
  .tab-home[aria-current="page"] b { animation: home-glow 2.8s ease-in-out infinite; }
  .tab-home[aria-current="page"] .icon { transform: none; }
  .tab-home:active b { transform: scale(.9); }
  @keyframes home-glow { 50% { box-shadow: 0 10px 30px -2px rgba(var(--accent-rgb), .95), 0 0 0 6px rgba(var(--accent-rgb), .15); } }

  /* ปุ่มลอย / toast อยู่เหนือแถบล่าง */
  .chat { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px); }
  .adm-save { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 6px); }
  .chat-app { height: calc(100svh - var(--header-h) - var(--tab-h) - env(safe-area-inset-bottom)); }

  /* กล่องข้อความ = เลื่อนขึ้นจากด้านล่าง (bottom sheet) พร้อมที่จับ */
  .modal {
    width: 100%; max-width: none; max-height: calc(100svh - 40px); margin: auto 0 0; padding: 28px 16px calc(18px + env(safe-area-inset-bottom));
    border-width: 0; border-top: 1.5px solid var(--frame); border-radius: 22px 22px 0 0;
  }
  .modal[open] { animation: sheet-up .42s var(--ease); }
  .modal.is-closing { animation: sheet-down .22s ease-in forwards; }
  .modal::before { content: ''; position: absolute; top: 9px; left: 50%; width: 42px; height: 5px; margin-left: -21px; border-radius: 3px; background: var(--line-2); }
  .modal-x { top: -16px; }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  @keyframes sheet-down { to { transform: translateY(100%); } }

  /* หลังบ้านบนมือถือ: ใช้แถบล่างแทนเมนูเลื่อนด้านบน */
  .adm-side .adm-nav { display: none; }
  .adm-side { position: sticky; top: 0; background: var(--header-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
}
.modal.is-closing { animation: pop-out .18s ease-in forwards; }
@keyframes pop-out { to { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal::backdrop { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; } }

/* ----- 5) ชุดควบคุม ----- */
/* checkbox + radio */
input[type="checkbox"]:not(.switch), input[type="radio"] {
  appearance: none; -webkit-appearance: none; display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; margin: 0;
  border: 2px solid var(--line-2); border-radius: 7px; background: var(--field-bg); cursor: pointer; vertical-align: middle;
  transition: border-color .2s, background-color .2s, transform .2s var(--ease), box-shadow .2s;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:not(.switch)::after {
  content: ''; width: 12px; height: 12px; background: var(--on-primary); transform: scale(0); transition: transform .25s var(--ease);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m4 12.5 5 5L20 6.5' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m4 12.5 5 5L20 6.5' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
input[type="radio"]::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--on-primary); transform: scale(0); transition: transform .25s var(--ease); }
input[type="checkbox"]:not(.switch):checked, input[type="radio"]:checked { border-color: var(--accent); background: var(--accent); }
input[type="checkbox"]:not(.switch):checked::after, input[type="radio"]:checked::after { transform: scale(1); }
input[type="checkbox"]:not(.switch):active, input[type="radio"]:active { transform: scale(.88); }
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: var(--accent); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 0; box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .25); }
.check-row input { margin-top: 1px; }
/* switch (เปิด/ปิด) */
input.switch {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 48px; height: 28px; margin: 0; border-radius: 999px;
  background: var(--line-2); cursor: pointer; transition: background-color .25s;
}
input.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .3s var(--ease), width .2s; }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(20px); }
input.switch:active::after { width: 28px; }
input.switch:checked:active::after { transform: translateX(14px); }
input.switch:focus-visible { outline: 0; box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .25); }
/* range */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: none; cursor: pointer; --p: 50%; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--p), var(--line-2) var(--p)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line-2); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border: 3px solid var(--accent); border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); transition: transform .2s; }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 3px solid var(--accent); border-radius: 50%; background: #fff; }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.2); }
/* ตัวเลือกแบบปุ่มเรียงกัน */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 9px; font-size: .9rem; font-weight: 500; color: var(--muted); transition: background-color .25s, color .25s, box-shadow .25s; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 2px 10px -4px var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

/* dropdown (controls.js สร้างแทน <select> เดิมที่ซ่อนไว้) */
.cs { position: relative; display: block; min-width: 0; }
.cs-native { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0 !important; pointer-events: none; }
.cs-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--field-bg); color: var(--text); text-align: left; cursor: pointer; transition: border-color .2s, box-shadow .2s;
}
.select .cs-btn { min-width: 150px; min-height: 40px; padding: 6px 12px; }
.cs-btn > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-btn.is-empty > span { color: var(--muted); }
.cs-btn .icon { width: 18px; height: 18px; color: var(--accent); transition: transform .3s var(--ease); }
.cs.is-open .cs-btn { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .2); }
.cs.is-open .cs-btn .icon { transform: rotate(180deg); }
.cs-btn:disabled { opacity: .5; cursor: not-allowed; }
.field.is-bad .cs-btn { border-color: var(--bad); }
.cs-pop {
  position: fixed; z-index: 500; display: grid; grid-template-rows: auto minmax(0, 1fr); max-height: 320px; padding: 6px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); box-shadow: 0 24px 48px -16px var(--shadow); transform-origin: top center; animation: cs-in .22s var(--ease);
}
.cs-pop.is-up { transform-origin: bottom center; }
@keyframes cs-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.cs-search { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--field-bg); }
.cs-search input { flex: 1; min-width: 0; min-height: 38px; border: 0; background: none; outline: 0; color: var(--text); }
.cs-search .icon { color: var(--muted); }
.cs-list { margin: 0; padding: 0; list-style: none; overflow-y: auto; overscroll-behavior: contain; }
.cs-opt { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 9px; cursor: pointer; transition: background-color .15s; }
.cs-opt .icon { width: 16px; height: 16px; margin-left: auto; color: var(--accent); opacity: 0; transform: scale(.4); transition: opacity .2s, transform .25s var(--ease); }
.cs-opt[aria-selected="true"] { color: var(--accent); font-weight: 500; }
.cs-opt[aria-selected="true"] .icon { opacity: 1; transform: none; }
.cs-opt.is-active { background: var(--surface-2); }
.cs-opt.is-ph { color: var(--muted); }
.cs-none { padding: 12px; color: var(--muted); text-align: center; font-size: .9rem; }
.cs-back { position: fixed; inset: 0; z-index: 499; background: rgba(0, 0, 0, .45); animation: fade .25s; }
@media (max-width: 760px) {
  /* มือถือ: รายการตัวเลือกเป็นแผ่นจากด้านล่าง */
  .cs-pop { left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: auto !important; max-height: 70svh; padding: 22px 10px calc(10px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; animation: sheet-up .36s var(--ease); }
  .cs-pop::before { content: ''; position: absolute; top: 8px; left: 50%; width: 42px; height: 5px; margin-left: -21px; border-radius: 3px; background: var(--line-2); }
  .cs-opt { padding: 13px 14px; font-size: 1.02rem; }
}

/* ปฏิทินเลือกวันที่ */
.dp { position: relative; }
.dp-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--field-bg); color: var(--text); text-align: left; cursor: pointer; }
.dp-btn > span { flex: 1; }
.dp-btn.is-empty > span { color: var(--muted); }
.dp-btn .icon { color: var(--accent); }
.dp.is-open .dp-btn { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .2); }
.field.is-bad .dp-btn { border-color: var(--bad); }
.dp-pop { position: fixed; z-index: 500; width: 320px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 24px 48px -16px var(--shadow); animation: cs-in .22s var(--ease); }
.dp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.dp-head .cs { flex: 1; }
.dp-head .cs-btn { min-height: 38px; padding: 4px 10px; }
.dp-nav { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text); cursor: pointer; flex: none; }
.dp-nav:hover { color: var(--accent); }
.dp-week, .dp-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-week span { padding: 4px 0; color: var(--muted); font-size: .75rem; }
.dp-days button { aspect-ratio: 1; border: 0; border-radius: 50%; background: none; color: var(--text); font-size: .9rem; cursor: pointer; transition: background-color .15s, transform .2s var(--ease); }
.dp-days button:hover { background: var(--surface-2); }
.dp-days button:active { transform: scale(.88); }
.dp-days button.is-today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.dp-days button[aria-selected="true"] { background: var(--accent); color: var(--on-primary); font-weight: 600; }
.dp-days button:disabled { opacity: .3; cursor: default; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 8px; }
.dp-foot button { padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--accent); font-weight: 500; cursor: pointer; }
@media (max-width: 760px) {
  .dp-pop { left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: auto; padding: 22px 14px calc(14px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; animation: sheet-up .36s var(--ease); }
}

/* ----- 6) toast สีตามสถานะ: พื้นดำแบบธีมหลัก ขอบ + ไอคอนสีตามสถานะ -----
   จอคอม: ล่างกลาง ซ้อนได้ 3 อัน · มือถือ: แถบบางใต้แถบหัว เลื่อนลงมา ซ้อนได้ 2 อัน ปัดขึ้นเพื่อปิด */
/* popover ของเบราว์เซอร์มีกรอบ/พื้น/ระยะของตัวเอง ล้างออก */
.toasts[popover] { top: auto; right: auto; margin: 0; padding: 0; border: 0; background: none; color: inherit; overflow: visible; }
.toasts { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 600; display: grid; gap: 8px; width: min(400px, calc(100vw - 24px)); translate: -50% 0; pointer-events: none; }
.toast-item {
  --tone: #22c55e; --tone-rgb: 34, 197, 94;
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 8px 8px 12px; overflow: hidden;
  border: 1.5px solid var(--tone); border-radius: 12px; background: rgba(12, 12, 12, .97); color: #fff; font-weight: 500;
  box-shadow: 0 14px 32px -12px rgba(0, 0, 0, .9), 0 0 18px -8px rgba(var(--tone-rgb), .6); pointer-events: auto; touch-action: pan-x;
  animation: toast-in .45s var(--ease) both;
}
.toast-item.is-warn { --tone: #f59e0b; --tone-rgb: 245, 158, 11; }
.toast-item.is-error { --tone: #ef4444; --tone-rgb: 239, 68, 68; }
.toast-item.is-info { --tone: #3b82f6; --tone-rgb: 59, 130, 246; }
.toast-ic { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: rgba(var(--tone-rgb), .16); color: var(--tone); animation: toast-ic .5s var(--ease) .08s both; }
.toast-ic .icon { width: 17px; height: 17px; }
.toast-item > span:not(.toast-ic) { flex: 1; min-width: 0; font-size: .92rem; line-height: 1.35; }
.toast-x { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: #9a9a9a; cursor: pointer; }
.toast-x .icon { width: 16px; height: 16px; }
.toast-x:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--tone); opacity: .7; transform-origin: left; animation: toast-bar linear forwards; }
.toast-item.is-out { animation: toast-out .28s ease-in forwards; }
.toast-item.is-error { animation: toast-in .45s var(--ease) both, shake .45s .12s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(18px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toast-ic { from { transform: scale(0); } }
@keyframes toast-bar { to { transform: scaleX(0); } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.toast { display: none !important; }
@media (max-width: 760px) {
  .toasts, .toasts[popover] { top: calc(var(--header-h) + env(safe-area-inset-top) + 8px); bottom: auto; width: calc(100vw - 20px); gap: 6px; }
  .toast-item { min-height: 42px; padding: 6px 6px 6px 10px; border-radius: 999px; }
  .toast-item > span:not(.toast-ic) { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: .88rem; }
  .toast-ic { width: 26px; height: 26px; }
  .toast-bar { left: 18px; right: 18px; width: auto; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(-28px) scale(.96); } }
  @keyframes toast-out { to { opacity: 0; transform: translateY(-24px) scale(.96); } }
}

/* ----- 7) เอฟเฟกต์ ----- */
.btn, .tab, .chips button, .tabs button, .cs-opt, .user-menu a, .user-menu button, .seg span, .adm-row, .ocard, .ch-item, .hdr-icon { position: relative; overflow: hidden; }
.tab, .tab-home { overflow: visible; }
.ripple, .btn > .ripple { position: absolute; z-index: 0; border-radius: 50%; background: currentColor; opacity: .22; transform: scale(0); pointer-events: none; animation: ripple .6s ease-out forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.btn > :not(.ripple), .btn .icon { position: relative; z-index: 1; }
/* หัวใจกระจายตอนกดถูกใจ */
.burst { position: fixed; z-index: 700; width: 0; height: 0; pointer-events: none; }
.burst i { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--c); animation: burst .7s var(--ease) forwards; }
@keyframes burst { to { transform: translate(var(--x), var(--y)) scale(.2); opacity: 0; } }
.rcard-fav.is-on .icon, [data-fav].is-on .icon { animation: heart-pop .45s var(--ease); }
@keyframes heart-pop { 30% { transform: scale(1.45); } 60% { transform: scale(.9); } }
/* confetti ตอนทำรายการสำเร็จ */
.confetti { position: fixed; inset: 0; z-index: 700; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; background: var(--c); animation: confetti var(--d) cubic-bezier(.2, .6, .4, 1) forwards; }
@keyframes confetti { to { transform: translate(var(--x), 105vh) rotate(var(--r)); } }
.done-ic { animation: done-pop .7s var(--ease); }
@keyframes done-pop { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.12); } }
/* การ์ดเอียงตามเมาส์ (เฉพาะจอคอม + แอนิเมชันเต็ม) */
html[data-motion="full"] .rcard.is-tilt { transition: transform .12s linear, box-shadow .3s; }
/* ตัวโหลด (skeleton) */
.skel { position: relative; overflow: hidden; border-radius: 12px; background: var(--surface-2); min-height: 220px; }
.skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), .08), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
[aria-busy="true"] { position: relative; }
[aria-busy="true"]::after { content: ''; position: absolute; inset: 0; border-radius: 12px; background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), .06), transparent); animation: shimmer 1.3s infinite; pointer-events: none; }
/* ตัวเลขบนแถบเด้งเมื่อเปลี่ยน */
.badge.is-bump { animation: bump .5s var(--ease); }
@keyframes bump { 40% { transform: scale(1.5); } }
/* ปุ่มกดแล้วยุบ */
html:not([data-motion="off"]) .btn:active { transform: scale(.95); }

/* ----- 8) หน้าตั้งค่า ----- */
.st-page { max-width: 820px; padding-bottom: 40px; }
.st-sec { margin-bottom: 16px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg-2); }
.st-sec > h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 1.15rem; }
.st-sec > h2 .icon { color: var(--accent); }
.st-sec > p { margin-bottom: 14px; color: var(--muted); font-size: .9rem; }
.st-group { margin: 14px 0 6px; color: var(--muted); font-size: .8rem; font-weight: 500; letter-spacing: .02em; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.theme { position: relative; display: grid; gap: 8px; padding: 8px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface); cursor: pointer; transition: border-color .2s, transform .25s var(--ease); }
.theme:hover { transform: translateY(-2px); }
.theme input { position: absolute; opacity: 0; pointer-events: none; }
.theme:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .2); }
.theme:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-pv { position: relative; display: grid; grid-template-rows: 14px 1fr; gap: 5px; height: 84px; padding: 7px; border-radius: 11px; background: var(--pv-bg); overflow: hidden; }
.theme-pv::before { content: ''; border-radius: 4px; background: var(--pv-card); }
.theme-pv i { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.theme-pv i::before, .theme-pv i::after { content: ''; border-radius: 6px; background: var(--pv-card); border-top: 3px solid var(--pv-accent); }
.theme-pv b { position: absolute; right: 8px; bottom: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--pv-accent); box-shadow: 0 0 0 3px var(--pv-bg); }
.theme > span { display: flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 500; }
.theme > span .icon { width: 16px; height: 16px; margin-left: auto; color: var(--accent); opacity: 0; transform: scale(.4); transition: opacity .2s, transform .3s var(--ease); }
.theme:has(input:checked) > span .icon { opacity: 1; transform: none; }
.st-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.st-row:first-of-type { border-top: 0; }
.st-row > div:first-child { display: grid; gap: 2px; min-width: 0; flex: 1 1 220px; }
.st-row b { font-weight: 500; }
.st-row small { color: var(--muted); font-size: .82rem; }
.st-vol { display: flex; align-items: center; gap: 10px; flex: 1 1 240px; }
.st-vol output { min-width: 42px; color: var(--muted); font-size: .85rem; text-align: right; font-variant-numeric: tabular-nums; }
.st-sounds { display: flex; flex-wrap: wrap; gap: 6px; }
.st-foot { display: flex; justify-content: center; margin-top: 10px; }
@media (max-width: 760px) {
  .themes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-sec { padding: 16px 14px; }
}
