:root {
  --ink: #16306b;
  --ink-soft: #4f5d80;
  --paper: #fffdf8;
  --pink: #e0246f;
  --pink-deep: #b8155a;
  --pink-light: #ffc9dd;
  --yellow: #ffe45c;
  --yellow-soft: #fff4b8;
  --sky: #c4e8fb;
  --mint: #c6ecd2;
  --lilac: #dccdf7;
  --coral: #f2706a;
  --line: #06c755;
  --line-dark: #05843a;
  --danger: #b3261e;
  --border: #e9e1d3;
  --radius: 22px;
  --display: "Mali", "Sarabun", system-ui, sans-serif;
  --body: "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  color: var(--ink);
  font: 400 1.0625rem/1.7 var(--body);
  background:
    radial-gradient(38rem 26rem at 8% 2%, rgba(255, 201, 221, .55), transparent 70%),
    radial-gradient(34rem 26rem at 96% 8%, rgba(196, 232, 251, .7), transparent 70%),
    radial-gradient(40rem 30rem at 85% 42%, rgba(255, 228, 92, .22), transparent 70%),
    radial-gradient(40rem 30rem at 5% 62%, rgba(220, 205, 247, .4), transparent 70%),
    radial-gradient(40rem 30rem at 90% 88%, rgba(198, 236, 210, .45), transparent 70%),
    var(--paper);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--pink-deep); }
h1, h2, h3 { font-family: var(--display); line-height: 1.25; margin: 0; font-weight: 700; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
code { background: #f3eee4; padding: .1em .4em; border-radius: 6px; word-break: break-all; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .55rem 1.2rem; border: 2px solid transparent; border-radius: 999px;
  font: 600 1rem/1.3 var(--body); text-decoration: none; cursor: pointer; background: none; color: var(--ink);
  transition: transform .12s ease, background-color .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-lg { padding: .75rem 1.7rem; font-size: 1.1rem; }
.btn-sm { padding: .25rem .8rem; font-size: .9rem; }
.btn-pink { background: var(--pink); color: #fff; box-shadow: 0 3px 0 var(--pink-deep); }
.btn-yellow { background: var(--yellow); color: var(--ink); box-shadow: 0 3px 0 #d4b520; }
.btn-line { background: var(--line-dark); color: #fff; box-shadow: 0 3px 0 #046a2e; }
.btn-ghost { border-color: var(--ink); background: #fff; }
.btn-link { color: var(--ink); padding-inline: .5rem; }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }

/* Header */
.announce { background: var(--ink); color: #fff; text-align: center; padding: .35rem 1rem; font-size: .95rem; }
.nav {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1.5rem;
  padding: .6rem clamp(1rem, 4vw, 3rem); background: rgba(255, 253, 248, .94);
  border-bottom: 2px dashed var(--pink-light);
}
.brand { display: flex; flex-direction: column; line-height: 1.15; text-decoration: none; color: var(--ink); }
.brand-en { font: 700 1.35rem var(--display); color: var(--pink); }
.brand-th { font-size: .82rem; color: var(--ink-soft); }
.nav-links { display: flex; gap: 1.1rem; margin-left: auto; }
.nav-links a { color: var(--ink); text-decoration: none; font-weight: 500; }
.nav-links a:hover { color: var(--pink-deep); text-decoration: underline wavy var(--pink-light); }
.nav-actions { display: flex; align-items: center; gap: .4rem; }
@media (max-width: 900px) { .nav-links { display: none; } .nav-actions { margin-left: auto; } }
.nav .btn, .brand-en { white-space: nowrap; }
@media (max-width: 460px) {
  .brand-th { display: none; }
  .brand-en { font-size: 1.1rem; }
  .nav { gap: .4rem; padding-inline: .7rem; }
  .nav-actions { gap: .1rem; }
  .nav-actions .btn { padding-inline: .55rem; font-size: .88rem; }
}

/* Flash messages */
.flashes { max-width: 760px; margin: 1rem auto 0; padding: 0 1rem; }
.flash { margin: 0 0 .5rem; padding: .7rem 1rem; border-radius: 14px; overflow-wrap: anywhere; }
.flash-success { background: var(--mint); }
.flash-error { background: #ffdcd8; color: #7c1710; }
.flash-info { background: var(--sky); }

/* Hero */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 2rem; align-items: center;
  max-width: 1160px; margin: 0 auto; padding: clamp(2rem, 6vw, 4.5rem) clamp(1.2rem, 4vw, 2rem);
}
.eyebrow { margin: 0 0 .5rem; color: var(--ink-soft); font-weight: 500; }
.hero h1 { font-size: clamp(2.9rem, 8vw, 5.2rem); color: var(--pink); line-height: 1.02; }
.hero-th { font: 700 clamp(1.5rem, 4vw, 2.3rem) var(--display); color: #fff; margin: .9rem 0 1.1rem; }
.hero-lead { font-size: 1.2rem; max-width: 34rem; margin: 0 0 1.5rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; }
.hero-facts { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; padding: 0; margin: 1.5rem 0 0; color: var(--ink-soft); }
.hero-facts b { color: var(--ink); }
.hero-art { position: relative; min-height: 460px; }
.art { position: absolute; border-radius: 14px; border: 8px solid #fff; box-shadow: 0 10px 28px rgba(22, 48, 107, .2); }
.art-a { width: 54%; left: 2%; top: 0; transform: rotate(-4deg); }
.art-b { width: 58%; right: 0; bottom: 0; transform: rotate(5deg); }
@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { min-height: 360px; max-width: 420px; }
}

/* Brush-stroke highlights, echoing the painted labels on the posters */
.brush {
  display: inline-block; padding: .12em .75em; border-radius: 40% 60% 55% 45% / 70% 55% 65% 50%;
  transform: rotate(-1.2deg);
}
.brush-pink { background: linear-gradient(95deg, var(--pink), #f04f96 70%, var(--pink)); }
.brush-yellow { background: var(--yellow); }
.brush-sky { background: var(--sky); }
.brush-pink-light { background: var(--pink-light); }
.brush-lilac { background: var(--lilac); }

/* Sections */
.band { max-width: 1160px; margin: 0 auto; padding: clamp(2.2rem, 5vw, 3.6rem) clamp(1.2rem, 4vw, 2rem); }
.band > h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-bottom: 1.8rem; }

.activities { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; }
.activity { background: #fff; border-radius: var(--radius); padding: .6rem .6rem 1rem; box-shadow: 0 6px 18px rgba(22, 48, 107, .08); }
.activity:nth-child(odd) { transform: rotate(-1deg); }
.activity:nth-child(even) { transform: rotate(1deg) translateY(10px); }
.activity img { border-radius: 16px; aspect-ratio: 5 / 6; object-fit: cover; object-position: center 60%; width: 100%; }
.activity h3 { font-size: 1.08rem; margin: .7rem .3rem .2rem; }
.activity p { margin: 0 .3rem; font-size: .95rem; color: var(--ink-soft); line-height: 1.5; }
@media (max-width: 960px) { .activities { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 620px) { .activities { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.teacher {
  display: flex; align-items: center; gap: 1.5rem; max-width: 900px; margin: 1.5rem auto;
  padding: 1rem 2rem 1rem 1rem; background: var(--mint); border-radius: 110px 40px 40px 110px;
}
.teacher img { width: 130px; height: 130px; object-fit: cover; object-position: top; border-radius: 50%; border: 5px solid #fff; flex: none; }
.teacher h2 { font-size: 1.45rem; margin-bottom: .2rem; }
.teacher p { margin: 0; }
@media (max-width: 620px) {
  .teacher { flex-direction: column; text-align: center; border-radius: var(--radius); margin-inline: 1.2rem; padding: 1.2rem; }
}

.schedule-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 1.2rem; }
.card { border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.card h3 { font-size: 1.15rem; margin-bottom: .9rem; }
.card-sky { background: var(--sky); }
.card-yellow { background: var(--yellow-soft); }
.card-mint { background: var(--mint); }
.dates { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.dates li { background: #fff; border-radius: 12px; padding: .25rem .8rem; font-weight: 600; }
.rounds { margin: 0; display: grid; gap: .6rem; }
.rounds div { display: flex; justify-content: space-between; gap: 1rem; background: #fff; border-radius: 12px; padding: .4rem .9rem; }
.rounds dt { font-weight: 600; }
.rounds dd { margin: 0; white-space: nowrap; }
.place { font: 600 1.3rem var(--display); margin: 0 0 .8rem; }
@media (max-width: 860px) { .schedule-grid { grid-template-columns: 1fr; } }

.prices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; align-items: stretch; }
.price { position: relative; background: #fff; border: 2px dashed var(--pink-light); border-radius: var(--radius); padding: 1.5rem; }
.price h3 { font-size: 1.2rem; }
.price p { margin: 0; }
.amount { font: 700 3rem/1.2 var(--display); color: var(--pink); margin: .4rem 0 !important; }
.amount small { font-size: 1.05rem; color: var(--ink); margin-left: .4rem; }
.price-hot { background: var(--yellow-soft); border: 3px solid var(--pink); transform: rotate(-1deg); }
.tag { position: absolute; top: -.9rem; right: 1rem; background: var(--pink); color: #fff; border-radius: 999px; padding: .1rem .9rem; font-size: .9rem; font-weight: 600; }
@media (max-width: 860px) { .prices { grid-template-columns: 1fr; } }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; }
.gallery figure { margin: 0; background: #fff; padding: .55rem .55rem .7rem; border-radius: 12px; box-shadow: 0 6px 18px rgba(22, 48, 107, .1); }
.gallery figure:nth-child(3n+1) { transform: rotate(-1deg); }
.gallery figure:nth-child(3n+2) { transform: rotate(1deg); }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.gallery figcaption { text-align: center; font-size: .92rem; color: var(--ink-soft); margin-top: .4rem; }

.faq-list { max-width: 800px; display: grid; gap: .6rem; }
.faq-list details { background: #fff; border-radius: 16px; padding: .7rem 1.2rem; }
.faq-list summary { cursor: pointer; font-weight: 600; }
.faq-list p { margin: .5rem 0 .2rem; }

.join { text-align: center; padding: clamp(2.5rem, 6vw, 4rem) 1.5rem; background: var(--pink); color: #fff; margin-top: 2rem; }
.join h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
.join p { margin: .4rem 0 1.4rem; }
.join .hero-cta { justify-content: center; }

.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; padding: 2rem clamp(1.2rem, 4vw, 3rem) 5.5rem; background: var(--ink); color: #dfe6f7; }
.footer-brand { font: 700 1.2rem var(--display); color: #fff; }
.footer p { margin: .2rem 0 0; }
.footer-links { display: flex; flex-direction: column; gap: .2rem; }
.footer a { color: #fff; }

/* Forms and inner pages */
.page { max-width: 1000px; margin: 0 auto; padding: 2.5rem 1.2rem 4rem; }
.center { text-align: center; }
.center h1 { margin-bottom: 1.5rem; }
.form-page { max-width: 680px; }
.form-page.narrow { max-width: 440px; }
.form-page h1 { font-size: 2rem; margin-bottom: .5rem; }
.muted { color: var(--ink-soft); }
.prose h1 { font-size: 2rem; }
.prose h2 { font-size: 1.25rem; margin-top: 1.6rem; }
.form { display: grid; gap: .9rem; margin-top: 1rem; }
.form label { display: block; font-weight: 500; }
.form label > input:not([type=checkbox]):not([type=radio]), .form label > select, .form label > textarea { margin-top: .25rem; }
.form small { font-weight: 400; color: var(--ink-soft); }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea {
  width: 100%; padding: .6rem .8rem; border: 2px solid var(--border); border-radius: 12px;
  font: inherit; color: inherit; background: #fff;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--pink); }
.form input:disabled { background: #f5f1e9; color: var(--ink-soft); }
.form .btn { justify-self: start; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }
.form .check { display: flex; align-items: flex-start; gap: .55rem; font-weight: 400; }
.check input { margin-top: .4rem; }
.more summary { cursor: pointer; color: var(--pink-deep); font-weight: 600; margin-bottom: .5rem; }
.panel { background: #fff; border-radius: var(--radius); padding: 1.3rem 1.5rem; margin-top: 1.2rem; box-shadow: 0 4px 14px rgba(22, 48, 107, .06); }
.panel h2 { font-size: 1.25rem; }
.panel-danger { border: 2px solid #f4c7c3; }
.inline-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.qr { background: #fff; padding: .5rem; border-radius: 12px; margin: 1rem 0; width: 200px; height: 200px; }

/* Chat widget */
.chat { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: .6rem; }
.chat-toggle {
  order: 2; position: relative; padding: .8rem 1.4rem; border: 0; border-radius: 999px; background: var(--ink); color: #fff;
  font: 700 1.05rem var(--display); cursor: pointer; box-shadow: 0 8px 22px rgba(22, 48, 107, .35);
}
.chat-dot { position: absolute; top: 0; right: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--coral); border: 2px solid #fff; }
.chat-panel {
  order: 1; width: min(370px, calc(100vw - 2rem)); height: min(540px, calc(100dvh - 7rem));
  display: flex; flex-direction: column; background: #fff; border-radius: 20px; overflow: hidden;
  box-shadow: 0 14px 40px rgba(22, 48, 107, .3);
}
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; background: var(--pink); color: #fff; }
.chat-head strong { display: block; font-family: var(--display); }
.chat-head small { font-size: .82rem; }
.chat-close { background: none; border: 0; color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; padding: .2rem .4rem; }
.chat-log { flex: 1; overflow-y: auto; padding: .9rem; display: flex; flex-direction: column; gap: .5rem; background: var(--paper); }
.bubble { margin: 0; padding: .45rem .8rem; border-radius: 14px; max-width: 86%; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; font-size: .98rem; }
.bubble-customer { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.bubble-bot { align-self: flex-start; background: var(--yellow-soft); border-bottom-left-radius: 4px; }
.bubble-admin { align-self: flex-start; background: var(--mint); border-bottom-left-radius: 4px; }
.chat-quick { display: flex; flex-wrap: wrap; gap: .35rem; padding: .5rem .7rem 0; flex: none; }
.chat-quick button { flex: none; border: 1.5px solid var(--pink-light); background: #fff; color: var(--pink-deep); border-radius: 999px; padding: .15rem .7rem; font: 500 .9rem var(--body); cursor: pointer; }
.chat-form { display: flex; gap: .4rem; padding: .6rem .7rem; flex: none; }
.chat-form input[type=text], .chat-form input[name=text] { flex: 1; min-width: 0; padding: .5rem .8rem; border: 2px solid var(--border); border-radius: 999px; font: inherit; }
.chat-form .btn { padding: .4rem 1rem; }
.chat-line { text-align: center; font-size: .86rem; padding: 0 0 .55rem; color: var(--line-dark); flex: none; }

/* Admin */
body.admin { background: #f7f4ee; }
.admin-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.admin-side { background: #fff; border-right: 2px solid var(--border); padding: 1.2rem; display: flex; flex-direction: column; gap: 1.2rem; position: sticky; top: 0; height: 100vh; }
.admin-side nav { display: grid; gap: .15rem; }
.admin-side nav a { padding: .4rem .7rem; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 500; }
.admin-side nav a:hover { background: var(--yellow-soft); }
.admin-side-foot { margin-top: auto; font-size: .95rem; display: grid; gap: .2rem; justify-items: start; }
.admin-main { padding: 1.8rem clamp(1rem, 3vw, 2.5rem) 3rem; min-width: 0; }
.admin-main h1 { font-size: 1.7rem; margin-bottom: .7rem; }
.badge { display: inline-block; min-width: 1.4em; text-align: center; background: var(--pink); color: #fff; border-radius: 999px; font-size: .78rem; padding: 0 .4em; }
.stats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.stats li { background: #fff; border-radius: 16px; padding: 1rem 1.2rem; }
.stats a { color: inherit; text-decoration: none; }
.stats b { display: block; font: 700 2.2rem/1.1 var(--display); color: var(--pink); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .97rem; }
.table th, .table td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.pill { display: inline-block; border-radius: 999px; padding: 0 .65rem; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--mint); }
.pill-wait { background: var(--yellow); }
.pill-off { background: #eee; color: #555; }
.pill-bad { background: #ffd2cd; color: #7c1710; }
.admin-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-top: 1rem; }
.gallery-item { margin: 0; display: grid; gap: .5rem; padding: .8rem; }
.gallery-item label { display: grid; gap: .15rem; font-size: .92rem; }
.gallery-item label.check { display: flex; gap: .4rem; }
.gallery-item input:not([type=checkbox]) { padding: .35rem .6rem; border: 2px solid var(--border); border-radius: 10px; font: inherit; width: 100%; }
.gallery-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; }
.admin-chat .chat-log { height: 52vh; border-radius: 12px; }
.admin-chat .chat-form { padding-inline: 0; }
@media (max-width: 760px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; border-right: 0; border-bottom: 2px solid var(--border); }
  .admin-side nav { grid-template-columns: repeat(2, 1fr); }
}

/* Class application form */
.hp { position: absolute; left: -9999px; }
.choices { border: 2px solid var(--border); border-radius: 16px; padding: .7rem 1rem 1rem; margin: 0; display: grid; gap: .5rem; background: #fff; }
.choices legend { font-weight: 500; padding: 0 .4rem; }
.choices p { margin: 0; }
.choices .btn { justify-self: start; }
.date-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .4rem .8rem; }
.consent-box { background: var(--yellow-soft); border-color: #f0dd8a; }
.apply h1 { font-size: 1.7rem; }
