/* Contemporary editorial look: white paper, light blue + orange, thin light lines, flat print colours. */
:root {
  --ink: #2E3550;
  --muted: #6B7391;
  --orange: #F5A15C;
  --orange-deep: #E07C2E;
  --orange-pale: #FDEBDB;
  --blue: #A9D3F5;
  --blue-line: #CFE5F8;
  --blue-pale: #EAF4FD;
  --blue-ink: #7FB6E6;
  --moon: #F9D86B;
  --moon-line: #E3B33C;
  --pink: #F6B8D0;
  --white: #FFFFFF;
  --display: "Mali", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  font-family: "Noto Sans Thai", "Leelawadee UI", "Sarabun", Tahoma, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--white); color: var(--ink); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 28px; border: none; border-radius: 999px;
  background: var(--orange); color: var(--ink); font-weight: 700; font-size: 16px; text-decoration: none;
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover { filter: brightness(1.03); }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn.soft { background: var(--blue-pale); }
.btn.white { background: var(--white); box-shadow: 0 2px 10px rgba(127, 182, 230, .25); }
.btn.link { background: none; padding: 12px 6px; text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 6px; text-decoration-thickness: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- krathong artwork (from the design) ---------- */
svg.kr { display: block; width: 100%; height: auto; overflow: visible; }
.kbob { animation: kbob 3.2s ease-in-out infinite alternate; transform-origin: 50% 92%; }
@keyframes kbob { from { transform: rotate(-1.8deg) translateY(1px); } to { transform: rotate(1.8deg) translateY(-3px); } }
.kpop { animation: kpop .5s cubic-bezier(.2, .9, .3, 1.25); }
@keyframes kpop { from { transform: scale(.88) translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
.kr .kflame { transform-box: fill-box; transform-origin: 50% 100%; animation: kfl .8s ease-in-out infinite alternate; }
@keyframes kfl { 0% { transform: scale(1, 1) rotate(-3deg); } 50% { transform: scale(1.08, 1.15) rotate(2deg); } 100% { transform: scale(.94, 1.04) rotate(-1deg); } }
.kr .khalo { transform-box: fill-box; transform-origin: center; animation: khalo 2.4s ease-in-out infinite alternate; }
@keyframes khalo { from { opacity: .6; transform: scale(.92); } to { opacity: 1; transform: scale(1.08); } }
.kr .ksmoke path { opacity: 0; animation: ksm 3.6s ease-out infinite; }
@keyframes ksm { 0% { opacity: 0; transform: translateY(5px); } 30% { opacity: .7; } 100% { opacity: 0; transform: translateY(-14px); } }
.kr .kcoin-on .kc { animation: kdrop .9s cubic-bezier(.45, 0, .6, 1.5) both; }
@keyframes kdrop { 0% { transform: translateY(-110px); opacity: 0; } 55% { transform: translateY(0); opacity: 1; } 72% { transform: translateY(-10px); } 100% { transform: translateY(0); } }
.kr .ktw { transform-box: fill-box; transform-origin: center; animation: ktw 1.8s ease-in-out infinite; }
@keyframes ktw { 0%, 100% { opacity: .25; transform: scale(.5); } 50% { opacity: 1; transform: scale(1.15); } }
.kr .kshine { animation: kshine 1.6s linear infinite; }
@keyframes kshine { to { stroke-dashoffset: -14; } }
.kr .kd-on { animation: kpop .45s cubic-bezier(.2, .9, .3, 1.25); }
.kr .kwing { transform-box: fill-box; transform-origin: 100% 60%; animation: kwing .35s ease-in-out infinite alternate; }
.kr .kwing2 { transform-origin: 0% 60%; }
@keyframes kwing { from { transform: scaleX(1); } to { transform: scaleX(.35); } }
.kr .kbfly { animation: kbfly 4s ease-in-out infinite alternate; }
@keyframes kbfly { 0% { transform: translate(0, 0); } 50% { transform: translate(-8px, -10px); } 100% { transform: translate(4px, -4px); } }
.kr .kfly { animation: kfly 3.4s ease-in-out infinite alternate; }
@keyframes kfly { 0% { transform: translate(0, 0); opacity: .2; } 40% { opacity: 1; } 100% { transform: translate(6px, -12px); opacity: .5; } }
.kstill, .kstill * { animation: none !important; }

/* ---------- full-page scene (float + share): moon over a pale water band, krathong on the water ---------- */
.lscene {
  position: fixed; inset: 0; z-index: 40; overflow: auto; background: var(--white); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}
.lscene .ls-eyebrow { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); animation: lsfade .9s ease .2s both; }
.lscene .ls-art { position: relative; width: min(640px, 100%, calc((100dvh - 250px) * 1.1)); min-width: 260px; margin-top: 6px; }
.lscene .ls-art > svg { display: block; width: 100%; height: auto; }
/* other people's krathongs drifting on the water behind the main one */
.lscene .ls-fleet { position: absolute; inset: 0; pointer-events: none; }
.lscene .ls-o { position: absolute; left: 0; opacity: 0; animation: lsfleet 60s linear infinite; }
@keyframes lsfleet { 0% { transform: translateX(var(--x0)); opacity: 0; } 8%, 92% { opacity: .85; } 100% { transform: translateX(var(--x1)); opacity: 0; } }
.lscene .ls-o svg { display: block; width: 100%; height: auto; }
/* two krathongs floating side by side (design.d2) */
.kpair { display: flex; align-items: flex-end; width: 100%; }
.kpair > .kr { flex: 1 1 0; min-width: 0; width: 50%; height: auto; }
.kpair > .kr + .kr { margin-left: -2%; margin-bottom: -3%; }
.lscene .ls-k.pair { width: 62%; }
.lscene .ls-k { position: absolute; left: 50%; top: 80%; width: 38%; transform: translate(-50%, -100%); }
.lscene .ls-drop { animation: lsdrop 1.1s cubic-bezier(.3, .8, .3, 1.15) both; }
@keyframes lsdrop { 0% { transform: translateY(-70%) scale(1.08); opacity: 0; } 55% { transform: translateY(4%) scale(1, .96); opacity: 1; } 75% { transform: translateY(-2%); } 100% { transform: none; opacity: 1; } }
.lscene .ls-rip { position: absolute; left: 50%; top: 80%; width: 46%; aspect-ratio: 4 / 1; border: 1.4px solid var(--blue-ink); border-radius: 50%; transform: translate(-50%, -50%) scale(.3); opacity: 0; animation: lsrip 2.6s ease-out 1 both; pointer-events: none; }
.lscene .ls-rip:nth-of-type(2) { border-color: var(--orange); }
@keyframes lsrip { 0% { transform: translate(-50%, -50%) scale(.3); opacity: .9; } 100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } }
.lscene .ls-wish { margin: 10px 0 0; max-width: 22em; text-align: center; font-family: var(--display); font-size: clamp(20px, 5vw, 28px); font-weight: 600; line-height: 1.3; word-break: break-word; animation: lsfade .9s ease .9s both; }
.lscene .ls-note { margin: 10px 0 0; padding: 6px 16px; border-radius: 999px; background: var(--orange-pale); font-size: 13px; font-weight: 700; animation: lsfade .9s ease 1.1s both; }
.lscene .ls-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 14px; margin-top: 18px; animation: lsfade .9s ease 1.3s both; }
@keyframes lsfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.lscene .tw { transform-box: fill-box; transform-origin: center; animation: lstw 2.4s ease-in-out infinite; }
@keyframes lstw { 0%, 100% { opacity: .35; transform: scale(.75); } 50% { opacity: 1; transform: scale(1.1); } }
.lscene .moonc { transform-box: fill-box; transform-origin: center; animation: lsmoon 3s ease-in-out infinite alternate; }
@keyframes lsmoon { from { transform: scale(1); } to { transform: scale(1.04); } }
.lscene .wave { animation: lsdrift 5s ease-in-out infinite alternate; }
@keyframes lsdrift { from { transform: translateX(-8px); } to { transform: translateX(10px); } }
.lscene .fishR { animation: lsfishR 9s linear infinite; }
.lscene .fishL { animation: lsfishL 12s linear 2s infinite; }
@keyframes lsfishR { 0% { transform: translateX(0); opacity: 0; } 10%, 90% { opacity: 1; } 100% { transform: translateX(300px); opacity: 0; } }
@keyframes lsfishL { 0% { transform: translateX(0); opacity: 0; } 10%, 90% { opacity: 1; } 100% { transform: translateX(-280px); opacity: 0; } }
.lscene .shoot { animation: lsshoot 3.4s ease-in 1.5s infinite; }
@keyframes lsshoot { 0% { transform: translate(0, 0); opacity: 0; } 10%, 60% { opacity: 1; } 100% { transform: translate(-140px, 70px); opacity: 0; } }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: 90px; z-index: 99; transform: translateX(-50%); max-width: 90vw; padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--white); font-size: 14px; font-weight: 700; text-align: center; transition: opacity .3s; }

/* ---------- share-image customiser ---------- */
.sheetwrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(46, 53, 80, .4); animation: fadeIn .25s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheetbox { width: min(400px, 100%); max-height: 94vh; overflow: auto; padding: 24px 22px; border-radius: 24px; background: var(--white); animation: sheetUp .35s cubic-bezier(.2, .9, .3, 1.1) both; }
.sheetbox.wide { width: min(760px, 100%); display: flex; flex-wrap: wrap; gap: 22px; justify-content: center; padding: 22px; }
@keyframes sheetUp { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }
.sc-prev { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.sc-prev canvas { display: block; border-radius: 18px; box-shadow: 0 6px 24px rgba(46, 53, 80, .12); }
.sc-ctl { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.sc-ctl h3 { margin: 0; font-family: var(--display); font-size: 22px; }
.sc-lab { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 44px; padding: 8px 16px; border: 1px solid var(--blue-line); border-radius: 999px; background: var(--white); font-size: 14px; font-weight: 700; transition: transform .12s ease; }
.pill[aria-pressed="true"] { background: var(--orange); border-color: var(--orange); }
.pill:active { transform: scale(.96); }
.dots { display: flex; flex-wrap: wrap; gap: 12px; }
.dotsw { width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid #E3EFFB; transition: transform .15s ease; }
.dotsw:hover { transform: scale(1.12); }
.dotsw[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--orange); }
.field { width: 100%; padding: 12px 14px; border: 1px solid var(--blue-line); border-radius: 14px; background: var(--white); color: var(--ink); font: inherit; font-size: 16px; outline: none; }
.field:focus { border-color: var(--blue-ink); }

@media (prefers-reduced-motion: reduce) {
  .kbob, .kpop, .kr *, .lscene *, .sheetwrap, .sheetbox { animation: none !important; }
  .lscene .ls-rip, .lscene .ls-fleet { display: none; }
}
