* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; }
body { overflow: hidden; font-family: 'Lalezar', 'Vazirmatn', system-ui, sans-serif; background: #9fd8f5; }
canvas { display: block; touch-action: none; }
.app { position: fixed; inset: 0; overflow: hidden; color: #3b1d0e; user-select: none; -webkit-user-select: none; }
.game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
button { font-family: inherit; cursor: pointer; border: none; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); line-height: 1.8; }
.screen.center { justify-content: center; }
.bgimg { background: url(/assets/bg_menu.webp) center/cover; }
.dim { background: rgba(30, 12, 4, .45); backdrop-filter: blur(3px); }
.menu { background: linear-gradient(to bottom, rgba(255,248,231,.55), transparent 35%, transparent 60%, rgba(255,248,231,.6)); }
.title { font-size: clamp(40px, 12vw, 64px); color: #e63946; text-shadow: 0 4px 0 #ffd23f, 0 8px 18px rgba(0,0,0,.25); text-align: center; line-height: 1.5; margin-top: 8px; }
.title.sm { font-size: 38px; }
.sub { font-size: 18px; color: #2a6b3a; font-weight: 700; background: rgba(255,255,255,.7); padding: 0 14px; border-radius: 99px; }
.spacer { flex: 1; }
.menu-top { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.menu-btns { display: flex; flex-direction: column; gap: 10px; width: min(340px, 100%); }
.btn { min-height: 52px; border-radius: 18px; font-size: 22px; color: #fff; background: linear-gradient(#ff5d6c, #d62839); box-shadow: 0 6px 0 #8f1424, 0 10px 20px rgba(0,0,0,.2); transition: transform .08s; padding: 0 22px; }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #8f1424; }
.btn.big { font-size: 28px; min-height: 64px; }
.btn.alt { background: linear-gradient(#5fd17a, #2a9d55); box-shadow: 0 6px 0 #17663a, 0 10px 20px rgba(0,0,0,.2); }
.icon-btn { min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 14px; background: #fff8e7; color: #3b1d0e; font-size: 16px; box-shadow: 0 4px 0 #d9b77a; pointer-events: auto; }
.hud-pill { background: rgba(255,248,231,.92); border-radius: 14px; padding: 2px 12px; font-size: 16px; box-shadow: 0 3px 0 #d9b77a; text-align: center; line-height: 1.6; }
.hud-pill.gold { background: #ffd23f; box-shadow: 0 3px 0 #b88a00; }
.hud-pill .small { font-size: 12px; opacity: .8; }
.loadbar { width: min(300px, 80%); height: 18px; background: #fff8e7; border-radius: 99px; margin: 24px 0 8px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,.2); }
.loadbar div, .progress div { height: 100%; background: linear-gradient(90deg, #2a9d55, #ffd23f); transition: width .2s; }
.panel { width: min(420px, 100%); background: rgba(255,248,231,.95); border-radius: 22px; padding: 12px; box-shadow: 0 8px 0 #d9b77a; }
.row { display: flex; gap: 8px; margin-bottom: 10px; }
.chip { flex: 1; min-height: 44px; border-radius: 14px; background: #f1e3c6; font-size: 18px; color: #3b1d0e; }
.chip.on { background: #2a9d55; color: #fff; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.item { min-height: 62px; border-radius: 14px; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #3b1d0e; box-shadow: 0 3px 0 #e2c993; padding: 4px; min-width: 0; }
.item .nm { font-size: 16px; overflow-wrap: anywhere; }
.item .pr { font-size: 13px; color: #d62839; font-family: Vazirmatn, sans-serif; font-weight: 700; }
.item.on { outline: 3px solid #2a9d55; }
.item:disabled { opacity: .5; }
.stages { display: flex; flex-direction: column; gap: 12px; width: min(420px, 100%); margin-top: 16px; }
.stage { display: flex; align-items: center; gap: 12px; background: rgba(255,248,231,.95); border-radius: 20px; padding: 12px; box-shadow: 0 6px 0 #d9b77a; text-align: right; color: #3b1d0e; position: relative; }
.stage .num { width: 52px; height: 52px; flex: none; border-radius: 50%; background: #e63946; color: #fff; font-size: 28px; display: grid; place-items: center; }
.stage .txt { display: flex; flex-direction: column; min-width: 0; }
.stage .txt b { font-size: 22px; font-weight: normal; }
.stage .txt span { font-family: Vazirmatn, sans-serif; font-size: 13px; opacity: .8; }
.stage.locked { filter: grayscale(.9); opacity: .75; }
.stage .crown { position: absolute; inset-inline-end: 10px; top: -10px; background: #ffd23f; border-radius: 99px; padding: 0 10px; font-size: 13px; }
.rules { margin-top: auto; background: rgba(255,255,255,.85); border-radius: 14px; padding: 8px 14px; font-family: Vazirmatn, sans-serif; font-size: 14px; text-align: center; max-width: 420px; }
.hud { position: absolute; inset: 0; pointer-events: none; padding: max(10px, env(safe-area-inset-top)) 10px 10px; }
.hud-top { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.progress { height: 10px; background: rgba(255,255,255,.6); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.rank-badge { position: absolute; inset-inline-start: 10px; top: calc(max(10px, env(safe-area-inset-top)) + 80px); background: #e63946; color: #fff; border-radius: 16px; padding: 2px 14px; text-align: center; box-shadow: 0 4px 0 #8f1424; line-height: 1.4; }
.rank-badge span { font-size: 13px; display: block; }
.rank-badge b { font-size: 34px; font-weight: normal; }
.order { position: absolute; inset-inline-end: 8px; top: calc(max(10px, env(safe-area-inset-top)) + 80px); display: flex; flex-direction: column; gap: 3px; font-family: Vazirmatn, sans-serif; font-size: 12px; }
.ord { background: rgba(255,248,231,.85); border-radius: 8px; padding: 0 8px; line-height: 1.8; }
.ord.me { background: #ffd23f; font-weight: 800; }
.ord.fin { color: #1b7a3d; }
.count { position: absolute; top: 35%; width: 100%; text-align: center; font-size: 120px; color: #ffd23f; text-shadow: 0 6px 0 #d62839, 0 10px 30px rgba(0,0,0,.3); animation: pop .9s ease-out; inset-inline-start: 0; }
.count.go { color: #5fd17a; text-shadow: 0 6px 0 #17663a; }
@keyframes pop { from { transform: scale(2.2); opacity: 0; } 30% { transform: scale(1); opacity: 1; } to { opacity: .9; } }
.banner { position: absolute; top: 28%; inset-inline-start: 0; width: 100%; text-align: center; font-size: 46px; color: #fff; text-shadow: 0 4px 0 #2a9d55, 0 8px 20px rgba(0,0,0,.3); animation: pop .6s ease-out; }
.hint { position: absolute; bottom: max(30px, env(safe-area-inset-bottom)); inset-inline-start: 50%; transform: translateX(50%); width: min(340px, 90%); background: rgba(255,248,231,.92); border-radius: 18px; padding: 8px 14px; text-align: center; font-size: 17px; line-height: 1.7; animation: bob 1.2s ease-in-out infinite; }
.hint span { font-family: Vazirmatn, sans-serif; font-size: 12px; opacity: .7; }
@keyframes bob { 50% { margin-bottom: 8px; } }
.card { width: min(380px, 100%); background: #fff8e7; border-radius: 26px; padding: 18px; text-align: center; box-shadow: 0 10px 0 #d9b77a, 0 20px 40px rgba(0,0,0,.3); animation: pop .4s ease-out; }
.card.win { border-top: 10px solid #ffd23f; }
.card.lose { border-top: 10px solid #8a8a8a; }
.card-title { font-size: 40px; color: #e63946; }
.card.win .card-title { color: #2a9d55; }
.rankbig { font-size: 30px; }
.rankbig small { font-size: 18px; opacity: .7; }
.reward { font-size: 20px; background: #ffd23f; border-radius: 14px; padding: 2px 10px; margin: 6px 0; }
.reward span { font-size: 14px; display: block; }
.unlock { color: #2a9d55; font-size: 18px; }
.olist { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 10px 0; font-family: Vazirmatn, sans-serif; font-size: 13px; }
.olist div { border-radius: 8px; padding: 0 6px; }
.olist .q { background: #d8f3dc; }
.olist .x { background: #eee; color: #888; text-decoration: line-through; }
.olist .me { outline: 2px solid #e63946; font-weight: 800; }
.card-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.card-btns.col { flex-direction: column; margin-top: 12px; }
