:root {
    --bg: #1e1e2f;
    --panel: #292942;
    --cell: #2e2e40;
    --cell-hover: #3a3a52;
    --x-color: #4ecdc4;
    --o-color: #ff6b6b;
    --text: #ffffff;
    --accent: #7c5cff;
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body.light {
    --bg: #f5f7fa;
    --panel: #ffffff;
    --cell: #eef1f5;
    --cell-hover: #e1e6ef;
    --x-color: #2ecc71;
    --o-color: #e74c3c;
    --text: #2c3e50;
    --accent: #3498db;
}

* {
    box-sizing: border-box;
    transition: var(--transition);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    text-align: center;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

h1 {
    margin: 10px 0 20px;
    font-size: 2.5em;
    color: var(--accent);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    color: var(--text);
    opacity: 0.8;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.panel {
    background: var(--panel);
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 15px auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.1);
}

body.light .panel {
    border: 1px solid rgba(0,0,0,0.1);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

#board {
    display: none;
    grid-template-columns: repeat(3, minmax(80px, 120px));
    gap: 10px;
    justify-content: center;
    margin: 30px auto;
    max-width: 400px;
}

.cell {
    aspect-ratio: 1;
    background: var(--cell);
    font-size: 2.5em;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--border-radius);
    border: none;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.cell:hover:not(.occupied) {
    background: var(--cell-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.cell.x { color: var(--x-color); }
.cell.o { color: var(--o-color); }
.cell.occupied { cursor: not-allowed; }

button, select {
    padding: 10px 20px;
    margin: 5px;
    border-radius: 8px;
    border: none;
    background: var(--accent);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    opacity: 0.9;
}

button:active {
    transform: translateY(0);
}

select {
    background: var(--panel);
    color: var(--text);
    border: 2px solid var(--accent);
    padding: 8px 16px;
}

#deleteData {
    background: #ff4757;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stat-box {
    background: var(--panel);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-box h3 {
    margin-top: 0;
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 5px;
    display: inline-block;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

body.light .stat-item {
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.stat-value {
    font-weight: bold;
    color: var(--accent);
}

#emotionPanel {
    font-size: 1.2em;
    font-weight: bold;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    max-width: 500px;
}

#resultPanel {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--accent);
    margin: 20px auto;
    min-height: 40px;
}

@media (max-width: 600px) {
    .controls {
        flex-direction: column;
    }
    
    #board {
        grid-template-columns: repeat(3, minmax(70px, 90px));
    }
    
    .cell {
        font-size: 2em;
    }
    
    h1 {
        font-size: 2em;
    }
}
