@font-face{font-family:'Mali';font-style:normal;font-weight:200;font-display:swap;src:url('fonts/Mali-ExtraLight.woff2') format('woff2');}
@font-face{font-family:'Mali';font-style:italic;font-weight:200;font-display:swap;src:url('fonts/Mali-ExtraLightItalic.woff2') format('woff2');}
@font-face{font-family:'Mali';font-style:normal;font-weight:300;font-display:swap;src:url('fonts/Mali-Light.woff2') format('woff2');}
@font-face{font-family:'Mali';font-style:italic;font-weight:300;font-display:swap;src:url('fonts/Mali-LightItalic.woff2') format('woff2');}
@font-face{font-family:'Mali';font-style:normal;font-weight:400;font-display:swap;src:url('fonts/Mali-Regular.woff2') format('woff2');}
@font-face{font-family:'Mali';font-style:italic;font-weight:400;font-display:swap;src:url('fonts/Mali-Italic.woff2') format('woff2');}
@font-face{font-family:'Mali';font-style:normal;font-weight:500;font-display:swap;src:url('fonts/Mali-Medium.woff2') format('woff2');}
@font-face{font-family:'Mali';font-style:italic;font-weight:500;font-display:swap;src:url('fonts/Mali-MediumItalic.woff2') format('woff2');}
@font-face{font-family:'Mali';font-style:normal;font-weight:600;font-display:swap;src:url('fonts/Mali-SemiBold.woff2') format('woff2');}
@font-face{font-family:'Mali';font-style:italic;font-weight:600;font-display:swap;src:url('fonts/Mali-SemiBoldItalic.woff2') format('woff2');}
@font-face{font-family:'Mali';font-style:normal;font-weight:700;font-display:swap;src:url('fonts/Mali-Bold.woff2') format('woff2');}
@font-face{font-family:'Mali';font-style:italic;font-weight:700;font-display:swap;src:url('fonts/Mali-BoldItalic.woff2') format('woff2');}
@font-face{font-family:'ScheherazadeNew';font-style:normal;font-weight:400;font-display:swap;src:url('fonts/ScheherazadeNew-Regular.woff2') format('woff2');}
@font-face{font-family:'NotoNaskhAr';font-style:normal;font-weight:400;font-display:swap;src:url('fonts/NotoNaskhArabic-Regular.woff2') format('woff2');}
@font-face{font-family:'AmiriAr';font-style:normal;font-weight:400;font-display:swap;src:url('fonts/Amiri-Regular.woff2') format('woff2');}
:root { --arfont: 'ScheherazadeNew', 'NotoNaskhAr', 'Geeza Pro', 'Traditional Arabic', serif; }
[data-arfont='naskh'] { --arfont: 'NotoNaskhAr', 'ScheherazadeNew', 'Geeza Pro', serif; }
[data-arfont='amiri'] { --arfont: 'AmiriAr', 'ScheherazadeNew', 'Geeza Pro', serif; }

:root {
  --bg: #F3EEDC; --card: color-mix(in srgb, var(--bg) 45%, #fff); --text: #44563F; --muted: #8A9680; --border: #E4DBBF;
  --primary: #7CAE8A; --primary-dark: #4C7959; --head1: #C6E0CC; --head2: #A9D2B5;
  --soft: color-mix(in srgb, var(--primary) 16%, var(--bg)); --on-primary: #FFFFFF;
  --sh-d: rgba(150, 133, 90, .24); --sh-l: rgba(255, 255, 255, .95);
  --out: 6px 6px 14px var(--sh-d), -5px -5px 12px var(--sh-l);
  --out-s: 3px 3px 8px var(--sh-d), -3px -3px 7px var(--sh-l);
  --in: inset 3px 3px 7px var(--sh-d), inset -3px -3px 7px var(--sh-l);
  --shadow: var(--out);
  --grid: color-mix(in srgb, var(--primary) 15%, transparent);
  --ok: #5DB985; --moon: var(--head1); --danger: #E36A6A;
  --fard: #F29A9A; --sunnah: #8CCB9E; --charity: #F2C96B; --other: #AFA3EE;
}
[data-theme='gold'] { --bg:#FFF6DC; --text:#4A3F2A; --muted:#9A8F78; --border:#F2E2A8; --primary:#EBA43A; --primary-dark:#C77F1A; --head1:#F6D56F; --head2:#EDB04A; --sh-d:rgba(190,150,60,.25); }
[data-theme='blush']    { --bg:#FFF0F3; --text:#5A3A44; --muted:#B08B97; --border:#FAD3DD; --primary:#EE7C98; --primary-dark:#C9506F; --head1:#F8A9BC; --head2:#F086A3; --soft:#FFE1E8; --shadow:0 4px 16px rgba(220,110,140,.15); }
[data-theme='mint']     { --bg:#EEFAF4; --text:#2F4A40; --muted:#7FA091; --border:#CDEBDD; --primary:#4DB790; --primary-dark:#2E8A69; --head1:#8DD6B8; --head2:#5CBF9C; --soft:#D9F4E7; --shadow:0 4px 16px rgba(70,170,130,.15); }
[data-theme='sky']      { --bg:#EEF7FE; --text:#2D4258; --muted:#7D9AB3; --border:#CFE6F8; --primary:#4FA3E3; --primary-dark:#2A78B8; --head1:#8BC8F3; --head2:#5BAEEA; --soft:#DCEEFC; --shadow:0 4px 16px rgba(70,140,210,.15); }
[data-theme='lavender'] { --bg:#F4F1FE; --text:#3F3A5C; --muted:#9A92BE; --border:#DDD6F7; --primary:#8D7CE0; --primary-dark:#6553BF; --head1:#B9ADF2; --head2:#9A89E8; --soft:#E8E3FB; --shadow:0 4px 16px rgba(120,100,210,.15); }
[data-theme='night']    { --moon:#E9C46A; --bg:#161C33; --card:#212A4A; --text:#ECE9F7; --muted:#9BA3C4; --border:#33406B; --primary:#E9C46A; --primary-dark:#F3D98F; --head1:#2B3556; --head2:#1E2745; --soft:#2B3560; --on-primary:#1B2038; --shadow:0 4px 16px rgba(0,0,0,.35); }

[data-theme='forest'] { --bg:#EAF2E6; --text:#2B3F2E; --muted:#7C9A80; --border:#CFE3CF; --primary:#3F8F5A; --primary-dark:#2A6A40; --head1:#9CCFA9; --head2:#6DB783; --soft:#D6E9D6; --sh-d:rgba(80,130,90,.24); }
[data-theme='olive'] { --bg:#F3F3E2; --text:#434630; --muted:#98997A; --border:#E3E5BD; --primary:#9AA544; --primary-dark:#6F7A2A; --head1:#D3DA94; --head2:#B6C165; --soft:#E6E9C4; --sh-d:rgba(140,150,60,.24); }
[data-theme='teal'] { --bg:#E8F6F6; --text:#264648; --muted:#7FA3A3; --border:#C5E6E5; --primary:#2FA3A3; --primary-dark:#1F7A7A; --head1:#8ADAD8; --head2:#55C0BE; --soft:#D2EFEE; --sh-d:rgba(60,150,150,.24); }
[data-theme='ocean'] { --bg:#E9F0FA; --text:#26364F; --muted:#7F93B3; --border:#CBD9F2; --primary:#3F6FD0; --primary-dark:#2A4FA0; --head1:#98B6EE; --head2:#6B93E0; --soft:#D6E2F8; --sh-d:rgba(70,100,180,.24); }
[data-theme='plum'] { --bg:#F8EEF6; --text:#4F3350; --muted:#A78AA8; --border:#EBCDE8; --primary:#B060B0; --primary-dark:#8A3F8C; --head1:#DDA7DD; --head2:#C27FC4; --soft:#F0DAEE; --sh-d:rgba(150,80,150,.24); }
[data-theme='rose'] { --bg:#FFEDEE; --text:#5C2F33; --muted:#B58A8D; --border:#F7CDD0; --primary:#D9505A; --primary-dark:#AC323C; --head1:#F2A0A6; --head2:#E4737C; --soft:#FFDADC; --sh-d:rgba(200,90,100,.24); }
[data-theme='coral'] { --bg:#FFF0EC; --text:#5A3A36; --muted:#B5908A; --border:#FAD3CB; --primary:#F0806C; --primary-dark:#C95A46; --head1:#F9B2A4; --head2:#F28E7B; --soft:#FFE0DA; --sh-d:rgba(220,120,100,.24); }
[data-theme='peach'] { --bg:#FFF3E6; --text:#5A4129; --muted:#B59A7E; --border:#F7DDBD; --primary:#F29B4C; --primary-dark:#C97620; --head1:#F9C98F; --head2:#F4AC5E; --soft:#FFE6CC; --sh-d:rgba(210,140,70,.24); }
[data-theme='choco'] { --bg:#F4ECE4; --text:#4A382C; --muted:#A38F80; --border:#E3D3C3; --primary:#A9784F; --primary-dark:#7F5535; --head1:#D8B896; --head2:#C09770; --soft:#EADBCB; --sh-d:rgba(150,110,80,.24); }

/* ---------- ธีมสีเข้ม ---------- */
[data-theme='emerald'] { --moon:#7EE0B6; --bg:#0F2420; --card:#183530; --text:#E4F3EA; --muted:#8DB5A3; --border:#2A4F46; --primary:#5FD3A0; --primary-dark:#8EE6C0; --head1:#1D4A3E; --head2:#123229; --soft:#1F4238; --on-primary:#0B1F1A; }
[data-theme='abyss']   { --moon:#8CC4F7; --bg:#0C1626; --card:#15263F; --text:#E6EEF9; --muted:#8CA3C2; --border:#254166; --primary:#5AA9F0; --primary-dark:#8CC4F7; --head1:#1B3A63; --head2:#112845; --soft:#1C3556; --on-primary:#08121F; }
[data-theme='mocha']   { --moon:#EDC09A; --bg:#211914; --card:#2F241C; --text:#F3E7DB; --muted:#B39C88; --border:#4A3A2D; --primary:#E0A370; --primary-dark:#EDC09A; --head1:#3C2D22; --head2:#2A1F17; --soft:#3A2C21; --on-primary:#26180D; }
[data-theme='wine']    { --moon:#F0AFD6; --bg:#24121F; --card:#351C2F; --text:#F6E6F1; --muted:#B994AE; --border:#54304B; --primary:#E58AC2; --primary-dark:#F0AFD6; --head1:#4A2442; --head2:#331830; --soft:#4A2842; --on-primary:#2B0F24; }
[data-theme='amoled']  { --moon:#7BEBB6; --bg:#000000; --card:#141414; --text:#EDEDED; --muted:#8E8E8E; --border:#2A2A2A; --primary:#4ADE9A; --primary-dark:#7BEBB6; --head1:#1A1A1A; --head2:#0D0D0D; --soft:#1E1E1E; --on-primary:#031A10; }
[data-theme='dusk']     { --moon:#F6C3E3; --bg:#3B2A45; --card:#4A3656; --text:#F8EAF5; --muted:#C6A9C4; --border:#664C74; --primary:#F0A6D2; --primary-dark:#F8C9E5; --head1:#5A4068; --head2:#463152; --soft:#573D63; --on-primary:#3A1E36; }
[data-theme='rosewood'] { --moon:#F9C6D2; --bg:#4A2F3A; --card:#5C3B48; --text:#FBEBEF; --muted:#D0A9B4; --border:#76505F; --primary:#F4A3B5; --primary-dark:#FACBD6; --head1:#6E4755; --head2:#573745; --soft:#6B4553; --on-primary:#451B28; }
[data-theme='lilac']    { --moon:#D4C8FA; --bg:#34324F; --card:#43405F; --text:#EFEDFB; --muted:#B4AFD6; --border:#5C5886; --primary:#B9A8F5; --primary-dark:#D6CCFA; --head1:#524E7B; --head2:#3F3C63; --soft:#504C78; --on-primary:#26214A; }
[data-theme='emerald'], [data-theme='abyss'], [data-theme='mocha'], [data-theme='wine'], [data-theme='amoled'], [data-theme='dusk'], [data-theme='rosewood'], [data-theme='lilac'] { --shadow:0 4px 16px rgba(0,0,0,.35); --sh-d:rgba(0,0,0,.5); --sh-l:rgba(255,255,255,.05); --grid:rgba(255,255,255,.05); color-scheme: dark; }
[data-theme='emerald'] .hero, [data-theme='abyss'] .hero, [data-theme='mocha'] .hero, [data-theme='wine'] .hero, [data-theme='amoled'] .hero, [data-theme='dusk'] .hero, [data-theme='rosewood'] .hero, [data-theme='lilac'] .hero { color: var(--primary); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; color: var(--text); font-family: 'Mali', system-ui, sans-serif; }
body { background-color: var(--bg); background-image: var(--bgimg); background-size: var(--bgsz); background-attachment: fixed; min-height: 100vh; padding-bottom: calc(150px + env(safe-area-inset-bottom)); overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: var(--text); }
h1, h2, h3 { margin: 0; }
.hidden { display: none !important; }

/* ---------- หัวแอป ---------- */
.hero {
  background: linear-gradient(170deg, var(--head1), var(--head2));
  color: var(--primary-dark); text-align: center; padding: calc(30px + env(safe-area-inset-top)) 18px 24px;
  border-radius: 0 0 34px 34px; box-shadow: var(--out); position: relative; overflow: hidden;
}
.hero::before { content: ''; position: absolute; left: 0; right: 0; top: calc(8px + env(safe-area-inset-top)); height: 12px;
  background: radial-gradient(circle at 50% 50%, var(--bg) 0 4.5px, transparent 5.5px) 0 0 / 26px 12px repeat-x; opacity: .9; }
[data-theme='night'] .hero { color: var(--primary); }
[data-theme='blush'] { --sh-d:rgba(190,110,130,.22); }
[data-theme='mint'] { --sh-d:rgba(80,150,120,.22); }
[data-theme='sky'] { --sh-d:rgba(80,130,180,.22); }
[data-theme='lavender'] { --sh-d:rgba(110,95,180,.2); }
[data-theme='night'] { --sh-d:rgba(0,0,0,.45); --sh-l:rgba(255,255,255,.05); --grid: rgba(255,255,255,.05); }
.hero h1 { font-size: 1.45rem; letter-spacing: .3px; font-weight: 700; }
.hero p { margin: 4px 0 0; font-size: .85rem; opacity: .85; }
.demo-pill { position: static; display: inline-block; margin-top: 8px; font-size: .68rem; background: rgba(255,255,255,.55); padding: 3px 9px; border-radius: 99px; }

main { padding: 14px 14px 8px; max-width: 640px; margin: 0 auto; }
.card { background: var(--card); border-radius: 26px; padding: 16px; margin-bottom: 16px; box-shadow: var(--out); }
.card h2 { font-size: 1.02rem; color: var(--primary-dark); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h2::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--soft); flex: none; }
.card h2.center { justify-content: center; }
.card h2.center::before { display: none; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.muted { color: var(--muted); font-size: .82rem; }
.center { text-align: center; }
.btn { background: var(--primary); color: var(--on-primary); padding: 11px 18px; border-radius: 16px; font-weight: 600; box-shadow: 4px 4px 10px var(--sh-d), -3px -3px 8px var(--sh-l); transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(1px); box-shadow: inset 2px 2px 6px rgba(0,0,0,.18); }
.btn.ghost { background: var(--card); color: var(--primary-dark); box-shadow: var(--out-s); }
.btn.ghost:active { box-shadow: var(--in); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 6px 12px; font-size: .82rem; border-radius: 11px; }
.btn.block { width: 100%; }
.chip { display: inline-block; padding: 7px 13px; border-radius: 99px; background: var(--card); box-shadow: var(--out-s); color: var(--primary-dark); font-size: .85rem; margin: 0 6px 6px 0; }

/* ---------- แถบล่าง ---------- */
nav.tabs {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 20; max-width: 620px; margin: 0 auto;
  display: flex; gap: 2px; justify-content: space-around; padding: 7px 6px;
  background: var(--card); border-radius: 28px; box-shadow: var(--out);
}
nav.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 20px; font-size: .66rem; color: var(--muted); }
nav.tabs button .ic { font-size: 1.35rem; line-height: 1; transition: transform .2s; }
nav.tabs button.active { background: var(--card); box-shadow: var(--in); color: var(--primary-dark); font-weight: 700; }
nav.tabs button.active .ic { transform: translateY(-2px) scale(1.12); }

/* ---------- วันนี้ ---------- */
.mascot-card { display: flex; gap: 12px; align-items: center; }
.stk { filter: drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff) drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff) drop-shadow(0 3px 4px rgba(60,50,20,.18)); overflow: visible; }
.stk-wrap { flex: none; animation: bob 3.2s ease-in-out infinite; }
.stk-wrap svg { width: 84px; height: 84px; display: block; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-5px) } }
.bubble { background: var(--card); box-shadow: var(--in); border-radius: 20px 20px 20px 6px; padding: 11px 14px; font-size: .92rem; line-height: 1.55; }
.ring-wrap { position: relative; width: 84px; height: 84px; flex: none; }
.ring-wrap .ring-text { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; color: var(--primary-dark); }
.date-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.date-nav button { width: 40px; height: 40px; border-radius: 14px; background: var(--card); box-shadow: var(--out-s); color: var(--primary-dark); font-size: 1.1rem; }
.date-nav button:active { box-shadow: var(--in); }
.date-title { text-align: center; line-height: 1.3; }
.date-title b { font-size: 1.05rem; }
.stat-row { display: flex; gap: 10px; }
.stat { flex: 1; background: var(--card); box-shadow: var(--out-s); border-radius: 20px; padding: 12px 6px; text-align: center; }
.stat b { display: block; font-size: 1.25rem; color: var(--primary-dark); }
.stat span { font-size: .72rem; color: var(--muted); }

.habit { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; margin-bottom: 10px; background: var(--card); box-shadow: var(--out-s); border: 0; width: 100%; text-align: left; transition: box-shadow .15s, background .15s; }
.habit .em { font-size: 1.35rem; width: 38px; text-align: center; display: grid; place-items: center; }
.habit .em svg, .goal-item .em svg { width: 36px; height: 36px; display: block; }
.mc-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.mc-dot { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ink, #5E6E5A); box-shadow: var(--out-s); }
.mc-dot.active { box-shadow: var(--in), 0 0 0 3px var(--primary); transform: scale(1.08); }
.habit .nm { flex: 1; font-size: .96rem; }
.habit .box { width: 30px; height: 30px; border-radius: 11px; border: 0; box-shadow: var(--in); display: grid; place-items: center; color: transparent; font-size: 1rem; transition: all .15s; }
.habit.done { background: var(--soft); box-shadow: var(--in); }
.habit.done .nm { text-decoration: line-through; opacity: .65; }
.habit.done .box { background: var(--primary); box-shadow: 2px 2px 6px var(--sh-d); color: var(--on-primary); animation: pop .3s; }
.habit[data-cat='fard'] .em { filter: none; }
.cat-title { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); margin: 12px 2px 8px; }
.cat-title i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
@keyframes pop { 0% { transform: scale(.6) } 60% { transform: scale(1.25) } 100% { transform: scale(1) } }

.task { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 18px; background: var(--card); box-shadow: var(--out-s); margin-bottom: 7px; }
.task .t-time { font-size: .78rem; background: var(--soft); box-shadow: var(--in); color: var(--primary-dark); border-radius: 9px; padding: 3px 8px; white-space: nowrap; }
.task .t-title { flex: 1; font-size: .92rem; word-break: break-word; }
.task.done .t-title { text-decoration: line-through; opacity: .55; }
.task button { font-size: 1.05rem; padding: 4px 6px; }

.sparkle { position: fixed; pointer-events: none; z-index: 99; font-size: 1.3rem; animation: floatup 1.4s ease-out forwards; }
@keyframes floatup { from { opacity: 1; transform: translateY(0) scale(.8) } to { opacity: 0; transform: translateY(-140px) scale(1.4) rotate(40deg) } }

/* ---------- ปฏิทิน ---------- */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: .72rem; color: var(--muted); margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-cell { aspect-ratio: 1; border-radius: 15px; background: var(--card); box-shadow: var(--out-s); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .86rem; position: relative; border: 2px solid transparent; }
.cal-cell.empty { background: none; box-shadow: none; }
.cal-cell.today { border-color: var(--primary); font-weight: 700; }
.cal-cell.sel { background: var(--soft); box-shadow: var(--in); }
.cal-cell .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary-dark); position: absolute; top: 5px; right: 6px; }
.cal-cell .pbar { position: absolute; left: 20%; right: 20%; bottom: 5px; height: 4px; border-radius: 4px; background: rgba(0,0,0,.07); overflow: hidden; }
.cal-cell .pbar i { display: block; height: 100%; background: var(--ok); border-radius: 4px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .74rem; color: var(--muted); margin-top: 10px; }

/* ---------- แผ่นล่าง (modal) ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(20, 15, 5, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@keyframes fade { from { opacity: 0 } }
.sheet { background-color: var(--bg); background-image: var(--bgimg); background-size: var(--bgsz); width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; border-radius: 28px 28px 0 0; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); animation: slide .25s ease-out; }
@keyframes slide { from { transform: translateY(40px); opacity: .5 } }
.sheet .grab { width: 44px; height: 5px; border-radius: 5px; background: var(--border); margin: -6px auto 12px; }
.field { display: block; margin-bottom: 10px; }
.field span { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.field input, .field select { width: 100%; padding: 12px 14px; border-radius: 16px; border: 0; background: var(--card); box-shadow: var(--in); outline: none; }
.field input:focus, .field select:focus, .chat-input input:focus { box-shadow: var(--in), 0 0 0 2px var(--primary); }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: var(--card); box-shadow: var(--in); border-radius: 28px; transition: .2s; }
.switch i::after { content: ''; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(20px); }

/* ---------- สถิติ/กราฟ ---------- */
.seg { display: flex; background: var(--card); box-shadow: var(--in); border-radius: 18px; padding: 4px; margin-bottom: 14px; }
.seg button { flex: 1; padding: 8px; border-radius: 14px; font-size: .9rem; color: var(--muted); }
.seg button.active { background: var(--card); color: var(--primary-dark); font-weight: 700; box-shadow: var(--out-s); }
.bar-row { display: grid; grid-template-columns: 112px 1fr 42px; gap: 8px; align-items: center; margin-bottom: 9px; font-size: .84rem; }
.bar-row .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { position: relative; height: 14px; background: var(--card); box-shadow: var(--in); border-radius: 14px; overflow: visible; }
.bar-fill { height: 100%; border-radius: 14px; min-width: 0; transition: width .5s; }
.bar-goal { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 2px dashed var(--primary-dark); opacity: .7; }
.bar-row .val { text-align: right; color: var(--primary-dark); font-weight: 600; font-size: .8rem; }
.chart-svg { width: 100%; height: auto; display: block; }
.months { display: flex; align-items: flex-end; gap: 10px; height: 130px; padding-top: 10px; }
.months .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; font-size: .72rem; color: var(--muted); }
.months .col i { width: 100%; max-width: 38px; border-radius: 10px 10px 4px 4px; background: linear-gradient(var(--head1), var(--primary)); min-height: 4px; }
.months .col.cur i { outline: 2px solid var(--primary-dark); outline-offset: 2px; }
.months .col b { color: var(--primary-dark); font-size: .74rem; }
.pill-ok { color: var(--ok); font-weight: 700; }

/* ---------- อัซการ ---------- */
.dhikr { padding: 16px; }
.dhikr .ar, .daily .ar { font-family: var(--arfont); direction: rtl; text-align: center; line-height: 2.2; font-size: calc(1.5rem * var(--az, 1)); white-space: pre-line; margin-bottom: 10px; }
.dhikr .th { font-size: .86rem; color: var(--muted); line-height: 1.6; margin-bottom: 10px; }
.dhikr .src { font-size: .72rem; color: var(--muted); opacity: .85; }
.counter { width: 100%; padding: 14px; border-radius: 20px; background: var(--card); box-shadow: var(--out-s); color: var(--primary-dark); font-weight: 700; font-size: 1.05rem; margin-top: 10px; position: relative; overflow: hidden; }
.counter .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--primary); opacity: .22; transition: width .2s; }
.counter.done { background: var(--ok); color: #fff; }
.counter.done .fill { display: none; }
.counter span { position: relative; }
.derived-note { font-size: .7rem; color: var(--muted); margin-top: 6px; }

/* ---------- แชท ---------- */
.chat-box { display: flex; flex-direction: column; gap: 8px; min-height: 40vh; max-height: calc(100vh - 360px); overflow-y: auto; padding: 4px 2px 8px; scroll-behavior: smooth; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 18px; line-height: 1.55; font-size: .93rem; white-space: pre-wrap; word-break: break-word; }
.msg.bot { background: var(--card); box-shadow: var(--out-s); border-bottom-left-radius: 6px; align-self: flex-start; }
.msg.me { background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 6px; align-self: flex-end; box-shadow: 3px 3px 8px var(--sh-d); }
.msg.sys { align-self: center; background: var(--soft); color: var(--primary-dark); font-size: .8rem; text-align: center; }
.typing span { display: inline-block; width: 7px; height: 7px; background: var(--muted); border-radius: 50%; margin: 0 2px; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s } .typing span:nth-child(3) { animation-delay: .4s }
@keyframes blink { 0%,80%,100% { opacity: .25 } 40% { opacity: 1 } }
.chat-input { display: flex; gap: 8px; margin-top: 8px; }
.chat-input input { flex: 1; padding: 13px 16px; border-radius: 99px; border: 0; background: var(--card); box-shadow: var(--in); outline: none; }
.chat-input button { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: 1.1rem; box-shadow: 3px 3px 8px var(--sh-d), -2px -2px 6px var(--sh-l); }
.notice { background: var(--card); box-shadow: var(--in); border-radius: 18px; padding: 11px 13px; font-size: .8rem; line-height: 1.6; color: var(--primary-dark); margin-bottom: 12px; }

/* ---------- ตั้งค่า ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-btn { border-radius: 18px; padding: 10px 6px; border: 0; background: var(--card); box-shadow: var(--out-s); font-size: .78rem; }
.theme-btn .sw { display: flex; height: 30px; border-radius: 10px; overflow: hidden; margin-bottom: 6px; }
.theme-btn .sw i { flex: 1; }
.theme-btn.active { box-shadow: var(--in), 0 0 0 2px var(--primary); font-weight: 700; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.set-row:last-child { border-bottom: 0; }
.goal-item { display: flex; align-items: center; gap: 8px; padding: 7px 0; }
.goal-item input.nm { flex: 1; padding: 9px 11px; border-radius: 13px; border: 0; box-shadow: var(--in); background: var(--card); min-width: 0; }
.goal-item .em { width: 34px; text-align: center; }
input[type='range'] { width: 100%; accent-color: var(--primary); }

/* ---------- ล็อกอิน ---------- */
.auth { max-width: 420px; margin: 0 auto; padding: 18px; }

/* ---------- ล็อกอิน (หน้าใหม่) ---------- */
.auth-page { position: fixed; inset: 0; z-index: 60; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(120% 70% at 50% -10%, #2E8F78 0%, rgba(46,143,120,0) 60%), linear-gradient(175deg, #0C3B3A 0%, #0F2F33 55%, #11243A 100%);
  display: flex; flex-direction: column; align-items: center; padding: calc(28px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom)); color: #EAF7F1; }
.auth-page::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(circle, rgba(255,255,255,.9) 0 1.2px, transparent 1.8px), radial-gradient(circle, rgba(242,193,78,.8) 0 1px, transparent 1.6px);
  background-size: 90px 90px, 140px 140px; background-position: 12px 20px, 60px 70px; mask-image: linear-gradient(#000, transparent 70%); -webkit-mask-image: linear-gradient(#000, transparent 70%); }
.auth-brand { position: relative; text-align: center; margin: 6px 0 18px; }
.auth-moon { width: 74px; height: 74px; margin: 0 auto 8px; display: block; filter: drop-shadow(0 6px 18px rgba(242,193,78,.35)); }
.auth-brand h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: .3px; color: #fff; }
.auth-brand p { margin: 4px 0 0; font-size: .85rem; color: #BFE3D5; }
.auth-card { position: relative; width: 100%; max-width: 400px; --bg:#F4FBF8; --card:#fff; --text:#23413B; --muted:#76908A; --border:#D4E8E0; --primary:#1F8A70; --primary-dark:#14604F; --soft:#E5F4EE; --on-primary:#fff; --sh-d:rgba(20,90,75,.18); --sh-l:rgba(255,255,255,.9); --danger:#D4504F; --ok:#2E9E6E;
  background: #FBFEFC; color: var(--text); border-radius: 28px; padding: 22px 20px 18px; box-shadow: 0 18px 50px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.4) inset; color-scheme: light; }
.auth-card h2 { font-size: 1.2rem; color: var(--primary-dark); }
.auth-card .field input { background: #F1F8F5; box-shadow: none; border: 1.5px solid var(--border); }
.auth-card .field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,138,112,.18); }
.auth-card .btn { background: linear-gradient(180deg, #F6CC5E, #E6AE32); color: #3A2A05; box-shadow: 0 6px 16px rgba(230,174,50,.4); border-radius: 18px; padding: 13px 18px; font-size: 1rem; }
.auth-card .btn:active { box-shadow: inset 0 2px 6px rgba(0,0,0,.2); }
.auth-card .btn.ghost { background: #EAF5F0; color: var(--primary-dark); box-shadow: none; }
.auth-card a { color: var(--primary); font-weight: 600; }
.auth-foot { position: relative; margin-top: 16px; font-size: .78rem; color: #9CC9BA; text-align: center; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(108px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-size: .85rem; z-index: 60; max-width: 90%; text-align: center; animation: fade .2s; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.err { color: var(--danger); font-size: .84rem; margin: 6px 0; }

/* ---------- ชุดสติกเกอร์ ---------- */
.stk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; }
.stk-item { text-align: center; font-size: .74rem; color: var(--muted); }
.stk-item svg { width: 100%; max-width: 92px; height: auto; display: block; margin: 0 auto 2px; }
.avatar-pick { display: flex; gap: 12px; }
.avatar-pick button { flex: 1; border-radius: 22px; padding: 10px 6px 8px; background: var(--card); box-shadow: var(--out-s); font-size: .84rem; }
.avatar-pick button.active { box-shadow: var(--in), 0 0 0 2px var(--primary); font-weight: 700; color: var(--primary-dark); }
.avatar-pick svg { width: 84px; height: 84px; display: block; margin: 0 auto 2px; }
.title-sticker { display: flex; align-items: center; gap: 10px; }
.title-sticker .stk-wrap svg { width: 62px; height: 62px; }

/* แถบเลื่อนแบบ soft */
input[type='range'] { -webkit-appearance: none; appearance: none; height: 16px; background: var(--card); box-shadow: var(--in); border-radius: 99px; padding: 0; margin: 6px 0; }
input[type='range']::-webkit-slider-runnable-track { height: 16px; background: transparent; }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -5px; border-radius: 50%; background: var(--primary); box-shadow: 2px 2px 6px var(--sh-d), -1px -1px 4px var(--sh-l); border: 3px solid var(--card); }
input[type='range']::-moz-range-track { height: 16px; background: transparent; }
input[type='range']::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--primary); border: 3px solid var(--card); }

/* ---------- ลายพื้นหลัง (เลือกได้ในตั้งค่า) ---------- */
[data-bg='grid'], html:not([data-bg]) { --bgimg: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); --bgsz: 24px 24px; }
[data-bg='ruled'] { --bgimg: linear-gradient(var(--grid) 1.5px, transparent 1.5px); --bgsz: 100% 30px; }
[data-bg='dots'] { --bgimg: radial-gradient(color-mix(in srgb, var(--primary) 38%, transparent) 1.7px, transparent 2.2px); --bgsz: 22px 22px; }
[data-bg='islamic'] { --bgimg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%237CAE8A' stroke-opacity='.34' stroke-width='1.3'%3E%3Crect x='16' y='16' width='32' height='32'/%3E%3Crect x='16' y='16' width='32' height='32' transform='rotate(45 32 32)'/%3E%3Ccircle cx='32' cy='32' r='4.5'/%3E%3C/g%3E%3Cg fill='%237CAE8A' fill-opacity='.3'%3E%3Cpath d='M0 -4 L4 0 0 4 -4 0Z'/%3E%3Cpath transform='translate(64 0)' d='M0 -4 L4 0 0 4 -4 0Z'/%3E%3Cpath transform='translate(0 64)' d='M0 -4 L4 0 0 4 -4 0Z'/%3E%3Cpath transform='translate(64 64)' d='M0 -4 L4 0 0 4 -4 0Z'/%3E%3C/g%3E%3C/svg%3E"); --bgsz: 64px 64px; }
[data-bg='stars'] { --bgimg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cg fill='%23E9B949' fill-opacity='.5'%3E%3Cpath transform='translate(18 20)' d='M0 -6 L1.6 -1.6 6 0 1.6 1.6 0 6 -1.6 1.6 -6 0 -1.6 -1.6Z'/%3E%3Cpath transform='translate(64 48)' d='M0 -4.5 L1.2 -1.2 4.5 0 1.2 1.2 0 4.5 -1.2 1.2 -4.5 0 -1.2 -1.2Z'/%3E%3Cpath transform='translate(36 74)' d='M0 -3.5 L1 -1 3.5 0 1 1 0 3.5 -1 1 -3.5 0 -1 -1Z'/%3E%3C/g%3E%3Cg fill='%237CAE8A' fill-opacity='.35'%3E%3Ccircle cx='52' cy='14' r='1.8'/%3E%3Ccircle cx='8' cy='60' r='1.6'/%3E%3Ccircle cx='80' cy='80' r='1.6'/%3E%3C/g%3E%3C/svg%3E"); --bgsz: 90px 90px; }
[data-bg='plain'] { --bgimg: none; --bgsz: auto; }
.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bg-tile { border-radius: 18px; padding: 8px 8px 7px; background: var(--card); box-shadow: var(--out-s); font-size: .76rem; text-align: center; }
.bg-tile .bg-prev { height: 52px; border-radius: 12px; margin-bottom: 6px; background-color: var(--bg); background-image: var(--bgimg); background-size: var(--bgsz); box-shadow: var(--in); }
.bg-tile.active { box-shadow: var(--in), 0 0 0 2px var(--primary); font-weight: 700; color: var(--primary-dark); }
.sound-row { display: flex; gap: 8px; align-items: center; }
.sound-row select { flex: 1; }

/* ---------- เมนูล่างแบบชิบิ ---------- */
nav.tabs { z-index: 30; align-items: center; gap: 4px; padding: 9px 9px 7px 12px; }
nav.tabs button.slot { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0; background: none; box-shadow: none; border-radius: 18px; font-size: .68rem; color: var(--muted); }
nav.tabs button.slot.active { background: none; box-shadow: none; color: var(--primary-dark); font-weight: 700; }
.nb { position: relative; display: grid; place-items: center; width: var(--s, 46px); height: var(--s, 46px); border-radius: 50%; background: var(--c, #CBE7D2); box-shadow: 0 0 0 3px #fff, 3px 5px 9px var(--sh-d); overflow: hidden; transition: transform .15s, box-shadow .15s; flex: none; }
.nb svg.ni { width: 80%; height: 80%; display: block; }
.nb svg.ni.head { width: 108%; height: 108%; }
nav.tabs .slot.active .nb { box-shadow: 0 0 0 3px #fff, 0 0 0 5.5px var(--primary), 3px 5px 9px var(--sh-d); transform: translateY(-3px); }
nav.tabs .slot:active .nb { transform: scale(.94); }
nav.tabs .slot.drop .nb { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--primary), 0 0 14px var(--primary); transform: scale(1.12); }
nav.tabs button.fab { flex: none; width: 64px; display: grid; place-items: center; padding: 0; background: none; }
.fab .nb { --s: 54px; }
.fab .x { position: absolute; inset: 0; display: none; place-items: center; color: #fff; font-size: 1.4rem; background: var(--primary); }
.fab.open .x { display: grid; }
.fab.open .ni { display: none; }
.fab.on .nb { box-shadow: 0 0 0 3px #fff, 0 0 0 5.5px var(--primary), 3px 5px 9px var(--sh-d); }

#menuLayer .menu-ov { position: fixed; inset: 0; z-index: 25; background: rgba(46, 58, 38, .4); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); opacity: 0; transition: opacity .2s; }
#menuLayer .menu-ov.on { opacity: 1; }
.menu-head { position: absolute; left: 14px; right: 14px; top: calc(14px + env(safe-area-inset-top)); max-width: 620px; margin: 0 auto; display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--card); border-radius: 22px; padding: 10px 12px 10px 16px; box-shadow: var(--out); }
.menu-head .hint { font-size: .8rem; color: var(--muted); line-height: 1.45; }
.mb { position: absolute; width: 70px; display: flex; flex-direction: column; align-items: center; gap: 5px; background: none; padding: 0; touch-action: none; user-select: none; -webkit-user-select: none; transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; transition: transform .34s cubic-bezier(.3, 1.5, .5, 1), opacity .2s; }
.menu-ov.on .mb { transform: none; opacity: 1; }
.mb .nb { --s: 60px; }
.mb .lb { font-size: .74rem; background: var(--card); padding: 2px 10px; border-radius: 99px; box-shadow: var(--out-s); white-space: nowrap; color: var(--text); }
.mb .pin { position: absolute; top: -2px; right: 4px; width: 17px; height: 17px; border-radius: 50%; background: var(--primary); border: 2.5px solid #fff; box-shadow: 1px 2px 4px var(--sh-d); }
.mb.picked .nb { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--primary); transform: scale(1.1); }
.mb.lifting { opacity: .35 !important; }
.mb:active .nb { transform: scale(.94); }
.drag-ghost { position: fixed; z-index: 60; pointer-events: none; transform: translate(-50%, -50%) scale(1.18) rotate(-6deg); filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .25)); }
.drag-ghost .nb { --s: 62px; }
body.menu-edit nav.tabs .slot { touch-action: none; }
body.menu-edit nav.tabs .slot .nb { animation: wig .45s ease-in-out infinite alternate; }
@keyframes wig { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
body.menu-open .toast { bottom: calc(112px + env(safe-area-inset-bottom)); z-index: 70; }

/* ---------- การ์ดกำลังใจประจำวัน ---------- */
.daily { text-align: center; }
.daily .dhead { display: flex; align-items: center; gap: 10px; text-align: left; margin-bottom: 8px; }
.daily .dhead .stk-wrap { width: 62px; flex: none; }
.daily .dhead .bubble { flex: 1; font-size: .86rem; }
.daily .dtag { display: inline-block; font-size: .7rem; padding: 2px 10px; border-radius: 99px; background: var(--soft); color: var(--primary-dark); margin-bottom: 6px; }
.daily .ar { direction: rtl; line-height: 2.25; font-size: 1.55rem; margin: 6px 0 8px; white-space: pre-line; }
.daily .th { font-size: .9rem; line-height: 1.65; margin-bottom: 6px; }
.daily .src { font-size: .74rem; color: var(--muted); margin-bottom: 10px; }
.arfont-pick { display: flex; flex-direction: column; gap: 10px; }
.arfont-pick button { border-radius: 18px; padding: 10px 12px; background: var(--card); box-shadow: var(--out-s); font-size: .84rem; text-align: center; }
.arfont-pick button.active { box-shadow: var(--in), 0 0 0 2px var(--primary); font-weight: 700; color: var(--primary-dark); }

.trial-banner{background:#FFF1C9;border:2px solid #fff;box-shadow:0 4px 0 #EBCB7A;border-radius:18px;padding:10px 14px;margin:0 0 12px;color:#6B4A00;font-size:.92rem;line-height:1.4}
.trial-banner span{display:block;font-size:.8rem;opacity:.85}
.plans{display:grid;gap:8px;margin:10px 0}
.plan{background:var(--soft);border-radius:16px;padding:10px 12px;text-align:left;border:2px solid var(--border)}
.plan b{display:block}.plan span{font-size:.85rem;color:var(--muted)}
.plan.prem{border-color:var(--primary)}


/* ---------- เมนูล่างติดขอบจอ (แบบแอปทั่วไป) ---------- */
nav.tabs { left: 0; right: 0; bottom: 0; max-width: none; margin: 0; border-radius: 26px 26px 0 0; padding: 9px 10px calc(8px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 18px var(--sh-d); border-top: 2px solid #fff; }
body { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
.avatar-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.avatar-pick button { padding: 8px 2px 7px; font-size: .74rem; border-radius: 20px; }
.avatar-pick svg { width: 64px; height: 64px; }

/* ---------- โหมดมีรอบเดือน ---------- */
.pswitch { flex: none; width: 56px; height: 32px; border-radius: 99px; background: #D9D3C0; box-shadow: var(--in); position: relative; transition: background .2s; padding: 0; }
.pswitch i { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.25); transition: transform .2s; }
.pswitch.on { background: #F29AB0; }
.pswitch.on i { transform: translateX(24px); }
.pswitch:disabled { opacity: .55; }
.period-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: #FFE6EC; border: 2px solid #fff; border-radius: 20px; padding: 10px 14px; margin: 0 0 12px; box-shadow: 0 4px 0 #F4BFCB; color: #7A2E3F; }
.period-bar.on { background: #FFD3DE; }
.pb-t b { display: block; }
.pb-t span { display: block; font-size: .78rem; line-height: 1.35; opacity: .9; margin-top: 2px; }
.period-set { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.habit.locked { opacity: .5; filter: grayscale(.6); cursor: not-allowed; pointer-events: none; }
.habit.locked .box { background: #FFE0E8; border-color: #F4BFCB; color: inherit; }

/* ---------- เลือกรูปไอคอนในรายการ ---------- */
.hi-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hi-pick button { border-radius: 20px; padding: 10px 6px 8px; background: var(--card); box-shadow: var(--out-s); font-size: .8rem; }
.hi-pick button.active { box-shadow: var(--in), 0 0 0 2px var(--primary); font-weight: 700; color: var(--primary-dark); }
.hi-prev { display: flex; justify-content: center; gap: 4px; margin-bottom: 6px; }
.hi-prev svg { width: 40px; height: 40px; }
.hi-prev .emo { font-size: 1.7rem; width: 40px; line-height: 40px; }
svg.stkr { filter: drop-shadow(1.6px 0 0 #fff) drop-shadow(-1.6px 0 0 #fff) drop-shadow(0 1.6px 0 #fff) drop-shadow(0 -1.6px 0 #fff) drop-shadow(0 2px 2px rgba(60,80,50,.25)); overflow: visible; }
.habit .em svg.me { width: 42px; height: 42px; }


/* ---------- โน้ตประจำวัน (มุ้งมิ้ง) ---------- */
.cal-cell .nmk { position: absolute; top: 3px; left: 6px; font-size: .6rem; color: #F07A97; line-height: 1; }
.note-card { position: relative; margin-top: 18px; padding: 22px 16px 16px; border-radius: 26px; background: var(--np, #FFE3EA); border: 3px solid #fff; box-shadow: 0 6px 0 rgba(0,0,0,.06), 0 10px 22px var(--sh-d); color: #6A4A55; }
.note-card .tape { position: absolute; top: -11px; width: 64px; height: 22px; background: repeating-linear-gradient(45deg, rgba(255,255,255,.75) 0 6px, rgba(255,255,255,.35) 6px 12px); border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.note-card .tape.t1 { left: 22px; transform: rotate(-6deg); }
.note-card .tape.t2 { right: 22px; transform: rotate(5deg); }
.note-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-head button { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.75); font-size: 1.2rem; line-height: 1; box-shadow: 0 2px 0 rgba(0,0,0,.08); }
.nh-t { text-align: center; line-height: 1.3; }
.nh-t b { display: block; font-size: 1.05rem; }
.nh-t span { font-size: .8rem; opacity: .8; }
.note-mood { display: flex; gap: 8px; justify-content: center; margin: 12px 0 10px; }
.note-mood button { width: 44px; height: 44px; border-radius: 50%; font-size: 1.45rem; background: rgba(255,255,255,.6); box-shadow: 0 3px 0 rgba(0,0,0,.07); transition: transform .12s; }
.note-mood button.on { background: #fff; transform: translateY(-3px) scale(1.12); box-shadow: 0 0 0 3px #F29AB0, 0 4px 8px rgba(0,0,0,.12); }
.note-in { width: 100%; border: 0; outline: 0; resize: none; border-radius: 16px; padding: 10px 14px; font-family: inherit; font-size: 1rem; color: #5A4048; line-height: 28px; min-height: 176px;
  background-color: rgba(255,255,255,.78); background-image: repeating-linear-gradient(transparent 0 27px, rgba(240,122,151,.28) 27px 28px); background-position: 0 9px; background-attachment: local; box-shadow: inset 0 2px 5px rgba(0,0,0,.06); }
.note-in::placeholder { color: #B79AA4; }
.note-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: .78rem; }
.note-cols { display: flex; gap: 8px; }
.note-cols button { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,.18); }
.note-cols button.on { box-shadow: 0 0 0 2.5px #F29AB0, 0 2px 4px rgba(0,0,0,.18); transform: scale(1.12); }
.note-mascot { position: absolute; right: 12px; top: -34px; width: 58px; height: 58px; pointer-events: none; }
.note-mascot .stk-wrap, .note-mascot svg { width: 100%; height: 100%; }


/* ---------- เกม ---------- */
.tickets .tk-n { font-size: 1.5rem; text-align: center; }
.tickets .tk-n b { font-size: 2.2rem; color: var(--primary-dark); }
.tickets .tk-n span { font-size: .95rem; color: var(--muted); }
.game-card { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 22px; padding: 14px; margin-top: 12px; box-shadow: var(--out-s); }
.game-card .gc-ic { font-size: 2.2rem; width: 58px; height: 58px; border-radius: 18px; background: var(--soft); display: grid; place-items: center; flex: none; }
.game-card .gc-t { flex: 1; min-width: 0; }
.game-card .gc-t b { display: block; }
.game-card .gc-t span { font-size: .8rem; color: var(--muted); line-height: 1.35; display: block; }
.game-card.soon { opacity: .6; }
.game-card em { font-style: normal; font-size: .75rem; background: #FFE9A8; color: #6B4A00; padding: 3px 10px; border-radius: 99px; flex: none; }
body.game-open { overflow: hidden; }
.game-ov { position: fixed; inset: 0; z-index: 90; background: #CFEFFF; touch-action: none; }
.game-cv { display: block; touch-action: none; }
.game-x { position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 10px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.85); font-size: 1.1rem; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.game-end { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(40,60,40,.35); }
.game-end[hidden] { display: none; }
.ge-card { background: #FFFDF3; border-radius: 28px; padding: 22px 26px; text-align: center; border: 4px solid #fff; box-shadow: 0 8px 0 rgba(0,0,0,.08); max-width: 86vw; }
.ge-t { font-size: 1.15rem; color: #6A5A3A; }
.ge-s { font-size: 3.4rem; font-weight: 700; color: #3E8E5C; line-height: 1.1; }
.ge-s small { font-size: 1rem; color: #8A8A70; }
.ge-b { color: #D9822B; font-weight: 700; margin: 4px 0 12px; }
.ge-m { color: #8A8A70; margin: 4px 0 12px; font-size: .9rem; }
.ge-btns { display: grid; gap: 8px; }

/* หน้าเข้าสู่ระบบ: โทนสว่าง */
.auth-page{background:radial-gradient(120% 60% at 50% -10%,#CFEFE0 0%,rgba(207,239,224,0) 65%),linear-gradient(175deg,#EAF7F0 0%,#F8F3E1 100%);color:#2E4A42}
.auth-page::before{opacity:.55;background-image:radial-gradient(circle,rgba(242,193,78,.9) 0 1.3px,transparent 1.9px),radial-gradient(circle,rgba(79,170,140,.6) 0 1px,transparent 1.6px)}
.auth-brand h1{color:#1F6B57}.auth-brand p{color:#6E8F84}
.auth-card{box-shadow:0 14px 40px rgba(60,130,105,.22),0 0 0 1px rgba(79,170,140,.18);background:#fff}
.auth-foot{color:#7FA597}
.auth-moon{filter:drop-shadow(0 6px 14px rgba(230,174,50,.35))}

.game-card.locked { opacity: .78; }
.game-card.locked .gc-ic { filter: grayscale(.3); }
.pm-tag { font-size: .66rem; font-weight: 600; background: var(--primary); color: var(--on-primary); padding: 1px 7px; border-radius: 99px; vertical-align: middle; }
