/* ลอยกระทงออนไลน์ — ฉากแม่น้ำยามค่ำคืน */
:root {
    --gold: #ffd27a;
    --gold-2: #f2a93b;
    --ink: #fff7e6;
    --glass: rgba(14, 22, 52, .62);
    --font: "Noto Sans Thai", "Inter", "Noto Sans Myanmar", "Myanmar Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); color: var(--ink); background: #060b22; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
.hp { position: absolute; left: -9999px; }

/* ---------- scene (fixed background) ---------- */
.scene { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
.sky { position: absolute; inset: 0 0 42% 0; background: radial-gradient(ellipse at 70% 18%, #2c2f6e 0%, transparent 55%), linear-gradient(#050a24 0%, #101a4a 55%, #2a2a62 85%, #43356e 100%); }
.stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; opacity: .7; animation: twinkle var(--d, 3s) ease-in-out infinite var(--delay, 0s); }
@keyframes twinkle { 50% { opacity: .15; transform: scale(.6); } }

.moon { position: absolute; right: 2.5%; top: 13%; width: clamp(90px, 11vw, 160px); aspect-ratio: 1; border-radius: 50%;
        background: radial-gradient(circle at 38% 35%, #fffbea 0%, #ffeec2 45%, #f3d98f 75%, #e6c573 100%);
        box-shadow: 0 0 60px 18px rgba(255, 228, 160, .45), 0 0 160px 60px rgba(255, 210, 130, .18); }
.moon::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 62% 60%, rgba(200,170,100,.35) 0 9%, transparent 10%), radial-gradient(circle at 40% 70%, rgba(200,170,100,.25) 0 6%, transparent 7%), radial-gradient(circle at 70% 32%, rgba(200,170,100,.22) 0 5%, transparent 6%); }

.lanterns i { position: absolute; bottom: -40px; width: 14px; height: 18px; border-radius: 40% 40% 30% 30%;
              background: radial-gradient(circle at 50% 70%, #fff3c4, #ffb347 55%, #e26a1c);
              box-shadow: 0 0 14px 4px rgba(255, 170, 70, .55); animation: rise var(--t, 30s) linear infinite var(--delay, 0s); opacity: .9; }
@keyframes rise { 0% { transform: translate(0, 0) scale(var(--s, 1)); opacity: 0; } 8% { opacity: .95; } 50% { transform: translate(var(--sway, 30px), -38vh) scale(calc(var(--s, 1) * .8)); } 100% { transform: translate(calc(var(--sway, 30px) * -.5), -70vh) scale(calc(var(--s, 1) * .45)); opacity: 0; } }

.skyline { position: absolute; left: 0; right: 0; bottom: 42%; width: 100%; height: 90px; }

.river { position: absolute; left: 0; right: 0; bottom: 0; height: 42%; overflow: hidden;
         background: linear-gradient(#141c4a 0%, #0c1438 35%, #070d28 100%); }
.moon-trail { position: absolute; right: calc(2.5% + clamp(45px, 5.5vw, 80px) - 60px); top: 0; width: 120px; height: 100%;
              background: repeating-linear-gradient(transparent 0 10px, rgba(255, 226, 150, .35) 10px 13px);
              filter: blur(3px); mask-image: linear-gradient(#000, transparent 90%); -webkit-mask-image: linear-gradient(#000, transparent 90%);
              animation: shimmer 3s ease-in-out infinite alternate; }
@keyframes shimmer { to { transform: scaleX(1.35); opacity: .7; } }
.waves { position: absolute; left: 0; width: 200%; height: 24px; opacity: .35;
         background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='24'%3E%3Cpath d='M0 12 Q25 2 50 12 T100 12 T150 12 T200 12' fill='none' stroke='%237d93d6' stroke-width='1.6'/%3E%3C/svg%3E") repeat-x;
         animation: drift linear infinite; }
.w1 { top: 12%; animation-duration: 46s; opacity: .25; }
.w2 { top: 45%; animation-duration: 32s; }
.w3 { top: 78%; animation-duration: 22s; opacity: .45; }
@keyframes drift { to { transform: translateX(-50%); } }

/* krathong sprites */
.krathongs { position: absolute; inset: 0; }
.kt { position: absolute; left: 0; top: 0; width: 120px; cursor: pointer; will-change: transform; -webkit-tap-highlight-color: transparent; }
.kt svg { display: block; width: 100%; height: auto; animation: bob 4.5s ease-in-out infinite var(--bob, 0s); transform-origin: 50% 80%; }
.kt::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: -10px; height: 18px; border-radius: 50%;
             background: radial-gradient(ellipse, rgba(255, 190, 90, .45), transparent 70%); filter: blur(2px); }
.kt-name { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: calc(2px / var(--s, 1)); white-space: nowrap;
           font-size: calc(12px / var(--s, 1)); font-weight: 600; line-height: 1.3; color: #fff8e6; padding: 0 calc(8px / var(--s, 1));
           border-radius: 99px; background: rgba(8, 18, 48, .55); text-shadow: 0 1px 3px rgba(0, 0, 0, .7); pointer-events: none; }
.kt[data-lane="0"] .kt-name, .kt[data-lane="1"] .kt-name { display: none; }          /* แถวไกล ๆ ไม่แสดงชื่อ กันรก */
.kt.own .kt-name { display: block; color: #2a1600; font-weight: 700; background: var(--gold); text-shadow: none; box-shadow: 0 0 16px rgba(255, 210, 122, .8); }
.kt.own { filter: drop-shadow(0 0 10px rgba(255, 210, 122, .55)); }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-1.5deg); } }
.flame { transform-origin: 50% 100%; animation: flicker .18s ease-in-out infinite alternate; }
@keyframes flicker { to { transform: scale(.9, 1.12) translateY(-.5px); opacity: .85; } }

/* ---------- foreground UI ---------- */
.lk-top { position: relative; z-index: 3; display: flex; align-items: center; gap: 16px; padding: 14px clamp(16px, 4vw, 40px); }
.lk-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .12em; }
.lk-brand img { background: #fff; border-radius: 8px; padding: 4px 6px; height: 34px; width: auto; }
.lk-back { margin-left: auto; font-size: .9rem; opacity: .85; }
.lk-back:hover { opacity: 1; color: var(--gold); }
.lk-counter { position: absolute; left: 50%; transform: translateX(-50%); background: var(--glass); border: 1px solid rgba(255, 210, 122, .35);
              padding: 6px 18px; border-radius: 99px; backdrop-filter: blur(8px); font-size: .95rem; white-space: nowrap; }
.lk-count { font-weight: 800; color: var(--gold); font-size: 1.15rem; font-variant-numeric: tabular-nums; }

.lk-main { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr 400px; gap: 32px; align-items: start;
           max-width: 1200px; margin: 0 auto; padding: clamp(10px, 4vh, 40px) clamp(16px, 4vw, 40px) 46vh; }
.lk-hero { text-shadow: 0 2px 18px rgba(0, 0, 0, .6); padding-top: 2vh; }
.lk-kicker { color: var(--gold); letter-spacing: .14em; text-transform: uppercase; font-size: .85rem; margin: 0 0 6px; }
.lk-hero h1 { font-family: "Sriracha", var(--font); font-weight: 400; font-size: clamp(2.6rem, 6.5vw, 5rem); line-height: 1.1; margin: 0 0 12px;
              background: linear-gradient(180deg, #fff3cf, #ffd27a 55%, #f2a93b); -webkit-background-clip: text; background-clip: text; color: transparent;
              filter: drop-shadow(0 4px 20px rgba(255, 190, 90, .35)); }
.lk-sub { font-size: clamp(1rem, 1.6vw, 1.15rem); line-height: 1.7; max-width: 560px; opacity: .92; margin: 0; }

.lk-panel { background: var(--glass); border: 1px solid rgba(255, 210, 122, .28); border-radius: 22px; padding: 22px 22px 18px;
            backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.lk-panel h2 { font-size: 1rem; margin: 0 0 10px; color: var(--gold); font-weight: 600; }
.lk-designs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.lk-design { cursor: pointer; text-align: center; }
.lk-design input { position: absolute; opacity: 0; }
.lk-thumb { display: block; aspect-ratio: 1; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 2px solid transparent; padding: 6px; transition: .2s; }
.lk-thumb svg { width: 100%; height: 100%; }
.lk-design input:checked + .lk-thumb { border-color: var(--gold); background: rgba(255, 210, 122, .14); box-shadow: 0 0 18px rgba(255, 210, 122, .35); }
.lk-design input:focus-visible + .lk-thumb { outline: 2px solid #fff; }
.lk-dname { display: block; font-size: .8rem; margin-top: 4px; opacity: .9; }
.lk-input { width: 100%; font: inherit; color: #fff; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18); border-radius: 12px;
            padding: .7em .9em; margin-bottom: 10px; resize: none; }
.lk-input::placeholder { color: rgba(255, 255, 255, .5); }
.lk-input:focus { outline: none; border-color: var(--gold); background: rgba(255, 255, 255, .12); }
.lk-row { display: flex; justify-content: space-between; gap: 10px; margin: -2px 0 12px; }
.lk-note, .lk-len { font-size: .75rem; opacity: .65; }
.lk-btn { display: block; width: 100%; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 1.1rem; text-align: center;
          padding: .8em 1em; border-radius: 99px; color: #2a1600; background: linear-gradient(180deg, #ffe39b, #f2a93b);
          box-shadow: 0 6px 24px rgba(242, 169, 59, .45); transition: transform .15s, box-shadow .15s; }
.lk-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(242, 169, 59, .6); }
.lk-btn[disabled] { opacity: .6; pointer-events: none; }
.lk-msg { min-height: 1.4em; margin: 10px 0 0; text-align: center; font-size: .95rem; }
.lk-msg.ok { color: var(--gold); }
.lk-msg.err { color: #ff9b9b; }
.lk-closed { text-align: center; }
.lk-closed p { font-size: 1.3rem; color: var(--gold); margin: 6px 0 18px; }
.lk-panel.sent { animation: glowpulse 1.4s ease-out; }
@keyframes glowpulse { 30% { box-shadow: 0 0 0 6px rgba(255, 210, 122, .35), 0 20px 60px rgba(0, 0, 0, .45); } }

.lk-bubble { position: fixed; z-index: 5; max-width: 260px; background: rgba(255, 249, 235, .97); color: #2a1a05; border-radius: 14px; padding: 10px 14px;
             box-shadow: 0 10px 30px rgba(0, 0, 0, .45); font-size: .92rem; line-height: 1.5; transform: translate(-50%, -100%); pointer-events: none; }
.lk-bubble b { display: block; color: #b26b00; }
.lk-bubble::after { content: ""; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); border: 8px solid transparent; border-bottom: 0; border-top-color: rgba(255, 249, 235, .97); }
.lk-hint { position: fixed; z-index: 2; left: 50%; bottom: 10px; transform: translateX(-50%); margin: 0; font-size: .8rem; opacity: .6; pointer-events: none; white-space: nowrap; }

@media (max-width: 900px) {
    .lk-main { grid-template-columns: 1fr; padding-bottom: 46vh; }
    .lk-hero { text-align: center; }
    .lk-sub { margin: 0 auto; }
    .lk-panel { max-width: 480px; width: 100%; margin: 0 auto; }
    .lk-counter { position: static; transform: none; order: 3; margin-left: auto; font-size: .85rem; padding: 5px 12px; }
    .lk-back { display: none; }
    .kt { width: 90px; }
}
@media (prefers-reduced-motion: reduce) {
    .stars i, .lanterns i, .waves, .moon-trail, .kt svg, .flame { animation: none !important; }
}
@media (max-width: 900px) { .moon { right: 6%; top: 7%; width: 84px; } .moon-trail { right: calc(6% - 18px); } }
/* small screens: let grid children shrink, scale the title to the width */
.lk-main > * { min-width: 0; }
@media (max-width: 600px) {
    .lk-hero h1 { font-size: 10.5vw; }
    .lk-sub br { display: none; }
    .lk-panel { padding: 18px 16px 14px; }
    .lk-designs { gap: 6px; }
    .lk-brand span { display: none; }
}

/* ให้แตะทะลุพื้นที่ว่างไปถึงกระทงบนแม่น้ำได้ — เฉพาะฟอร์มและลิงก์ที่รับการแตะ */
.lk-main { pointer-events: none; }
.lk-main .lk-panel, .lk-main a, .lk-main button, .lk-main input, .lk-main textarea, .lk-main label { pointer-events: auto; }

/* พลุ — วาดบน canvas ด้านหลังพระจันทร์/เส้นขอบฟ้า */
.fireworks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fw-reflect { position: absolute; inset: 0; pointer-events: none; opacity: 0; mix-blend-mode: screen;
              background: radial-gradient(ellipse 22% 60% at var(--fx, 50%) 0%, var(--fc, #ffd27a), transparent 70%); transition: opacity 1.4s ease-out; }
.fw-reflect.on { opacity: .28; transition: opacity .12s; }
@media (prefers-reduced-motion: reduce) { .fireworks, .fw-reflect { display: none; } }

/* ตัวเลือกภาษา (ไทย / 中文 / မြန်မာ / EN) */
.lk-langs { display: flex; gap: 2px; margin-left: auto; background: var(--glass); border: 1px solid rgba(255, 255, 255, .15); border-radius: 99px; padding: 3px; }
.lk-langs a { padding: 4px 11px; border-radius: 99px; font-size: .85rem; opacity: .8; white-space: nowrap; }
.lk-langs a:hover { opacity: 1; }
.lk-langs a.on { background: var(--gold); color: #2a1600; font-weight: 700; opacity: 1; }
.lk-langs + .lk-back { margin-left: 4px; }
.lk-langs a[lang="my"], :lang(my) body { font-family: "Noto Sans Myanmar", "Myanmar Text", "Padauk", var(--font); }
:lang(my) .lk-hero h1 { font-family: "Noto Sans Myanmar", "Myanmar Text", var(--font); font-weight: 700; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.5; }
:lang(my) .lk-sub, :lang(my) .lk-note, :lang(my) .lk-msg { line-height: 1.9; }
:lang(zh) .lk-hero h1 { font-family: var(--font); font-weight: 700; letter-spacing: .06em; }
@media (max-width: 900px) {
    .lk-top { flex-wrap: wrap; row-gap: 10px; }
    .lk-langs { margin-left: auto; }
    .lk-counter { order: 4; margin: 0 auto; }
}
@media (max-width: 420px) { .lk-langs a { padding: 4px 8px; font-size: .8rem; } }
.lk-langs a { display: inline-flex; align-items: center; height: 28px; line-height: 1; }
.lk-langs a[lang="my"] { font-size: .8rem; padding-top: 2px; }

/* รูปดอกบัวแทนอีโมจิ 🪷 */
.ico-lotus { display: inline-block; width: 1.35em; height: auto; vertical-align: -.25em; margin-left: .15em; }
