/* ===============================================
   CARROT IN A BOX - Main Stylesheet
   Retro Pixel Art Theme
   =============================================== */

/* Root Variables - Retro Color Palette */
:root {
    --pixel-bg-dark: #1a1a2e;
    --pixel-bg-medium: #16213e;
    --pixel-bg-light: #0f3460;
    --pixel-primary: #533483;
    --pixel-accent: #ff6b35;
    --pixel-carrot: #ff8c42;
    --pixel-box-wood: #8b4513;
    --pixel-box-shadow: #5d2f0a;
    --pixel-text: #eaeaea;
    --pixel-text-shadow: #333333;
    --pixel-border: #0f3460;
    --pixel-success: #4caf50;
    --pixel-warning: #ff9800;
    --pixel-danger: #f44336;
    --pixel-player1: #4169e1;
    --pixel-player2: #dc143c;
}

/* Base Reset and Typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Press Start 2P', monospace;
    background: linear-gradient(135deg, var(--pixel-bg-dark) 0%, var(--pixel-bg-medium) 100%);
    color: var(--pixel-text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    font-size: 12px;
}

/* Pixel Text Styling */
.pixel-text {
    text-shadow: 2px 2px 0 var(--pixel-text-shadow);
    letter-spacing: 1px;
}

/* Game Header */
.game-header {
    background: var(--pixel-bg-light);
    padding: 20px;
    text-align: center;
    border-bottom: 4px solid var(--pixel-border);
    position: relative;
}

.game-title {
    font-size: 24px;
    color: var(--pixel-accent);
    margin-bottom: 10px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 2px 2px 0 var(--pixel-text-shadow), 0 0 10px var(--pixel-accent); }
    to { text-shadow: 2px 2px 0 var(--pixel-text-shadow), 0 0 20px var(--pixel-accent), 0 0 30px var(--pixel-accent); }
}

.round-info {
    font-size: 14px;
    color: var(--pixel-text);
}

/* Main Game Container */
.game-container {
    display: flex;
    min-height: 400px;
    padding: 20px;
    gap: 0;
    position: relative;
}

/* Player Sections */
.player-section {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid var(--pixel-border);
}

.player-1 {
    border-right: none;
    background: linear-gradient(90deg, transparent 0%, rgba(65, 105, 225, 0.1) 100%);
}

.player-2 {
    border-left: none;
    background: linear-gradient(90deg, rgba(220, 20, 60, 0.1) 0%, transparent 100%);
}

/* Center Divider */
.center-divider {
    width: 4px;
    background: var(--pixel-border);
    position: relative;
    box-shadow:
        -2px 0 0 rgba(0, 0, 0, 0.3),
        2px 0 0 rgba(0, 0, 0, 0.3);
}

.divider-decoration {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: var(--pixel-accent);
    border: 2px solid var(--pixel-border);
    transform-origin: center;
}

/* Player Header */
.player-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    gap: 10px;
}

.player-avatar {
    width: 64px;
    height: 64px;
    background: var(--pixel-primary);
    border: 3px solid var(--pixel-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.player-1 .player-avatar {
    background: var(--pixel-player1);
}

.player-2 .player-avatar {
    background: var(--pixel-player2);
}

.player-name {
    font-size: 16px;
    margin: 10px 0 5px;
}

.player-score {
    font-size: 10px;
    color: var(--pixel-warning);
}

/* Box Container */
.box-container {
    width: 200px;
    height: 200px;
    position: relative;
    margin: 20px 0;
    perspective: 600px;
}

.box {
    width: 100%;
    height: 100%;
    position: relative;
    background: var(--pixel-box-wood);
    border: 4px solid var(--pixel-box-shadow);
    cursor: pointer;
    transition: transform 0.3s;
}

.box:hover {
    transform: translateY(-5px);
}

.box-lid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(180deg, var(--pixel-box-wood) 0%, var(--pixel-box-shadow) 100%);
    border-bottom: 3px solid var(--pixel-box-shadow);
    transform-origin: top;
    transition: transform 0.5s;
    z-index: 2;
}

.box-inside {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: #2a1810;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.box[data-state="open"] .box-lid {
    transform: rotateX(-90deg);
}

/* Carrot Sprite (CSS-based for now) */
.carrot {
    width: 60px;
    height: 80px;
    background: var(--pixel-carrot);
    position: relative;
    clip-path: polygon(50% 0%, 30% 20%, 20% 100%, 80% 100%, 70% 20%);
}

.carrot::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 20px;
    background: #228b22;
    clip-path: polygon(20% 100%, 0% 0%, 50% 30%, 100% 0%, 80% 100%);
}

/* Carrot Emoji in Box */
.carrot-emoji {
    font-size: 60px;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

/* Player Controls */
.player-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    min-height: 120px; /* Ensure consistent height */
}

.player-status {
    font-size: 10px;
    padding: 5px 10px;
    background: var(--pixel-bg-light);
    border: 2px solid var(--pixel-border);
    color: var(--pixel-text);
}

/* Control Area */
.control-area {
    background: var(--pixel-bg-light);
    padding: 20px;
    border: 4px solid var(--pixel-border);
    border-top: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.game-state-display {
    text-align: center;
    padding: 10px;
}

.state-text {
    font-size: 14px;
    color: var(--pixel-warning);
}

/* Timer */
.timer-container {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    background: var(--pixel-bg-dark);
    border: 3px solid var(--pixel-accent);
}

.timer-label {
    font-size: 12px;
    color: var(--pixel-accent);
}

.timer-display {
    font-size: 24px;
    color: var(--pixel-warning);
    min-width: 60px;
    text-align: center;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

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

/* Player-specific decision buttons */
.player-decision {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    animation: fadeIn 0.5s ease-out;
}

.player-decision .retro-btn {
    font-size: 10px;
    padding: 12px 20px;
}

/* Retro Button Style */
.retro-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    padding: 15px 30px;
    background: var(--pixel-primary);
    color: var(--pixel-text);
    border: 3px solid var(--pixel-border);
    cursor: pointer;
    position: relative;
    text-transform: uppercase;
    transition: all 0.1s;
    box-shadow:
        inset -3px -3px 0 rgba(0, 0, 0, 0.3),
        inset 3px 3px 0 rgba(255, 255, 255, 0.1),
        3px 3px 0 rgba(0, 0, 0, 0.5);
}

.retro-btn:hover {
    background: var(--pixel-accent);
    transform: translate(-2px, -2px);
    box-shadow:
        inset -3px -3px 0 rgba(0, 0, 0, 0.3),
        inset 3px 3px 0 rgba(255, 255, 255, 0.1),
        5px 5px 0 rgba(0, 0, 0, 0.5);
}

.retro-btn:active {
    transform: translate(1px, 1px);
    box-shadow:
        inset -2px -2px 0 rgba(0, 0, 0, 0.3),
        inset 2px 2px 0 rgba(255, 255, 255, 0.1),
        1px 1px 0 rgba(0, 0, 0, 0.5);
}

.peek-btn {
    background: var(--pixel-warning);
}

.keep-btn {
    background: var(--pixel-success);
}

.swap-btn {
    background: var(--pixel-danger);
}

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

.modal-content {
    background: var(--pixel-bg-medium);
    padding: 30px;
    max-width: 500px;
    text-align: center;
}

.modal-title {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--pixel-accent);
}

.modal-body {
    margin: 20px 0;
}

.winner-carrot {
    width: 80px;
    height: 100px;
    margin: 20px auto;
    background: var(--pixel-carrot);
    clip-path: polygon(50% 0%, 30% 20%, 20% 100%, 80% 100%, 70% 20%);
}

.modal-text {
    font-size: 12px;
    margin: 10px 0;
}

.modal-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

/* Instructions Overlay */
.instructions-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.instructions-content {
    background: var(--pixel-bg-medium);
    padding: 30px;
    max-width: 600px;
}

.instructions-content h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--pixel-accent);
}

.instructions-list {
    list-style: none;
    text-align: left;
    margin: 20px 0;
}

.instructions-list li {
    margin: 15px 0;
    padding-left: 30px;
    position: relative;
    font-size: 10px;
    line-height: 1.8;
}

.instructions-list li::before {
    content: '>';
    position: absolute;
    left: 10px;
    color: var(--pixel-accent);
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
    }

    .center-divider {
        width: 100%;
        height: 4px;
    }

    .player-section {
        border: 2px solid var(--pixel-border) !important;
        margin-bottom: 10px;
    }

    .box-container {
        width: 150px;
        height: 150px;
    }
}

/* ===============================================
   Advertisement Container Styles
   =============================================== */

.ad-container {
    text-align: center;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    margin: 10px auto;
    border: 2px solid var(--pixel-border);
    max-width: 100%;
    overflow: hidden;
}

.ad-container.ad-banner-top {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.ad-placeholder {
    color: var(--pixel-text);
    opacity: 0.5;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.ad-interstitial {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: var(--pixel-bg-dark);
    padding: 20px;
    min-width: 300px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-sidebar {
    position: fixed;
    right: 10px;
    top: 100px;
    width: 160px;
    height: 600px;
}

.desktop-only {
    display: none;
}

@media (min-width: 1200px) {
    .desktop-only {
        display: block;
    }
}

/* Cookie Notice Styles */
.cookie-notice {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--pixel-bg-dark);
    border-top: 2px solid var(--pixel-accent);
    padding: 15px;
    z-index: 2000;
    box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.3);
}

.cookie-notice-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.cookie-notice p {
    color: var(--pixel-text);
    margin: 0;
    flex: 1;
}

.cookie-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.privacy-link {
    color: var(--pixel-accent);
    text-decoration: none;
}

.privacy-link:hover {
    text-decoration: underline;
}

/* Hide ads when ad-free */
body.ad-free .ad-container {
    display: none !important;
}