:root {
    --dark-green-bg: #051909;
    --neon-green: #4de85a;
    --dim-green: #1a4d23;
    --border-color: #FEFAEC;
    --text-color: #FEFAEC;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Gloria+Hallelujah&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Playwrite+CZ&display=swap');

body {
    background-color: var(--dark-green-bg);
    color: var(--text-color);
    font-family: "Gloria Hallelujah", cursive;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 10px;
}

h1 {
    font-size: clamp(2rem, 5vmin, 3.5rem);
    /* Responsive font size */
    color: var(--neon-green);
    text-shadow: 0 0 10px var(--neon-green);
    margin-bottom: 2vmin;
    text-align: center;
}

#options {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 2vmin;
    padding: 0 10px;
}

button {
    font-family: inherit;
    font-size: clamp(1rem, 3vmin, 1.5rem);
    color: var(--text-color);
    background: transparent;
    border: 2px solid var(--neon-green);
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 5px var(--neon-green);
    min-width: 100px;
}

button:hover {
    background: var(--neon-green);
    color: var(--dark-green-bg);
    box-shadow: 0 0 15px var(--neon-green);
}

#board-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1vmin;
    padding: 2vmin;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
}

.large-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 25vmin;
    height: 25vmin;
    border: 2px solid var(--dim-green);
    position: relative;
    padding: 0.5vmin;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: "Playwrite CZ", cursive;
    font-size: 5vmin;
    cursor: pointer;
    color: var(--text-color);
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.cell:nth-child(3n+1) {
    border-left: none;
}

.cell:nth-child(3n) {
    border-right: none;
}

.cell:nth-child(-n+3) {
    border-top: none;
}

.cell:nth-child(n+7) {
    border-bottom: none;
}

.highlight-grid {
    border-color: var(--neon-green);
    box-shadow: 0 0 8px var(--neon-green);
    transform: scale(1.02);
    z-index: 10;
}

.disabled-grid {
    pointer-events: none;
    opacity: 0.8;
}

.disabled-style {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 15vmin;
    color: var(--neon-green);
    text-shadow: 0 0 10px var(--neon-green);
    background: rgba(5, 25, 9, 0.9);
    width: 100%;
    height: 100%;
}

.draw-text {
    font-size: 5vmin;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--dark-green-bg);
    padding: 5vmin;
    border: 2px solid var(--neon-green);
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 0 30px var(--neon-green);
    max-width: 90vw;
    /* Ensure modal fits on mobile */
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    font-size: clamp(1.5rem, 5vmin, 3rem);
    color: var(--neon-green);
    margin-bottom: 20px;
    text-shadow: 0 0 10px var(--neon-green);
}

.modal-content ul {
    text-align: left;
    font-size: clamp(0.9rem, 2vmin, 1.2rem);
    line-height: 1.5;
}

#play-again-btn,
#close-rules-btn {
    font-size: 1.2rem;
    padding: 10px 30px;
    margin-top: 20px;
}