/* index.html — landing page, redesigned in a black/mono "portfolio" style
   (dot grid, giant shiny headline, glass header, mega menu, click sparks).
   Guest sees only the login section; the hero + guild picker appear once
   js/home.js's renderHome() sets body[data-state="user"].

   Tokens are prefixed --h- so they never collide with css/style.css's own
   --muted/--accent/etc., which the shared modal/toast/streak card still use. */

:root {
  --h-bg: #000;
  --h-fg: #fafafa;
  --h-muted: #a3a3a3;
  --h-line: rgba(250, 250, 250, .10);
  --h-dot: #444;
  --h-shine-a: #fff;
  --h-shine-b: #666;
  --h-card: rgba(255, 255, 255, .03);
  --h-card-hover: rgba(255, 255, 255, .07);
  --h-pill-bg: #fff;
  --h-pill-fg: #000;
  --h-glow: rgba(255, 255, 255, .13);
  --h-glass: rgba(10, 10, 10, .6);
  --h-nav-active: #262626;
  --h-nav-hover: #333;
  --h-mega-bg: #0b0b0b;
  --h-mcard-bg: #141414;
  --h-mcard-hover: #181a12;
  --h-grid-line: rgba(255, 255, 255, .05);
  --h-lime: #bef264;
  --h-lime-line: rgba(190, 242, 100, .55);
  --h-sky: #38bdf8;
  --h-yellow: #eab308;
  --h-rose: #f43f5e;
}


html { scroll-behavior: smooth; }
body.home-v2 {
  margin: 0;
  background: var(--h-bg) !important;
  background-image: none !important;
  color: var(--h-fg);
  font-family: 'Inter', 'Anuphan', system-ui, sans-serif;
  overflow-x: hidden;
  transition: background .4s, color .4s;
}
body.home-v2 ::selection { background: rgba(125, 125, 125, .25); }
:where(body.home-v2) a { color: inherit; text-decoration: none; }
.th { font-family: 'Anuphan', 'Inter', sans-serif; }
.mono { font-family: 'JetBrains Mono', monospace; }
.label {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .25em; color: var(--h-muted);
}

/* ===== Visibility by auth state (set by js/home.js renderHome) ===== */
body[data-state="loading"] .only-user,
body[data-state="loading"] .only-guest,
body[data-state="loading"] .only-blocked,
body[data-state="guest"] .only-user,
body[data-state="guest"] .only-blocked,
body[data-state="user"] .only-guest,
body[data-state="user"] .only-blocked,
body[data-state="blocked"] .only-user,
body[data-state="blocked"] .only-guest { display: none !important; }

/* ===== Preloader (also covers the auth check) ===== */
.preloader {
  position: fixed; inset: 0; z-index: 1500; background: var(--h-bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  transition: transform .9s cubic-bezier(.76, 0, .24, 1);
}
/* Hidden once it has slid away, so it's no longer a full-screen layer. */
.preloader.done { transform: translateY(-100%); visibility: hidden; transition: transform .9s cubic-bezier(.76, 0, .24, 1), visibility 0s .9s; }
.preloader-word {
  font-weight: 900; font-size: clamp(2.5rem, 9vw, 5rem); letter-spacing: -.05em;
  display: flex; overflow: hidden;
}
.preloader-word span { display: inline-block; transform: translateY(110%); animation: h-rise .7s cubic-bezier(.23, 1, .32, 1) forwards; }
.preloader-bar { width: 160px; height: 1px; background: var(--h-line); overflow: hidden; }
.preloader-bar i { display: block; height: 100%; width: 0; background: var(--h-fg); animation: h-load .55s ease forwards .1s; }
@keyframes h-rise { to { transform: translateY(0); } }
@keyframes h-load { to { width: 100%; } }

/* ===== Background layers ===== */
.dot-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .25;
  background-image: radial-gradient(circle, var(--h-dot) .6px, transparent .6px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse at center, #000 40%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 40%, transparent 85%);
}
/* Character art slot (HOME_ART in js/home-fx.js): one character hugging
   each edge, faded and masked so it melts into the black toward the centre
   and the bottom — the old "swap the bg characters" concept, toned down so
   it never fights the title. */
.art-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.art-layer i {
  position: absolute; top: 4vh; bottom: 0; width: 44vw; display: block;
  background-repeat: no-repeat; background-size: auto 100%;
  opacity: var(--art-opacity, .22); filter: saturate(.85);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
.art-layer .art-left {
  left: -6vw; background-position: left bottom;
  -webkit-mask-image: linear-gradient(90deg, #000 30%, transparent 92%), linear-gradient(0deg, transparent 0%, #000 35%);
  mask-image: linear-gradient(90deg, #000 30%, transparent 92%), linear-gradient(0deg, transparent 0%, #000 35%);
}
.art-layer .art-right {
  right: -6vw; background-position: right bottom;
  -webkit-mask-image: linear-gradient(270deg, #000 30%, transparent 92%), linear-gradient(0deg, transparent 0%, #000 35%);
  mask-image: linear-gradient(270deg, #000 30%, transparent 92%), linear-gradient(0deg, transparent 0%, #000 35%);
}

/* Floating paths (21st.dev "Floating Paths" port) — drawn into a canvas
   by js/home-fx.js; this just places it and sets its colour/strength. */
.paths-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; color: var(--h-fg); opacity: .5; }
.paths-layer canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* A fixed 1000px disc moved with transform (js/home-fx.js) — moving the
   gradient's centre instead repainted the whole viewport on every mouse
   move, and every backdrop blur above it with it. */
.spotlight {
  position: fixed; left: 0; top: 0; width: 1000px; height: 1000px; z-index: 1; pointer-events: none;
  background: radial-gradient(500px circle at 50% 50%, rgba(255, 255, 255, .06), transparent 60%);
  transform: translate3d(calc(50vw - 500px), calc(30vh - 500px), 0);
  will-change: transform;
}
.corner-glow {
  position: absolute; top: 0; left: 0; right: 0; height: 220px; pointer-events: none; z-index: 2;
  background:
    radial-gradient(30% 100% at 0 0, var(--h-glow), transparent 70%),
    radial-gradient(30% 100% at 100% 0, var(--h-glow), transparent 70%);
}

/* ===== Header: transparent, turns into a glass pill after scrolling ===== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  max-width: 1600px; margin: 0 auto; padding: 24px clamp(16px, 6vw, 96px);
  transition: transform .4s cubic-bezier(.25, .1, .25, 1), opacity .4s;
}
.topbar.hidden { transform: translateY(-100px); opacity: 0; }
.topbar-row {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 8px 0; border-radius: 999px; border: 1px solid transparent;
  transition: padding .5s cubic-bezier(.23, 1, .32, 1), background .5s, border-color .5s;
}
.topbar.scrolled .topbar-row {
  padding: 12px 24px; background: var(--h-glass); border-color: var(--h-line);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
.clock {
  justify-self: start; cursor: default;
  font-family: 'JetBrains Mono', monospace; font-weight: 800; font-size: 24px; letter-spacing: .1em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--h-fg) 20%, var(--h-muted) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  transition: letter-spacing .3s;
}
.clock:hover { letter-spacing: .2em; }

.nav { display: flex; align-items: center; gap: 24px; position: relative; }
.nav > a, .nav-dd > button {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 20px; border-radius: 999px;
  font: 700 14px 'Inter', 'Anuphan', sans-serif; color: var(--h-muted); background: transparent; border: 0; cursor: pointer;
  transition: color .25s, background .25s;
}
.nav > a:hover, .nav-dd > button:hover { color: var(--h-fg); }
.nav > a[hidden] { display: none; } /* owner-only links (Auth.applyUserDisplay) */
.nav > a.active { background: var(--h-nav-active); color: var(--h-fg); }
/* Unread owner reply on contact.html: a dot on the Contact link (js/mascot.js). */
.nav > a[href^="contact.html"] { position: relative; }
.nav > a.has-unread::after {
  content: ""; position: absolute; top: 6px; right: 10px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--h-rose); box-shadow: 0 0 8px var(--h-rose);
}
/* Today's raid hit / ลอยกระทง still waiting: a dot on the Tools button, the
   กิลด์เรด card and the Event bar (js/auth.js markMenuTodo). */
.nav-dd > button.has-todo, .mega-event.has-todo { position: relative; }
.nav-dd > button.has-todo::after, .mega-event.has-todo::after, .mcard .todo-dot {
  content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--h-rose); pointer-events: none;
}
.nav-dd > button.has-todo::after { top: 6px; right: 10px; }
.mega-event.has-todo::after { top: 14px; right: 16px; }
.mcard .todo-dot { top: 12px; right: 12px; z-index: 1; }
.nav-dd > button .chev { transition: transform .3s; opacity: .5; }
.nav-dd.open > button { background: var(--h-nav-active); color: var(--h-fg); }
.nav-dd.open > button .chev { transform: rotate(180deg); }
.nav-dd > button .live { width: 7px; height: 7px; border-radius: 50%; background: var(--h-lime); box-shadow: 0 0 8px var(--h-lime); display: none; }
.nav-dd.open > button .live { display: block; }

.topbar-right { grid-column: 3; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
/* Re-skins style.css's shared .icon-btn (kept on these for js/mascot.js's
   #rankingBtn unread dot, which styles off .icon-btn-dot). */
/* Plain icons — no circle behind them; they brighten and move on hover. */
.topbar .icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 0; box-shadow: none;
  background: transparent; color: var(--h-muted); font-size: 15px;
  transition: color .25s, transform .25s cubic-bezier(.23, 1, .32, 1);
}
.topbar .icon-btn:hover { background: transparent; color: var(--h-fg); transform: scale(1.08); border: 0; }
.topbar .icon-btn:active { transform: scale(.95); }
.topbar .icon-btn:focus-visible { outline: 1px solid var(--h-line); outline-offset: 2px; }
/* Each header icon has its own small hover motion (on the svg, so the
   button's own scale still applies): trophy hops, wrench
   tightens, folder lifts open, logout arrow slides out. */
.topbar .icon-btn svg { transition: transform .45s cubic-bezier(.23, 1, .32, 1); }
.topbar #rankingBtn:hover svg { animation: h-ico-hop .6s cubic-bezier(.23, 1, .32, 1); }
.topbar #adminToolsBtn:hover svg { animation: h-ico-twist .7s ease-in-out; }
.topbar #ownerToolsBtn:hover svg { transform: translateY(-2px) rotate(-8deg) scale(1.08); }
.topbar #logoutBtn:hover svg { animation: h-ico-slide .7s ease-in-out; }
.topbar #contactBtn { display: none; position: relative; }
.topbar #contactBtn:hover svg { animation: h-ico-hop .6s cubic-bezier(.23, 1, .32, 1); }
.topbar #contactBtn.has-unread::after {
  content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--h-rose); box-shadow: 0 0 8px var(--h-rose);
}
@keyframes h-ico-hop { 0%, 100% { transform: none; } 35% { transform: translateY(-4px) rotate(-10deg); } 60% { transform: translateY(0) rotate(6deg); } 80% { transform: translateY(-1px) rotate(-2deg); } }
@keyframes h-ico-twist { 0%, 100% { transform: none; } 30% { transform: rotate(-35deg); } 60% { transform: rotate(15deg); } 80% { transform: rotate(-6deg); } }
@keyframes h-ico-slide { 0%, 100% { transform: none; } 45% { transform: translateX(4px); } 70% { transform: translateX(1px); } }
.topbar .icon-btn-dot { border-color: var(--h-bg); }
.topbar .icon-dropdown-menu {
  background: var(--h-mega-bg); border: 1px solid var(--h-line); border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
}
.topbar .icon-dropdown-menu a { color: var(--h-fg); }
.topbar .icon-dropdown-menu a:hover { background: var(--h-nav-active); }
.topbar .user-display-label { color: var(--h-muted); font-size: 12px; margin-right: 4px; }
.topbar .user-rank-badge { width: 28px; height: 28px; }

/* ===== Mega menu (Tools) ===== */
.mega {
  position: absolute; top: calc(100% + 20px); left: 50%; width: min(860px, calc(100vw - 32px));
  transform: translate(-50%, -10px) scale(.98); transform-origin: top center;
  display: grid; grid-template-columns: 1fr 264px;
  background: var(--h-mega-bg); border: 1px solid var(--h-line); border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .35s cubic-bezier(.23, 1, .32, 1);
}
.nav-dd.open .mega { opacity: 1; pointer-events: auto; transform: translate(-50%, 0) scale(1); }
.mega-main { padding: 20px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; align-content: start; }
.mega-side { padding: 16px; display: flex; flex-direction: column; gap: 12px; border-left: 1px solid var(--h-line); }
/* The current event, full width under both columns (window.SITE_EVENT in
   js/page-transition.js fills it in; hidden when there is none). */
.mega-event {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 16px;
  padding: 16px 22px; border-top: 1px solid var(--h-line); border-radius: 0 0 22px 22px;
  color: var(--h-fg); text-decoration: none; transition: background .25s;
}
.mega-event[hidden] { display: none; }
.mega-event:hover { background: var(--h-card-hover, #141414); }
.mega-event:focus-visible { outline: 2px solid var(--h-lime); outline-offset: -4px; }
.mega-event .me-kicker {
  flex-shrink: 0; padding: 3px 10px; border-radius: 999px; background: var(--h-yellow); color: #0a0a0a;
  font: 800 11px/1.4 'Inter', sans-serif; letter-spacing: .08em; text-transform: uppercase;
}
.mega-event .me-text { display: flex; flex-direction: column; min-width: 0; }
.mega-event .me-text b { font: 800 16px 'Anuphan', sans-serif; }
.mega-event .me-text small { font: 500 12.5px 'Anuphan', sans-serif; color: var(--h-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mega-event .me-arrow { margin-left: auto; flex-shrink: 0; color: var(--h-muted); transition: transform .3s cubic-bezier(.23, 1, .32, 1), color .3s; }
.mega-event:hover .me-arrow { transform: translateX(4px); color: var(--h-fg); }
@media (prefers-reduced-motion: reduce) { .mega-event .me-arrow { transition: none; } }

.mcard {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  border: 1px solid var(--h-line); border-radius: 16px; padding: 16px 18px;
  background: var(--h-mcard-bg); color: var(--h-fg); overflow: hidden; cursor: pointer; text-align: left;
  font: inherit;
  transition: border-color .3s, background .3s;
}
.mcard { transition: border-color .3s, background .3s, transform .5s cubic-bezier(.23, 1, .32, 1), box-shadow .5s; }
.mcard:hover { border-color: var(--h-lime-line); background: var(--h-mcard-hover); transform: translateY(-4px) scale(1.02); box-shadow: 0 18px 40px rgba(0, 0, 0, .5); }
/* diagonal sheen that fades in on hover */
.mcard::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .7s;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, .05) 50%, transparent 70%);
}
.mcard:hover::after { opacity: 1; }
.mcard h4 { margin: 0; font: 700 15px 'Anuphan', 'Inter', sans-serif; display: flex; align-items: center; gap: 8px; transition: color .3s; }
.mcard p { margin: 4px 0 0; font: 500 12px 'Anuphan', sans-serif; color: var(--h-muted); }
.mcard svg { color: var(--h-muted); transition: color .3s, transform .4s cubic-bezier(.23, 1, .32, 1); }
.mcard:hover h4, .mcard:hover svg { color: var(--h-lime); }
.mcard h4 .live { width: 7px; height: 7px; border-radius: 50%; background: var(--h-lime); box-shadow: 0 0 8px var(--h-lime); opacity: 0; transition: opacity .3s; }
.mcard:hover h4 .live { opacity: 1; }
.mcard.m-big { grid-column: span 3; min-height: 158px; padding: 20px; }
.mcard.m-big::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--h-grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--h-grid-line) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000 30%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent 100%);
}
.mcard.m-big .m-ico { position: absolute; top: 20px; left: 20px; }
.mcard.m-big .m-ico { z-index: 1; }
.mcard.m-big:hover .m-ico { transform: scale(1.1) rotate(-3deg); }
.mcard.m-big h4 { font-size: 17px; }
.mcard.m-big .m-img {
  position: absolute; right: -10px; top: -6px; width: 120px; opacity: .14; filter: grayscale(1) blur(1px);
  transition: opacity .4s, filter .4s, transform .5s cubic-bezier(.23, 1, .32, 1);
}
.mcard.m-big:hover .m-img { opacity: .5; filter: none; transform: scale(1.06) rotate(-4deg); }
.mcard.m-small { grid-column: span 2; min-height: 78px; justify-content: center; }
/* The event pages (ห้องช่าง, ค่ายตัดไม้) share the third row, half each. */
.mcard.m-small.m-event { grid-column: span 3; }
.mcard.m-small.m-wide { grid-column: span 3; } /* กิลด์เรด + บิงโกวอร์ share the last war row */
/* Third row: the new pages (กิลด์เรด, โรงตีเหล็ก, บิงโกวอร์). Raid + forge were
   staging-only (data-staging) until 2026-11-13; now shown everywhere. */
.m-new { display: none; padding: 1px 6px; border-radius: 999px; background: var(--h-yellow); color: #0a0a0a; font: 800 9.5px/1.4 'Inter', sans-serif; letter-spacing: .04em; vertical-align: 2px; }
html.menu-new .m-new { display: inline-block; }
.m-must { display: inline-block; padding: 1px 6px; border-radius: 999px; background: var(--h-rose); color: #fff; font: 800 9.5px/1.4 'Inter', sans-serif; letter-spacing: .04em; vertical-align: 2px; }
/* Small cards: icon sits in a little rounded chip that lights up; icon
   grows 1.25× and tilts 12°. Row cards: card slides left, icon 1.25× / -6°. */
.mcard.m-small svg, .mcard.m-row svg { position: absolute; top: 18px; right: 18px; box-sizing: content-box; padding: 6px; margin: -6px; border-radius: 10px; transition: color .3s, transform .5s cubic-bezier(.23, 1, .32, 1), background .3s; }
.mcard.m-small:hover svg { transform: scale(1.25) rotate(12deg); background: var(--h-card-hover); }
.mcard.m-row { flex: 1; justify-content: center; min-height: 76px; padding-right: 50px; }
.mcard.m-row svg { top: 50%; transform: translateY(-50%); }
.mcard.m-row:hover { transform: translateX(-4px) scale(1.02); }
.mcard.m-row:hover svg { transform: translateY(-50%) scale(1.25) rotate(-6deg); }
.mcard > * { position: relative; }
.mcard.m-big > .m-img, .mcard.m-big > .m-ico, .mcard.m-small > svg, .mcard.m-row > svg, .mcard > .m-snake { position: absolute; }

/* Big cards: four little squares wander the background grid (random walk
   built in js/home-fx.js), faint at rest and brighter on hover. */
.m-snake { inset: 0; pointer-events: none; overflow: hidden; opacity: .3; transition: opacity .7s; }
.mcard:hover .m-snake { opacity: 1; }
.m-snake i { position: absolute; top: 0; left: 0; width: 22px; height: 22px; background: rgba(255, 255, 255, .06); }
.m-snake i:first-child { background: rgba(255, 255, 255, .12); }
/* The page you're already on (js/home-fx.js marks it) */
.mcard.current { border-color: var(--h-lime-line); box-shadow: 0 0 15px rgba(190, 242, 100, .06); }
.mcard.current h4, .mcard.current svg { color: var(--h-lime); }
.mcard.current h4 .live { display: none; }
/* pulsing "you are here" dot, like the reference's animate-ping */
.mcard.current h4::after {
  content: ''; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--h-lime); box-shadow: 0 0 6px var(--h-lime);
  animation: h-ping 1.6s cubic-bezier(0, 0, .2, 1) infinite;
}
@keyframes h-ping { 0% { box-shadow: 0 0 0 0 rgba(190, 242, 100, .7), 0 0 6px var(--h-lime); } 80%, 100% { box-shadow: 0 0 0 7px rgba(190, 242, 100, 0), 0 0 6px var(--h-lime); } }
/* Guild picker over the menu — account pages have no ?guild=, so a guild
   card there asks which guild first (js/home-fx.js openGuildPick). */
.mega-guilds {
  position: absolute; inset: 0; z-index: 5; border-radius: inherit;
  background: var(--h-mega-bg); padding: 24px 28px; display: flex; flex-direction: column; gap: 18px;
  animation: mg-in .3s cubic-bezier(.23, 1, .32, 1);
}
.mega-guilds[hidden] { display: none; }
@keyframes mg-in { from { opacity: 0; transform: translateY(6px); } }
.mg-head { display: flex; align-items: center; gap: 14px; }
.mg-head h4 { margin: 2px 0 0; font: 700 20px 'Anuphan', 'Inter', sans-serif; color: var(--h-fg); }
.mg-kicker { font: 600 11px 'Inter', sans-serif; letter-spacing: .18em; text-transform: uppercase; color: var(--h-muted); }
.mg-back {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--h-line); background: var(--h-mcard-bg);
  color: var(--h-fg); display: grid; place-items: center; cursor: pointer; transition: border-color .3s, color .3s;
}
.mg-back:hover { border-color: var(--h-lime-line); color: var(--h-lime); }
.mg-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.mg-row {
  position: relative; width: 100%; text-align: left; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; gap: 4px; padding: 18px 48px 18px 18px;
  border: 1px solid var(--h-line); border-radius: 16px; background: var(--h-mcard-bg); color: var(--h-fg);
  transition: border-color .3s, background .3s, transform .5s cubic-bezier(.23, 1, .32, 1);
}
.mg-row:hover, .mg-row:focus-visible { border-color: var(--h-lime-line); background: var(--h-mcard-hover); transform: translateY(-3px); outline: none; }
.mg-name { font: 700 17px 'Anuphan', 'Inter', sans-serif; }
.mg-meta { font: 500 12px 'Anuphan', sans-serif; color: var(--h-muted); }
.mg-row svg { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--h-muted); transition: color .3s, transform .4s cubic-bezier(.23, 1, .32, 1); }
.mg-row:hover svg, .mg-row:focus-visible svg { color: var(--h-lime); transform: translate(4px, -50%); }
.mg-row:hover .mg-name { color: var(--h-lime); }

/* Admin-only pages collapse out of the grid for member-only sessions */
.mcard[hidden] { display: none; }

/* Side tab (announcement doc): css/mascot.css .side-tab, on every page. */

/* ===== Main ===== */
.home-v2 main { position: relative; z-index: 10; }

.hero {
  min-height: 100svh; display: flex; flex-direction: column; justify-content: center;
  padding: 130px clamp(16px, 4vw, 48px) 60px; max-width: 105rem; margin: 0 auto;
}
.hero-hello {
  font-family: 'Anuphan', sans-serif; font-size: clamp(13px, 1.1vw, 16px); color: var(--h-muted); margin: 0 0 18px;
  display: flex; align-items: center; gap: 10px;
}
.hero-hello::before { content: ''; width: 28px; height: 1px; background: var(--h-muted); }
.hero-hello strong { color: var(--h-fg); }
/* Black Friday sale tag after the greeting: black card, gold hairline, foil FRIDAY (matches .um-bf) */
.hero-hello { flex-wrap: wrap; }
.bf-pill {
  display: inline-flex; align-items: center; gap: 10px; margin-left: 10px; padding: 5px 12px 5px 6px; border-radius: 999px;
  background: #0a0a0a; box-shadow: inset 0 0 0 1px rgba(201, 162, 74, .55); color: #d6d3d1; text-decoration: none;
  font: 500 13px 'Anuphan', sans-serif; transition: box-shadow .2s, color .2s;
}
.bf-pill[hidden] { display: none; }
.bf-pill b { display: inline-flex; align-items: baseline; gap: 3px; padding: 4px 8px; border-radius: 999px; background: #161412; color: #f5f5f4; font: 800 10px/1 'Inter', sans-serif; letter-spacing: .08em; }
.bf-pill b i { font-style: normal; background: linear-gradient(180deg, #fde68a 0%, #d4a53c 55%, #f5d98a 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bf-pill span { white-space: nowrap; }
/* Black Friday bar across the top of index (in flow, above the fixed .topbar) */
.bf-bar { position: relative; z-index: 51; background: #0a0a0a; border-bottom: 1px solid rgba(201, 162, 74, .35); }
.bf-bar[hidden] { display: none; }
.bf-bar-link {
  display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 40px; padding: 8px 52px;
  color: #d6d3d1; font: 500 13.5px 'Anuphan', sans-serif; text-decoration: none;
}
.bf-bar-link b { display: inline-flex; align-items: baseline; gap: 4px; font: 800 11px/1 'Inter', sans-serif; letter-spacing: .12em; color: #f5f5f4; }
.bf-bar-link b i { font-style: normal; background: linear-gradient(180deg, #fde68a 0%, #d4a53c 55%, #f5d98a 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bf-bar-sep { width: 1px; height: 14px; background: rgba(201, 162, 74, .4); }
.bf-bar-go { display: inline-flex; align-items: center; gap: 6px; color: #e7c873; font-weight: 700; white-space: nowrap; }
.bf-bar-go svg { transition: transform .2s; }
.bf-bar-link:hover .bf-bar-go svg { transform: translateX(2px); }
.bf-bar-x {
  position: absolute; right: 10px; top: 50%; translate: 0 -50%; width: 30px; height: 30px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: none; color: #78716c; cursor: pointer;
}
.bf-bar-x:hover { color: #e7e5e4; }
@media (max-width: 640px) {
  .bf-bar-link { justify-content: flex-start; gap: 10px; padding: 8px 44px 8px 16px; font-size: 12.5px; white-space: nowrap; }
  .bf-bar-sep, .bf-bar-long { display: none; }
}
.bf-pill svg { flex: none; color: #c9a24a; transition: transform .2s; }
.bf-pill:hover { color: #fff; box-shadow: inset 0 0 0 1px #c9a24a; }
.bf-pill:hover svg { transform: translateX(2px); }
@media (max-width: 640px) { .bf-pill { margin-left: 0; font-size: 12.5px; } .hero-hello { row-gap: 10px; } }
/* Infinity Castle collab pill (html.collab-ic is set by js/page-transition.js
   through 28 Oct): 滅 seal, amber lantern border, a slow light sweep. */
html.collab-ic .collab-pill {
  display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; position: relative; overflow: hidden;
  margin: -6px 0 22px; padding: 6px 14px 6px 6px; border-radius: 999px;
  border: 1px solid rgba(255,170,100,.28); background: linear-gradient(90deg, rgba(196,30,58,.16), rgba(255,140,60,.06));
  font: 500 13px 'Anuphan', sans-serif; color: rgba(255,225,200,.85);
}
.collab-pill b { font-family: 'Inter', sans-serif; font-weight: 600; color: #fff; }
.collab-seal {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: #c41e3a; color: #fff; font: 700 13px/1 'Yu Mincho', 'Hiragino Mincho ProN', 'Noto Serif JP', serif;
}
.collab-end { color: rgba(255,200,150,.6); font-size: 12px; padding-left: 10px; border-left: 1px solid rgba(255,170,100,.25); }
.collab-pill::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 35%, rgba(255,200,150,.18) 50%, transparent 65%);
  transform: translateX(-100%); animation: collab-sweep 5s ease-in-out infinite 1.5s;
}
@keyframes collab-sweep { 30%, 100% { transform: translateX(100%); } }
@media (max-width: 560px) { .collab-end { display: none; } }
@media (prefers-reduced-motion: reduce) { .collab-pill::after { animation: none; } }
/* Halloween pill (html.halloween, 29 Oct – 4 Nov): pumpkin seal, orange
   to purple, same sweep as the collab pill; links to ห้องช่าง. */
html.halloween .hw-pill {
  display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; position: relative; overflow: hidden;
  margin: -6px 0 22px; padding: 6px 14px 6px 6px; border-radius: 999px; text-decoration: none;
  border: 1px solid rgba(255,150,60,.3); background: linear-gradient(90deg, rgba(249,115,22,.18), rgba(126,34,206,.14));
  font: 500 13px 'Anuphan', sans-serif; color: rgba(255,225,200,.85); transition: border-color .2s;
}
html.halloween .hw-pill:hover { border-color: rgba(255,170,90,.6); }
.hw-pill b { font-family: 'Inter', sans-serif; font-weight: 600; color: #fdba74; }
.hw-seal { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #2e1065; font-size: 13px; line-height: 1; }
.hw-pill::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 35%, rgba(255,200,150,.18) 50%, transparent 65%);
  transform: translateX(-100%); animation: collab-sweep 5s ease-in-out infinite 1.5s;
}
@media (prefers-reduced-motion: reduce) { .hw-pill::after { animation: none; } }
/* Stacked title like the reference hero: rows sit flush (no gap), each
   row centred but nudged — TDERM left of centre, GUILD right of centre,
   W⚔R H🛡B centred — so the three short words interlock instead of
   drifting to opposite edges. Letters inside a .hero-word sit flush. */
.hero-row { display: flex; align-items: center; gap: clamp(12px, 3vw, 40px); position: relative; }
.hero-row.r1 { justify-content: center; padding-right: 14%; }
.hero-row.r2 { justify-content: center; padding-left: 20%; }
.hero-row.r3 { justify-content: center; gap: clamp(20px, 3vw, 56px); }
.hero-word { display: flex; align-items: center; position: relative; }

/* Small floating guild shortcuts around the title (Lucide cat → เสือหนิก,
   paw-print → หนิกเสือ, crown → LEGENDS; js/home.js shows only the guilds
   this session can reach), bobbing on the reference's timings: y -10px 2s, y +10px 2.5s,
   x +10px 3s. Offsets are in em of the giant title so they track its size. */
.float-icon {
  position: absolute; z-index: 2; width: clamp(22px, 2.3vw, 38px); height: clamp(22px, 2.3vw, 38px);
  color: var(--h-muted); opacity: .75; transition: color .3s, opacity .3s, scale .3s;
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; /* buttons default to ~13px, which would shrink the em offsets below */
}
.float-icon[hidden] { display: none; }
.float-icon svg { width: 100%; height: 100%; display: block; }
.float-icon:hover, .float-icon:focus-visible { color: var(--h-fg); opacity: 1; scale: 1.15; }
.fi-tderm { top: -.12em; right: -.32em; }
.fi-guild { top: .28em; left: -.5em; }
.fi-hub { top: .02em; right: -.42em; }
.fi-egg { top: -.08em; right: -.42em; }
.fi-iris { top: .04em; left: -.3em; }
.float-y { animation: h-float-y 2s ease-in-out infinite alternate; }
.float-y2 { animation: h-float-y2 2.5s ease-in-out infinite alternate; }
.float-x { animation: h-float-x 3s ease-in-out infinite alternate; }
@keyframes h-float-y { to { translate: 0 -10px; } }
@keyframes h-float-y2 { to { translate: 0 10px; } }
@keyframes h-float-x { to { translate: 10px 0; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.big {
  margin: 0; font-size: clamp(3.2rem, 14vw, 15rem); font-weight: 900; line-height: .85; letter-spacing: -.06em;
  display: flex; align-items: center;
}
.shiny {
  color: transparent; -webkit-text-fill-color: transparent;
  background-image: linear-gradient(120deg, var(--h-shine-a) 30%, var(--h-shine-b) 50%, var(--h-shine-a) 70%);
  background-size: 200%; -webkit-background-clip: text; background-clip: text;
  animation: h-shine 4s linear infinite;
}
/* background-clip:text only paints inside the element's box, and the tight
   negative letter-spacing makes that box narrower than the glyph ink — so
   the right edge of D/W/R/B got sliced off. Pad the box out and pull it back
   with an equal negative margin: glyphs stay where they were, fully painted. */
.hero-word .shiny, .gate-big.shiny { padding: .1em .12em; margin: -.1em -.12em; }
@keyframes h-shine { from { background-position: 100% 0; } to { background-position: -100% 0; } }
/* Hero title: every letter span shares ONE gradient sized to the whole title,
   each shifted by its own offset (--sx/--sy, set by syncHeroShine in
   js/home.js), so a single highlight sweeps across the full text instead of
   each letter flashing on its own. Without JS it falls back to the above. */
.hero-title.shine-sync .shiny {
  background-size: calc(var(--tw) * 2) var(--th);
  animation: h-shine-sync 5s linear infinite;
}
@keyframes h-shine-sync {
  from { background-position: calc(-1 * var(--tw) - var(--sx)) calc(-1 * var(--sy)); }
  to { background-position: calc(var(--tw) - var(--sx)) calc(-1 * var(--sy)); }
}
.glyph { width: .78em; height: .78em; margin: 0 .04em; cursor: pointer; transition: transform .5s cubic-bezier(.23, 1, .32, 1), filter .3s; flex-shrink: 0; }
.glyph:hover { transform: rotate(-14deg) scale(1.08); filter: drop-shadow(0 0 22px currentColor); }
.glyph.sword { color: var(--h-sky); }
/* Idle motion, same timing as the reference hero: the A-swords pulse
   (scale 1 → 1.2, 0.6s each way) and the shield sways like its robot head
   (rotate 8° + float up 10px, 1.8s each way). On the wrapper so the
   svg's own hover transform above still works on top. */
.glyph-wrap { display: inline-flex; will-change: transform; }
.anim-pulse { animation: h-glyph-pulse 1.2s ease-in-out infinite; }
.anim-sway { animation: h-glyph-sway 3.6s ease-in-out infinite; }
@keyframes h-glyph-pulse { 50% { transform: scale(1.2); } }
@keyframes h-glyph-sway { 50% { transform: rotate(8deg) translateY(-10px); } }
.glyph.shield { color: var(--h-yellow); }
/* Infinity Castle collab swaps (html.collab-ic, through 28 Oct): the
   A-swords become one nichirin katana, the shield a 滅 seal. */
.collab-only { display: none; }
html.collab-ic .collab-only { display: inline-flex; }
html.collab-ic .collab-off { display: none; }
/* Halloween swaps (html.halloween): witch's hat for the A, cauldron for the U */
.hw-only { display: none; }
html.halloween .hw-only { display: inline-flex; }
html.halloween .collab-off { display: none; }
.glyph.witch-hat, .glyph.cauldron { overflow: visible; }
.glyph.witch-hat:hover { filter: drop-shadow(0 0 .12em rgba(167,139,250,.8)); }
.glyph.cauldron:hover { filter: drop-shadow(0 0 .12em rgba(132,204,22,.8)); }
.glyph.cauldron .bub { animation: h-bubble 1.8s ease-in infinite; }
.glyph.cauldron .b2 { animation-delay: .6s; }
.glyph.cauldron .b3 { animation-delay: 1.2s; }
@keyframes h-bubble { 0% { transform: translateY(4px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-4px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .glyph.cauldron .bub { animation: none; } }
.glyph.nichirin { color: #ef4444; }
.glyph.metsu {
  display: grid; place-items: center; width: .66em; height: .66em; margin: .06em .1em; border-radius: .08em;
  background: #c41e3a; color: #c41e3a; box-shadow: inset 0 0 0 .025em rgba(255,255,255,.35), 0 0 0 .02em #c41e3a;
  transform: rotate(-6deg);
}
/* letter-spacing reset: .big's -.06em would pull the kanji off-centre */
.glyph.metsu b { color: #fff; font: 700 .46em/1 'Noto Serif JP', 'Yu Mincho', 'Hiragino Mincho ProN', serif; letter-spacing: 0; }
.glyph.metsu:hover { transform: rotate(-14deg) scale(1.08); }
/* Hover = fire aura: a flickering orange glow round the seal, and flame
   tongues licking up off its top edge (on ::after, above the box, so the
   seal's own red face stays clean). The katana gets the same flicker as a
   drop-shadow. Static glow only under reduced motion. */
.glyph.metsu { position: relative; }
.glyph.metsu::after {
  content: ""; position: absolute; left: -12%; right: -12%; bottom: 70%; height: 95%; pointer-events: none;
  background:
    radial-gradient(38% 70% at 50% 100%, #fff3b0 0 18%, #ffb020 40%, transparent 72%),
    radial-gradient(22% 58% at 22% 100%, #ff8a00 0 30%, transparent 70%),
    radial-gradient(22% 62% at 78% 100%, #ff5a00 0 30%, transparent 70%),
    radial-gradient(55% 90% at 50% 100%, rgba(255, 60, 0, .55), transparent 70%);
  filter: blur(.012em); mix-blend-mode: screen; transform-origin: 50% 100%;
  opacity: 0; transform: scaleY(.3); transition: opacity .25s, transform .35s cubic-bezier(.23, 1, .32, 1);
}
.glyph.metsu:hover::after { opacity: 1; transform: scaleY(1); animation: h-flame 0.45s ease-in-out infinite alternate; }
.glyph.metsu:hover { animation: h-fire-aura .6s ease-in-out infinite alternate; }
.glyph.nichirin:hover { animation: h-fire-blade .6s ease-in-out infinite alternate; }
@keyframes h-flame {
  0%   { transform: scaleY(.9) scaleX(1) skewX(-3deg); }
  50%  { transform: scaleY(1.12) scaleX(.94) skewX(2deg); }
  100% { transform: scaleY(.98) scaleX(1.04) skewX(-1deg); }
}
@keyframes h-fire-aura {
  from { box-shadow: inset 0 0 0 .025em rgba(255,255,255,.35), 0 0 0 .02em #ff7a1a, 0 0 .08em #ff9a2e, 0 -.05em .2em rgba(255, 90, 0, .7), 0 0 .38em rgba(255, 40, 0, .35); }
  to   { box-shadow: inset 0 0 0 .025em rgba(255,255,255,.5), 0 0 0 .02em #ffb347, 0 0 .12em #ffb347, 0 -.1em .3em rgba(255, 120, 0, .8), 0 0 .5em rgba(255, 50, 0, .45); }
}
/* Katana fire: dashes run along the two spiral waves (index.html), so the
   flame swirls up round the blade from the tsuba to the tip. */
.glyph.nichirin { overflow: visible; }
.glyph.nichirin .fire { stroke-dasharray: 3.2 2.2; opacity: 0; transition: opacity .25s; }
.glyph.nichirin:hover .fire { opacity: 1; animation: h-fire-swirl .7s linear infinite; }
.glyph.nichirin:hover .fire-back { opacity: .7; animation-delay: -.35s; }
@keyframes h-fire-swirl { to { stroke-dashoffset: -10.8; } }
@keyframes h-fire-blade {
  from { filter: drop-shadow(0 0 .04em #ffb347) drop-shadow(0 -.04em .12em #ff5a00); }
  to   { filter: drop-shadow(0 0 .07em #ffd27a) drop-shadow(0 -.07em .2em #ff3d00); }
}
@media (prefers-reduced-motion: reduce) {
  .glyph.metsu:hover, .glyph.metsu:hover::after, .glyph.nichirin:hover, .glyph.nichirin:hover .fire { animation: none; }
  .glyph.metsu:hover { box-shadow: inset 0 0 0 .025em rgba(255,255,255,.4), 0 0 0 .02em #ff9a2e, 0 0 .1em #ff9a2e, 0 -.08em .26em rgba(255, 90, 0, .7); }
}
.side-note { margin: 0; max-width: 300px; line-height: 1.7; }
/* Sized up (was 12px) so the two notes hold their own beside the 14vw title */
.side-note.th { letter-spacing: .04em; text-transform: none; font-size: clamp(13px, 1.25vw, 19px); font-weight: 600; color: var(--h-muted); }

.reveal { opacity: 0; transform: translateY(40px); filter: blur(8px); transition: opacity 1s cubic-bezier(.23, 1, .32, 1), transform 1s cubic-bezier(.23, 1, .32, 1), filter 1s cubic-bezier(.23, 1, .32, 1); }
.ready .reveal { opacity: 1; transform: none; filter: none; }
.ready .reveal.d1 { transition-delay: .1s; }
.ready .reveal.d2 { transition-delay: .2s; }
.ready .reveal.d3 { transition-delay: .3s; }
.ready .reveal.d4 { transition-delay: .45s; }

.cta-line { display: flex; align-items: center; gap: 24px; margin-top: clamp(40px, 7vw, 90px); padding-right: 150px; } /* clear the fixed mascot (css/mascot.css) bottom-right */
.cta-line .rule { flex: 1; height: 1px; background: var(--h-line); }
/* To-do chips under the logo (js/home.js renderHeroTodo): icon + a few words,
   in each card's colour (quiz yellow, ค่ายตัดไม้ wood, บิงโก lime). */
.hero-todo { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: clamp(28px, 4vw, 48px); }
.hero-todo[hidden] { display: none; }
.hero-todo { align-items: center; }
.todo-lead { display: inline-flex; align-items: center; gap: 10px; margin-right: 4px; font: 600 12px 'Anuphan', sans-serif; letter-spacing: .06em; color: var(--h-muted); }
.todo-lead::before { content: ''; width: 28px; height: 1px; background: var(--h-muted); }
.todo-act { font-weight: 500; color: var(--h-muted); }
.todo-act::before { content: '·'; margin-right: 6px; opacity: .6; }
@media (max-width: 560px) { .todo-lead { flex-basis: 100%; justify-content: center; margin: 0 0 2px; } }
.todo-chip {
  --c: var(--h-yellow);
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 5px; border-radius: 999px; text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); background: color-mix(in srgb, var(--c) 7%, rgba(10, 10, 10, .55));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--h-fg); font: 700 13px/1 'Anuphan', 'Inter', sans-serif; white-space: nowrap;
  transition: transform .25s cubic-bezier(.23, 1, .32, 1), border-color .2s, background .2s;
}
.todo-chip:hover { transform: translateY(-2px); border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, rgba(10, 10, 10, .55)); }
.todo-chip:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 3px; }
.todo-ico { box-sizing: border-box; display: grid; place-items: center; flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--c); color: #0a0a0a; font: 800 13px 'JetBrains Mono', monospace; }
.todo-ico svg { width: 13px; height: 13px; }
.todo-lumber { --c: #d39a5b; }
.todo-loy { --c: #facc15; }
.todo-loy .todo-ico svg { width: 16px; height: 16px; }
.todo-bael { --c: #c4b5fd; }
.todo-bael .todo-ico svg { width: 16px; height: 16px; }
.todo-raid { --c: #fb7185; }
.todo-bingo { --c: var(--h-lime); }
.todo-bingo .todo-ico { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); place-items: stretch; gap: 1.5px; padding: 6px; background: #141414; border: 1px solid rgba(190, 242, 100, .35); }
.todo-bingo .todo-ico i { border-radius: 1px; background: #333; }
.todo-bingo .todo-ico i.on { background: var(--h-lime); }
/* งานวันนี้ panel (index.html #todayPanel): the to-do chips and, under a
   hairline, the ลอยกระทง trade requests (js/home.js renderLoyAsks). One frame
   in the site's mono style; yellow only marks the ลอยกระทง part. */
.today-panel {
  box-sizing: border-box; width: fit-content; min-width: min(560px, 100%); max-width: 100%; margin: clamp(28px, 4vw, 48px) auto 0; padding: 14px 18px;
  border: 1px solid var(--h-line); border-radius: 20px; background: rgba(10, 10, 10, .6);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.today-panel[hidden] { display: none; }
.today-panel .hero-todo { margin-top: 0; }
/* louder than the rest of the hero so it isn't skipped: a white heading line
   with the count on top, bigger chips under it, a brighter frame */
.today-panel { padding: 16px 20px 18px; border-color: rgba(250, 250, 250, .18); background: rgba(12, 12, 12, .82); }
.today-panel .todo-lead { flex-basis: 100%; justify-content: center; margin: 0 0 6px; font: 800 18px 'Anuphan', sans-serif; letter-spacing: .02em; color: var(--h-fg); }
.today-panel .todo-lead::before { display: none; }
/* the count is plain muted text after the heading, not a pill, so it doesn't read as one more chip */
.todo-count { font: 600 15px 'Anuphan', sans-serif; color: var(--h-fg); }
/* the number itself is the loud part: big yellow digit, no box */
.todo-count em { font: 800 22px/1 'Inter', sans-serif; font-style: normal; color: var(--h-yellow); margin: 0 2px; vertical-align: -2px; }
.todo-count::before { content: '·'; margin-right: 8px; opacity: .6; }
.today-panel .todo-chip { gap: 10px; padding: 7px 16px 7px 7px; font-size: 14px; }
.today-panel .todo-ico { width: 28px; height: 28px; }
.today-panel .todo-ico svg { width: 15px; height: 15px; }
.loy-asks {
  --c: #facc15;
  display: flex; flex-direction: column; gap: 6px; padding: 10px 10px 8px; border-radius: 12px; text-decoration: none;
  color: var(--h-fg); font: 500 13px/1.4 'Anuphan', sans-serif; text-align: left;
  transition: background-color .2s;
}
.loy-asks[hidden] { display: none; }
/* a hairline between the chips and the requests, only when both show */
.today-panel:has(.hero-todo:not([hidden])) .loy-asks { margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--h-line); border-radius: 0 0 12px 12px; }
.loy-asks:hover { background: rgba(255, 255, 255, .03); }
.loy-asks:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 2px; }
.la-head { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--c); }
.la-head b { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--c); color: #0a0a0a; font: 800 12px 'Inter', sans-serif; }
.la-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.la-item { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 2px; border-top: 1px solid rgba(255, 255, 255, .06); }
.la-item:first-child { border-top: 0; }
.la-item b { flex: 0 1 auto; min-width: 0; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.la-deal { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.la-deal small { color: var(--h-muted); font-size: 12px; }
.la-ico { position: relative; display: inline-grid; place-items: center; flex-shrink: 0; box-sizing: border-box; width: 28px; height: 28px; border-radius: 9px; border: 1px solid var(--h-line); background: #0d0d0d; }
.la-ico svg { width: 20px; height: 20px; overflow: visible; }
.la-ico i { position: absolute; right: -6px; bottom: -6px; padding: 0 4px; border-radius: 999px; background: #e5e5e5; color: #0a0a0a; font: 800 9.5px/1.5 'Inter', sans-serif; font-style: normal; }
.la-swap { margin: 0 2px 0 4px; color: #737373; font: 700 13px 'Inter', sans-serif; }
.la-item em { flex-shrink: 0; font-style: normal; padding: 1px 8px; border-radius: 999px; background: var(--c); color: #0a0a0a; font: 700 11px 'Anuphan', sans-serif; }
.la-item.is-own b { color: var(--h-muted); font-weight: 600; }
.la-wait { flex-shrink: 0; color: var(--h-muted); font-size: 12px; }
.la-wait.is-got { color: var(--h-lime); font-weight: 700; }
.la-foot { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.la-more { color: var(--h-muted); }
.la-go { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--c); font-weight: 700; }
.la-go svg { width: 14px; height: 14px; }
@media (prefers-reduced-motion: no-preference) {
  .la-go svg { transition: translate .25s cubic-bezier(.23, 1, .32, 1); }
  .loy-asks:hover .la-go svg, .loy-asks:focus-visible .la-go svg { translate: 3px 0; }
}
@media (max-width: 560px) { .today-panel { padding: 12px 10px; border-radius: 16px; } .la-deal small { display: none; } .la-item.is-own .la-deal + .la-wait { font-size: 11.5px; } }
/* something to collect / a deadline today: a soft pulse on the icon */
.todo-chip.hot .todo-ico { animation: todo-pulse 2s ease-in-out infinite; }
@keyframes todo-pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .todo-chip { transition: none; } .todo-chip:hover { transform: none; } .todo-chip.hot .todo-ico { animation: none; } }
.status { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 10px #22c55e; }
.cta-pill {
  position: relative; display: flex; align-items: center; height: 52px; width: 52px;
  background: var(--h-pill-bg); color: var(--h-pill-fg) !important; border-radius: 999px; overflow: hidden;
  transition: width .6s cubic-bezier(.23, 1, .32, 1); box-shadow: 0 20px 40px rgba(0, 0, 0, .3); flex-shrink: 0;
}
.cta-pill:hover, .cta-pill:focus-visible { width: 200px; }
.cta-pill-text {
  white-space: nowrap; opacity: 0; transition: opacity .2s; padding: 0 56px 0 24px;
  font: 800 12px 'Anuphan', sans-serif; letter-spacing: .08em;
}
.cta-pill:hover .cta-pill-text, .cta-pill:focus-visible .cta-pill-text { opacity: 1; transition-delay: .15s; }
.cta-pill-icon { position: absolute; right: 0; width: 52px; height: 52px; display: grid; place-items: center; transition: transform .6s cubic-bezier(.23, 1, .32, 1); }
.cta-pill:hover .cta-pill-icon { transform: rotate(-45deg); }

/* ===== Marquee ===== */
.marquee {
  border-block: 1px solid var(--h-line); overflow: hidden; padding: 18px 0;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
body[data-state="guest"] .marquee, body[data-state="blocked"] .marquee { margin-top: 100px; }
.marquee-track { display: flex; gap: 48px; width: max-content; animation: h-scroll 40s linear infinite; }
.marquee-track span { font-size: clamp(1.1rem, 2.4vw, 1.8rem); font-weight: 800; white-space: nowrap; color: var(--h-muted); display: flex; align-items: center; gap: 48px; }
.marquee-track span::after { content: '✦'; font-size: .6em; color: var(--h-fg); }
@keyframes h-scroll { to { transform: translateX(-50%); } }

/* ===== Sections ===== */
section.block { scroll-margin-top: 90px; max-width: 105rem; margin: 0 auto; padding: clamp(70px, 10vw, 140px) clamp(16px, 4vw, 48px); }
.block-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 40px; flex-wrap: wrap; }
.block-title { margin: 0; font-family: 'Anuphan', sans-serif; font-size: clamp(2rem, 5vw, 4rem); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.block-title small { display: block; font-family: 'Inter'; margin-bottom: 14px; }

/* Guest login / blocked notices */
.gate { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 80px); align-items: center; min-height: 60vh; }
.gate-big { margin: 0; font-size: clamp(2.6rem, 7vw, 6.5rem); font-weight: 900; line-height: .9; letter-spacing: -.05em; }
.gate-big.th { font-size: clamp(2.2rem, 5.5vw, 5rem); line-height: 1.05; letter-spacing: -.02em; }
.gate-card { border: 1px solid var(--h-line); border-radius: 28px; padding: 32px; background: var(--h-card); backdrop-filter: blur(6px); }
.gate-card > p { font-family: 'Anuphan', sans-serif; color: var(--h-muted); font-size: 14px; line-height: 1.7; margin: 0 0 22px; }
.btn-discord-v2 {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: #5865F2; color: #fff !important; border: 0; border-radius: 999px; padding: 16px 20px;
  font: 700 15px 'Anuphan', sans-serif; cursor: pointer; transition: transform .3s, box-shadow .3s;
}
.btn-discord-v2:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(88, 101, 242, .4); }
.btn-ghost-v2 {
  display: block; width: 100%; margin-top: 12px; background: transparent; color: var(--h-fg);
  border: 1px solid var(--h-line); border-radius: 999px; padding: 15px 20px; font: 600 14px 'Anuphan', sans-serif; cursor: pointer;
  transition: border-color .3s, background .3s;
}
.btn-ghost-v2:hover { border-color: var(--h-fg); background: var(--h-card-hover); }
.gate-card > .gate-error { color: #fecdd3; background: color-mix(in srgb, var(--h-rose) 14%, transparent); border: 1px solid color-mix(in srgb, var(--h-rose) 45%, transparent); border-radius: 14px; padding: 12px 14px; margin: 0 0 18px; }
.gate-notice { font-family: 'Anuphan', sans-serif; font-size: 11px; line-height: 1.7; color: var(--h-muted); margin: 22px 0 0; padding-top: 18px; border-top: 1px dashed var(--h-line); }

/* Guild picker list */
.guild-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--h-line); }
.guild-row {
  position: relative; display: grid; grid-template-columns: 70px 1fr auto 60px; align-items: center; gap: 16px;
  padding: clamp(22px, 3vw, 38px) 8px; border: 0; border-bottom: 1px solid var(--h-line);
  cursor: pointer; overflow: hidden; width: 100%; background: none;
  color: inherit; text-align: left; font: inherit;
}
.guild-row::before {
  content: ''; position: absolute; inset: 0; background: var(--h-fg); transform: scaleY(0); transform-origin: bottom;
  transition: transform .55s cubic-bezier(.23, 1, .32, 1); z-index: 0;
}
.guild-row:hover::before { transform: scaleY(1); }
.guild-row > * { position: relative; z-index: 1; transition: color .4s, transform .55s cubic-bezier(.23, 1, .32, 1), border-color .4s; }
.guild-row:hover > *, .guild-row:hover .label { color: var(--h-bg); }
.guild-row:hover .g-name { transform: translateX(18px); }
.g-num { font-size: 12px; color: var(--h-muted); }
.g-name { font-family: 'Anuphan', 'Inter', sans-serif; font-size: clamp(1.8rem, 6vw, 5rem); font-weight: 800; line-height: 1.1; letter-spacing: -.03em; }
.g-meta { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.g-dest { font: 600 13px 'Anuphan', sans-serif; color: var(--h-lime); }
.guild-row:hover .g-dest { color: var(--h-bg); }
.g-arrow { justify-self: end; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--h-line); display: grid; place-items: center; }
.guild-row:hover .g-arrow { transform: rotate(-45deg); border-color: var(--h-bg); }
/* Which page the guild rows will open (js/home.js refreshGuildDest) */
.pending-hint { display: none; margin: 0 0 18px; font: 600 14px 'Anuphan', sans-serif; color: var(--h-lime); }
.pending-hint.show { display: block; }

/* Toolkit grid */
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1px; background: var(--h-line); border: 1px solid var(--h-line); border-radius: 24px; overflow: hidden; }
/* Toolkit cards — same vocabulary as the Tools menu's big cards: faint
   grid with wandering squares (js/home-fx.js addGridWalkers), a big faded
   copy of the card's icon as a corner watermark, a larger icon tile, and a
   01–04 index. Everything decorative sits under the text (z-index). */
.tool {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 250px; padding: 26px 26px 26px; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--h-bg); border: 0; color: var(--h-fg); text-align: left; font: inherit; cursor: pointer;
  transition: background .35s;
}
.tool::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--h-grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--h-grid-line) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(120% 90% at 0% 0%, #000 20%, transparent 75%); mask-image: radial-gradient(120% 90% at 0% 0%, #000 20%, transparent 75%);
}
.tool::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .7s;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, .045) 50%, transparent 70%);
}
.tool:is(:hover, .is-active) { background: var(--h-mcard-hover); }
.tool:is(:hover, .is-active)::after { opacity: 1; }
.tool > .m-snake { position: absolute; z-index: -1; }
.tool:is(:hover, .is-active) .m-snake { opacity: 1; }
.tool-mark {
  position: absolute; right: -26px; bottom: -30px; width: 170px; height: 170px; z-index: -1; pointer-events: none;
  color: var(--h-fg); opacity: .05; stroke-width: 1.1;
  transition: transform .8s cubic-bezier(.23, 1, .32, 1), opacity .5s, color .5s;
}
.tool:is(:hover, .is-active) .tool-mark { opacity: .1; transform: rotate(-8deg) scale(1.06); color: var(--h-lime); }
.tool:has(.tool-icon.hot) .tool-mark { color: #fb923c; }
.tool-icon {
  display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(145deg, #1d1d1d, #0e0e0e); border: 1px solid var(--h-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 10px 24px rgba(0, 0, 0, .35);
  color: var(--h-fg); transition: transform .5s cubic-bezier(.23, 1, .32, 1), border-color .3s, color .3s, box-shadow .3s;
}
.tool-icon svg { width: 26px; height: 26px; }
.tool-icon.hot { color: #fb923c; }
.tool:is(:hover, .is-active) .tool-icon { transform: scale(1.1) rotate(-3deg); border-color: var(--h-lime-line); color: var(--h-lime); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 22px rgba(190, 242, 100, .12); }
.tool:is(:hover, .is-active) .tool-icon.hot { color: #fb923c; border-color: rgba(251, 146, 60, .5); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 22px rgba(251, 146, 60, .15); }
.tool h3 { font-family: 'Anuphan', sans-serif; font-size: 21px; font-weight: 700; margin: 22px 0 6px; }
.tool p { margin: 0; font-family: 'Anuphan', sans-serif; font-size: 13px; color: var(--h-muted); line-height: 1.6; }
.tool .corner {
  position: absolute; top: 26px; right: 24px; display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--h-muted); transition: color .3s, transform .4s cubic-bezier(.23, 1, .32, 1);
}
.tool-num { font: 600 11px 'JetBrains Mono', monospace; letter-spacing: .1em; }
.tool:is(:hover, .is-active) .corner { color: var(--h-fg); transform: translate(3px, -3px); }
.tool[hidden] { display: none; }
/* Guild picker's page selector: the picked card stays lit (same look as
   hover, above) with a bar along its bottom edge. */
.tools-pick { margin-bottom: clamp(22px, 3vw, 36px); }
.tools-pick[hidden] { display: none; }
.tool.is-active::after { box-shadow: inset 0 -3px 0 var(--h-lime); }
.tool.is-active:has(.tool-icon.hot)::after { box-shadow: inset 0 -3px 0 #fb923c; }

/* ===== Toolkit intro: badge + wipe-reveal headline + live stats =====
   Same beats as the reference site's "Professional Statistics" section:
   each headline line is hidden under a coloured bar that wipes across
   (alternating direction), the text appears as the bar passes, and the
   stat numbers count up — all once, when scrolled into view (.in-view is
   added by js/home-fx.js). */
.toolkit-block { text-align: center; }
.toolkit-block .tools { text-align: left; }
.stat-badge {
  display: flex; align-items: center; gap: 10px; width: fit-content; margin: 0 auto 26px; padding: 7px 18px;
  border-radius: 999px; background: var(--h-mcard-bg); border: 1px solid var(--h-line);
  font: 700 11px 'Inter', sans-serif; letter-spacing: .15em; text-transform: uppercase; color: var(--h-fg);
}
.stat-badge .ping { position: relative; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 10px rgba(34, 197, 94, .8); }
.stat-badge .ping::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: rgba(74, 222, 128, .6); animation: h-badge-ping 2s ease-in-out infinite; }
@keyframes h-badge-ping { 50% { transform: scale(2); opacity: 0; } }

.wipe-head {
  margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: .08em;
  font: 800 clamp(1.8rem, 4.6vw, 3.9rem) 'Anuphan', 'Inter', sans-serif; line-height: 1.22; letter-spacing: -.01em; color: var(--h-fg);
}
.wipe-line { position: relative; display: inline-block; overflow: hidden; padding: .1em .12em .02em; white-space: nowrap; } /* each line stays whole; font scales down on phones instead */
.wipe-txt { opacity: 0; }
.wipe-bar { position: absolute; inset: 0; background: var(--wipe); clip-path: inset(0 100% 0 0); }
.wipe-line.alt .wipe-bar { clip-path: inset(0 0 0 100%); }
.in-view .wipe-txt { animation: h-txt-on 0s linear forwards; animation-delay: calc(var(--d) + .35s); }
.in-view .wipe-bar { animation: h-wipe .75s cubic-bezier(.85, 0, .15, 1) var(--d) forwards; }
.in-view .wipe-line.alt .wipe-bar { animation-name: h-wipe-alt; }
@keyframes h-txt-on { to { opacity: 1; } }
@keyframes h-wipe { 0% { clip-path: inset(0 100% 0 0); } 45%, 55% { clip-path: inset(0 0 0 0); } 100% { clip-path: inset(0 0 0 100%); } }
@keyframes h-wipe-alt { 0% { clip-path: inset(0 0 0 100%); } 45%, 55% { clip-path: inset(0 0 0 0); } 100% { clip-path: inset(0 100% 0 0); } }

/* ทายฮีโร่ประจำวัน entry above the stats bar (index.html #homeQuizCta) */
.quiz-cta {
  display: flex; align-items: center; gap: 14px; max-width: 1000px; margin: 48px auto -28px; padding: 14px 22px 14px 14px;
  border-radius: 999px; border: 1px solid color-mix(in srgb, var(--h-yellow) 45%, transparent); background: rgba(234, 179, 8, .07);
  color: var(--h-fg); text-decoration: none;
  transition: transform .3s cubic-bezier(.23, 1, .32, 1), background .25s, border-color .25s;
}
.quiz-cta[hidden], .quiz-cta-tag[hidden] { display: none; }
.quiz-cta:hover { transform: translateY(-2px); background: rgba(234, 179, 8, .12); border-color: var(--h-yellow); }
.quiz-cta:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 3px; }
.quiz-cta-ico {
  display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  background: var(--h-yellow); color: #0a0a0a; font: 800 18px 'JetBrains Mono', monospace;
  transition: rotate .5s cubic-bezier(.34, 1.56, .64, 1);
}
.quiz-cta:hover .quiz-cta-ico { rotate: 14deg; }
.quiz-cta-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; text-align: left; font: 500 13px/1.5 'Anuphan', sans-serif; color: var(--h-muted); }
.quiz-cta-text b { font: 800 16px/1.3 'Anuphan', sans-serif; color: var(--h-fg); }
.quiz-cta-tag { flex-shrink: 0; padding: 4px 12px; border-radius: 999px; background: var(--h-yellow); color: #0a0a0a; font: 800 12.5px 'Inter', 'Anuphan', sans-serif; white-space: nowrap; }
.quiz-cta-arrow { flex-shrink: 0; transition: translate .3s cubic-bezier(.23, 1, .32, 1); }
.quiz-cta:hover .quiz-cta-arrow { translate: 4px 0; }
.quiz-cta.done { border-color: var(--h-line); background: var(--h-card); }
.quiz-cta.done .quiz-cta-ico { background: #2b2b2b; color: var(--h-muted); }
/* ค่ายตัดไม้'s war-day market (js/home.js), in the yard's wood colour; under the quiz when both show. */
.lumber-cta { --wd: #d39a5b; border-color: color-mix(in srgb, var(--wd) 50%, transparent); background: color-mix(in srgb, var(--wd) 8%, transparent); }
.lumber-cta:hover { background: color-mix(in srgb, var(--wd) 14%, transparent); border-color: var(--wd); }
.lumber-cta .quiz-cta-ico, .lumber-cta .quiz-cta-tag { background: var(--wd); }
.lumber-cta .quiz-cta-ico svg { transform-origin: 30% 70%; }
.lumber-cta:hover .quiz-cta-ico { rotate: 0deg; }
.lumber-cta:hover .quiz-cta-ico svg { animation: um-wiggle .6s ease-in-out; }
.quiz-cta:not([hidden]) + .lumber-cta { margin-top: 48px; }
/* กิลด์เรด (index.html #homeRaidCta): rose like the raid popup, a sword */
.raid-cta { --rd: #fb7185; border-color: color-mix(in srgb, var(--rd) 45%, transparent); background: color-mix(in srgb, var(--rd) 7%, transparent); }
.raid-cta:hover { background: color-mix(in srgb, var(--rd) 13%, transparent); border-color: var(--rd); }
.raid-cta .quiz-cta-ico, .raid-cta .quiz-cta-tag { background: var(--rd); }
.raid-cta:hover .quiz-cta-ico { rotate: -14deg; }
/* บิงโกวอร์ (index.html #homeBingoCta): lime, the icon is a tiny 3×3 card */
.bingo-cta { border-color: color-mix(in srgb, var(--h-lime) 35%, transparent); background: rgba(190, 242, 100, .05); }
.bingo-cta:hover { background: rgba(190, 242, 100, .1); border-color: var(--h-lime); }
.bingo-cta .quiz-cta-tag { background: #262626; color: var(--h-fg); }
.bingo-cta.is-ready, .bingo-cta.is-ready:hover { border-color: var(--h-lime); }
.bingo-cta.is-ready .quiz-cta-tag { background: var(--h-lime); color: #0a0a0a; }
.quiz-cta-ico.bingo-cta-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); place-items: stretch; gap: 2.5px; padding: 9px; background: #141414; border: 1px solid rgba(190, 242, 100, .35); }
.bingo-cta-grid i { border-radius: 2px; background: #333; }
.bingo-cta-grid i.on { background: var(--h-lime); }
.bingo-cta:hover .quiz-cta-ico.bingo-cta-grid { rotate: 0deg; scale: 1.08; }
@media (prefers-reduced-motion: reduce) { .lumber-cta:hover .quiz-cta-ico svg { animation: none; } }
@media (prefers-reduced-motion: reduce) { .quiz-cta, .quiz-cta-ico, .quiz-cta-arrow { transition: none; } .quiz-cta:hover { transform: none; } }

.stats-bar {
  position: relative; display: flex; max-width: 1000px; margin: 48px auto 56px; padding: 34px 24px;
  background: var(--h-card); border: 1px solid var(--h-line); border-radius: 22px; overflow: hidden;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateY(24px); transition: opacity .8s .5s, transform .8s .5s cubic-bezier(.23, 1, .32, 1);
}
.stats-bar.in-view { opacity: 1; transform: none; }
.stats-bar::before { content: ''; position: absolute; top: 0; left: 25%; width: 50%; height: 100%; background: rgba(59, 130, 246, .06); filter: blur(60px); pointer-events: none; }
.stat {
  position: relative; flex: 1; min-height: 72px; display: grid; place-items: center;
  background: none; border: 0; padding: 0 8px; color: inherit; font: inherit; cursor: pointer; text-decoration: none;
}
.stat + .stat::before { content: ''; position: absolute; left: 0; top: 50%; height: 48px; transform: translateY(-50%); border-left: 1px dashed var(--h-line); }
.stat-body { display: flex; flex-direction: column; align-items: center; transition: opacity .3s; }
.stat-label { margin-bottom: 8px; font: 600 12px 'Anuphan', sans-serif; letter-spacing: .06em; color: var(--h-muted); }
.stat-num { display: flex; align-items: baseline; }
.stat-num b { font: 900 clamp(1.9rem, 3.2vw, 2.6rem) 'Inter', sans-serif; letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: var(--h-fg); }
.stat-num small { margin-left: 5px; font: 800 15px 'Anuphan', sans-serif; color: var(--h-muted); }
.stat-place { display: inline-flex; align-items: baseline; margin-left: 4px; padding-left: 12px; border-left: 1px solid var(--h-line); }
.stat-place[hidden] { display: none; }
.stat-place b { font: 900 clamp(1.2rem, 2vw, 1.6rem) 'Inter', sans-serif; letter-spacing: -.03em; color: var(--h-fg); }
.stat-hash { font: 800 clamp(1rem, 1.6vw, 1.25rem) 'Inter', sans-serif; font-style: normal; color: var(--h-muted); margin-right: 1px; }
/* Rank & place holds a badge, a tier name and #place — give it more room
   than the single-number stats so nothing presses against the dividers. */
.stat.stat-wide { flex: 1.55; }
.stat-rank { align-items: center; gap: 8px; white-space: nowrap; }
.stat-rank img { width: 30px; height: 30px; margin: -6px 0; object-fit: contain; } /* negative margin keeps the row as tall as the number stats */
.stat-rank img[hidden] { display: none; }
.stat-rank b { font: 800 clamp(1.2rem, 2vw, 1.6rem) 'Anuphan', sans-serif; letter-spacing: 0; }
.stat-cta {
  position: absolute; inset: -10px; display: grid; place-items: center; pointer-events: none;
  font: 700 13px 'Anuphan', sans-serif; color: var(--h-fg);
  background: var(--h-mega-bg);
  -webkit-mask-image: radial-gradient(circle, #000 45%, transparent 95%); mask-image: radial-gradient(circle, #000 45%, transparent 95%);
  opacity: 0; transform: scale(.8); transition: opacity .25s, transform .3s cubic-bezier(.23, 1, .32, 1);
}
.stat:hover .stat-body, .stat:focus-visible .stat-body { opacity: .3; }
.stat:hover .stat-cta, .stat:focus-visible .stat-cta { opacity: 1; transform: none; }
.stat[hidden] { display: none; }

/* Owner-only controls at the top of the header's 🗂️ menu (maintenance /
   announcement — js/home.js initOwnerPanels). */
.topbar .icon-dropdown-menu { min-width: 270px; padding: 8px; }
.owner-ctl { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 10px 12px; border-radius: 12px; background: var(--h-mcard-bg); margin-bottom: 6px; font-family: 'Anuphan', sans-serif; }
.owner-ctl .maintenance-toggle-label { font-weight: 800; font-size: 13px; color: var(--h-fg); }
.owner-ctl .maintenance-toggle-status { font-size: 12px; color: var(--h-muted); line-height: 1.5; }
.owner-ctl .btn { margin-top: 4px; width: 100%; border-radius: 999px; padding: 8px 14px; font-size: 12px; box-shadow: none; }
.owner-menu-divider { height: 1px; margin: 6px 4px 8px; background: var(--h-line); }

/* ===== Footer ===== */
.home-v2 footer { position: relative; z-index: 10; border-top: 1px solid var(--h-line); overflow: hidden; }
.foot-inner { max-width: 105rem; margin: 0 auto; padding: 50px clamp(16px, 4vw, 48px) 30px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.foot-inner .th { font-size: 13px; color: var(--h-muted); line-height: 1.8; }
.foot-inner strong { color: var(--h-fg); }
.foot-giant {
  font-size: clamp(4rem, 21vw, 22rem); font-weight: 900; letter-spacing: -.07em; line-height: .75; text-align: center;
  color: transparent; -webkit-text-stroke: 1px var(--h-line); user-select: none; padding-bottom: 2vw; white-space: nowrap;
}

/* Footer extras (js/home-fx.js footerFx): a light sweeping along the top
   rule, a live dot on the build tag, and the giant
   TDERM split into letters — each letter lights lime and lifts as the
   pointer nears it (--p, 0–1), hops when tapped, and rises into place as
   the footer scrolls in. */
.home-v2 footer::before {
  content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent 0 35%, var(--h-lime) 45%, var(--h-sky) 55%, transparent 65% 100%) 0 0 / 300% 100%;
  animation: foot-sweep 7s linear infinite;
}
@keyframes foot-sweep { from { background-position: 100% 0; } to { background-position: 0 0; } }
.foot-inner .th strong, .foot-inner .site-footer-owner-name {
  background: linear-gradient(var(--h-lime), var(--h-lime)) 0 100% / 0 1px no-repeat;
  transition: background-size .35s cubic-bezier(.23, 1, .32, 1), color .25s;
}
.foot-inner .th:hover strong, .foot-inner .th:hover .site-footer-owner-name { background-size: 100% 1px; color: var(--h-lime); }
.home-v2 .site-build-time {
  display: flex; justify-content: flex-end; align-items: center; gap: 7px; margin-top: 8px; opacity: 1;
  font: 500 11px 'JetBrains Mono', monospace; color: var(--h-muted); letter-spacing: .02em;
}
.home-v2 .site-build-time:empty { display: none; }
.home-v2 .site-build-time::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--h-lime); box-shadow: 0 0 8px var(--h-lime);
  animation: foot-live 2.2s ease-in-out infinite;
}
@keyframes foot-live { 50% { opacity: .35; box-shadow: 0 0 2px var(--h-lime); } }
.foot-giant span {
  --p: 0; display: inline-block; cursor: default;
  -webkit-text-stroke-color: color-mix(in srgb, var(--h-lime) calc(var(--p) * 85%), rgba(250, 250, 250, .10));
  color: rgb(190 242 100 / calc(var(--p) * .10));
  transform: translateY(calc(var(--p) * -5%));
  transition: transform .5s cubic-bezier(.23, 1, .32, 1), -webkit-text-stroke-color .4s, color .4s;
}
.foot-giant span.hop { animation: foot-hop .6s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes foot-hop { 40% { translate: 0 -14%; rotate: -4deg; } 70% { translate: 0 2%; rotate: 1deg; } }
/* Back-to-top (js/home-fx.js toTop): white round button in the bottom-LEFT
   corner — the pet (css/mascot.css) owns the bottom-right strip. Shows once
   the page is scrolled past one screen; steps aside while an editor's
   .palette-dock is open, and sits under modals (z 50). */
.to-top {
  position: fixed; left: 20px; bottom: 20px; z-index: 45; width: 48px; height: 48px; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--h-fg); color: #000; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  opacity: 0; visibility: hidden; translate: 0 16px; scale: .9;
  transition: opacity .3s, translate .45s cubic-bezier(.34, 1.56, .64, 1), scale .3s, visibility 0s .45s, box-shadow .3s;
}
.to-top.show { opacity: 1; visibility: visible; translate: 0 0; scale: 1; transition-delay: 0s; }
.to-top svg { width: 20px; height: 20px; overflow: visible; }
.to-top:is(:hover, :focus-visible) { scale: 1.08; box-shadow: 0 0 0 4px var(--h-lime-line), 0 10px 30px rgba(0, 0, 0, .5); }
.to-top:is(:hover, :focus-visible) .to-top-arrow { animation: to-top-arrow .9s cubic-bezier(.65, 0, .35, 1) infinite; }
@keyframes to-top-arrow { 0% { translate: 0 0; opacity: 1; } 45% { translate: 0 -6px; opacity: 0; } 46% { translate: 0 6px; opacity: 0; } 100% { translate: 0 0; opacity: 1; } }
body:has(.palette-dock:not(.collapsed)) .to-top { opacity: 0; visibility: hidden; }
@media (max-width: 640px) { .to-top { left: 12px; bottom: 12px; width: 42px; height: 42px; } }
@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    .foot-giant { view-timeline: --foot-giant; }
    .foot-giant span {
      animation: foot-rise linear both; animation-timeline: --foot-giant;
      animation-range: entry 0% entry 90%;
    }
    .foot-giant span:nth-child(2) { animation-range: entry 8% entry 94%; }
    .foot-giant span:nth-child(3) { animation-range: entry 16% entry 97%; }
    .foot-giant span:nth-child(4) { animation-range: entry 24% entry 99%; }
    .foot-giant span:nth-child(5) { animation-range: entry 32% entry 100%; }
    .foot-giant span.hop { animation: foot-hop .6s cubic-bezier(.34, 1.56, .64, 1); }
    @keyframes foot-rise { from { translate: 0 45%; opacity: 0; } }
  }
}
@media (prefers-reduced-motion: reduce) {
  .home-v2 footer::before, .home-v2 .site-build-time::before, .foot-giant span.hop, .to-top .to-top-arrow { animation: none !important; }
  .foot-giant span { transition: none; transform: none; }
  .to-top { transition: opacity .2s, visibility 0s .2s; translate: none; scale: none; }
  .to-top.show { transition-delay: 0s; }
}

/* ===== Member-code modal (js/home-code.js) ===== */
.code-modal {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none; transition: opacity .25s, visibility 0s .25s;
  visibility: hidden; /* closed: no full-screen blur for the GPU to keep redrawing */
}
.code-modal.open { opacity: 1; pointer-events: auto; visibility: visible; transition: opacity .25s; }
.code-card {
  position: relative; width: min(440px, 100%); padding: 32px 28px 24px; text-align: center;
  background: var(--h-mega-bg); border: 1px solid var(--h-line); border-radius: 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  transform: translateY(16px) scale(.97); transition: transform .4s cubic-bezier(.23, 1, .32, 1);
}
.code-modal.open .code-card { transform: none; }
.code-close {
  position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: var(--h-nav-active); color: var(--h-fg); display: grid; place-items: center; cursor: pointer;
  transition: transform .4s cubic-bezier(.23, 1, .32, 1), background .25s;
}
.code-close:hover { background: var(--h-nav-hover); transform: rotate(90deg); }
.code-title { margin: 0; font: 800 24px 'Anuphan', sans-serif; color: var(--h-fg); }
.code-sub { margin: 6px 0 26px; font: 500 13px 'Anuphan', sans-serif; color: var(--h-muted); }

.code-boxes { display: flex; justify-content: center; align-items: center; gap: 8px; }
.code-gap { width: 10px; }
.code-box {
  width: 50px; height: 60px; padding: 0; text-align: center;
  font: 700 24px 'JetBrains Mono', monospace; color: var(--h-fg); caret-color: var(--h-lime);
  background: var(--h-mcard-bg); border: 1.5px solid var(--h-line); border-radius: 14px; outline: none;
  transition: border-color .2s, box-shadow .2s, transform .2s, background .2s;
}
.code-boxes.owner .code-box { width: 40px; height: 54px; font-size: 20px; }
.code-boxes.owner .code-gap { width: 6px; }
.code-box:focus { border-color: var(--h-fg); box-shadow: 0 0 0 4px var(--h-card-hover); transform: translateY(-2px); }
.code-box.filled { border-color: rgba(250, 250, 250, .35); }
.code-box:disabled { opacity: 1; }

.code-modal[data-status="checking"] .code-box { animation: code-pulse 1s ease-in-out infinite; }
.code-modal[data-status="ok"] .code-box { border-color: var(--h-lime); color: var(--h-lime); box-shadow: 0 0 18px rgba(190, 242, 100, .18); }
.code-modal[data-status="error"] .code-box { border-color: var(--h-rose); }
.code-boxes.shake { animation: code-shake .4s; }
@keyframes code-pulse { 50% { border-color: var(--h-muted); } }
@keyframes code-shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

.code-status { min-height: 20px; margin: 14px 0 22px; font: 600 13px 'Anuphan', sans-serif; color: var(--h-muted); }
.code-modal[data-status="ok"] .code-status { color: var(--h-lime); }
.code-modal[data-status="error"] .code-status { color: var(--h-rose); }

.code-actions { display: flex; gap: 10px; }
.code-btn { flex: 1; padding: 14px 18px; border-radius: 999px; font: 700 14px 'Anuphan', sans-serif; cursor: pointer; transition: transform .25s, background .25s, border-color .25s; }
.code-btn.ghost { background: transparent; color: var(--h-fg); border: 1px solid var(--h-line); }
.code-btn.ghost:hover { border-color: var(--h-fg); }
.code-btn.solid { background: var(--h-pill-bg); color: var(--h-pill-fg); border: 0; }
.code-btn.solid:hover { transform: translateY(-1px); }
.code-btn:disabled { opacity: .5; cursor: default; transform: none; }

@media (max-width: 420px) {
  .code-card { padding: 28px 16px 20px; }
  .code-boxes { gap: 6px; }
  .code-box { width: 42px; height: 54px; font-size: 21px; }
  .code-boxes.owner .code-box { width: 32px; height: 46px; font-size: 17px; }
  .code-boxes.owner { gap: 4px; }
}

/* ===== Daily T-coin streak card — the look itself lives in css/style.css
   (shared by every page); new-theme pages just drop it below the fixed
   glass header. */
.home-v2 .streak-card { top: 92px; }

/* ===== User menu (js/auth.js renderUserMenu) — one header button with the
   rank badge + name; opens a glass panel with profile, stats, links, the
   owner's controls and logout. Replaces the name label and the trophy /
   tools / 🗂️ / logout icons on new-theme pages. */
.has-user-menu .topbar #userDisplayLabel,
.has-user-menu .topbar #rankingBtn,
.has-user-menu .topbar #adminToolsBtn,
.has-user-menu .topbar #ownerToolsDropdown,
.has-user-menu .topbar #logoutBtn { display: none !important; }

.user-menu { position: relative; }
.user-menu-btn {
  position: relative; display: inline-flex; align-items: center; gap: 9px;
  padding: 4px 12px 4px 4px; border: 1px solid var(--h-line); border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, .04); color: var(--h-fg); font: 700 12.5px 'Anuphan', 'Inter', sans-serif;
  transition: background .25s, border-color .25s, transform .3s cubic-bezier(.23, 1, .32, 1);
}
.user-menu-btn:hover { background: rgba(255, 255, 255, .09); border-color: rgba(250, 250, 250, .22); }
.user-menu-btn:active { transform: scale(.96); }
.user-menu-btn:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 2px; }
.um-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #1a1a1a; overflow: hidden; flex-shrink: 0; }
.um-avatar img { width: 30px; height: 30px; object-fit: contain; }
.um-initial { font: 800 13px 'Inter', 'Anuphan', sans-serif; color: var(--h-fg); }
.um-btn-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-chev { color: var(--h-muted); transition: transform .35s cubic-bezier(.23, 1, .32, 1); }
.user-menu.open .um-chev { transform: rotate(180deg); }
.um-dot { position: absolute; top: 2px; left: 26px; width: 9px; height: 9px; border-radius: 50%; background: var(--h-rose); border: 2px solid var(--h-bg); display: none; }
.user-menu.has-dot .um-dot, .user-menu.has-mail .um-dot { display: block; }

.user-menu-panel {
  position: absolute; top: calc(100% + 12px); right: 0; z-index: 60; width: 300px; padding: 10px;
  background: rgba(11, 11, 11, .92); border: 1px solid var(--h-line); border-radius: 22px;
  backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .6);
  font-family: 'Anuphan', 'Inter', sans-serif; text-align: left;
  opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.98); transform-origin: top right;
  transition: opacity .25s, transform .35s cubic-bezier(.23, 1, .32, 1), visibility 0s .35s;
  max-height: calc(100vh - 100px); overflow-y: auto;
}
.user-menu.open .user-menu-panel { opacity: 1; visibility: visible; transform: none; transition: opacity .25s, transform .35s cubic-bezier(.23, 1, .32, 1); }

.um-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 14px; }
.um-head-badge { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; flex-shrink: 0; background: linear-gradient(145deg, #1d1d1d, #0e0e0e); border: 1px solid var(--h-line); }
.um-head-badge img { width: 40px; height: 40px; object-fit: contain; }
.um-head-badge .um-initial { font-size: 18px; }
.um-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.um-head-text b { font-size: 15px; font-weight: 800; color: var(--h-fg); overflow-wrap: anywhere; }
.um-head-text span { font-size: 12px; color: var(--h-muted); }

.um-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.um-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 14px; background: #151515; }
.um-stat b { font: 800 16px 'Inter', 'Anuphan', sans-serif; font-variant-numeric: tabular-nums; color: var(--h-fg); }
.um-stat span { font-size: 11px; color: var(--h-muted); }
.um-stat:nth-child(2) b { color: var(--h-yellow); }

.um-links { display: flex; flex-direction: column; gap: 2px; }
.um-links a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--h-fg); font-size: 13.5px; font-weight: 600; text-decoration: none;
  transition: background .2s, padding-left .25s cubic-bezier(.23, 1, .32, 1);
}
.um-links a svg { color: var(--h-muted); flex-shrink: 0; transition: color .2s; }
.um-links a:hover { background: var(--h-nav-active); padding-left: 16px; }
.um-links a:hover svg { color: var(--h-fg); }
.user-menu.has-dot .um-achv::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--h-rose); }
/* Owner's unanswered contact messages (js/auth.js refreshOwnerInbox). */
/* a reward waiting, not a warning */
.um-count.um-count-coin { background: var(--h-yellow); color: #0a0a0a; }
.um-count { margin-left: auto; min-width: 20px; padding: 2px 6px; border-radius: 999px; background: var(--h-rose); color: #fff; font: 800 11px 'Inter', sans-serif; font-variant-numeric: tabular-nums; text-align: center; }
/* word tags (MUST / NEW / CLAIM / BID) share one width so they line up down the menu */
.um-count.um-tag { min-width: 52px; }
/* lumber market bid: mint, a "go trade today" tag, apart from yellow NEW/CLAIM */
.um-count.um-bid { background: #34d399; color: #052e1c; }
/* Black Friday sale tag on the ร้าน T-coin link: black card, gold hairline, foil-gold FRIDAY */
.um-count.um-bf { display: inline-flex; align-items: baseline; gap: 3px; padding: 3px 7px; border-radius: 4px; background: #0a0a0a; color: #f5f5f4; box-shadow: inset 0 0 0 1px #c9a24a; font: 800 9.5px/1 'Inter', sans-serif; letter-spacing: .08em; }
.um-count.um-bf i { font-style: normal; background: linear-gradient(180deg, #fde68a 0%, #d4a53c 55%, #f5d98a 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* กิลด์เรด: a yellow dot (last week's reward waiting) just left of MUST */

.um-owner { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--h-line); }
.um-section-label { display: block; padding: 0 12px 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--h-muted); }
.um-owner-ctls:empty { display: none; }
/* Grouped links (js/auth.js): a hairline + small muted label between groups. */
.um-group + .um-group { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--h-line); }
.um-group > .um-section-label { padding-bottom: 4px; }
.um-owner .owner-ctl { margin: 0 0 6px; }
.um-foot { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--h-line); }
.um-foot a, .um-foot a svg { color: #fb7185; }
.um-foot a:hover { background: rgba(244, 63, 94, .1); }

/* ---- Playful touches: pointer spotlight, staggered drop-in, rank badge
   shine, stat tiles that count up (js/auth.js _umCountUp) and light up in
   their own colour, a sliding accent bar on links, and a per-icon hover
   motion picked by data-ico. All static under reduced motion. */
.user-menu-panel {
  background:
    radial-gradient(260px circle at var(--mx, 50%) var(--my, -200px), rgba(163, 230, 53, .07), transparent 70%),
    rgba(11, 11, 11, .92);
}
.user-menu.open .user-menu-panel :is(.um-head, .um-stat, .um-section-label, .um-links a) {
  animation: um-drop .45s cubic-bezier(.23, 1, .32, 1) both;
  animation-delay: calc(var(--i, 0) * 28ms + 40ms);
}
@keyframes um-drop { from { opacity: 0; translate: 0 -8px; filter: blur(3px); } }

/* Avatar in the header button: bobs when hovered, turns once when opened. */
.um-avatar img, .um-avatar .um-initial { transition: rotate .6s cubic-bezier(.34, 1.56, .64, 1), scale .3s; }
.user-menu-btn:hover .um-avatar img { scale: 1.12; }
.user-menu.open .um-avatar img, .user-menu.open .um-avatar .um-initial { rotate: 360deg; }
.um-dot { animation: um-ping 1.8s ease-out infinite; }
@keyframes um-ping { 0% { box-shadow: 0 0 0 0 rgba(251, 113, 133, .55); } 70%, 100% { box-shadow: 0 0 0 7px rgba(251, 113, 133, 0); } }

/* Rank badge: a light sweep on open and on hover, badge floats a little. */
.um-head-badge { position: relative; overflow: hidden; transition: border-color .3s, box-shadow .3s; }
.um-head-badge::after {
  content: ''; position: absolute; inset: -20%; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .28) 50%, transparent 65%);
  translate: -120% 0;
}
.user-menu.open .um-head-badge::after { animation: um-shine 1.1s .25s ease-out; }
.um-head:hover .um-head-badge::after { animation: um-shine .9s ease-out; }
.um-head:hover .um-head-badge { border-color: rgba(250, 204, 21, .45); box-shadow: 0 0 18px rgba(250, 204, 21, .18); }
.um-head-badge img { animation: um-float 3.2s ease-in-out infinite; }
@keyframes um-shine { to { translate: 120% 0; } }
@keyframes um-float { 50% { translate: 0 -2px; rotate: -3deg; } }

/* Stat tiles: lift and glow in their own colour; the number pops. */
.um-stat { --c: var(--h-fg); position: relative; overflow: hidden; border: 1px solid transparent; cursor: default; transition: translate .3s cubic-bezier(.23, 1, .32, 1), border-color .3s, background .3s; }
.um-stat-points { --c: var(--h-lime); }
.um-stat-tcoin { --c: var(--h-yellow); }
.um-stat-streak { --c: #fb923c; }
.um-stat::before {
  content: ''; position: absolute; left: 10px; right: 10px; top: 0; height: 2px; border-radius: 2px;
  background: var(--c); scale: 0 1; transition: scale .35s cubic-bezier(.23, 1, .32, 1);
}
.um-stat:hover { translate: 0 -2px; border-color: color-mix(in srgb, var(--c) 35%, transparent); background: color-mix(in srgb, var(--c) 8%, #151515); }
.um-stat:hover::before { scale: 1 1; }
.um-stat b { transition: color .3s; }
.um-stat:hover b { color: var(--c); animation: um-pop .4s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes um-pop { 40% { scale: 1.15; } }
/* The streak tile flickers a flame once the streak is going. */
.um-stat-streak::after {
  content: ''; position: absolute; right: 8px; top: 8px; width: 7px; height: 9px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #fb923c;
  box-shadow: 0 0 8px #fb923c; opacity: .8; animation: um-flame 1.4s ease-in-out infinite;
}
@keyframes um-flame { 50% { scale: .8 1.15; opacity: .5; } }
.um-stat-streak:not(:has(b[data-count]:not([data-count="0"])))::after { display: none; }

/* Links: lime accent bar slides in on the left. */
.um-links a::before {
  content: ''; position: absolute; left: 4px; top: 50%; width: 3px; height: 16px; margin-top: -8px; border-radius: 3px;
  background: var(--h-lime); scale: 1 0; transition: scale .3s cubic-bezier(.23, 1, .32, 1);
}
.um-links a:is(:hover, :focus-visible)::before { scale: 1 1; }
.um-foot a::before { background: #fb7185; }
.um-links a:focus-visible { outline: none; background: var(--h-nav-active); padding-left: 16px; }
.um-links a svg { transition: color .2s, rotate .4s cubic-bezier(.34, 1.56, .64, 1), translate .3s cubic-bezier(.34, 1.56, .64, 1), scale .3s; }

/* Per-icon hover motion. */
.um-links a[data-ico="trophy"]:is(:hover, :focus-visible) svg { animation: um-wiggle .6s ease-in-out; color: var(--h-yellow); }
.um-links a[data-ico="award"]:is(:hover, :focus-visible) svg { animation: um-bounce .6s cubic-bezier(.34, 1.56, .64, 1); color: var(--h-yellow); }
.um-links a[data-ico="shop"]:is(:hover, :focus-visible) svg { animation: um-flip .7s ease-in-out; color: var(--h-yellow); }
.um-links a[data-ico="bag"]:is(:hover, :focus-visible) svg { animation: um-bounce .6s cubic-bezier(.34, 1.56, .64, 1); }
.um-links a[data-ico="axe"]:is(:hover, :focus-visible) svg { animation: um-wiggle .6s ease-in-out; color: #d39a5b; }
.um-links a[data-ico="boss"]:is(:hover, :focus-visible) svg { animation: um-wiggle .6s ease-in-out; color: #c4b5fd; }
.um-links a[data-ico="gift"]:is(:hover, :focus-visible) svg { animation: um-shake .5s ease-in-out; color: var(--h-rose); }
.um-links a[data-ico="quiz"]:is(:hover, :focus-visible) svg { animation: um-wiggle .6s ease-in-out; color: var(--h-lime); }
.um-links a[data-ico="bingo"]:is(:hover, :focus-visible) svg { animation: um-wiggle .6s ease-in-out; color: var(--h-yellow); }
.um-links a[data-ico="tools"]:is(:hover, :focus-visible) svg { rotate: -45deg; color: var(--h-sky); }
.um-links a[data-ico="eye"]:is(:hover, :focus-visible) svg { animation: um-blink .5s ease-in-out; }
.um-links a[data-ico="coins"]:is(:hover, :focus-visible) svg { animation: um-flip .7s ease-in-out; color: var(--h-yellow); }
.um-links a[data-ico="mail"]:is(:hover, :focus-visible) svg { rotate: -12deg; translate: 0 -2px; color: var(--h-sky); }
.um-links a[data-ico="wallet"]:is(:hover, :focus-visible) svg { translate: 0 -2px; scale: 1.08; color: var(--h-lime); }
.um-links a[data-ico="logout"]:is(:hover, :focus-visible) svg { animation: um-exit .8s ease-in-out infinite; color: #fb7185; }
@keyframes um-wiggle { 20% { rotate: -14deg; } 45% { rotate: 11deg; } 70% { rotate: -6deg; } }
@keyframes um-flip { to { transform: rotateY(360deg); } }
@keyframes um-bounce { 35% { translate: 0 -4px; scale: 1.05 .95; } 65% { translate: 0 0; scale: .95 1.05; } }
@keyframes um-shake { 20%, 60% { rotate: -10deg; } 40%, 80% { rotate: 10deg; } }
@keyframes um-blink { 45% { scale: 1 .1; } }
@keyframes um-exit { 50% { translate: 3px 0; } }

@media (prefers-reduced-motion: reduce) {
  .user-menu.open .user-menu-panel :is(.um-head, .um-stat, .um-section-label, .um-links a),
  .um-head-badge img, .um-head-badge::after, .um-dot, .um-stat-streak::after,
  .um-stat:hover b, .um-links a svg { animation: none !important; }
  .um-avatar img, .um-avatar .um-initial { transition: none; rotate: none !important; }
  .um-stat:hover, .um-links a svg { translate: none !important; rotate: none !important; }
}

@media (max-width: 1100px) {
  .um-btn-name, .um-chev { display: none; }
  .user-menu-btn { padding: 4px; }
}
@media (max-width: 420px) {
  .user-menu-panel { position: fixed; top: 70px; left: 12px; right: 12px; width: auto; max-height: calc(100dvh - 82px); overflow-y: auto; overscroll-behavior: contain; }
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .topbar .user-display-label { display: none !important; }
}
@media (max-width: 900px) {
  .gate { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .hero-row { flex-wrap: wrap; }
  .hero-row.r1, .hero-row.r3 { justify-content: flex-start; padding-right: 0; }
  .hero-row.r2 { justify-content: flex-end; padding-left: 0; }
  .side-note { order: 2; }
  .clock { font-size: 18px; }
  .nav { gap: 6px; }
  .nav > a, .nav-dd > button { padding: 0 12px; font-size: 13px; }
}
@media (max-width: 680px) {
  .topbar { padding: 14px 16px; }
  .topbar-row { grid-template-columns: auto 1fr; }
  .topbar-right { grid-column: 2; }
  .nav { display: none; }
  body:not([data-state="guest"]) .topbar #contactBtn { display: flex; }
  .clock { font-size: 16px; }
}
@media (max-width: 600px) {
  .tool { min-height: 0; }
  .guild-row { grid-template-columns: 34px 1fr 44px; }
  .g-meta { display: none; }
  .cta-line { flex-wrap: wrap; gap: 16px; }
  .cta-line .rule { display: none; }
  .cta-line { padding-right: 0; }
  .hero-row.r1 .side-note { display: none; } /* crowds GUILD at phone width */
  .float-icon { display: none !important; } /* clutter the small title; the guild list sits right below */
  /* Two edge characters crop to fragments on a phone — show just the right
     one, wider, so it still reads as a character behind the content. */
  .art-layer .art-left { display: none; }
  .art-layer .art-right { width: 95vw; right: -25vw; top: 10vh; }
  .gate-card { padding: 22px; }
  .stats-bar { display: grid; grid-template-columns: repeat(3, 1fr); row-gap: 26px; padding: 26px 8px; }
  .stat-label { font-size: 11px; letter-spacing: .02em; }
  .wipe-head { font-size: 6.4vw; }
  .stat + .stat::before { display: none; }
  .stat.stat-wide { grid-column: 1 / -1; order: -1; } /* rank on its own top row, the three numbers below */
}
@media (prefers-reduced-motion: reduce) {
  .home-v2 *, .home-v2 *::before, .home-v2 *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; filter: none; }
  .wipe-txt { opacity: 1; }
  .wipe-bar { display: none; }
  .stats-bar { opacity: 1; transform: none; }
}

/* ===== Popups: every .modal-overlay / .modal-box (style.css base) =====
   Shared by index and every v2 page, so the logout confirm (js/auth.js),
   each page's #confirmModal and the bigger pickers all open the same way:
   the backdrop fades + blurs in, the box springs up out of a blur, a light
   runs along its top edge, then the badge, message and buttons follow one
   after another. Closing plays it back out — display transitions with
   allow-discrete, so the page JS keeps toggling .open exactly as before. */
.home-v2 .modal-overlay {
  padding: 16px; box-sizing: border-box;
  background: rgba(0, 0, 0, 0); backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0);
  transition: background-color .3s ease, backdrop-filter .3s ease, -webkit-backdrop-filter .3s ease, display .3s allow-discrete;
}
.home-v2 .modal-overlay.open {
  background: rgba(0, 0, 0, .72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  @starting-style { background: rgba(0, 0, 0, 0); backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); }
}
.home-v2 .modal-overlay > :is(.modal-box, .dp-box) {
  opacity: 0; translate: 0 18px; scale: .94; filter: blur(6px);
  transition: opacity .22s ease, translate .45s cubic-bezier(.34, 1.4, .64, 1), scale .45s cubic-bezier(.34, 1.4, .64, 1), filter .3s ease;
}
.home-v2 .modal-overlay.open > :is(.modal-box, .dp-box) {
  opacity: 1; translate: 0 0; scale: 1; filter: none;
  @starting-style { opacity: 0; translate: 0 18px; scale: .94; filter: blur(6px); }
}
.home-v2 .modal-box {
  position: relative;
  background: var(--h-mega-bg); border: 1px solid var(--h-line); border-radius: 24px; color: var(--h-fg);
  font-family: 'Anuphan', sans-serif;
  box-shadow: 0 40px 90px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .05);
}
/* The light that runs along the top edge once per open. */
.home-v2 .modal-box::before {
  content: ""; position: absolute; top: -1px; left: 12%; right: 12%; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent);
  opacity: 0;
}
.home-v2 .modal-overlay.open .modal-box::before { animation: pop-edge-run 1.1s cubic-bezier(.65, 0, .35, 1) .15s; }
@keyframes pop-edge-run {
  0% { opacity: 0; translate: -40% 0; }
  30% { opacity: 1; }
  100% { opacity: 0; translate: 40% 0; }
}
/* Plain .btn inside a popup on pages without castle.css (index) — the same
   muted / white pill pair castle.css gives every v2 page. */
.home-v2 .modal-box .btn {
  background: #1f1f1f; color: var(--h-fg); border: 1px solid transparent; border-radius: 999px;
  font-family: 'Anuphan', sans-serif; font-weight: 700;
  transition: transform .3s cubic-bezier(.23, 1, .32, 1), background .2s, color .2s, border-color .2s;
}
.home-v2 .modal-box .btn:hover:not(:disabled) { background: #2b2b2b; border-color: rgba(250, 250, 250, .18); transform: scale(1.05); }
.home-v2 .modal-box .btn:active:not(:disabled) { transform: scale(.95); }
.home-v2 .modal-box .btn-primary { background: var(--h-pill-bg); color: var(--h-pill-fg); }
.home-v2 .modal-box .btn-primary:hover:not(:disabled) { background: #e5e5e5; }

/* ----- Confirm / alert popups (.confirm-modal-box on each page, and the
   logout confirm) — centred, with an accent badge js/auth.js adds on top:
   yellow ? for a question, sky i for an OK-only notice (cancel hidden),
   rose door for logging out. */
.home-v2 .confirm-modal-box { width: min(400px, 100%); max-width: 400px; padding: 28px 24px 22px; text-align: center; }
.home-v2 .confirm-modal-box .confirm-modal-message { margin-bottom: 22px; font-size: 14.5px; line-height: 1.7; color: var(--h-fg); }
.home-v2 .confirm-modal-box .confirm-modal-actions { justify-content: center; }
.home-v2 .confirm-modal-box .confirm-modal-actions .btn { min-width: 116px; padding: 10px 20px; font-size: 14px; }

.pop-badge {
  --pop-accent: var(--h-yellow);
  position: relative; display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 16px;
  border-radius: 18px; color: var(--pop-accent);
  background: color-mix(in srgb, var(--pop-accent) 10%, #0e0e0e);
  border: 1px solid color-mix(in srgb, var(--pop-accent) 38%, transparent);
  box-shadow: 0 0 28px color-mix(in srgb, var(--pop-accent) 16%, transparent), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.pop-badge::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  border: 1.5px solid var(--pop-accent); opacity: 0;
}
.pop-badge svg { overflow: visible; }
.pop-badge .pop-ico-info { display: none; }
.confirm-modal-box:has(#confirmModalCancelBtn[style*="none"]) .pop-badge { --pop-accent: var(--h-sky); }
.confirm-modal-box:has(#confirmModalCancelBtn[style*="none"]) .pop-ico-help { display: none; }
.confirm-modal-box:has(#confirmModalCancelBtn[style*="none"]) .pop-ico-info { display: block; }
.pop-badge.is-logout { --pop-accent: var(--h-rose); }
/* error notice (counter.js showError): rose, and the "i" stood on its head reads as "!" */
.confirm-modal-box.is-error:has(#confirmModalCancelBtn) .pop-badge { --pop-accent: var(--h-rose); }
.confirm-modal-box.is-error .pop-ico-info { rotate: 180deg; }

/* Open sequence: badge springs in and rings out, then the message and
   buttons rise in turn. Fill "backwards" only, so hover transforms on the
   buttons still work once the entrance has finished. */
.modal-overlay.open .pop-badge { animation: pop-badge-in .6s cubic-bezier(.34, 1.56, .64, 1) .08s backwards; }
.modal-overlay.open .pop-badge::after { animation: pop-ring 1s ease-out .4s; }
.modal-overlay.open .pop-q-mark { animation: pop-q-wobble .9s ease-in-out .45s; }
.modal-overlay.open .pop-dot { animation: pop-dot-bounce .7s cubic-bezier(.34, 1.56, .64, 1) .55s backwards; }
.modal-overlay.open .pop-logout-arrow { animation: pop-arrow-out 1s cubic-bezier(.65, 0, .35, 1) .45s; }
.modal-overlay.open .confirm-modal-message { animation: pop-rise .45s cubic-bezier(.23, 1, .32, 1) .14s backwards; }
.modal-overlay.open .confirm-modal-actions > * { animation: pop-rise .45s cubic-bezier(.23, 1, .32, 1) .22s backwards; }
.modal-overlay.open .confirm-modal-actions > * + * { animation-delay: .28s; }
.pop-q-mark, .pop-logout-arrow { transform-box: fill-box; transform-origin: 50% 90%; }
/* The logout button pushes the arrow out of the door while hovered. */
.confirm-modal-box:has(#logoutConfirmOk:is(:hover, :focus-visible)) .pop-logout-arrow { animation: pop-arrow-out 1s cubic-bezier(.65, 0, .35, 1) infinite; }
.confirm-modal-box:has(#logoutConfirmOk:is(:hover, :focus-visible)) .pop-badge { border-color: var(--pop-accent); }
@keyframes pop-badge-in { from { opacity: 0; scale: .4; rotate: -18deg; } }
@keyframes pop-ring { 0% { opacity: .8; scale: 1; } 100% { opacity: 0; scale: 1.45; } }
@keyframes pop-q-wobble { 20% { rotate: -14deg; } 45% { rotate: 10deg; } 70% { rotate: -5deg; } }
@keyframes pop-dot-bounce { from { opacity: 0; translate: 0 -5px; } }
@keyframes pop-arrow-out { 0% { translate: 0 0; opacity: 1; } 45% { translate: 5px 0; opacity: 0; } 46% { translate: -4px 0; opacity: 0; } 100% { translate: 0 0; opacity: 1; } }
@keyframes pop-rise { from { opacity: 0; translate: 0 8px; } }

@media (prefers-reduced-motion: reduce) {
  .home-v2 .modal-overlay > :is(.modal-box, .dp-box) { translate: none; scale: none; filter: none; transition-duration: .12s; }
  .home-v2 .modal-overlay.open > :is(.modal-box, .dp-box) { @starting-style { translate: none; scale: none; filter: none; } }
  .home-v2 .modal-overlay { transition-duration: .12s; }
  .home-v2 .modal-overlay .modal-box::before,
  .modal-overlay .pop-badge, .modal-overlay .pop-badge::after, .modal-overlay .pop-badge *,
  .modal-overlay .confirm-modal-message, .modal-overlay .confirm-modal-actions > * { animation: none !important; }
}
/* ทีมตีเทพแห่งการทำลาย (boss-skill.html) takes the full row under กิลด์เรด + บิงโกวอร์. */
.mcard.m-small.m-wide.m-boss { grid-column: span 6; }
