* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #eee;
    padding: 12px;
    padding-bottom: 30px;
}
#app { max-width: 420px; margin: 0 auto; }
.hidden { display: none !important; }

#loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #aaa;
}

/* Arena */
.arena {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: rgba(0,0,0,0.3);
    border-radius: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}
.fighter {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}
.fighter .avatar-wrap {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #e94560;
    margin-bottom: 6px;
    background: #222;
}
.fighter .avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.fighter .name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    text-align: center;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hp-bar {
    width: 80px;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}
.hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #e94560, #ff6b6b);
    transition: width 0.5s ease;
}
.hp-text {
    font-size: 11px;
    color: #aaa;
    margin-top: 2px;
}
.vs {
    font-size: 20px;
    font-weight: 800;
    color: #e94560;
    text-shadow: 0 0 10px rgba(233,69,96,0.5);
    padding: 0 8px;
}

/* Log */
.log-container {
    background: rgba(0,0,0,0.4);
    border-radius: 12px;
    padding: 12px;
    min-height: 180px;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.08);
}
#log { font-size: 14px; line-height: 1.6; }
.log-entry {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    animation: fadeIn 0.4s ease;
}
.log-entry.round { font-weight: 700; color: #e94560; }
.log-entry.attack { color: #ffd93d; }
.log-entry.dodge { color: #6bcb77; }
.log-entry.crit { color: #ff6b6b; animation: pulse 0.3s ease; }
.log-entry.hp { color: #888; font-size: 12px; }
.log-entry.round { font-weight: 700; color: #e94560; margin-top: 8px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* Result */
#result {
    margin-top: 16px;
    padding: 20px;
    text-align: center;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
}
#result.victory { background: linear-gradient(135deg, #11998e, #38ef7d); color: #111; }
#result.defeat { background: linear-gradient(135deg, #eb3349, #f45c43); color: #fff; }
#result .reward { font-size: 14px; margin-top: 6px; opacity: 0.9; }
.btn-continue { display: block; margin: 16px auto 0; padding: 12px 24px; font-size: 16px; font-weight: 600; background: rgba(0,0,0,0.2); border: 2px solid currentColor; border-radius: 12px; cursor: pointer; color: inherit; }
.btn-flee { position: fixed; bottom: 16px; right: 16px; padding: 10px 16px; background: rgba(200,80,80,0.6); border: 1px solid #f55; border-radius: 8px; color: #fff; cursor: pointer; font-size: 14px; }

/* Game main screen */
.screen { min-height: 100vh; padding: 16px; }
.game-header { text-align: center; margin-bottom: 20px; }
.game-header h1 { font-size: 22px; margin-bottom: 10px; }
.header-nav { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.btn-compact { padding: 6px 12px !important; font-size: 13px !important; }
.stats-bar { font-size: 12px; color: #999; margin-bottom: 8px; }
.user-bar { font-size: 14px; color: #aaa; display: flex; justify-content: center; gap: 16px; }
.game-nav { display: flex; flex-direction: column; gap: 10px; }
.game-nav .btn { padding: 14px; font-size: 16px; border-radius: 12px; border: none; cursor: pointer; background: rgba(255,255,255,0.1); color: #fff; }
.game-nav .btn-primary { background: linear-gradient(135deg, #e94560, #ff6b6b); font-weight: 700; }
.btn-danger { background: rgba(200,80,80,0.4) !important; }
.btn { padding: 10px 16px; border-radius: 8px; border: none; cursor: pointer; background: rgba(255,255,255,0.1); color: #fff; margin: 4px; }
.back { background: none; border: none; color: #888; cursor: pointer; font-size: 14px; margin-bottom: 12px; }
.card { background: rgba(0,0,0,0.3); border-radius: 12px; padding: 16px; margin: 8px 0; }
.card h2 { font-size: 18px; margin-bottom: 12px; }

/* Разборки */
.showdown-block { margin-bottom: 16px; }
.showdown-score { font-size: 18px; font-weight: 700; text-align: center; margin: 12px 0; }
.showdown-score .team-red { color: #e94560; font-weight: 600; }
.showdown-score .team-blue { color: #4a90d9; font-weight: 600; }
.showdown-score .red-count { color: #e94560; }
.showdown-score .blue-count { color: #4a90d9; }
.showdown-participants { font-size: 13px; margin: 8px 0; }
.participants-row { margin: 4px 0; }
.participants-row .team-red { color: #e94560; }
.participants-row .team-blue { color: #4a90d9; }
#showdownTime { font-size: 14px; color: #aaa; text-align: center; margin-bottom: 12px; }
.showdown-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-red { background: linear-gradient(135deg, #c62828, #e53935) !important; }
.btn-blue { background: linear-gradient(135deg, #1565c0, #2196f3) !important; }
.battle-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.team-red h3 { color: #e94560; font-size: 14px; }
.team-blue h3 { color: #4a90d9; font-size: 14px; }
.battle-teams ul { list-style: none; font-size: 13px; }
.battle-teams li { padding: 4px 0; }
.battle-teams .dead { opacity: 0.5; text-decoration: line-through; }
.struck { text-decoration: line-through; }

/* Экран боя: плашки пар, убитые, урон в плашках */
.battle-pairs { margin: 12px 0; }
.battle-pairs-above { margin-bottom: 8px; }
.battle-pair-center { margin: 10px 0; }
.battle-pairs-below { margin-top: 8px; }
.battle-pairs-empty { color: #888; font-size: 14px; padding: 12px; text-align: center; }
.battle-pair-waiting { color: #888; font-size: 13px; font-style: italic; padding: 8px 0; }
.battle-subtitle { font-size: 14px; color: #aaa; margin-bottom: 8px; }
.battle-pair-block {
    background: rgba(0,0,0,0.35);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}
.battle-pair-block.battle-pair-my {
    border: 2px solid #4a90d9;
    box-shadow: 0 0 12px rgba(74,144,217,0.35);
}
.battle-pair-sides { display: flex; align-items: flex-start; gap: 8px; }
.battle-pair-side { flex: 1; min-width: 0; font-size: 13px; display: flex; flex-direction: column; gap: 0; }
.battle-participant { margin-bottom: 10px; }
.battle-participant:last-child { margin-bottom: 0; }
.battle-pair-side.team-red .battle-pair-name { color: #e94560; }
.battle-pair-side.team-blue .battle-pair-name { color: #4a90d9; }
.battle-pair-name { display: block; margin-bottom: 2px; }
.battle-pair-name.dead { opacity: 0.6; text-decoration: line-through; }
.battle-participant .hp-bar { width: 100%; height: 6px; background: #333; border-radius: 3px; overflow: hidden; margin-top: 2px; }
.battle-participant .hp-fill.team-red-fill { background: linear-gradient(90deg, #c62828, #e94560); height: 100%; }
.battle-participant .hp-fill.team-blue-fill { background: linear-gradient(90deg, #1565c0, #4a90d9); height: 100%; }
.battle-pair-damage-one { margin-top: 2px; font-size: 12px; }
.battle-pair-damage-one .dmg-red { color: #e94560; }
.battle-pair-damage-one .dmg-blue { color: #4a90d9; }
.battle-pair-vs { font-size: 12px; font-weight: 700; color: #888; display: flex; align-items: center; }
.battle-pair-damage { margin-top: 6px; font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }
.battle-pair-damage .dmg-red { color: #e94560; }
.battle-pair-damage .dmg-blue { color: #4a90d9; }
.battle-killed { margin-top: 12px; padding: 10px; background: rgba(0,0,0,0.25); border-radius: 8px; font-size: 13px; }
.battle-killed strong { display: block; margin-bottom: 6px; color: #aaa; }
.battle-killed-teams { color: #ccc; }
.battle-killed .killed-name { text-decoration: line-through; }

/* Завершённые разборки */
.showdown-list { display: flex; flex-direction: column; gap: 12px; }
.showdown-list .showdown-card { margin-bottom: 0; }
.showdown-list .showdown-score { margin-bottom: 6px; }
.showdown-list .showdown-participants { margin: 6px 0; font-size: 13px; }
.showdown-list .showdown-time { margin: 6px 0; color: #aaa; }
.showdown-list .showdown-buttons { display: flex; gap: 8px; margin-top: 8px; }
.showdown-list .showdown-in { margin-top: 8px; }
.showdown-closed { margin-top: 8px; color: #888; font-size: 13px; }
.showdown-history { margin-top: 12px; }
.showdown-history h2 { font-size: 16px; margin-bottom: 12px; }
.history-empty { color: #888; font-size: 14px; padding: 8px 0; }
.history-item { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 13px; }
.history-item:last-child { border-bottom: none; }
.history-date { color: #aaa; margin-bottom: 4px; }
.history-winner { font-weight: 600; margin-bottom: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-log { padding: 4px 10px; font-size: 12px; }
.battle-results { padding: 16px; margin-top: 12px; background: rgba(0,0,0,0.2); border-radius: 12px; border: 1px solid rgba(255,255,255,0.1); }
.battle-results.victory, .battle-result-msg.victory { color: #ffd93d; font-weight: 700; }
.battle-result-section { margin-top: 16px; }
.battle-contrib { margin: 8px 0 4px; font-size: 14px; }
.battle-contrib p { margin: 4px 0; }
.battle-achievements { margin-top: 16px; }
.battle-achievements p { color: #6bcb77; margin: 4px 0; }
.log-result-box { padding: 12px; background: rgba(0,0,0,0.2); border-radius: 8px; margin-top: 12px; }
.log-result-box .battle-result-msg { margin-bottom: 6px; }
.log-result-box p { margin: 4px 0; }
.log-result-section { margin-top: 16px; }
.log-result-stats { margin: 8px 0 4px; }
.log-result-stats p { margin: 4px 0; }
.log-result-achievements { margin-top: 16px; }
.log-result-achievements p { color: #6bcb77; margin: 4px 0; }
.history-teams { color: #ccc; font-size: 12px; }
.history-teams .team-red { color: #e94560; }
.history-teams .team-blue { color: #4a90d9; }

/* Профиль (новый вид) */
.profile-main { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.profile-avatar-wrap { flex-shrink: 0; width: 120px; height: 120px; border-radius: 50%; overflow: hidden; border: 4px solid #e94560; background: #222; }
.profile-avatar { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; font-size: 15px; line-height: 1.8; }
.profile-nick { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.profile-base { background: rgba(0,0,0,0.2); border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.profile-base .profile-stat-row { margin-bottom: 10px; }
.profile-base .profile-stat-row:last-child { margin-bottom: 0; }
.profile-stat-row { margin-bottom: 8px; }
.profile-stat-upgrade { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.btn-upgrade { display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px; font-size: 13px; background: rgba(233,69,96,0.3); border: 1px solid #e94560; border-radius: 6px; color: #fff; cursor: pointer; }
.btn-upgrade:hover { background: rgba(233,69,96,0.5); }
.btn-upgrade-disabled { background: rgba(100,100,100,0.3) !important; border-color: #666 !important; cursor: not-allowed; opacity: 0.7; }
.cost.cost-ok { color: #6bcb77; }
.cost.cost-no { color: #ff6b6b; }
.profile-derived { background: rgba(0,0,0,0.3); border-radius: 12px; padding: 14px; }
.profile-derived h3 { font-size: 16px; margin-bottom: 8px; }
.profile-derived p { font-size: 14px; color: #ccc; }


/* Магазин */
.shop-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.1); flex-wrap: wrap; }
.shop-item:last-child { border-bottom: none; }
.shop-coins { font-weight: 600; }
.shop-stars { color: #ffd93d; }
.shop-buy { flex-shrink: 0; }
