@font-face {
  font-family: "LINE Seed Sans TH";
  src: url("../assets/fonts/LINESeedSansTH_W_Rg.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "LINE Seed Sans TH";
  src: url("../assets/fonts/LINESeedSansTH_W_Bd.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "LINE Seed Sans TH";
  src: url("../assets/fonts/LINESeedSansTH_W_XBd.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #070211;
  --bg-deep: #040108;
  --surface: rgba(19, 10, 38, 0.76);
  --text: #f8f6ff;
  --muted: #b8adcb;
  --purple: #8b5cf6;
  --purple-soft: #c4b5fd;
  --cyan: #22d3ee;
  --line: rgba(196, 181, 253, 0.16);
  --max-width: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -15%, rgba(109, 40, 217, 0.26), transparent 37rem),
    linear-gradient(180deg, #090216 0%, var(--bg) 44%, var(--bg-deep) 100%);
  font-family: "LINE Seed Sans TH", system-ui, sans-serif;
  line-height: 1.6;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
  content: "";
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
img { display: block; max-width: 100%; }

.page-glow {
  position: fixed;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  opacity: 0.14;
  filter: blur(110px);
  pointer-events: none;
}

.page-glow-left { top: 35%; left: -18rem; background: #7c3aed; }
.page-glow-right { top: 10%; right: -20rem; background: #0891b2; }

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 40px), var(--max-width));
  min-height: 88px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

.brand, .header-actions, .footer-brand { display: flex; align-items: center; }
.brand { gap: 13px; }
.brand img { width: auto; height: 45px; filter: drop-shadow(0 0 14px rgba(139, 92, 246, 0.35)); }
.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-copy strong { font-size: 1rem; letter-spacing: 0.02em; }
.brand-copy small { margin-top: 5px; color: var(--purple-soft); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; }

.header-actions { gap: 14px; }
.system-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #b9fbcf;
  font-size: 0.75rem;
}
.system-state i, .game-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #34d399;
}

.language-button {
  min-width: 46px;
  padding: 8px 12px;
  border: 1px solid rgba(196, 181, 253, 0.28);
  border-radius: 999px;
  color: var(--purple-soft);
  background: rgba(139, 92, 246, 0.08);
  cursor: pointer;
  transition: 180ms ease;
}
.language-button:hover { border-color: var(--purple); color: white; background: rgba(139, 92, 246, 0.2); }

main { width: min(calc(100% - 40px), var(--max-width)); margin: 0 auto; }

.hero {
  display: flex;
  min-height: 520px;
  padding: 88px 0 76px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.eyebrow, .section-kicker {
  margin: 0;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 7px 14px;
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.055);
}
.eyebrow::before { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); content: ""; }

h1 {
  max-width: 900px;
  margin: 25px 0 20px;
  font-size: clamp(3rem, 7vw, 6.25rem);
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 1.1;
}
h1 span { display: block; }

.gradient-text {
  padding-top: 0.1em;
  padding-bottom: 0.08em;
  background: linear-gradient(100deg, #c4b5fd 5%, #e879f9 48%, #67e8f9 95%);
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
}

.hero-description { max-width: 700px; margin: 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.17rem); }
.game-action svg { width: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }

.competitions { padding: 64px 0 84px; scroll-margin-top: 24px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 40px; margin-bottom: 32px; }
.section-heading h2 { margin: 7px 0 0; font-size: clamp(1.8rem, 4vw, 2.55rem); line-height: 1.2; }

.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.game-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border: 1px solid rgba(var(--card-accent-rgb), 0.22);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(var(--card-accent-rgb), 0.075), rgba(12, 5, 25, 0.82) 56%);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.22);
  animation: reveal 580ms both;
  animation-delay: var(--reveal-delay);
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}
.game-card:hover { transform: translateY(-6px); border-color: rgba(var(--card-accent-rgb), 0.58); box-shadow: 0 24px 65px rgba(0, 0, 0, 0.34), 0 0 36px rgba(var(--card-accent-rgb), 0.1); }

.card-visual { position: relative; display: grid; height: 180px; overflow: hidden; place-items: center; background: radial-gradient(circle at 50% 70%, rgba(var(--card-accent-rgb), 0.24), transparent 55%); }
.card-visual::after { position: absolute; inset: auto 0 0; height: 60%; background: linear-gradient(transparent, rgba(8, 2, 18, 0.96)); content: ""; }
.card-orb { position: absolute; width: 130px; height: 130px; border: 1px solid rgba(var(--card-accent-rgb), 0.22); border-radius: 50%; box-shadow: inset 0 0 40px rgba(var(--card-accent-rgb), 0.13), 0 0 50px rgba(var(--card-accent-rgb), 0.13); }
.game-image { position: relative; z-index: 1; width: 136px; height: 136px; object-fit: contain; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.42)); transition: transform 260ms ease; }
.game-card[data-game="recycling"] .game-image { width: 210px; height: 150px; }
.game-card[data-game="spacebot"] .game-image { width: 148px; height: 148px; }
.game-card:hover .game-image { transform: scale(1.07) rotate(-1deg); }
.game-status { position: absolute; top: 14px; right: 14px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid rgba(255,255,255,.1); border-radius: 999px; color: #d4ccdf; background: rgba(5, 2, 11, 0.6); backdrop-filter: blur(8px); font-size: 0.67rem; }
.game-card.is-pending .game-status i { background: #34d399; box-shadow: 0 0 10px #34d399; }

.card-content { position: relative; z-index: 2; padding: 4px 22px 22px; }
.game-name { min-height: 2.5em; margin: 7px 0 9px; font-size: 1.25rem; line-height: 1.24; }
.game-description { min-height: 4.8em; margin: 0 0 20px; color: var(--muted); font-size: 0.86rem; line-height: 1.6; }
.game-action { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border: 1px solid rgba(var(--card-accent-rgb), 0.3); border-radius: 12px; color: #fff; background: rgba(var(--card-accent-rgb), 0.12); font-size: 0.79rem; font-weight: 700; transition: 180ms ease; }
.game-action[href]:hover { border-color: rgba(var(--card-accent-rgb), 0.7); background: rgba(var(--card-accent-rgb), 0.25); }
.game-action[aria-disabled="true"] { color: #8d829d; cursor: not-allowed; }


footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: min(calc(100% - 40px), var(--max-width)); min-height: 100px; margin: 0 auto; border-top: 1px solid var(--line); color: #796f89; font-size: 0.74rem; }
.footer-brand { gap: 9px; color: #b7aec4; font-weight: 700; }
.footer-brand img { width: auto; height: 26px; opacity: 0.7; }
.footer-version { letter-spacing: 0.06em; }

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

@media (max-width: 940px) {
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-heading { align-items: start; flex-direction: column; gap: 10px; }
}

@media (max-width: 620px) {
  .site-header, main, footer { width: min(calc(100% - 28px), var(--max-width)); }
  .site-header { min-height: 74px; }
  .brand img { height: 36px; }
  .brand-copy strong { font-size: 0.88rem; }
  .brand-copy small { font-size: 0.58rem; }
  .system-state { display: none; }
  .hero { min-height: 460px; padding: 65px 0 56px; }
  h1 { margin-top: 22px; font-size: clamp(2.65rem, 14vw, 4.3rem); }
  .hero-description { font-size: 0.96rem; }
  .competitions { padding-top: 46px; }
  .game-grid { grid-template-columns: 1fr; }
  .card-visual { height: 170px; }
  .game-description { min-height: 0; }
  footer { padding: 28px 0; flex-direction: column; justify-content: center; gap: 6px; text-align: center; }
  footer p { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
