:root {
  --ink: #0b0a10;
  --ink-2: #14121b;
  --text: #f3eee6;
  --muted: #b3aab8;
  --line: rgba(255, 255, 255, 0.12);
  --gold: #e6c98d;
  --display: 'Cinzel', 'Times New Roman', serif;
  --sans: 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; }

/* Only the chosen language shows. */
html[lang='th'] [lang='en'],
html[lang='en'] [lang='th'] { display: none !important; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 14px var(--gutter);
  padding-top: max(14px, env(safe-area-inset-top));
  background: linear-gradient(to bottom, rgba(11, 10, 16, 0.92), rgba(11, 10, 16, 0));
  transition: background-color 0.3s, backdrop-filter 0.3s;
}
.nav.scrolled {
  background-color: rgba(11, 10, 16, 0.72);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  width: 14px; height: 14px; transform: rotate(45deg);
  background: linear-gradient(135deg, #ff5a76, #b1173a);
  box-shadow: 0 0 14px rgba(255, 70, 100, 0.6);
}
.brand-name { font: 700 17px/1 var(--display); letter-spacing: 0.22em; }
.brand-name b { font-weight: 500; color: var(--gold); margin-left: 0.4em; }
.nav-links { display: flex; gap: 22px; margin-left: auto; }
.nav-links a {
  font: 500 13px/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase;
  text-decoration: none; color: var(--muted); transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }
.lang { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: rgba(0, 0, 0, 0.35); }
.lang button {
  font: 500 13px/1 var(--sans); color: var(--muted);
  background: none; border: 0; border-radius: 999px; padding: 7px 12px; cursor: pointer;
}
.lang button[aria-pressed='true'] { background: rgba(255, 255, 255, 0.12); color: var(--text); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center; gap: clamp(24px, 5vh, 48px);
  padding: 96px var(--gutter) 56px;
  isolation: isolate;
}
.hero-sky {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 50% at 18% 30%, rgba(200, 40, 70, 0.22), transparent 70%),
    radial-gradient(50% 50% at 82% 20%, rgba(130, 100, 255, 0.2), transparent 70%),
    radial-gradient(70% 60% at 50% 110%, rgba(230, 200, 140, 0.1), transparent 70%),
    var(--ink);
}
.hero-sky::after {
  /* faint stars */
  content: ''; position: absolute; inset: 0; opacity: 0.55;
  background-image:
    radial-gradient(1px 1px at 12% 22%, #fff, transparent 60%),
    radial-gradient(1px 1px at 33% 12%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 58% 28%, #ffe7c2, transparent 60%),
    radial-gradient(1px 1px at 76% 9%, #fff, transparent 60%),
    radial-gradient(1px 1px at 88% 34%, #d9ccff, transparent 60%),
    radial-gradient(1px 1px at 45% 6%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 6% 8%, #ffd0d8, transparent 60%);
}
.hero-copy { max-width: 760px; }
.eyebrow {
  margin: 0 0 14px;
  font: 500 12px/1 var(--display); letter-spacing: 0.32em; text-transform: uppercase; color: var(--gold);
}
.hero h1 {
  margin: 0;
  font-weight: 600; font-size: clamp(32px, 5.2vw, 64px); line-height: 1.18; letter-spacing: -0.01em;
  text-wrap: balance;
}
html[lang='en'] .hero h1 { font-family: var(--display); font-weight: 700; letter-spacing: 0.01em; }
.lede { margin: 18px 0 0; max-width: 56ch; color: var(--muted); font-size: clamp(15px, 1.4vw, 18px); }

.portals { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(12px, 1.6vw, 22px); }
.portal {
  position: relative; overflow: hidden; isolation: isolate;
  height: clamp(220px, 42vh, 400px);
  border-radius: 14px; border: 1px solid var(--line);
  text-decoration: none;
  transition: transform 0.35s cubic-bezier(.2,.7,.2,1), border-color 0.35s, box-shadow 0.35s;
}
.portal:hover, .portal:focus-visible {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 18px 48px -18px var(--accent);
}
.portal-bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2;
  transition: transform 0.6s cubic-bezier(.2,.7,.2,1);
}
.portal:hover .portal-bg { transform: scale(1.05); }
.portal::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgba(8, 7, 12, 0.95) 0%, rgba(8, 7, 12, 0.35) 45%, rgba(8, 7, 12, 0) 75%);
}
.portal-fig {
  position: absolute; z-index: -1; right: -6%; bottom: 0; height: 104%; width: auto; max-width: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 98%);
  mask-image: linear-gradient(to bottom, #000 70%, transparent 98%);
  transition: transform 0.6s cubic-bezier(.2,.7,.2,1);
}
.portal:hover .portal-fig { transform: translateY(-6px); }
.portal-trio {
  position: absolute; z-index: -1; inset: 6% 6% 16% 6%;
  display: flex; justify-content: center; align-items: flex-end;
}
.portal-trio img { height: 86%; width: auto; min-width: 0; object-fit: contain; margin: 0 -3%; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)); transition: transform 0.6s cubic-bezier(.2,.7,.2,1); }
.portal-trio img:nth-child(2) { height: 96%; }
.portal:hover .portal-trio img { transform: translateY(-6px); }
.portal-text { position: absolute; left: 20px; right: 20px; bottom: 18px; display: grid; gap: 4px; }
.portal-genre { font: 500 11px/1.3 var(--display); letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); }
.portal-title { font: 700 clamp(22px, 2.3vw, 30px)/1.1 var(--display); letter-spacing: 0.04em; color: var(--text); text-shadow: 0 2px 16px rgba(0, 0, 0, 0.7); }

/* Each game owns an accent. */
.portal--eclipse, .game--eclipse { --accent: #ff4d63; --glow: rgba(220, 30, 60, 0.45); --btn-1: #e3354f; --btn-2: #9c1530; }
.portal--aetheria, .game--aetheria { --accent: #b9a6ff; --glow: rgba(140, 110, 255, 0.4); --btn-1: #ecd39c; --btn-2: #c39b58; }
.portal--guild, .game--guild { --accent: #ff7a95; --glow: rgba(230, 50, 90, 0.35); --btn-1: #d8314f; --btn-2: #8d1530; }

.portal-bg--guild, .game-bg--guild {
  background:
    radial-gradient(40% 50% at 28% 60%, rgba(200, 30, 60, 0.38), transparent 70%),
    radial-gradient(2px 2px at 20% 30%, rgba(255, 90, 120, 0.8), transparent 60%),
    radial-gradient(2px 2px at 70% 18%, rgba(255, 90, 120, 0.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 86% 70%, rgba(255, 90, 120, 0.7), transparent 60%),
    radial-gradient(2px 2px at 45% 85%, rgba(255, 90, 120, 0.5), transparent 60%),
    linear-gradient(rgba(10, 6, 10, 0.7), rgba(10, 6, 10, 0.82)),
    url(img/guild-floor.webp) center / 360px repeat,
    #100a0e;
}

/* ---------- Game sections ---------- */
.game {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: min(100svh, 920px);
  display: flex; align-items: center;
  padding: clamp(72px, 10vh, 120px) var(--gutter);
  border-top: 1px solid var(--line);
}
.game-bg {
  position: absolute; inset: 0; z-index: -1;
  background: var(--bg) center / cover no-repeat;
}
.game-bg:not(.game-bg--guild)::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(9, 8, 13, 0.25) 0%, rgba(9, 8, 13, 0.82) 52%, rgba(9, 8, 13, 0.94) 100%),
    linear-gradient(to bottom, var(--ink) 0%, transparent 18%, transparent 80%, var(--ink) 100%);
}
.game--flip .game-bg::after {
  background:
    linear-gradient(270deg, rgba(9, 8, 13, 0.25) 0%, rgba(9, 8, 13, 0.82) 52%, rgba(9, 8, 13, 0.94) 100%),
    linear-gradient(to bottom, var(--ink) 0%, transparent 18%, transparent 80%, var(--ink) 100%);
}
.game-inner {
  width: 100%; max-width: 1240px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1.05fr; gap: clamp(24px, 4vw, 64px); align-items: center;
}
.game--flip .game-art { order: 2; }
.game-art { position: relative; display: flex; justify-content: center; }
.game-art::before {
  content: ''; position: absolute; inset: 15% 10%; z-index: -1; border-radius: 50%;
  background: var(--glow); filter: blur(60px);
}
.game-art > img {
  width: min(100%, 560px); height: auto;
  /* The cut-outs end in straight edges at the sides and bottom; fade all three. */
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 100%), linear-gradient(to right, transparent 0%, #000 12%, #000 88%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, #000 72%, transparent 100%), linear-gradient(to right, transparent 0%, #000 12%, #000 88%, transparent 100%);
  mask-composite: intersect;
}
.game-art--trio { align-items: flex-end; }
.game-art--trio > img {
  width: 34%; max-width: 230px; margin: 0 -3%;
  -webkit-mask-image: none; mask-image: none;
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.7));
}
.game-art--trio > img:nth-child(2) { width: 38%; max-width: 260px; z-index: 1; }

.game-genre { margin: 0 0 10px; font: 500 12px/1.4 var(--display); letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); }
.game-title {
  margin: 0 0 18px;
  font: 700 clamp(34px, 4.6vw, 60px)/1.05 var(--display); letter-spacing: 0.03em;
  text-shadow: 0 0 40px var(--glow);
}
.game-title small {
  display: block; margin-top: 10px;
  font: 500 clamp(13px, 1.3vw, 17px)/1.3 var(--display); letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold);
}
.th-title { font-family: var(--sans); font-weight: 600; letter-spacing: 0; }
.game-desc { margin: 0 0 22px; max-width: 54ch; color: #ddd4dc; font-size: clamp(15px, 1.25vw, 17px); }

.heroes { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.heroes li {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px 8px 8px;
  border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, 0.35);
}
.heroes img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 1px solid var(--accent); }
.heroes b { display: block; font: 700 15px/1.2 var(--display); letter-spacing: 0.08em; }
.heroes small { display: block; font-size: 12px; color: var(--muted); }

.features { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 10px; }
.features li { position: relative; padding-left: 22px; color: var(--text); font-size: 15px; }
.features li::before {
  content: ''; position: absolute; left: 2px; top: 0.62em; width: 7px; height: 7px;
  transform: rotate(45deg); background: var(--accent); box-shadow: 0 0 10px var(--accent);
}

.game-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.play {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 30px; border-radius: 10px;
  font: 700 15px/1 var(--display); letter-spacing: 0.16em; text-transform: uppercase; text-decoration: none;
  color: #fff;
  background: linear-gradient(180deg, var(--btn-1), var(--btn-2));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 30px -10px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
html[lang='th'] .play { font-family: var(--sans); letter-spacing: 0.04em; font-size: 16px; }
.play::after { content: '→'; font-family: var(--sans); transition: transform 0.2s; }
.play:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -10px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.play:hover::after { transform: translateX(3px); }
.game--aetheria .play { color: #231a0c; }
.platforms { font: 500 13px/1.3 var(--display); letter-spacing: 0.14em; color: var(--muted); }
.platforms small { font-family: var(--sans); letter-spacing: 0; margin-left: 4px; }

.game.will-in .game-inner { opacity: 0; transform: translateY(28px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(.2,.7,.2,1); }
.game.in .game-inner { opacity: 1; transform: none; }

/* ---------- Footer ---------- */
.footer {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px;
  padding: 36px var(--gutter) max(36px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--ink-2);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 14px; }
.footer-links a:hover { color: var(--text); }
.copy { margin: 0 0 0 auto; color: var(--muted); font-size: 13px; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .lang { margin-left: auto; }
  .game-inner, .game--flip .game-inner { grid-template-columns: 1fr; }
  .game--flip .game-art { order: 0; }
  .game-art:not(.game-art--trio) > img { width: min(78%, 420px); }
  .game-bg::after, .game--flip .game-bg::after {
    background: linear-gradient(to bottom, var(--ink) 0%, rgba(9, 8, 13, 0.55) 25%, rgba(9, 8, 13, 0.9) 60%, var(--ink) 100%) !important;
  }
}
@media (max-width: 700px) {
  .hero h1 br { display: none; }
  .portals { grid-template-columns: 1fr; }
  .portal { height: 190px; }
  .portal-fig { height: 135%; top: -4%; bottom: auto; }
}

/* Phones held sideways: short screens, so the hero and sections stay compact. */
@media (max-height: 500px) and (orientation: landscape) {
  .nav { padding-top: 10px; padding-bottom: 10px; }
  .hero { min-height: auto; padding-top: 72px; padding-bottom: 32px; gap: 20px; }
  .hero h1 { font-size: clamp(26px, 4vw, 38px); }
  .lede { margin-top: 10px; font-size: 14px; }
  .portals { grid-template-columns: repeat(3, 1fr); }
  .portal { height: 230px; }
  .game { min-height: auto; padding-top: 48px; padding-bottom: 48px; }
  .game-inner, .game--flip .game-inner { grid-template-columns: 0.8fr 1.2fr; }
  .game--flip .game-art { order: 2; }
  .game-art:not(.game-art--trio) > img { width: 100%; max-height: 80vh; object-fit: contain; }
  .heroes { gap: 8px; }
  .heroes li { padding: 6px 12px 6px 6px; }
  .heroes img { width: 36px; height: 36px; }
  .game-bg::after { background: linear-gradient(90deg, rgba(9, 8, 13, 0.4), rgba(9, 8, 13, 0.9) 50%) !important; }
  .game--flip .game-bg::after { background: linear-gradient(270deg, rgba(9, 8, 13, 0.4), rgba(9, 8, 13, 0.9) 50%) !important; }
  .game-title { font-size: 32px; margin-bottom: 12px; }
  .game-desc { font-size: 14px; margin-bottom: 14px; }
  .features { gap: 6px; margin-bottom: 18px; }
  .features li { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .game.will-in .game-inner { opacity: 1; transform: none; }
}
