:root {
  --blue: #557dd3;
  --deep: #29417e;
  --white: #fff;
  --shadow: 0 18px 45px rgba(23, 52, 104, 0.24);
}

* {
  box-sizing: border-box;
}

/* ── Snap Scroll (index page only via .snap-page on <html>) ── */
/* Snap scroll handled via JS (smoothSnap) — CSS provides sizing only */
.snap-page .hero,
.snap-page .last-update,
.snap-page .guide-section,
.snap-page .commu-section,
.snap-page .news-section {
  min-height: 100dvh;
}

html {
  scroll-behavior: smooth;
  /* ป้องกัน font scaling อัตโนมัติบน iOS เมื่อหมุนหน้าจอ */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Noto Sans Thai", system-ui, sans-serif;
  background: #dcecff;
  color: #17223a;
  overflow-x: hidden;
  /* smooth scroll บน iOS */
  -webkit-overflow-scrolling: touch;
}

img {
  max-width: 100%;
  height: auto;
}

.site-shell {
  min-height: 100vh;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 34px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(180deg, rgba(72, 121, 207, 0.62), rgba(72, 121, 207, 0.08));
  backdrop-filter: blur(4px);
  transition: 0.25s;
}

.topbar.scrolled {
  height: 44px;
  background: rgba(62, 105, 188, 0.78);
  box-shadow: 0 5px 20px rgba(25, 55, 100, 0.16);
}

.brand-mini {
  display: none;
  width: 80px;
}

.brand-mini img {
  width: 100%;
  display: block;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 19px;
  margin-left: 12px;
}

.main-nav a {
  position: relative;
  color: white;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(19, 42, 86, 0.42);
  line-height: 1;
}

.main-nav a:after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -7px;
  height: 2px;
  border-radius: 9px;
  background: #fff;
  transition: 0.25s;
}

.main-nav a:hover:after {
  right: 0;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-btn {
  height: 23px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #648ee7, #3e64c3);
  color: white;
  text-decoration: none;
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(38, 71, 147, 0.22);
}

.lang-switcher {
  position: relative;
}

.lang-current {
  height: 24px;
  min-width: 45px;
  border: 0;
  border-radius: 999px;
  background: white;
  color: #24355f;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.lang-current:after {
  content: "▾";
  font-size: 8px;
  margin-left: 5px;
}

.lang-menu {
  position: absolute;
  right: 0;
  top: 30px;
  display: grid;
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.13);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: 0.2s;
}

.lang-switcher.open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-menu button {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 800;
  color: #24355f;
  cursor: pointer;
}

.lang-menu button:hover {
  background: #e8f0ff;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  border: 0;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 9px;
  width: 34px;
  height: 30px;
  padding: 7px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: #39579f;
  border-radius: 5px;
  margin: 4px 0;
}

.hero {
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding-top: 70px;
  padding-bottom: 50px;
  background: url("../images/hero.png") center top/cover no-repeat;
  background-attachment: fixed;
  overflow: hidden;
}

/* iOS/Android ไม่รองรับ background-attachment: fixed */
@supports (-webkit-overflow-scrolling: touch) {
  .hero {
    background-attachment: scroll;
  }
}

.hero:after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 21%;
  background: linear-gradient(0deg, rgba(210, 230, 255, 0.78), transparent);
  pointer-events: none;
}

.sky-shine {
  position: absolute;
  top: -14%;
  left: 50%;
  width: 62vw;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.14) 32%, transparent 62%);
  mix-blend-mode: screen;
  animation: pulseSky 4s ease-in-out infinite;
}

/*
.hero-content {
  min-height: calc(100vh - 124px);
  display: flex;
  flex-direction: column;
  align-items: center;
}
*/

.hero-content {
  position: relative;
  z-index: 2;

  width: min(780px, 92vw);
  min-height: calc(100vh - 120px);

  display: flex;
  flex-direction: column;
  align-items: center;

  /* ดันข้อความลงมาอยู่กลางจอ */
  justify-content: space-between;

  padding-top: 10%;
  padding-bottom: 40px;

  text-align: center;
  will-change: transform;
}

.hero-logo {
  width: clamp(300px, 42vw, 655px);
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 16px 18px rgba(77, 86, 140, 0.18));
}

.hero-desc {
  max-width: 700px;

  /* ให้อยู่ในวงเหลือง */
  margin-top: auto;
  margin-bottom: 140px;

  font-size: clamp(12px, 1.05vw, 16px);
  line-height: 1.3;
}

.store-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: auto;
}

/* ── Store button pill ── */
.store-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px 9px 12px;
  background: rgba(10,10,18,0.88);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  text-decoration: none;
  color: #fff;
  min-width: 158px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.store-btn:hover {
  background: rgba(30,30,50,0.95);
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.45);
}

.store-btn-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

.store-btn-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.store-btn-sub {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.7;
  margin-bottom: 3px;
  letter-spacing: 0.02em;
}

.store-btn-name {
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.last-update {
  position: relative;
  min-height: 100vh;
  max-height: fit-content;
  margin-top: -1px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0 0;
  overflow: hidden;
  background: #cfe3ff;
}

.update-bg {
  position: absolute;
  inset: -6% 0 0;
  background: url("../images/bg-lastupdate.png") center top/cover no-repeat;
  will-change: transform;
}

.last-update:before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(203, 226, 255, 0.5) 0%,
    rgba(255, 255, 255, 0) 30%,
    rgba(126, 186, 102, 0.12) 100%
  );
}

.board-zone {
  position: relative;
  z-index: 4;
  width: min(970px, 78vw);
  margin-top: 0;
  margin-left: 120px;
  will-change: transform;
}

.board-bg {
  width: 100%;
  display: block;
  filter: drop-shadow(0 23px 22px rgba(85, 68, 38, 0.22));
}

.board-title {
  position: absolute;
  top: 7.2%;
  left: 16%;
  right: 17%;
  text-align: center;
  font-family: Georgia, serif;
  font-size: clamp(30px, 4vw, 62px);
  line-height: 1;
  font-weight: 900;
  color: #fff;
  text-shadow:
    0 3px 0 rgba(113, 83, 41, 0.48),
    0 5px 10px rgba(59, 38, 16, 0.35);
  transform: rotate(-2deg);
}

.slider {
  position: absolute;
  /* พิกัดวัดจาก BOARD1.png (1347×944 px) — พื้นที่สีครีมตรงกลาง board */
  left: 18.34%;
  top: 23.62%;
  width: 63.55%;
  height: 50.74%;
  filter: drop-shadow(0 8px 14px rgba(33, 43, 55, 0.18));
}

.slide-window {
  width: 100%;
  height: 100%; /* เต็มพื้นที่ครีม */
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(180, 150, 100, 0.25);
}

.slide-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.22, 0.8, 0.25, 1);
}

.slide {
  flex: 0 0 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.slide img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.slide-arrow {
  position: absolute;
  z-index: 10;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(90, 87, 75, 0.78);
  color: white;
  font-size: 34px;
  line-height: 32px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  transition: 0.2s;
}

.slide-arrow:hover {
  background: rgba(72, 67, 58, 0.95);
  transform: translateY(-50%) scale(1.08);
}

.slide-arrow.prev {
  left: 3px;
}

.slide-arrow.next {
  right: 3px;
}

.npc {
  position: absolute;
  z-index: 5;
      left: 10%;
    bottom: 0;
  width: clamp(242px, 40vw,380px);
  filter: drop-shadow(0 25px 22px rgba(59, 55, 38, 0.25));
  will-change: transform;
}

.poring-wrap {
  position: absolute;
  z-index: 6;
  right: 15%;
  top: 76px;
  width: clamp(350px, 13vw, 300px);
  animation: floatPoring 3.5s ease-in-out infinite;
  will-change: transform;
}

.poring {
  width: 100%;
  display: block;
  filter: drop-shadow(0 16px 12px rgba(84, 68, 96, 0.16));
}

.wing-glow {
  position: absolute;
  inset: 18% 8%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 246, 144, 0.5), rgba(255, 255, 255, 0.2) 36%, transparent 68%);
  filter: blur(7px);
  animation: glowBlink 1.6s ease-in-out infinite;
}

.glow-b {
  animation-delay: 0.8s;
  transform: scale(0.72);
}

.grass {
  position: absolute;
  z-index: 7;
  left: 4%;
  width: 92%;
  pointer-events: none;
  filter: drop-shadow(0 -8px 8px rgba(67, 96, 49, 0.14));
}

.grass-back {
  bottom: -12.2%;
  opacity: 0.64;
  transform: scaleX(1.04);
}

.grass-front {
  bottom: -12%;
  transform: scaleX(1.1);
}

.placeholder {
  min-height: 280px;
  display: grid;
  place-items: center;
  background: #eff7ff;
  border-top: 1px solid rgba(86, 118, 166, 0.14);
}

.placeholder h2 {
  font-size: 52px;
  color: #7c9bc9;
  opacity: 0.32;
}

@keyframes pulseSky {
  50% {
    opacity: 0.72;
    transform: translateX(-50%) scale(1.05);
  }
}

@keyframes floatPoring {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }

  50% {
    transform: translateY(-18px) rotate(4deg);
  }
}

@keyframes glowBlink {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.9);
  }

  50% {
    opacity: 0.9;
    transform: scale(1.15);
  }
}

@media (max-width: 1024px) {
  .topbar {
    height: 48px;
    background: rgba(64, 105, 188, 0.72);
  }

  .brand-mini {
    display: block;
  }

  .main-nav {
    display: none;
  }

  .main-nav.open {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    position: fixed;
    top: 48px;          /* ชิดใต้ topbar (height: 48px) */
    left: 0;
    right: 0;
    background: rgba(16, 36, 90, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 14px 16px 20px;
    gap: 8px;
    z-index: 200;
    animation: mobileNavIn 0.22s ease both;
  }

  @keyframes mobileNavIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .main-nav a {
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    text-align: center;
  }

  .main-nav a:hover,
  .main-nav a:focus {
    background: rgba(255, 255, 255, 0.16);
  }

  .nav-toggle {
    display: block;
  }

  .top-actions {
    margin-left: 0;
  }

  .login-btn {
    height: 28px;
  }

  .hero {
    height: auto;
    min-height: 620px;
    padding-top: 80px;
    background-position: center top;
  }

  .board-zone {
    width: min(870px, 86vw);
    margin-left: 70px;
  }

  .npc {
    left: -9%;
    width: clamp(210px, 45vw, 400px);
    bottom: 0;
  }

  .poring-wrap {
    right: 2%;
    top: 115px;
  }

  .slide-arrow.prev {
    left: 3px;
  }

  .slide-arrow.next {
    right: 3px;
  }
}

/* ——— 900px: ปรับ board-zone layout ——— */
@media (max-width: 900px) {
  .board-zone {
    width: min(800px, 88vw);
    margin-left: 40px;
  }
}

@media (max-width: 680px) {
  /* ปิด fixed background บน mobile ทุก browser */
  .hero {
    background-attachment: scroll;
  }

  .topbar {
    padding: 0 8px;
    gap: 7px;
  }

  .brand-mini {
    width: 65px;
  }

  .login-btn {
    font-size: 9px;
    padding: 0 9px;
  }

  .lang-current {
    min-width: 39px;
  }

  .hero {
    min-height: 555px;
    padding-top: 90px;
    background-size: auto 100%;
    background-position: center top;
  }

  .hero-logo {
    width: min(88vw, 420px);
  }

  .hero-desc {
    padding: 0 18px;
    font-size: 11px;
  }

  .store-row {
    gap: 7px;
  }

  .store-btn {
    min-width: 140px;
    padding: 8px 14px 8px 10px;
    gap: 8px;
  }

  .store-btn-name { font-size: 14px; }
  .store-btn-icon { width: 28px; height: 28px; }

  .last-update {
    min-height: 570px;
    padding-top: 28px;
  }

  .update-bg {
    background-position: center top;
  }

  .board-zone {
   margin-left: 0;
        margin-top: 42px;
        width: 700px;
  }

  .board-title {
    font-size: clamp(25px, 8vw, 44px);
    top: 7.4%;
  }

  .slider {
    left: 18.34%;
    top: 23.62%;
    width: 63.55%;
    height: 50.74%;
  }

  .slide-window {
    width: 100%;
    height: 100%;
  }

  .slide-arrow {
    width: 28px;
    height: 28px;
    font-size: 26px;
    line-height: 24px;
  }

  .slide-arrow.prev {
    left: -31px;
  }

  .slide-arrow.next {
    right: -31px;
  }

  .npc {
   display: none;
  }

  .poring-wrap {
    right: 0;
    top: 52px;
    width: 24vw;
    min-width: 86px;
  }

  .grass-front {
    bottom: -5%;
  }

  .placeholder {
    min-height: 180px;
  }

  .placeholder h2 {
    font-size: 34px;
  }
}

@media (max-width: 430px) {
  .main-nav.open {
    grid-template-columns: 1fr;  /* single column on narrow phones */
  }

  .hero {
    min-height: 520px;
  }

  .board-zone {
    width: 132vw;
    margin-left: 0;
    margin-top: -50px;
  }

  .npc {
    width: 52vw;
    left: -32px;
    display: none;
  }

  .poring-wrap {
    right: -16px;
  }

  .last-update {
    min-height: 520px;
  }

  .slide-arrow.prev {
    left: -25px;
  }

  .slide-arrow.next {
    right: -25px;
  }
}

/* ——— hero layout overrides (merged) ——— */
.hero-desc {
  margin-bottom: 26px;
}

.store-row {
  margin-bottom: 0;
}

@media (max-width: 680px) {
  .hero-desc {
    margin-bottom: 18px;
  }
}

/* ——— Mobile landscape fix ——— */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    background-attachment: scroll;
    min-height: auto;
    padding-top: 60px;
    padding-bottom: 32px;
  }

  .hero-content {
    min-height: auto;
    padding-top: 0;
    padding-bottom: 24px;
  }

  .hero-logo {
    width: clamp(180px, 28vh, 320px);
  }

  .hero-desc {
    margin-bottom: 12px;
    font-size: 11px;
  }

  .store-btn {
    min-width: 120px;
    padding: 7px 12px 7px 9px;
    gap: 7px;
    border-radius: 11px;
  }

  .store-btn-name { font-size: 13px; }
  .store-btn-sub  { font-size: 9px; }
  .store-btn-icon { width: 26px; height: 26px; }
}

/* ============================================================
   SITE FOOTER — ใช้ร่วมกันทุกหน้า
============================================================ */
.site-footer {
  background: linear-gradient(180deg, #0d1628 0%, #060e1c 100%);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 44px 24px 36px;
  text-align: center;
}

.footer-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.footer-logo {
  height: 28px;
  width: auto;
  opacity: 0.55;
  filter: brightness(0) invert(1);
}

.footer-divider {
  width: 44px;
  height: 1px;
  background: rgba(255,255,255,0.10);
}

.footer-copy {
  margin: 0;
  font-size: 11px;
  line-height: 1.9;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.01em;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 11px;
}

.footer-links a {
  color: rgba(255,255,255,0.48);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.18s;
}

.footer-links a:hover { color: #fff; }

.footer-sep { color: rgba(255,255,255,0.18); }
