/* Tycoon Rush - game styles. Works without Tailwind. Logical properties keep RTL correct. */
:root {
  --bg0: #070c22; --bg1: #0a1030; --bg2: #111a45;
  --glass: rgba(255, 255, 255, 0.06); --glass-b: rgba(255, 255, 255, 0.12);
  --text: #eaf0ff; --dim: #8f9bc7;
  --green: #2dff6e; --green-d: #12a84a; --red: #ff4d5e; --red-d: #b3243a;
  --gold: #ffd24a; --gold-d: #d99a10; --blue: #35c2ff; --purple: #b57bff;
  --nav-h: 66px; --ad-h: 50px;
  --font: 'Cairo', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg0);
  background-image: radial-gradient(120% 60% at 50% -10%, #1b2a73 0%, transparent 60%), linear-gradient(180deg, #0a1030 0%, #070c22 60%, #050813 100%);
  background-attachment: fixed; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
  -webkit-text-size-adjust: 100%; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; margin: 0; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.dim { color: var(--dim); }
.center { text-align: center; }
.pad { padding: 18px; }
.up { color: var(--green); }
.down { color: var(--red); }
.green { color: var(--green); }
.red { color: var(--red); }

.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg0); z-index: 500; font-weight: 700; }

/* ---------- layout ---------- */
.app {
  max-width: 480px; margin: 0 auto; height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top); position: relative;
}
@media (min-width: 520px) {
  .app { border-inline: 1px solid rgba(255, 255, 255, 0.06); box-shadow: 0 0 60px rgba(40, 80, 255, 0.12); background: rgba(5, 8, 22, 0.35); }
}
.views { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 10px 12px 14px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.views::-webkit-scrollbar { display: none; }
.view { display: flex; flex-direction: column; gap: 10px; }
.view-title { font-size: 1.15rem; font-weight: 900; padding-inline: 4px; }

/* ---------- HUD ---------- */
.hud { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; }
.hud-profile { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; text-align: start; min-height: 48px; padding: 4px 8px 4px 4px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-b); }
.avatar { width: 40px; height: 40px; flex: none; display: grid; place-items: center; font-size: 24px; border-radius: 50%; background: linear-gradient(145deg, #2a3c8f, #121c55); border: 2px solid var(--gold); box-shadow: 0 0 10px rgba(255, 210, 74, 0.35); }
.hud-info { display: flex; flex-direction: column; min-width: 0; gap: 1px; flex: 1; }
.hud-name { font-weight: 800; font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-level { font-size: 0.7rem; color: var(--dim); display: flex; gap: 6px; white-space: nowrap; overflow: hidden; }
.hud-level b { color: var(--gold); }
.hud-title { overflow: hidden; text-overflow: ellipsis; }
.bar { position: relative; display: block; height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #17c653, #6dff9a); transition: width 0.25s ease-out; }
.bar-xp { height: 6px; }
.bar-xp > i { background: linear-gradient(90deg, #e0a516, #ffd24a); }
.bar-goal { height: 8px; flex: 1; }
.bar-goal > i { background: linear-gradient(90deg, #35c2ff, #b57bff); }
.bar-timer > i { background: linear-gradient(90deg, #ff4d5e, #ffd24a); transition: none; width: 100%; }
.bar-txt { position: absolute; inset-block: 0; inset-inline-end: 8px; font-size: 0.64rem; font-weight: 800; line-height: 10px; color: #fff; text-shadow: 0 1px 2px #000; }
.hud-pills { display: flex; flex-direction: column; gap: 4px; }
.pill { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 2px 4px 2px 8px; border-radius: 99px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--glass-b); }
.pill-ico { font-size: 16px; }
.pill-col { display: flex; flex-direction: column; line-height: 1; min-width: 78px; }
.pill-val { font-weight: 900; font-size: 0.95rem; }
.pill-cash .pill-val { color: var(--green); font-size: 1rem; }
.pill-sub { font-size: 0.6rem; color: var(--dim); margin-top: 1px; }
.plus { width: 28px; height: 28px; flex: none; border-radius: 50%; font-weight: 900; font-size: 1.1rem; line-height: 1; color: #04210f; background: radial-gradient(circle at 30% 30%, #7dffa6, #18c455); box-shadow: 0 0 8px rgba(45, 255, 110, 0.6); }
.plus::after { content: ''; position: absolute; }
.pill .plus { position: relative; }
.icon-btn { width: 44px; height: 44px; flex: none; display: grid; place-items: center; font-size: 22px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-b); }

/* ---------- race bar ---------- */
.racebar { display: flex; align-items: center; gap: 8px; padding: 4px 12px 6px; font-size: 0.78rem; flex-wrap: wrap; }
.rb-clock { font-weight: 800; white-space: nowrap; }
.rb-clock b { color: var(--gold); font-size: 0.95rem; }
.rb-track { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 120px; }
.rb-track b { color: var(--blue); white-space: nowrap; }
.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 0.7rem; font-weight: 800; background: var(--glass); border: 1px solid var(--glass-b); white-space: nowrap; }
.chip-warn { color: #ffb347; border-color: rgba(255, 179, 71, 0.5); background: rgba(255, 179, 71, 0.12); }
.chip-boost { color: var(--gold); border-color: rgba(255, 210, 74, 0.5); }
.chip-ghost.ahead { color: var(--green); border-color: rgba(45, 255, 110, 0.5); }
.chip-ghost.behind { color: var(--red); border-color: rgba(255, 77, 94, 0.5); }
.chip-lv { color: var(--dim); }
.chip-you { color: #04210f; background: var(--green); border-color: transparent; margin-inline-start: 6px; }

/* ---------- ad slot (reserved, no layout shift) ---------- */
.ad-slot { flex: none; height: var(--ad-h); display: grid; place-items: center; margin: 0 8px 4px; border-radius: 10px; overflow: hidden; }
.ad-mock-banner { width: 100%; height: 100%; display: grid; place-items: center; font-size: 0.7rem; color: var(--dim); letter-spacing: 0.08em; border: 1px dashed rgba(255, 255, 255, 0.18); border-radius: 10px; background: rgba(255, 255, 255, 0.03); }

/* ---------- nav ---------- */
.nav { flex: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 0 8px calc(8px + env(safe-area-inset-bottom)); padding: 5px; height: var(--nav-h); border-radius: 22px; background: rgba(10, 16, 48, 0.92); border: 1px solid var(--glass-b); backdrop-filter: blur(10px); }
.nav-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border-radius: 16px; font-size: 0.68rem; font-weight: 800; color: var(--dim); min-height: 44px; transition: background 0.2s, color 0.2s, box-shadow 0.2s; }
.nav-ico { font-size: 22px; line-height: 1; filter: grayscale(0.5); }
.nav-btn.on { color: #fff; background: linear-gradient(180deg, rgba(45, 255, 110, 0.18), rgba(45, 255, 110, 0.05)); border: 1px solid rgba(45, 255, 110, 0.55); box-shadow: 0 0 14px rgba(45, 255, 110, 0.35), inset 0 -3px 0 var(--green); }
.nav-btn.on .nav-ico { filter: none; transform: scale(1.12); }
.nav-badge { position: absolute; top: 2px; inset-inline-end: 12px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-style: normal; font-size: 0.65rem; font-weight: 900; display: grid; place-items: center; box-shadow: 0 0 8px rgba(255, 77, 94, 0.7); }

/* ---------- cards / buttons ---------- */
.card { background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03)); border: 1px solid var(--glass-b); border-radius: 18px; padding: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.card-name { font-weight: 900; font-size: 0.98rem; }
.card-inc { font-weight: 800; font-size: 0.85rem; color: var(--green); }
.card-desc { font-size: 0.74rem; color: var(--dim); line-height: 1.3; }
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: 14px; font-weight: 900; font-size: 0.95rem; text-align: center; transition: transform 0.08s, box-shadow 0.2s, filter 0.2s; }
.btn:active:not(:disabled) { transform: scale(0.95); }
.btn-green { color: #03210e; background: linear-gradient(180deg, #5dff8f, #18c455); box-shadow: 0 3px 0 #0b7a30, 0 0 16px rgba(45, 255, 110, 0.45); }
.btn-red { color: #fff; background: linear-gradient(180deg, #ff6b7a, #d63348); box-shadow: 0 3px 0 #8c1d2d, 0 0 14px rgba(255, 77, 94, 0.4); }
.btn-gold { color: #2b1b00; background: linear-gradient(180deg, #ffe27a, #f2b01c); box-shadow: 0 3px 0 #a56f00, 0 0 18px rgba(255, 210, 74, 0.5); }
.btn-ghost { background: var(--glass); border: 1px solid var(--glass-b); }
.btn-dim, .btn:disabled { filter: grayscale(0.85) brightness(0.65); box-shadow: none; }
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn-sm { min-height: 44px; padding: 6px 12px; font-size: 0.85rem; }
.btn-xs { flex: 1; min-height: 44px; padding: 4px 2px; font-size: 0.78rem; border-radius: 12px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.btn-block { width: 100%; }
.glow-pulse { animation: glow 1.8s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 4px 0 #0b7a30, 0 0 14px rgba(45, 255, 110, 0.45); } 50% { box-shadow: 0 4px 0 #0b7a30, 0 0 30px rgba(45, 255, 110, 0.9); } }
.seg { display: inline-flex; gap: 4px; padding: 3px; border-radius: 14px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--glass-b); }
.seg-wide { display: flex; }
.seg-wide .seg-btn { flex: 1; }
.seg-btn { min-height: 40px; padding: 4px 14px; border-radius: 11px; font-weight: 800; font-size: 0.85rem; color: var(--dim); }
.seg-btn.on { color: #03210e; background: linear-gradient(180deg, #5dff8f, #18c455); box-shadow: 0 0 10px rgba(45, 255, 110, 0.4); }
.spinner { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.2); border-top-color: var(--gold); animation: spin 0.8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { padding: 10px 12px; border-radius: 12px; font-size: 0.82rem; background: rgba(255, 179, 71, 0.12); border: 1px solid rgba(255, 179, 71, 0.4); color: #ffcf8a; }
.hint { font-size: 0.72rem; color: var(--dim); }
.hint.bad { color: var(--red); }

/* ---------- empire ---------- */
.hero { position: relative; border-radius: 20px; overflow: hidden; border: 1px solid var(--glass-b); background: linear-gradient(180deg, #1f3b9a 0%, #2a64d6 45%, #0e1b52 100%); padding: 0 0 14px; text-align: center; }
.hero-sky { position: relative; height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; background: radial-gradient(60% 80% at 50% 100%, rgba(255, 210, 74, 0.25), transparent 70%); }
.hero-sign { margin-bottom: 4px; padding: 6px 14px; border-radius: 10px; background: rgba(5, 10, 40, 0.82); border: 2px solid rgba(160, 190, 255, 0.5); font-weight: 900; font-size: 1.05rem; color: var(--gold); letter-spacing: 0.03em; display: flex; gap: 8px; align-items: center; box-shadow: 0 0 18px rgba(80, 140, 255, 0.5); }
.hero-sign b { font-size: 1.2rem; }
.hero-city { font-size: 2rem; letter-spacing: 6px; line-height: 1; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)); padding-bottom: 2px; }
.hero-ips { font-weight: 900; font-size: 1.2rem; color: var(--green); text-shadow: 0 0 10px rgba(45, 255, 110, 0.6); margin: 6px 0; }
.tap-btn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; width: min(78%, 280px); min-height: 104px; border-radius: 28px; color: #2b1b00; background: linear-gradient(180deg, #ffe27a 0%, #f2b01c 100%); box-shadow: 0 6px 0 #a56f00, 0 0 28px rgba(255, 210, 74, 0.6); touch-action: manipulation; transition: transform 0.06s, box-shadow 0.1s; }
.tap-btn:active { transform: translateY(4px) scale(0.97); box-shadow: 0 2px 0 #a56f00, 0 0 36px rgba(255, 210, 74, 0.9); }
.tap-emoji { font-size: 2.2rem; line-height: 1.1; }
.tap-label { font-weight: 900; font-size: 1rem; }
.tap-val { font-weight: 900; font-size: 0.9rem; opacity: 0.8; }
.qty-row { display: flex; gap: 6px; justify-content: center; }
.qty-row .seg-btn { flex: 0 1 90px; border: 1px solid var(--glass-b); background: var(--glass); }
.qty-row .seg-btn.on { border-color: transparent; }
.biz-list, .up-list, .mission-list, .asset-list { display: flex; flex-direction: column; gap: 10px; }
.biz-card, .up-card { padding: 10px; }
.biz-body, .biz-teaser, .up-card, .mission-card { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 10px; }
.biz-ico { width: 54px; height: 54px; display: grid; place-items: center; font-size: 30px; border-radius: 16px; background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04)); border: 1px solid var(--glass-b); }
.biz-ico.dim { filter: grayscale(1); opacity: 0.6; }
.biz-mid { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.biz-teaser { opacity: 0.8; }
.buy-btn { flex-direction: column; gap: 0; min-width: 96px; min-height: 52px; line-height: 1.15; padding: 6px 10px; }
.btn-lbl { font-size: 0.8rem; }
.btn-cost { font-size: 0.92rem; }
.biz-card.bump { animation: bump 0.3s; }
@keyframes bump { 40% { transform: scale(1.025); box-shadow: 0 0 22px rgba(45, 255, 110, 0.45); } }

/* ---------- trade ---------- */
.lock-card { text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 24px 16px; }
.lock-ico { font-size: 2.6rem; }
.trade-main { display: flex; flex-direction: column; gap: 10px; }
.chart-card { padding: 10px 8px 8px; background: linear-gradient(180deg, rgba(8, 14, 40, 0.9), rgba(8, 14, 40, 0.6)); }
.asset-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.chip-btn { display: inline-flex; gap: 4px; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 99px; font-weight: 800; font-size: 0.82rem; color: var(--dim); border: 1px solid var(--glass-b); white-space: nowrap; }
.chip-btn.on { color: #fff; border-color: rgba(45, 255, 110, 0.7); background: rgba(45, 255, 110, 0.12); box-shadow: 0 0 10px rgba(45, 255, 110, 0.3); }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 2px 6px; }
.chart-price { font-size: 1.7rem; font-weight: 900; line-height: 1.1; }
.chart-change { font-weight: 800; font-size: 0.9rem; }
.row-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.trend { font-size: 0.75rem; color: var(--gold); font-weight: 800; }
.badge-pump { padding: 6px 12px; border-radius: 12px; font-weight: 900; font-size: 0.95rem; color: var(--green); background: rgba(45, 255, 110, 0.12); border: 2px solid var(--green); box-shadow: 0 0 14px rgba(45, 255, 110, 0.5); transform: rotate(-4deg); animation: glow2 1.6s infinite; }
.badge-pump.crash { color: var(--red); background: rgba(255, 77, 94, 0.12); border-color: var(--red); box-shadow: 0 0 14px rgba(255, 77, 94, 0.5); }
@keyframes glow2 { 50% { filter: brightness(1.35); } }
.chart-canvas { display: block; width: 100%; height: 190px; direction: ltr; }
.range-row { display: flex; gap: 6px; justify-content: center; margin-top: 4px; }
.pill-btn { min-height: 36px; padding: 0 18px; border-radius: 99px; font-weight: 800; font-size: 0.8rem; color: var(--dim); }
.pill-btn.on { color: var(--green); border: 1px solid var(--green); background: rgba(45, 255, 110, 0.1); }
.pf-line { font-size: 0.82rem; font-weight: 800; color: var(--dim); text-align: center; }
.asset-card { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.asset-card.sel { border-color: rgba(45, 255, 110, 0.55); box-shadow: 0 0 14px rgba(45, 255, 110, 0.2); }
.asset-top { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; cursor: pointer; }
.asset-ico { width: 48px; height: 48px; display: grid; place-items: center; font-size: 26px; border-radius: 14px; background: rgba(255, 255, 255, 0.08); }
.asset-mid { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.asset-tag { font-size: 0.72rem; color: var(--dim); }
.asset-hold { font-size: 0.72rem; font-weight: 800; color: var(--dim); }
.asset-hold.up { color: var(--green); } .asset-hold.down { color: var(--red); }
.asset-right { text-align: end; display: flex; flex-direction: column; }
.asset-price { font-weight: 900; font-size: 1.05rem; }
.asset-chg { font-weight: 800; font-size: 0.78rem; }
.mini-badge { display: inline-block; font-size: 0.6rem; padding: 1px 6px; border-radius: 6px; font-weight: 900; color: #03210e; background: var(--green); vertical-align: middle; }
.mini-badge.crash { background: var(--red); color: #fff; }
.trade-row { display: flex; gap: 6px; align-items: center; }
.trade-lbl { flex: none; width: 40px; font-weight: 900; font-size: 0.78rem; }

/* ---------- missions / upgrades / ranks ---------- */
.mission-card.ready { border-color: rgba(45, 255, 110, 0.6); box-shadow: 0 0 16px rgba(45, 255, 110, 0.25); }
.mission-ico { width: 48px; height: 48px; display: grid; place-items: center; font-size: 26px; border-radius: 14px; background: rgba(255, 255, 255, 0.08); }
.mission-mid { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.reward-chips { font-size: 0.78rem; font-weight: 800; color: var(--gold); }
.mission-card .bar { height: 14px; }
.mission-card .bar-txt { line-height: 14px; }
.rank-list { display: flex; flex-direction: column; gap: 6px; }
.rank-row { display: grid; grid-template-columns: 40px 34px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 14px; background: var(--glass); border: 1px solid transparent; }
.rank-row.top { background: linear-gradient(90deg, rgba(255, 210, 74, 0.14), rgba(255, 255, 255, 0.04)); }
.rank-row.me { border-color: var(--green); background: rgba(45, 255, 110, 0.1); box-shadow: 0 0 12px rgba(45, 255, 110, 0.25); }
.rank-pos { font-weight: 900; text-align: center; font-size: 1rem; }
.rank-av { font-size: 22px; text-align: center; }
.rank-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 800; }
.rank-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { font-weight: 900; color: var(--gold); white-space: nowrap; }
.rank-you { padding: 8px 12px; border-radius: 12px; background: rgba(45, 255, 110, 0.1); border: 1px solid rgba(45, 255, 110, 0.5); font-weight: 800; font-size: 0.85rem; }
.bests-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; text-align: center; }
.ms-lbl { font-size: 0.72rem; color: var(--dim); font-weight: 700; }
.ms-val { font-size: 1.15rem; font-weight: 900; }
.ms-val.gold { color: var(--gold); }

/* ---------- modals ---------- */
.modals { position: relative; z-index: 100; }
.modal-back { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(3, 6, 20, 0.74); backdrop-filter: blur(6px); animation: fadeIn 0.18s; overflow-y: auto; }
.modal-back.modal-out { animation: fadeOut 0.18s forwards; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.modal { position: relative; width: min(100%, 440px); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 18px 16px; border-radius: 24px; background: linear-gradient(170deg, #17235f, #0b1238 70%); border: 1px solid var(--glass-b); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); display: flex; flex-direction: column; gap: 12px; animation: popIn 0.25s cubic-bezier(0.2, 1.3, 0.4, 1); margin: auto; scrollbar-width: none; }
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } }
.modal-sm { width: min(100%, 380px); }
.modal-title { font-size: 1.25rem; font-weight: 900; text-align: center; }
.modal-body { text-align: center; font-size: 0.92rem; line-height: 1.55; color: #cfd8ff; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions > * { flex: 1; }
.modal-actions.col { flex-direction: column; }
.modal-x { position: absolute; top: 10px; inset-inline-end: 10px; width: 40px; height: 40px; border-radius: 50%; font-weight: 900; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--glass-b); z-index: 2; }
.modal-x.gold { border: 2px solid var(--gold); color: var(--gold); }
.label { font-size: 0.8rem; font-weight: 800; color: var(--dim); }
.input { width: 100%; min-height: 48px; padding: 8px 14px; border-radius: 14px; border: 1px solid var(--glass-b); background: rgba(0, 0, 0, 0.35); color: var(--text); font-family: inherit; font-size: 1.05rem; font-weight: 700; user-select: text; -webkit-user-select: text; }
.profile-form { display: flex; flex-direction: column; gap: 8px; }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.avatar-opt { aspect-ratio: 1; min-height: 44px; display: grid; place-items: center; font-size: 24px; border-radius: 14px; background: var(--glass); border: 2px solid transparent; }
.avatar-opt.sel { border-color: var(--gold); background: rgba(255, 210, 74, 0.15); box-shadow: 0 0 12px rgba(255, 210, 74, 0.4); }
.modal-onboard .brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.brand-logo { width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 0 28px rgba(255, 210, 74, 0.4); object-fit: cover; }
.brand-title { font-size: 1.7rem; font-weight: 900; color: var(--gold); }
.brand-sub { font-size: 0.85rem; color: var(--dim); }
.onboard { display: flex; flex-direction: column; gap: 12px; }
.seg-lang { align-self: center; }
.challenge-banner { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 14px; background: rgba(255, 140, 40, 0.14); border: 1px solid rgba(255, 160, 60, 0.55); font-weight: 800; font-size: 0.88rem; }
.challenge-emoji { font-size: 26px; }
.modal-count { background: transparent; border: 0; box-shadow: none; align-items: center; }
.modal-back:has(.modal-count) { background: rgba(3, 6, 20, 0.85); }
.count-wrap { text-align: center; }
.count-sub { font-weight: 800; color: var(--dim); letter-spacing: 0.15em; text-transform: uppercase; }
.count-num { font-size: 8rem; font-weight: 900; line-height: 1; color: var(--gold); text-shadow: 0 0 40px rgba(255, 210, 74, 0.8); }
.count-num.pop { animation: countPop 0.8s ease-out; }
.count-num.go { color: var(--green); text-shadow: 0 0 40px rgba(45, 255, 110, 0.9); font-size: 6rem; animation: countPop 0.5s ease-out; }
@keyframes countPop { 0% { transform: scale(2); opacity: 0; } 30% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.85); opacity: 0.8; } }
.settings .row, .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; font-weight: 800; }
.switch { width: 54px; height: 30px; border-radius: 99px; background: rgba(255, 255, 255, 0.15); position: relative; flex: none; transition: background 0.2s; }
.switch i { position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: inset-inline-start 0.2s; }
.switch.on { background: var(--green-d); }
.switch.on i { inset-inline-start: 27px; }
.center { text-align: center; }
.shop-gems { text-align: center; font-weight: 900; font-size: 1.1rem; color: var(--blue); }
.shop-list { display: flex; flex-direction: column; gap: 8px; }
.shop-card { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-b); }
.shop-ico { font-size: 28px; text-align: center; }
.shop-name { font-weight: 900; font-size: 0.92rem; }
.shop-desc { font-size: 0.72rem; color: var(--dim); line-height: 1.3; }
.shop-cd { font-size: 0.7rem; color: var(--red); font-weight: 800; }
.shop-cd.on { color: var(--green); }
.shop-btns { display: flex; flex-direction: column; gap: 4px; }
.dec-ico { font-size: 3rem; text-align: center; }
.modal-decision { border-color: rgba(255, 210, 74, 0.5); }

/* milestone */
.modal-milestone { padding-top: 6px; border: 2px solid var(--gold); background: radial-gradient(100% 50% at 50% 0%, rgba(255, 200, 60, 0.28), transparent 70%), linear-gradient(180deg, #1a1c3d, #0a0f2c); box-shadow: 0 0 40px rgba(255, 210, 74, 0.4), 0 20px 60px rgba(0, 0, 0, 0.6); }
.trophy-wrap { position: relative; height: 150px; display: grid; place-items: center; }
.trophy-rays { position: absolute; width: 220px; height: 220px; background: repeating-conic-gradient(from 0deg, rgba(255, 210, 74, 0.28) 0 8deg, transparent 8deg 20deg); -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 70%); mask-image: radial-gradient(circle, #000 20%, transparent 70%); animation: spin 18s linear infinite; }
.trophy { position: relative; font-size: 6.2rem; line-height: 1; filter: drop-shadow(0 0 22px rgba(255, 210, 74, 0.9)); animation: float 2.4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px) scale(1.04); } }
.ribbon { align-self: center; padding: 8px 26px; font-weight: 900; font-size: 1.45rem; text-align: center; color: var(--gold); background: linear-gradient(180deg, #1ea84a, #0e6a2c); border: 2px solid var(--gold); border-radius: 10px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); box-shadow: 0 0 24px rgba(45, 255, 110, 0.4); transform: rotate(-1.5deg); }
.ms-stats { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px; border-radius: 16px; background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 210, 74, 0.5); }
.ms-cell { display: flex; align-items: center; gap: 8px; justify-content: center; }
.ms-ico { font-size: 1.8rem; }
.ms-sep { width: 1px; align-self: stretch; background: rgba(255, 210, 74, 0.5); }
.ms-gems { text-align: center; font-weight: 800; color: var(--blue); }
.ms-tag { text-align: center; font-style: italic; color: #d7defa; display: flex; align-items: center; gap: 8px; }
.ms-tag::before, .ms-tag::after { content: ''; flex: 1; height: 1px; background: rgba(255, 210, 74, 0.45); }
.ad-tag { margin-inline-start: 4px; padding: 1px 6px; border-radius: 6px; font-size: 0.65rem; background: rgba(0, 0, 0, 0.55); color: var(--gold); border: 1px solid var(--gold-d); }

/* ---------- fx ---------- */
.layer-fx { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; }
.float-num { position: absolute; transform: translate(-50%, 0); font-weight: 900; font-size: 1.2rem; color: #fff; text-shadow: 0 2px 6px #000, 0 0 10px rgba(45, 255, 110, 0.8); animation: floatUp 0.9s ease-out forwards; white-space: nowrap; direction: ltr; }
.float-num.float-gold { color: var(--gold); text-shadow: 0 2px 6px #000, 0 0 10px rgba(255, 210, 74, 0.8); }
.float-num.big { font-size: 1.8rem; }
@keyframes floatUp { from { opacity: 1; transform: translate(-50%, 0) scale(0.9); } to { opacity: 0; transform: translate(-50%, -70px) scale(1.15); } }
.briefcase { position: absolute; pointer-events: auto; min-width: 64px; min-height: 64px; font-size: 3rem; line-height: 1; border-radius: 50%; background: radial-gradient(circle, rgba(255, 210, 74, 0.45), transparent 70%); filter: drop-shadow(0 0 14px rgba(255, 210, 74, 0.9)); animation: briefcaseBob 0.8s ease-in-out infinite alternate; }
@keyframes briefcaseBob { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-14px) rotate(6deg) scale(1.08); } }
.toasts { position: fixed; z-index: 90; inset-inline: 0; top: calc(env(safe-area-inset-top) + 8px); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 10px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 460px; padding: 10px 14px; border-radius: 16px; font-weight: 800; font-size: 0.86rem; line-height: 1.35; background: rgba(10, 16, 48, 0.96); border: 1px solid var(--glass-b); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); animation: toastIn 0.25s ease-out; }
.toast-good { border-color: rgba(45, 255, 110, 0.6); }
.toast-bad { border-color: rgba(255, 77, 94, 0.6); }
.toast-out { opacity: 0; transform: translateY(-10px); transition: 0.25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px); } }

/* ---------- mock ad overlay ---------- */
.ad-mock-overlay { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.9); }
.ad-mock-card { width: min(100%, 360px); padding: 20px; text-align: center; border-radius: 20px; background: #161a33; border: 1px dashed var(--dim); display: flex; flex-direction: column; gap: 10px; }
.ad-mock-tag { align-self: center; padding: 2px 10px; border-radius: 6px; background: var(--gold); color: #000; font-weight: 900; font-size: 0.75rem; }
.ad-mock-title { font-weight: 900; font-size: 1.2rem; }
.ad-mock-body { color: var(--dim); font-size: 0.85rem; }
.ad-mock-sub { font-size: 0.7rem; color: var(--dim); direction: ltr; }
.ad-mock-count { font-size: 1.6rem; font-weight: 900; color: var(--gold); }
.ad-mock-row { display: flex; gap: 8px; justify-content: center; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .trophy, .trophy-rays, .briefcase, .glow-pulse { animation: none !important; }
}
@media (max-width: 360px) {
  .pill-col { min-width: 64px; }
  .buy-btn { min-width: 84px; }
  .tap-btn { min-height: 92px; }
}

/* ---------- fix pass ---------- */
button, input, .nav-btn, .tap-btn, .btn { touch-action: manipulation; }
/* B2: readable active state for the buy-amount pills */
.qty-row .seg-btn.on { color: #fff; border-color: var(--green); background: rgba(45, 255, 110, 0.16); box-shadow: 0 0 12px rgba(45, 255, 110, 0.45); }
/* B3: toasts stack vertically below the race bar, above modals */
.toasts { z-index: 150; top: calc(env(safe-area-inset-top) + 112px); }
/* B8: vivid red sell buttons (also when disabled: only dimmed, never grey-brown) */
.btn-red { background: linear-gradient(180deg, #ff5a6c, #e0102a); box-shadow: 0 3px 0 #8c1020, 0 0 18px rgba(255, 40, 70, 0.6); }
.trade-row .btn:disabled, .trade-row .btn.btn-dim { filter: none; opacity: 0.55; }
.trade-row .btn-red:disabled { box-shadow: 0 2px 0 #8c1020, 0 0 12px rgba(255, 40, 70, 0.4); }
