/* Chalkboard Styles */

@import url('https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap');

body {
    background-color: #2b3a42;
    color: #fcfcfc;
    /* Chalkboard texture simulation */
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 60%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.1'/%3E%3C/svg%3E");
    font-family: 'Permanent Marker', cursive;
}

/* Chalk Text Effect */
.chalkboard-text {
    text-shadow: 2px 2px 0px rgba(0,0,0,0.2);
}

.chalkboard-border {
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 2px 5px 3px 255px / 255px 3px 225px 5px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
}

/* Mode Buttons */
.mode-btn {
    border: 3px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.5);
    background: transparent;
    border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    border-color: rgba(255, 255, 255, 0.6);
    color: rgba(255, 255, 255, 0.8);
    transform: scale(1.05) rotate(-1deg);
}

.mode-btn.active {
    border-color: #fcfcfc;
    color: #fcfcfc;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05) rotate(-2deg);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* Cell Styling */
.cell {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: 'Permanent Marker', cursive;
    position: relative;
    font-size: 3rem;
    border: 3px solid rgba(255, 255, 255, 0.7);
    border-radius: 2px;
    background: transparent;
    transition: background-color 0.2s;
}

.cell:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Player Colors */
.cell.x {
    color: #ff8c94; /* Pastel Chalk Pink */
    text-shadow: 0 0 2px #ff8c94;
}

.cell.o {
    color: #84c1ff; /* Pastel Chalk Blue */
    text-shadow: 0 0 2px #84c1ff;
}

.cell.triangle {
    color: #fdfd96; /* Pastel Chalk Yellow */
    text-shadow: 0 0 2px #fdfd96;
}

/* Scribble Animation */
@keyframes scribble {
    0% { 
        opacity: 0; 
        transform: scale(0.8) rotate(-10deg); 
    }
    20% {
        opacity: 0.5;
        transform: scale(0.9) rotate(5deg);
    }
    40% {
        transform: scale(0.95) rotate(-5deg);
    }
    60% {
        transform: scale(1.05) rotate(3deg);
    }
    80% {
        transform: scale(0.98) rotate(-2deg);
    }
    100% { 
        opacity: 1; 
        transform: scale(1) rotate(0deg); 
    }
}

.mark-animation {
    animation: scribble 0.4s ease-out forwards;
    display: inline-block;
}

/* Eraser Button */
.eraser-btn {
    border: none;
    background: #d4d4d4;
    background-image: linear-gradient(to bottom, #f0f0f0, #d0d0d0);
    color: #333;
    border-bottom: 6px solid #999;
    border-radius: 5px;
    transition: all 0.1s;
}

.eraser-btn:active {
    transform: translateY(4px);
    border-bottom: 2px solid #999;
}

/* Chalk Button */
.chalk-btn {
    border: 2px dashed rgba(255, 255, 255, 0.6);
    background: transparent;
    color: white;
    transition: all 0.2s;
}

.chalk-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

/* Winning Strike/Highlight */
.cell.winner {
    position: relative;
}

.cell.winner::before {
    content: '';
    position: absolute;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50% 10% 40% 5% / 10% 40% 10% 50%;
    box-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
    z-index: 10;
    transition: width 0.3s ease-out;
    pointer-events: none;
}

/* Default Horizontal (Row) */
.cell.winner.win-row::before {
    width: 90%;
    top: 50%;
    left: 5%;
    transform: translateY(-50%) rotate(-2deg);
}

/* Vertical (Col) */
.cell.winner.win-col::before {
    width: 90%;
    top: 50%;
    left: 5%;
    transform: translateY(-50%) rotate(88deg);
}

/* Diagonal Main (Top-Left to Bottom-Right) */
.cell.winner.win-diag-main::before {
    width: 130%;
    top: 50%;
    left: -15%;
    transform: translateY(-50%) rotate(43deg);
}

/* Diagonal Anti (Top-Right to Bottom-Left) */
.cell.winner.win-diag-anti::before {
    width: 130%;
    top: 50%;
    left: -15%;
    transform: translateY(-50%) rotate(-43deg);
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .cell {
        font-size: 2rem;
        border-width: 2px;
    }
    h1 {
        font-size: 2.5rem;
    }
}
