/* ========== FrostFarm — Frost / Snow theme ========== */
:root {
  --ice-0: #ffffff;
  --ice-50: #f4f9fe;
  --ice-100: #e6f2fc;
  --ice-200: #cfe6f9;
  --ice-300: #a9d3f5;
  --frost-400: #6bb6ee;
  --frost-500: #3b9ae1;
  --frost-600: #2179c4;
  --frost-700: #185f9c;
  --frost-900: #0b3a63;

  --ink-900: #0d2b45;
  --ink-700: #2f4e69;
  --ink-500: #5a7590;
  --ink-300: #9db2c5;

  --online: #0f9d78;
  --online-bg: #dcf7ee;
  --offline: #6f8398;
  --offline-bg: #e9eff5;
  --paused: #b9740b;
  --paused-bg: #fdf1dc;
  --done: #2179c4;
  --done-bg: #dcecfb;
  --danger: #c4423a;

  --glass: rgba(255, 255, 255, 0.6);
  --glass-strong: rgba(255, 255, 255, 0.84);
  --glass-border: rgba(255, 255, 255, 0.95);
  --shadow: 0 14px 34px -16px rgba(33, 121, 196, 0.35), 0 2px 6px rgba(13, 43, 69, 0.05);
  --shadow-hover: 0 22px 44px -18px rgba(33, 121, 196, 0.45), 0 2px 8px rgba(13, 43, 69, 0.06);
  --shadow-lg: 0 30px 70px -28px rgba(11, 58, 99, 0.45);
  --radius: 20px;

  --font-head: "Prompt", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Thai", "Prompt", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
section, footer { scroll-margin-top: 84px; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--ink-900);
  background: linear-gradient(180deg, #f8fbff 0%, #eef6fe 40%, #e1eefb 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}
body.locked { overflow: hidden; }

#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

/* แสงออโรร่าเบา ๆ ด้านหลัง */
.aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.aurora span {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55;
  animation: drift 26s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { width: 620px; height: 420px; left: -160px; top: -140px; background: #bfe2ff; }
.aurora span:nth-child(2) { width: 520px; height: 380px; right: -140px; top: 60px; background: #d9ecff; animation-delay: -8s; }
.aurora span:nth-child(3) { width: 480px; height: 320px; left: 35%; top: 420px; background: #c9f0f5; opacity: .35; animation-delay: -16s; }

.wrap { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 0 24px; }

h1, h2, h3 { font-family: var(--font-head); line-height: 1.25; margin: 0; }
code {
  font-family: var(--font-mono);
  background: var(--ice-100); color: var(--frost-700);
  padding: 1px 6px; border-radius: 6px; font-size: .9em;
}
.mono { font-family: var(--font-mono) !important; letter-spacing: .08em; }
.grad {
  background: linear-gradient(90deg, var(--frost-700), var(--frost-500) 55%, #7cc8ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid rgba(169, 211, 245, 0.45);
}
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 66px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink-900); }
.brand-icon {
  width: 36px; height: 36px; padding: 7px; border-radius: 11px; color: #fff;
  background: linear-gradient(135deg, #8fd0ff, var(--frost-500) 45%, var(--frost-700));
  box-shadow: 0 8px 16px -8px rgba(33, 121, 196, .8), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.brand-name { font-family: var(--font-head); font-size: 1.25rem; font-weight: 600; letter-spacing: .2px; }
.brand-name b { color: var(--frost-500); font-weight: 700; }

.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a {
  color: var(--ink-700); text-decoration: none; font-weight: 500; font-size: .95rem;
  padding: 7px 14px; border-radius: 999px; transition: background .2s, color .2s;
}
.nav a:hover { background: var(--ice-100); color: var(--frost-600); }
.nav a:focus-visible { outline: 2px solid var(--frost-400); outline-offset: 2px; }

.sync {
  display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--ink-500);
  padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .8); border: 1px solid var(--ice-200);
  white-space: nowrap;
}
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-300); }
.sync.ok .sync-dot { background: var(--online); animation: pulse 2s infinite; }
.sync.err .sync-dot { background: var(--danger); }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 48px; align-items: center;
  padding-top: 72px; padding-bottom: 32px;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 6px 14px 6px 10px;
  border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--frost-700);
  background: rgba(255, 255, 255, .85); border: 1px solid var(--ice-200);
  box-shadow: 0 4px 14px -8px rgba(33, 121, 196, .4);
}
.eyebrow-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--online); animation: pulse 2s infinite; }
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); font-weight: 700; letter-spacing: -.3px; }
.lead { max-width: 540px; margin: 18px 0 30px; color: var(--ink-500); font-size: 1.06rem; }

/* lookup card */
.lookup {
  max-width: 600px; padding: 18px; border-radius: 24px;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg), inset 0 1px 0 #fff;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.lookup-fields { display: grid; grid-template-columns: 1.2fr 1fr; gap: 10px; }
.lf {
  display: grid; gap: 2px; padding: 10px 14px; border-radius: 14px;
  background: #fff; border: 1px solid var(--ice-200);
  transition: border-color .15s, box-shadow .15s;
}
.lf:focus-within { border-color: var(--frost-400); box-shadow: 0 0 0 4px rgba(107, 182, 238, .22); }
.lf span { font-size: .76rem; font-weight: 600; color: var(--ink-500); }
.lf input {
  border: 0; outline: 0; background: transparent; padding: 2px 0; min-width: 0;
  font: inherit; font-size: 1.05rem; font-weight: 500; color: var(--ink-900);
}
.lf input::placeholder { color: var(--ink-300); font-weight: 400; }
.btn-frost {
  width: 100%; margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; cursor: pointer; font: inherit; font-size: 1.02rem; font-weight: 600; color: #fff;
  padding: 14px 20px; border-radius: 14px;
  background: linear-gradient(135deg, var(--frost-500), var(--frost-700));
  box-shadow: 0 12px 24px -12px rgba(24, 95, 156, .9), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: filter .15s, transform .15s;
}
.btn-frost svg { width: 18px; height: 18px; transition: transform .2s; }
.btn-frost:hover { filter: brightness(1.08); }
.btn-frost:hover svg { transform: translateX(3px); }
.btn-frost:focus-visible { outline: 3px solid var(--ice-300); outline-offset: 2px; }
.btn-frost:disabled { opacity: .7; cursor: progress; }
.lookup-error {
  margin: 10px 0 0; padding: 9px 12px; border-radius: 10px; font-size: .9rem;
  color: #9c3a32; background: #fff4f2; border: 1px solid #f6d3cd;
}
.lookup-hint { display: flex; align-items: center; gap: 8px; margin: 12px 2px 0; font-size: .84rem; color: var(--ink-500); }
.lookup-hint svg { width: 15px; height: 15px; flex: none; color: var(--frost-500); }

/* live stats card */
.live {
  position: relative; overflow: hidden; padding: 28px; border-radius: 28px; color: #fff;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(143, 208, 255, .55), transparent 55%),
    linear-gradient(150deg, #3b9ae1 0%, #1f6fb6 55%, #0b3a63 100%);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.live::after { /* ขอบน้ำแข็งด้านล่าง */
  content: ""; position: absolute; inset: auto 0 0 0; height: 46px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, .12));
}
.live-flake {
  position: absolute; right: -36px; top: -36px; width: 210px; height: 210px; color: rgba(255, 255, 255, .16);
  animation: spin 60s linear infinite;
}
.live-head { position: relative; display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 500; opacity: .9; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #7ff0c9; box-shadow: 0 0 0 0 rgba(127, 240, 201, .6); animation: pulse-w 2s infinite; }
.live-main { position: relative; margin: 18px 0 22px; }
.live-main b { display: block; font-family: var(--font-head); font-size: 4.2rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.live-main span { font-size: 1rem; opacity: .9; }
.live-grid { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.live-grid div {
  padding: 12px; border-radius: 14px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.live-grid b { display: block; font-family: var(--font-head); font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.live-grid span { font-size: .78rem; opacity: .85; }
.live-note { position: relative; display: flex; align-items: center; gap: 8px; margin: 18px 0 0; font-size: .82rem; opacity: .85; }
.live-note svg { width: 15px; height: 15px; flex: none; }

/* ---------- Sections ---------- */
.section { margin-top: 88px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.section-head h2 { font-size: 1.65rem; }
.section-head p { margin: 4px 0 0; color: var(--ink-500); font-size: .95rem; }

/* anonymous queue */
.queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.q-item {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 4px 12px; align-items: center;
  padding: 14px 16px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: rise .4s cubic-bezier(.2, .7, .3, 1) both;
}
.q-icon {
  grid-row: span 2; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 700; color: var(--frost-700); background: var(--ice-100);
}
.q-game { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-item .pill { justify-self: end; }
.q-prog { grid-column: 2 / 4; display: flex; align-items: center; gap: 10px; font-size: .78rem; color: var(--ink-500); }
.q-prog .bar { flex: 1; height: 6px; }
.q-prog b { font-variant-numeric: tabular-nums; color: var(--ink-700); min-width: 38px; text-align: right; }

/* features */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature {
  padding: 22px; border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .2s, box-shadow .2s;
}
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.f-icon {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 14px; border-radius: 13px;
  color: #fff; background: linear-gradient(135deg, #8fd0ff, var(--frost-600));
  box-shadow: 0 8px 18px -10px rgba(33, 121, 196, .9);
}
.f-icon svg { width: 22px; height: 22px; }
.feature h3 { font-size: 1.02rem; margin-bottom: 6px; }
.feature p { margin: 0; color: var(--ink-500); font-size: .9rem; }

/* steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: s; }
.steps li {
  position: relative; padding: 22px; border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow);
}
.step-no {
  display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 12px;
  border-radius: 11px; font-family: var(--font-head); font-weight: 700; color: var(--frost-700);
  background: var(--ice-100); border: 1px solid var(--ice-200);
}
.steps h3 { font-size: 1.02rem; margin-bottom: 4px; }
.steps p { margin: 0; color: var(--ink-500); font-size: .92rem; }

/* ---------- Shared bits (ใช้ทั้งหน้าลูกค้าและแอดมิน) ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.stat b { display: block; font-family: var(--font-head); font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span:not(.stat-icon) { font-size: .88rem; color: var(--ink-500); }
.stat-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; position: relative; }
.stat-icon::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%; }
.ic-all { background: var(--ice-100); }
.ic-all::after { background: var(--frost-500); border-radius: 4px; }
.ic-online { background: var(--online-bg); }
.ic-online::after { background: var(--online); animation: pulse 2s infinite; }
.ic-offline { background: var(--offline-bg); }
.ic-offline::after { background: var(--offline); }
.ic-done { background: var(--done-bg); }
.ic-done::after {
  width: 16px; height: 9px; border-radius: 0; background: none;
  border-left: 3px solid var(--done); border-bottom: 3px solid var(--done);
  transform: translateY(-2px) rotate(-45deg);
}

.pill {
  flex: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--offline-bg); color: var(--offline);
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.online { background: var(--online-bg); color: var(--online); }
.pill.online i { animation: pulse 2s infinite; }
.pill.offline { background: var(--offline-bg); color: var(--offline); }
.pill.paused { background: var(--paused-bg); color: var(--paused); }
.pill.done { background: var(--done-bg); color: var(--done); }

.avatar {
  flex: none; width: 48px; height: 48px; border-radius: 14px; overflow: hidden;
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--frost-400), var(--frost-700));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.prog-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .86rem; margin-bottom: 6px; }
.prog-head span { color: var(--ink-500); }
.prog-head b { font-family: var(--font-head); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prog-head b small { color: var(--ink-500); font-weight: 500; font-family: var(--font-body); }

.bar { position: relative; height: 10px; border-radius: 999px; overflow: hidden; background: var(--ice-100); box-shadow: inset 0 1px 2px rgba(13, 43, 69, .08); }
.bar-fill {
  height: 100%; border-radius: inherit; position: relative; overflow: hidden;
  background: linear-gradient(90deg, var(--frost-400), var(--frost-600));
  transition: width .8s cubic-bezier(.2, .7, .3, 1);
}
.is-online .bar-fill::after, .bar.is-online .bar-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .55) 50%, transparent 80%);
  transform: translateX(-100%); animation: shimmer 2.2s infinite;
}
.is-offline .bar-fill { background: linear-gradient(90deg, #b9c8d6, #8ea2b5); }
.is-paused .bar-fill { background: linear-gradient(90deg, #f3c97a, var(--paused)); }
.is-done .bar-fill { background: linear-gradient(90deg, var(--frost-500), var(--frost-700)); }

.empty { text-align: center; padding: 40px 20px; color: var(--ink-500); }
.empty-flake { font-size: 2.4rem; color: var(--frost-400); animation: spin 12s linear infinite; display: inline-block; }
.empty p { margin: 8px 0 2px; font-weight: 600; color: var(--ink-700); }

.skeleton { height: 92px; border-radius: 16px; background: linear-gradient(100deg, var(--ice-100) 30%, var(--ice-50) 50%, var(--ice-100) 70%); background-size: 300% 100%; animation: skel 1.4s infinite; }

.d-section { font-family: var(--font-head); font-size: .95rem; font-weight: 600; margin: 20px 0 10px; color: var(--ink-700); }
.d-log { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--ice-200); display: grid; gap: 12px; }
.d-log li { position: relative; font-size: .9rem; }
.d-log li::before {
  content: ""; position: absolute; left: -23px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid var(--frost-400);
}
.d-log li:first-child::before { background: var(--frost-400); box-shadow: 0 0 0 4px rgba(107, 182, 238, .25); }
.d-log time { display: block; font-size: .75rem; color: var(--ink-500); }

/* dialog (ใช้ในหน้าแอดมิน) */
.detail {
  width: min(580px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--glass-border); border-radius: 22px; color: var(--ink-900);
  background: rgba(255, 255, 255, .95); box-shadow: 0 30px 80px -20px rgba(13, 43, 69, .45);
}
.detail::backdrop { background: rgba(13, 43, 69, .3); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.detail[open] { animation: pop .25s cubic-bezier(.2, .7, .3, 1); }
.detail-body { padding: 24px; }
.d-head { display: flex; align-items: center; gap: 14px; }
.d-close {
  margin-left: auto; align-self: flex-start; border: 0; cursor: pointer; width: 34px; height: 34px; border-radius: 10px;
  background: var(--ice-100); color: var(--ink-700); font-size: 1.2rem; line-height: 1;
}
.d-close:hover { background: var(--ice-200); }
.d-close:focus-visible { outline: 2px solid var(--frost-400); outline-offset: 2px; }

/* ---------- Footer ---------- */
.footer { position: relative; z-index: 1; margin-top: 110px; padding: 28px 0 22px; color: #dbeeff; background: var(--frost-900); }
.footer-peaks { position: absolute; left: 0; right: 0; bottom: calc(100% - 2px); width: 100%; height: 70px; fill: var(--frost-900); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer .brand-name { color: #fff; }
.footer .brand-name b { color: #8fd0ff; }
.footer p { margin: 4px 0 0; color: #a9c8e4; font-size: .92rem; }
.contact-links { display: flex; gap: 10px; flex-wrap: wrap; }
.contact-links a {
  text-decoration: none; font-weight: 500; font-size: .9rem; color: #fff;
  padding: 8px 16px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2);
  transition: background .2s;
}
.contact-links a:hover { background: rgba(255, 255, 255, .2); }
.copy { margin-top: 22px !important; font-size: .8rem !important; color: #7fa3c4 !important; }

/* ---------- Private order view ---------- */
.ov {
  position: fixed; inset: 0; z-index: 40; overflow-y: auto; overscroll-behavior: contain;
  background:
    radial-gradient(900px 500px at 15% 0%, #d3eaff, transparent 60%),
    radial-gradient(700px 500px at 100% 30%, #e3f1ff, transparent 60%),
    linear-gradient(180deg, #f6faff, #e4f0fb);
  animation: fade .25s ease;
}
.ov-bar {
  position: sticky; top: 0; z-index: 2;
  background: rgba(255, 255, 255, .72); border-bottom: 1px solid rgba(169, 211, 245, .5);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.ov-bar-inner { display: flex; align-items: center; gap: 14px; height: 60px; }
.ov-back {
  display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
  font: inherit; font-weight: 600; font-size: .92rem; color: var(--frost-700);
  padding: 8px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--ice-200);
}
.ov-back svg { width: 16px; height: 16px; }
.ov-back:hover { background: var(--ice-50); }
.ov-back:focus-visible { outline: 2px solid var(--frost-400); outline-offset: 2px; }
.ov-private { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--online); padding: 4px 10px; border-radius: 999px; background: var(--online-bg); }
.ov-private svg { width: 14px; height: 14px; }
.ov-sync { margin-left: auto; font-size: .82rem; color: var(--ink-500); white-space: nowrap; }

.ov-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; padding-top: 28px; padding-bottom: 48px; align-items: start; }

/* 3D stage */
.stage {
  position: sticky; top: 84px; height: min(680px, calc(100vh - 112px)); min-height: 440px;
  border-radius: 28px; overflow: hidden;
  background:
    radial-gradient(60% 45% at 50% 82%, rgba(255, 255, 255, .95), transparent 70%),
    radial-gradient(80% 60% at 50% 0%, #cfe8ff, transparent 70%),
    linear-gradient(180deg, #a9d6fb 0%, #dff0ff 55%, #f4f9ff 100%);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255, 255, 255, .8);
}
.stage-canvas { position: absolute; inset: 0; cursor: grab; touch-action: none; }
.stage-canvas:active { cursor: grabbing; }
.stage-canvas canvas { display: block; width: 100% !important; height: 100% !important; }
.stage-canvas img.fallback { position: absolute; inset: 8% 10% 6%; width: 80%; height: 86%; object-fit: contain; filter: drop-shadow(0 20px 20px rgba(11, 58, 99, .25)); }
.stage-loading, .stage-empty {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px;
  color: var(--frost-700); font-weight: 500; text-align: center;
}
.stage-empty small { color: var(--ink-500); }
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(33, 121, 196, .2); border-top-color: var(--frost-600);
  animation: spin .9s linear infinite;
}
.stage-hud {
  position: absolute; left: 16px; right: 16px; top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  pointer-events: none;
}
.stage-hud .pill { box-shadow: 0 6px 16px -8px rgba(13, 43, 69, .4); font-size: .85rem; padding: 6px 12px; }
.stage-hint {
  display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 500; color: var(--frost-700);
  padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .75);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.stage-hint svg { width: 14px; height: 14px; }

/* info column */
.ov-info { display: grid; gap: 18px; min-width: 0; }
.ov-head h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); word-break: break-word; }
.ov-sub { margin: 0 0 4px; font-size: .88rem; font-weight: 600; color: var(--frost-600); letter-spacing: .3px; }
.ov-task {
  display: flex; gap: 8px; margin: 12px 0 0; padding: 10px 14px; border-radius: 14px;
  font-size: .95rem; color: var(--ink-700); background: rgba(255, 255, 255, .7); border: 1px solid var(--ice-200);
}
.ov-task::before { content: "❄"; color: var(--frost-500); }
.ov-task:empty { display: none; }

.ring-card {
  display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; padding: 22px;
  border-radius: var(--radius); background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow);
}
.ring { position: relative; width: 150px; height: 150px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: none; stroke: var(--ice-100); stroke-width: 11; }
.ring-fill {
  fill: none; stroke: url(#ringGrad); stroke-width: 11; stroke-linecap: round;
  stroke-dasharray: 314.16; stroke-dashoffset: 314.16;
  transition: stroke-dashoffset 1s cubic-bezier(.2, .7, .3, 1);
}
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label b { font-family: var(--font-head); font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ring-label span { font-size: .8rem; color: var(--ink-500); }
.ring-meta { display: grid; gap: 10px; }
.ring-meta div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--ice-200); }
.ring-meta div:last-child { border-bottom: 0; padding-bottom: 0; }
.ring-meta span { color: var(--ink-500); font-size: .88rem; }
.ring-meta b { font-family: var(--font-head); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

.gain { color: var(--online); }
.units { display: grid; gap: 8px; }
.units-title { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: .9rem; color: var(--ink-700); }
.unit-card {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--ice-200);
}
.unit-card b { display: block; font-family: var(--font-head); font-weight: 600; }
.unit-card small { color: var(--ink-500); font-size: .8rem; }
.unit-star {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; font-size: 1.2rem;
  color: #c9a24b; background: linear-gradient(135deg, #fff8e6, #fdecc4);
}
.unit-card.got { border-color: #9fd8c3; background: linear-gradient(135deg, #f2fcf8, #fff); }
.unit-card.got .unit-star { color: #fff; background: linear-gradient(135deg, #f5c84c, #e09a1a); box-shadow: 0 6px 14px -6px rgba(224, 154, 26, .7); }
/* ฟาร์มตามเวลา */
.timed-card {
  display: grid; gap: 10px; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(135deg, #f2f9ff, #fff); border: 1px solid var(--ice-200);
}
.timed-head { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; }
.timed-head b { display: block; font-family: var(--font-head); font-weight: 600; }
.timed-head small { color: var(--ink-500); font-size: .8rem; }
.timed-head small b { display: inline; color: var(--frost-700); font-variant-numeric: tabular-nums; }
.timed-ic {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; font-size: 1.15rem;
  background: linear-gradient(135deg, #e3f2ff, #c9e6ff);
}
.timed-gain { text-align: right; }
.timed-gain small { display: block; }
.timed-gain b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.timed-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .78rem; color: var(--ink-500); }
.timed-meta b { color: var(--ink-700); font-weight: 600; font-variant-numeric: tabular-nums; }
.timed-card.ended { border-color: #9fd8c3; background: linear-gradient(135deg, #f2fcf8, #fff); }
.timed-card.ended .timed-ic { background: linear-gradient(135deg, #dcf7ee, #b9ecd9); }
.timed-card.ended .bar-fill { background: linear-gradient(90deg, var(--frost-500), var(--frost-700)); }
.goal-sub { margin: 6px 0 0; font-size: .8rem; color: var(--ink-500); }
.goal-sub .gain { font-family: var(--font-head); font-weight: 600; }
.goals-list { display: grid; gap: 14px; padding: 18px 20px; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow); }
.goals-list:empty { display: none; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.facts div { padding: 12px 14px; border-radius: 14px; background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: 0 6px 16px -12px rgba(33, 121, 196, .4); }
.facts dt { font-size: .76rem; color: var(--ink-500); }
.facts dd { margin: 0; font-weight: 600; font-size: .95rem; }

.timeline-card { padding: 20px; border-radius: var(--radius); background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow); }
.timeline-card h2 { font-size: 1.05rem; margin-bottom: 14px; }

/* ---------- Animations ---------- */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(15, 157, 120, .45); }
  70% { box-shadow: 0 0 0 7px rgba(15, 157, 120, 0); }
  100% { box-shadow: 0 0 0 0 rgba(15, 157, 120, 0); }
}
@keyframes pulse-w {
  0% { box-shadow: 0 0 0 0 rgba(127, 240, 201, .6); }
  70% { box-shadow: 0 0 0 8px rgba(127, 240, 201, 0); }
  100% { box-shadow: 0 0 0 0 rgba(127, 240, 201, 0); }
}
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(60px, 40px) scale(1.12); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes skel { to { background-position: -150% 0; } }

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

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .features { grid-template-columns: repeat(2, 1fr); }
  .ov-grid { grid-template-columns: 1fr; }
  .stage { position: relative; top: 0; height: 460px; min-height: 0; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 48px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav { display: none; }
  .sync { margin-left: auto; }
  .section { margin-top: 64px; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .lookup { padding: 12px; border-radius: 20px; }
  .lookup-fields { grid-template-columns: 1fr; }
  .live { padding: 22px; }
  .live-main b { font-size: 3.4rem; }
  .features { grid-template-columns: 1fr; }
  .stats { gap: 10px; }
  .stat { padding: 14px; gap: 10px; }
  .stat-icon { width: 36px; height: 36px; }
  .stat b { font-size: 1.4rem; }
  .sync #syncText { display: none; }
  .stage { height: 380px; border-radius: 22px; }
  .ring-card { grid-template-columns: 1fr; justify-items: center; }
  .ring-meta { width: 100%; }
  .ov-private { display: none; }
}
