/**
 * Borderlands Tic-Tac-Toe Styles
 * Cel-shaded, comic book aesthetic
 */

.bttt-container {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    font-family: 'Permanent Marker', cursive;
    position: relative;
    border-radius: 10px;
    max-width: 500px;
    margin: 20px auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 4px solid #000;
}

/* Grungy texture overlay */
.bttt-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.1) 2px,
            rgba(0,0,0,0.1) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.05) 2px,
            rgba(0,0,0,0.05) 4px
        );
    pointer-events: none;
    z-index: 1;
}

.bttt-container > * {
    position: relative;
    z-index: 2;
}

/* Title styles */
.bttt-title {
    font-family: 'Bangers', cursive !important;
    font-size: 3rem !important;
    color: #f4d03f !important;
    text-shadow:
        4px 4px 0 #000,
        -2px -2px 0 #000,
        2px -2px 0 #000,
        -2px 2px 0 #000,
        5px 5px 0 #c9a227,
        6px 6px 10px rgba(0,0,0,0.5) !important;
    letter-spacing: 4px;
    margin: 0 0 10px 0 !important;
    padding: 0 !important;
    transform: skewX(-5deg);
    animation: btttTitlePulse 2s ease-in-out infinite;
    line-height: 1.2 !important;
}

@keyframes btttTitlePulse {
    0%, 100% { transform: skewX(-5deg) scale(1); }
    50% { transform: skewX(-5deg) scale(1.02); }
}

.bttt-subtitle {
    font-family: 'Permanent Marker', cursive !important;
    font-size: 1.2rem !important;
    color: #e74c3c !important;
    text-shadow: 2px 2px 0 #000 !important;
    margin: 0 0 25px 0 !important;
    letter-spacing: 2px;
}

/* Mode selection buttons */
.bttt-mode-selection {
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.bttt-mode-btn {
    font-family: 'Bangers', cursive !important;
    font-size: 1.3rem !important;
    padding: 12px 30px !important;
    border: 4px solid #000 !important;
    background: linear-gradient(180deg, #f39c12 0%, #d68910 50%, #b9770e 100%) !important;
    color: #000 !important;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    box-shadow:
        5px 5px 0 #000,
        inset 2px 2px 0 rgba(255,255,255,0.3),
        inset -2px -2px 0 rgba(0,0,0,0.2) !important;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.3) !important;
    letter-spacing: 2px;
    border-radius: 0 !important;
    line-height: 1 !important;
}

.bttt-mode-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow:
        7px 7px 0 #000,
        inset 2px 2px 0 rgba(255,255,255,0.3),
        inset -2px -2px 0 rgba(0,0,0,0.2) !important;
    background: linear-gradient(180deg, #f5b041 0%, #eb984e 50%, #dc7633 100%) !important;
}

.bttt-mode-btn:active {
    transform: translate(2px, 2px);
    box-shadow:
        3px 3px 0 #000,
        inset 2px 2px 0 rgba(255,255,255,0.3),
        inset -2px -2px 0 rgba(0,0,0,0.2) !important;
}

.bttt-mode-btn.active {
    background: linear-gradient(180deg, #27ae60 0%, #1e8449 50%, #196f3d 100%) !important;
    color: #fff !important;
    text-shadow: 1px 1px 0 #000 !important;
}

/* Status display */
.bttt-status {
    font-family: 'Bangers', cursive !important;
    font-size: 1.8rem !important;
    color: #3498db !important;
    text-shadow:
        3px 3px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000 !important;
    margin-bottom: 20px !important;
    min-height: 40px;
    letter-spacing: 2px;
}

.bttt-status.winner {
    color: #2ecc71 !important;
    animation: btttWinPulse 0.5s ease-in-out infinite;
}

.bttt-status.draw {
    color: #e74c3c !important;
}

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

/* Game board */
.bttt-board {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 100px);
    gap: 8px;
    margin: 0 auto 25px;
    padding: 15px;
    background: linear-gradient(145deg, #2c3e50 0%, #1a252f 100%);
    border: 5px solid #000;
    box-shadow:
        8px 8px 0 #000,
        inset 0 0 30px rgba(0,0,0,0.5);
    position: relative;
    width: fit-content;
}

/* Comic-style corner decorations */
.bttt-board::before,
.bttt-board::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    border: 4px solid #f4d03f;
    z-index: 10;
}

.bttt-board::before {
    top: -6px;
    left: -6px;
    border-right: none;
    border-bottom: none;
}

.bttt-board::after {
    bottom: -6px;
    right: -6px;
    border-left: none;
    border-top: none;
}

.bttt-cell {
    width: 100px;
    height: 100px;
    background: linear-gradient(145deg, #34495e 0%, #2c3e50 50%, #1a252f 100%);
    border: 4px solid #000 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Bangers', cursive !important;
    font-size: 4rem !important;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow:
        inset 3px 3px 0 rgba(255,255,255,0.1),
        inset -3px -3px 0 rgba(0,0,0,0.3);
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
}

.bttt-cell:hover:not(.taken) {
    background: linear-gradient(145deg, #4a6278 0%, #3d566d 50%, #2c3e50 100%);
    transform: scale(1.05);
    z-index: 10;
}

.bttt-cell.taken {
    cursor: not-allowed;
}

/* X marker */
.bttt-cell.x {
    color: #e74c3c !important;
    text-shadow:
        3px 3px 0 #000,
        -2px -2px 0 #000,
        2px -2px 0 #000,
        -2px 2px 0 #000,
        0 0 20px rgba(231, 76, 60, 0.5) !important;
    animation: btttPlaceMarker 0.3s ease-out;
}

/* O marker */
.bttt-cell.o {
    color: #3498db !important;
    text-shadow:
        3px 3px 0 #000,
        -2px -2px 0 #000,
        2px -2px 0 #000,
        -2px 2px 0 #000,
        0 0 20px rgba(52, 152, 219, 0.5) !important;
    animation: btttPlaceMarker 0.3s ease-out;
}

@keyframes btttPlaceMarker {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.bttt-cell.winning {
    animation: btttWinningCell 0.5s ease-in-out infinite;
    background: linear-gradient(145deg, #27ae60 0%, #1e8449 50%, #196f3d 100%) !important;
}

@keyframes btttWinningCell {
    0%, 100% {
        box-shadow:
            inset 3px 3px 0 rgba(255,255,255,0.1),
            inset -3px -3px 0 rgba(0,0,0,0.3),
            0 0 20px #2ecc71;
    }
    50% {
        box-shadow:
            inset 3px 3px 0 rgba(255,255,255,0.1),
            inset -3px -3px 0 rgba(0,0,0,0.3),
            0 0 40px #2ecc71;
    }
}

/* Reset button */
.bttt-reset-btn {
    font-family: 'Bangers', cursive !important;
    font-size: 1.5rem !important;
    padding: 12px 40px !important;
    border: 4px solid #000 !important;
    background: linear-gradient(180deg, #e74c3c 0%, #c0392b 50%, #a93226 100%) !important;
    color: #fff !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow:
        5px 5px 0 #000,
        inset 2px 2px 0 rgba(255,255,255,0.3),
        inset -2px -2px 0 rgba(0,0,0,0.2) !important;
    text-shadow: 2px 2px 0 #000 !important;
    letter-spacing: 3px;
    border-radius: 0 !important;
    line-height: 1 !important;
}

.bttt-reset-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow:
        7px 7px 0 #000,
        inset 2px 2px 0 rgba(255,255,255,0.3),
        inset -2px -2px 0 rgba(0,0,0,0.2) !important;
    background: linear-gradient(180deg, #ec7063 0%, #e74c3c 50%, #c0392b 100%) !important;
}

.bttt-reset-btn:active {
    transform: translate(2px, 2px);
    box-shadow:
        3px 3px 0 #000,
        inset 2px 2px 0 rgba(255,255,255,0.3),
        inset -2px -2px 0 rgba(0,0,0,0.2) !important;
}

/* Scoreboard */
.bttt-scoreboard {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.bttt-score-item {
    font-family: 'Bangers', cursive !important;
    font-size: 1.2rem !important;
    padding: 8px 20px !important;
    border: 3px solid #000 !important;
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%) !important;
    box-shadow: 4px 4px 0 #000 !important;
    border-radius: 0 !important;
}

.bttt-score-item.bttt-player-x {
    color: #e74c3c !important;
    text-shadow: 2px 2px 0 #000 !important;
}

.bttt-score-item.bttt-player-o {
    color: #3498db !important;
    text-shadow: 2px 2px 0 #000 !important;
}

.bttt-score-item.bttt-draws {
    color: #f4d03f !important;
    text-shadow: 2px 2px 0 #000 !important;
}

/* Difficulty selector */
.bttt-difficulty-selector {
    margin-bottom: 20px;
    display: none;
}

.bttt-difficulty-selector.visible {
    display: block;
}

.bttt-difficulty-label {
    font-family: 'Permanent Marker', cursive !important;
    color: #f4d03f !important;
    text-shadow: 2px 2px 0 #000 !important;
    margin-bottom: 10px !important;
    font-size: 1.1rem !important;
}

.bttt-difficulty-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.bttt-diff-btn {
    font-family: 'Bangers', cursive !important;
    font-size: 1rem !important;
    padding: 8px 18px !important;
    border: 3px solid #000 !important;
    background: linear-gradient(180deg, #9b59b6 0%, #8e44ad 50%, #7d3c98 100%) !important;
    color: #fff !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 3px 3px 0 #000 !important;
    text-shadow: 1px 1px 0 #000 !important;
    border-radius: 0 !important;
    line-height: 1 !important;
}

.bttt-diff-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 #000 !important;
}

.bttt-diff-btn.active {
    background: linear-gradient(180deg, #2ecc71 0%, #27ae60 50%, #1e8449 100%) !important;
}

/* Explosion effect */
.bttt-explosion {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
}

.bttt-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid #000;
    animation: btttExplode 1s ease-out forwards;
}

@keyframes btttExplode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y)) scale(0);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 500px) {
    .bttt-title {
        font-size: 2.2rem !important;
    }

    .bttt-board {
        grid-template-columns: repeat(3, 75px);
        grid-template-rows: repeat(3, 75px);
        gap: 6px;
        padding: 12px;
    }

    .bttt-cell {
        width: 75px;
        height: 75px;
        font-size: 2.8rem !important;
    }

    .bttt-mode-btn {
        font-size: 1.1rem !important;
        padding: 10px 20px !important;
    }

    .bttt-scoreboard {
        gap: 10px;
    }

    .bttt-score-item {
        font-size: 1rem !important;
        padding: 6px 12px !important;
    }
}
