/* Арена героев — тёмное фэнтези. Цвета и шрифты — в переменных, дизайнер меняет их здесь. */
:root {
  --bg: #120d0b;
  --bg-2: #1c1410;
  --panel: #241a14;
  --panel-2: #2e2219;
  --line: #4a3626;
  --text: #f3e7d3;
  --muted: #a8957c;
  --gold: #f5c04a;
  --gold-2: #c98a1c;
  --red: #e2493a;
  --green: #7fd36a;
  --ff-title: "Philosopher", Georgia, serif;
  --ff-ui: "Manrope", system-ui, sans-serif;
  --tabs-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--ff-ui); overflow: hidden; }
body { overscroll-behavior: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }

#app {
  position: relative; height: 100%; max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% 38%, #3a2416 0%, transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 46px, rgba(0,0,0,.25) 46px 48px),
    repeating-linear-gradient(90deg, transparent 0 94px, rgba(0,0,0,.18) 94px 96px),
    linear-gradient(#1a120d, #0e0907);
}

/* ── шапка ── */
.top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 8px; gap: 12px; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  font-family: var(--ff-title); font-weight: 700; font-size: 20px; color: #2a1a08;
  background: linear-gradient(145deg, #ffe39a, var(--gold-2)); box-shadow: 0 0 0 2px #5a3b16, 0 4px 14px rgba(245,192,74,.25);
}
.me-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.me-sub { font-size: 12px; color: var(--muted); }
.me-sub b { color: var(--gold); }
.gold {
  display: flex; align-items: center; gap: 7px; padding: 7px 14px 7px 8px; border-radius: 999px;
  background: linear-gradient(#2c1f12, #1e150d); box-shadow: inset 0 0 0 1px #6a4a1f, 0 6px 18px rgba(0,0,0,.35);
  font-family: var(--ff-title); font-weight: 700; font-size: 20px; color: var(--gold);
  transition: transform .15s;
}
.gold.bump { transform: scale(1.08); }
.coin { width: 24px; height: 24px; }
.coin circle { fill: var(--gold); stroke: #8a5a10; stroke-width: 1.5; }
.coin path { fill: #a8680f; }

/* ── экраны ── */
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sheet { overflow-y: auto; padding: 4px 16px calc(var(--tabs-h) + 24px); -webkit-overflow-scrolling: touch; }
.sheet h2 { font-family: var(--ff-title); font-size: 26px; margin: 8px 0 4px; color: #ffe3a6; }
.lead { margin: 0 0 14px; color: var(--muted); font-size: 14px; }

/* ── арена ── */
.arena { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; overflow: hidden; touch-action: none; }
.torch { position: absolute; top: 16%; width: 120px; height: 220px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,140,40,.32), transparent); animation: flicker 2.6s infinite alternate; }
.torch.l { left: -50px; } .torch.r { right: -50px; animation-delay: -1.3s; }
@keyframes flicker { 0%{opacity:.6;transform:scale(1)} 30%{opacity:1} 55%{opacity:.75;transform:scale(1.06)} 100%{opacity:.95} }

.boss-head { width: 100%; padding: 6px 20px 0; z-index: 2; }
.boss-title { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--ff-title); font-size: 21px; font-weight: 700; margin-bottom: 8px; text-shadow: 0 2px 8px #000; }
.tag { font-family: var(--ff-ui); font-size: 11px; font-weight: 800; letter-spacing: .04em; padding: 3px 8px; border-radius: 6px; background: #3b2a1c; color: var(--gold); box-shadow: inset 0 0 0 1px #6a4a1f; }
.tag.boss { background: linear-gradient(#b8231d, #6d0f0c); color: #ffe7c8; box-shadow: 0 0 14px rgba(226,73,58,.6); }
.hp { position: relative; height: 18px; border-radius: 9px; background: #0b0706; box-shadow: inset 0 0 0 1px #4a2a1c, 0 4px 12px rgba(0,0,0,.4); overflow: hidden; }
.hp-fill, .hp-ghost { position: absolute; inset: 0 auto 0 0; width: 100%; border-radius: 9px; transform-origin: left center; }
.hp-ghost { background: #f7e2b0; opacity: .55; transition: transform .5s cubic-bezier(.22,1,.36,1) .15s; }
.hp-fill { background: linear-gradient(#ff6b52, #b51d18); box-shadow: inset 0 2px 0 rgba(255,255,255,.25); }
.hp-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; text-shadow: 0 1px 2px #000; }

.boss-wrap { position: relative; flex: 1; width: 100%; display: grid; place-items: center; min-height: 0; }
.floor { position: absolute; bottom: 12%; width: 62%; height: 34px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0,0,0,.65), transparent); }
.boss {
  width: min(78vw, 330px, 44vh); height: auto; pointer-events: none; filter: drop-shadow(0 18px 24px rgba(0,0,0,.6));
  animation: idle 2.4s ease-in-out infinite; transform-origin: 50% 90%;
}
.boss.hit { animation: hit .14s ease-out; }
.boss.dying { animation: die .45s ease-in forwards; }
.boss.enter { animation: enter .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes idle { 50% { transform: translateY(-6px) scale(1.01, .99); } }
@keyframes hit { 0% { transform: scale(.94, .9) translateY(4px); filter: brightness(2.2) drop-shadow(0 0 0 #fff); } 100% { transform: none; } }
@keyframes die { to { transform: scale(.2) rotate(-25deg); opacity: 0; filter: brightness(3); } }
@keyframes enter { from { transform: scale(.3) translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.hint { position: absolute; bottom: 14px; font-size: 13px; color: var(--muted); letter-spacing: .02em; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 16px calc(var(--tabs-h) + 18px); }
.stat { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(36,26,20,.85); box-shadow: inset 0 0 0 1px var(--line); }
.stat svg { width: 26px; height: 26px; flex: none; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linejoin: round; }
.stat b { display: block; font-family: var(--ff-title); font-size: 19px; line-height: 1.1; }
.stat span { font-size: 11px; color: var(--muted); }

/* ── эффекты ── */
.fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.dmg { position: absolute; font-family: var(--ff-title); font-weight: 700; font-size: 26px; color: #fff; text-shadow: 0 2px 0 #6b1d10, 0 0 10px rgba(0,0,0,.6);
  animation: float .8s ease-out forwards; transform: translate(-50%, -50%); }
.dmg.crit { font-size: 38px; color: var(--gold); text-shadow: 0 2px 0 #7a3c00, 0 0 18px rgba(255,170,0,.8); }
.dmg.crit::before { content: "КРИТ! "; font-size: 18px; vertical-align: middle; }
@keyframes float { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), -260%) scale(.9); } }
.spark { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #ffd27a; box-shadow: 0 0 8px #ff9a1f; animation: spark .5s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--x), var(--y)) scale(.2); opacity: 0; } }
.coinfly { position: absolute; width: 22px; height: 22px; animation: coinfly .9s cubic-bezier(.5,-0.4,.7,1) forwards; }
@keyframes coinfly { 0% { transform: translate(0,0) scale(.4); } 30% { transform: translate(var(--sx), var(--sy)) scale(1.1); } 100% { transform: translate(var(--tx), var(--ty)) scale(.6); opacity: .8; } }
.reward { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-family: var(--ff-title); font-weight: 700; font-size: 34px; color: var(--gold); text-shadow: 0 3px 0 #6a3a00, 0 0 24px rgba(255,170,0,.7); animation: reward 1.3s ease-out forwards; white-space: nowrap; }
.reward small { display: block; text-align: center; font-size: 15px; color: #ffe7c8; }
@keyframes reward { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -90%); } }

/* ── списки и карточки ── */
.list { display: flex; flex-direction: column; gap: 10px; }
.card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: linear-gradient(var(--panel-2), var(--panel)); box-shadow: inset 0 0 0 1px var(--line); }
.card .ico { width: 48px; height: 48px; flex: none; border-radius: 12px; display: grid; place-items: center; background: #1a120d; box-shadow: inset 0 0 0 1px #5a4027; }
.card .ico svg { width: 28px; height: 28px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.card .body { flex: 1; min-width: 0; }
.card .t { font-weight: 800; font-size: 15px; }
.card .t small { color: var(--gold); font-weight: 700; margin-left: 4px; }
.card .d { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card .d b { color: var(--green); font-weight: 700; }
.btn { padding: 10px 14px; border-radius: 12px; font-weight: 800; font-size: 14px; white-space: nowrap; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.96); }
.btn.primary { color: #2a1704; background: linear-gradient(#ffd977, #e09a22); box-shadow: 0 3px 0 #8a5410, 0 6px 16px rgba(224,154,34,.25); }
.btn.ghost { box-shadow: inset 0 0 0 1px #6a4a1f; color: var(--gold); }
.btn.buy { min-width: 96px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.btn.buy svg { width: 16px; height: 16px; }
.btn[disabled] { opacity: .4; pointer-events: none; filter: grayscale(.6); }
.btn.done { background: #23331c; color: var(--green); box-shadow: inset 0 0 0 1px #3f6a2e; }

.daily { margin: 6px 0 14px; padding: 14px; border-radius: 18px; background: linear-gradient(135deg, #4a2c10, #2a190c); box-shadow: inset 0 0 0 1px #8a5c22; }
.daily .h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.daily .h b { font-family: var(--ff-title); font-size: 19px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 12px; }
.day { text-align: center; padding: 6px 0; border-radius: 9px; background: rgba(0,0,0,.3); font-size: 10.5px; color: var(--muted); }
.day b { display: block; font-size: 12px; color: var(--text); }
.day.got { background: #5a3b16; color: #ffe3a6; }
.day.next { box-shadow: inset 0 0 0 1.5px var(--gold); }

.invite { padding: 18px 16px; border-radius: 18px; text-align: center; margin: 6px 0 16px; background: radial-gradient(100% 120% at 50% 0%, #5a3814, #241a14); box-shadow: inset 0 0 0 1px #8a5c22; }
.invite-big { font-family: var(--ff-title); font-weight: 700; font-size: 42px; color: var(--gold); text-shadow: 0 3px 0 #6a3a00; }
.invite-sub { color: #e8d5b5; font-size: 14px; margin: 4px 0 14px; }
.invite .row { display: flex; gap: 10px; justify-content: center; }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 20px 10px; }

.rank { width: 30px; text-align: center; font-family: var(--ff-title); font-weight: 700; font-size: 18px; color: var(--muted); flex: none; }
.rank.r1 { color: #ffd34d; } .rank.r2 { color: #d9dde6; } .rank.r3 { color: #e09a5b; }
.card.me { box-shadow: inset 0 0 0 1.5px var(--gold); }
.my-rank { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }
.my-rank b { color: var(--gold); font-family: var(--ff-title); font-size: 18px; }

/* ── нижнее меню ── */
.tabs { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); background: linear-gradient(rgba(22,15,11,.92), #120c09); backdrop-filter: blur(8px); box-shadow: 0 -1px 0 var(--line); z-index: 10; }
.tabs button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--muted); }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tabs button.active { color: var(--gold); }
.tabs button.active::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.dot { position: absolute; top: 9px; right: calc(50% - 18px); width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px #120c09; }

/* ── модалки и тосты ── */
.modal { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px; background: rgba(5,3,2,.72); backdrop-filter: blur(3px); animation: fade .2s; }
.modal-card { width: 100%; max-width: 340px; padding: 24px 20px 20px; border-radius: 22px; text-align: center; background: radial-gradient(120% 90% at 50% 0%, #4a2e12, #1e150f 70%); box-shadow: inset 0 0 0 1px #8a5c22, 0 20px 60px rgba(0,0,0,.6); animation: pop .35s cubic-bezier(.2,1.5,.4,1); }
.modal-card h3 { font-family: var(--ff-title); font-size: 25px; margin: 6px 0 6px; color: #ffe3a6; }
.modal-card p { color: #e1cfb2; font-size: 14px; margin: 0 0 16px; line-height: 1.45; }
.modal-card .big { font-family: var(--ff-title); font-weight: 700; font-size: 40px; color: var(--gold); margin: 4px 0 14px; text-shadow: 0 3px 0 #6a3a00; }
.modal-card .code { font-family: ui-monospace, monospace; font-size: 24px; letter-spacing: .1em; padding: 10px; border-radius: 12px; background: #120c09; box-shadow: inset 0 0 0 1px #8a5c22; margin-bottom: 14px; user-select: all; -webkit-user-select: all; }
.modal-card .btn { width: 100%; padding: 13px; font-size: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }
.toast { position: absolute; left: 50%; bottom: calc(var(--tabs-h) + 16px); transform: translate(-50%, 20px); opacity: 0; z-index: 40; padding: 10px 16px; border-radius: 12px; background: #2e2219; box-shadow: inset 0 0 0 1px #6a4a1f, 0 10px 30px rgba(0,0,0,.5); font-size: 14px; font-weight: 600; transition: .25s; pointer-events: none; max-width: 90%; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .boss, .torch, .hint { animation: none; }
}
