* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; }
body { overflow: hidden; font-family: 'Vazirmatn', system-ui, sans-serif; background: #dcefcf; color: #4a2f3a; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
canvas { display: block; touch-action: none; }
button { font-family: inherit; cursor: pointer; border: none; }
img { -webkit-user-drag: none; }

.app { position: fixed; inset: 0; overflow: hidden; }
.screen, .hud { position: absolute; inset: 0; pointer-events: none; direction: rtl; }
.screen button, .hud button, .stage-card { pointer-events: auto; }

.top-row { position: absolute; top: max(14px, env(safe-area-inset-top)); inset-inline: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.top-row.three { display: grid; grid-template-columns: 1fr auto 1fr; }
.top-row.three > :first-child { justify-self: start; }
.top-row.three > :last-child { justify-self: end; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 250, 244, 0.95); border-radius: 999px; padding: 5px 14px 5px 10px; font-weight: 800; font-size: 15px; box-shadow: 0 3px 10px rgba(90, 60, 70, 0.14); color: #4a2f3a; min-height: 36px; }
.pill img { width: 22px; height: 22px; object-fit: contain; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; background: #fffaf4; box-shadow: 0 3px 10px rgba(90, 60, 70, 0.16); display: grid; place-items: center; transition: transform .12s; }
.round-btn img { width: 26px; height: 26px; object-fit: contain; }
.round-btn:active { transform: scale(.9); }
.round-btn.muted { opacity: .55; }
.world-pill { background: rgba(255, 250, 244, 0.96); border-radius: 18px; padding: 4px 18px 6px; text-align: center; box-shadow: 0 3px 10px rgba(90, 60, 70, 0.14); line-height: 1.5; min-width: 0; }
.world-pill small { display: block; color: #f0668e; font-weight: 800; font-size: 11px; }
.world-pill b { display: block; font-size: 15px; font-weight: 900; white-space: nowrap; }

/* title */
.logo { position: absolute; top: 11%; inset-inline: 0; text-align: center; }
.logo-word { font-family: 'Lalezar', 'Vazirmatn', sans-serif; font-weight: 900; font-size: clamp(66px, 21vw, 112px); line-height: 1.05; color: #ff86ab;
  text-shadow: 0 2px 0 #fff, 0 -2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff, 3px 3px 0 #fff, -3px 3px 0 #fff, 0 7px 0 #b04a6e, 0 9px 0 #7a3150, 0 14px 22px rgba(90, 30, 60, .3); animation: bob 3s ease-in-out infinite; }
.logo-word.second { position: relative; display: inline-flex; align-items: center; gap: 4px; animation-delay: -1.2s; }
.logo-word.second img { width: clamp(56px, 16vw, 90px); height: auto; animation: spin 6s linear infinite; filter: drop-shadow(0 4px 4px rgba(90, 30, 60, .3)); }
.slogan { margin: 14px auto 0; font-weight: 800; color: #fff; font-size: clamp(12px, 3.5vw, 15px); text-shadow: 0 1px 3px rgba(60, 30, 40, .75), 0 0 8px rgba(60, 30, 40, .4); padding: 0 14px; line-height: 1.8; overflow-wrap: anywhere; }
.title-bottom { position: absolute; bottom: max(28px, env(safe-area-inset-bottom)); inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.btn-primary { min-width: min(76vw, 300px); height: 62px; border-radius: 999px; color: #fff; font-size: 22px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(180deg, #ff9fbd 0%, #f6709a 55%, #ec5c88 100%); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .45), inset 0 -4px 0 rgba(170, 40, 90, .25), 0 8px 18px rgba(236, 92, 136, .4); transition: transform .12s; text-shadow: 0 1px 2px rgba(150, 30, 70, .35); }
.btn-primary:active { transform: scale(.95); }
.btn-primary:disabled { filter: grayscale(.7); opacity: .6; }
.btn-secondary { height: 44px; padding: 0 20px; border-radius: 999px; background: #fffaf4; color: #4a2f3a; font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 3px 10px rgba(90, 60, 70, .16); transition: transform .12s; }
.btn-secondary:active { transform: scale(.95); }
.btn-secondary.wide { width: 100%; justify-content: center; margin-top: 12px; }
.row-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* map */
.stage-card { position: absolute; bottom: max(12px, env(safe-area-inset-bottom)); inset-inline: 10px; background: #fffaf4; border-radius: 22px; padding: 14px 14px 16px; box-shadow: 0 -4px 24px rgba(90, 60, 70, .18); animation: rise .35s ease-out; max-width: 520px; margin: 0 auto; }
.card-head { display: flex; gap: 12px; align-items: center; }
.portrait { width: 62px; height: 62px; flex: none; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fff3d6, #ffd98e); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(90, 60, 70, .2); overflow: hidden; display: grid; place-items: center; }
.portrait img { width: 110%; height: 110%; object-fit: cover; object-position: top; }
.card-text { min-width: 0; flex: 1; line-height: 1.6; }
.card-text small { color: #f0668e; font-weight: 800; font-size: 12px; }
.card-text h2 { font-size: 21px; font-weight: 900; }
.meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: #8a6f78; font-size: 13px; font-weight: 600; }
.stars { display: inline-flex; gap: 2px; }
.card-actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.card-actions .btn-primary { flex: 1; min-width: 0; height: 56px; font-size: 19px; }

/* modals */
.modal-bg { position: absolute; inset: 0; background: rgba(70, 40, 55, .42); display: grid; place-items: center; z-index: 20; direction: rtl; animation: fade .2s; padding: 16px; }
.modal { width: min(92vw, 380px); background: #fffaf4; border-radius: 26px; padding: 22px 18px 18px; text-align: center; box-shadow: 0 16px 40px rgba(70, 40, 55, .3); animation: pop .32s cubic-bezier(.2, 1.5, .4, 1); display: flex; flex-direction: column; gap: 12px; line-height: 1.7; max-height: 92vh; overflow: auto; }
.modal h2 { font-size: 24px; font-weight: 900; color: #e85a86; }
.modal .sub { color: #8a6f78; font-weight: 600; margin-top: -8px; font-size: 14px; }
.modal .btn-primary { min-width: 0; width: 100%; }
.goals { list-style: none; text-align: start; background: #fff1f4; border-radius: 16px; padding: 10px 14px; font-weight: 700; font-size: 14px; }
.goals li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.goals img { width: 20px; }
.link-btn { background: none; color: #a77f8c; font-weight: 700; font-size: 13px; min-height: 36px; }
.modal-head { display: flex; align-items: center; gap: 10px; }
.modal-head img { width: 44px; height: 44px; object-fit: contain; }
.modal-head h2 { flex: 1; text-align: start; }
.upg-list { display: flex; flex-direction: column; gap: 10px; }
.upg { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 16px; padding: 10px; box-shadow: 0 2px 8px rgba(90, 60, 70, .08); text-align: start; }
.upg > img { width: 46px; height: 46px; object-fit: contain; flex: none; }
.upg-text { flex: 1; min-width: 0; line-height: 1.5; }
.upg-text b { font-size: 15px; }
.upg-text small { display: block; color: #8a6f78; font-size: 12px; overflow-wrap: anywhere; }
.dots { display: flex; gap: 4px; margin-top: 4px; }
.dots i { width: 14px; height: 6px; border-radius: 3px; background: #f0e3e6; }
.dots i.on { background: #f6709a; }
.buy { flex: none; min-width: 78px; height: 40px; border-radius: 999px; background: linear-gradient(180deg, #ffd770, #f5b632); color: #5b3a12; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 10px; box-shadow: inset 0 -3px 0 rgba(150, 90, 0, .25); }
.buy img { width: 18px; }
.buy:disabled { filter: grayscale(.8); opacity: .55; }
.result .big-stars { display: flex; justify-content: center; align-items: flex-end; gap: 4px; margin-top: -4px; }
.result .big-stars img { width: 64px; animation: starIn .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.result .big-stars img.mid { width: 82px; margin-bottom: 10px; }
.result.lose h2 { color: #8a6f78; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: #fff1f4; border-radius: 14px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; line-height: 1.5; min-width: 0; }
.stats img { width: 34px; height: 34px; object-fit: contain; }
.stats b { font-size: 18px; font-weight: 900; }
.stats small { font-size: 11px; color: #8a6f78; }
.time { font-size: 13px; color: #8a6f78; font-weight: 700; margin-top: -4px; }

/* hud */
.hud-top { position: absolute; top: max(12px, env(safe-area-inset-top)); inset-inline: 12px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.hud-top > :first-child { justify-self: start; }
.hud-top > :last-child { justify-self: end; }
.boss-bar { position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 56px); left: 50%; transform: translateX(-50%); width: min(80vw, 320px); background: rgba(255, 250, 244, .94); border-radius: 999px; padding: 4px 12px 4px 6px; display: flex; align-items: center; gap: 8px; box-shadow: 0 3px 10px rgba(90, 60, 70, .14); }
.boss-bar img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; object-position: top; background: #ffe6a8; }
.boss-info { flex: 1; min-width: 0; line-height: 1.4; }
.boss-info span { font-size: 11px; font-weight: 800; color: #8a6f78; }
.bar { height: 8px; background: #f3e2e6; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff7b9f, #ff4f7d); border-radius: 4px; transition: width .2s; margin-inline-start: auto; }
.boss-bar b { font-weight: 900; font-size: 16px; color: #e8507c; }
.goal-chips { position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 104px); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: rgba(255, 250, 244, .8); border-radius: 999px; padding: 2px 10px 2px 8px; font-size: 12px; font-weight: 800; color: #8a6f78; }
.chip img { width: 16px; }
.chip.on { color: #c78a00; background: rgba(255, 246, 214, .95); }
.chip.off { opacity: .55; text-decoration: line-through; }
.toast { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); font-family: 'Lalezar', 'Vazirmatn', sans-serif; font-weight: 900; font-size: 30px; color: #fff; white-space: nowrap; text-shadow: 0 3px 0 #e8507c, 0 5px 12px rgba(120, 30, 60, .4); animation: toastPop 1.3s ease-out forwards; }
.tutorial { position: absolute; bottom: 14%; inset-inline: 0; text-align: center; color: #fff; font-weight: 800; text-shadow: 0 1px 4px rgba(60, 30, 40, .7); line-height: 1.8; padding: 0 20px; }
.tutorial p { font-size: 17px; }
.tutorial small { font-size: 13px; display: block; opacity: .95; }
.hand { width: 140px; height: 60px; margin: 0 auto 6px; position: relative; }
.hand .dot { position: absolute; top: 14px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .9); box-shadow: 0 0 0 8px rgba(255, 255, 255, .35); animation: drag 1.6s ease-in-out infinite; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; top: 0; left: 0; font-weight: 900; font-size: 14px; color: #fff; background: rgba(90, 60, 70, .55); border-radius: 999px; padding: 0 9px; line-height: 1.6; white-space: nowrap; will-change: transform; }
.lbl.player { background: rgba(255, 255, 255, .9); color: #e8507c; }
.lbl.minion { font-size: 12px; }
.lbl.boss { background: #f6709a; font-size: 13px; box-shadow: 0 2px 6px rgba(150, 30, 70, .3); }
.lbl.danger { background: #d9435f; }
.lbl.boss.edge { opacity: .85; outline: 2px solid #fff; }

.joy { position: absolute; top: 0; left: 0; width: 0; height: 0; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 5; }
.joy::before { content: ''; position: absolute; width: 110px; height: 110px; left: -55px; top: -55px; border-radius: 50%; background: rgba(255, 255, 255, .22); border: 3px solid rgba(255, 255, 255, .6); }
.joy-knob { position: absolute; width: 46px; height: 46px; left: -23px; top: -23px; border-radius: 50%; background: rgba(255, 255, 255, .9); box-shadow: 0 3px 10px rgba(90, 60, 70, .25); }

.loading { position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, #f4fbe9, #cfe8bf); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; direction: rtl; z-index: 30; line-height: 1.8; }
.loading img { width: 120px; animation: spin 4s linear infinite; }
.loading .bar { width: 200px; height: 10px; }
.loading .bar i { margin-inline-start: 0; }
.loading small { color: #8a6f78; font-weight: 700; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
@keyframes toastPop { 0% { transform: translateX(-50%) scale(.4); opacity: 0; } 15% { transform: translateX(-50%) scale(1.12); opacity: 1; } 25% { transform: translateX(-50%) scale(1); } 75% { opacity: 1; } 100% { transform: translateX(-50%) translateY(-30px); opacity: 0; } }
@keyframes drag { 0%, 100% { left: 10px; } 50% { left: 96px; } }
