/* ============================================
   Battle of Great Minds - Styles
   ============================================ */

/* ---- Online Presence ---- */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---- Arena Layout ---- */
.battle-arena {
    min-height: calc(100vh - 120px);
    background: linear-gradient(180deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    position: relative;
    overflow: hidden;
    padding-bottom: 24px;
}

.battle-arena-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

.battle-content {
    position: relative;
    z-index: 1;
}

/* ---- Scoreboard ---- */
.battle-scoreboard {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px 8px;
}

.battle-team-card {
    flex: 1;
    background: rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 12px 10px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s;
}

.battle-team-card.active-team {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255,215,0,0.3);
}

.battle-team-card.winner {
    border-color: #FFD700;
    background: rgba(255,215,0,0.15);
}

.battle-team-name {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.7);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.battle-team-score {
    font-size: 36px;
    font-weight: 900;
    color: white;
    line-height: 1;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.battle-team-score.hidden-score {
    font-size: 28px;
    color: rgba(255,255,255,0.4);
}

.battle-team-avatars {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 8px;
}

.battle-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
}

.battle-avatar.roboto-avatar {
    background: linear-gradient(135deg, #10B981, #059669) !important;
    border-color: #34D399;
    box-shadow: 0 0 8px rgba(16,185,129,0.4);
    padding: 2px;
    overflow: visible;
}

.battle-avatar.active-player {
    border-color: #FFD700;
    box-shadow: 0 0 12px rgba(255,215,0,0.5);
    animation: battleGlow 1.5s ease-in-out infinite;
}

/* ---- Result Icons (✅/❌ row for each question) ---- */
.battle-result-icons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
    margin: 4px 0 2px;
    min-height: 16px;
}

.battle-result-mark {
    font-size: 12px;
    line-height: 1;
}

.battle-result-mark:last-child {
    animation: battleResultPop 0.5s ease-out;
}

.battle-answered-dot {
    font-size: 10px;
    font-weight: 700;
    color: #4ECDC4;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
    animation: battlePulse 1.5s ease-in-out infinite;
}

@keyframes battleResultPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.4); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* ---- VS Divider ---- */
.battle-vs {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 50px;
}

.battle-vs-text {
    font-size: 20px;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255,215,0,0.5), 0 0 40px rgba(255,215,0,0.3);
    animation: battleVsPulse 2s ease-in-out infinite;
}

.battle-vs-lightning {
    font-size: 24px;
    filter: drop-shadow(0 0 8px rgba(255,215,0,0.8));
    animation: battleLightning 3s ease-in-out infinite;
}

/* ---- Question Card ---- */
.battle-question-card {
    background: rgba(255,255,255,0.95);
    border-radius: 16px;
    margin: 12px 16px;
    padding: 20px 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    animation: battleSlideUp 0.4s ease-out;
}

.battle-question-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.battle-question-text {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    line-height: 1.5;
    margin-bottom: 16px;
}

.battle-question-image {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* ---- Timer ---- */
.battle-timer-wrap {
    display: flex;
    justify-content: center;
    margin: 8px 0 12px;
}

.battle-timer {
    position: relative;
    width: 56px;
    height: 56px;
}

.battle-timer-circle {
    transform: rotate(-90deg);
    width: 56px;
    height: 56px;
}

.battle-timer-bg {
    fill: none;
    stroke: rgba(255,255,255,0.15);
    stroke-width: 4;
}

.battle-timer-fill {
    fill: none;
    stroke: #4ECDC4;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.battle-timer-fill.warning {
    stroke: #FF6B6B;
    animation: battleTimerPulse 0.5s ease-in-out infinite;
}

.battle-timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: 800;
    color: white;
}

/* ---- Answer Options ---- */
.battle-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 16px 16px;
}

.battle-option {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 14px 12px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    backdrop-filter: blur(5px);
}

.battle-option:active {
    transform: scale(0.96);
}

.battle-option.selected {
    border-color: var(--primary);
    background: rgba(108,99,255,0.3);
}

.battle-option.correct {
    border-color: #4ECDC4;
    background: rgba(78,205,196,0.3);
    animation: battleCorrect 0.5s ease-out;
}

.battle-option.wrong {
    border-color: #FF6B6B;
    background: rgba(255,107,107,0.3);
    animation: battleWrong 0.4s ease-out;
}

.battle-option.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.battle-option-label {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    font-size: 12px;
    font-weight: 800;
    margin-right: 6px;
    text-align: center;
}

/* ---- Status Bar ---- */
.battle-status {
    text-align: center;
    padding: 8px 16px;
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    font-weight: 600;
}

.battle-status .your-turn {
    color: #FFD700;
    font-size: 16px;
    font-weight: 800;
    animation: battlePulse 1s ease-in-out infinite;
}

.battle-status .waiting {
    color: rgba(255,255,255,0.5);
}

/* ---- Spectator Badge ---- */
.battle-spectator-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,107,107,0.2);
    border: 1px solid rgba(255,107,107,0.4);
    border-radius: 20px;
    padding: 4px 12px;
    color: #FF6B6B;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: battlePulse 2s ease-in-out infinite;
}

.battle-spectator-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #FF6B6B;
    animation: battleBlink 1s ease-in-out infinite;
}

/* ---- Countdown Overlay ---- */
.battle-countdown {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,12,41,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.battle-countdown-num {
    font-size: 120px;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 0 0 40px rgba(255,215,0,0.6), 0 0 80px rgba(255,215,0,0.3);
    animation: battleCountPop 0.8s ease-out;
}

.battle-countdown-go {
    font-size: 64px;
    font-weight: 900;
    color: #4ECDC4;
    text-shadow: 0 0 40px rgba(78,205,196,0.6);
    animation: battleCountPop 0.6s ease-out;
}

/* ---- Feedback Overlay ---- */
.battle-feedback {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 998;
    pointer-events: none;
}

.battle-feedback-text {
    font-size: 48px;
    font-weight: 900;
    animation: battleFeedbackPop 1s ease-out forwards;
}

.battle-feedback-text.correct {
    color: #4ECDC4;
    text-shadow: 0 0 30px rgba(78,205,196,0.6);
}

.battle-feedback-text.wrong {
    color: #FF6B6B;
    text-shadow: 0 0 30px rgba(255,107,107,0.6);
}

.battle-feedback-text.steal {
    color: #FFD700;
    text-shadow: 0 0 30px rgba(255,215,0,0.6);
}

/* ---- Results Screen ---- */
.battle-results {
    padding: 20px 16px;
    text-align: center;
}

.battle-results-title {
    font-size: 24px;
    font-weight: 900;
    color: #FFD700;
    margin-bottom: 4px;
    text-shadow: 0 2px 10px rgba(255,215,0,0.3);
}

.battle-results-subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 20px;
}

.battle-score-bars {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    padding: 0 16px;
}

.battle-score-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.battle-score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease-out;
}

.battle-score-bar-fill.team1 {
    background: linear-gradient(90deg, #6C63FF, #A855F7);
}

.battle-score-bar-fill.team2 {
    background: linear-gradient(90deg, #FF6B6B, #EC4899);
}

.battle-mvp {
    background: rgba(255,215,0,0.1);
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 12px;
    padding: 12px;
    margin: 16px;
    color: white;
}

.battle-mvp-label {
    font-size: 11px;
    color: #FFD700;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.battle-mvp-name {
    font-size: 16px;
    font-weight: 800;
}

.battle-results-actions {
    display: flex;
    gap: 10px;
    margin: 20px 16px 0;
}

.battle-results-actions .btn {
    flex: 1;
}

/* ---- Battle Question Breakdown ---- */
.battle-breakdown {
    margin: 16px;
    text-align: left;
}

.battle-breakdown-title {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,0.7);
    margin-bottom: 8px;
}

.battle-breakdown-item {
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 13px;
}

.battle-breakdown-icon {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.battle-breakdown-detail {
    flex: 1;
}

.battle-breakdown-team {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

/* Expandable breakdown */
.battle-breakdown-item.expandable {
    cursor: pointer;
    transition: background 0.2s;
}
.battle-breakdown-item.expandable:active {
    background: rgba(255,255,255,0.1);
}
.battle-breakdown-summary {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}
.battle-breakdown-chevron {
    color: rgba(255,255,255,0.4);
    font-size: 12px;
    flex-shrink: 0;
    transition: transform 0.2s;
    margin-left: auto;
}
.battle-breakdown-expand {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    margin: 0 16px 6px;
    border-radius: 0 0 10px 10px;
    background: rgba(255,255,255,0.04);
}
.battle-breakdown-expand.open {
    max-height: 800px;
    padding: 12px 14px;
}
.battle-breakdown-expand.open {
    border-top: 1px solid rgba(255,255,255,0.08);
}
.battle-breakdown-fullq {
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 10px;
}
.battle-breakdown-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.battle-breakdown-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    flex-wrap: wrap;
}
.battle-breakdown-opt.correct {
    background: rgba(76,175,80,0.15);
    border: 1px solid rgba(76,175,80,0.4);
}
.battle-breakdown-opt.wrong {
    background: rgba(244,67,54,0.1);
    border: 1px solid rgba(244,67,54,0.3);
}
.bbd-letter {
    font-weight: 700;
    min-width: 18px;
    text-align: center;
    color: rgba(255,255,255,0.6);
}
.bbd-text {
    flex: 1;
}
.bbd-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}
.bbd-tag.t1 {
    background: rgba(108,99,255,0.3);
    color: #a8a0ff;
}
.bbd-tag.t2 {
    background: rgba(255,107,107,0.3);
    color: #ff9999;
}
.bbd-tag.answer {
    background: rgba(76,175,80,0.3);
    color: #81C784;
}
.battle-breakdown-explanation {
    margin-top: 8px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    line-height: 1.4;
}

/* ---- Battle List ---- */
.battle-list-header {
    background: linear-gradient(135deg, #0f0c29, #302b63);
    color: white;
    padding: 20px 16px;
    text-align: center;
    border-radius: 0 0 20px 20px;
    margin-bottom: 16px;
}

.battle-list-header h2 {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 4px;
}

.battle-list-header p {
    font-size: 13px;
    opacity: 0.7;
}

.battle-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 16px;
    margin: 16px 0 8px;
}

.battle-section-title.live {
    color: #EF4444;
    display: flex;
    align-items: center;
    gap: 6px;
}

.battle-section-title .pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #EF4444;
    animation: battleBlink 1s ease-in-out infinite;
}

.battle-card {
    background: var(--card);
    border-radius: 14px;
    margin: 0 16px 10px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.2s;
}

.battle-card:active {
    transform: scale(0.98);
}

.battle-card.live {
    border: 2px solid #EF4444;
    animation: battleCardPulse 2s ease-in-out infinite;
}

.battle-card.pending {
    border: 2px solid #F59E0B;
}

.battle-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.battle-card-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 10px;
}

.battle-card-badge.live {
    background: #FEE2E2;
    color: #EF4444;
}

.battle-card-badge.scheduled {
    background: #DBEAFE;
    color: #3B82F6;
}

.battle-card-badge.pending {
    background: #FEF3C7;
    color: #D97706;
}

.battle-card-badge.completed {
    background: #D1FAE5;
    color: #059669;
}

.battle-card-subject {
    font-size: 11px;
    color: var(--text-light);
}

.battle-card-matchup {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.battle-card-team {
    flex: 1;
    text-align: center;
}

.battle-card-team-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.battle-card-team-teacher {
    font-size: 11px;
    color: var(--text-light);
}

.battle-card-vs {
    font-size: 14px;
    font-weight: 900;
    color: var(--primary);
}

.battle-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-light);
}

.battle-card-spectators {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #EF4444;
    margin-top: 4px;
}

.battle-card-time {
    text-align: center;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    opacity: 0.8;
}

.battle-card-score {
    font-size: 18px;
    font-weight: 800;
}

/* ---- Dashboard Banner ---- */
.battle-dashboard-banner {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    color: white;
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 16px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.battle-dashboard-banner.live {
    animation: battleCardPulse 2s ease-in-out infinite;
    border: 2px solid #EF4444;
}

.battle-dashboard-banner .banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.battle-dashboard-banner .banner-icon {
    font-size: 32px;
}

.battle-dashboard-banner .banner-text h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.battle-dashboard-banner .banner-text p {
    font-size: 12px;
    opacity: 0.8;
}

.battle-dashboard-banner .banner-arrow {
    font-size: 20px;
    opacity: 0.6;
    margin-left: auto;
}

/* ---- Create Battle Form ---- */
.battle-form-step {
    padding: 16px;
}

.battle-form-step h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

.battle-search-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.battle-search-input:focus {
    border-color: var(--primary);
}

.battle-search-results {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
}

.battle-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.battle-search-item:hover,
.battle-search-item:active {
    background: var(--bg);
}

.battle-search-item .name {
    font-size: 14px;
    font-weight: 600;
}

.battle-search-item .teacher {
    font-size: 12px;
    color: var(--text-light);
}

.battle-config-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 8px 0 16px;
}

.battle-config-option {
    padding: 10px 8px;
    border: 2px solid var(--border);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.battle-config-option.selected {
    border-color: var(--primary);
    background: rgba(108,99,255,0.08);
    color: var(--primary);
}

/* ---- Animations ---- */
@keyframes battleGlow {
    0%, 100% { box-shadow: 0 0 12px rgba(255,215,0,0.5); }
    50% { box-shadow: 0 0 24px rgba(255,215,0,0.8); }
}

@keyframes battleVsPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes battleLightning {
    0%, 100% { opacity: 1; transform: scale(1); }
    25% { opacity: 0.6; transform: scale(1.1) rotate(5deg); }
    50% { opacity: 1; transform: scale(1) rotate(0deg); }
    75% { opacity: 0.6; transform: scale(1.1) rotate(-5deg); }
}

@keyframes battlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes battleBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

@keyframes battleSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes battleCountPop {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes battleCorrect {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes battleWrong {
    0% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

@keyframes battleFeedbackPop {
    0% { transform: scale(0.5); opacity: 0; }
    30% { transform: scale(1.3); opacity: 1; }
    60% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0; }
}

@keyframes battleCardPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.2); }
    50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

@keyframes battleTimerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes battleSparkle {
    0% { transform: scale(0) rotate(0deg); opacity: 1; }
    100% { transform: scale(1.5) rotate(180deg); opacity: 0; }
}

/* ---- Team teacher label ---- */
.battle-team-teacher-label {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 4px;
}

/* ---- Spectator mini answer options ---- */
.spectator-mini-opt {
    display: inline-block;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.1);
}

.spectator-mini-opt.correct {
    background: rgba(78,205,196,0.2);
    border-color: #4ECDC4;
    color: #4ECDC4;
    font-weight: 700;
}

.spectator-mini-opt.wrong {
    background: rgba(255,107,107,0.2);
    border-color: #FF6B6B;
    color: #FF6B6B;
    font-weight: 700;
}

/* ---- Spectator option styling ---- */
.battle-option.spectator {
    opacity: 0.7;
    cursor: default;
}

/* ---- Time Label under status ---- */
.battle-time-label {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
    font-weight: 600;
}

/* ---- Waiting Screen (Opponent's Turn) ---- */
.battle-waiting-screen {
    text-align: center;
    padding: 40px 24px 60px;
    color: white;
}

.battle-waiting-icon {
    position: relative;
    display: inline-block;
    font-size: 48px;
    margin-bottom: 16px;
}

.battle-waiting-pulse {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 70px; height: 70px;
    border-radius: 50%;
    background: rgba(255,215,0,0.15);
    animation: battleWaitPulse 2s ease-in-out infinite;
}

.battle-waiting-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 6px;
    color: rgba(255,255,255,0.9);
}

.battle-waiting-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 20px;
}

.battle-waiting-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.battle-waiting-dots .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    animation: battleDotBounce 1.4s ease-in-out infinite;
}

.battle-waiting-dots .dot:nth-child(2) { animation-delay: 0.2s; }
.battle-waiting-dots .dot:nth-child(3) { animation-delay: 0.4s; }

/* ---- Turn Notification Overlay ---- */
.battle-turn-notify {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 997;
    pointer-events: none;
    animation: battleTurnFadeIn 0.3s ease-out;
}

.battle-turn-notify.fade-out {
    animation: battleTurnFadeOut 0.3s ease-in forwards;
}

.battle-turn-notify-text {
    font-size: 36px;
    font-weight: 900;
    padding: 16px 32px;
    border-radius: 16px;
    animation: battleTurnPop 0.4s ease-out;
}

.battle-turn-notify-text.your-turn {
    color: #FFD700;
    background: rgba(15,12,41,0.85);
    border: 3px solid rgba(255,215,0,0.4);
    text-shadow: 0 0 30px rgba(255,215,0,0.6);
}

.battle-turn-notify-text.opponent-turn {
    color: rgba(255,255,255,0.8);
    background: rgba(15,12,41,0.85);
    border: 3px solid rgba(255,255,255,0.2);
    font-size: 24px;
}

/* ---- Timeout Feedback ---- */
.battle-feedback-text.timeout {
    color: #FF6B6B;
    text-shadow: 0 0 30px rgba(255,107,107,0.6);
}

/* ---- New Animations ---- */
@keyframes battleWaitPulse {
    0%, 100% { transform: translate(-50%,-50%) scale(1); opacity: 0.4; }
    50% { transform: translate(-50%,-50%) scale(1.4); opacity: 0.1; }
}

@keyframes battleDotBounce {
    0%, 80%, 100% { transform: translateY(0); background: rgba(255,255,255,0.3); }
    40% { transform: translateY(-12px); background: rgba(255,215,0,0.7); }
}

@keyframes battleTurnFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes battleTurnFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes battleTurnPop {
    0% { transform: scale(0.5); }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ---- Acceptance Overlay ---- */
.battle-accepted-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,12,41,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: battleTurnFadeIn 0.3s ease-out;
}

.battle-accepted-card {
    text-align: center;
    padding: 32px 24px;
    max-width: 300px;
    width: 90%;
}

.battle-accepted-icon {
    font-size: 64px;
    margin-bottom: 12px;
    animation: battleCountPop 0.6s ease-out;
}

.battle-accepted-title {
    font-size: 28px;
    font-weight: 900;
    color: #4ECDC4;
    margin-bottom: 8px;
    text-shadow: 0 0 30px rgba(78,205,196,0.5);
    animation: battleCountPop 0.6s ease-out 0.1s both;
}

.battle-accepted-sub {
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    line-height: 1.4;
    animation: battleCountPop 0.6s ease-out 0.2s both;
}

@keyframes dotPulse {
    0%, 100% { background: rgba(255,255,255,0.2); transform: scale(1); }
    50% { background: #4ECDC4; transform: scale(1.4); }
}

/* ---- Spectator Count ---- */
.battle-spectator-count {
    text-align: center;
    margin: 6px auto 2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    letter-spacing: 0.3px;
    backdrop-filter: blur(5px);
    width: fit-content;
}

.battle-spectator-count-wrap {
    text-align: center;
    position: relative;
}

.battle-spectator-count {
    cursor: pointer;
}

.battle-spectator-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: rgba(0,0,0,0.6);
    border-radius: 10px;
    margin: 0 auto;
    width: fit-content;
    min-width: 160px;
    backdrop-filter: blur(10px);
}

.battle-spectator-list.open {
    max-height: 200px;
    padding: 6px 0;
    margin-top: 4px;
    border: 1px solid rgba(255,255,255,0.15);
    overflow-y: auto;
}

.battle-spectator-item {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    text-align: left;
}

/* ---- Reaction Bar ---- */
.battle-reaction-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px 16px;
    margin-top: 8px;
}

.battle-reaction-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    font-size: 22px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.battle-reaction-btn:active {
    transform: scale(1.25);
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
}

.battle-reaction-btn.cooldown {
    opacity: 0.4;
    pointer-events: none;
}

/* ---- Floating Emoji Container ---- */
.battle-reaction-container {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 100px;
    width: 280px;
    height: 400px;
    pointer-events: none;
    z-index: 996;
    overflow: hidden;
}

.battle-floating-emoji {
    position: absolute;
    bottom: 0;
    animation: battleEmojiFloat 4.5s ease-out forwards;
    will-change: transform, opacity;
}

@keyframes battleEmojiFloat {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0.9;
    }
    15% {
        transform: translateY(-50px) scale(1.1);
        opacity: 1;
    }
    50% {
        transform: translateY(-180px) scale(1) translateX(var(--drift, 10px));
        opacity: 0.8;
    }
    100% {
        transform: translateY(-380px) scale(0.7) translateX(var(--drift, 10px));
        opacity: 0;
    }
}

/* ---- Battle Mode Toggle (1v1 / Team) ---- */
.battle-mode-toggle {
    display: flex;
    background: var(--bg);
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
    margin-bottom: 12px;
}

.battle-mode-opt {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-light);
}

.battle-mode-opt.selected {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(108,99,255,0.3);
}

/* ---- Team Member Section ---- */
.battle-team-section {
    overflow: hidden;
    animation: battleTeamSlideDown 0.3s ease-out;
    margin-bottom: 12px;
    padding-top: 4px;
}

@keyframes battleTeamSlideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 600px; }
}

/* ---- Team Member Pills ---- */
.battle-team-pills {
    margin-bottom: 8px;
}

.battle-team-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
}

.battle-team-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(108,99,255,0.1);
    border: 2px solid var(--primary);
    border-radius: 20px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

.battle-team-pill-x {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--primary);
    padding: 0 2px;
    line-height: 1;
    font-weight: 700;
}

/* ---- Team Indicator on Battle Cards ---- */
.battle-team-indicator {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 8px;
    background: rgba(108,99,255,0.1);
    color: var(--primary);
    margin-left: 6px;
}

/* ---- Team Members Under Captain in Scoreboard ---- */
.battle-team-members-list {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 4px;
    line-height: 1.3;
    font-weight: 600;
}

/* ---- Battle Leaderboard ---- */
.battle-lb-card {
    background: var(--card);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.battle-lb-title {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 10px;
}
.battle-lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.battle-lb-table thead th {
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    padding: 4px 4px 8px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.battle-lb-table thead th:first-child { width: 28px; text-align: center; }
.battle-lb-table tbody tr { border-bottom: 1px solid var(--border); }
.battle-lb-table tbody tr:last-child { border-bottom: none; }
.battle-lb-table td { padding: 8px 4px; }
.battle-lb-rank { text-align: center; font-size: 16px; width: 28px; }
.battle-lb-player {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 13px;
}
.battle-lb-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
}
.battle-lb-stat {
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-light);
}
.battle-lb-me {
    background: rgba(108,99,255,0.08);
}
.battle-lb-me td { color: var(--primary); }
.battle-lb-me .battle-lb-stat { color: var(--primary); }
.battle-lb-toggle {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    background: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border-top: 1px solid var(--border);
    margin-top: 2px;
}

/* ---- Responsive ---- */
@media (max-width: 360px) {
    .battle-team-score { font-size: 28px; }
    .battle-vs-text { font-size: 16px; }
    .battle-options { grid-template-columns: 1fr; }
    .battle-countdown-num { font-size: 80px; }
    .battle-turn-notify-text { font-size: 28px; }
    .battle-turn-notify-text.opponent-turn { font-size: 20px; }
}
