:root {
  --bg: #fff3e6;
  --card: #fffdf9;
  --ink: #3b2f2c;
  --soft: #6e5f59;
  --muted: #9c8c84;
  --tai: #ff5470;
  --tai-2: #ffc2cc;
  --xiu: #4d8dff;
  --xiu-2: #c9dcff;
  --gold: #ffc53d;
  --gold-2: #ffe7a6;
  --mint: #c9f2d9;
  --lav: #e4d7ff;
  --felt: #2f8f6b;
  --felt-2: #3fae84;
  --line: 2.5px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --hd-bg: #fffdf9; --hd-text: #3b2f2c; --hd-muted: #8a7a72; --hd-field: #fff1e0; --hd-accent: #ff5470; --hd-accent-ink: #fff; --hd-shadow: rgba(255, 84, 112, 0.35);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; color: var(--ink);
  font: 15px/1.5 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  background-image: radial-gradient(#ffd9bf 1.4px, transparent 1.6px); background-size: 24px 24px;
}
button { font: inherit; color: inherit; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top ---------- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; max-width: 1080px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px 6px; }
.brand { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; }
.brand span { display: grid; line-height: 1.2; }
.brand b { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.brand small { color: var(--muted); font-size: 13px; font-weight: 600; }
.top-right { display: flex; gap: 8px; align-items: center; }
.wallet { display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 14px 0 8px; background: var(--gold-2); border: var(--line); border-radius: 999px; box-shadow: var(--shadow-sm); font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.wallet.bump { animation: bump 0.45s ease; }
@keyframes bump { 40% { transform: scale(1.12); } }
.coin { width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3b0, var(--gold) 55%, #e09b00); border: 2px solid var(--ink); display: inline-block; flex: none; position: relative; }
.coin::after { content: "x"; position: absolute; inset: 0; display: grid; place-items: center; font: 900 11px/1 system-ui, sans-serif; color: #8a5a00; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: var(--line); background: var(--card); box-shadow: var(--shadow-sm); display: grid; place-items: center; }
.icon-btn.off .wave { display: none; }
.account { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px 0 5px; border: var(--line); border-radius: 999px; background: var(--card); box-shadow: var(--shadow-sm); font-weight: 700; font-size: 14px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--tai-2); border: 2px solid var(--ink); font-weight: 800; }

.tabs { display: flex; gap: 6px; max-width: 1080px; margin: 8px auto 0; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: none; position: relative; padding: 10px 18px; border: var(--line); border-radius: 16px; background: var(--card); font-weight: 800; box-shadow: var(--shadow-sm); transition: transform 0.12s; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.tabs button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.badge { position: absolute; top: -6px; right: -6px; width: 14px; height: 14px; border-radius: 50%; background: var(--tai); border: 2px solid var(--ink); }

main { max-width: 1080px; margin: 0 auto; padding: 16px 16px 40px; }
.card { background: var(--card); border: var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card h2 { margin: 0 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.hint { color: var(--soft); margin: 0 0 14px; font-size: 14px; }
.fine { text-align: center; color: var(--muted); font-size: 12.5px; margin: 10px auto 0; max-width: 60ch; }

.btn { border: var(--line); border-radius: 16px; padding: 11px 18px; font-weight: 800; background: var(--card); box-shadow: var(--shadow-sm); transition: transform 0.12s, box-shadow 0.12s; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }
.btn.primary { background: var(--tai); color: #fff; }
.btn.big { font-size: 18px; padding: 13px 30px; }
.btn.wide { width: 100%; }
.btn.ghost { background: var(--card); }
:is(.btn, .tabs button, .zone, .chip, .icon-btn, .account):focus-visible { outline: 3px solid #4d8dff; outline-offset: 3px; }

/* ---------- dice table ---------- */
.table { background: var(--felt); border: var(--line); border-radius: 32px; box-shadow: var(--shadow); padding: 18px; color: #fff; position: relative; overflow: hidden;
  background-image: radial-gradient(circle at 50% 30%, var(--felt-2), var(--felt) 70%); }
.road { display: flex; gap: 5px; flex-wrap: wrap; min-height: 26px; justify-content: center; margin-bottom: 10px; }
.road i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 800 11px/1 system-ui, sans-serif; font-style: normal; border: 2px solid var(--ink); }
.road i.tai { background: var(--tai); color: #fff; }
.road i.xiu { background: var(--xiu); color: #fff; }
.road i.bao { background: var(--gold); color: var(--ink); }
.road i.new { animation: pop 0.4s cubic-bezier(0.3, 1.6, 0.6, 1); }
@keyframes pop { from { transform: scale(0); } }

.bowl-wrap { display: grid; justify-items: center; gap: 10px; margin: 6px 0 16px; }
.plate { position: relative; width: min(300px, 78vw); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fffaf2, #f1e3d0 70%); border: var(--line); box-shadow: 0 10px 0 rgba(0, 0, 0, 0.18), inset 0 -10px 0 rgba(0, 0, 0, 0.06); display: grid; place-items: center; }
.dice { display: flex; gap: 12px; perspective: 600px; }
.die { --s: 56px; width: var(--s); height: var(--s); position: relative; transform-style: preserve-3d; transform: rotateX(var(--rx, -20deg)) rotateY(var(--ry, 20deg)); transition: transform 1.1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.die .f { position: absolute; inset: 0; border-radius: 12px; background: #fff; border: 2.5px solid var(--ink); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 7px; backface-visibility: hidden; box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.08); }
.die .f i { width: 11px; height: 11px; border-radius: 50%; background: var(--ink); align-self: center; justify-self: center; }
.die .f.red i { background: var(--tai); width: 13px; height: 13px; }
.die .f.big i { width: 18px; height: 18px; }
.f1 { transform: translateZ(calc(var(--s) / 2)); }
.f6 { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.f2 { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.f5 { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.f3 { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.f4 { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.p1 { grid-area: 1 / 1; } .p2 { grid-area: 1 / 2; } .p3 { grid-area: 1 / 3; } .p4 { grid-area: 2 / 1; } .p5 { grid-area: 2 / 2; } .p6 { grid-area: 2 / 3; } .p7 { grid-area: 3 / 1; } .p8 { grid-area: 3 / 2; } .p9 { grid-area: 3 / 3; }

.lid { position: absolute; inset: -4%; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #ffd1d9, var(--tai) 60%, #c8324d); border: var(--line); box-shadow: var(--shadow); transform: translateY(-130%) scale(0.9); opacity: 0; transition: transform 0.45s cubic-bezier(0.5, -0.4, 0.4, 1.4), opacity 0.3s; pointer-events: none; }
.lid span { font-weight: 900; font-size: 28px; color: #fff; text-shadow: 2px 2px 0 var(--ink); letter-spacing: 0.04em; }
.lid::before { content: ""; position: absolute; top: 8%; width: 22%; height: 12%; border-radius: 50%; background: var(--gold); border: var(--line); }
.lid.on { transform: none; opacity: 1; }
.lid.shake { animation: shake 0.16s linear infinite; }
@keyframes shake { 0% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(-6px, 2px) rotate(-4deg); } 50% { transform: translate(5px, -2px) rotate(3deg); } 75% { transform: translate(-4px, -1px) rotate(-2deg); } }

.result { min-height: 34px; padding: 5px 16px; border-radius: 999px; background: rgba(0, 0, 0, 0.22); font-weight: 800; font-size: 16px; text-align: center; }
.result b.tai { color: #ffd0d8; } .result b.xiu { color: #cfe0ff; } .result b.bao { color: var(--gold-2); }
.result.win { background: var(--gold); color: var(--ink); animation: pop 0.4s cubic-bezier(0.3, 1.6, 0.6, 1); }

.zones { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; }
.zone { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 120px; padding: 14px; border: var(--line); border-radius: 22px; box-shadow: var(--shadow-sm); transition: transform 0.12s; color: var(--ink); }
.zone b { font-size: clamp(30px, 6vw, 44px); line-height: 1; font-weight: 900; letter-spacing: 0.02em; }
.zone small { font-weight: 700; font-size: 12.5px; opacity: 0.8; }
.zone.tai { background: var(--tai-2); }
.zone.tai b { color: var(--tai); text-shadow: 2px 2px 0 var(--ink); }
.zone.xiu { background: var(--xiu-2); }
.zone.xiu b { color: var(--xiu); text-shadow: 2px 2px 0 var(--ink); }
.zone.bao { background: var(--gold-2); min-width: 110px; }
.zone.bao b { font-size: 22px; color: #e08a00; text-shadow: 1.5px 1.5px 0 var(--ink); }
.zone:active { transform: translate(2px, 2px); }
.zone.hit { animation: glow 1.2s ease 2; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px var(--gold), var(--shadow-sm); transform: scale(1.03); } }
.stake { position: absolute; top: -12px; right: -8px; display: none; align-items: center; gap: 4px; padding: 3px 10px 3px 4px; background: var(--card); border: 2px solid var(--ink); border-radius: 999px; font-weight: 800; font-size: 13px; box-shadow: 2px 2px 0 var(--ink); }
.stake.on { display: inline-flex; animation: pop 0.25s ease; }
.stake .coin { width: 18px; height: 18px; }
.stake .coin::after { font-size: 9px; }

.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 18px 0 14px; }
.chip { --c: #fff; width: 58px; height: 58px; border-radius: 50%; border: var(--line); background: var(--c); font-weight: 900; font-size: 13px; color: var(--ink); box-shadow: 0 4px 0 var(--ink); position: relative; transition: transform 0.12s; background-image: repeating-conic-gradient(rgba(255, 255, 255, 0.7) 0 12deg, transparent 12deg 45deg); }
.chip span { position: absolute; inset: 9px; border-radius: 50%; background: var(--c); border: 2px dashed rgba(59, 47, 44, 0.5); display: grid; place-items: center; }
.chip[aria-checked="true"] { transform: translateY(-8px); box-shadow: 0 10px 0 var(--ink); }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.actions .btn.primary { min-width: 160px; }

/* ---------- slot ---------- */
.machine { max-width: 520px; margin: 0 auto; background: linear-gradient(180deg, #ff8fa3, var(--tai)); border: var(--line); border-radius: 34px; box-shadow: var(--shadow); padding: 18px; display: grid; gap: 14px; }
.jar-head { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 10px 16px; background: var(--ink); border-radius: 20px; color: var(--gold); }
.jar-ic { width: 52px; height: 52px; animation: wiggle 2.4s ease-in-out infinite; }
@keyframes wiggle { 0%, 70%, 100% { transform: rotate(0); } 80% { transform: rotate(-8deg); } 90% { transform: rotate(6deg); } }
.jar-head small { display: block; color: #ffe7a6; font-weight: 700; font-size: 12.5px; }
.jar-head b { font-size: clamp(26px, 6vw, 36px); font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; text-shadow: 0 0 12px rgba(255, 197, 61, 0.5); }
.reels { --cell: clamp(80px, 22vw, 112px); position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px; background: #fff7ee; border: var(--line); border-radius: 22px; box-shadow: inset 0 8px 0 rgba(0, 0, 0, 0.06); }
.reel { height: calc(var(--cell) * 3); overflow: hidden; border-radius: 14px; background: var(--card); border: 2px solid var(--ink); position: relative;
  -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); }
.strip { will-change: transform; }
.strip svg { display: block; width: 100%; height: var(--cell); padding: 14%; }
.strip.blur svg { filter: blur(1.5px); }
.payline { position: absolute; left: 6px; right: 6px; top: 50%; height: var(--cell); transform: translateY(-50%); border: 3px dashed var(--tai); border-radius: 16px; pointer-events: none; }
.reels.win .payline { border-style: solid; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255, 197, 61, 0.5); animation: glow 0.8s ease 3; }
.slot-msg { text-align: center; font-weight: 800; color: #fff; text-shadow: 1.5px 1.5px 0 var(--ink); min-height: 24px; }
.bet-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 16px; background: rgba(255, 255, 255, 0.9); border: var(--line); border-radius: 18px; font-weight: 800; }
.bets { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.bets button { padding: 7px 12px; border: 2px solid var(--ink); border-radius: 12px; background: var(--card); font-weight: 800; font-size: 13.5px; }
.bets button[aria-checked="true"] { background: var(--gold); box-shadow: 0 3px 0 var(--ink); transform: translateY(-2px); }
#spin { background: var(--gold); color: var(--ink); font-size: 22px; letter-spacing: 0.04em; }
.paytable { background: rgba(255, 255, 255, 0.9); border: var(--line); border-radius: 18px; padding: 10px 14px; }
.paytable summary { font-weight: 800; cursor: pointer; }
.pays { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; margin-top: 10px; }
.pay { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; }
.pay svg { width: 26px; height: 26px; }
.pay span { margin-left: auto; color: var(--tai); }
.jar-wins { color: #fff; font-size: 13px; font-weight: 700; text-align: center; text-shadow: 1px 1px 0 var(--ink); }

/* ---------- tasks ---------- */
.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.task { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 18px; background: #fff7ee; }
.task b { display: block; font-size: 15px; }
.task small { color: var(--soft); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.task small .coin { width: 16px; height: 16px; }
.task small .coin::after { font-size: 8px; }
.task .bar { height: 8px; border-radius: 999px; background: #f0e2d4; overflow: hidden; margin-top: 6px; border: 1.5px solid var(--ink); }
.task .bar i { display: block; height: 100%; background: #3ccf7a; }
.task.claimed { opacity: 0.55; }
.task .btn { padding: 8px 14px; font-size: 14px; }
.task a.btn { text-decoration: none; color: inherit; }
.rescue { margin-top: 16px; padding: 14px; border: 2px dashed var(--ink); border-radius: 18px; background: var(--gold-2); }
.rescue p { margin: 0 0 10px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stats div { text-align: center; padding: 10px; border-radius: 16px; background: #fff7ee; border: 2px solid var(--ink); }
.stats b { display: block; font-size: 22px; font-weight: 900; }
.stats small { color: var(--soft); font-weight: 700; font-size: 12.5px; }

/* ---------- top ---------- */
ol.board { margin: 0; padding: 0; display: grid; gap: 8px; }
ol.board li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 14px; border: 2px solid var(--ink); border-radius: 16px; background: #fff7ee; font-weight: 700; }
ol.board li.me { background: var(--gold-2); }
ol.board .rank { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 2px solid var(--ink); font-weight: 900; }
ol.board li:nth-child(1) .rank { background: var(--gold); }
ol.board li:nth-child(2) .rank { background: #dfe6ee; }
ol.board li:nth-child(3) .rank { background: #f3c19a; }
ol.board .amt { display: flex; align-items: center; gap: 6px; font-weight: 900; font-variant-numeric: tabular-nums; }

/* ---------- welcome ---------- */
.welcome { max-width: 560px; margin: 40px auto; padding: 28px 22px; text-align: center; background: var(--card); border: var(--line); border-radius: 30px; box-shadow: var(--shadow); }
.welcome-art { display: flex; justify-content: center; gap: 14px; margin-bottom: 8px; perspective: 600px; }
.welcome-art .die { --s: 60px; animation: tumble 4s ease-in-out infinite; }
.welcome-art .die:nth-child(2) { animation-delay: -1.3s; }
.welcome-art .die:nth-child(3) { animation-delay: -2.6s; }
@keyframes tumble { 50% { transform: rotateX(-30deg) rotateY(200deg) translateY(-8px); } }
.welcome h1 { font-size: clamp(24px, 4vw, 32px); line-height: 1.2; letter-spacing: -0.03em; margin: 12px 0 8px; }
.welcome p { color: var(--soft); }
.welcome small { display: block; margin-top: 14px; color: var(--muted); }

/* ---------- win pop, toast ---------- */
.win-pop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; pointer-events: none; }
.win-pop div { padding: 18px 34px; background: var(--gold); border: var(--line); border-radius: 26px; box-shadow: var(--shadow); text-align: center; animation: winIn 2s cubic-bezier(0.3, 1.6, 0.6, 1) forwards; }
.win-pop small { display: block; font-weight: 800; font-size: 15px; }
.win-pop b { font-size: clamp(34px, 8vw, 54px); font-weight: 900; letter-spacing: -0.03em; }
@keyframes winIn { 0% { transform: scale(0.3) rotate(-8deg); opacity: 0; } 15% { transform: scale(1.08) rotate(2deg); opacity: 1; } 25% { transform: scale(1); } 80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(0.9) translateY(-20px); } }
.confetti { position: fixed; top: -12px; z-index: 59; width: 10px; height: 14px; border: 1.5px solid var(--ink); border-radius: 3px; pointer-events: none; animation: fall var(--d, 2s) linear forwards; }
@keyframes fall { to { transform: translate(var(--x, 0), 105vh) rotate(var(--r, 540deg)); } }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 70; transform: translate(-50%, 150%); visibility: hidden; padding: 10px 18px; background: var(--ink); color: #fff; border-radius: 14px; font-weight: 700; transition: transform 0.25s, visibility 0.25s; max-width: calc(100vw - 32px); }
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast.err { background: #c8324d; }

@media (max-width: 620px) {
  .zones { grid-template-columns: 1fr 1fr; }
  .zone.bao { grid-column: 1 / -1; grid-row: 2; min-height: 64px; }
  .zone { min-height: 100px; }
  .die { --s: 46px; }
  .die .f i { width: 9px; height: 9px; }
  .die .f.big i { width: 15px; height: 15px; }
  .chip { width: 52px; height: 52px; font-size: 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .brand small { display: none; }
  .account #account-name { display: none; }
  .account { padding: 0 5px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition-duration: 0.01s !important; } }
.table .btn.ghost { color: var(--ink); }

/* ---------- Kenney assets (CC0) ---------- */
.die .f { background: #fff center / 100% 100% no-repeat; border: 0; padding: 0; border-radius: 9px; box-shadow: none; }
.chip { width: 60px; height: 60px; border: 0; border-radius: 50%; background: center / contain no-repeat; box-shadow: none; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.35)); }
.chip span { position: absolute; inset: 0; border: 0; background: none; display: grid; place-items: center; font-weight: 900; font-size: 13px; color: var(--ink); text-shadow: 0 0 3px #fff, 0 0 2px #fff; }
.chip[data-chip="10000"] span { color: #fff; text-shadow: 0 0 3px #000; }
.chip[aria-checked="true"] { transform: translateY(-8px); box-shadow: none; filter: drop-shadow(0 10px 0 rgba(0, 0, 0, 0.35)) drop-shadow(0 0 6px var(--gold)); }
.pile { position: absolute; left: 50%; bottom: 8px; width: 46px; height: 0; transform: translateX(-50%); pointer-events: none; }
.pile img { position: absolute; left: 0; bottom: calc(var(--i) * 6px); width: 46px; height: auto; animation: drop 0.25s ease-out; }
@keyframes drop { from { transform: translateY(-24px); opacity: 0; } }
.zone b, .zone small { position: relative; z-index: 1; }
.zone { padding-bottom: 40px; }
.zone.bao { padding-bottom: 14px; }
.zone.bao .pile { left: auto; right: 14px; bottom: 10px; transform: none; }
.fx { position: fixed; z-index: 61; pointer-events: none; animation: fx 1.1s cubic-bezier(0.2, 0.8, 0.3, 1) forwards; }
@keyframes fx { 0% { transform: translate(0, 0) scale(0.2) rotate(0); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(var(--rot)); opacity: 0; } }
.win-pop { background: radial-gradient(circle, rgba(59, 47, 44, 0.35), transparent 70%); }
.win-glow { position: absolute; width: min(560px, 120vw); height: auto; animation: spinGlow 4s linear infinite; opacity: 0.9; }
@keyframes spinGlow { to { transform: rotate(360deg); } }
.win-pop > div { position: relative; }
@media (max-width: 620px) { .chip { width: 52px; height: 52px; } .pile img, .pile { width: 38px; } }
/* piles sit in the bottom-left corner of each zone, clear of the labels */
.pile, .zone.bao .pile { left: 12px; right: auto; bottom: 10px; width: 36px; transform: none; }
.pile img { width: 36px; bottom: calc(var(--i) * 5px); }
.zone { padding-bottom: 14px; }
@media (max-width: 620px) {
  .chips { gap: 6px; flex-wrap: nowrap; }
  .chip { width: 46px; height: 46px; }
  .chip span { font-size: 11.5px; }
  .pile, .pile img { width: 30px; }
}
/* ---------- props: porcelain plate and bowl, felt table (drawn SVG) ---------- */
.table { background-color: #1f7a57; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"), radial-gradient(circle at 50% 28%, #3aa77c, #1f7a57 62%, #145c41);
  box-shadow: inset 0 0 0 7px #d9a93a, inset 0 0 0 10px #7a4f00, inset 0 0 60px rgba(0, 0, 0, 0.35), var(--shadow); }
.plate { background: url(img/plate.svg) center / contain no-repeat; border: 0; box-shadow: none; border-radius: 0; }
.dice { gap: 14px; }
.die .f { border-radius: 11px; }
.lid { inset: -7%; background: url(img/bowl.svg) center / contain no-repeat; border: 0; box-shadow: none; border-radius: 0; filter: drop-shadow(0 14px 10px rgba(0, 0, 0, 0.35)); }
.lid::before { display: none; }
.lid.on { transform: none; }
.result.win b.tai { color: var(--tai); } .result.win b.xiu { color: var(--xiu); } .result.win b.bao { color: #c26a00; }
@media (max-width: 620px) { .pile { display: none; } }

/* ---------- admin ---------- */
.admin-form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 8px; }
.admin-form input { font: inherit; padding: 11px 13px; border: 2px solid var(--ink); border-radius: 14px; background: #fff7ee; color: var(--ink); min-width: 0; }
.quick-give { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quick-give .btn { padding: 8px 14px; font-size: 14px; }
.players, .admin-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.players li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 16px; background: #fff7ee; }
.players small { display: block; color: var(--soft); font-size: 12.5px; }
.players .amt { display: flex; align-items: center; gap: 6px; font-weight: 900; }
.pbtns { display: flex; gap: 6px; }
.pbtns .btn { padding: 6px 10px; font-size: 13px; }
.admin-log li { font-size: 13.5px; padding: 6px 10px; border-radius: 10px; background: #fff7ee; }
.admin-log small { color: var(--muted); margin-left: 6px; }
@media (max-width: 620px) { .admin-form { grid-template-columns: 1fr; } .players li { grid-template-columns: minmax(0, 1fr) auto; } .pbtns { grid-column: 1 / -1; } }

/* ---------- jungle slot (Jungle Slot Assets, CC0) ---------- */
.machine { background: #2a1a0e url(img/slot-bg.webp) center / cover; border-color: #3b2412; box-shadow: inset 0 0 0 6px #b8752f, inset 0 0 0 9px #5a3416, var(--shadow); }
.reels { background: #1b232c; border-color: #5a3416; box-shadow: inset 0 0 0 3px #b8752f, inset 0 10px 18px rgba(0, 0, 0, 0.5); }
.reel { background: #26313c; border-color: #0e141a; }
.strip img { display: block; width: 100%; height: var(--cell); object-fit: cover; user-select: none; }
.strip.blur img { filter: blur(2px) brightness(1.1); }
.payline { border-color: #ffd34d; }
.slot-msg { color: #fff6c8; text-shadow: 0 2px 0 #3b2412, 0 0 8px rgba(0, 0, 0, 0.6); }
.bet-row { background: rgba(255, 246, 220, 0.92); border-color: #5a3416; }
.spin-orb { justify-self: center; width: 116px; height: 116px; border: 0; border-radius: 50%; background: url(img/slot-spin.png) center / contain no-repeat; display: grid; place-items: center; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); transition: transform 0.12s; }
.spin-orb span { font-weight: 900; font-size: 24px; color: #fff; letter-spacing: 0.04em; text-shadow: 0 2px 0 #5b0d8a, 0 0 10px rgba(255, 255, 255, 0.5); }
.spin-orb:hover { transform: scale(1.05); }
.spin-orb:active { transform: scale(0.94); }
.spin-orb:disabled { filter: grayscale(0.6) drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); cursor: progress; }
.pay img { width: 34px; height: 29px; object-fit: cover; border-radius: 5px; }
.paytable { background: rgba(255, 246, 220, 0.92); border-color: #5a3416; }
.jar-wins { color: #fff6c8; text-shadow: 0 1px 0 #3b2412; }
/* dice: rendered faces (White dices, CC0) */
.die .f { border-radius: 14%; }
#spin.spin-orb { background: url(img/slot-spin.png) center / contain no-repeat; color: #fff; padding: 0; box-shadow: none; }

/* ---------- baccarat ---------- */
.hands { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 4px 0 14px; }
.hand { min-height: 196px; padding: 10px 12px 14px; border-radius: 22px; border: 2px dashed rgba(255, 255, 255, 0.45); background: rgba(0, 0, 0, 0.12); }
.hand h3 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 8px; font-size: 18px; font-weight: 900; letter-spacing: 0.06em; }
.hand.player h3 { color: #cfe0ff; } .hand.banker h3 { color: #ffd0d8; }
.hand .score { min-width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--ink); border: var(--line); font-size: 20px; }
.cards { display: flex; gap: 8px; justify-content: center; align-items: center; min-height: 140px; perspective: 800px; }
.pcard { width: 92px; aspect-ratio: 140 / 190; animation: deal 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
.pcard.third { transform: rotate(90deg); margin: 0 14px; }
@keyframes deal { from { transform: translate(0, -120px) rotate(-20deg); opacity: 0; } }
.pcard.third { animation-name: deal3; }
@keyframes deal3 { from { transform: translate(0, -120px) rotate(40deg); opacity: 0; } }
.pcard-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateY(180deg); transition: transform 0.45s ease; }
.pcard.up .pcard-in { transform: rotateY(0); }
.pcard img { position: absolute; inset: 0; width: 100%; height: 100%; backface-visibility: hidden; border-radius: 8px; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.35)); }
.pcard .back { transform: rotateY(180deg); }
.zone.player { background: var(--xiu-2); } .zone.player b { color: var(--xiu); text-shadow: 2px 2px 0 var(--ink); }
.zone.banker { background: var(--tai-2); } .zone.banker b { color: var(--tai); text-shadow: 2px 2px 0 var(--ink); }
.zone.tie { background: var(--mint); min-width: 120px; } .zone.tie b { font-size: 24px; color: #1f9d55; text-shadow: 1.5px 1.5px 0 var(--ink); }
.bac-table .zones .zone b { font-size: clamp(26px, 5vw, 38px); }
.rules { margin-top: 14px; padding: 10px 14px; border-radius: 16px; background: rgba(0, 0, 0, 0.18); font-size: 14px; }
.rules summary { font-weight: 800; cursor: pointer; }
.rules p { margin: 8px 0 0; line-height: 1.55; }

/* ---------- Đường Lên Triệu Phú (quiz ladder) ---------- */
.quiz { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 16px; align-items: start; }
.quiz-main { background: linear-gradient(160deg, #26306b, #141a3d); color: #fff; border: var(--line); border-radius: 28px; box-shadow: var(--shadow); padding: 22px; min-height: 420px; }
.quiz-start, .quiz-end { text-align: center; display: grid; justify-items: center; gap: 10px; padding: 18px 6px; }
.quiz-start h2, .quiz-end h2 { margin: 0; font-size: clamp(28px, 4vw, 38px); font-weight: 900; color: var(--gold); text-shadow: 2px 2px 0 #000; letter-spacing: -0.01em; }
.quiz-start p, .quiz-end p { max-width: 52ch; color: #dfe3ff; margin: 0; }
.quiz-start small { color: #b9c0f0; }
.peak { width: 120px; height: 80px; }
.lifelines { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.lifelines button { padding: 8px 14px; border-radius: 999px; border: 2px solid #ffc53d; background: #1d2552; color: #fff; font-weight: 800; }
.lifelines button:disabled { opacity: 0.35; text-decoration: line-through; cursor: not-allowed; }
.qbox { position: relative; padding: 18px 20px; margin: 0 0 16px; border: 2px solid #8fa2ff; border-radius: 22px; background: linear-gradient(180deg, #2c3a8c, #1a2260); box-shadow: 0 0 0 4px rgba(143, 162, 255, 0.15); text-align: center; }
.qbox small { display: block; color: var(--gold); font-weight: 800; margin-bottom: 6px; }
.qbox p { margin: 0; font-size: clamp(18px, 2.2vw, 22px); font-weight: 700; line-height: 1.4; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ans { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 16px; text-align: left; border: 2px solid #8fa2ff; border-radius: 999px; background: #1a2260; color: #fff; font-weight: 700; font-size: 15.5px; transition: background 0.2s; }
.ans b { color: var(--gold); }
.ans:hover:not(:disabled) { background: #2c3a8c; }
.ans:disabled { cursor: default; }
.ans.pick { background: #ff9f1a; border-color: #ffd27a; color: #2a1600; animation: pulse 0.5s ease infinite alternate; }
.ans.pick b { color: #2a1600; }
.ans.right { background: #22b35e; border-color: #9bf0bf; animation: none; }
.ans.right b { color: #fff; }
.ans.wrong { background: #d8344f; border-color: #ffb3c0; animation: none; }
@keyframes pulse { to { filter: brightness(1.15); } }
.help-out { margin-top: 14px; min-height: 10px; }
.aud { display: flex; gap: 14px; justify-content: center; align-items: flex-end; height: 130px; }
.aud div { display: grid; grid-template-rows: 1fr auto auto; justify-items: center; width: 44px; height: 100%; }
.aud i { align-self: end; width: 26px; background: linear-gradient(180deg, #ffc53d, #ff8a00); border-radius: 6px 6px 0 0; min-height: 2px; }
.aud b { font-size: 12.5px; } .aud span { font-weight: 900; color: var(--gold); }
.phone { margin: 0; padding: 12px 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.1); text-align: center; }
#quiz-stop { display: block; margin: 16px auto 0; }
.ladder { margin: 0; padding: 10px; list-style: none; background: #141a3d; border: var(--line); border-radius: 22px; box-shadow: var(--shadow); display: grid; gap: 2px; }
.ladder li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 10px; border-radius: 10px; color: #b9c0f0; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.ladder li span { color: #7d86c4; width: 22px; }
.ladder li.safe { color: #fff; }
.ladder li.safe b { color: var(--gold); }
.ladder li.done { opacity: 0.6; }
.ladder li.cur { background: #ff9f1a; color: #2a1600; opacity: 1; }
.ladder li.cur span, .ladder li.cur b { color: #2a1600; }
@media (max-width: 760px) {
  .quiz { grid-template-columns: 1fr; }
  .ladder { grid-template-columns: repeat(3, 1fr); order: -1; }
  .ladder li { font-size: 12px; padding: 3px 6px; }
  .answers { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .hands { grid-template-columns: 1fr 1fr; gap: 8px; }
  .pcard { width: 52px; }
  .pcard.third { margin: 0 8px; }
  .hand { min-height: 130px; padding: 8px; }
  .cards { min-height: 86px; gap: 4px; }
  .zone.tie { grid-column: 1 / -1; grid-row: 2; min-height: 64px; }
}
.quiz-main .btn.ghost { color: var(--ink); }

/* ---------- Đường Lên Triệu Phú: game-show stage ---------- */
.quiz-main { position: relative; overflow: hidden; border-color: #0a0d24; background:
  radial-gradient(ellipse 60% 45% at 50% -8%, rgba(150, 175, 255, 0.55), transparent 70%),
  radial-gradient(ellipse 30% 70% at 12% -5%, rgba(255, 210, 120, 0.22), transparent 70%),
  radial-gradient(ellipse 30% 70% at 88% -5%, rgba(255, 210, 120, 0.22), transparent 70%),
  radial-gradient(ellipse 80% 40% at 50% 110%, rgba(80, 60, 200, 0.55), transparent 70%),
  #090c26; }
.quiz-main::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
  background: repeating-conic-gradient(from 180deg at 50% -20%, rgba(255, 255, 255, 0.10) 0 3deg, transparent 3deg 12deg); -webkit-mask-image: linear-gradient(#000, transparent 75%); mask-image: linear-gradient(#000, transparent 75%); }
.quiz-main > * { position: relative; }
.quiz-start h2, .quiz-end h2 { background: linear-gradient(180deg, #fff6c8, #ffc53d 55%, #d68f00); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.6)); }
.peak { width: 130px; height: 98px; filter: drop-shadow(0 0 18px rgba(255, 197, 61, 0.45)); }
.qbox { border: 2px solid transparent; border-radius: 18px; background: linear-gradient(180deg, #17205a, #0d1340) padding-box, linear-gradient(90deg, #8a6a12, #ffe28a, #ffc53d, #ffe28a, #8a6a12) border-box; box-shadow: 0 0 24px rgba(255, 197, 61, 0.25), inset 0 0 30px rgba(120, 150, 255, 0.15); }
.qbox p { color: #fff; text-shadow: 0 1px 0 #000; }
.ans { border: 2px solid transparent; border-radius: 16px; background: linear-gradient(180deg, #1a2468, #0e1544) padding-box, linear-gradient(90deg, #6a5310, #e9c766, #6a5310) border-box; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35); }
.ans:hover:not(:disabled) { background: linear-gradient(180deg, #27338a, #141d5c) padding-box, linear-gradient(90deg, #8a6a12, #ffe28a, #8a6a12) border-box; }
.ans.pick { background: linear-gradient(180deg, #ffb13b, #ff8a00) padding-box, linear-gradient(90deg, #fff1b0, #fff1b0) border-box; color: #2a1600; }
.ans.right { background: linear-gradient(180deg, #2fd27a, #149a52) padding-box, linear-gradient(90deg, #c9ffe0, #c9ffe0) border-box; }
.ans.wrong { background: linear-gradient(180deg, #ff5a72, #c5243f) padding-box, linear-gradient(90deg, #ffd0d8, #ffd0d8) border-box; }
.lifelines button { width: 64px; height: 44px; padding: 0; border-radius: 50%; border: 2px solid #e9c766; background: radial-gradient(circle at 50% 30%, #2c3a96, #10174a); font-size: 12.5px; box-shadow: 0 0 12px rgba(255, 197, 61, 0.25); }
.ladder { background: linear-gradient(180deg, #0f1440, #070a22); border-color: #0a0d24; }
.ladder li.safe { color: #fff; }
.ladder li.cur { background: linear-gradient(90deg, #ff9f1a, #ffc53d); box-shadow: 0 0 14px rgba(255, 159, 26, 0.5); }
/* phones: three cards per hand must fit, so the cards shrink and overlap a little */
.hands { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.hand { min-width: 0; }
@media (max-width: 620px) {
  .hand { padding: 8px 6px 10px; }
  .hand h3 { font-size: 15px; margin-bottom: 6px; }
  .hand .score { min-width: 32px; height: 32px; font-size: 16px; }
  .cards { gap: 0; }
  .pcard { width: 44px; }
  .pcard + .pcard { margin-left: -12px; }
  .pcard.third { margin: 0 2px 0 4px; }
}

/* ---------- Máy Bay (Kenney Tappy Plane, CC0) ---------- */
.flights { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 10px; }
.flights i { flex: none; padding: 4px 10px; border-radius: 999px; font: 800 13px/1.2 system-ui, sans-serif; font-style: normal; border: 2px solid var(--ink); }
.flights i.lo { background: #c9dcff; color: #2a4fa8; }
.flights i.mid { background: #e4d7ff; color: #6a3fd1; }
.flights i.hi { background: #ffc2cc; color: #c8324d; }
.sky { position: relative; height: clamp(260px, 46vh, 420px); border: var(--line); border-radius: 28px; box-shadow: var(--shadow); overflow: hidden; background: #8fd3ff; }
.sky.flying .sky-bg { animation: skyScroll 18s linear infinite; }
@keyframes skyScroll { to { background-position: -800px 100%; } }
.sky.flying .ground { animation: groundScroll 4s linear infinite; }
@keyframes groundScroll { to { background-position: -808px 100%; } }
.trail { position: absolute; inset: 0; width: 100%; height: 100%; }
#trail-fill { fill: rgba(255, 84, 112, 0.22); }
#trail-line { fill: none; stroke: #ff3b5c; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.plane { position: absolute; left: 0; top: 0; width: 88px; transform-origin: 30% 60%; will-change: transform; z-index: 2; }
.plane img { width: 100%; display: block; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.25)); }
.sky.gone .plane { transition: transform 0.9s ease-in, opacity 0.9s; transform: translate(120vw, -60px) rotate(-30deg) !important; opacity: 0; }
.mult { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); z-index: 3; font: 900 clamp(48px, 9vw, 84px)/1 system-ui, sans-serif; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); font-variant-numeric: tabular-nums; }
.sky.gone .mult { color: #ff5470; }
.sky.won .mult { color: #3ccf7a; }
.sky-msg { position: absolute; left: 50%; top: calc(22% + clamp(56px, 10vw, 92px)); transform: translateX(-50%); z-index: 3; padding: 6px 16px; border-radius: 999px; background: rgba(255, 255, 255, 0.9); border: 2px solid var(--ink); font-weight: 800; text-align: center; white-space: nowrap; }
.sky-msg:empty { display: none; }
.sky-msg small { font-weight: 700; color: var(--soft); }
.sky.gone .sky-msg b { color: #ff3b5c; }
.fly-panel { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; margin-top: 16px; padding: 14px; background: var(--card); border: var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.fly-bet label, .fly-auto { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.fly-bet input, .fly-auto input[inputmode] { flex: 1; min-width: 0; font-weight: 800; font-size: 18px; line-height: 1; font-family: inherit; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 14px; background: #fff7ee; color: var(--ink); }
.fly-quick { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.fly-quick button { padding: 6px 10px; border: 2px solid var(--ink); border-radius: 10px; background: var(--gold-2); font-weight: 800; font-size: 13px; }
.fly-auto { flex-wrap: wrap; }
.switch { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--tai); }
.fly-btn { border: var(--line); border-radius: 20px; font-weight: 900; font-size: 26px; line-height: 1.1; font-family: inherit; letter-spacing: 0.04em; color: #fff; background: linear-gradient(180deg, #ff6f87, #e8304f); box-shadow: 0 6px 0 var(--ink); display: grid; place-items: center; min-height: 76px; transition: transform 0.1s; }
.fly-btn small { display: block; font-size: 14px; font-weight: 800; letter-spacing: 0; }
.fly-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.fly-btn.cash { background: linear-gradient(180deg, #ffd25e, #ff9f1a); color: var(--ink); animation: pulse 0.6s ease infinite alternate; }
.fly-btn.wait { background: #c8bfb8; color: var(--ink); font-size: 16px; }
.fly-fine { margin-top: 12px; }
@media (max-width: 760px) {
  .fly-panel { grid-template-columns: 1fr 1fr; }
  .fly-btn { grid-column: 1 / -1; }
  .plane { width: 64px; }
}
@media (max-width: 460px) { .fly-panel { grid-template-columns: 1fr; } }

/* ---------- Phi Công Biển ---------- */
.sea-scene { position: relative; height: clamp(300px, 52vh, 460px); border: var(--line); border-radius: 28px; box-shadow: var(--shadow); overflow: hidden;
  background: linear-gradient(180deg, #4fb6ff 0%, #9fdcff 55%, #d9f2ff 70%); }
.sea-sun { position: absolute; right: 9%; top: 9%; width: 70px; height: 70px; border-radius: 50%; background: radial-gradient(circle, #fff7c2, #ffd34d 60%, rgba(255, 211, 77, 0) 72%); }
.sea-cloud { position: absolute; width: 140px; height: 44px; border-radius: 40px; background: #fff; opacity: 0.9; box-shadow: 40px -14px 0 -2px #fff, 80px 0 0 -6px #fff; }
.sea-cloud.c1 { left: 10%; top: 12%; } .sea-cloud.c2 { left: 55%; top: 22%; transform: scale(0.7); } .sea-cloud.c3 { left: 85%; top: 8%; transform: scale(0.55); }
.sea-scene.flying .sea-cloud { animation: cloudDrift calc(var(--step, 760ms) * 14) linear infinite; }
.sea-scene.flying .c2 { animation-duration: calc(var(--step, 760ms) * 20); } .sea-scene.flying .c3 { animation-duration: calc(var(--step, 760ms) * 26); }
@keyframes cloudDrift { from { translate: 30vw 0; } to { translate: -80vw 0; } }
.sea-water { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: linear-gradient(180deg, #1e8fd6, #0a5c99); }
.wave { position: absolute; left: 0; top: -22px; width: 200%; height: 30px; }
.wave path { fill: #1e8fd6; }
.wave.w2 { top: -12px; opacity: 0.6; } .wave.w2 path { fill: #59b8ef; }
.wave.w1 { animation: waveMove 5s linear infinite; } .wave.w2 { animation: waveMove 8s linear infinite reverse; }
.sea-scene.flying .wave.w1 { animation-duration: 1.6s; } .sea-scene.flying .wave.w2 { animation-duration: 2.4s; }
@keyframes waveMove { to { transform: translateX(-50%); } }
.sea-plane { position: absolute; left: 18%; top: 38%; width: 92px; z-index: 4; transition: top 0.35s cubic-bezier(0.3, 1.4, 0.6, 1), left 1.2s ease-in-out, transform 0.6s; animation: bob 1.4s ease-in-out infinite; }
.sea-plane img { width: 100%; display: block; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.25)); }
.sea-plane.hit img { animation: hitShake 0.45s ease; }
@keyframes hitShake { 20% { transform: rotate(14deg) translateX(-6px); filter: brightness(1.6) drop-shadow(0 0 8px #ff5470); } 60% { transform: rotate(-6deg); } }
.sea-plane.boost img { animation: boostUp 0.45s ease; }
@keyframes boostUp { 40% { transform: rotate(-12deg) scale(1.08); filter: drop-shadow(0 0 10px #ffd34d); } }
.sea-plane.land { left: 64%; top: calc(70% - 92px * 0.62 - 26px) !important; transform: rotate(4deg); animation: none; transition: top 1.1s ease-in, left 1.2s ease-out, transform 0.6s; }
.sea-plane.sink { left: 46%; top: 82% !important; transform: rotate(38deg); animation: none; transition: top 0.7s ease-in, left 0.7s linear, transform 0.7s; }
.sea-items { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.sea-item { position: absolute; left: 100%; display: grid; place-items: center; width: 62px; height: 62px; margin-top: -10px; animation: itemIn linear forwards; }
@keyframes itemIn { to { left: calc(18% + 30px); } }
.sea-item.plus { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #b9ffcf, #2fbf71); border: 3px solid var(--ink); box-shadow: 0 0 14px rgba(47, 191, 113, 0.6); }
.sea-item.mul { border-radius: 16px; background: radial-gradient(circle at 35% 30%, #fff1a8, #ffb300); border: 3px solid var(--ink); transform: rotate(45deg); box-shadow: 0 0 18px rgba(255, 179, 0, 0.7); }
.sea-item.mul b { transform: rotate(-45deg); }
.sea-item b { font: 900 18px/1 system-ui, sans-serif; color: var(--ink); }
.sea-item.rocket { width: 92px; height: 40px; }
.sea-item.rocket svg { width: 100%; height: 100%; transform: scaleX(-1); filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.3)); }
.sea-item.got { animation: none; left: calc(18% + 30px); transition: transform 0.3s, opacity 0.3s; transform: scale(1.6); opacity: 0; }
.sea-item.mul.got { transform: rotate(45deg) scale(1.6); }
.carrier { position: absolute; bottom: calc(30% - 34px); left: 110%; width: min(46%, 360px); z-index: 2; transition: left 0.9s cubic-bezier(0.2, 0.8, 0.3, 1); }
.carrier.in { left: 52%; }
.splash { position: absolute; left: 47%; bottom: 26%; width: 10px; height: 10px; z-index: 5; pointer-events: none; }
.splash.go::before, .splash.go::after { content: ""; position: absolute; left: -40px; bottom: 0; width: 90px; height: 90px; border-radius: 50% 50% 0 0; border: 6px solid #fff; border-bottom: 0; animation: splash 0.8s ease-out forwards; }
.splash.go::after { left: -20px; width: 50px; height: 60px; animation-delay: 0.1s; }
@keyframes splash { from { transform: scale(0.2); opacity: 1; } to { transform: scale(1.4) translateY(-30px); opacity: 0; } }
.sea-total { position: absolute; left: 50%; top: 7%; transform: translateX(-50%); z-index: 5; display: grid; justify-items: center; padding: 8px 22px 10px; border-radius: 22px; background: rgba(255, 255, 255, 0.92); border: var(--line); box-shadow: var(--shadow-sm); min-width: 170px; }
.sea-total small { font-weight: 800; color: var(--soft); font-size: 12.5px; }
.sea-total b { font: 900 clamp(30px, 6vw, 44px)/1 system-ui, sans-serif; color: var(--ink); font-variant-numeric: tabular-nums; }
.sea-total span { font-weight: 800; color: #1f9d55; font-variant-numeric: tabular-nums; }
.sea-total.bump { animation: bump 0.35s ease; }
.sea-msg { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); z-index: 6; padding: 8px 18px; border-radius: 999px; background: rgba(255, 255, 255, 0.95); border: 2px solid var(--ink); font-weight: 800; white-space: nowrap; }
.sea-msg:empty { display: none; }
.sea-scene.won .sea-msg { background: #3ccf7a; color: #fff; }
.sea-scene.won .sea-msg b { color: #fff; }
.sea-scene.lost .sea-msg { background: #ff5470; color: #fff; }
.sea-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 0.9fr); gap: 12px; align-items: stretch; margin-top: 16px; padding: 14px; background: var(--card); border: var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.speeds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.speeds button { display: grid; align-content: center; gap: 2px; padding: 8px 4px; border: 2px solid var(--ink); border-radius: 14px; background: #fff7ee; font-weight: 900; font-size: 14px; }
.speeds button small { font-weight: 700; font-size: 11px; color: var(--soft); }
.speeds button[aria-checked="true"] { background: #4fb6ff; color: #fff; box-shadow: 0 3px 0 var(--ink); transform: translateY(-2px); }
.speeds button[aria-checked="true"] small { color: #eaf6ff; }
.sea-legend { margin: 12px 0 0; text-align: center; color: var(--soft); font-size: 13.5px; font-weight: 600; }
.sea-legend .it { display: inline-grid; place-items: center; min-width: 34px; padding: 1px 6px; border: 2px solid var(--ink); border-radius: 999px; font-weight: 900; font-size: 12px; color: var(--ink); }
.sea-legend .plus { background: #7fe0a6; } .sea-legend .mul { background: #ffd34d; } .sea-legend .rocket { background: #ff9fb0; }
@media (max-width: 760px) {
  .sea-panel { grid-template-columns: 1fr; }
  .sea-plane { width: 64px; left: 10%; }
  @keyframes itemIn { to { left: calc(10% + 20px); } }
  .sea-item { width: 48px; height: 48px; } .sea-item b { font-size: 15px; }
  .sea-item.rocket { width: 70px; height: 30px; }
  .sea-plane.land { left: 60%; top: calc(70% - 64px * 0.62 - 22px) !important; }
  .carrier.in { left: 46%; }
  .carrier { width: 58%; bottom: calc(30% - 26px); }
  .sea-total { min-width: 140px; padding: 6px 16px; }
}

/* ---------- plane art: "Red Biplane" (CC0) and "Hills Scenery" parallax layers (CC0) ---------- */
.sky { background: #e8cdb8; }
.sky-bg, .ground { display: none; }
.layer { position: absolute; top: 0; bottom: 0; left: 0; width: 200%; background-repeat: repeat-x; background-position: 0 100%; background-size: 50% 100%; will-change: transform; }
.l-sky { width: 100%; background-image: url(img/fly/l-sky.webp); background-size: cover; }
.l-clouds { background-image: url(img/fly/l-clouds.webp); }
.l-hills { background-image: url(img/fly/l-hills.webp); }
.l-mid { background-image: url(img/fly/l-mid.webp); }
.l-front { background-image: url(img/fly/l-front.webp); z-index: 1; pointer-events: none; }
.sky.flying .l-clouds { animation: par 70s linear infinite; }
.sky.flying .l-hills { animation: par 40s linear infinite; }
.sky.flying .l-mid { animation: par 20s linear infinite; }
.sky.flying .l-front { animation: par 9s linear infinite; }
@keyframes par { to { transform: translateX(-50%); } }
.sky .trail, .sky .plane { z-index: 2; }
.sky .mult, .sky .sky-msg { z-index: 3; }
#trail-fill { fill: rgba(255, 84, 112, 0.25); }
.plane { width: 120px; }
.sea-plane { width: 130px; }
.plane, .sea-plane { position: absolute; }
.prop { position: absolute; right: 0.5%; top: 14%; width: 7%; height: 60%; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(30, 30, 30, 0.55), rgba(30, 30, 30, 0.15) 60%, transparent 72%); opacity: 0; }
.sky.flying .prop, .sea-plane.spin .prop { opacity: 1; animation: prop 0.09s linear infinite alternate; }
@keyframes prop { from { transform: scaleY(1); } to { transform: scaleY(0.25); } }
.sea-plane.land { top: calc(70% - 130px * 0.546 - 22px) !important; }
@media (max-width: 760px) {
  .plane { width: 84px; }
  .sea-plane { width: 88px; }
  .sea-plane.land { top: calc(70% - 88px * 0.546 - 18px) !important; }
}
/* Bay Cao: keep the multiplier in the top-left corner, clear of the climbing plane */
.sky .mult { left: 22px; top: 16px; transform: none; font-size: clamp(40px, 7vw, 68px); }
.sky .sky-msg { left: 22px; top: calc(16px + clamp(46px, 8vw, 76px)); transform: none; }
