@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&display=swap');

body {
    font-family: 'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', cursive, sans-serif;
    background: linear-gradient(135deg, #FFD89B 0%, #FEFBE3 50%, #FFB8D1 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    color: #333;
    overflow: hidden; /* Prevent scrolling */
}

/* Utility */
.hidden {
    display: none !important;
}

/* Landing Page & Overlays */
.full-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #FEFBE3;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-out;
}

.landing-content {
    text-align: center;
    background: linear-gradient(145deg, #FFF4A3 0%, #FFEB99 100%);
    padding: 20px 40px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(139, 90, 0, 0.4), 0 0 30px rgba(255, 200, 100, 0.3);
    border: 6px solid #6ec5cd;
    max-width: 90%;
    animation: floatIn 0.8s ease-out;
}

.big-logo {
    font-size: 42px;
    margin: 0;
    color: #5d4037; /* Dark brown */
    text-shadow: 3px 3px 0px #FF6B6B, 5px 5px 0px #6ec5cd;
    margin-bottom: 15px;
    font-weight: 900;
    letter-spacing: 2px;
    animation: wiggle 2s infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-2deg); }
    75% { transform: rotate(2deg); }
}

.subtitle {
    font-size: 16px;
    color: #795548;
    margin-bottom: 30px;
    font-weight: 600;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.play-btn {
    background: linear-gradient(145deg, #7ED6DE 0%, #6ec5cd 100%);
    color: #fff;
    border: 3px solid #5d4037;
    padding: 12px 28px;
    border-radius: 50px;
    font-size: 18px;
    cursor: pointer;
    font-weight: 900;
    transition: all 0.2s;
    box-shadow: 0 6px 0 #5d4037, 0 0 20px rgba(110, 197, 205, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.play-btn:hover {
    background: linear-gradient(145deg, #8FE5ED 0%, #7ED6DE 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 0 #5d4037, 0 0 30px rgba(110, 197, 205, 0.7);
}

.play-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #5d4037;
}

.secondary-btn {
    background: linear-gradient(145deg, #FFEE7A 0%, #f6ea56 100%);
    color: #5d4037;
    border: 3px solid #5d4037;
    padding: 10px 28px;
    border-radius: 50px;
    font-size: 17px;
    cursor: pointer;
    font-weight: 900;
    box-shadow: 0 5px 0 #5d4037, 0 0 15px rgba(246, 234, 86, 0.4);
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.secondary-btn:hover {
    background-color: #FEFBE3;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #5d4037;
}

.secondary-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #5d4037;
}

/* Game Container */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(145deg, #FFE5CC 0%, #FFD4A8 100%);
    padding: 10px;
    border-radius: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15), 0 0 40px rgba(255, 180, 100, 0.2);
    border: 5px solid #6ec5cd;
    width: 98vw;
    height: 98vh;
    overflow: hidden;
}

.top-panel {
    width: 100%;
    background-color: #FEFBE3;
    border: 2px solid #6ec5cd;
    box-shadow: 0 4px 0 #5d4037;
    padding: 5px 20px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
    flex: 0 0 auto;
    position: relative;
}

.rules-btn {
    position: absolute;
    right: 20px;
    background: linear-gradient(145deg, #FFD54F 0%, #FFC107 100%);
    border: 3px solid #5d4037;
    border-radius: 25px;
    padding: 10px 18px;
    font-weight: 900;
    cursor: pointer;
    color: #5d4037;
    box-shadow: 0 4px 0 #f57f17, 0 0 15px rgba(255, 213, 79, 0.5);
    font-size: 18px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rules-btn:hover {
    background: linear-gradient(145deg, #FFE082 0%, #FFD54F 100%);
    transform: translateY(-2px) rotate(-5deg);
    box-shadow: 0 6px 0 #f57f17, 0 0 25px rgba(255, 213, 79, 0.7);
}

.rules-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #5d4037;
}

.rules-content {
    max-width: 600px;
    width: 90%;
    text-align: left;
    max-height: 80vh;
    overflow-y: auto;
}

.rules-list {
    margin: 15px 0;
    font-size: 16px;
    line-height: 1.5;
    color: #3e2723;
}

.rules-list h3 {
    color: #5d4037;
    border-bottom: 2px solid #6ec5cd;
    padding-bottom: 5px;
    margin-top: 20px;
    margin-bottom: 10px;
}

.rules-list ul, .rules-list ol {
    padding-left: 25px;
    margin-bottom: 15px;
}

.rules-list li {
    margin-bottom: 8px;
}

.game-title {
    margin: 0;
    font-size: 32px;
    color: #5d4037;
    text-shadow: 2px 2px 0 #FF6B6B, 4px 4px 0 #6ec5cd;
    font-weight: 900;
    letter-spacing: 2px;
    text-align: center;
}

.main-content {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    gap: 10px;
}

.game-board-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    overflow: hidden;
}

canvas {
    background: #FEFBE3;
    background-image: url('board.png');
    background-size: cover;
    background-position: center;
    cursor: pointer;
    border: 4px solid #6ec5cd;
    border-radius: 15px;
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.side-panel {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px;
}

.stats-box {
    background: linear-gradient(145deg, #FFF8E1 0%, #FFECB3 100%);
    border: 4px solid #6ec5cd;
    padding: 20px;
    border-radius: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15), 0 0 25px rgba(110, 197, 205, 0.3);
}

.stats-box h2 {
    margin: 0 0 10px 0;
    color: #5d4037;
    text-align: center;
    font-size: 28px;
    border-bottom: 3px dashed #6ec5cd;
    padding-bottom: 10px;
    text-shadow: 2px 2px 0 #FFE082;
    font-weight: 900;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 14px;
    color: #795548;
    font-weight: bold;
    text-transform: uppercase;
}

.stat-value {
    font-size: 20px;
    color: #d35400;
    font-weight: 800;
    background: linear-gradient(145deg, #FFE4F0 0%, #FFD4E8 100%);
    padding: 8px 12px;
    border-radius: 15px;
    border: 2px solid #ff69b4;
    box-shadow: 0 3px 8px rgba(255, 105, 180, 0.2);
}

.message-box {
    margin-top: 10px;
    background: linear-gradient(145deg, #D4FFEA 0%, #B8F5D8 100%);
    padding: 12px;
    border-radius: 20px;
    border: 3px solid #4CAF50;
    color: #2E7D32;
    font-weight: bold;
    text-align: center;
    font-size: 17px;
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
    animation: pulse 2s infinite;
}

.bottom-controls {
    width: 100%;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #FEFBE3;
    border: 2px solid #6ec5cd;
    box-shadow: 0 4px 0 #f9a825;
    border-radius: 10px;
    margin-top: 5px;
    flex: 0 0 auto;
}

.control-btn, .exit-btn {
    background: linear-gradient(145deg, #7ED6DE 0%, #6ec5cd 100%);
    color: white;
    border: 3px solid #5d4037;
    padding: 10px 22px;
    border-radius: 20px;
    font-size: 18px;
    cursor: pointer;
    font-weight: 900;
    box-shadow: 0 4px 0 #5d4037, 0 0 15px rgba(110, 197, 205, 0.4);
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.exit-btn {
    background: linear-gradient(145deg, #FF7A5C 0%, #d35400 100%);
    border-color: #bf360c;
    box-shadow: 0 4px 0 #bf360c, 0 0 15px rgba(255, 122, 92, 0.4);
}

.control-btn:active, .exit-btn:active {
    transform: translateY(3px);
    box-shadow: 0 0 0;
}

.legend-box {
    display: flex;
    gap: 20px;
    background: linear-gradient(145deg, #D4EBFF 0%, #C4E0FF 100%);
    padding: 8px 25px;
    border-radius: 20px;
    border: 3px solid #6ec5cd;
    box-shadow: 0 3px 8px rgba(110, 197, 205, 0.3);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    font-size: 18px;
    color: #5d4037;
}

.emoji {
    font-size: 24px;
}

/* Remove old styles */
.game-stats, .stat-row, .stat-msg, .header-bar {
    display: none;
}

/* Winner Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(93, 64, 55, 0.8); /* Dark brown overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-content {
    background: linear-gradient(145deg, #FFE9A0 0%, #FFDC7F 100%);
    padding: 60px;
    border-radius: 30px;
    text-align: center;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5), 0 0 50px rgba(255, 200, 100, 0.4);
    border: 10px solid #6ec5cd;
    transform: scale(1.1);
    animation: popIn 0.5s ease-out;
}

#winner-title {
    font-size: 52px;
    color: #d35400; /* Dark orange/brown */
    margin: 0 0 20px 0;
    text-shadow: 3px 3px 0px #FF6B6B, 5px 5px 0px #4ECDC4, 7px 7px 0px #FFE66D;
    font-weight: 900;
    animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

#winner-message {
    font-size: 24px;
    color: #5d4037;
    margin-bottom: 30px;
    font-weight: 700;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes floatIn {
    0% { 
        transform: translateY(-50px) scale(0.8); 
        opacity: 0; 
    }
    60% { 
        transform: translateY(10px) scale(1.05); 
    }
    100% { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

h1 {
    color: #444;
    margin-bottom: 5px;
    font-size: 24px;
}


.status-panel {
    background-color: #fcf8e3;
    border: 1px solid #e0c060;
    padding: 20px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    margin-bottom: 0;
}

#turn-text {
    font-weight: bold;
    color: #d35400;
}

canvas {
    background: #FEFBE3;
    background-image: url('board.png'); /* Uses the provided board image */
    background-size: cover;
    background-position: center;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 10px;
    /* Responsive sizing */
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.controls {
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

button {
    background-color: #6ec5cd;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

button:hover {
    background-color: #a06b00;
}

.legend {
    display: flex;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
}

.dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid #333;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.tiger-dot {
    background-color: black;
}

.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: 100;
}

.menu-content {
    background: linear-gradient(145deg, #FFE9A0 0%, #FFDC7F 100%);
    padding: 40px;
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border: 5px solid #6ec5cd;
}

.menu-content h2 {
    margin-top: 0;
    color: #333;
    margin-bottom: 30px;
}

.menu-content button {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 15px;
    font-size: 18px;
}

.hidden {
    display: none !important;
}

.goat-dot {
    background-color: white;
}

@media (max-width: 1000px) {
    .game-container {
        flex-direction: column;
        max-height: 98vh;
        padding: 10px;
        gap: 10px;
    }
    
    .game-info-section {
        width: 100%;
        max-width: 600px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .status-panel, .controls, .header-bar {
        flex: 1;
        min-width: 200px;
    }

    canvas {
        max-height: 60vh;
    }
}
/* New Menu Layout */
.menu-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.menu-row {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.play-btn.selected {
    background-color: #f6ea56; /* Yellow for selected */
    color: #5d4037; /* Dark brown text */
    border-color: #5d4037;
    box-shadow: inset 0 4px 0 #5d4037;
    transform: translateY(2px);
}

.play-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.8);
}

.start-btn {
    background: linear-gradient(145deg, #A5D84E 0%, #76C043 100%);
    color: white;
    border: 4px solid #5d4037;
    padding: 14px 45px;
    border-radius: 50px;
    font-size: 24px;
    cursor: pointer;
    font-weight: 900;
    margin-top: 20px;
    box-shadow: 0 8px 0 #1b5e20, 0 0 30px rgba(165, 216, 78, 0.6);
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: pulse 2s infinite;
}

.start-btn:hover {
    background: linear-gradient(145deg, #B6E85E 0%, #87D154 100%);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 0 #1b5e20, 0 0 40px rgba(165, 216, 78, 0.8);
}

.start-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #1b5e20;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    body {
        height: auto;
        overflow-y: auto;
        display: block;
    }

    .game-container {
        height: auto;
        min-height: 100vh;
        width: 100%;
        padding: 5px;
        border: none;
        border-radius: 0;
        overflow: visible;
        justify-content: flex-start;
    }

    .main-content {
        flex-direction: column;
        flex: 0 0 auto;
    }

    .side-panel {
        flex: 0 0 auto;
        width: 100%;
        flex-direction: row;
        padding: 5px;
        order: -1; /* Move stats above board */
    }

    .stats-box {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px;
        width: 100%;
        justify-content: space-around;
        align-items: center;
    }

    .stat-item {
        margin-bottom: 0;
        font-size: 14px;
    }

    .message-box {
        margin-top: 0;
        padding: 5px 10px;
        font-size: 14px;
        width: auto;
    }

    .game-title {
        font-size: 20px;
        text-align: left;
    }

    .top-panel {
        padding: 5px 10px;
        margin-bottom: 0;
        justify-content: space-between;
    }
    
    .rules-btn {
        position: static;
        font-size: 14px;
        padding: 5px 10px;
    }

    .bottom-controls {
        padding: 10px;
        margin-top: 10px;
        margin-bottom: 20px;
    }

    .control-btn, .exit-btn {
        padding: 8px 15px;
        font-size: 14px;
    }

    .legend-box {
        padding: 5px 10px;
    }
    
    .landing-content {
        padding: 30px 20px;
        width: 90%;
    }
    
    .big-logo {
        font-size: 40px;
    }
    
    .menu-row {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .play-btn {
        width: 100%;
        padding: 10px 20px;
        font-size: 18px;
    }

    .start-btn {
        padding: 12px 40px;
        font-size: 22px;
        width: 100%;
        margin-top: 10px;
    }

    .menu-section {
        gap: 10px;
    }
    
    canvas {
        max-height: 50vh;
    }
}
