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

body {
    background: linear-gradient(135deg, #111827 0%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: white;
    user-select: none;
    overflow: hidden;
}

.permanent-marker-regular {
  font-family: "Permanent Marker", cursive;
  font-weight: 400;
  font-style: normal;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
    text-align: center;
}

.scoreboard {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    width: 100%;
    max-width: 320px;
}

.scoreboard div {
    flex: 1;
    padding: 10px;
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    color: #94a3b8;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
}

.scoreboard span {
    font-size: 1.4rem;
    margin-top: 5px;
    color: white;
}

.computer-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    background: #1e293b;
    border: 1px solid #334155;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.computer-controls span {
    font-weight: 500;
    color: #cbd5e1;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .3s ease;
    border-radius: 22px;
    border: 1px solid #475569;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
    background-color: #00ffff;
    border-color: #00ffff;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
}

input:checked + .slider:before {
    transform: translateX(22px);
    background-color: #0f172a;
}

.status-message {
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #e2e8f0;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
    text-align: center;
    height: 1.5rem; /* Reserve space to prevent layout shift */
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1;
    margin-bottom: 20px;
    position: relative;
}

.cell {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1e293b;
    border: 1px solid #334155;
    color: white;
    font-size: 3.5rem;
    cursor: pointer;
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.cell:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
    background-color: #334155;
}

.cell.X {
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.6);
}

.cell.O {
    color: #ff00ff;
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.6);
}

button.reset {
    padding: 12px 24px;
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #e94560 0%, #c6283e 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.4);
}

button.reset:hover {
    background: linear-gradient(135deg, #f85c78 0%, #d32f45 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(233, 69, 96, 0.6);
}

button.reset:active {
    transform: scale(0.95);
}

/* Line to indicate the winning combination */
.win-line {
    position: absolute;
    width: 0;
    height: 5px;
    background-color: #00ff00;
    box-shadow: 0 0 10px #00ff00;
    border-radius: 2px;
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.5s ease-in-out;
}

.highlight {
    background-color: #22c55e !important;
    color: white;
    animation: blink 0.5s ease-in-out infinite alternate;
}

@keyframes blink {
    from {
        opacity: 1;
    }
    to {
        opacity: 0.7;
    }
}

@media (max-width: 360px) {
    .cell {
        font-size: 2.8rem;
    }
    .board {
        gap: 8px;
    }
}