:root {
  --sky-top: #6ebcff;
  --sky-mid: #b4dcff;
  --sky-bottom: #eef8ff;
  --blue: #1d63d8;
  --gold: #ffc23a;
  --gold-deep: #f08a12;
  --text: #1b3a6b;
  --text-dim: #4a6a99;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.95);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Kanit", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 50%, var(--sky-bottom) 100%);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Sky background ---------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.sunglow {
  position: absolute;
  top: -30vmax;
  left: -25vmax;
  width: 80vmax;
  height: 80vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.4) 30%, transparent 65%);
}

.contrail {
  position: absolute;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
}

.contrail.c1 { top: 30vh; left: 6vw; width: 32vw; transform: rotate(12deg); }
.contrail.c2 { top: 18vh; right: 4vw; width: 40vw; transform: rotate(-20deg); }

.clouds {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 60vh;
  animation: drift 40s ease-in-out infinite alternate;
}

.clouds.back { opacity: 0.75; animation-duration: 60s; }

.clouds span {
  position: absolute;
  left: var(--x);
  bottom: var(--b);
  width: var(--w);
  height: var(--h);
  border-radius: 50%;
  background: #fff;
  filter: blur(18px);
  box-shadow:
    calc(var(--w) * 0.22) calc(var(--h) * -0.35) 0 calc(var(--h) * -0.12) #fff,
    calc(var(--w) * -0.2) calc(var(--h) * -0.2) 0 calc(var(--h) * -0.18) #fff;
}

.clouds.back span { bottom: calc(var(--b) + 14vh); background: #f4fbff; }

@keyframes drift {
  from { transform: translateX(-3vw); }
  to   { transform: translateX(3vw); }
}

#sparkles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.hero {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 16px;
  animation: fadeUp 1.2s ease-out both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Logo (assets/logo.webp, transparent background) ---------- */
.logo {
  filter: drop-shadow(0 8px 24px rgba(40, 120, 230, 0.35));
  animation: logoFloat 5s ease-in-out infinite;
}

.logo img {
  display: block;
  width: min(620px, 92vw);
  height: auto;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.tagline {
  margin-top: 20px;
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  font-weight: 400;
  color: var(--text);
  text-shadow: 0 0 12px #fff, 0 0 4px #fff;
}

.countdown {
  display: flex;
  align-items: flex-start;
  gap: clamp(6px, 2vw, 18px);
  margin-top: 40px;
}

.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: clamp(64px, 16vw, 120px);
  padding: clamp(12px, 2.5vw, 22px) clamp(8px, 2vw, 16px);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(29, 99, 216, 0.18), inset 0 0 18px rgba(255, 255, 255, 0.8);
}

.num {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 6vw, 3.6rem);
  line-height: 1.1;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 #fff;
}

.num.tick { animation: tick 0.4s ease-out; }

@keyframes tick {
  0%   { transform: translateY(-6px); opacity: 0.4; }
  100% { transform: translateY(0); opacity: 1; }
}

.label {
  margin-top: 6px;
  font-size: clamp(0.75rem, 1.8vw, 0.95rem);
  color: var(--text-dim);
}

.sep {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(1.6rem, 5vw, 3rem);
  color: #fff;
  text-shadow: 0 0 8px rgba(29, 99, 216, 0.5);
  padding-top: clamp(10px, 2.4vw, 22px);
}

.launch-date {
  margin-top: 28px;
  font-size: 1.1rem;
  color: var(--text);
  text-shadow: 0 0 10px #fff;
}

.launch-date strong { color: var(--gold-deep); font-weight: 500; }

.launched {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  color: var(--blue);
  margin-top: 40px;
}

.lang-switch {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  padding: 4px;
  gap: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 14px rgba(29, 99, 216, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lang-switch button {
  min-width: 44px;
  padding: 6px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--blue);
  font: 600 0.9rem "Fredoka", sans-serif;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--blue);
  color: #fff;
}

.social {
  display: flex;
  gap: 24px;
  margin-top: 36px;
}

.social a {
  color: var(--blue);
  text-decoration: none;
  font-size: 0.95rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.social a:hover { color: var(--gold-deep); border-color: var(--gold-deep); }

.footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px 16px;
  font-size: 0.8rem;
  color: var(--text-dim);
  opacity: 0.7;
}

.footer a { color: var(--blue); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ---------- Top bar (nav + language) ---------- */
.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.topbar .lang-switch { position: static; flex-shrink: 0; }

.site-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 14px rgba(29, 99, 216, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-x: auto;
  scrollbar-width: none;
}

.site-nav a {
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--blue);
  text-decoration: none;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.site-nav a:hover { background: rgba(29, 99, 216, 0.1); }
.site-nav a[aria-current="page"] { background: var(--blue); color: #fff; }

/* Long content is written once per language; show only the active one */
html:lang(th) [data-lang-block="en"],
html:lang(en) [data-lang-block="th"] { display: none; }

/* ---------- Content pages (news / faq / rules) ---------- */
.page {
  position: relative;
  z-index: 2;
  flex: 1;
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 16px 16px 48px;
  animation: fadeUp 1s ease-out both;
}

.page-title {
  text-align: center;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 500;
  color: var(--blue);
  text-shadow: 0 0 12px #fff;
}

.page-lead {
  text-align: center;
  margin-top: 6px;
  color: var(--text);
  text-shadow: 0 0 10px #fff;
}

.page .dl-panel { margin-top: 20px; }
.page .dl-panel h2 { font-size: 1.2rem; }
.page p, .page li { line-height: 1.7; }
.page ol, .page ul { padding-left: 1.4em; }
.page a { color: var(--blue); }

.faq details {
  border-top: 1px solid rgba(29, 99, 216, 0.12);
  padding: 12px 0;
}

.faq details:first-of-type { border-top: none; }

.faq summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--blue); font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details > div { margin-top: 8px; color: var(--text); }
.faq details > div > * + * { margin-top: 8px; }

.rules li + li { margin-top: 6px; }

.penalty { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.penalty th, .penalty td { padding: 8px; border-bottom: 1px solid rgba(29, 99, 216, 0.12); text-align: left; vertical-align: top; }
.penalty thead th { color: var(--text-dim); font-weight: 500; }

.news-item time { font-size: 0.85rem; color: var(--text-dim); }
.news-item h2 { margin-top: 2px; }
.news-item p + p { margin-top: 8px; }

.tag {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  color: #fff;
  background: var(--blue);
}

.tag.event { background: var(--gold-deep); }

/* Text the owner still has to confirm before going live */
mark.todo {
  padding: 0 6px;
  border-radius: 6px;
  background: #fff1b8;
  color: #8a5a00;
  font-size: 0.85em;
}

/* ---------- Download page ---------- */
.dl-page { justify-content: flex-start; padding-top: 16px; }

.logo-small { display: block; }
.logo-small img { width: min(340px, 70vw); }

.dl-title {
  margin-top: 8px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 500;
  color: var(--blue);
  text-shadow: 0 0 12px #fff;
}

.dl-card,
.dl-panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(29, 99, 216, 0.18), inset 0 0 18px rgba(255, 255, 255, 0.8);
  text-align: left;
}

.dl-card {
  width: min(860px, 100%);
  margin-top: 28px;
  padding: clamp(18px, 3vw, 28px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.dl-card h2 { font-size: 1.25rem; font-weight: 500; color: var(--text); }

.dl-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 10px; }
.dl-meta dt { font-size: 0.8rem; color: var(--text-dim); }
.dl-meta dd { font-weight: 500; color: var(--text); }

.dl-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.btn {
  display: inline-block;
  padding: 14px 36px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 1.1rem;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
  box-shadow: 0 6px 18px rgba(240, 138, 18, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  text-shadow: 0 1px 2px rgba(150, 70, 0, 0.4);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(240, 138, 18, 0.5); }

.btn[aria-disabled="true"] {
  background: linear-gradient(180deg, #c9d6ea 0%, #9fb2cf 100%);
  box-shadow: none;
  text-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.mirrors { font-size: 0.85rem; color: var(--text-dim); }
.mirrors a { color: var(--blue); margin-left: 8px; }
.mirrors a[aria-disabled="true"] { color: var(--text-dim); opacity: 0.6; cursor: not-allowed; }

.dl-grid {
  width: min(860px, 100%);
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.dl-panel { padding: clamp(16px, 3vw, 24px); }
.dl-panel h2 { font-size: 1.1rem; font-weight: 500; color: var(--blue); margin-bottom: 12px; }

.steps { padding-left: 1.4em; display: grid; gap: 8px; color: var(--text); }

.spec { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.spec th, .spec td { padding: 6px 8px; border-bottom: 1px solid rgba(29, 99, 216, 0.12); text-align: left; }
.spec thead th { color: var(--text-dim); font-weight: 500; }
.spec tbody th { color: var(--blue); font-weight: 500; white-space: nowrap; }

.back-link { margin-top: 28px; color: var(--blue); text-decoration: none; }
.back-link:hover { color: var(--gold-deep); }

@media (max-width: 520px) {
  .sep { display: none; }
  .countdown { gap: 8px; }
  .contrail { display: none; }
  .dl-card { flex-direction: column; align-items: stretch; text-align: center; }
  .dl-meta { justify-content: center; }
  .dl-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column-reverse; align-items: stretch; }
  .topbar .lang-switch { align-self: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
