:root {
  --bg: var(--tg-theme-bg-color, #0f1115);
  --card: var(--tg-theme-secondary-bg-color, #1a1d24);
  --text: var(--tg-theme-text-color, #f2f3f5);
  --muted: var(--tg-theme-hint-color, #8b919c);
  --accent: var(--tg-theme-button-color, #3b82f6);
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --ok: #22c55e;
  --bad: #ef4444;
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: 76px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.brand { font-weight: 800; font-size: 19px; letter-spacing: -.3px; }
.brand span { color: var(--accent); }
.bal { background: var(--card); padding: 6px 12px; border-radius: 999px; }
.bal b { font-variant-numeric: tabular-nums; }

main { padding: 0 16px; }
.tab { display: none; }
.tab.active { display: block; animation: in .18s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(4px); } }
h2 { font-size: 18px; margin: 8px 0 12px; }
h3 { font-size: 15px; margin: 18px 0 8px; }

.card { background: var(--card); border-radius: var(--r); padding: 14px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 10px; }
.card h2, .card h3 { margin: 0; }
.hero { align-items: center; text-align: center; padding: 22px 14px; }
.hero .big { font-size: 44px; font-weight: 800; color: var(--accent); line-height: 1; }
.hero p { margin: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.btn { appearance: none; border: 0; border-radius: 12px; padding: 12px 16px; font: inherit; font-weight: 600; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); width: 100%; cursor: pointer; transition: transform .08s, opacity .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: .45; }
.btn.sm { width: auto; padding: 8px 14px; font-size: 14px; }

.bar { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }

.task { display: flex; flex-direction: row; align-items: center; gap: 12px; }
.task .ic { font-size: 22px; }
.task .info { flex: 1; min-width: 0; }
.task .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task .rw { color: var(--ok); font-weight: 700; font-size: 13px; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }

input[type=text], input:not([type]), input[name=url], input[name=title] { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--text) 12%, transparent); background: var(--bg); color: var(--text); font: inherit; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.seg { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 12px; }
.seg label { flex: 1; }
.seg input { display: none; }
.seg span { display: block; text-align: center; padding: 8px; border-radius: 9px; font-weight: 600; font-size: 14px; }
.seg input:checked + span { background: var(--accent); color: var(--accent-text); }
.lock { text-align: center; }

.camp .st { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--text) 10%, transparent); }
.st.active { background: color-mix(in srgb, var(--ok) 25%, transparent); }
.st.rejected { background: color-mix(in srgb, var(--bad) 25%, transparent); }
.how { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid color-mix(in srgb, var(--text) 6%, transparent); }
.tabs button { flex: 1; background: none; border: 0; color: var(--muted); font: inherit; font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 20px; }
.tabs button span { font-size: 11px; }
.tabs button.active { color: var(--accent); }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: #111; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .2s; pointer-events: none; max-width: 90vw; text-align: center; z-index: 10; }
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ---- BoostMine ---- */
.tabs button { font-size: 19px; }
.mine-hud { gap: 8px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--card)), var(--card)); }
.mine-hud .hr { font-size: 30px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.mine-hud .hr small { font-size: 14px; color: var(--muted); font-weight: 600; }
.coins-pill { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #fbbf24; padding: 8px 14px; border-radius: 999px; font-size: 17px; }
.coins-pill b { font-variant-numeric: tabular-nums; }
.turbo { align-self: flex-start; font-size: 13px; font-weight: 700; color: #fb923c; background: color-mix(in srgb, #f97316 18%, transparent); padding: 4px 10px; border-radius: 99px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.vault .row b { font-variant-numeric: tabular-nums; color: #fbbf24; }
.vbar { height: 12px; }
.vbar i { background: linear-gradient(90deg, #f59e0b, #fbbf24); transition: width .25s linear; }
.vbar.full i { background: linear-gradient(90deg, #ef4444, #f97316); animation: pulse 1s infinite; }
body.vault-full #btnCollect { animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }

.mine-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.act { appearance: none; border: 0; border-radius: var(--r); padding: 14px 10px; color: var(--text); font: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; transition: transform .08s; }
.act:active { transform: scale(.96); }
.act:disabled { opacity: .5; }
.act .ai { font-size: 28px; line-height: 1.1; }
.act small { color: var(--muted); font-size: 12px; text-align: center; }
.turbo-act { background: linear-gradient(160deg, color-mix(in srgb, #f97316 30%, var(--card)), var(--card)); }
.spin-act { background: linear-gradient(160deg, color-mix(in srgb, #a855f7 30%, var(--card)), var(--card)); }
.spin-act.glow { box-shadow: 0 0 0 2px #a855f7, 0 0 18px color-mix(in srgb, #a855f7 50%, transparent); }
.spin-act.glow .ai { animation: wobble 2s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }

.rack-head { margin: 6px 2px 8px; }
.rack-head h3 { margin: 0; }
.rack { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.slot { appearance: none; border: 0; font: inherit; color: var(--text); border-radius: 12px; aspect-ratio: 3 / 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; cursor: pointer; padding: 4px; min-width: 0; }
.slot.miner { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 22%, var(--card)), var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent); }
.slot.miner b { font-size: 12px; }
.slot.miner small { font-size: 10px; color: var(--muted); white-space: nowrap; }
.slot.miner::after { content: ''; position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); animation: led 1.6s infinite; }
@keyframes led { 50% { opacity: .3; } }
.slot .lv { position: absolute; top: 5px; left: 6px; font-style: normal; font-size: 10px; font-weight: 800; color: var(--c); }
.slot.empty { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--text) 18%, transparent); color: var(--muted); }
.slot.empty span { font-size: 26px; line-height: 1; }
.slot.empty small { font-size: 10px; }
.slot:active { transform: scale(.95); }
.fan .blades { transform-origin: 20px 20px; animation: spin 1.1s linear infinite; }
body.turbo-on .fan .blades { animation-duration: .35s; }
body.vault-full .rack .fan .blades { animation-play-state: paused; }
@keyframes spin { to { transform: rotate(360deg); } }
.rack-btn { margin-bottom: 12px; }

.toplist { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.toplist li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--text) 4%, transparent); }
.toplist li.me { box-shadow: inset 0 0 0 1.5px var(--accent); }
.toplist .pos { width: 24px; text-align: center; font-weight: 700; }
.toplist .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toplist b { color: #fbbf24; font-variant-numeric: tabular-nums; }

.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .2s; }
.sheet-box { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; background: var(--bg); border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; transform: translateY(100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
.sheet.open .sheet-bg { opacity: 1; }
.sheet.open .sheet-box { transform: none; }
.sheet-box h2 { margin: 0; }
.shop { display: grid; gap: 8px; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 16%, var(--card)), var(--card)); }
.shop-item .info { flex: 1; display: flex; flex-direction: column; }
.shop-item small { color: var(--muted); font-size: 12px; }
.miner-big { display: flex; justify-content: center; padding: 8px; }
.miner-big .fan { filter: drop-shadow(0 0 14px var(--c)); }
.ok { color: var(--ok); }

.wheel-wrap { position: relative; width: min(78vw, 300px); aspect-ratio: 1; margin: 6px auto; }
.wheel { width: 100%; height: 100%; border-radius: 50%; position: relative; transition: transform 4s cubic-bezier(.15, .85, .2, 1); box-shadow: 0 0 0 6px #fbbf24, 0 0 30px color-mix(in srgb, #fbbf24 35%, transparent); }
.wheel span { position: absolute; inset: 0; display: flex; justify-content: center; }
.wheel em { font-style: normal; font-weight: 800; font-size: 15px; margin-top: 14%; color: #fff; text-shadow: 0 1px 3px #000; }
.wheel::after { content: ''; position: absolute; inset: 42%; border-radius: 50%; background: #fbbf24; box-shadow: 0 0 0 4px #0f1115; }
.pointer { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); z-index: 2; color: #fbbf24; font-size: 28px; text-shadow: 0 2px 4px #000; }

.float-txt { position: fixed; transform: translateX(-50%); color: #fbbf24; font-weight: 800; font-size: 22px; pointer-events: none; z-index: 30; animation: floatUp 1.2s ease-out forwards; text-shadow: 0 2px 6px #000; }
@keyframes floatUp { to { transform: translate(-50%, -70px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .fan .blades, .turbo, .spin-act.glow .ai, .slot.miner::after { animation: none; } .wheel { transition-duration: .01s; } }
