:root {
    --bg-color: #0d0221;
    --card-bg: rgba(255, 255, 255, 0.05);
    --accent-primary: #7b2cbf;
    --accent-secondary: #ff0054;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --tile-bg: rgba(255, 255, 255, 0.03);
    --tile-hover: rgba(255, 255, 255, 0.1);
    --tile-active: #7b2cbf;
    --tile-valid: rgba(0, 255, 127, 0.2);
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-color);
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(123, 44, 191, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 0, 84, 0.1) 0%, transparent 40%);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    width: 95%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

header {
    text-align: center;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff 0%, #7b2cbf 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

p.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 500px;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem 2rem;
    border-radius: 16px;
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 4px;
    width: min(90vw, 500px);
    height: min(90vw, 500px);
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 12px;
}

.tile {
    background: var(--tile-bg);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tile:hover:not(.filled) {
    background: var(--tile-hover);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
    z-index: 2;
}

.tile.filled {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 0 10px rgba(123, 44, 191, 0.5);
    cursor: default;
}

.tile.last-move {
    background: var(--accent-secondary);
    box-shadow: 0 0 15px rgba(255, 0, 84, 0.7);
    transform: scale(1.1);
    z-index: 3;
}

.tile.valid {
    background: var(--tile-valid);
    border: 2px solid #00ff7f;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 0.7; }
}

.controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

button {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

button:hover:not(:disabled) {
    background: var(--accent-primary);
    transform: translateY(-2px);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-color);
    padding: 3rem;
    border-radius: 32px;
    text-align: center;
    border: 1px solid var(--accent-primary);
    max-width: 400px;
}

.modal h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.modal p {
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

/* Responsiveness */
@media (max-width: 600px) {
    h1 { font-size: 2rem; }
    .grid { gap: 2px; padding: 4px; }
    .tile { font-size: 0.7rem; }
}
