:root {
    --primary-bg: #1a1b23;
    --panel-bg: rgba(30, 25, 25, 0.85);
    --panel-border: rgba(255, 255, 255, 0.1);
    --accent-color: #00e701; /* Stake green-ish */
    --accent-hover: #00ff00;
    --text-main: #ffffff;
    --text-dim: #a0a0a0;
    --font-ui: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    background-color: var(--primary-bg);
    color: var(--text-main);
    font-family: var(--font-ui);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#balance-display {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 1.2rem;
    font-weight: 600;
    z-index: 100;
    background: rgba(0,0,0,0.5);
    padding: 10px 20px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

#game-container {
    width: 100%;
    max-width: 1200px;
    aspect-ratio: 16 / 9;
    background-image: url('assets/bg.png');
    background-size: cover;
    background-position: center;
    position: relative;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Multiplier Bar --- */
#multiplier-bar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 40px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.4);
    padding: 15px 40px;
    border-radius: 30px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    opacity: 0.5;
    transition: opacity 0.3s, transform 0.3s;
}

.step.active {
    opacity: 1;
    transform: scale(1.1);
}

.step.passed {
    opacity: 0.8;
}

.step .dot {
    width: 16px;
    height: 16px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
    transition: background-color 0.3s, box-shadow 0.3s;
}

.step.active .dot {
    background-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-color);
}

.step .value {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.1rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    -webkit-text-stroke: 1px rgba(0,0,0,0.5);
}

.progress-line {
    position: absolute;
    top: 23px; /* Align with dots */
    left: 40px;
    right: 40px;
    height: 2px;
    background: rgba(255,255,255,0.3);
    z-index: -1;
}

/* --- Game Area --- */
#game-area {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#goal-net {
    position: absolute;
    width: 70%;
    height: 60%;
    top: 15%;
    /* Create a basic net pattern using repeating gradients */
    background-image: 
        linear-gradient(rgba(255,255,255,0.7) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255,255,255,0.7) 2px, transparent 2px);
    background-size: 40px 40px;
    border: 8px solid #dcdcdc; /* Goal posts */
    border-bottom: none;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.targets-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    padding: 10px;
    gap: 10px;
    z-index: 5;
}

.target {
    border-radius: 50%;
    border: 4px dashed rgba(255,255,255,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.target::after {
    content: '';
    width: 40%;
    height: 40%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="rgba(255,255,255,0.5)" d="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.3-208-208S141.3 48 256 48s208 93.3 208 208S370.7 464 256 464zM256 128c-70.6 0-128 57.4-128 128s57.4 128 128 128s128-57.4 128-128S326.6 128 256 128z"/></svg>') no-repeat center;
    background-size: contain;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.target:hover, .target.hover-effect {
    border-color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.1);
    transform: scale(1.05);
}

.target:hover::after {
    opacity: 1;
}

.target.disabled {
    pointer-events: none;
    opacity: 0.3;
}

#goalkeeper {
    position: absolute;
    bottom: 12%; /* closer to ground */
    width: 25%; /* larger */
    height: 55%; /* larger */
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 20; /* Brought to top */
    pointer-events: none; /* Let clicks pass through to targets */
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

#goalkeeper img {
    height: 100%;
    object-fit: contain;
}

#ball {
    position: absolute;
    bottom: 3%; /* closer to user */
    width: 12%; /* larger */
    height: 12%; /* larger */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 30; /* Brought to top */
    pointer-events: none; /* Let clicks pass through to targets */
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), scale 0.4s;
}

#ball img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s; /* For rotation during flight */
}

/* Highlight arrows around ball */
.target-indicators {
    position: absolute;
    width: 140%;
    height: 140%;
    border-radius: 50%;
    border: 2px solid rgba(0, 231, 1, 0.5);
    border-top-color: transparent;
    border-bottom-color: transparent;
    animation: rotate 4s linear infinite;
    display: none; /* Show only when ready to shoot */
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

/* --- Overlays --- */
.overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    backdrop-filter: blur(4px);
    opacity: 1;
    transition: opacity 0.3s;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#overlay-text {
    font-family: var(--font-heading);
    font-size: 6rem;
    color: #ff3333;
    text-shadow: 0 0 30px rgba(255,0,0,0.8);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay:not(.hidden) #overlay-text {
    transform: scale(1);
}

.overlay-win #overlay-text {
    color: var(--accent-color);
    text-shadow: 0 0 30px rgba(0,255,0,0.8);
}


/* --- Bottom Control Panel --- */
#control-panel {
    background: var(--panel-bg);
    border-top: 1px solid var(--panel-border);
    padding: 10px 40px 20px 40px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    z-index: 20;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
}

.panel-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
}

.tab-btn.active {
    color: var(--text-main);
    background: rgba(255,255,255,0.1);
}

.panel-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 15px;
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.panel-section.hidden {
    display: none;
}

.panel-section label {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

select, input {
    background: transparent;
    border: none;
    color: white;
    font-family: var(--font-ui);
    font-size: 1.1rem;
    font-weight: 600;
    outline: none;
}

select {
    cursor: pointer;
}

select option {
    background: #2a2b33;
    color: white;
}

.bet-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.5);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}

.currency-symbol {
    color: var(--text-dim);
    margin-right: 5px;
}

input[type="number"] {
    width: 80px;
    -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.bet-controls {
    display: flex;
    gap: 4px;
    margin-left: 10px;
}

.bet-controls button {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.bet-controls button:hover {
    background: rgba(255,255,255,0.2);
}

.action-section {
    background: transparent;
    border: none;
    padding: 0;
    flex: 0 0 250px;
}

#main-action-btn {
    width: 100%;
    padding: 18px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #00e701, #00b300);
    color: #000;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 900;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(0, 231, 1, 0.4);
    transition: all 0.2s;
}

#main-action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 231, 1, 0.6);
}

#main-action-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(0, 231, 1, 0.4);
}

#main-action-btn:disabled {
    background: #3a3b43;
    color: #8a8b93;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.win-display {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-color);
    display: flex;
    align-items: center;
}

@media (max-width: 900px) {
    body {
        align-items: stretch;
        overflow-y: auto;
    }

    #balance-display {
        top: 10px;
        right: 10px;
        font-size: 0.95rem;
        padding: 8px 12px;
    }

    #game-container {
        min-height: 100vh;
        aspect-ratio: auto;
        border-radius: 0;
    }

    #multiplier-bar {
        top: 58px;
        width: calc(100% - 24px);
        gap: 14px;
        justify-content: space-between;
        padding: 10px 14px;
        border-radius: 18px;
    }

    .step .value {
        font-size: 0.8rem;
    }

    .step .dot {
        width: 12px;
        height: 12px;
    }

    #goal-net {
        width: 86%;
        height: 46%;
        top: 18%;
        border-width: 6px;
        background-size: 28px 28px;
    }

    .targets-grid {
        gap: 6px;
    }

    .target {
        border-width: 3px;
    }

    #goalkeeper {
        width: 34%;
        height: 42%;
        bottom: 22%;
    }

    #ball {
        width: 18%;
        height: 18%;
        bottom: 20%;
    }

    #control-panel {
        padding: 10px 14px 16px;
    }

    .panel-controls {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .panel-section {
        padding: 10px 12px;
    }

    .action-section {
        grid-column: 1 / -1;
        flex-basis: auto;
    }

    #main-action-btn {
        min-height: 54px;
        font-size: 1.1rem;
    }

    #overlay-text {
        max-width: 90%;
        text-align: center;
        font-size: 3.4rem;
    }
}

@media (max-width: 520px) {
    #multiplier-bar {
        gap: 8px;
    }

    .step .value {
        font-size: 0.68rem;
    }

    .panel-tabs {
        margin-top: 4px;
    }

    .panel-controls {
        grid-template-columns: 1fr;
    }

    .bet-input-wrapper {
        justify-content: space-between;
    }

    input[type="number"] {
        width: 100%;
        min-width: 0;
    }

    #goal-net {
        height: 40%;
    }

    #goalkeeper {
        width: 42%;
    }

    #ball {
        width: 22%;
        height: 22%;
    }
}
