/* === Font Definitions === */
@font-face {
    font-family: 'ChelGeneral'; /* Name for your general font */
    src: url('fonts/winner-bold.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'ChelButton'; /* Name for your button font */
    src: url('fonts/Unbounded-Regular.ttf') format('truetype');
     font-weight: normal;
     font-style: normal;
}

/* === Keyframes Definitions === */
@keyframes floatCrown {
  0%, 100% { transform: translateY(0) translateX(-50%); } /* Keep translateX for centering */
  50% { transform: translateY(-8px) translateX(-50%); } /* Keep translateX for centering */
}

@keyframes flickerGlow {
  0%, 18%, 22%, 25%, 53%, 57%, 100% {
    text-shadow:
      0 0 4px rgba(234, 196, 53, 0.2),
      0 0 8px rgba(234, 196, 53, 0.2),
      0 0 12px rgba(234, 196, 53, 0.2);
    opacity: 0.9;
  }
  20%, 24%, 55% {
     text-shadow:
      0 0 5px rgba(234, 196, 53, 0.6),
      0 0 15px rgba(234, 196, 53, 0.4),
      0 0 25px rgba(234, 196, 53, 0.3);
    opacity: 1;
  }
}

@keyframes fadeInOut { /* For +1 Score Overlay */
  0% { opacity: 0; transform: scale(0.8); }
  20% { opacity: 1; transform: scale(1.1); }
  80% { opacity: 1; transform: scale(1.0); }
  100% { opacity: 0; transform: scale(0.8); }
}

@keyframes seriesWinFadeInOut { /* For Series Win Overlay */
  0% { opacity: 0; transform: scale(0.8) rotate(-5deg); }
  25% { opacity: 1; transform: scale(1.1) rotate(3deg); }
  75% { opacity: 1; transform: scale(1.0) rotate(0deg); }
  100% { opacity: 0; transform: scale(0.8) rotate(5deg); }
}

@keyframes confettiFlyUp { /* For Confetti */
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-85vh) translateX(var(--drift, 0px)) rotate(var(--end-rotation, 360deg));
    opacity: 0;
  }
}

/* === Basic Reset === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === Default Body Styles === */
body {
    background-color: #1E1E1E;
    background-image: url('img/bg.png'); /* Default background */
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #EAC435; /* Default text color */
    font-family: 'ChelGeneral', sans-serif; /* Default font */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 30px; /* Space below potential fixed header */
}

/* === Page Specific Background Overrides === */
#page-doga {
    background-image: url('img/bg-doga.png');
}
#page-kerem {
    background-image: url('img/bg-kerem.png');
}

/* === Header Styles === */
header {
    text-align: center;
    margin: 0px 20px 20px 20px; /* Top margin removed as body has padding-top */
}

h1 {
    font-size: 2.5em;
    font-weight: 700;
    color: #EAC435;
    margin-bottom: 10px;
    margin-top: 20px; /* Space above H1 */
    line-height: 1.2; /* Adjusted line height */
    font-family: 'ChelGeneral', sans-serif;
}

/* Apply flicker to headers with this class */
h1.hero-title {
    animation: flickerGlow 2s linear infinite alternate;
}

.separator {
    border: none;
    height: 1px;
    background-color: #EAC435;
    width: 100%;
    max-width: 300px; /* Limit width */
    margin: 10px auto 0 auto; /* Spacing */
}

/* === Base Button Styling === */
.button-link {
    display: inline-block;
    border: 1px solid #EAC435;
    background-color: transparent;
    color: #EAC435;
    padding: 18px 40px; /* Adjusted padding */
    text-decoration: none;
    border-radius: 8px;
    font-size: .75em; /* Increased base size slightly */
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px; /* Added slight spacing */
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
    font-family: 'ChelButton', sans-serif; /* Specific button font */
    text-align: center;
}
.button-link:hover {
    background-color: #EAC435;
    color: #1E1E1E;
}

/* === Index Page (Home) === */
.profile-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-grow: 1; /* Takes remaining vertical space */
    padding: 20px 0; /* Adjusted padding */
    width: 100%;
    margin: 30px 0 20px 0; /* Adjusted margins */
}

.profile-card {
    background-color: transparent; /* Explicitly transparent */
    padding: 0px;
    text-align: center;
    width: 85%;
    max-width: 350px;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.profile-card:hover {
    transform: translateY(-3px); /* Subtle hover effect */
}

.profile-pic { /* Image on Index page cards */
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 15px auto;
    display: block;
    border: 3px solid white; /* Slightly thicker border */
}

.profile-card h2 { /* Name on Index page cards */
    font-size: .9em; /* Slightly larger */
    font-weight: 400;
    color: white;
    font-family: 'ChelButton', sans-serif;
}

/* === Standings Page === */
.standings-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
    flex-grow: 1;
    padding: 115px 20px 50px 20px;
    width: 100%;
}

.player-standing {
    text-align: center;
    width: 100%;
    max-width: 450px;
    transition: order 0.5s ease-in-out;
    position: relative; /* Needed for absolute positioning of crown */
    padding: 15px 0;
}

/* Container for name and crown */
.player-name-container {
    position: relative;
    display: inline-block;
    margin-bottom: 5px; /* Base space below name container */
    padding-top: 0em; /* Add padding to top to make space for crown */
}

/* Crown Emoji Styling */
.crown-emoji {
    position: absolute;
    /* UPDATED: Adjust top to position within the new padding-top space */
    top: -1.2em;
    left: 50%;
    transform: translateX(-50%); /* Center horizontally */
    /* UPDATED: Slightly larger font size */
    font-size: 5em;
    opacity: 0; /* Hidden by default */
    pointer-events: none;
    transition: opacity 0.4s ease-in-out;
    animation: floatCrown 3.0s ease-in-out infinite;
    animation-play-state: paused; /* Animation paused when hidden */
}

/* Make crown visible and animate when leader */
.player-standing.is-leader .crown-emoji {
    opacity: 1;
    animation-play-state: running; /* Start animation */
}

.player-standing .player-name {
    font-size: 1.8em; /* Base name size */
    font-weight: 400;
    color: #EAC435;
    font-family: 'ChelGeneral', sans-serif;
    text-transform: uppercase;
    transition: font-size 0.3s ease-out;
    display: block;
}

/* Optional: Slightly larger name for leader */
.player-standing.is-leader .player-name {
     font-size: 2.0em;
}

/* Base style for the score paragraph */
.standing-score {
    font-family: 'ChelGeneral', sans-serif;
    line-height: 1;
    margin-top: -10px;
    text-align: center; /* Explicitly center score */
}

/* Style for the score SPAN itself */
.standing-score span {
    display: inline-block;
    transition: font-size 0.3s ease-out, color 0.3s ease, -webkit-text-stroke 0.3s ease, text-stroke 0.3s ease;
}

/* Leader Score Style (Applied to parent <p>) */
.score-leader span {
    font-size: 8em;
    font-weight: 700;
    color: #EAC435; /* Filled color */
    -webkit-text-stroke-width: 0;
    text-stroke-width: 0;
    animation: flickerGlow 1.5s linear infinite alternate; /* Flicker effect */
}

/* Loser/Tied Score Style (Applied to parent <p>) */
.score-loser span {
    font-size: 5em;
    font-weight: normal;
    color: transparent; /* Transparent fill */
    -webkit-text-stroke: 2px #EAC435; /* Outline */
    text-stroke: 2px #EAC435; /* Standard property */
    animation: none; /* No flicker */
}

/* === Trophy Cabinet Page === */
.trophy-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
    padding: 40px; /* No horizontal padding needed? */
    flex-grow: 1;
    width: 100%;
}

.player-trophy-area {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Pushes items to ends */
    width: 100%;
    padding: 30px 40px; /* Adjusted padding */
    color: white;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    order: 2; /* Non-leader is second */
    transition: order 0.5s ease-in-out, box-shadow 0.3s ease;
    /* background-color removed, assuming image or body bg is sufficient */
}

/* Order leader first and add highlight */
.player-trophy-area.is-trophy-leader {
    order: 1;
}

.trophy-player-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.trophy-player-img {
    width: 120px; /* Slightly smaller */
    height: auto;
    object-fit: cover;
    flex-shrink: 0; /* Prevent shrinking */
}

.trophy-wins-display {
    display: flex;
    align-items: center;
    gap: 15px; /* Increased gap */
}

.crown-icon { /* Image used as icon */
    height: 80px; /* Adjusted size */
    width: auto;
    /* padding-right removed, gap handles spacing */
}

/* Base style for trophy count number */
.trophy-count {
    font-family: 'ChelGeneral', sans-serif;
    font-size: 5em;
    font-weight: 700;
    color: #eac33500;
    line-height: 1;
    transition: font-size 0.3s ease-out;
    display: inline-block; /* Helps layout */
    -webkit-text-stroke: 1px #EAC435;
    text-stroke: 1px #EAC435; /* Standard property */
}

/* Style for the leading trophy count number */
.trophy-count-leader {
    font-size: 7em; /* Much larger size */
    /* !important removed */
    transition: font-size 0.3s ease-out;
    display: inline-block;
    line-height: 1;
    color:#EAC435;
    -webkit-text-stroke: 0px #EAC435;
    text-stroke: 0px #EAC435; /* Standard property */
}

/* Class to apply faster flicker effect */
.flicker-glow-fast {
    animation: flickerGlow 1s linear infinite alternate;
}


/* === Profile Pages (doga.html / kerem.html) === */
.team-name {
    text-align: center;
    margin-top: 0px;
    margin-bottom: 30px;
    font-size: 1em;
    font-weight: 700;
    text-transform: uppercase;
    color: #EAC435;
    font-family: 'ChelButton', sans-serif;
}

.profile-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    padding: 20px;
    gap: 15px;
    width: 100%;
}

.profile-page-name {
    font-size: 2.5em;
    font-weight: 700;
    color: #EAC435;
    font-family: 'ChelGeneral', sans-serif;
    text-transform: uppercase;
    line-height: 1.1;
}

.profile-page-score { /* Score display on individual profile page */
    font-size: 8em;
    color: transparent; /* Outlined */
    font-family: 'ChelGeneral', sans-serif;
    line-height: 1;
    margin-top: -10px;
    -webkit-text-stroke: 4px #EAC435;
    text-stroke: 4px #EAC435; /* Standard property */
}

.team-logo {
    display: block;
    max-width: 100px;
    height: auto;
    margin-top: 20px;
}

/* === Overlays (General) === */

/* Dark Background for "+1 Win" */
.dark-bg-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 900; opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}
.dark-bg-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* "+1 Win" Text Overlay */
.win-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    font-family: 'ChelGeneral', sans-serif; font-size: 8em; font-weight: bold;
    color: #EAC435; text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
    z-index: 950; opacity: 0; pointer-events: none; transform: scale(0.8);
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out; /* Fallback transition */
}
.win-overlay.active {
    opacity: 1;
    animation: fadeInOut 1.5s ease-in-out forwards;
}

/* Series Win Text Overlay */
.series-win-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    background-color: rgba(0, 0, 0, 0.9); /* Darker background */
    font-family: 'ChelGeneral', sans-serif; font-size: 6.5em; font-weight: bold;
    text-align: center; color: #FFF700;
    text-shadow: 0 0 10px #EAC435, 0 0 15px #EAC435, 3px 3px 5px rgba(0, 0, 0, 0.8);
    z-index: 1000; opacity: 0; pointer-events: none; transform: scale(0.8);
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out; /* Fallback transition */
    padding: 20px; line-height: 1.1; overflow: hidden;
}
.series-win-overlay.active {
    opacity: 1;
    pointer-events: auto;
    animation: seriesWinFadeInOut 2.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
}

/* Confetti Container */
#trophy-confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow clicks through */
    overflow: hidden; /* Hide emojis that go off-screen */
    z-index: 975; /* Behind series win text (1000), above +1 win text (950) */
}

/* Individual Confetti Emoji */
.confetti-emoji {
    position: absolute;
    bottom: -80px; /* Start further below */
    opacity: 1;
    will-change: transform, opacity;
    user-select: none;
    filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.3));
    /* font-size set dynamically */
    /* animation set dynamically */
}

/* === Video Overlay Styles (Commented Out - Feature Removed) === */
/*
.video-overlay {
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-color: #000;
    z-index: 1000;
    display: none;
    justify-content: center; align-items: center;
}
.video-overlay.active { display: flex; }
#fullscreen-video { width: 100%; height: 100%; object-fit: cover; }
body.video-active { overflow: hidden; }
*/

/* === Modal Styles (Reset Confirmation) === */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.75); /* Slightly darker */
    display: none; justify-content: center; align-items: center;
    z-index: 2000; padding: 20px; opacity: 0;
    transition: opacity 0.3s ease-in-out;
}
.modal-overlay.active {
    display: flex; opacity: 1;
}

.modal-content {
    background-color: #c82333; /* Red background */
    color: white; padding: 30px 35px;
    border-radius: 10px; text-align: center;
    max-width: 400px; width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease-in-out;
}
.modal-overlay.active .modal-content {
    transform: scale(1); /* Scale in effect */
}

.modal-message {
    font-size: 1.1em; line-height: 1.5; margin-bottom: 25px;
    font-family: 'ChelGeneral', sans-serif;
}

.modal-actions {
    display: flex; justify-content: space-around; gap: 15px; flex-wrap: wrap;
}

.modal-button {
    padding: 12px 20px; border: none; border-radius: 6px; font-size: 0.75em;
    font-weight: bold; cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    font-family: 'ChelButton', sans-serif; min-width: 100px;
}
.modal-button:active {
    transform: scale(0.95); /* Click feedback */
}

.modal-button-confirm {
    background-color: #ffdd57; color: #333; border: 1px solid #ffdd57;
}
.modal-button-confirm:hover {
    background-color: #ffca28;
}

.modal-button-cancel {
    background-color: transparent; color: white; border: 1px solid rgba(255, 255, 255, 0.7);
}
.modal-button-cancel:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* === Footer Styles === */
footer {
    text-align: center;
    padding: 30px 20px 50px 20px;
    margin-top: auto; /* Pushes footer down */
    width: 100%;
}

/* Footer on Home page */
.footer-home {
    padding-bottom: 70px; /* Extra space at bottom */
}
/* Stacking Buttons in Home Footer */
.footer-home > .button-link {
    display: block;
    width: calc(100% - 40px); /* Full width minus padding */
    max-width: 300px;
    margin: 15px auto 0 auto; /* Centered with spacing */
}
.footer-home > .button-link:first-child {
    margin-top: 0;
}

/* Default Button Style in Home Footer */
.footer-home > a.button-link:not(.trophy-link) {
    border: 1px solid #EAC435; background-color: transparent; color: #EAC435;
}
.footer-home > a.button-link:not(.trophy-link):hover {
    background-color: #EAC435; color: #1E1E1E;
}

/* Trophy Link Button Style (Green) */
.trophy-link {
    border: 1px solid #28a745; background-color: transparent; color: #28a745;
}
.trophy-link:hover {
    background-color: #28a745; color: white;
}

/* Footer Link on other pages ('BACK TO...') */
.footer-link:not(.reset-button) { /* Exclude reset button from this style */
    display: block;
    background-color: #EAC435; color: #1E1E1E;
    text-align: center;
    padding: 18px 30px;
    text-decoration: none;
    font-weight: 700; font-size: .75em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 auto;
    width: calc(100% - 40px);
    max-width: 300px;
    font-family: 'ChelButton', sans-serif;
    border: none;
    border-radius: 8px;
}
.footer-link:not(.reset-button):hover {
    opacity: 0.9;
}

/* Reset Scores Button (Red) */
.reset-button {
    display: block;
    width: calc(100% - 40px); max-width: 300px;
    margin: 20px auto 0 auto; /* Space above */
    border: 1px solid #dc3545; background-color: #dc3545; color: white;
    padding: 18px 30px; text-decoration: none; border-radius: 8px;
    font-size: .75em; text-transform: uppercase; letter-spacing: 1px;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    cursor: pointer; font-family: 'ChelButton', sans-serif;
}
.reset-button:hover {
    background-color: #c82333; border-color: #c82333;
}

/* === Responsive Adjustments for 400px width === */
@media (max-width: 390px) {

    /* --- General Adjustments --- */
    body {
        padding-top: 55px; /* Reduce top padding */
    }

    h1 {
        font-size: 2em; /* Reduce main title size */
        margin-top: 15px;
    }

    .separator {
        max-width: 250px; /* Slightly smaller separator */
    }

    .button-link,
    .footer-link:not(.reset-button),
    .reset-button {
        padding: 15px 20px; /* Reduce button padding */
        font-size: 0.7em; /* Slightly smaller button text */
    }

    footer {
        padding: 0px 15px 30px 15px; /* Adjust footer padding */
    }


    /* --- Index Page (`index.html`) --- */
    .profile-container {
        gap: 40px; /* Reduce gap between profile cards */
        margin: 20px 0 15px 0;
    }

    .profile-pic {
        width: 150px; /* Smaller profile pictures */
        height: 150px;
    }

    .profile-card h2 {
        font-size: 0.85em; /* Slightly smaller name text */
    }


    /* --- Standings Page (`standings.html`) --- */
    .standings-container {
        margin:0;
        padding: 80px 15px 0px 15px; /* Adjust padding */
    }

    .player-standing .player-name {
        font-size: 1.3em; /* Reduce player name size */
    }

    .player-standing.is-leader .player-name {
        font-size: 2.5em; /* Reduce leader name size */
    }

    .crown-emoji {
        font-size: 5em; /* Smaller crown */
        top: -1em; /* Adjust crown position */
    }

    /* Adjust score sizes */
    .score-leader span {
        font-size: 8em; /* Smaller leader score */
    }

    .score-loser span {
        font-size: 4em; /* Smaller loser/tied score */
         -webkit-text-stroke-width: 1px; /* Thinner stroke */
         text-stroke-width: 1px;
    }


    /* --- Trophy Cabinet Page (`trophy-cabinet.html`) --- */
    .trophy-container {
        margin:0;
        padding: 10px 15px 30px 15px; /* Adjust padding */
        gap: 0px; /* Reduce gap between sections */
    }

    .player-trophy-area {
        margin:0;
        padding:10px 15px; /* Reduce padding inside sections */
        flex-direction: column; /* Stack elements vertically */
        align-items: center; /* Center items */
        gap: 10px;
    }

     /* Ensure leader is still shown first */
    .player-trophy-area.is-trophy-leader {
       order: 1;
    }
     .player-trophy-area:not(.is-trophy-leader) {
       order: 2;
    }


    .trophy-player-img {
        width: 140px; /* Smaller team logos */
    }

    .crown-icon {
        height: 80px; /* Smaller crown icon */
    }

    .trophy-count {
        font-size: 4em; /* Smaller base trophy count */
        -webkit-text-stroke-width: 1px; /* Thinner stroke */
         text-stroke-width: 1px;
    }

    .trophy-count-leader {
        font-size: 7em; /* Smaller leader trophy count */
    }


    /* --- Profile Pages (`doga.html` / `kerem.html`) --- */
    .team-name {
        font-size: 0.9em;
        margin-bottom: 15px;
    }

    .profile-page-name {
        font-size: 2em; /* Smaller profile name */
    }

    .profile-page-score span { /* Target the span if needed */
        font-size: 6em; /* Smaller profile score */
        -webkit-text-stroke-width: 3px; /* Adjust stroke */
        text-stroke-width: 3px;
    }

    .team-logo {
        max-width: 80px; /* Smaller team logo on profile */
    }


    /* --- Overlays --- */
    .win-overlay {
       font-size: 6em; /* Smaller "+1 Win" text */
    }

    .series-win-overlay {
       font-size: 4em; /* Smaller series win text */
    }

    /* --- Modal --- */
     .modal-content {
        padding: 20px 25px; /* Slightly less padding */
     }
     .modal-message {
        font-size: 1em; /* Slightly smaller modal text */
     }
      .modal-button {
        font-size: 0.7em;
        padding: 10px 15px;
     }
}