@font-face {
    font-family: 'Monocraft';
    src: url('../assets/Monocraft.woff2') format('woff2'),
         url('../assets/Monocraft.woff') format('woff'),
         url('../assets/Monocraft.ttc') format('truetype-collection');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

body {
    font-family: 'Monocraft', monospace;
    background: #0a0a0a;
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
    cursor: default;
}

.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

.circle-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #9e59d6, transparent);
    top: 20%;
    left: 10%;
    animation: float-1 8s infinite;
}

.circle-2 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, #b767f8, transparent);
    top: 60%;
    right: 15%;
    animation: float-2 10s infinite;
}

.circle-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #9e59d6, transparent);
    bottom: 10%;
    left: 20%;
    animation: float-3 12s infinite;
}

.circle-4 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, #b767f8, transparent);
    top: 10%;
    right: 30%;
    animation: float-4 6s infinite;
}

@keyframes float-1 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(calc(50vw - 150px), calc(50vh - 150px)) scale(1.2); }
    75% { transform: translate(0, 0) scale(0.9); }
    90% { transform: translate(0, 0) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes float-2 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(calc(-50vw + 125px), calc(-50vh + 125px)) scale(1.1); }
    75% { transform: translate(0, 0) scale(0.8); }
    90% { transform: translate(0, 0) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes float-3 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(calc(30vw - 200px), calc(-40vh + 200px)) scale(0.9); }
    75% { transform: translate(0, 0) scale(1.3); }
    90% { transform: translate(0, 0) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes float-4 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(calc(-30vw + 100px), calc(40vh - 100px)) scale(1.4); }
    75% { transform: translate(0, 0) scale(0.7); }
    90% { transform: translate(0, 0) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Main content styling */
.content {
    position: relative;
    z-index: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.game-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.title {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #9e59d6, #b767f8, #ffffff);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-attachment: unset;
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.1em;
    transition: opacity 0.3s ease;
}

.subtitle.hidden {
    opacity: 0;
    height: 0;
    margin: 0;
    overflow: hidden;
}

/* Glassmorphic game container */
.game-container {
    width: 98vw;
    height: 96vh;
    max-height: 96vh;
    max-width: 1800px;
    background: rgba(28, 25, 25, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Screen management */
.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.hidden {
    display: none !important;
}

/* Player selection styling */
#playerSelectScreen h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #b767f8;
    text-align: center;
}

.player-buttons {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.player-btn {
    background: rgba(158, 89, 214, 0.2);
    border: 2px solid rgba(158, 89, 214, 0.4);
    border-radius: 12px;
    color: #ffffff;
    font-family: 'Monocraft', monospace;
    font-size: 1.1rem;
    padding: 1rem 2.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    min-width: 180px;
}

.player-btn:hover {
    background: rgba(158, 89, 214, 0.3);
    border-color: rgba(158, 89, 214, 0.6);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(158, 89, 214, 0.3);
}

/* Game screen styling */
.game-header-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    font-family: 'Monocraft', monospace;
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.game-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin-bottom: 0.8rem;
    position: relative;
    overflow: hidden;
    height: calc(100% - 120px);
    max-height: calc(100vh - 200px);
}

.game-controls {
    padding: 0.6rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

/* Game control buttons */
.control-btn {
    background: rgba(158, 89, 214, 0.2);
    border: 1px solid rgba(158, 89, 214, 0.4);
    border-radius: 6px;
    color: #ffffff;
    font-family: 'Monocraft', monospace;
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: rgba(158, 89, 214, 0.3);
    border-color: rgba(158, 89, 214, 0.6);
}

.control-btn:active {
    transform: scale(0.95);
}

/* Back to main link */
.back-to-main {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 100;
}

/* Back to rand button */
.back-to-rand {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}

.main-link {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    backdrop-filter: blur(10px);
}

.main-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Version text */
.version-text {
    position: fixed;
    bottom: 10px;
    right: 15px;
    color: #666;
    font-size: 0.8rem;
    font-family: 'Monocraft', monospace;
    z-index: 1000;
    opacity: 0.7;
}

/* Game-specific styles */
.score-display {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    color: #b767f8;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

.lives-display {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    color: #ffeb3b;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

.left-display {
    position: fixed;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #4a7c29;
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-width: 100px;
    max-width: 150px;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

.right-display {
    position: fixed;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #b8a082;
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-width: 100px;
    max-width: 150px;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

/* Media queries for responsive design */
@media (max-width: 1400px) {
    .left-display, .right-display {
        font-size: 0.8rem;
        padding: 0.7rem 0.9rem;
        min-width: 90px;
        max-width: 130px;
    }
}

@media (max-width: 1200px) {
    .left-display, .right-display {
        font-size: 0.75rem;
        padding: 0.6rem 0.8rem;
        min-width: 80px;
        max-width: 120px;
        left: 8px;
        right: 8px;
    }
    
    .left-display {
        left: 8px;
    }
    
    .right-display {
        right: 8px;
    }
}

@media (max-width: 1000px) {
    .left-display, .right-display {
        position: absolute;
        top: 8px;
        transform: none;
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
        min-width: 70px;
        max-width: 100px;
    }
    
    .left-display {
        left: 8px;
    }
    
    .right-display {
        right: 8px;
    }
}

.game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.game-over-screen h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #b767f8;
}

.game-over-screen p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Canvas styling */
canvas {
    border-radius: 8px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    outline: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: crosshair;
}

canvas:focus {
    outline: 2px solid rgba(183, 103, 248, 0.5);
}

/* Responsive design */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    .game-container {
        width: 96vw;
        height: 98vh;
        padding: 0.8rem;
    }
    
    .player-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .player-btn {
        min-width: 200px;
        font-size: 1rem;
        padding: 0.8rem 2rem;
    }
    
    #playerSelectScreen h2 {
        font-size: 1.6rem;
        margin-bottom: 1.5rem;
    }
    
    .game-area {
        height: calc(100% - 100px);
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.6rem;
    }
    
    .game-container {
        width: 98vw;
        height: 99vh;
        padding: 0.5rem;
        border-radius: 15px;
    }
    
    .back-to-main, .back-to-rand {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        margin-bottom: 0.5rem;
    }
    
    .player-btn {
        min-width: 180px;
        font-size: 0.9rem;
        padding: 0.7rem 1.5rem;
    }
    
    .game-area {
        height: calc(100% - 80px);
    }
    
    .game-controls {
        font-size: 0.8rem;
        height: 40px;
        padding: 0.4rem;
    }
}

/* Tic-Tac-Toe Styles */
.modifier-display {
    background: rgba(183, 103, 248, 0.2);
    border: 2px solid rgba(183, 103, 248, 0.5);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    max-width: 400px;
}

.modifier-display h3 {
    color: #b767f8;
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.modifier-display p {
    color: #ffffff;
    font-size: 0.9rem;
}

.tic-tac-toe-cell {
    transition: all 0.2s ease;
}

.tic-tac-toe-cell:hover:not(:disabled) {
    transform: scale(1.05);
    border-color: rgba(183, 103, 248, 0.8) !important;
    box-shadow: 0 0 15px rgba(183, 103, 248, 0.3);
}

.tic-tac-toe-cell:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}
