/* ==========================================================================
    Elite Championship Arena - CompetitionModal Styles
    ========================================================================== */

/* Competition Modal Container - Premium Foundation */
.modal.competition-modal {
    position: relative !important;       /* no fixed/fullscreen */
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;         /* no internal scroll bar */
    align-self: flex-start !important;    /* place at top of container */
    margin-top: calc(var(--header-height, 50px) + 16px) !important;  /* below header */

    /* keep overlay visually transparent */
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
}

.modal.competition-modal.modal-fullscreen {
    position: relative !important;
    inset: auto !important;               /* reset top/left/right/bottom */
    width: auto !important;
    height: auto !important;
    align-self: flex-start !important;
    margin-top: calc(var(--header-height, 50px) + 16px) !important;
    padding-top: 0 !important;
}
.modal.competition-modal .modal-content {
    display: inline-block;                /* shrink-wrap to content */
    width: auto;                          /* no forced width */
    max-width: min(90vw, 650px);          /* sensible cap */
 
    background: var(--color-grey-300) !important;
    border: 3px solid var(--color-primary-800) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2) !important;
    border-radius: 12px !important;
    overflow-y: auto;                     /* vertical scroll on the visible panel */
    overflow-x: hidden;
    max-height: calc(100vh - var(--header-height, 50px) - 48px);  /* header + 16px top gap + 16px bottom gap + close button space */
    -webkit-overflow-scrolling: touch;    /* smooth iOS scroll */
    padding: 0.75rem;
    margin: 0 auto 16px;                  /* center horizontally */
    box-sizing: border-box;
}

.modal.competition-modal .responsive-modal {
    width: auto !important;
    max-width: none !important;
}

.modal.competition-modal .modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
        rgba(212, 175, 55, 0.03) 0%,
        rgba(212, 175, 55, 0.01) 50%,
        rgba(114, 47, 55, 0.02) 100%);
    pointer-events: none;
}

/* Modal Header - Championship Branding */
.modal-header {
    background: var(--color-primary-800) !important;
    padding: 1rem 1.5rem 0.75rem !important;
    text-align: center !important;
    position: relative !important;
    border-bottom: 2px solid var(--color-secondary-300) !important;
    box-shadow: none;
    border-radius: 8px 8px 0 0;
    margin: -1rem -2.5rem 1rem -2.5rem;
}

.modal-header::before {
    position: absolute;
    top: 0.75rem;
    left: 1rem;
    font-size: 1.2rem;
    color: var(--color-secondary-300);
    opacity: 0.9;
}

.modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: var(--color-secondary-300);
}

.modal-header h1,
.modal-header h2 {
    font-family: var(--font-family) !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: var(--color-secondary-200) !important;
    margin: 0 !important;
    letter-spacing: 0.5px !important;
    text-shadow: none !important;
}

.modal-header p {
    font-family: var(--font-family);
    font-size: 1.1rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    margin: 0.25rem 0 0 0;
}

/* Competition Type Sections */
.competition-types {
    padding: 0rem 1rem;
}
.competition-type-section {
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-grey-300);
    background: var(--color-white);
    transition: box-shadow 0.2s ease;
}

.competition-type-section:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
}

.section-header h3 {
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.section-header p {
    margin: 0 0 0 auto;
    padding: 0;
    color: var(--color-grey-700);
    font-size: 0.9rem;
    text-align: right;
}

/* Trial Section */
.competition-type-section.trial-section {
    border-left: 4px solid var(--color-primary-800);
}

.competition-type-section.trial-section::before {
    content: '🎯';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1.2rem;
    color: var(--color-primary-800);
    opacity: 0.8;
}

/* Official Section */
.competition-type-section.official-section {
    border-left: 4px solid var(--color-secondary-300);
}

.competition-type-section.official-section::before {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1.2rem;
    color: var(--color-secondary-300);
    opacity: 0.9;
}

.competition-type-section h3 {
    font-family: var(--font-family);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-grey-900);
    margin: 0 0 0.25rem 0;
    padding: .5rem .5rem 0rem .5rem;
}

.competition-type-section p {
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--color-grey-700);
    margin: 0;
    line-height: 1.5;
    padding-left: .5rem;
}

/* Section Content Styling */
.competition-type-section .section-content {
    padding: 0.75rem;
    position: relative;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal.competition-modal .modal-content {
        width: 95vw;
        margin: 1rem;
        border-radius: 16px;
        max-height: calc(100vh - var(--header-height, 50px) - 32px);
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-header h1,
    .modal-header h2 {
        font-size: 1.5rem;
    }

    .modal-header p {
        font-size: 0.9rem;
    }

    .competition-type-section .section-content {
        padding: 1rem;
    }

    .competition-type-section h3 {
        font-size: 1.25rem;
    }

    .level-card {
        padding: 0.375rem 0.625rem;
        min-height: 2.5rem;
    }

    .level-badge {
        font-size: 0.65rem;
        padding: 0.125rem 0.375rem;
    }

    .difficulty-stars {
        font-size: 0.7rem;
    }

    .level-type {
        font-size: 0.65rem;
    }

    .level-points {
        font-size: 0.75rem;
    }

    .level-status {
        font-size: 0.65rem;
        padding: 0.25rem 0.625rem;
        min-width: 70px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 0.5rem 0.5rem 0 0.5rem;
    }

    .section-description {
        margin-left: 0;
        text-align: left;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .modal.competition-modal .modal-content {
        width: 100vw;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    .modal-header {
        padding: 0.75rem;
    }

    .modal-header h1,
    .modal-header h2 {
        font-size: 1.25rem;
        letter-spacing: 0.5px;
    }

    .competition-type-section {
        margin: 0.75rem 0;
    }

    .competition-type-section .section-content {
        padding: 0.75rem;
    }

    .level-card {
        padding: 0.25rem 0.5rem;
        min-height: 2rem;
    }

    .level-badge {
        font-size: 0.6rem;
        padding: 0.125rem 0.25rem;
    }

    .difficulty-stars {
        font-size: 0.65rem;
    }

    .level-type {
        font-size: 0.6rem;
    }

    .level-points {
        font-size: 0.7rem;
    }

    .level-status {
        font-size: 0.6rem;
        padding: 0.25rem 0.5rem;
        min-width: 60px;
    }
}

/* ==========================================================================
   Premium Level Cards - Elite Championship Arena
   ========================================================================== */

/* Premium level colors for difficulty levels */
/* Note: Metallic gradients removed for cleaner design */

.level-grid {
    margin: 0 auto;
    max-width: 600px;
    width: 95%;
}

/* Base Level Card Styling - 3-Column Grid Layout */
.level-card {
    position: relative;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--color-grey-300);
    background: var(--color-primary-800) !important;
    overflow: hidden !important;
    animation: fadeIn 0.6s ease-out;
    min-height: 2rem;
}

/* Level Card Column Styles */
.level-left {
    /* Name column - left aligned */
    text-align: left;
    padding-right: 0.25rem;
}

.level-center {
    /* Eligibility/Requirements column - center, stacked */
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
    padding: 0 0.25rem;
}

.level-right {
    /* Entry Fee/Button column - right aligned, stacked */
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-end;
    padding-left: 0.25rem;
}

/* Level Card Content Container - Grid Layout for Columns */
.level-card-content {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 0.5rem;
    align-items: center;
}

/* Mobile responsive - stack columns vertically */
@media (max-width: 768px) {
    .level-card {
        padding: 0.5rem;
    }

    .level-card-content {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .level-left,
    .level-center,
    .level-right {
        text-align: center;
        padding: 0;
    }

    .level-right {
        align-items: center;
    }
}

.modal-content .level-name {
    color: var(--color-grey-100);
    margin: 0rem;
}

/* Staggered Reveal Animation */
.level-card:nth-child(1) { animation-delay: 0.1s; }
.level-card:nth-child(2) { animation-delay: 0.2s; }
.level-card:nth-child(3) { animation-delay: 0.3s; }
.level-card:nth-child(4) { animation-delay: 0.4s; }
.level-card:nth-child(5) { animation-delay: 0.5s; }
.level-card:nth-child(6) { animation-delay: 0.6s; }
.level-card:nth-child(7) { animation-delay: 0.7s; }
.level-card:nth-child(8) { animation-delay: 0.8s; }

.level-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(0, 0, 0, 0.05) 75%,
        rgba(0, 0, 0, 0.31) 100%);
    pointer-events: none;
    z-index: 1;
}

.level-card > * {
    position: relative;
    z-index: 2;
}

/* Level Card Variants - Difficulty-Based Premium Materials */
.level-card.bronze-level {
    border-left: 3px solid #B87333 !important;
}

.level-card.silver-level {
    border-left: 3px solid #C0C0C0 !important;
}

.level-card.gold-level {
    border-left: 3px solid var(--color-secondary-300) !important;
}

.level-card.platinum-level {
    border-left: 3px solid #E5E4E2 !important;
}

/* Level Header - Premium Badge and Stars - Now inline */
.level-badge {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    padding: 0.125rem 0.25rem;
    border-radius: 8px;
    font-size: 0.6rem;
    font-weight: 600;
    background: var(--color-grey-100);
    margin-right: 0.5rem;
}

.level-badge::before {
    content: '';
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
}

.level-badge.bronze-badge {
    color: #CD7F32;
}

.level-badge.silver-badge {
    color: #C0C0C0;
}

.level-badge.gold-badge {
    color: var(--color-secondary-300);
}

.level-badge.platinum-badge {
    color: #E5E4E2;
}

.difficulty-stars {
    display: flex;
    gap: 0.125rem;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    margin-right: 0.5rem;
}

.difficulty-stars.star-1::before { content: "⭐☆☆☆☆"; }
.difficulty-stars.star-2::before { content: "⭐⭐☆☆☆"; }
.difficulty-stars.star-3::before { content: "⭐⭐⭐☆☆"; }
.difficulty-stars.star-4::before { content: "⭐⭐⭐⭐☆"; }
.difficulty-stars.star-5::before { content: "⭐⭐⭐⭐⭐"; }

/* Level Meta - Competition Type and Points - Now inline */
.level-type {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--color-grey-700);
    margin-right: 0.5rem;
}

.level-type::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
}

.level-type.trial { color: var(--color-primary-800); }
.level-type.official { color: var(--color-secondary-300); }

.level-points {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--color-secondary-300);
}

.level-points::before {
    content: '🏆';
    font-size: 0.7rem;
}

/* Level Status - Availability Indicators - Center column, stacked */
.level-status {
    display: block;
    text-align: center;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--color-grey-100);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    min-width: 60px;
    margin: 0 auto;
}

/* Entry Fee Display - Small font in right column */
.entry-fee {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-secondary-200);
    text-align: center;
}

/* Enter Competition Button - Premium styling in right column */
.level-enter-btn {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: var(--color-secondary-200) !important;
    color: var(--color-primary-800);
    box-shadow: 0 1px 4px rgba(212, 175, 55, 0.3);
    min-width: 60px;
    text-align: center;
}

.level-enter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
    background: var(--color-secondary-300) !important;
}

.level-enter-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.5), 0 2px 8px rgba(212, 175, 55, 0.3);
}

.level-enter-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(212, 175, 55, 0.2);
}

/* Mobile adjustments for entry fee and button */
@media (max-width: 768px) {
    .entry-fee {
        font-size: 0.7rem;
        margin-bottom: 0.25rem;
    }

    .level-enter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
        width: 100%;
        max-width: 120px;
    }
}

@media (max-width: 480px) {
    .entry-fee {
        font-size: 0.65rem;
    }

    .level-enter-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.7rem;
    }
}

.level-status.available {
    background: rgba(72, 187, 120, 0.2);
    color: #48BB78;
    border: 1px solid rgba(72, 187, 120, 0.4);
}

.level-status.locked {
    background: rgba(160, 174, 192, 0.2);
    color: #A0AEC0;
    border: 1px solid rgba(160, 174, 192, 0.4);
}

.level-status.ineligible {
    background: rgba(229, 62, 62, 0.2);
    color: #E53E3E;
    border: 1px solid rgba(229, 62, 62, 0.4);
}

/* Level Preview and Requirements */
.level-preview {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.level-requirements-summary {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
    margin: 0;
}

/* Enhanced Interactive States */
.level-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--color-primary-800);
}

.level-card:hover .difficulty-stars {
    color: var(--color-primary-800);
}

.level-card.selected {
    border-color: var(--color-secondary-300) !important;
    box-shadow: 0 0 0 2px var(--color-secondary-300), 0 2px 8px rgba(212, 175, 55, 0.2);
    animation: pulse-gold 2s infinite;
}

/* Removed unused border-expand animation */

/* Gold Loading Spinner */
@keyframes spin-gold {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    border-top-color: #D4AF37;
    border-right-color: #FFD700;
    animation: spin-gold 1s ease-in-out infinite;
    margin-right: 8px;
}

/* Double Ring Gold Spinner */
.loading-spinner-double {
    position: relative;
    width: 24px;
    height: 24px;
    margin-right: 8px;
}

.loading-spinner-double::before,
.loading-spinner-double::after {
    content: '';
    position: absolute;
    border: 2px solid transparent;
    border-radius: 50%;
}

.loading-spinner-double::before {
    width: 24px;
    height: 24px;
    border-top: 2px solid #D4AF37;
    border-right: 2px solid rgba(212, 175, 55, 0.5);
    animation: spin-gold 1.5s linear infinite;
}

.loading-spinner-double::after {
    width: 16px;
    height: 16px;
    top: 4px;
    left: 4px;
    border-top: 2px solid #FFD700;
    border-right: 2px solid rgba(255, 215, 0, 0.5);
    animation: spin-gold 1s linear infinite reverse;
}

/* Fade-in Animation for Dynamic Content */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Premium Competition Buttons */
.competition-enter-btn,
.competition-cancel-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-shadow: none;
}

.competition-enter-btn {
    background: var(--color-primary-800) !important;
    color: var(--color-white);
    box-shadow: 0 2px 8px rgba(14, 116, 90, 0.3);
}

.competition-enter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 116, 90, 0.4);
    background: var(--color-primary-hover) !important;
}

.competition-enter-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(14, 116, 90, 0.2);
}

.competition-cancel-btn {
    background: var(--color-grey-200) !important;
    color: var(--color-grey-700);
    border: 1px solid var(--color-grey-300);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.competition-cancel-btn:hover {
    transform: translateY(-1px);
    background: var(--color-grey-300) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.competition-cancel-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Button Focus State */
.competition-enter-btn:focus,
.competition-cancel-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 116, 90, 0.5), 0 2px 8px rgba(14, 116, 90, 0.3);
}

/* Button Disabled State */
.competition-enter-btn:disabled,
.competition-cancel-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: var(--color-grey-200) !important;
    color: var(--color-grey-500);
}

.competition-enter-btn:disabled:hover,
.competition-cancel-btn:disabled:hover {
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Button Loading State */
.competition-enter-btn.loading,
.competition-cancel-btn.loading {
    cursor: not-allowed;
    position: relative;
}

.competition-enter-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #FFFFFF;
    animation: spin-gold 1s linear infinite;
}

.competition-cancel-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    border-top-color: #D4AF37;
    animation: spin-gold 1s linear infinite;
}

.level-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.level-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.6);
    z-index: 3;
}

.level-card.ineligible {
    background: rgba(114, 47, 55, 0.3) !important;
    border-color: var(--color-primary-700) !important;
    cursor: not-allowed;
}

.level-card.ineligible .level-status {
    background: rgba(229, 62, 62, 0.2);
    color: #E53E3E;
}

/* Premium material effects removed for cleaner design */

/* Animations */
@keyframes pulse-gold {
    0%, 100% {
        box-shadow:
            0 0 0 2px var(--color-secondary-300),
            0 4px 16px rgba(212, 175, 55, 0.3);
    }
    50% {
        box-shadow:
            0 0 0 4px var(--color-secondary-300),
            0 6px 20px rgba(212, 175, 55, 0.4);
    }
}

@keyframes selection-feedback {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 102, 204, 0.7);
    }
    25% {
        transform: scale(1.05);
        box-shadow: 0 0 0 5px rgba(0, 102, 204, 0);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(0, 102, 204, 0);
    }
    75% {
        transform: scale(1.05);
        box-shadow: 0 0 0 5px rgba(0, 102, 204, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 102, 204, 0);
    }
}

.level-card.selecting {
    animation: selection-feedback 0.6s ease-out;
}

/* Exit Animation */
@keyframes modalFadeOutOpacity {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.modal.competition-modal.exiting {
    animation: modalFadeOutOpacity 0.2s ease-in forwards;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .level-card,
    .competition-type-section,
    .modal-header::before,
    .modal.competition-modal.entering,
    .level-card.selected,
    .level-card.selecting,
    .modal.competition-modal.exiting,
    .fade-in,
    .competition-enter-btn::before,
    .competition-enter-btn:hover::before,
    .loading-spinner,
    .loading-spinner-double::before,
    .loading-spinner-double::after,
    .competition-enter-btn.loading::after,
    .competition-cancel-btn.loading::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        transition-duration: 0.01ms !important;
    }

    .level-card,
    .competition-type-section,
    .competition-enter-btn,
    .competition-cancel-btn {
        transition: none !important;
    }
}

/* Shimmer animations removed for cleaner design */

/* Modal Entry Animation */
@keyframes modalFadeInOpacity {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.modal.competition-modal.entering {
    animation: modalFadeInOpacity 0.2s ease-out;
}

/* ==========================================================================
    MOBILE OPTIMIZATION & ACCESSIBILITY ENHANCEMENTS
    ========================================================================== */

/* Enhanced Touch-Friendly Design - Minimum 44px Touch Targets */
.competition-enter-btn,
.competition-cancel-btn {
    min-height: 44px;
    min-width: 44px;
    padding: .5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(16px, 2.5vw, 1rem);
}

/* Premium Competition Buttons - Mobile Optimized */
@media (max-width: 768px) {
    .competition-enter-btn,
    .competition-cancel-btn {
        width: 100%;
        padding: 1.5rem 3rem;
        font-size: 1.1rem;
        margin: 1rem 0;
        min-height: 48px;
    }
}

/* Level Cards - Touch-Friendly Spacing */
.level-card {
    min-height: 44px;
    position: relative;
}

.level-card > * {
    position: relative;
    z-index: 2;
}

/* Enhanced Touch Feedback */
@media (hover: none) and (pointer: coarse) {
    .level-card:active {
        transform: scale(0.98);
        background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.15) 0%,
            rgba(255, 255, 255, 0.08) 50%,
            rgba(0, 0, 0, 0.08) 100%);
    }
}

/* Enhanced Typography for Mobile */
@media (max-width: 768px) {
    .modal-header h1,
    .modal-header h2 {
        font-size: clamp(20px, 5vw, 2.5rem);
        letter-spacing: 1px;
    }

    .modal-header p {
        font-size: clamp(16px, 4vw, 1.25rem);
        line-height: 1.5;
    }

    .level-card {
        padding: clamp(1rem, 3vw, 1.5rem);
        margin-bottom: clamp(1rem, 3vw, 1.5rem);
    }

    .competition-type-section h3 {
        font-size: clamp(20px, 4vw, 1.75rem);
    }

    .competition-type-section p {
        font-size: clamp(14px, 3.5vw, 1rem);
        line-height: 1.6;
    }
}

/* Responsive Breakpoints - Enhanced */
@media (max-width: 767px) {
    /* Mobile: <768px */
    .modal.competition-modal .modal-content {
        max-width: 95vw;
        padding: 1.5rem;
        border-radius: 16px;
    }

    .modal-header {
        padding: 2rem 1.5rem;
    }

    .competition-type-section .section-content {
        padding: 1.5rem;
    }

    .level-meta {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        text-align: center;
    }

    .level-status {
        width: 100%;
        justify-content: center;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    /* Tablet: 768px-1023px */
    .modal.competition-modal .modal-content {
        max-width: 90vw;
        padding: 2rem;
    }

    .modal-header {
        padding: 2.5rem;
    }

    .competition-type-section .section-content {
        padding: 2rem;
    }
}

@media (min-width: 1024px) {
    /* Desktop: >1024px */
    .modal.competition-modal .modal-content {
        max-width: 900px;
        padding: .5rem 2.5rem;
    }

    .modal-header {
        padding: 3rem 2.5rem;
    }

    .competition-type-section .section-content {
        padding: 2.5rem;
    }

    /* Enhanced hover effects for desktop */
    .competition-enter-btn:hover,
    .competition-cancel-btn:hover {
        transform: translateY(-3px) scale(1.02);
    }
}

/* ==========================================================================
    ACCESSIBILITY FEATURES - WCAG 2.1 AA COMPLIANCE
    ========================================================================== */

/* Focus Management - Gold Outline for Keyboard Navigation */
.competition-enter-btn:focus,
.competition-cancel-btn:focus,
.level-card:focus,
.competition-type-section:focus,
.modal-header:focus {
    outline: 3px solid #D4AF37;
    outline-offset: 2px;
    box-shadow:
        0 0 0 6px rgba(212, 175, 55, 0.2),
        0 0 20px rgba(212, 175, 55, 0.3);
}

/* Enhanced Focus for Screen Readers */
@media (prefers-reduced-motion: reduce) {
    .competition-enter-btn:focus,
    .competition-cancel-btn:focus {
        outline: 4px solid #D4AF37;
        outline-offset: 3px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .modal.competition-modal .modal-content {
        border: 4px solid #D4AF37;
        background: #000000;
    }

    .modal-header {
        background: #FFFFFF;
        color: #000000;
        border: 2px solid #D4AF37;
    }

    .modal-header h1,
    .modal-header h2,
    .modal-header p {
        color: #000000;
        font-weight: 700;
    }

    .level-card {
        border: 3px solid #FFFFFF;
        background: #000000;
        color: #FFFFFF;
    }

    .level-card.gold-level,
    .level-card.silver-level,
    .level-card.bronze-level,
    .level-card.platinum-level {
        background: #000000;
        border-color: #FFFFFF;
    }

    .competition-enter-btn {
        background: #FFFFFF;
        color: #000000;
        border: 3px solid #D4AF37;
    }

    .competition-cancel-btn {
        background: #FFFFFF;
        color: #000000;
        border: 3px solid #D4AF37;
    }
}

/* Color Blindness Support - Multiple Visual Cues */
.level-status.available {
    background: rgba(72, 187, 120, 0.2);
    color: #48BB78;
    border: 2px solid #48BB78;
    position: relative;
}

.level-status.available::before {
    content: '✓';
    position: absolute;
    left: 0.5rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: #48BB78;
}

.level-status.locked {
    background: rgba(160, 174, 192, 0.2);
    color: #A0AEC0;
    border: 2px solid #A0AEC0;
    position: relative;
}

.level-status.locked::before {
    content: '🔒';
    position: absolute;
    left: 0.5rem;
    font-size: 1.2rem;
    color: #A0AEC0;
}

.level-status.ineligible {
    background: rgba(229, 62, 62, 0.2);
    color: #E53E3E;
    border: 2px solid #E53E3E;
    position: relative;
}

.level-status.ineligible::before {
    content: '✗';
    position: absolute;
    left: 0.5rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: #E53E3E;
}


/* Enhanced ARIA Support - Styles for accessible elements */
/* Note: HTML attributes are now properly set in JavaScript file */

.modal.competition-modal[role="dialog"] {
    /* ARIA attributes set in JavaScript */
}

.modal-header h1[id="competition-modal-title"],
.modal-header h2[id="competition-modal-title"] {
    /* ID attributes set in JavaScript */
}

.modal-header p[id="competition-modal-description"] {
    /* ID attributes set in JavaScript */
}

/* Level Cards - Enhanced Accessibility */
/* Note: ARIA attributes are now properly set in JavaScript file */

.level-card[role="button"] {
    cursor: pointer;
}

.level-card[aria-selected="true"] {
    /* Selection styling handled by JavaScript */
}

.level-card[aria-disabled="true"] {
    cursor: not-allowed;
}

/* Screen Reader Only Content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip Link for Keyboard Users */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #D4AF37;
    color: #1A1A1A;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    z-index: 10000;
    transition: top 0.3s;
}

.skip-to-content:focus {
    top: 6px;
}

/* ==========================================================================
    DARK MODE SUPPORT
    ========================================================================== */

@media (prefers-color-scheme: dark) {
    .modal.competition-modal .modal-content {
        background: linear-gradient(135deg,
            var(--color-rich-black) 0%,
            #2D1B1B 50%,
            #1A1A1A 100%);
    }

    .modal-header {
        background: linear-gradient(135deg,
            #2D2D2D 0%,
            #1A1A1A 50%,
            #2D2D2D 100%);
        color: #FFFFFF;
    }

    .modal-header h1,
    .modal-header h2,
    .modal-header p {
        color: #FFFFFF;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    }

    .competition-type-section.trial-section {
        background: linear-gradient(135deg,
            #4A4A4A 0%,
            #5A5A5A 50%,
            #4A4A4A 100%);
    }

    .competition-type-section.official-section {
        background: linear-gradient(135deg,
            #2D2D2D 0%,
            #3D3D2D 50%,
            #2D2D2D 100%);
    }

    .competition-type-section h3,
    .competition-type-section p {
        color: #FFFFFF;
    }

    .level-card {
        background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.05) 0%,
            rgba(255, 255, 255, 0.02) 50%,
            rgba(0, 0, 0, 0.1) 100%);
        color: #FFFFFF;
    }

    .level-badge {
        background: rgba(0, 0, 0, 0.6);
        color: #FFFFFF;
        border-color: rgba(255, 255, 255, 0.4);
    }

    .level-meta {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.2);
    }

    .level-points {
        color: #FFD700;
        text-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
    }
}

/* ==========================================================================
    PERFORMANCE OPTIMIZATIONS FOR MOBILE
    ========================================================================== */

/* GPU Acceleration for Smooth Animations */
.modal.competition-modal,
.level-card,
.competition-enter-btn,
.competition-cancel-btn,
.competition-type-section {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Optimized Animation Performance */
@media (max-width: 768px) {
    .level-card {
        will-change: transform, opacity;
    }

    .competition-enter-btn,
    .competition-cancel-btn {
        will-change: transform, box-shadow;
    }

    .modal.competition-modal.entering {
        animation-duration: 0.6s;
    }
}

/* Reduced Animation Complexity for Mobile */
@media (max-width: 480px) {
    .modal.competition-modal.entering {
        animation-duration: 0.4s;
    }

    .level-card:nth-child(n+4) {
        animation-delay: 0.1s;
    }

    .level-card:nth-child(n+7) {
        animation-delay: 0.05s;
    }
}

/* Touch Action Optimization */
.level-card,
.competition-enter-btn,
.competition-cancel-btn {
    touch-action: manipulation;
}

/* Enhanced Loading States for Mobile */
@media (max-width: 768px) {
    .loading-spinner {
        width: 24px;
        height: 24px;
    }

    .loading-spinner-double {
        width: 28px;
        height: 28px;
    }
}

/* Optimized Font Loading */
.modal-header h1,
.modal-header h2 {
    font-display: swap;
}

/* Content Visibility Optimization */
@media (max-width: 768px) {
    .level-card {
        contain: layout style paint;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .level-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .level-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .level-meta {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .difficulty-stars {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .level-card {
        padding: 0.75rem;
        border-radius: 16px;
    }

    .level-badge {
        padding: 0.25rem 0.75rem;
        font-size: 0.8rem;
    }

    .difficulty-stars {
        font-size: 0.9rem;
    }

    .level-points {
        font-size: 1rem;
    }
}