:root {
  --bg: #f7f1e5;
  --card: #fffdf8;
  --card2: #fff7ea;
  --ink: #2c261e;
  --muted: #7d7263;
  --line: #e8dcc6;
  --accent: #f08a2c;
  --accent2: #ff5f6d;
  --accent-ink: #fff;
  --good: #3c9a4a;
  --bad: #d4453c;
  --gold: #c88a12;
  --shadow: 0 8px 24px rgba(80, 50, 10, 0.09);
  --shadow-lg: 0 18px 40px rgba(80, 50, 10, 0.16);
  --blob1: rgba(255, 190, 110, 0.45);
  --blob2: rgba(140, 210, 120, 0.4);
  --blob3: rgba(255, 140, 170, 0.3);
  --radius: 18px;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1814;
    --card: #27241e;
    --card2: #2e2a22;
    --ink: #f2ecdf;
    --muted: #a99e8c;
    --line: #3b362c;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.5);
    --blob1: rgba(240, 138, 44, 0.16);
    --blob2: rgba(90, 170, 80, 0.13);
    --blob3: rgba(255, 95, 109, 0.1);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
/* Slow coloured light behind everything. */
body::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(30% 28% at 20% 22%, var(--blob1), transparent 70%),
    radial-gradient(28% 26% at 82% 18%, var(--blob2), transparent 70%),
    radial-gradient(34% 30% at 62% 82%, var(--blob3), transparent 70%);
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate3d(5%, -4%, 0) rotate(8deg) scale(1.1); } }
a { color: inherit; }
img { display: block; }
h1, h2 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.warn { color: var(--accent); font-weight: 700; }
.big { font-size: 20px; font-weight: 800; }

/* header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 18px;
  padding: 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.logo {
  font-weight: 900; font-size: 19px; text-decoration: none; white-space: nowrap; letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), #b57bff, var(--accent));
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: hue 8s linear infinite;
}
@keyframes hue { to { background-position: 300% 0; } }
.top nav { display: flex; gap: 6px; flex: 1; min-width: 0; overflow: hidden; }
.top nav a { position: relative; text-decoration: none; color: var(--muted); font-weight: 700; padding: 6px 10px; border-radius: 10px; transition: color .2s, background .2s; }
.top nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--card) 70%, transparent); }
.top nav a.on { color: var(--ink); }
.top nav a.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 1px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent2)); animation: grow .35s var(--spring); }
@keyframes grow { from { transform: scaleX(0); } }
#who { position: relative; }
.chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--card); color: var(--ink); cursor: pointer; font: inherit;
  box-shadow: var(--shadow); transition: transform .15s;
}
@media (hover: hover) { .chip:hover { transform: translateY(-1px); } }
.chip .name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.coins { display: flex; align-items: center; gap: 4px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.coins img { width: 18px; height: 18px; }
.coins.bump { animation: bump .5s var(--spring); }
.coins.bump.up img { animation: spinY .7s ease-out; }
.coins.bump.down { color: var(--bad); animation: bump .5s var(--spring), back-gold 1.2s .4s forwards; }
@keyframes bump { 40% { transform: scale(1.3); } }
@keyframes spinY { to { transform: rotateY(720deg); } }
@keyframes back-gold { to { color: var(--gold); } }
.av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--line); flex: none; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 140px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: drop .2s var(--spring); transform-origin: top right;
}
@keyframes drop { from { transform: scale(.85); opacity: 0; } }
.menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; color: var(--ink); font: inherit; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--bg); }
#who { flex: none; }
@media (max-width: 600px) {
  .top { gap: 8px; justify-content: space-between; }
  .top nav { display: none; }
  .chip .name { display: none; }
}

main { max-width: 1040px; margin: 0 auto; padding: 20px 16px 56px; }
/* Page change: sections rise in one after another. */
#view.enter > * { animation: rise .5s var(--spring) both; }
#view.enter > *:nth-child(2) { animation-delay: .07s; }
#view.enter > *:nth-child(3) { animation-delay: .14s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }

/* buttons */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform .12s, box-shadow .2s, filter .2s;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); } }
.btn:active { transform: scale(.95); }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.btn.primary { background: linear-gradient(135deg, #ff9d3c, var(--accent) 45%, var(--accent2)); border-color: transparent; color: var(--accent-ink); box-shadow: 0 6px 16px rgba(240, 120, 40, .3); }
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 10px 22px rgba(240, 120, 40, .38); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg); }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 10px; }
.btn.big { padding: 12px 22px; font-size: 17px; border-radius: 14px; }
.btn.round { width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: 20px; }
.btn.icon { padding: 5px 8px; }
.btn.icon img { width: 20px; height: 20px; }
.btn .pc { width: 12px; height: 12px; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(240, 138, 44, 0); transform: scale(1.04); } 0%, 100% { box-shadow: 0 0 0 0 rgba(240, 138, 44, .45); } }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .25; transform: scale(0); pointer-events: none; animation: ripple .6s ease-out forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* home */
.hero { position: relative; text-align: center; padding: 40px 0 34px; }
.hero h1 {
  position: relative; font-size: clamp(38px, 9vw, 64px); font-weight: 900; margin: 0; letter-spacing: 2px;
  background: linear-gradient(100deg, var(--ink) 30%, var(--accent) 45%, var(--accent2) 55%, var(--ink) 70%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 5s ease-in-out infinite;
}
@keyframes sheen { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.decos { position: absolute; inset: -10px 0 0; pointer-events: none; }
.deco { position: absolute; width: 42px; height: 42px; opacity: .9; animation: float 6s ease-in-out infinite; animation-delay: calc(var(--i) * -0.7s); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .15)); }
.deco:nth-child(1) { left: 4%; top: 18%; }
.deco:nth-child(2) { left: 16%; top: 70%; width: 34px; height: 34px; }
.deco:nth-child(3) { left: 27%; top: 6%; width: 30px; height: 30px; }
.deco:nth-child(4) { right: 6%; top: 12%; width: 48px; height: 48px; }
.deco:nth-child(5) { right: 18%; top: 66%; }
.deco:nth-child(6) { right: 30%; top: 2%; width: 30px; height: 30px; }
.deco:nth-child(7) { left: 40%; top: 84%; width: 28px; height: 28px; }
.deco:nth-child(8) { right: 42%; top: 86%; width: 30px; height: 30px; }
.deco:nth-child(9) { left: 9%; top: 46%; width: 26px; height: 26px; }
.deco:nth-child(10) { right: 3%; top: 54%; width: 32px; height: 32px; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-16px) rotate(8deg); } }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.cards.home { max-width: 760px; margin: 0 auto; }
.game-card {
  --rx: 0deg; --ry: 0deg;
  position: relative; overflow: hidden; display: grid; justify-items: center; gap: 6px; padding: 30px 18px 24px;
  border-radius: 26px; text-decoration: none; color: #3a2a12;
  background: linear-gradient(160deg, #ffe6c2, #ffc978);
  box-shadow: var(--shadow-lg);
  transform: perspective(700px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .25s ease-out, box-shadow .25s;
}
.game-card.t-farm { background: linear-gradient(160deg, #e3f5c8, #9fd46a); color: #23401a; }
.game-card:hover { box-shadow: 0 26px 50px rgba(80, 50, 10, .25); }
.game-card .shine { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .55), transparent 45%); opacity: 0; transition: opacity .25s; }
.game-card:hover .shine { opacity: 1; }
.game-card .art { width: 128px; height: 128px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .45); box-shadow: inset 0 -8px 20px rgba(0, 0, 0, .06); }
.game-card .art img { width: 96px; height: 96px; animation: bob 3.2s ease-in-out infinite; filter: drop-shadow(0 10px 10px rgba(0, 0, 0, .18)); transition: transform .3s var(--spring); }
.game-card.t-farm .art img { animation-delay: -1.6s; }
.game-card:hover .art img { transform: scale(1.15) rotate(-8deg); }
@keyframes bob { 50% { translate: 0 -10px; } }
.game-card h2 { margin: 8px 0 0; font-size: 24px; font-weight: 900; }
.tag { font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 99px; background: rgba(255, 255, 255, .6); }

.panel { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel-art { width: 56px; height: 56px; margin-bottom: 8px; animation: bob 3.2s ease-in-out infinite; }
.panel.ai { display: grid; justify-items: start; align-content: start; text-decoration: none; transition: transform .2s, box-shadow .2s; }
@media (hover: hover) { .panel.ai:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); } }
.panel.ai .btn { margin-top: auto; }
.field { display: flex; align-items: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.ico { width: 26px; height: 26px; }
.field input { width: 88px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-weight: 700; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 3px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--card2); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: transform .12s; }
.chip-btn:active { transform: scale(.92); }
.chip-btn img { width: 14px; height: 14px; }
.seg { position: relative; display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; flex-wrap: wrap; background: var(--card2); }
.seg button { position: relative; overflow: hidden; border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 700; padding: 7px 13px; cursor: pointer; min-width: 38px; transition: background .2s, color .2s; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: linear-gradient(135deg, #ff9d3c, var(--accent2)); color: #fff; animation: bump .35s var(--spring); }
.pill { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.pill img { width: 13px; height: 13px; }
.pill.gold { color: var(--gold); border-color: currentColor; }
.pill.good { color: var(--good); border-color: currentColor; }
.pill.bad { color: var(--bad); border-color: currentColor; }
.pills { display: flex; gap: 6px; margin-bottom: 10px; }

/* toasts, dialogs, flights, banners */
#toasts { position: fixed; left: 50%; top: 72px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 700; animation: toast-in .4s var(--spring); transition: opacity .3s, transform .3s; text-align: center; }
.toast.bad { background: var(--bad); color: #fff; animation: toast-in .4s var(--spring), shake .4s .1s; }
.toast.good { background: var(--good); color: #fff; }
.toast.out { opacity: 0; transform: translateY(-10px) scale(.95); }
@keyframes toast-in { from { transform: translateY(-20px) scale(.8); opacity: 0; } }
@keyframes shake { 25% { translate: -6px 0; } 50% { translate: 5px 0; } 75% { translate: -3px 0; } }
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(20, 14, 6, .5); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.dlg { position: relative; width: min(420px, 100%); background: var(--card); border-radius: 24px; padding: 26px; box-shadow: var(--shadow-lg); animation: pop-in .4s var(--spring); }
.dlg.small { width: min(340px, 100%); }
@keyframes pop-in { from { transform: scale(.7) translateY(20px); opacity: 0; } }
.dlg .x, .promo .x { position: absolute; right: 12px; top: 8px; border: 0; background: none; font-size: 26px; color: var(--muted); cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions.end { justify-content: flex-end; margin-top: 18px; }
.code { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 16px; padding: 14px 16px; border-radius: 16px; background: var(--bg); border: 2px dashed var(--accent); font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.code i { display: inline-block; font-style: normal; animation: digit .5s var(--spring) both; animation-delay: calc(var(--i) * 60ms + .1s); }
@keyframes digit { from { transform: translateY(-14px) scale(.4); opacity: 0; } }
.wait { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); margin: 0; }
.spin { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fly { position: fixed; left: 0; top: 0; z-index: 70; pointer-events: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .25)); will-change: transform; }
.float-text { position: fixed; z-index: 70; pointer-events: none; transform: translate(-50%, -50%); font-weight: 900; font-size: 22px; color: var(--good); text-shadow: 0 2px 0 #fff, 0 0 12px rgba(255, 255, 255, .8); animation: float-up 1.2s ease-out forwards; }
.float-text.gold { color: var(--gold); }
@keyframes float-up { 0% { opacity: 0; translate: 0 10px; scale: .5; } 20% { opacity: 1; scale: 1.2; } 100% { opacity: 0; translate: 0 -60px; scale: 1; } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 80; pointer-events: none; }
.banner { position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; pointer-events: auto; background: radial-gradient(circle, rgba(0, 0, 0, .25), transparent 70%); animation: fade .25s; transition: opacity .4s; }
.banner.out { opacity: 0; }
.banner-card { display: grid; justify-items: center; gap: 4px; padding: 26px 40px; border-radius: 28px; background: var(--card); box-shadow: var(--shadow-lg); animation: banner-in .6s var(--spring); }
.banner-card img { width: 84px; height: 84px; animation: bob 1.6s ease-in-out infinite, spinY 1s ease-out; }
.banner-card b { font-size: 34px; font-weight: 900; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.banner-card span { color: var(--muted); font-weight: 700; }
@keyframes banner-in { from { transform: scale(.3) rotate(-12deg); opacity: 0; } }

/* chess */
.chess-lobby .cards { margin-bottom: 26px; }
.lists h2 { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.count { font-size: 12px; min-width: 22px; height: 22px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: var(--accent); animation: bump .4s var(--spring); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #ff3b3b; box-shadow: 0 0 0 0 rgba(255, 59, 59, .6); animation: live 1.4s infinite; display: inline-block; margin-left: 6px; vertical-align: middle; }
@keyframes live { 70% { box-shadow: 0 0 0 8px rgba(255, 59, 59, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 59, 59, 0); } }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; transition: transform .2s, box-shadow .2s; }
@media (hover: hover) { .row:hover { transform: translateX(4px); box-shadow: var(--shadow); } }
.row.new { animation: rise .45s var(--spring) both; animation-delay: calc(var(--i) * 50ms); }
.row .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: pre; font-weight: 700; }
.duo { display: flex; }
.duo .av + .av { margin-left: -10px; border: 2px solid var(--card); }
.empty { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 14px; border: 2px dashed var(--line); border-radius: 14px; }
.empty img { width: 28px; height: 28px; opacity: .6; animation: bob 3s ease-in-out infinite; }
.chess-game { display: grid; grid-template-columns: minmax(0, 600px) minmax(240px, 320px); gap: 22px; justify-content: center; align-items: start; }
@media (max-width: 860px) { .chess-game { grid-template-columns: minmax(0, 600px); } }
.board {
  position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; min-width: 0;
  max-width: min(600px, calc(100vh - 190px)); max-width: min(600px, calc(100svh - 190px));
  margin: 0 auto; border-radius: 8px; overflow: hidden; background: #6b4a2b;
  box-shadow: 0 0 0 6px #6b4a2b, 0 0 0 8px #3e2a17, var(--shadow-lg); touch-action: none; user-select: none; -webkit-user-select: none;
}
.board canvas { display: block; }
.col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.pbar { display: flex; align-items: center; gap: 10px; min-height: 44px; max-width: min(600px, calc(100vh - 190px)); max-width: min(600px, calc(100svh - 190px)); margin: 0 auto; width: 100%; min-width: 0; padding: 4px 8px 4px 4px; border-radius: 99px; transition: background .3s, box-shadow .3s; }
.pbar .av { width: 36px; height: 36px; transition: box-shadow .3s; }
.pbar.turn { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pbar.turn .av { box-shadow: 0 0 0 3px var(--accent), 0 0 14px var(--accent); animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 3px var(--accent2), 0 0 22px var(--accent2); } }
.pbar.waiting .av { opacity: .5; animation: bob 2s ease-in-out infinite; }
.pbar .pname { flex: 1; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #8a7a62; flex: none; }
.pc.w { background: #fff; }
.pc.b { background: #222; }
.clock { min-width: 78px; text-align: center; padding: 4px 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font: 800 20px/1.2 ui-monospace, "SF Mono", Consolas, monospace; font-variant-numeric: tabular-nums; transition: background .3s, color .3s, transform .3s; }
.clock.run { background: var(--ink); color: var(--bg); transform: scale(1.06); }
.clock.run.low { background: var(--bad); color: #fff; animation: tick 1s steps(1) infinite; }
@keyframes tick { 50% { transform: scale(1.12); } }
.side { display: grid; gap: 12px; align-content: start; }
.status { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.status p:last-child { margin: 0; }
.your-turn { color: var(--accent); animation: bump .5s var(--spring); }
.dots::after { content: "..."; display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom; animation: dots 1.2s steps(4) infinite; margin-left: 2px; }
@keyframes dots { from { width: 0; } to { width: 1.2em; } }
.moves { margin: 0; padding: 10px 10px 10px 36px; max-height: 260px; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; font-variant-numeric: tabular-nums; columns: 2; column-gap: 24px; }
.moves:empty { display: none; }
.moves li span { display: inline-block; min-width: 4em; font-weight: 700; }
.moves li:last-child { animation: rise .3s var(--spring); }
.promo { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; background: rgba(0, 0, 0, .5); animation: fade .2s; }
.promo button:not(.x) { width: 22%; aspect-ratio: 1; border: 0; border-radius: 14px; background: #f0d9b5; cursor: pointer; padding: 4px; animation: pop-in .35s var(--spring) both; transition: transform .15s; }
.promo button:nth-child(2) { animation-delay: .04s; }
.promo button:nth-child(3) { animation-delay: .08s; }
.promo button:nth-child(4) { animation-delay: .12s; }
.promo button:not(.x):hover { transform: scale(1.08); }
.promo button img { width: 100%; height: 100%; }
.promo .x { color: #fff; }
.result { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .35); cursor: pointer; animation: fade .3s; }
.result > div { display: grid; justify-items: center; gap: 2px; padding: 20px 34px; border-radius: 24px; background: var(--card); box-shadow: var(--shadow-lg); animation: banner-in .6s var(--spring); }
.result img { width: 72px; height: 72px; animation: bob 1.8s ease-in-out infinite; }
.result b { font-size: 28px; font-weight: 900; }
.result span { font-weight: 800; color: var(--muted); }
.result.win b { background: linear-gradient(90deg, #f7b500, var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result.win span { color: var(--gold); font-size: 18px; }
.result.lose { background: rgba(0, 0, 0, .5); }
.result.lose span { color: var(--bad); }
.levels button { min-width: 34px; padding: 7px 0; }

/* farm */
.farm { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.hud { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meter { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 140px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 10px; box-shadow: var(--shadow); }
.meter > img { width: 28px; height: 28px; }
.meter > div { flex: 1; font-size: 13px; }
.meter small { color: var(--muted); font-variant-numeric: tabular-nums; }
.meter.pop > img { animation: bump .45s var(--spring); }
.energy > img { animation: zap 2.4s ease-in-out infinite; }
@keyframes zap { 0%, 88%, 100% { transform: none; } 92% { transform: rotate(-12deg) scale(1.15); } 96% { transform: rotate(10deg); } }
.meter.low .bar i { background: linear-gradient(90deg, #ff6b6b, #ff3b3b); }
.meter.low > img { animation: shake .5s infinite; }
.bar { position: relative; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 3px; }
.bar i { position: relative; display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffb238, #ff8a1f); transition: width .5s var(--spring); overflow: hidden; }
.bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%); background-size: 200% 100%; animation: shimmer 2.2s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -100% 0; } }
.level .bar i { background: linear-gradient(90deg, #7dd36f, #3c9a4a); }
.level.pop > img, .level > img.pop { animation: spinY .8s ease-out; }
.level > img { transition: transform .3s; }
.btn.gift { padding: 4px 10px; animation: wiggle 1.4s infinite; }
.btn.gift img { width: 28px; height: 28px; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-10deg) scale(1.1); } 90% { transform: rotate(10deg) scale(1.1); } 95% { transform: rotate(-4deg); } }
.orders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.order { position: relative; display: grid; gap: 6px; justify-items: center; padding: 10px 6px 8px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); transition: border-color .3s, transform .3s var(--spring); }
.order.ready { border-color: var(--good); animation: ready 1.6s ease-in-out infinite; transform: translateY(-2px); }
@keyframes ready { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 30%, transparent), 0 8px 20px color-mix(in srgb, var(--good) 25%, transparent); } }
.order.ready .btn.primary { animation: pulse 1.6s ease-in-out infinite; }
.order.enter { animation: card-in .55s var(--spring) .45s both; }
@keyframes card-in { from { transform: scale(.4) rotate(-6deg); opacity: 0; } }
.need { display: flex; gap: 4px; }
.want { position: relative; width: clamp(30px, 10vw, 42px); aspect-ratio: 1; border-radius: 12px; background: var(--bg); display: grid; place-items: center; transition: background .3s; }
.want img { width: 80%; height: 80%; opacity: .5; filter: grayscale(.6); transition: opacity .3s, filter .3s; }
.want.have { background: color-mix(in srgb, var(--good) 20%, var(--bg)); }
.want.have img { opacity: 1; filter: none; }
.want.have::after { content: "✓"; position: absolute; left: -3px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%; background: var(--good); color: #fff; font: 900 10px/16px system-ui; text-align: center; }
.want.got img { animation: bump .5s var(--spring); }
.want.got::after { animation: pop-in .4s var(--spring); }
.want em { position: absolute; right: -3px; top: -4px; font: 800 11px/16px system-ui; min-width: 16px; text-align: center; border-radius: 8px; background: #fff; color: #3d6b1a; border: 1px solid #5b8f2a; font-style: normal; }
.reward { display: flex; align-items: center; gap: 3px; font-weight: 800; color: var(--gold); font-size: 14px; font-variant-numeric: tabular-nums; }
.reward img { width: 17px; height: 17px; }
.obtns { display: flex; gap: 2px; align-items: center; }
.obtns .btn.primary { padding: 5px 12px; }
.obtns .icon { font-size: 16px; color: var(--muted); }
.farm .field { margin: 0; min-width: 0; justify-content: center; touch-action: none; user-select: none; -webkit-user-select: none; }
.farm .field canvas { border-radius: 20px; box-shadow: 0 0 0 4px #4e8726, var(--shadow-lg); }
.info { display: none; align-items: center; gap: 12px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.info.show { display: flex; animation: rise .35s var(--spring); }
.info > div { flex: 1; min-width: 0; }
.info p { margin: 4px 0 0; }
.info img.big { width: 46px; height: 46px; animation: bob 2.4s ease-in-out infinite; }
.info .lv { margin-left: 8px; font-size: 12px; font-weight: 800; color: var(--muted); }
.cost { display: flex; align-items: center; gap: 2px; font-weight: 800; }
.cost img { width: 18px; height: 18px; }
.chain { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.chain img { width: 22px; height: 22px; opacity: .3; filter: grayscale(1); transition: transform .3s; }
.chain img.done { opacity: .85; filter: none; }
.chain img.cur { opacity: 1; filter: none; transform: scale(1.35); margin: 0 3px; }
.gate { display: grid; justify-items: center; gap: 14px; padding: 60px 0; text-align: center; }
.gate h1 { font-size: 30px; font-weight: 900; margin: 0; }
.gate-art { width: 120px; height: 120px; animation: bob 2.6s ease-in-out infinite; filter: drop-shadow(0 14px 14px rgba(0, 0, 0, .18)); }

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