/* Global Styles */
:root {
    --primary-color: #3498db;
    --secondary-color: #2980b9;
    --accent-color: #333333;
    --text-color: #000000;
    --light-color: #f8f9fa;
    --dark-color: #191919;
    --book-color: #8b4513;
    --book-page: #f5f5dc;
    --out-color: #ff4d4d;
    --four-color: #4d79ff;
    --six-color: #ff9933;
    --wide-color: #9966ff;
    --noball-color: #ff6699;
    --button-text: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-color);
    min-height: 100vh;
    padding: 20px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><circle cx="50" cy="50" r="48" fill="none" stroke="%23ffffff20" stroke-width="1"/><circle cx="50" cy="50" r="30" fill="none" stroke="%23ffffff20" stroke-width="1"/></svg>');
    background-size: 300px 300px;
    background-position: center;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
}

header {
    background-color: var(--primary-color);
    color: var(--button-text);
    padding: 20px;
    border-bottom: 5px solid var(--secondary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header .logo {
    text-align: left;
}

header h1 {
    font-size: 2.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header h1 span {
    display: block;
    font-size: 1rem;
    font-weight: normal;
    letter-spacing: 1px;
    margin-top: 5px;
}

header nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
}

header nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 15px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

header nav ul li a:hover {
    background-color: var(--secondary-color);
}

/* Game Setup Styles */
.game-setup {
    padding: 30px;
    background-color: var(--light-color);
    text-align: center;
}

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

.setup-title {
    color: var(--primary-color);
    font-size: 2.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

.setup-subtitle {
    color: var(--text-color);
    font-size: 1.8rem;
    font-weight: 400;
    letter-spacing: 1px;
}

.setup-tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.setup-tiles.two-players {
    grid-template-areas: 
        "mode settings"
        "player1 player2";
}

.setup-tiles:not(.two-players) {
    grid-template-areas: 
        "mode player1"
        "settings player2";
}

@media (max-width: 768px) {
    .setup-tiles {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .setup-tiles.two-players,
    .setup-tiles:not(.two-players) {
        grid-template-areas: 
            "mode"
            "player1"
            "player2"
            "settings";
    }
    
    .player-tile:nth-of-type(3) {
        display: block;
    }
}

.game-mode-tile {
    grid-area: mode;
}

.settings-tile {
    grid-area: settings;
}

.player-tile:nth-of-type(2) {
    grid-area: player1;
}

.player-tile:nth-of-type(3) {
    grid-area: player2;
}

.setup-tile {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.setup-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.tile-header {
    background-color: var(--primary-color);
    color: var(--button-text);
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.tile-header i {
    font-size: 1.5rem;
}

.tile-header h2 {
    font-size: 1.3rem;
    margin: 0;
}

.tile-content {
    padding: 20px;
}

.mode-options {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.mode-btn, .player-btn, .action-btn {
    background-color: var(--accent-color);
    color: var(--button-text);
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.mode-btn:hover, .player-btn:hover, .action-btn:hover {
    background-color: #6e6e6e;
    transform: translateY(-2px);
}

.mode-btn.active, .player-btn.active {
    background-color: var(--primary-color);
    color: var(--button-text);
}

.player-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.player-1, .player-2 {
    flex: 1;
    min-width: 300px;
}

.player-names {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.player-btn {
    flex: 0 0 auto;
    margin: 5px;
}

@media (max-width: 480px) {
    .player-names {
        justify-content: flex-start;
    }
    
    .player-btn {
        font-size: 0.9rem;
        padding: 8px 12px;
    }
}

.game-settings {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.setting label {
    font-weight: bold;
    color: var(--text-color);
}

.setting select {
    padding: 8px 15px;
    border-radius: 5px;
    border: 2px solid var(--secondary-color);
    background-color: white;
    flex: 1;
    font-size: 1rem;
}

@media (max-width: 480px) {
    .game-settings {
        flex-direction: row;
        justify-content: space-around;
        flex-wrap: wrap;
    }
    
    .setting select {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
}

.start-btn {
    background-color: var(--accent-color);
    color: var(--button-text);
    border: none;
    padding: 12px 25px;
    font-size: 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    width: 100%;
    max-width: 300px;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.start-btn:hover {
    background-color: #6e6e6e;
    transform: translateY(-2px);
}

/* Ad Space */
.ad-space {
    padding: 20px;
    background-color: #f0f0f0;
    text-align: center;
}

.ad-placeholder {
    height: 90px;
    background-color: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #999;
    border-radius: 5px;
}

/* Game Area Styles */
.game-area {
    padding: 30px;
    background-color: var(--light-color);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--dark-color);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    flex: 1;
}

.game-actions {
    display: flex;
    gap: 10px;
    margin-left: 20px;
}

.reset-btn {
    background-color: #6c757d;
}

.reset-btn:hover {
    background-color: #5a6268;
}

.quit-btn {
    background-color: #dc3545;
}

.quit-btn:hover {
    background-color: #c82333;
}

.team-score h3 {
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.score-details {
    font-size: 1.8rem;
    font-weight: bold;
}

.overs {
    font-size: 1rem;
    opacity: 0.8;
}

.target-score {
    font-size: 1.2rem;
    font-weight: bold;
    background-color: var(--primary-color);
    padding: 8px 15px;
    border-radius: 5px;
}

.game-field {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

/* Book Styles */
.book-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.book {
    width: 300px;
    height: 400px;
    perspective: 1500px;
}

.book-cover {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateY(-30deg);
    transition: transform 1s ease;
}

.book-spine {
    position: absolute;
    width: 50px;
    height: 100%;
    left: 0;
    background-color: var(--book-color);
    transform: rotateY(90deg) translateZ(25px);
    box-shadow: inset -5px 0 10px rgba(0, 0, 0, 0.2);
}

.book-front {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--book-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 0 5px 5px 0;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
    color: var(--light-color);
    padding: 20px;
    text-align: center;
}

.book-front h2 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.book-front p {
    font-size: 1.2rem;
}

.book-pages {
    position: absolute;
    width: 290px;
    height: 390px;
    top: 5px;
    left: 5px;
    background-color: var(--book-page);
    border-radius: 0 5px 5px 0;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    transform: translateZ(-1px);
}

.page {
    width: 90%;
    height: 90%;
    background-color: var(--book-page);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 5rem;
    color: var(--text-color);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.05);
}

/* Ball Tracker Styles */
.ball-tracker {
    flex: 1;
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.ball-tracker h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    text-align: center;
}

.balls-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.ball {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    background-color: var(--secondary-color);
}

.ball.out {
    background-color: var(--out-color);
}

.ball.four {
    background-color: var(--four-color);
}

.ball.six {
    background-color: var(--six-color);
}

.ball.wide {
    background-color: var(--wide-color);
}

.ball.noball {
    background-color: var(--noball-color);
}

/* Game Controls */
.game-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.status-message {
    font-size: 1.2rem;
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    background-color: var(--accent-color);
    width: 100%;
}

.action-buttons {
    display: flex;
    gap: 15px;
}

.action-btn {
    padding: 12px 25px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.primary-btn {
    background-color: #007bff;
    padding: 15px 30px;
    font-size: 1.1rem;
}

.primary-btn:hover {
    background-color: #0069d9;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #3b5998;
}

.share-btn:hover {
    background-color: #4c70ba;
}

/* Game Result */
.game-result {
    background-color: rgba(0, 0, 0, 0.8);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 100;
}

.game-result h2 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.game-result p {
    font-size: 1.5rem;
    margin-bottom: 30px;
    text-align: center;
    max-width: 80%;
}

/* Celebration Animations */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

.celebration-text {
    font-size: 8rem;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    animation: pulse 0.5s infinite alternate;
}

.four .celebration-text {
    color: var(--four-color);
}

.six .celebration-text {
    color: var(--six-color);
}

.out .celebration-text {
    color: var(--out-color);
}

.confetti {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

@keyframes pulse {
    from {
        transform: scale(1);
        opacity: 0.8;
    }
    to {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #aaa;
}

.close-modal:hover {
    color: #333;
}

.modal h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
}

.modal p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.modal ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal li {
    margin-bottom: 8px;
}

/* Contact Form */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: bold;
    color: var(--primary-color);
}

.form-group input,
.form-group textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.submit-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background-color: var(--secondary-color);
}

/* Footer Styles */
footer {
    background-color: var(--dark-color);
    color: white;
    padding: 30px;
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent-color);
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent-color);
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icons a {
    color: white;
    font-size: 1.5rem;
    transition: color 0.3s ease;
}

.social-icons a:hover {
    color: var(--accent-color);
}

.copyright {
    margin-top: 20px;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 992px) {
    .game-field {
        flex-direction: column;
    }
    
    .book {
        width: 250px;
        height: 350px;
    }
    
    .book-pages {
        width: 240px;
        height: 340px;
    }
}

@media (max-width: 768px) {
    .player-selection {
        flex-direction: column;
    }
    
    .player-1, .player-2 {
        width: 100%;
    }
    
    .game-settings {
        flex-direction: column;
        gap: 15px;
    }
    
    .scoreboard {
        flex-direction: column;
        gap: 10px;
    }
    
    .balls-container {
        grid-template-columns: repeat(4, 1fr);
    }
    
    header {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-actions {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 576px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .game-setup, .game-area {
        padding: 15px;
    }
    
    .mode-options {
        flex-direction: column;
    }
    
    .balls-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .action-btn {
        width: 100%;
    }
    
    header nav ul {
        flex-direction: column;
        gap: 10px;
    }
}