:root {
    --primary-bg: #1abc9c;
    --gradient-top: #6db3f2;
    /* Sky blue ish */
    --gradient-bottom: #1e6969;
    /* Tealish dark */
    --text-white: #ffffff;
    --card-glass: rgba(255, 255, 255, 0.1);
    --font-main: "Google Sans", sans-serif;
    --font-thai: "Google Sans", sans-serif;
    --vs-size: 120px;
    /* Legacy variable, kept for reference if box returns */
    --vs-font-size: 4rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: "Google Sans", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-variation-settings: "GRAD" 0;
    background: linear-gradient(180deg, #343434 0%, #000000 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    color: white;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 400px;
    background: transparent;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Header */
/* Header */
.match-header {
    display: flex;
    justify-content: space-between;
    width: 80%;
    margin-top: 40px;
    font-size: 2rem;
    font-weight: 700;
}

/* VS Section */
/* VS Section */
.vs-section {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 20px 0 20px 0;
    position: relative;
    gap: 30px;
    /* Reduced gap as VS is now in flow */
}

.team-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    opacity: 0;
    /* Hidden initially */
    transition: transform 1s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 1s ease;
}

/* Home animation: from Left */
.home-group {
    transform: translateX(-50px);
}

/* Away animation: from Right */
.away-group {
    transform: translateX(50px);
}

.team-group.slide-active {
    opacity: 1;
    transform: translateX(0);
}

.team-name {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.avatar-container {
    /* home/away big logo */
    position: relative;
    width: 120px;
    height: 120px;
}

.avatar-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid white;
    background: #e0f2f1;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.flag-badge {
    display: none;
    /* Hidden as requested */
    position: absolute;
    bottom: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
    background: white;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.home-flag {
    left: 0;
}

.away-flag {
    right: 0;
}

.vs-badge {
    /* Text Only Layout */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    margin-top: 50px;
    /* Optical alignment with avatars */

    /* Typography */
    font-size: var(--vs-font-size, 5rem);
    font-weight: 900;
    font-style: italic;
    line-height: 1;
    padding-right: 0.2em;
    /* Fix italic clipping */
    margin-right: -0.1em;
    /* Optical centering */

    /* Fire Text Effect */
    background: linear-gradient(180deg, #FFFFFF 0%, #FFEB3B 25%, #FF9800 50%, #FF5722 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;

    /* Initial State */
    opacity: 0;
    transform: scale(0) rotate(-180deg);
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.8s ease;
}

.vs-badge.pop-in {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    /* Initial Glow */
    filter: drop-shadow(0 0 5px rgba(255, 193, 7, 0.8)) drop-shadow(0 0 15px rgba(255, 87, 34, 0.6));
    animation: burn 1.2s infinite alternate ease-in-out;
}

@keyframes burn {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 5px rgba(255, 193, 7, 0.8)) drop-shadow(0 0 15px rgba(255, 87, 34, 0.6));
    }

    100% {
        transform: scale(1.15);
        filter: drop-shadow(0 0 10px rgba(255, 193, 7, 1)) drop-shadow(0 0 25px rgba(255, 69, 0, 0.8)) brightness(1.2);
    }
}

.vs-badge span {
    /* Reset rotation since main container handles it */
    transform: none;
}

/* Match Details Card */
.match-detail-card {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.match-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #eee;
}

.match-team img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    /* Use contain for logos */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.match-info-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.match-date,
.match-league {
    font-size: 0.8rem;
    color: #aaa;
    font-weight: 300;
}

.match-time {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}

/* Actions */
.actions-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 10px;
    gap: 15px;
}

.action-btn {
    flex: 1;
    aspect-ratio: 1;
    border: none;
    border-radius: 16px;
    background: #111;
    position: relative;
    z-index: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    font-weight: 700;
    font-family: var(--font-main);
    transition: transform 0.1s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.action-btn::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    background-size: 400%;
    z-index: -1;
    filter: blur(5px);
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    animation: glowing 20s linear infinite;
    opacity: 1;
    /* Make it bright */
    transition: opacity 0.3s ease-in-out;
    border-radius: 18px;
}

/* Specific Glow Colors */
.home-btn::before {
    background: linear-gradient(45deg, #F44336, #FF4081, #D32F2F, #F44336);
}

.draw-btn::before {
    background: linear-gradient(45deg, #ffffff, #80DEEA, #26C6DA, #ffffff);
}

.draw-btn {
    /* Unselected: White text (inherited), Dark BG (from parent) */
    font-size: 1.6rem;
    font-weight: 800;
    text-transform: uppercase;
}

/* Specific override for Draw button selected state */
.action-btn.draw-btn.selected::after {
    background: #ffffff;
    /* White BG when selected */
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

.away-btn::before {
    background: linear-gradient(45deg, #F44336, #FF4081, #D32F2F, #F44336);
}

.action-btn::after {
    z-index: -1;
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background: #222;
    left: 0;
    top: 0;
    border-radius: 16px;
    transition: background 0.3s ease;
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn.selected::after {
    background: #FF3131;
    /* Neon Red */
    box-shadow: 0 0 20px rgba(255, 49, 49, 0.6);
}

.action-btn.selected {
    color: #000;
    font-weight: 800;
}

@keyframes glowing {
    0% {
        background-position: 0 0;
    }

    50% {
        background-position: 400% 0;
    }

    100% {
        background-position: 0 0;
    }
}

/* Remove legacy .action-btn.selected block that caused issues */

.team-logo {
    font-size: 1.2rem;
    /* This would be an img in real app */
}

/* Footer */
.footer-info {
    text-align: center;
    font-family: var(--font-thai);
    font-weight: 300;
    opacity: 0.9;
    line-height: 1.5;
    width: 100%;
    /* Ensure full width for child button */
    font-size: 1.5rem;
    /* เพิ่มบรรทัดนี้เพื่อปรับขนาด (เลขยิ่งมากยิ่งใหญ่) */
}

/* Countdown New */
.countdown-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 15px;
    border-radius: 8px;
    min-width: 70px;
}

.countdown-number {
    font-size: 2rem;
    font-weight: 700;
    color: #29B6F6;
    /* Bright Blue */
    font-family: var(--font-main);
    line-height: 1;
}

.countdown-label {
    font-size: 0.7rem;
    color: #aaa;
    margin-top: 5px;
    font-family: var(--font-thai);
    text-transform: uppercase;
}

/* Blink Effect on Change */
@keyframes blinkText {
    0% {
        color: #29B6F6;
        transform: scale(1);
    }

    50% {
        color: #fff;
        text-shadow: 0 0 10px #fff, 0 0 20px #29B6F6;
        transform: scale(1.1);
    }

    100% {
        color: #29B6F6;
        transform: scale(1);
    }
}

.blink {
    animation: blinkText 0.4s ease-in-out;
}

/* Lazy Loading Styles */
.loading-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e0f2f1;
    /* Match avatar bg */
    border-radius: 50%;
}

.loading-effect img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

img.lazy-load {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

img:not(.lazy-load) {
    opacity: 1;
}

/* Global Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-logo {
    width: 150px;
    height: auto;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Stadium Background */
body.stadium-bg {
    background: url('../assets/img/effect/img-bg-stadium-01.jpg') no-repeat center center fixed !important;
    background-size: cover !important;
}

/* Background Layer for Fade In */
#bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

#bg-layer.visible {
    opacity: 1;
}

/* Main Logo on App Screen */
.main-logo {
    width: 215px;
    height: auto;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(-50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    /* Fire Glow Effect */
    filter: drop-shadow(0 0 15px rgba(255, 165, 0, 0.8)) drop-shadow(0 0 30px rgba(255, 69, 0, 0.6));
}

.main-logo.slide-in {
    opacity: 1;
    transform: translateY(0);
}

.league-title {
    font-family: var(--font-main);
    font-size: 3.0rem;
    /* Increased size */
    font-weight: 700;
    margin-bottom: 10px;
    opacity: 0;
    filter: blur(10px);
    transition: opacity 1s ease, filter 1s ease;
    /* Fire Glow for Text */
    text-shadow: 0 0 10px rgba(255, 165, 0, 0.8), 0 0 20px rgba(255, 69, 0, 0.6);
}

.league-title.blur-in {
    opacity: 1;
    filter: blur(0);
}

/* Staggered Animation Initial States */
.match-detail-card,
.actions-container,
.footer-info {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fade-up-active {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Submit Button */
.submit-btn {
    margin-top: 25px;
    width: 100%;
    /* max-width removed to match match-detail-card */
    padding: 15px 0;
    font-size: 1.8rem;
    font-family: var(--font-main);
    font-weight: 800;
    color: #fff;
    background: linear-gradient(180deg, #333 0%, #111 100%);
    border: 3px solid #00bcd4;
    /* Cyan */
    border-radius: 12px;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 15px rgba(0, 188, 212, 0.4), inset 0 0 10px rgba(0, 188, 212, 0.2);
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 188, 212, 0.6), inset 0 0 20px rgba(0, 188, 212, 0.4);
    background: linear-gradient(180deg, #444 0%, #222 100%);
    border-color: #4dd0e1;
}

/* Reward Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.modal-content {
    background: #fff;
    width: 90%;
    max-width: 400px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: popIn 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    text-align: center;
    color: #333;
    z-index: 2;
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    padding: 20px;
    color: #fff;
}

.modal-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.modal-body {
    padding: 20px;
}

.modal-body h2 {
    font-size: 1rem;
    color: #555;
    margin-bottom: 15px;
}

.reward-list,
.instructions-list {
    list-style: none;
    padding: 0;
    text-align: left;
    margin-bottom: 20px;
}

.reward-list li,
.instructions-list li {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #444;
}

.refund-text h2 {
    color: #FF3131;
    font-weight: 800;
    margin: 15px 0;
}

.instructions-title {
    text-align: left;
    font-size: 1rem;
    margin-bottom: 10px;
    color: #333;
}

/* Modal Countdown */
.modal-countdown {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.timer-box {
    background: #333;
    color: #fff;
    padding: 8px;
    border-radius: 6px;
    min-width: 50px;
    display: flex;
    flex-direction: column;
}

.timer-box span {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
}

.timer-box small {
    font-size: 0.6rem;
    text-transform: uppercase;
}

/* Code Section */
.code-section {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px dashed #aaa;
}

.code-section h3 {
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: #666;
}

.code-text {
    font-size: 1.5rem;
    color: #29B6F6;
    font-weight: 800;
}

/* CTA Button */
.cta-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background: linear-gradient(90deg, #00C853 0%, #64DD17 100%);
    color: white;
    font-weight: 700;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(0, 200, 83, 0.4);
    transition: transform 0.2s;
}

.cta-btn:hover {
    transform: scale(1.02);
}

.close-modal-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.8;
}

.close-modal-btn:hover {
    opacity: 1;
}

/* Copy Success Modal */
.success-modal {
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    background: #fff;
    color: #333;
    width: 85%;
    max-width: 320px;
    border-radius: 20px;
}

.success-icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid #e8f5e9;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
}

.success-icon {
    width: 40px;
    height: 40px;
    stroke: #4CAF50;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: drawCheck 0.5s ease-in-out forwards;
}

@keyframes drawCheck {
    0% {
        stroke-dasharray: 0, 100;
    }

    100% {
        stroke-dasharray: 100, 100;
    }
}

.success-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    color: #333;
    text-align: center;
}

.success-title .line-id {
    color: #757575;
}

.success-subtitle {
    font-size: 0.9rem;
    color: #999;
    margin: 0;
    text-align: center;
}

.ok-btn-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.ok-btn {
    background: #81D4FA;
    color: white;
    border: none;
    padding: 10px 40px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(129, 212, 250, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ok-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(129, 212, 250, 0.6);
}

.ok-btn:active {
    transform: translateY(0);
}

/* Falling Coin Animation */
.falling-coin {
    position: absolute;
    top: -100px;
    user-select: none;
    pointer-events: none;
    z-index: 100;
    animation: fall linear infinite;
}

/* Ensure modal content is above coins */
.modal-content {
    position: relative;
    z-index: 10;
}

@keyframes fall {
    0% {
        top: -10%;
        opacity: 1;
        transform: rotate(0deg);
    }

    100% {
        top: 120%;
        opacity: 0;
        transform: rotate(360deg);
    }
}

/* Hamburger Menu */
.hamburger-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.hamburger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Nav Overlay */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-overlay.active {
    transform: translateX(0);
}

.nav-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 60px;
}

.nav-logo {
    width: 120px;
    height: auto;
}


.nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 30px;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-size: 1.8rem;
    font-weight: 600;
    font-family: var(--font-thai);
    transition: all 0.4s ease;
    opacity: 0;
    transform: translateY(20px);
}

.nav-overlay.active .nav-link {
    opacity: 1;
    transform: translateY(0);
}



.nav-link:hover {
    color: #29B6F6;
}

.nav-footer {
    margin-top: auto;
    padding-bottom: 20px;
}

.line-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #06C755;
    color: #fff;
    text-decoration: none;
    padding: 15px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.line-btn:active {
    transform: scale(0.98);
}