/* =======================================================
   KALE SAVAŞI - PREMIUM KUŞATMA ARENASI UI
   Cyber-Medieval Dark Theme • PC + Mobile First
   Font: Rajdhani (skorboard) + Inter (gövde)
   ======================================================= */

:root {
    /* Renk Sistemi */
    --bg-dark: #070b14;
    --bg-deeper: #04070e;
    --panel-bg: rgba(11, 18, 34, 0.88);
    --panel-bg-solid: #0b1222;
    --card-bg: rgba(17, 26, 48, 0.78);
    --card-bg-hover: rgba(24, 36, 66, 0.92);
    --border-subtle: rgba(148, 163, 184, 0.14);
    --border-strong: rgba(148, 163, 184, 0.28);
    --border-glow: rgba(56, 189, 248, 0.4);

    --kizil-primary: #ef4444;
    --kizil-light: #fca5a5;
    --kizil-glow: rgba(239, 68, 68, 0.55);
    --kizil-bg: rgba(239, 68, 68, 0.12);

    --mavi-primary: #3b82f6;
    --mavi-light: #93c5fd;
    --mavi-glow: rgba(59, 130, 246, 0.55);
    --mavi-bg: rgba(59, 130, 246, 0.12);

    --gold-primary: #f59e0b;
    --gold-light: #fcd34d;
    --gold-glow: rgba(245, 158, 11, 0.5);

    --emerald-primary: #10b981;
    --violet-primary: #8b5cf6;
    --sky-primary: #38bdf8;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    /* Tipografi */
    --font-display: 'Rajdhani', 'Segoe UI', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Ölçüler */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --hud-h: 76px;
    --deck-h: 264px;

    --shadow-panel: 0 8px 32px rgba(0, 0, 0, 0.45);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.4);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

#gameContainer {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(56, 189, 248, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 15% 110%, rgba(239, 68, 68, 0.07), transparent),
        radial-gradient(ellipse 60% 40% at 85% 110%, rgba(59, 130, 246, 0.07), transparent),
        radial-gradient(circle at 50% 30%, #101a33 0%, var(--bg-dark) 70%);
    position: relative;
    overflow: hidden;
}

/* İnce film grain / atmosfer dokusu */
#gameContainer::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 3px 3px;
    opacity: 0.5;
    z-index: 0;
}

#gameContainer > * {
    position: relative;
    z-index: 1;
}

/* =======================================================
   1. ÜST SKORBOARD (CANLAR, PUANLAR, DÖNEM)
   ======================================================= */
#hudTopBar {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    padding: 10px 18px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(9, 14, 28, 0.92));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    z-index: 100;
    gap: 14px;
    position: relative;
}

#hudTopBar::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--kizil-glow), rgba(245, 158, 11, 0.5), var(--mavi-glow), transparent);
    opacity: 0.7;
    pointer-events: none;
}

.hud-team {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 460px;
    padding: 8px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s var(--ease-out), border-color 0.3s;
}

.hud-team::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    opacity: 0.9;
}

.hud-kizil::before { left: 0; background: linear-gradient(180deg, var(--kizil-primary), transparent); }
.hud-mavi::before { right: 0; background: linear-gradient(180deg, var(--mavi-primary), transparent); }

.hud-team.hp-critical {
    border-color: rgba(239, 68, 68, 0.55);
    animation: criticalPulse 1.1s ease-in-out infinite;
}

/* Takım Arması Madalyonu */
.team-crest {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crest-ring {
    position: absolute;
    inset: 6px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--border-strong);
    transform: rotate(45deg);
    border-radius: 10px;
}

.hud-kizil .crest-ring {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 16px var(--kizil-glow), inset 0 0 12px rgba(239, 68, 68, 0.2);
}

.hud-mavi .crest-ring {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 16px var(--mavi-glow), inset 0 0 12px rgba(59, 130, 246, 0.2);
}

.crest-emoji {
    font-size: 22px;
    line-height: 1;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.team-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.team-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.team-header-row.justify-end { justify-content: flex-end; }

.team-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hud-kizil .team-name {
    color: var(--kizil-light);
    text-shadow: 0 0 12px var(--kizil-glow);
}

.hud-mavi .team-name {
    color: var(--mavi-light);
    text-shadow: 0 0 12px var(--mavi-glow);
}

.team-level {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border-subtle);
    color: #e2e8f0;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

/* Can Barları */
.hp-bar-wrap {
    width: 100%;
    height: 16px;
    background: rgba(2, 6, 16, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
}

.hp-bar-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(90deg, transparent 0, transparent 19px, rgba(0, 0, 0, 0.35) 19px, rgba(0, 0, 0, 0.35) 20px);
    pointer-events: none;
    opacity: 0.6;
}

.hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #b91c1c, #ef4444 55%, #f87171);
    box-shadow: 0 0 12px var(--kizil-glow);
    transition: width 0.5s var(--ease-out);
    border-radius: 7px;
    position: relative;
    overflow: hidden;
}

.hp-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    animation: hpShine 2.6s ease-in-out infinite;
}

.hp-bar-fill.fill-mavi {
    background: linear-gradient(90deg, #60a5fa, #3b82f6 45%, #1d4ed8);
    box-shadow: 0 0 12px var(--mavi-glow);
    margin-left: auto;
}

.hp-bar-fill.fill-mavi::after {
    animation: hpShine 2.6s ease-in-out infinite reverse;
    left: auto;
    right: -40%;
}

.hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 9.5px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 6px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.6px;
    pointer-events: none;
    z-index: 2;
    white-space: nowrap;
}

.hp-pct {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
    pointer-events: none;
    z-index: 2;
    display: none;
}

.team-pts-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

.team-pts-row.justify-end { justify-content: flex-end; }

.pts-label b {
    color: var(--gold-primary);
    font-weight: 700;
    font-family: var(--font-display);
    font-size: 14px;
    text-shadow: 0 0 8px var(--gold-glow);
}

.shield-indicator {
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.5);
    color: var(--sky-primary);
    font-size: 9.5px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    animation: pulseShield 1.5s infinite;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* Merkez Skor Çekirdeği */
.hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 118px;
    padding: 0 4px;
}

.hud-score-core {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hud-score-core::before,
.hud-score-core::after {
    content: '';
    width: 26px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.7));
    position: absolute;
    top: 50%;
}

.hud-score-core::before { left: -30px; }
.hud-score-core::after { right: -30px; transform: scaleX(-1); }

.hud-vs-badge {
    font-family: var(--font-display);
    background: linear-gradient(135deg, #fcd34d, #f59e0b 55%, #d97706);
    color: #1f1305;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 1.5px;
    padding: 4px 16px;
    border-radius: 10px;
    box-shadow: 0 0 20px var(--gold-glow), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.25);
    position: relative;
    z-index: 1;
}

.hud-period {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    color: var(--gold-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--gold-glow);
}

.hud-controls {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

.hud-icon-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    border-radius: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.25s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.hud-icon-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(56, 189, 248, 0.35), transparent 70%);
    opacity: 0;
    transition: opacity 0.25s;
}

.hud-icon-btn:hover {
    color: #fff;
    border-color: var(--border-glow);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.25);
}

.hud-icon-btn:hover::after { opacity: 1; }
.hud-icon-btn:active { transform: scale(0.94); }
.hud-icon-btn.is-muted { color: #f87171; border-color: rgba(248, 113, 113, 0.4); }
.hud-icon-btn.is-active { color: var(--sky-primary); border-color: var(--border-glow); }

/* =======================================================
   2. MERKEZ: 60 FPS HTML5 CANVAS SAVAŞ ALANI
   ======================================================= */
#arenaWrapper {
    flex: 1;
    min-height: 140px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background:
        radial-gradient(ellipse 90% 60% at 50% 100%, rgba(15, 23, 42, 0.9), transparent),
        #060a14;
}

#arenaCanvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

/* Sinematik Sahne Çerçevesi */
.arena-frame {
    position: absolute;
    inset: 10px;
    pointer-events: none;
    z-index: 5;
}

.frame-corner {
    position: absolute;
    width: 26px;
    height: 26px;
    border-color: rgba(56, 189, 248, 0.55);
    border-style: solid;
    border-width: 0;
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.5));
}

.frame-corner.tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; border-top-left-radius: 6px; }
.frame-corner.tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; border-top-right-radius: 6px; }
.frame-corner.bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; border-bottom-left-radius: 6px; }
.frame-corner.br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 6px; }

.frame-line {
    position: absolute;
    left: 40px;
    right: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.35), transparent);
    opacity: 0.7;
}

.frame-line.top { top: 0; }
.frame-line.bottom { bottom: 0; }

.arena-watermark {
    position: absolute;
    bottom: 16px;
    right: 22px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 4px;
    color: rgba(148, 163, 184, 0.35);
    text-transform: uppercase;
    pointer-events: none;
    z-index: 5;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* Canlı Toast Bildirimi */
#battleBannerToast {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%) translateY(-40px) scale(0.95);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(10, 16, 32, 0.96));
    border: 1px solid var(--border-glow);
    padding: 9px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s var(--ease-out);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: min(88vw, 560px);
    text-align: center;
    justify-content: center;
}

#battleBannerToast i {
    color: var(--sky-primary);
    font-size: 15px;
    flex-shrink: 0;
}

#battleBannerToast b { color: var(--gold-light); }

#battleBannerToast.toast-crit {
    border-color: rgba(245, 158, 11, 0.65);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 26px var(--gold-glow);
    animation: critFlash 0.5s var(--ease-out);
}

#battleBannerToast.toast-crit i { color: var(--gold-primary); }

#battleBannerToast.toast-hit i { color: var(--kizil-light); }

#battleBannerToast .crit-mark {
    background: linear-gradient(135deg, #fcd34d, #f59e0b);
    color: #1f1305;
    font-size: 10px;
    font-weight: 900;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 1px;
    margin: 0 3px;
    vertical-align: middle;
}

#battleBannerToast.show {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
}

/* =======================================================
   3. ALT PANEL: KULLANICI KARTI & CEPHANELİK
   ======================================================= */
#hudBottomDeck {
    background: linear-gradient(180deg, rgba(9, 14, 28, 0.94), rgba(7, 11, 22, 0.98));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    max-height: var(--deck-h);
    z-index: 100;
    position: relative;
}

#hudBottomDeck::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.5), rgba(245, 158, 11, 0.5), transparent);
    opacity: 0.6;
    pointer-events: none;
}

/* Kullanıcı Çubuğu */
.user-status-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.28);
    gap: 10px;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.user-avatar-ring {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(135deg, var(--sky-primary), var(--violet-primary));
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
}

body.team-kizil .user-avatar-ring {
    background: linear-gradient(135deg, #f87171, var(--kizil-primary));
    box-shadow: 0 0 14px var(--kizil-glow);
}

body.team-mavi .user-avatar-ring {
    background: linear-gradient(135deg, #60a5fa, var(--mavi-primary));
    box-shadow: 0 0 14px var(--mavi-glow);
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #0b1222;
    display: block;
    background: #0b1222;
}

.user-online-dot {
    position: absolute;
    right: 0;
    bottom: 2px;
    width: 10px;
    height: 10px;
    background: var(--emerald-primary);
    border: 2px solid #0b1222;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.9);
    animation: onlinePulse 2s infinite;
    z-index: 2;
}

.user-names {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.uname-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14.5px;
    color: #f8fafc;
    letter-spacing: 0.4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.uteam-badge {
    font-size: 9.5px;
    font-weight: 800;
    padding: 2px 9px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.uteam-badge.kizil {
    background: var(--kizil-bg);
    color: var(--kizil-light);
    border: 1px solid var(--kizil-glow);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}

.uteam-badge.mavi {
    background: var(--mavi-bg);
    color: var(--mavi-light);
    border: 1px solid var(--mavi-glow);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.btn-connect {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #fff;
    font-size: 11.5px;
    font-weight: 800;
    padding: 7px 15px;
    border-radius: 22px;
    text-decoration: none;
    box-shadow: 0 0 16px rgba(236, 72, 153, 0.45);
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.btn-connect:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 0 22px rgba(236, 72, 153, 0.65);
}

.btn-connect:active { transform: scale(0.97); }

.user-gold-box {
    display: flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(245, 158, 11, 0.06));
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 6px 14px;
    border-radius: 22px;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--gold-light);
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.3s, transform 0.3s var(--ease-out);
}

.user-gold-box::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 40%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transform: rotate(18deg);
    animation: goldSheen 4s ease-in-out infinite;
    pointer-events: none;
}

.user-gold-box.pulse {
    animation: goldPulse 0.6s var(--ease-out);
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.55);
}

.user-gold-box i { color: var(--gold-primary); font-size: 13px; }

.user-gold-box small {
    font-family: var(--font-body);
    font-size: 9.5px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sekmeler */
.deck-tabs-nav {
    display: flex;
    background: rgba(15, 23, 42, 0.55);
    padding: 6px 10px;
    gap: 8px;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
}

.deck-tab-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: all 0.25s var(--ease-out);
    position: relative;
    letter-spacing: 0.2px;
}

.deck-tab-btn i { font-size: 13px; opacity: 0.85; }

.deck-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-1px);
}

.deck-tab-btn.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(139, 92, 246, 0.14));
    border-color: rgba(56, 189, 248, 0.45);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

.deck-tab-btn.active i { opacity: 1; color: var(--sky-primary); }

.tab-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--emerald-primary);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.9);
    animation: onlinePulse 1.6s infinite;
    margin-left: 2px;
}

/* Sekme İçerikleri */
.deck-tab-pane {
    display: none;
    padding: 12px 14px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(var(--deck-h) - 118px);
    animation: paneFade 0.3s var(--ease-out);
    scrollbar-width: thin;
    scrollbar-color: rgba(56, 189, 248, 0.4) transparent;
}

.deck-tab-pane.active { display: block; }

.deck-tab-pane::-webkit-scrollbar { width: 6px; }
.deck-tab-pane::-webkit-scrollbar-track { background: transparent; }
.deck-tab-pane::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.35);
    border-radius: 4px;
}
.deck-tab-pane::-webkit-scrollbar-thumb:hover { background: rgba(56, 189, 248, 0.6); }

/* Aksiyon / Silah Grid */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: 11px;
}

.action-card {
    --wcolor: var(--gold-primary);
    background: linear-gradient(160deg, rgba(17, 26, 48, 0.9), rgba(12, 18, 36, 0.95));
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    padding: 11px 13px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s var(--ease-out), border-color 0.25s, box-shadow 0.25s;
    box-shadow: var(--shadow-card);
}

.action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--wcolor), transparent);
    opacity: 0.75;
    transition: opacity 0.25s;
}

.action-card::after {
    content: '';
    position: absolute;
    top: -70%;
    left: -70%;
    width: 60%;
    height: 240%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    transform: rotate(25deg);
    transition: left 0.55s var(--ease-out);
    pointer-events: none;
}

.action-card:hover:not(.disabled) {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--wcolor) 55%, transparent);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.55), 0 0 18px color-mix(in srgb, var(--wcolor) 30%, transparent);
}

.action-card:hover:not(.disabled)::after { left: 130%; }

.action-card:active:not(.disabled) { transform: translateY(-1px) scale(0.985); }

.action-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.55);
}

.action-card.insufficient-gold { border-color: rgba(239, 68, 68, 0.4); }
.action-card.insufficient-gold .ac-cost { color: #fca5a5; border-color: rgba(239, 68, 68, 0.5); }

.ac-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ac-icon {
    font-size: 19px;
    color: var(--wcolor);
    filter: drop-shadow(0 0 8px color-mix(in srgb, var(--wcolor) 60%, transparent));
}

.ac-cost {
    background: rgba(245, 158, 11, 0.14);
    color: var(--gold-light);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 12px;
    padding: 3px 9px;
    border-radius: 20px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    display: flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.3px;
    transition: color 0.25s, border-color 0.25s;
}

.ac-cost i { font-size: 10px; }

.ac-name {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.4px;
    line-height: 1.15;
}

.ac-desc {
    font-size: 10.5px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 28px;
}

.ac-stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 700;
    margin-top: auto;
    padding-top: 5px;
    border-top: 1px dashed rgba(148, 163, 184, 0.18);
}

.ac-damage-badge { color: #f87171; display: inline-flex; align-items: center; gap: 4px; }
.ac-cooldown-badge { color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }

/* Cooldown Karartması (Radyal Sayac) */
.cooldown-overlay {
    position: absolute;
    inset: 0;
    background: rgba(4, 7, 14, 0.9);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    z-index: 10;
    border-radius: 14px;
    overflow: hidden;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.cooldown-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--sky-primary), var(--violet-primary));
    transform-origin: left;
    transform: scaleX(var(--cd-progress, 1));
    transition: transform 1s linear;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}

.action-card.in-cooldown .cooldown-overlay { display: flex; }
.action-card.in-cooldown { cursor: progress; }

.cd-num {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 30px;
    color: var(--sky-primary);
    text-shadow: 0 0 16px rgba(56, 189, 248, 0.8);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.cd-label {
    font-size: 8.5px;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 2.5px;
    text-transform: uppercase;
}

/* Savaş Günlüğü */
.combat-feed-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-height: 40px;
}

.combat-feed-item {
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.75), rgba(15, 23, 42, 0.4));
    border-left: 3px solid var(--text-dim);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    animation: feedSlide 0.35s var(--ease-out);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: background 0.2s, transform 0.2s;
}

.combat-feed-item:hover {
    background: linear-gradient(90deg, rgba(23, 34, 62, 0.9), rgba(15, 23, 42, 0.5));
    transform: translateX(3px);
}

.combat-feed-item b { color: var(--gold-light); font-weight: 700; }

.combat-feed-item.kizil {
    border-left-color: var(--kizil-primary);
    box-shadow: inset 0 0 24px rgba(239, 68, 68, 0.06), 0 2px 8px rgba(0, 0, 0, 0.25);
}

.combat-feed-item.mavi {
    border-left-color: var(--mavi-primary);
    box-shadow: inset 0 0 24px rgba(59, 130, 246, 0.06), 0 2px 8px rgba(0, 0, 0, 0.25);
}

.combat-feed-time {
    font-family: var(--font-display);
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 7px;
    border-radius: 6px;
    white-space: nowrap;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.combat-feed-empty {
    text-align: center;
    color: var(--text-dim);
    font-size: 12.5px;
    padding: 26px 16px;
    border: 1px dashed rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.3);
}

.combat-feed-empty i {
    font-size: 26px;
    opacity: 0.5;
    color: var(--sky-primary);
}

/* =======================================================
   4. ANİMASYONLAR
   ======================================================= */
@keyframes pulseShield {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.72; transform: scale(0.97); }
}

@keyframes hpShine {
    0% { left: -40%; }
    55%, 100% { left: 130%; }
}

@keyframes criticalPulse {
    0%, 100% { box-shadow: var(--shadow-card); }
    50% { box-shadow: var(--shadow-card), 0 0 22px rgba(239, 68, 68, 0.55); }
}

@keyframes onlinePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.82); opacity: 0.65; }
}

@keyframes goldSheen {
    0%, 55% { left: -60%; }
    85%, 100% { left: 130%; }
}

@keyframes goldPulse {
    0% { transform: scale(1); }
    35% { transform: scale(1.07); }
    100% { transform: scale(1); }
}

@keyframes critFlash {
    0% { box-shadow: 0 0 0 rgba(245, 158, 11, 0); }
    40% { box-shadow: 0 0 38px rgba(245, 158, 11, 0.75); }
    100% { box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 26px var(--gold-glow); }
}

@keyframes paneFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes feedSlide {
    from { opacity: 0; transform: translateX(-14px); }
    to { opacity: 1; transform: translateX(0); }
}

/* =======================================================
   5. DUYARLILIK: TABLET & MOBİL
   ======================================================= */

/* Orta boy ekranlar / tabletler */
@media (max-width: 900px) {
    #hudTopBar { padding: 8px 12px; gap: 10px; }
    .hud-team { max-width: none; padding: 7px 10px; gap: 9px; }
    .team-crest { width: 40px; height: 40px; }
    .crest-emoji { font-size: 19px; }
    .team-name { font-size: 13px; }
    .hud-center { min-width: 96px; }
    .action-grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
    .uname-text { max-width: 150px; }
}

/* Geniş PC: daha geniş kartlar & ferah arena */
@media (min-width: 1400px) {
    .action-grid { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
    #hudTopBar { padding: 12px 26px; }
    .deck-tab-pane { padding: 14px 20px; }
    .user-status-strip { padding: 9px 22px; }
}

/* -------------------------------------------------------
   MOBİL (≤ 640px): Yatay skorboard optimizasyonu
   ------------------------------------------------------- */
@media (max-width: 640px) {
    #hudTopBar {
        padding: 6px 8px;
        gap: 6px;
        align-items: center;
    }

    .hud-team {
        padding: 6px 8px;
        gap: 7px;
        border-radius: 10px;
    }

    .team-crest { width: 30px; height: 30px; }
    .crest-emoji { font-size: 15px; }
    .crest-ring { inset: 3px; border-radius: 7px; }

    .team-name { font-size: 10.5px; letter-spacing: 0.3px; }
    .team-level { display: none; }

    .team-info { gap: 3px; }
    .hp-bar-wrap { height: 11px; border-radius: 6px; }
    .hp-text { display: none; }
    .hp-pct { display: block; right: 5px; font-size: 9px; }

    .team-pts-row { font-size: 9.5px; gap: 6px; }
    .pts-label b { font-size: 12px; }
    .shield-indicator { font-size: 8.5px; padding: 1px 6px; }
    .shield-indicator i + * { display: none; }

    .hud-center { min-width: 64px; gap: 2px; padding: 0; }
    .hud-score-core::before, .hud-score-core::after { display: none; }
    .hud-vs-badge { font-size: 11px; padding: 3px 10px; letter-spacing: 1px; }
    .hud-period { font-size: 8.5px; letter-spacing: 1.2px; }
    .hud-controls { gap: 4px; }
    .hud-icon-btn { width: 25px; height: 25px; font-size: 10.5px; border-radius: 7px; }

    .arena-frame { inset: 6px; }
    .frame-corner { width: 16px; height: 16px; }
    .arena-watermark { font-size: 8.5px; letter-spacing: 2.5px; bottom: 10px; right: 12px; }

    #battleBannerToast {
        top: 12px;
        padding: 7px 14px;
        font-size: 11.5px;
        max-width: 92vw;
    }

    .user-status-strip { padding: 6px 10px; gap: 8px; }
    .user-avatar-ring { width: 34px; height: 34px; }
    .user-online-dot { width: 9px; height: 9px; }
    .uname-text { font-size: 13px; max-width: 130px; }
    .uteam-badge { font-size: 8.5px; padding: 1px 7px; }
    .user-actions { gap: 8px; }
    .btn-connect { font-size: 10.5px; padding: 6px 11px; }
    .btn-connect span { display: none; } /* sadece ikon */
    .user-gold-box { font-size: 13.5px; padding: 5px 11px; gap: 5px; }
    .user-gold-box small { display: none; }

    .deck-tabs-nav { padding: 5px 7px; gap: 6px; }
    .deck-tab-btn {
        font-size: 10.5px;
        padding: 7px 5px;
        gap: 5px;
        border-radius: 9px;
        flex-direction: column;
        line-height: 1.1;
    }
    .deck-tab-btn i { font-size: 13px; }
    .deck-tab-btn span { font-size: 9.5px; }

    .deck-tab-pane {
        padding: 9px 9px;
        max-height: min(38vh, 240px);
        -webkit-overflow-scrolling: touch;
    }

    #hudBottomDeck { max-height: none; }

    .action-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .action-card { padding: 9px 10px; gap: 5px; border-radius: 12px; }
    .cooldown-overlay { border-radius: 12px; }
    .ac-icon { font-size: 17px; }
    .ac-cost { font-size: 11px; padding: 2px 7px; }
    .ac-name { font-size: 13px; }
    .ac-desc { display: none; }
    .ac-stats-row { font-size: 9px; padding-top: 4px; }
    .cd-num { font-size: 26px; }

    .combat-feed-item { font-size: 11px; padding: 7px 9px; }
    .combat-feed-empty { padding: 18px 12px; font-size: 11.5px; }
    .combat-feed-empty i { font-size: 22px; }
}

/* -------------------------------------------------------
   KÜÇÜK MOBİL (≤ 380px): sıkışık skorboard
   ------------------------------------------------------- */
@media (max-width: 380px) {
    .team-crest { display: none; }
    .hud-team { padding: 6px 7px; }
    .team-name { font-size: 9.5px; }
    .hud-center { min-width: 54px; }
    .uname-text { max-width: 100px; }
    .deck-tab-btn span { font-size: 9px; }
}

/* -------------------------------------------------------
   YATAY KULLANIM (düşük yükseklik): alan tasarrufu
   ------------------------------------------------------- */
@media (max-height: 540px) and (orientation: landscape) {
    #hudTopBar { padding: 4px 10px; }
    .hud-team { padding: 4px 9px; }
    .team-crest { width: 32px; height: 32px; }
    .crest-emoji { font-size: 15px; }
    .hp-bar-wrap { height: 11px; }
    .team-pts-row { display: none; }
    .hud-controls { margin-top: 0; }
    .user-status-strip { padding: 4px 10px; }
    .user-avatar-ring { width: 30px; height: 30px; }
    .deck-tab-pane { padding: 7px 9px; max-height: 132px; }
    .action-card { padding: 7px 9px; gap: 4px; }
    .ac-desc { display: none; }
    .arena-watermark { display: none; }
}

/* -------------------------------------------------------
   DOKUNMATİK CİHAZLAR: büyük dokunma hedefleri
   ------------------------------------------------------- */
@media (pointer: coarse) {
    .hud-icon-btn { min-width: 36px; min-height: 36px; }
    .deck-tab-btn { padding-top: 10px; padding-bottom: 10px; }
    .action-card { min-height: 96px; justify-content: center; }
    .combat-feed-item { padding-top: 10px; padding-bottom: 10px; }
}

/* Konsol erişilebilirliği: klavye odağı */
.deck-tab-btn:focus-visible,
.hud-icon-btn:focus-visible,
.action-card:focus-visible,
.btn-connect:focus-visible {
    outline: 2px solid var(--sky-primary);
    outline-offset: 2px;
}

/* Hareket azaltma tercihi */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
