/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Arial', sans-serif;
}

/* Variables */
:root {
    --primary-color: #7C2D12;
    --secondary-color: #B45309;
    --accent-color: #FBBF24;
    --background-color: #FEF3C7;
    --text-color: #7C2D12;
    --button-color: #FBBF24;
    --button-text-color: #7C2D12;
    --button-hover-color: #F59E0B;
    --shadow-color: rgba(124, 45, 18, 0.2);
    --white: #FFFFFF;
    --bean-safe-margin: 30px;
}

/* Global Styles */
body {
    background-color: var(--background-color);
    color: var(--text-color);
    overflow: hidden;
    touch-action: manipulation;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
    max-width: 500px;
    width: 100%;
    height: 100%;
    max-height: 800px;
    background-color: var(--background-color);
    overflow: hidden;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: var(--background-color);
    z-index: 1;
}

.screen.active {
    display: flex;
}

/* Screen Backgrounds */
.screen-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* Home Screen */
#home-screen {
    justify-content: center;
    background: url('../assets/svg/home-bg.svg') no-repeat center center;
    background-size: cover;
    position: relative;
}

.home-logo {
    width: 80%;
    max-width: 300px;
    margin-bottom: 20px;
}

.game-instructions {
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    width: 85%;
    max-width: 350px;
    box-shadow: 0 4px 8px rgba(124, 45, 18, 0.2);
    border: 2px solid var(--primary-color);
}

.game-instructions h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    text-align: center;
    font-size: 1.3rem;
}

.game-instructions ul {
    padding-left: 20px;
    margin: 0;
}

.game-instructions li {
    margin-bottom: 5px;
    color: var(--text-color);
    font-size: 0.95rem;
}

.game-instructions .warning {
    color: #DC2626;
    font-weight: bold;
}

.difficulty-selection {
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    width: 85%;
    max-width: 350px;
    box-shadow: 0 4px 8px rgba(124, 45, 18, 0.2);
    border: 2px solid var(--primary-color);
}

.difficulty-selection h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    text-align: center;
    font-size: 1.3rem;
}

.difficulty-buttons {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.difficulty-btn {
    flex: 1;
    background-color: var(--background-color);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.difficulty-btn:hover {
    background-color: var(--button-hover-color);
    transform: scale(1.05);
}

.difficulty-btn.selected {
    background-color: var(--primary-color);
    color: white;
}

/* Form Screen */
#form-screen {
    position: relative;
    justify-content: flex-start;
    background: url('../assets/svg/form-background.svg') no-repeat center center;
    background-size: cover;
    padding: 20px;
    color: var(--primary-color);
}

.form-header {
    text-align: center;
    margin-bottom: 30px;
}

.form-logo {
    width: 200px;
    margin-bottom: 10px;
}

.form-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin: 10px 0;
}

.form-subtitle {
    font-size: 1rem;
    color: var(--secondary-color);
}

.player-info-form {
    width: 90%;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.form-field {
    width: 100%;
    margin-bottom: 15px;
}

.form-field input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: white;
    color: var(--text-color);
    transition: border-color 0.3s;
}

.form-field input::placeholder {
    color: #9CA3AF;
}

.form-field input:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Game Screen */
#game-screen {
    background: url('../assets/svg/game-bg.svg') no-repeat center center;
    background-size: cover;
}

.game-score-panel {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    position: absolute;
    top: 10px;
    left: 0;
    z-index: 5;
}

.score-container, .timer-container {
    position: relative;
    width: 130px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--primary-color);
}

.score-container {
    background: linear-gradient(135deg, #FEF3C7 0%, #FBBF24 100%);
}

.timer-container {
    background: linear-gradient(135deg, #FEF3C7 0%, #F59E0B 100%);
}

.score-bg, .timer-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.2;
}

.score-text::before, .timer-text::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 10px;
    right: 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: bold;
    color: var(--primary-color);
    text-align: center;
}

.score-text::before {
    content: "Điểm";
}

.timer-text::before {
    content: "Thời gian";
}

.score-text, .timer-text {
    position: relative;
    z-index: 2;
    font-weight: bold;
    font-size: 2rem;
    color: var(--primary-color);
    text-shadow: 1px 1px 2px #ffffff, -1px -1px 2px #ffffff;
    padding: 10px 0 0 0;
    width: 90%;
    text-align: center;
    font-family: 'Arial Black', sans-serif;
}

.game-area {
    position: relative;
    width: 100%;
    height: calc(100% - 70px);
    overflow: hidden;
    box-sizing: border-box;
    padding: 0 10px;
}

#basket-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 100px;
    cursor: grab;
    z-index: 10;
}

#basket {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.soybean, .negative-score {
    position: absolute;
    width: 40px;
    height: 40px;
    object-fit: contain;
    z-index: 5;
    box-sizing: border-box;
}

.golden-soybean {
    width: 50px;
    height: 50px;
}

.lives-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FEF3C7 0%, #DC2626 100%);
    border-radius: 15px;
    padding: 5px 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--primary-color);
}

.lives-display {
    display: flex;
    gap: 5px;
}

.life-icon {
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.15);
    }
}

/* Game Over Screen */
#game-over-screen {
    background: url('../assets/svg/game-bg.svg') no-repeat center center;
    background-size: cover;
    justify-content: center;
    text-align: center;
}

.game-over-panel {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    width: 85%;
    max-width: 350px;
}

.game-over-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.final-score-container {
    margin-bottom: 40px;
}

.final-score-label {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 5px;
}

.final-score {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

/* Leaderboard Screen */
#leaderboard-screen {
    background: url('../assets/svg/leaderboard-bg.svg') no-repeat center center;
    background-size: cover;
    padding: 20px;
}

.leaderboard-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin: 30px 0 20px;
    text-align: center;
}

.leaderboard-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
}

.leaderboard-bg {
    width: 100%;
    pointer-events: none;
}

.leaderboard-entries {
    position: absolute;
    top: 50px;
    left: 0;
    width: 100%;
    padding: 0 20px;
    overflow-y: auto;
    max-height: calc(100% - 60px);
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    padding: 5px 0;
    border-bottom: 1px solid rgba(124, 45, 18, 0.3);
}

.rank {
    width: 40px;
    text-align: center;
    font-weight: bold;
}

.rank img {
    width: 30px;
    height: 30px;
}

.player-name {
    flex-grow: 1;
    padding: 0 10px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.player-score {
    width: 80px;
    text-align: right;
    font-weight: bold;
}

/* Lucky Spin Screen */
#lucky-spin-screen {
    justify-content: flex-start;
    align-items: center;
    background: url('../assets/svg/spin-bg.svg') no-repeat center center;
    background-size: cover;
    padding: 20px;
}

.lucky-spin-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin: 30px 0;
    text-align: center;
}

.spin-wheel-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 20px 0;
}

.wheel-pointer {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    width: 32px;
    height: 48px;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
}

.arrow {
    width: 100%;
    height: 100%;
}

.wheel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}

/* Fortune Wheel Ticker Sound Effect */
@keyframes ticker-sound {
    0%, 100% {
        transform: rotate(0);
    }
    50% {
        transform: rotate(1deg);
    }
}

/* Streak styles */
.streak-indicator {
    animation: pulse-streak 1s infinite alternate;
    box-shadow: 0 0 10px rgba(147, 51, 234, 0.7);
}

@keyframes pulse-streak {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.3);
    }
}

.spin-glow {
    animation: spin-glow 2s infinite;
}

@keyframes spin-glow {
    0%, 100% {
        filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.7));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(251, 191, 36, 1));
    }
}

.spin-buttons {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.bean-cost {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.bean-cost img {
    width: 20px;
    height: 20px;
}

/* Exchange Rewards Screen */
#exchange-screen {
    justify-content: flex-start;
    background: url('../assets/svg/exchange-bg.svg') no-repeat center center;
    background-size: cover;
    padding: 20px;
}

.exchange-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin: 30px 0 10px;
    text-align: center;
}

.beans-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.beans-container img {
    width: 30px;
    height: 30px;
}

.beans-count {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.rewards-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    max-height: 400px;
}

.reward-item {
    background-color: white;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.reward-item img {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
}

.reward-name {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--primary-color);
    text-align: center;
}

.reward-cost {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.reward-cost img {
    width: 20px;
    height: 20px;
    margin-right: 5px;
    margin-bottom: 0;
}

/* Buttons */
.game-button {
    position: relative;
    width: 200px;
    height: 60px;
    margin: 10px 0;
    background: none;
    border: none;
    cursor: pointer;
    overflow: visible;
    z-index: 10;
}

.button-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.button-text {
    position: relative;
    color: var(--button-text-color);
    font-weight: bold;
    font-size: 1.2rem;
    text-transform: uppercase;
    z-index: 2;
}

.game-button:hover {
    transform: scale(1.05);
}

.game-button:active {
    transform: scale(0.95);
}

.button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 20px;
}

.back-button {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s ease-in-out;
}

.back-button:hover {
    transform: scale(1.1);
}

.back-button:active {
    transform: scale(0.95);
}

.back-button img {
    width: 100%;
    height: 100%;
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .game-button {
        width: 180px;
        height: 55px;
    }
    
    .button-text {
        font-size: 1rem;
    }
    
    .form-title {
        font-size: 1.8rem;
    }
    
    .rewards-container {
        grid-template-columns: 1fr;
    }
    
    .spin-wheel-container {
        width: 250px;
        height: 250px;
    }
    
    .spin-buttons {
        flex-direction: row;
        gap: 10px;
    }
    
    .spin-buttons button {
        width: 100px;
        height: 100px;
    }

    .game-score-panel {
        padding: 10px;
    }

    .score-container, .timer-container {
        width: 110px;
        height: 55px;
    }

    .game-area {
        padding: 0 15px;
    }
}

@media (max-height: 700px) {
    .form-header {
        margin-top: 20px;
        margin-bottom: 20px;
    }
    
    .form-logo {
        width: 150px;
    }
    
    .form-title {
        font-size: 1.5rem;
    }
    
    .lucky-spin-title, .exchange-title, .leaderboard-title {
        margin: 20px 0;
        font-size: 1.8rem;
    }
    
    .spin-wheel-container {
        width: 250px;
        height: 250px;
        margin: 10px 0;
    }
    
    #basket-container {
        bottom: 50px;
    }
}

/* Landscape Mode */
@media (max-height: 450px) {
    #game-container {
        max-height: 100vh;
    }
    
    .form-header {
        margin-top: 10px;
    }
    
    .player-info-form {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 10px;
    }
    
    .form-field {
        width: 45%;
        margin-bottom: 5px;
    }
    
    .game-button {
        height: 40px;
    }
    
    #basket-container {
        bottom: 30px;
    }
}

/* Fix for Chrome button clickability */
button {
    position: relative;
    z-index: 15;
    touch-action: manipulation;
    cursor: pointer !important;
    -webkit-user-select: none;
    user-select: none;
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed !important;
}

/* Ensure all clickable elements remain interactive */
button, a, input, select, label {
    pointer-events: auto !important;
}

/* Add visible focus states for better accessibility */
button:focus, a:focus, input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
} 