:root{--ink:#1d3557;--panel:#ffffffd9;--accent:#ff8c42;color:var(--ink);-webkit-tap-highlight-color:transparent;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}*{box-sizing:border-box}html,body{overscroll-behavior:none;touch-action:manipulation;-webkit-user-select:none;user-select:none;background:#a8dcff;height:100%;margin:0;overflow:hidden}#stage{position:fixed;inset:0}#stage canvas{width:100%;height:100%;display:block}.hud{top:max(12px, env(safe-area-inset-top));left:max(12px, env(safe-area-inset-left));right:max(12px, env(safe-area-inset-right));pointer-events:none;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 12px;display:flex;position:fixed}.hud h1{background:var(--panel);border-radius:999px;margin:0;padding:8px 18px;font-size:clamp(1.1rem,3.5vw,1.8rem);box-shadow:0 4px 14px #0000001f}.track-switch{background:var(--panel);pointer-events:auto;border-radius:999px;gap:6px;padding:6px;display:flex;box-shadow:0 4px 14px #0000001f}.track-switch button{min-height:44px;font:inherit;color:var(--ink);cursor:pointer;background:0 0;border:none;border-radius:999px;padding:0 16px;font-weight:600}.track-switch button[aria-pressed=true]{color:#fff;background:var(--accent)}button{font:inherit;cursor:pointer}.dot{background:var(--car);border:3px solid #fff;border-radius:50%;flex:none;width:18px;height:18px;display:inline-block;box-shadow:0 0 0 1px #00000026}.dot.big{width:40px;height:40px}.medal{background:var(--medal);color:#1d3557;border-radius:999px;place-items:center;min-width:30px;height:30px;padding:0 4px;font-size:.9rem;font-weight:800;display:inline-grid}.medal.big{min-width:52px;height:52px;font-size:1.3rem}.players{left:max(12px, env(safe-area-inset-left));background:var(--panel);border-radius:20px;flex-direction:column;gap:4px;max-height:70vh;margin:0;padding:8px;list-style:none;display:flex;position:fixed;top:50%;overflow:auto;transform:translateY(-50%);box-shadow:0 4px 14px #0000001f}.players:empty{display:none}.player{white-space:nowrap;border-radius:14px;align-items:center;gap:8px;padding:6px 10px;font-weight:600;transition:background .2s;display:flex}.player.current{outline:3px solid var(--accent);background:#ffe8d6}.player.human .name{font-weight:800}.player .pos{font-variant-numeric:tabular-nums;opacity:.7;margin-left:auto;padding-left:6px;font-size:.9rem}.player .medal{margin-left:auto}.roll-btn{left:50%;bottom:max(20px, env(safe-area-inset-bottom));background:var(--accent);color:#fff;border:none;border-radius:999px;align-items:center;gap:14px;min-height:96px;padding:12px 34px 12px 16px;font-size:1.6rem;font-weight:800;animation:1.4s ease-in-out infinite pulse;display:flex;position:fixed;transform:translate(-50%);box-shadow:0 10px 30px #ff8c428c,0 4px #d9662a}.roll-btn svg{width:72px;height:72px}.roll-btn:active{transform:translate(-50%)scale(.95)}@keyframes pulse{50%{box-shadow:0 10px 40px #ff8c42e6,0 4px #d9662a}}.skip-btn{right:max(16px, env(safe-area-inset-right));bottom:max(20px, env(safe-area-inset-bottom));width:76px;height:76px;color:var(--ink);background:#fff;border:none;border-radius:50%;position:fixed;box-shadow:0 6px 18px #0003}.skip-btn svg{width:40px;height:40px}[hidden]{display:none!important}.dice-layer{pointer-events:none;z-index:5;place-items:center;display:grid;position:fixed;inset:0}.dice-layer canvas{filter:drop-shadow(0 12px 24px #00000040)}.toasts{top:max(20px, env(safe-area-inset-top));pointer-events:none;z-index:6;flex-direction:column;align-items:center;gap:8px;display:flex;position:fixed;left:50%;transform:translate(-50%)}.toast{color:#fff;background:var(--ink);white-space:nowrap;border-radius:999px;padding:12px 26px;font-size:clamp(1.3rem,4vw,2rem);font-weight:800;animation:.35s cubic-bezier(.2,1.6,.4,1) toast-in;box-shadow:0 8px 24px #00000040}.toast.out{opacity:0;transition:all .35s;transform:translateY(-12px)}.toast-turbo{background:#f48c06}.toast-mud{background:#7f5539}.toast-ramp{background:#0096c7}.toast-mystery{background:#7b2cbf}.toast-bump{background:#e63946}.toast-finish{background:#2a9d8f}@keyframes toast-in{0%{opacity:0;transform:scale(.5)}}.counter{top:max(20px, env(safe-area-inset-top));width:110px;height:110px;color:var(--accent);pointer-events:none;z-index:6;background:#fff;border-radius:50%;place-items:center;font-size:4.2rem;font-weight:900;display:grid;position:fixed;left:50%;transform:translate(-50%);box-shadow:0 8px 24px #0003}.counter.pop{animation:.3s cubic-bezier(.2,1.8,.4,1) pop}@keyframes pop{0%{transform:translate(-50%)scale(.4)}}.overlay{z-index:10;background:#1d355759;place-items:center;padding:16px;display:grid;position:fixed;inset:0}.card{text-align:center;background:#fff;border-radius:28px;width:min(100%,520px);max-height:calc(100dvh - 32px);padding:24px;overflow:auto;box-shadow:0 20px 60px #0000004d}.card h2{margin:0 0 16px;font-size:clamp(1.6rem,5vw,2.4rem)}.order-list,.rest{gap:6px;margin:0 0 16px;padding:0;list-style:none;display:grid}.order-row,.rest li{background:#f1f5f9;border-radius:14px;align-items:center;gap:12px;min-height:48px;padding:6px 14px;font-size:1.1rem;font-weight:700;display:flex}.order-row.human{outline:3px solid var(--accent)}.order-row .place{width:2ch;font-weight:900}.mini-die{width:40px;height:40px;margin-left:auto;animation:.3s cubic-bezier(.2,1.8,.4,1) pop-in}@keyframes pop-in{0%{transform:scale(.3)rotate(-90deg)}}.big-btn{background:var(--accent);color:#fff;border:none;border-radius:999px;min-width:220px;min-height:72px;padding:0 36px;font-size:1.6rem;font-weight:800;box-shadow:0 4px #d9662a}.podium{justify-content:center;align-items:flex-end;gap:10px;margin-bottom:16px;display:flex}.step{background:#f1f5f9;border-radius:16px 16px 0 0;flex-direction:column;align-items:center;gap:6px;width:30%;padding:12px 6px;font-weight:700;display:flex}.step-1{background:#fff3c4;min-height:190px}.step-2{min-height:155px}.step-3{min-height:125px}.step .name{font-size:.95rem}@media (width<=700px) and (orientation:portrait){.players{top:auto;bottom:calc(max(20px, env(safe-area-inset-bottom)) + 108px);flex-flow:wrap;justify-content:center;max-width:calc(100vw - 24px);max-height:none;padding:6px;left:50%;transform:translate(-50%)}.player{gap:6px;padding:4px 8px}.player .name,.player .pos{display:none}.player.human .name{display:inline}.toasts,.counter{top:84px}}@media (height<=500px){.players{gap:0;padding:4px;font-size:.85rem}.player{padding:3px 8px}.roll-btn{min-height:72px;font-size:1.3rem;bottom:12px}.roll-btn svg{width:52px;height:52px}.counter{width:72px;height:72px;font-size:2.6rem;top:12px}.toasts{top:12px}}.home-btn{top:max(12px, env(safe-area-inset-top));left:max(12px, env(safe-area-inset-left));background:var(--panel);width:60px;height:60px;color:var(--ink);z-index:4;border:none;border-radius:50%;position:fixed;box-shadow:0 4px 14px #00000026}.home-btn svg,.icon-btn svg{flex:none;width:34px;height:34px}.icon-btn{min-width:72px;min-height:72px;color:var(--ink);background:#f1f5f9;border:none;border-radius:999px;justify-content:center;align-items:center;gap:8px;padding:0 20px;font-size:1.3rem;font-weight:800;display:inline-flex;box-shadow:0 4px #cbd5e1}.icon-btn:disabled,.big-btn:disabled{opacity:.35;box-shadow:none}.next-btn,.confirm-yes{background:var(--accent);color:#fff;box-shadow:0 4px #d9662a}.confirm-no{color:#fff;background:#e63946;box-shadow:0 4px #a4161a}.confirm-row{flex-wrap:wrap;justify-content:center;gap:16px;display:flex}.big-btn{justify-content:center;align-items:center;gap:10px;display:inline-flex}.big-btn svg{width:36px;height:36px}.menu{padding:max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));z-index:20;background:#1d355740;place-items:center;display:grid;position:fixed;inset:0}.menu-card{text-align:center;background:#fff;border-radius:28px;flex-direction:column;gap:14px;width:min(100%,900px);max-height:calc(100dvh - 24px);padding:20px;display:flex;box-shadow:0 20px 60px #0000004d}.menu-card h2{margin:0;font-size:clamp(1.5rem,4.5vw,2.4rem)}.menu-body{flex-direction:column;flex:1;gap:14px;min-height:0;padding:4px;display:flex;overflow:auto}.menu-bar{justify-content:space-between;align-items:center;gap:12px;display:flex}.menu-bar .next-btn,.menu-bar .random-btn{margin-left:auto}.menu-bar .random-btn+.next-btn{margin-left:0}.menu-title{align-items:center;gap:18px;width:min(100%,640px);padding:32px 24px}.game-title{color:var(--accent);text-shadow:0 3px #d9662a33;margin:0;font-size:clamp(2.2rem,8vw,4rem);line-height:1.05}.title-cars{flex-wrap:wrap;justify-content:center;gap:6px;display:flex}.title-cars .car-icon{animation:1.6s ease-in-out infinite bounce}.title-cars .car-icon:nth-child(2){animation-delay:.2s}.title-cars .car-icon:nth-child(3){animation-delay:.4s}.title-cars .car-icon:nth-child(4){animation-delay:.6s}@keyframes bounce{50%{transform:translateY(-8px)}}.play-btn{background:var(--accent);color:#fff;border:none;border-radius:999px;align-items:center;gap:12px;min-height:96px;padding:0 44px 0 32px;font-size:2rem;font-weight:900;animation:1.4s ease-in-out infinite pulse;display:inline-flex;box-shadow:0 6px #d9662a,0 12px 30px #ff8c4280}.play-btn svg{width:48px;height:48px}.count-grid{grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:12px;display:grid}.count-btn{min-height:120px;color:var(--ink);background:#f8fafc;border:3px solid #e2e8f0;border-radius:22px;flex-direction:column;justify-content:center;align-items:center;gap:8px;padding:12px 8px;display:flex}.count-btn.selected,.car-card.selected,.track-card.selected{border-color:var(--accent);background:#fff4eb}.count-num{font-size:2.8rem;font-weight:900;line-height:1}.count-cars{flex-wrap:wrap;justify-content:center;gap:4px;max-width:90px;display:flex}.count-cars i{background:var(--accent);border-radius:4px 4px 2px 2px;width:18px;height:12px}.count-cars i.me{background:#2a9d8f}.car-grid{grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;display:grid}.car-grid.small{grid-template-columns:repeat(auto-fit,minmax(118px,1fr));gap:8px}.car-card{min-width:0;color:var(--ink);background:#f8fafc;border:3px solid #e2e8f0;border-radius:20px;flex-direction:column;align-items:center;gap:4px;padding:10px 6px;font-weight:700;display:flex;position:relative}.car-card:not(:disabled):active,.count-btn:active,.track-card:active{transform:scale(.96)}.car-card:disabled{opacity:.3}.car-card.mine:disabled{opacity:.55}.car-card .badge{background:var(--accent);color:#fff;border-radius:999px;padding:2px 10px;font-size:.85rem;position:absolute;top:6px;right:6px}.car-name{font-size:.95rem}.car-grid.small .car-name{font-size:.8rem}.pc-slots{flex-wrap:wrap;justify-content:center;gap:8px;display:flex}.pc-slot{color:#94a3b8;background:#f8fafc;border:3px dashed #cbd5e1;border-radius:16px;place-items:center;width:88px;height:80px;display:grid}.pc-slot.filled{border-style:solid;border-color:var(--car);background:#fff}.pc-slot .slot-num{font-size:1.6rem;font-weight:900}.track-grid{grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;display:grid}.track-card{color:var(--ink);background:#f0fdf4;border:3px solid #e2e8f0;border-radius:22px;flex-direction:column;align-items:center;gap:8px;padding:16px 10px;font-size:1.4rem;font-weight:800;display:flex}.car-icon{max-width:100%;height:auto}.dot.animal{place-items:center;width:30px;height:30px;font-size:18px;line-height:1;display:inline-grid}.dot.animal.big{width:64px;height:64px;font-size:40px}.track-icon{width:100%;max-width:220px;height:auto}.confetti{pointer-events:none;z-index:11;position:fixed;inset:0;overflow:hidden}.confetti i{border-radius:2px;width:10px;height:16px;animation:linear forwards fall;position:absolute;top:-20px}@keyframes fall{to{transform:translate(var(--drift), 110vh) rotate(var(--spin))}}@media (height<=500px){.menu-card{gap:8px;padding:12px}.menu-title{gap:8px;padding:14px}.title-cars .car-icon{width:64px;height:51px}.play-btn{min-height:72px;font-size:1.6rem}.count-grid{grid-template-columns:repeat(7,1fr)}.count-btn{min-height:96px}.count-num{font-size:2.2rem}.car-grid,.car-grid.small{grid-template-columns:repeat(4,1fr)}.car-name{display:none}.menu-card h2{font-size:1.4rem}.car-card{padding:4px}.car-grid .car-icon{width:64px;height:51px}.pc-slot{width:64px;height:54px}.pc-slot .car-icon{width:50px;height:40px}.icon-btn{min-width:56px;min-height:56px}.home-btn{width:52px;height:52px}}@media (width<=500px){.car-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.car-grid.small{grid-template-columns:repeat(4,minmax(0,1fr))}.car-grid.small .car-name{display:none}.car-grid.small .car-icon{width:64px;height:51px}.pc-slot{width:72px;height:64px}.pc-slot .car-icon{width:56px;height:45px}.random-btn span{display:none}}.animal-badge{background:color-mix(in srgb, var(--car) 30%, white);border:3px solid var(--car);vertical-align:middle;border-radius:50%;flex:none;place-items:center;width:44px;height:44px;font-size:26px;line-height:1;display:inline-grid}.animal-badge.big{width:76px;height:76px;font-size:46px}.menu-card h2 .animal-badge{margin-right:6px}.title-animals{flex-wrap:wrap;justify-content:center;gap:6px;display:flex}.title-cars .vehicle-img{width:120px;height:auto;animation:1.6s ease-in-out infinite bounce}.title-cars .vehicle-img:nth-child(2){animation-delay:.2s}.title-cars .vehicle-img:nth-child(3){animation-delay:.4s}.title-cars .vehicle-img:nth-child(4){animation-delay:.6s}.animal-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;display:grid}.animal-grid.small{gap:8px}.animal-card,.vehicle-card{min-width:0;color:var(--ink);background:#f8fafc;border:3px solid #e2e8f0;border-radius:20px;flex-direction:column;align-items:center;gap:4px;padding:10px 6px;font-weight:700;display:flex;position:relative}.animal-card.selected,.vehicle-card.selected{border-color:var(--accent);background:#fff4eb}.animal-card:disabled{opacity:.3}.animal-card.mine:disabled{opacity:.55}.animal-card .badge{background:var(--accent);color:#fff;border-radius:999px;padding:2px 10px;font-size:.85rem;position:absolute;top:6px;right:6px}.animal-card:active,.vehicle-card:active{transform:scale(.96)}.card-name{text-align:center;font-size:.9rem;line-height:1.15}.vehicle-grid{grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:10px;display:grid}.vehicle-img{aspect-ratio:4/3;object-fit:contain;pointer-events:none;width:100%;max-width:180px}.pc-slot .animal-badge{width:52px;height:52px;font-size:32px}.pc-progress{opacity:.6;margin-left:auto;font-size:1.2rem;font-weight:800}@media (width<=500px){.animal-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}.animal-badge.big{width:56px;height:56px;font-size:34px}.animal-card .card-name{display:none}.vehicle-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.vehicle-card{padding:4px}.vehicle-card .card-name{font-size:.7rem}.title-cars .vehicle-img{width:76px}}@media (height<=500px){.animal-grid{grid-template-columns:repeat(8,minmax(0,1fr))}.animal-badge.big{width:54px;height:54px;font-size:32px}.animal-card .card-name,.vehicle-card .card-name{display:none}.vehicle-grid{grid-template-columns:repeat(auto-fill,minmax(100px,1fr));gap:6px}.title-cars .vehicle-img{width:80px}.title-animals .animal-badge{width:34px;height:34px;font-size:20px}}.locked{filter:grayscale(.9);position:relative;opacity:.45!important}.lock{filter:none;font-size:1.3rem;position:absolute;bottom:6px;right:6px}.count-btn{position:relative}.reward-panel{background:#fff8e1;border-radius:20px;flex-wrap:wrap;justify-content:center;align-items:center;gap:14px;padding:10px 16px;font-weight:800;display:flex}.star-count{white-space:nowrap;font-size:1.6rem}.next-reward{place-items:center;width:96px;height:72px;display:grid;position:relative}.next-reward.small{width:70px;height:52px}.next-reward .vehicle-img,.next-reward .accessory-img{object-fit:contain;width:100%;height:100%}.locked-item>:not(.lock){filter:grayscale(.7)brightness(.9)}.locked-item .lock{bottom:-4px;right:-4px}.reward-progress{background:#e2e8f0;border-radius:999px;width:150px;height:26px;position:relative;overflow:hidden}.reward-progress .bar{background:linear-gradient(90deg,#ffd60a,#ffb703);border-radius:999px;height:100%;transition:width .8s}.reward-progress span{place-items:center;font-size:.85rem;font-weight:800;display:grid;position:absolute;inset:0}.accessory-grid{grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:8px;display:grid}.accessory-card,.world-card{min-width:0;color:var(--ink);background:#f8fafc;border:3px solid #e2e8f0;border-radius:18px;flex-direction:column;align-items:center;gap:4px;padding:8px 4px;font-weight:700;display:flex;position:relative}.accessory-card.selected,.world-card.selected{border-color:var(--accent);background:#fff4eb}.accessory-img{object-fit:contain;pointer-events:none;width:76px;height:76px}.no-accessory{color:#94a3b8;place-items:center;width:76px;height:76px;font-size:2.2rem;display:grid}.world-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;display:grid}.world-card{padding:14px 6px;font-size:1.15rem}.world-badge{background:color-mix(in srgb, var(--world) 35%, white);border:3px solid var(--world);border-radius:24px;place-items:center;width:84px;height:84px;font-size:48px;display:grid}.race-stars{top:max(12px, env(safe-area-inset-top));right:max(12px, env(safe-area-inset-right));background:var(--panel);z-index:4;border-radius:999px;padding:8px 16px;font-size:1.4rem;font-weight:900;position:fixed;box-shadow:0 4px 14px #00000026}.race-stars.pop{animation:.35s cubic-bezier(.2,1.8,.4,1) pop-in}.stars-summary{background:#fff8e1;border-radius:18px;flex-direction:column;align-items:center;gap:10px;margin-bottom:14px;padding:10px;display:flex}.stars-line{flex-wrap:wrap;justify-content:center;align-items:baseline;gap:10px;display:flex}.big-star{font-size:1.8rem;font-weight:900}.stars-detail{opacity:.7;font-weight:700}.next-line{align-items:center;gap:10px;display:flex}.gift-btn{color:#fff;background:#7209b7;border:none;border-radius:999px;align-items:center;gap:10px;min-height:72px;padding:0 26px;font-size:1.4rem;font-weight:900;animation:1s ease-in-out infinite wiggle;display:inline-flex;box-shadow:0 4px #3c096c}.gift{font-size:2.2rem}@keyframes wiggle{25%{transform:rotate(-4deg)scale(1.04)}75%{transform:rotate(4deg)scale(1.04)}}.reward-reveal{flex-direction:column;align-items:center;gap:4px;animation:.5s cubic-bezier(.2,1.8,.4,1) pop-in;display:flex}.reward-reveal .vehicle-img{width:180px}.reward-reveal .accessory-img{width:120px;height:120px}.reward-kind{color:#7209b7;font-weight:800}.reward-reveal strong{font-size:1.3rem}@media (height<=500px){.reward-panel{gap:8px;padding:4px 10px}.world-badge{width:56px;height:56px;font-size:32px}.accessory-img,.no-accessory{width:56px;height:56px}.accessory-card .card-name{display:none}.stars-summary{margin-bottom:6px;padding:4px}}@media (width<=500px){.world-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.accessory-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.accessory-card .card-name{font-size:.7rem}}.menu-title{position:relative}.gear-btn{color:#64748b;min-width:56px;min-height:56px;padding:0;position:absolute;top:12px;right:12px}.settings-layer{z-index:30}.gate-card,.settings-card{width:min(100%,560px)}.gate-q{font-size:1.5rem}.gate-options{grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:14px;display:grid}.gate-option{font-size:1.5rem}.shake-x{animation:.4s shake-x}@keyframes shake-x{25%{transform:translate(-10px)}75%{transform:translate(10px)}}.settings-card{text-align:left}.settings-card h2{text-align:center}.set-group{border-top:1px solid #e2e8f0;padding:12px 0}.set-group h3{margin:0 0 8px;font-size:1.1rem}.set-desc{opacity:.75;margin:6px 0 0}.segmented{flex-wrap:wrap;gap:6px;display:flex}.segmented button,.toggle{min-height:48px;color:var(--ink);background:#fff;border:2px solid #cbd5e1;border-radius:999px;padding:0 16px;font-weight:700}.segmented button[aria-pressed=true],.toggle[aria-pressed=true]{border-color:var(--accent);background:var(--accent);color:#fff}.slider-row{grid-template-columns:70px 1fr 56px;align-items:center;gap:10px;min-height:44px;font-weight:700;display:grid}.slider-row input{width:100%;accent-color:var(--accent);height:32px}.danger-btn{color:#fff;background:#e63946;min-height:52px;font-size:1rem;box-shadow:0 4px #a4161a}.confirm-inline{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.settings-close{margin:12px auto 0;display:flex}
