/* =============================================================================
   IRONBLADER - Stile CSS
   Campionato Competitivo Beyblade X
   Tema coerente con BeyTrade (dark, Apple Blue #007aff)
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Colori base BeyTrade */
    --bg-app: #141414;
    --bg-card: #1e1e1e;
    --bg-card-hover: #252525;
    --bg-elevated: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --text-muted: #666666;
    --border-color: #333333;
    --accent: #007aff;
    --accent-light: rgba(0, 122, 255, 0.15);
    --accent-glow: rgba(0, 122, 255, 0.3);

    /* IronBlader Brand Colors */
    --iron-gold: #f5c518;
    --iron-gold-light: rgba(245, 197, 24, 0.15);
    --iron-red: #ff3b30;
    --iron-green: #34c759;
    --iron-purple: #af52de;

    /* Finish type colors */
    --survival: #34c759;      /* verde - 1 punto */
    --ko: #ff9f0a;            /* arancione - 2 punti */
    --burst: #007aff;         /* blu - 2 punti */
    --extreme: #ff3b30;       /* rosso - 3 punti */

    /* Spacing */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --gap-sm: 8px;
    --gap-md: 16px;
    --gap-lg: 24px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.6);
    --shadow-accent: 0 0 24px rgba(0, 122, 255, 0.25);
    --shadow-gold: 0 0 24px rgba(245, 197, 24, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
    position: relative;
    isolation: isolate;
}

html {
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -220px;
    left: 50%;
    transform: translateX(-50%);
    width: 1200px;
    height: 560px;
    background: radial-gradient(circle, rgba(0, 122, 255, 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: min(980px, 86vw);
    height: min(620px, 60vh);
    background: url('logo-ironblader.png') no-repeat center / contain;
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
}

@media (max-width: 1180px) {
    body::after {
        top: 110px;
        width: min(860px, 92vw);
        height: min(520px, 54vh);
        opacity: 0.11;
    }
}

/* =============================================================================
   SCROLLBAR CUSTOM
   ============================================================================= */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* =============================================================================
   NAV / HEADER
   ============================================================================= */

.ib-nav {
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.ib-nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.ib-nav-brand .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--iron-gold), #ff9500);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 900;
    color: #000;
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow-gold);
}

.ib-nav-brand .brand-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.ib-nav-brand .brand-sub {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--iron-gold);
    letter-spacing: 2px;
    text-transform: uppercase;
    display: block;
    line-height: 1;
}

.ib-site-switcher {
    position: relative;
    gap: 0;
}

.ib-site-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.ib-site-brand-copy {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
}

.ib-site-switcher-caret {
    color: var(--text-secondary);
    font-size: 0.78rem;
    transform: translateY(1px);
}

.ib-site-switcher-btn[aria-expanded="true"] .ib-site-switcher-caret {
    color: var(--accent);
}

.ib-site-switcher-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 172px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: rgba(24, 24, 24, 0.98);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
    z-index: 120;
}

.ib-site-switcher-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ib-site-switcher-item:last-child {
    border-bottom: none;
}

.ib-site-switcher-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.ib-nav-links {
    display: flex;
    gap: 4px;
    list-style: none;
    min-width: 0;
}

.ib-nav-links a {
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ib-nav-links a:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.08);
}

.ib-nav-links a.active {
    color: var(--accent);
    background: var(--accent-light);
}

@media (max-width: 1280px) {
    .ib-nav {
        gap: 10px;
    }

    .ib-nav-links {
        flex: 1 1 auto;
        margin: 0 10px;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        scrollbar-width: none;
    }

    .ib-nav-links::-webkit-scrollbar {
        display: none;
    }

    .ib-nav-links li {
        flex: 0 0 auto;
    }

    .ib-nav-links a {
        padding: 7px 10px;
        font-size: 0.82rem;
    }
}

.ib-nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ib-nav-menu-btn {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.ib-nav-menu-btn span {
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 99px;
    background: var(--text-secondary);
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.ib-nav-menu-btn:hover {
    border-color: var(--accent);
    background: rgba(0, 122, 255, 0.08);
}

.ib-nav.menu-open .ib-nav-menu-btn span {
    background: var(--accent);
}

.ib-nav.menu-open .ib-nav-menu-btn span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.ib-nav.menu-open .ib-nav-menu-btn span:nth-child(2) {
    opacity: 0;
}

.ib-nav.menu-open .ib-nav-menu-btn span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.ib-user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ib-user-badge:hover { border-color: var(--accent); }

.ib-avatar-circle {
    --ib-avatar-size: 28px;
    width: var(--ib-avatar-size);
    height: var(--ib-avatar-size);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--iron-purple));
    border: 1px solid rgba(255, 255, 255, 0.16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.66rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}

.ib-avatar-circle.has-image {
    background: transparent;
}

.ib-avatar-circle img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.ib-avatar-18 { --ib-avatar-size: 18px; font-size: 0.5rem; }
.ib-avatar-22 { --ib-avatar-size: 22px; font-size: 0.58rem; }
.ib-avatar-24 { --ib-avatar-size: 24px; font-size: 0.62rem; }
.ib-avatar-28 { --ib-avatar-size: 28px; font-size: 0.66rem; }
.ib-avatar-32 { --ib-avatar-size: 32px; font-size: 0.72rem; }
.ib-avatar-36 { --ib-avatar-size: 36px; font-size: 0.78rem; }
.ib-avatar-56 { --ib-avatar-size: 56px; font-size: 1.15rem; }

.ib-user-avatar {
    flex-shrink: 0;
}

.ib-role-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.ib-role-badge.admin { background: rgba(255, 59, 48, 0.2); color: var(--iron-red); }
.ib-role-badge.moderator { background: rgba(255, 149, 0, 0.2); color: var(--ko); }
.ib-role-badge.referee { background: rgba(175, 82, 222, 0.2); color: var(--iron-purple); }
.ib-role-badge.captain { background: var(--iron-gold-light); color: var(--iron-gold); }

/* =============================================================================
   HERO SECTION
   ============================================================================= */

.ib-hero {
    position: relative;
    padding: 80px 24px;
    text-align: center;
    overflow: hidden;
    z-index: 1;
}

.ib-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(0,122,255,0.08) 0%, transparent 65%);
    pointer-events: none;
}

.ib-hero::after {
    content: none;
}

.ib-hero-tag {
    display: inline-block;
    background: var(--iron-gold-light);
    color: var(--iron-gold);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 100px;
    margin-bottom: 20px;
    border: 1px solid rgba(245, 197, 24, 0.3);
}

.ib-hero p {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 520px;
    margin: 0 auto 36px;
    line-height: 1.7;
}

.ib-hero .ib-hero-brand {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.95rem, 4.2vw, 3.2rem);
    font-weight: 900;
    letter-spacing: -0.9px;
    line-height: 1;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, #fff2b3 0%, #f5c518 42%, #d69700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 12px 30px rgba(245, 197, 24, 0.28);
}

.ib-hero .ib-hero-lead {
    color: var(--text-primary);
    font-size: clamp(0.98rem, 1.45vw, 1.34rem);
    font-weight: 600;
    max-width: 980px;
    line-height: 1.42;
    letter-spacing: -0.12px;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
    margin: 0 auto 32px;
}

.ib-hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* =============================================================================
   LAYOUT CONTAINERS
   ============================================================================= */

.ib-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.ib-section {
    padding: 48px 0;
    position: relative;
    z-index: 1;
}

.ib-section-header {
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.ib-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ib-section-title .icon { font-size: 1.4rem; }

/* =============================================================================
   CARDS
   ============================================================================= */

.ib-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 24px;
    transition: all 0.25s;
}

.ib-card:hover {
    border-color: rgba(255,255,255,0.15);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.ib-card--glass {
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
}

.ib-card--accent {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-card), rgba(0,122,255,0.05));
    box-shadow: var(--shadow-accent);
}

.ib-card--gold {
    border-color: var(--iron-gold);
    background: linear-gradient(135deg, var(--bg-card), rgba(245,197,24,0.04));
    box-shadow: var(--shadow-gold);
}

/* =============================================================================
   GRID LAYOUTS
   ============================================================================= */

.ib-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap-lg); }
.ib-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-lg); }
.ib-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap-md); }
.ib-grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap-lg); }

@media (max-width: 768px) {
    .ib-grid-2, .ib-grid-3, .ib-grid-4 { grid-template-columns: 1fr; }
}

/* =============================================================================
   BUTTONS
   ============================================================================= */

.btn-ib {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn-ib::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.2s;
}
.btn-ib:hover::after { background: rgba(255,255,255,0.06); }
.btn-ib:active { transform: scale(0.98); }

.btn-ib-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.35);
}
.btn-ib-primary:hover { box-shadow: 0 6px 24px rgba(0, 122, 255, 0.5); }

.btn-ib-gold {
    background: var(--iron-gold);
    color: #000;
    box-shadow: 0 4px 16px rgba(245, 197, 24, 0.3);
}
.btn-ib-gold:hover { box-shadow: 0 6px 24px rgba(245, 197, 24, 0.45); }

.btn-ib-danger {
    background: var(--iron-red);
    color: white;
    box-shadow: 0 4px 16px rgba(255, 59, 48, 0.3);
}

.btn-ib-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-ib-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ib-ghost {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    border: 1px solid transparent;
}

.btn-ib-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: var(--radius-xs); }
.btn-ib-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-md); }
.btn-ib-icon { padding: 8px; width: 36px; height: 36px; }

.ib-tabs-scroll {
    display: flex;
    gap: 4px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 28px;
    width: fit-content;
    max-width: 100%;
}

/* =============================================================================
   BADGES / PILLS
   ============================================================================= */

.ib-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.ib-badge-blue { background: var(--accent-light); color: var(--accent); }
.ib-badge-gold { background: var(--iron-gold-light); color: var(--iron-gold); }
.ib-badge-green { background: rgba(52, 199, 89, 0.15); color: var(--iron-green); }
.ib-badge-red { background: rgba(255, 59, 48, 0.15); color: var(--iron-red); }
.ib-badge-purple { background: rgba(175, 82, 222, 0.15); color: var(--iron-purple); }
.ib-badge-gray { background: rgba(255,255,255,0.08); color: var(--text-secondary); }
.ib-badge-orange { background: rgba(255, 159, 10, 0.15); color: #ff9f0a; }

/* Status badges */
.status-badge { display: inline-flex; align-items: center; gap: 5px; }
.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.status-badge.live::before { background: var(--iron-red); animation: pulse-dot 1s infinite; }
.status-badge.upcoming::before { background: var(--accent); }
.status-badge.locked::before { background: var(--iron-gold); }
.status-badge.completed::before { background: var(--iron-green); }
.status-badge.pending::before { background: var(--iron-gold); }
.status-badge.approved::before { background: var(--iron-green); }
.status-badge.rejected::before { background: var(--iron-red); }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* =============================================================================
   TEAM CARD
   ============================================================================= */

.team-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.team-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ib-team-logo {
    --ib-team-logo-size: 52px;
    width: var(--ib-team-logo-size);
    height: var(--ib-team-logo-size);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(0,122,255,0.22), rgba(175,82,222,0.18));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}

.ib-team-logo.has-image {
    background: transparent;
}

.ib-team-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ib-team-logo-18 { --ib-team-logo-size: 18px; border-radius: 6px; font-size: 0.56rem; }
.ib-team-logo-20 { --ib-team-logo-size: 20px; border-radius: 6px; font-size: 0.6rem; }
.ib-team-logo-22 { --ib-team-logo-size: 22px; border-radius: 7px; font-size: 0.62rem; }
.ib-team-logo-24 { --ib-team-logo-size: 24px; border-radius: 7px; font-size: 0.66rem; }
.ib-team-logo-28 { --ib-team-logo-size: 28px; border-radius: 8px; font-size: 0.72rem; }
.ib-team-logo-40 { --ib-team-logo-size: 40px; border-radius: 10px; font-size: 0.84rem; }
.ib-team-logo-48 { --ib-team-logo-size: 48px; border-radius: 12px; font-size: 0.94rem; }
.ib-team-logo-52 { --ib-team-logo-size: 52px; border-radius: 14px; font-size: 1rem; }
.ib-team-logo-64 { --ib-team-logo-size: 64px; border-radius: 16px; font-size: 1.15rem; }

.team-emoji {
    --ib-team-logo-size: 52px;
    font-size: 26px;
}

.team-info h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.team-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.team-members-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.member-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 100px;
    font-size: 0.78rem;
    border: 1px solid var(--border-color);
}

.member-chip .avatar {
    flex-shrink: 0;
}

/* =============================================================================
   MATCHDAY CARD
   ============================================================================= */

.matchday-card {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.matchday-card-header {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.matchday-number {
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent);
    margin-bottom: 6px;
}

.matchday-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.matchday-info {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.matchday-info span { display: flex; align-items: center; gap: 5px; }

/* =============================================================================
   MATCH VS CARD
   ============================================================================= */

.match-vs {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.match-vs:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.15);
}

.match-team {
    flex: 1;
    text-align: center;
    min-width: 0;
}

.match-team .emoji {
    --ib-team-logo-size: 40px;
    border-radius: 10px;
    font-size: 0.86rem;
    margin: 0 auto 6px;
}
.match-team .name {
    font-weight: 600;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.match-team .score {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
    margin-top: 4px;
}

.match-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.match-divider .vs-text {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 900;
    color: var(--text-muted);
    letter-spacing: 2px;
}

.match-divider .divider-line {
    width: 1px;
    height: 30px;
    background: var(--border-color);
}

/* =============================================================================
   BEYBLADE BUILD SLOTS (9 slot per squadra)
   ============================================================================= */

.bey-builds-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.bey-slot {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s;
    min-height: 140px;
    min-width: 0;
}

.bey-slot.filled { border-color: rgba(0, 122, 255, 0.4); }
.bey-slot.empty { border-style: dashed; opacity: 0.5; }

.bey-slot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.bey-slot-number {
    width: 22px;
    height: 22px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.bey-slot-player {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.bey-parts {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bey-part {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    min-width: 0;
}

.bey-part-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
    background: rgba(255,255,255,0.04);
}

.bey-part-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    width: 40px;
    flex-shrink: 0;
}

.bey-part-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.bey-nickname {
    font-size: 0.75rem;
    color: var(--iron-gold);
    font-weight: 600;
    text-align: center;
    margin-top: 4px;
}

.match-builder-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr 1fr auto;
    gap: 6px;
    align-items: center;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 10px;
}

/* =============================================================================
   LINEUP SUBMISSION (Schieramento)
   ============================================================================= */

.lineup-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.lineup-section-header {
    padding: 20px 24px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lineup-section-body {
    padding: 24px;
}

.player-slot-row {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.player-slot-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.player-slot-num {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
}

/* =============================================================================
   REFEREE LIVE PANEL
   ============================================================================= */

.live-scoreboard {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    border: 1px solid rgba(0, 122, 255, 0.3);
    box-shadow: var(--shadow-accent), var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.live-scoreboard::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0,122,255,0.05) 0%, transparent 60%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,59,48,0.2);
    color: var(--iron-red);
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 24px;
}

.live-dot {
    width: 7px;
    height: 7px;
    background: currentColor;
    border-radius: 50%;
    animation: live-pulse 1s infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.6); }
}

.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    margin: 20px 0;
    position: relative;
    z-index: 1;
}

.score-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.score-team .team-emoji {
    --ib-team-logo-size: 70px;
    border-radius: 18px;
    font-size: 1.3rem;
}
.score-team .team-name { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); }
.score-team .score-number {
    font-family: 'Outfit', sans-serif;
    font-size: 5rem;
    font-weight: 900;
    line-height: 1;
    color: white;
    text-shadow: 0 0 30px rgba(255,255,255,0.2);
}
.score-team .score-number.winning { color: var(--iron-gold); text-shadow: 0 0 30px rgba(245,197,24,0.4); }

.score-vs {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.score-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.progress-bar-container {
    flex: 1;
    max-width: 120px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Finish type buttons */
.finish-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 24px;
}

.finish-btn {
    padding: 16px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    position: relative;
    overflow: hidden;
}

.finish-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: 0.2s;
}
.finish-btn:hover::after { background: rgba(255,255,255,0.06); }
.finish-btn:active { transform: scale(0.97); }

.finish-btn .finish-points {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
}
.finish-btn .finish-label { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.finish-btn .finish-desc { font-size: 0.7rem; opacity: 0.7; }

.finish-btn.survival { background: rgba(52, 199, 89, 0.12); border-color: rgba(52, 199, 89, 0.4); color: var(--survival); }
.finish-btn.ko { background: rgba(255, 159, 10, 0.12); border-color: rgba(255, 159, 10, 0.4); color: var(--ko); }
.finish-btn.burst { background: rgba(0, 122, 255, 0.12); border-color: rgba(0, 122, 255, 0.4); color: var(--burst); }
.finish-btn.extreme { background: rgba(255, 59, 48, 0.12); border-color: rgba(255, 59, 48, 0.4); color: var(--extreme); }

.finish-btn:hover.survival { border-color: var(--survival); box-shadow: 0 0 20px rgba(52,199,89,0.25); }
.finish-btn:hover.ko { border-color: var(--ko); box-shadow: 0 0 20px rgba(255,159,10,0.25); }
.finish-btn:hover.burst { border-color: var(--burst); box-shadow: 0 0 20px rgba(0,122,255,0.25); }
.finish-btn:hover.extreme { border-color: var(--extreme); box-shadow: 0 0 20px rgba(255,59,48,0.25); }

/* =============================================================================
   STATISTICS 
   ============================================================================= */

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-change {
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
}

.stat-change.up { color: var(--iron-green); }
.stat-change.down { color: var(--iron-red); }

/* Radar / breakdown chart */
.finish-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.breakdown-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.breakdown-label {
    font-size: 0.78rem;
    font-weight: 600;
    width: 70px;
    flex-shrink: 0;
}

.breakdown-bar-bg {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
}

.breakdown-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.breakdown-bar.survival { background: var(--survival); }
.breakdown-bar.ko { background: var(--ko); }
.breakdown-bar.burst { background: var(--burst); }
.breakdown-bar.extreme { background: var(--extreme); }

.breakdown-value {
    font-size: 0.78rem;
    font-weight: 700;
    width: 30px;
    text-align: right;
    flex-shrink: 0;
}

/* Leaderboard table */
.ib-table {
    width: 100%;
    border-collapse: collapse;
}

.ib-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.ib-table td {
    padding: 12px 14px;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.ib-table tr:last-child td { border-bottom: none; }
.ib-table tr:hover td { background: rgba(255,255,255,0.03); }

.rank-number {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.rank-1 .rank-number { color: var(--iron-gold); }
.rank-2 .rank-number { color: #c0c0c0; }
.rank-3 .rank-number { color: #cd7f32; }

/* =============================================================================
   FORMS
   ============================================================================= */

.ib-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.ib-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ib-label .required { color: var(--iron-red); }

.ib-input, .ib-select, .ib-textarea {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    color-scheme: dark;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    outline: none;
    width: 100%;
}

.ib-input:focus, .ib-select:focus, .ib-textarea:focus {
    border-color: var(--accent);
    background: rgba(0, 122, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.ib-select { cursor: pointer; }
.ib-textarea { resize: vertical; min-height: 80px; }

.ib-input::placeholder,
.ib-textarea::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

/* Dropdown readability fix: evita testo chiaro su sfondo chiaro nel menu native */
.ib-select option,
.ib-select optgroup {
    background: #1b1f27;
    color: #f4f6fb;
}

.ib-select option:disabled {
    color: #9aa3b2;
}

.ib-input:disabled,
.ib-select:disabled,
.ib-textarea:disabled {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.03);
    cursor: not-allowed;
}

/* Mantiene leggibili i campi anche con autofill browser */
.ib-input:-webkit-autofill,
.ib-input:-webkit-autofill:hover,
.ib-input:-webkit-autofill:focus,
.ib-textarea:-webkit-autofill,
.ib-textarea:-webkit-autofill:hover,
.ib-textarea:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary);
    -webkit-box-shadow: 0 0 0 1000px #1b1f27 inset;
    transition: background-color 9999s ease-out 0s;
}

.ib-input.error, .ib-select.error { border-color: var(--iron-red); }

.ib-hint { font-size: 0.75rem; color: var(--text-muted); }
.ib-error { font-size: 0.75rem; color: var(--iron-red); }

.member-input-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.member-input-wrap .ib-input {
    width: 100%;
}

.member-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(24, 24, 24, 0.98);
    box-shadow: var(--shadow-md);
    z-index: 80;
}

.member-suggestion-item {
    width: 100%;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: transparent;
    color: var(--text-primary);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
}

.member-suggestion-item:last-child {
    border-bottom: 0;
}

.member-suggestion-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.member-suggestion-item .name {
    font-weight: 600;
}

.member-suggestion-item .hint {
    color: var(--text-muted);
    font-size: 0.74rem;
}

.member-suggestion-empty {
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 10px 12px;
}

.member-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.member-role-select {
    width: 130px;
    flex: 0 0 130px;
}

.member-row .btn-ib {
    flex-shrink: 0;
}

/* =============================================================================
   TOASTS / NOTIFICATIONS
   ============================================================================= */

.ib-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
    pointer-events: none;
}

.ib-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(30, 30, 30, 0.96);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(20px);
    max-width: 320px;
    animation: toast-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    pointer-events: auto;
    font-size: 0.85rem;
}

.ib-toast.success { border-left: 3px solid var(--iron-green); }
.ib-toast.error { border-left: 3px solid var(--iron-red); }
.ib-toast.warning { border-left: 3px solid var(--iron-gold); }
.ib-toast.info { border-left: 3px solid var(--accent); }

.ib-toast.fade-out {
    animation: toast-out 0.2s ease forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(8px); }
}

/* =============================================================================
   MODAL
   ============================================================================= */

.ib-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}

.ib-modal {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.ib-modal--wide { max-width: 900px; }

.ib-modal-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ib-modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
}

.ib-modal-close {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.06);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.ib-modal-close:hover { background: rgba(255,255,255,0.12); color: white; }

.ib-modal-body {
    padding: 24px;
}

.ib-modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* =============================================================================
   TIMELINE / SCORE LOG
   ============================================================================= */

.score-log {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.score-event {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 0.83rem;
    animation: event-slide 0.3s ease;
}

@keyframes event-slide {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.finish-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}

.finish-icon.survival { background: rgba(52, 199, 89, 0.15); color: var(--survival); }
.finish-icon.ko { background: rgba(255, 159, 10, 0.15); color: var(--ko); }
.finish-icon.burst { background: rgba(0, 122, 255, 0.15); color: var(--burst); }
.finish-icon.extreme { background: rgba(255, 59, 48, 0.15); color: var(--extreme); }

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
    body.ib-menu-open { overflow: hidden; }

    body::before {
        top: -180px;
        width: 900px;
        height: 440px;
    }

    body::after {
        top: 130px;
        width: 96vw;
        height: 320px;
        opacity: 0.1;
    }

    .ib-nav {
        height: auto;
        min-height: 64px;
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .ib-nav-brand {
        order: 1;
        flex: 1 1 auto;
        min-width: 0;
        max-width: 52vw;
    }

    .ib-nav-brand > div:last-child {
        min-width: 0;
    }

    .ib-nav-brand .brand-name {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .ib-nav-actions {
        order: 2;
        margin-left: auto;
        min-width: 0;
        max-width: 46vw;
    }

    .ib-nav-menu-btn {
        order: 3;
        display: inline-flex;
        flex-shrink: 0;
    }

    .ib-user-badge {
        max-width: min(46vw, 220px);
    }

    .ib-user-badge > span:first-of-type {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Fallback no-JS: link visibili e scrollabili orizzontalmente */
    .ib-nav-links {
        order: 4;
        flex: 1 0 100%;
        display: flex;
        gap: 8px;
        margin-top: 2px;
        padding: 4px 0 2px;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        scrollbar-width: none;
        -ms-overflow-style: none;
        width: 100%;
    }
    .ib-nav-links::-webkit-scrollbar { display: none; }
    .ib-nav-links li { flex: 0 0 auto; }
    .ib-nav-links a {
        width: auto;
        justify-content: flex-start;
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .ib-hero { padding: 40px 16px; }
    .ib-hero .ib-hero-brand {
        font-size: 2rem;
        margin-bottom: 8px;
    }
    .ib-hero .ib-hero-lead {
        font-size: 1.02rem;
        line-height: 1.46;
        margin-bottom: 24px;
    }
    .ib-container { padding: 0 14px; }
    .ib-section { padding: 30px 0; }
    .ib-card { padding: 16px; }
    .ib-card { min-width: 0; }
    .ib-section-header { margin-bottom: 20px; }
    .ib-section-title { font-size: 1.45rem; line-height: 1.15; }
    .ib-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .ib-section-header > * {
        min-width: 0;
        width: 100%;
    }
    .ib-section-header .btn-ib {
        width: 100%;
        justify-content: center;
    }
    .ib-select, .ib-input, .ib-textarea {
        width: 100% !important;
        max-width: 100% !important;
    }
    .ib-grid-2, .ib-grid-3, .ib-grid-4 { grid-template-columns: 1fr; }
    .ib-grid-auto { grid-template-columns: minmax(0, 1fr); }
    .ib-grid-2 > *,
    .ib-grid-3 > *,
    .ib-grid-4 > * {
        min-width: 0;
    }
    .ib-tabs-scroll {
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }
    .ib-tabs-scroll .btn-ib {
        flex: 0 0 auto;
    }

    .lineup-section-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 14px 16px;
    }
    .lineup-section-body { padding: 16px; }
    .beyblade-builder-9slot { grid-template-columns: 1fr; }
    .bey-builds-grid { grid-template-columns: 1fr; gap: 8px; }
    .bey-slot { min-height: 0; }

    .match-vs {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px;
    }
    .match-team .emoji {
        --ib-team-logo-size: 34px;
        border-radius: 9px;
        font-size: 0.78rem;
    }
    .match-team .name {
        font-size: 0.83rem;
        word-break: break-word;
    }
    .match-team .score { font-size: 1.7rem; }
    .match-divider .divider-line { height: 20px; }

    .score-display { gap: 12px; }
    .score-team .team-emoji {
        --ib-team-logo-size: 54px;
        border-radius: 14px;
        font-size: 1.02rem;
    }
    .score-team .score-number { font-size: 2.9rem; }
    .finish-type-grid { grid-template-columns: 1fr; gap: 8px; }
    .live-scoreboard { padding: 20px 14px; }

    .ib-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .ib-table th,
    .ib-table td {
        padding: 10px;
    }

    .ib-modal-overlay { padding: 10px; }
    .ib-modal { border-radius: var(--radius-md); max-height: 92vh; }
    .ib-modal-header,
    .ib-modal-body,
    .ib-modal-footer { padding-left: 16px; padding-right: 16px; }
    .ib-modal-header { padding-top: 16px; }
    .ib-modal-body { padding-top: 16px; }
    .ib-modal-footer {
        padding-bottom: 16px;
        flex-wrap: wrap;
    }
    .ib-modal-footer .btn-ib { flex: 1 1 100%; }

    .match-builder-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .match-builder-row .match-builder-vs {
        display: none;
    }
    .match-builder-row .match-builder-remove {
        justify-self: end;
    }

    .member-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .member-role-select {
        width: 100%;
        flex: 1 1 auto;
    }

    .member-row .btn-ib {
        align-self: flex-end;
    }

    .ib-toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
    .ib-toast {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .ib-nav {
        padding: 8px 10px;
        gap: 8px 10px;
    }

    .ib-nav-brand .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .ib-nav-brand .brand-name { font-size: 1.05rem; }
    .ib-nav-brand .brand-sub {
        display: none;
    }

    .ib-site-switcher-caret {
        font-size: 0.72rem;
    }

    .ib-user-badge {
        padding: 5px 8px;
        gap: 6px;
        font-size: 0.75rem;
        max-width: min(48vw, 180px);
    }

    .ib-user-avatar {
        --ib-avatar-size: 22px;
        font-size: 10px;
    }

    .ib-role-badge {
        font-size: 0.58rem;
        padding: 1px 5px;
    }

    .ib-nav-links a {
        font-size: 0.8rem;
        padding: 9px 10px;
    }

    .ib-section-title { font-size: 1.3rem; }
    .ib-card { padding: 14px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .score-display {
        gap: 18px;
    }

    .score-team .score-number {
        font-size: 3.8rem;
    }
}

/* =============================================================================
   LOADING STATES
   ============================================================================= */

.ib-skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 100%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.ib-empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.ib-empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.ib-empty-state h3 { font-family: 'Outfit', sans-serif; font-size: 1.2rem; margin-bottom: 8px; color: var(--text-secondary); }
.ib-empty-state p { font-size: 0.85rem; line-height: 1.6; }

/* =============================================================================
   PAGE-SPECIFIC: LINEUP BUILDER
   ============================================================================= */

.beyblade-builder-9slot {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.builder-slot {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 12px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    min-width: 0;
}

.builder-slot:hover { border-color: var(--accent); background: var(--accent-light); }
.builder-slot.active { border-color: var(--accent); border-style: solid; background: rgba(0,122,255,0.06); }
.builder-slot.has-error { border-color: var(--iron-red); background: rgba(255,59,48,0.04); }

.builder-slot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.builder-player-tag {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    padding: 2px 8px;
    border-radius: 4px;
}

.builder-bey-preview {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.builder-part-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    min-width: 0;
}

.builder-part-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    background: rgba(255,255,255,0.04);
    border-radius: 4px;
    padding: 2px;
}

.builder-part-type {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 35px;
    flex-shrink: 0;
}

.builder-part-name {
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Builder responsiveness
   Keep this block after the base builder styles, so it is not overridden later. */
@media (max-width: 1180px) {
    .beyblade-builder-9slot {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .beyblade-builder-9slot {
        grid-template-columns: 1fr;
    }
}

.duplicate-warning {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--iron-red);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Admin section separator */
.admin-only-section {
    border: 1px solid rgba(255,59,48,0.2);
    background: rgba(255,59,48,0.03);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 12px;
}

.admin-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--iron-red);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}
