:root {
  --sky: #76a1ff;
  --blue: #1747b5;
  --ink: #111;
  --muted: #bfc3cb;
  --yellow: #f4c92b;
  --err: #c62828;
  --chip: #dedede;
  --pad: clamp(16px, 5vw, 24px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Bai Jamjuree", system-ui, sans-serif; color: var(--ink); background: #fff; line-height: 1.5; padding-bottom: env(safe-area-inset-bottom); }
img { max-width: 100%; height: auto; }

/* Header */
.top { background: var(--sky); color: #fff; padding-top: env(safe-area-inset-top); }
.top-in { max-width: 960px; margin: 0 auto; padding: 12px var(--pad); padding-left: max(var(--pad), env(safe-area-inset-left)); padding-right: max(var(--pad), env(safe-area-inset-right)); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.brand { display: inline-flex; align-items: center; color: #fff; text-decoration: none; }
.brand-text { font-weight: 700; font-style: italic; font-size: clamp(1.25rem, 5vw, 1.6rem); }
.brand-text sup { font-size: .55em; }
.brand img { height: clamp(28px, 8vw, 38px); width: auto; display: block; }
nav { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: clamp(.72rem, 2.8vw, .85rem); font-weight: 600; }
nav a { color: #fff; text-decoration: none; }
nav a:hover { text-decoration: underline; }
a:focus-visible, .btn:focus-visible, .field:focus-visible, .select:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.top a:focus-visible { outline-color: #fff; }

/* Layout */
main { max-width: 720px; margin: 0 auto; padding: 24px var(--pad) 40px; padding-left: max(var(--pad), env(safe-area-inset-left)); padding-right: max(var(--pad), env(safe-area-inset-right)); }
.banner { background: var(--blue); color: #fff; border-radius: clamp(20px, 6vw, 28px); padding: clamp(16px, 4.5vw, 20px) clamp(18px, 5vw, 24px); margin-bottom: 20px; }
.banner h1 { margin: 0 0 2px; font-size: clamp(1.05rem, 4.6vw, 1.3rem); }
.banner p { margin: 0; font-size: clamp(.88rem, 3.6vw, .95rem); }

form { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(14px, 3.5vw, 18px); }
.card { min-width: 0; border: 1px solid var(--ink); border-radius: 14px; padding: clamp(16px, 4.5vw, 18px) clamp(18px, 5vw, 24px) clamp(18px, 4.5vw, 20px); background: #fff; }
.card.err { border-color: var(--err); }
.label { display: block; font-size: clamp(1.1rem, 4.6vw, 1.25rem); font-weight: 500; margin-bottom: 4px; }

.field { width: 100%; border: 0; border-bottom: 1px solid var(--ink); border-radius: 0; background: transparent; font: inherit; padding: 8px 0; resize: vertical; }
.field::placeholder { color: var(--muted); }
.select { width: min(100%, 22rem); font: inherit; background: var(--chip); border: 0; border-radius: 6px; padding: 10px; }

.upload { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 6px; }
.preview { max-width: 100%; max-height: 200px; object-fit: contain; border-radius: 8px; }
.fname { margin: 0; max-width: 100%; font-size: .85rem; color: #555; word-break: break-all; text-align: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; background: var(--yellow); color: var(--ink); border: 0; border-radius: 999px; padding: 8px 30px; font: inherit; font-weight: 500; cursor: pointer; text-align: center; }
.btn:hover { filter: brightness(.96); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sr-only:focus-visible + .btn { outline: 2px solid var(--blue); outline-offset: 3px; }
.submit { background: var(--blue); color: #fff; width: 100%; font-size: 1.05rem; }
.submit:disabled { opacity: .6; cursor: wait; }

.msg { color: var(--err); font-size: .85rem; margin: 6px 0 0; }
.banner-err { margin: 0; font-size: .95rem; }

.done { text-align: center; padding: 32px var(--pad); }
.done h2 { margin: 12px 0 4px; font-size: clamp(1.2rem, 5vw, 1.5rem); }
.done p { margin: 0 0 4px; }
.done .btn { margin-top: 16px; }
.tick { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; background: #1b7f4b; color: #fff; font-size: 1.8rem; line-height: 56px; }

/* Footer */
.logos { display: flex; justify-content: center; align-items: center; margin: clamp(28px, 8vw, 40px) auto 0; text-align: center; }
.logos img { height: clamp(40px, 12vw, 56px); width: auto; max-width: 70%; }
.logo-text { font-weight: 600; font-size: .9rem; color: #444; max-width: 240px; }
.copy { margin: 20px 0 0; text-align: center; font-size: .8rem; color: #666; }

/* Tablet and up: two columns */
@media (min-width: 720px) {
  main { padding-top: 32px; }
  form { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .full { grid-column: 1 / -1; }
}
@media (min-width: 1024px) {
  main { max-width: 780px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* ---- Home ---- */
body.home { background: #d9e5ff; }
.home-ddf { margin-bottom: 8px; }
.home-ddf img { height: clamp(44px, 12vw, 60px); width: auto; display: block; }
.balance { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0 28px; }
.circle { width: clamp(210px, 64vw, 280px); aspect-ratio: 1; border-radius: 50%; background: #82a2e3; border: 3px solid #a9bfee; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; text-align: center; padding: 12px; }
.circle p { margin: 0; }
.c-label { font-size: clamp(.85rem, 3.6vw, 1rem); }
.c-amount { font-size: clamp(1.9rem, 9vw, 2.6rem); font-weight: 700; line-height: 1.2; margin: 6px 0 !important; overflow-wrap: anywhere; }
.c-unit { font-size: clamp(.85rem, 3.4vw, 1rem); }
.refresh { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; background: none; border: 0; color: #5b6b94; font: inherit; font-size: .85rem; cursor: pointer; }
.refresh:focus-visible, .tiles a:focus-visible, .slides:focus-visible, .dot:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.loading .spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sec { font-size: 1.05rem; font-weight: 600; margin: 0 0 14px; }
.tiles { list-style: none; margin: 0 0 32px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 8px; }
.tiles a { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; text-decoration: none; color: var(--blue); font-size: clamp(.72rem, 3vw, .88rem); line-height: 1.3; }
.ico { width: clamp(56px, 16vw, 72px); aspect-ratio: 1; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 0 0 1px #cfd8ee; transition: transform .15s; }
.tiles a:hover .ico { transform: translateY(-2px); }
.ico img { width: 55%; height: 55%; object-fit: contain; }
.carousel { position: relative; background: #e4e4e4; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 7; }
.slides { position: absolute; inset: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; display: grid; place-items: center; height: 100%; color: #333; text-align: center; text-decoration: none; padding: 0; }
.slide img { width: 100%; height: 100%; object-fit: cover; display: block; max-width: none; }
.no-event { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 16px; text-align: center; color: #444; }
.dots { display: flex; justify-content: center; gap: 12px; margin-top: 14px; min-height: 12px; }
.dot { position: relative; width: 12px; height: 12px; padding: 0; border: 0; border-radius: 50%; background: #fff; cursor: pointer; }
.dot::after { content: ""; position: absolute; inset: -10px; }
.dot[aria-current="true"] { background: #0b5cff; }

/* ---- Inner (empty) pages ---- */
body.inner { background: #fff; }
.card.soon { text-align: center; padding: 40px var(--pad); color: #666; }
.back { margin: 20px 0 0; }
.back a { color: var(--blue); text-decoration: none; }
@media (prefers-reduced-motion: reduce) { .loading .spin { animation: none; } .ico { transition: none; } }
