/* 🎨 ธีมหน้าเว็บ — ค่าสีมาจาก themes.js (--t-*) · ไม่มี data-theme = ธีมเดิม ไม่มีผลใดๆ */

html[data-theme] body {
  background-color: var(--t-bg);
  background-image: var(--t-bg-img, none);
  background-attachment: fixed;
}

html[data-theme] .cute-card,
html[data-theme] .lace-border {
  background-color: var(--t-card);
  border: var(--t-card-bw, 1px) var(--t-card-bs, solid) var(--t-card-border);
  border-radius: var(--t-radius, 16px);
  box-shadow: 0 2px 0 rgb(var(--p-200) / 0.55), 0 8px 22px rgb(var(--p-700) / 0.08);
}
html[data-theme] .bg-white.lace-border { background-color: var(--t-card); }

html[data-theme] .cute-btn {
  background-color: var(--t-btn);
  color: var(--t-btn-fg);
  border: 1.5px solid var(--t-btn-border);
  border-radius: 9999px;
}
html[data-theme] .cute-btn:hover { background-color: var(--t-btn); filter: brightness(0.95); box-shadow: 0 6px 16px rgb(var(--p-700) / 0.18); }

html[data-theme] .tab-pill:hover { background: rgb(var(--p-50)); color: rgb(var(--p-800)); }
html[data-theme] .tab-pill.is-active { background: var(--t-tab); color: var(--t-tab-fg); box-shadow: 0 2px 0 rgb(var(--p-700) / 0.18); }

html[data-theme] thead,
html[data-theme] thead tr { background: var(--t-head) !important; color: var(--t-head-fg) !important; }
html[data-theme] thead th { color: var(--t-head-fg) !important; }

html[data-theme] .frm-section { background: var(--t-frm); border-color: var(--t-frm-border); }
html[data-theme] .frm-section-title, html[data-theme] .frm-label { color: rgb(var(--p-700)); }
html[data-theme] .frm-input { border-color: var(--t-frm-border); }
html[data-theme] .frm-input:focus, html[data-theme] .frm-input:focus-within { border-color: rgb(var(--p-500)); box-shadow: 0 0 0 3px rgb(var(--p-100)); }

html[data-theme] .status-online { background-color: rgb(var(--p-100)); color: rgb(var(--p-800)); border-color: rgb(var(--p-200)); }

/* ธีมหัวข้อแบบตัวเอียงมีเชิง (โคเก็ตต์) */
html[data-serif] h1, html[data-serif] h2, html[data-serif] h3 { font-family: 'Georgia', 'Times New Roman', 'Sarabun', serif; font-style: italic; letter-spacing: .01em; }

/* ขอบล่างหัวเว็บ: ลูกไม้หยัก (scallop) หรือคลื่น (wave) */
html[data-edge="scallop"] header.cute-card,
html[data-edge="wave"] header.cute-card { overflow: visible !important; margin-bottom: 1.75rem; }
html[data-edge="scallop"] header.cute-card::after,
html[data-edge="wave"] header.cute-card::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -13px; height: 14px; pointer-events: none;
}
html[data-edge="scallop"] header.cute-card::after {
  background: radial-gradient(circle at 10px 0, var(--t-edge) 9px, transparent 9.5px) repeat-x;
  background-size: 20px 14px;
}
html[data-edge="wave"] header.cute-card::after {
  background: radial-gradient(ellipse 14px 9px at 14px 0, var(--t-edge) 98%, transparent 100%) repeat-x;
  background-size: 28px 14px;
}

/* ตัวการ์ตูนประจำธีม */
.theme-mascot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.theme-mascot { pointer-events: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,.10)); }
@media (prefers-reduced-motion: no-preference) {
  .theme-mascot { animation: mascotBob 3.2s ease-in-out infinite; transform-origin: 50% 90%; }
  .theme-mascot-peek { animation: mascotPeek 3.6s ease-in-out infinite; }
}
@keyframes mascotBob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-5px) rotate(2deg); } }
@keyframes mascotPeek { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(3deg); } }

/* ตัวเลือกธีม */
.theme-card { border: 2px solid #EEE; border-radius: 18px; background: #fff; transition: transform .15s, border-color .15s, box-shadow .15s; }
.theme-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.theme-card.is-current { border-color: rgb(var(--p-500)); box-shadow: 0 0 0 3px rgb(var(--p-200)); }
.theme-swatch { width: 18px; height: 18px; border-radius: 9999px; border: 1.5px solid rgba(0,0,0,.12); display: inline-block; }

/* ===== ตุ๊กตาประจำธีม ใต้เมนูซ้าย ===== */
.theme-doll-wrap { position: fixed; left: 1rem; bottom: 1.25rem; width: 14rem; flex-direction: column; align-items: center; pointer-events: none; z-index: 20; }
.theme-doll { position: relative; width: 9.5rem; display: flex; flex-direction: column; align-items: center; filter: drop-shadow(0 6px 10px rgba(0,0,0,.10)); }
.theme-doll-head { width: 8.5rem; height: 8.5rem; position: relative; z-index: 2; margin-bottom: -2.6rem; }
.theme-doll-head svg { width: 100%; height: 100%; overflow: visible; }
.theme-doll-body { width: 8rem; height: auto; position: relative; z-index: 1; }
.theme-doll-name { margin-top: 0.2rem; font-size: 0.78rem; font-weight: 700; color: #111; background: rgba(255,255,255,.85); padding: 0.1rem 0.7rem; border-radius: 9999px; border: 1px solid rgb(var(--p-200)); }
.theme-doll-bubble { align-self: flex-end; margin-right: 0.6rem; margin-bottom: -0.4rem; font-size: 0.78rem; font-weight: 700; color: #111; background: #fff; border: 1.5px solid rgb(var(--p-300)); border-radius: 14px 14px 14px 4px; padding: 0.2rem 0.65rem; box-shadow: 0 2px 0 rgb(var(--p-200)); }
@media (prefers-reduced-motion: no-preference) {
  .theme-doll { animation: dollSway 3.4s ease-in-out infinite; transform-origin: 50% 100%; }
  .theme-doll-head { animation: dollHead 3.4s ease-in-out infinite; transform-origin: 50% 85%; }
  .theme-doll-bubble { animation: dollBubble 3.4s ease-in-out infinite; }
}
@keyframes dollSway { 0%,100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg) translateY(-3px); } }
@keyframes dollHead { 0%,100% { transform: rotate(3deg); } 50% { transform: rotate(-4deg); } }
@keyframes dollBubble { 0%,100% { transform: translateY(0); opacity: 1; } 50% { transform: translateY(-4px); opacity: .9; } }
/* หน้าจอเตี้ย: ซ่อนตุ๊กตาไม่ให้ทับเมนู */
@media (max-height: 760px) { .theme-doll-wrap { display: none !important; } }

/* ตุ๊กตาอยู่ในการ์ดเมนูซ้าย ชิดด้านล่าง (เมนูสูงเต็มหน้าจอ) */
nav .theme-doll-wrap { position: static; width: 100%; margin-top: auto; padding-top: 0.75rem; border-top: 1px solid rgb(var(--p-100)); z-index: auto; }
@media (max-height: 760px) { nav .theme-doll-wrap { display: flex !important; } nav .theme-doll-head { width: 6rem; height: 6rem; margin-bottom: -1.8rem; } nav .theme-doll-body { width: 5.6rem; } }
@media (max-height: 600px) { nav .theme-doll-wrap { display: none !important; } }
nav .tab-pill { white-space: nowrap; }

/* หัวข้อ "เมนู" + ตุ๊กตาเหลือแค่หัว */
.menu-title { width: 100%; text-align: center; font-weight: 800; font-size: 1.05rem; color: #111; padding: 0.35rem 0 0.5rem; margin-bottom: 0.25rem; border-bottom: 1.5px dashed rgb(var(--p-200)); letter-spacing: .02em; }
@media (max-width: 767px) { .menu-title { display: none; } }
.theme-doll-head { margin-bottom: 0 !important; width: 8rem; height: 8rem; }
nav .theme-doll-bubble { margin-bottom: -0.2rem; }
@media (max-height: 760px) { nav .theme-doll-head { width: 6rem; height: 6rem; } }
nav .theme-doll-bubble { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: center; margin-right: 0; }
