/* -------------------- RESET & BASE -------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Poppins', system-ui, -apple-system, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

/* -------------------- CSS VARIABLES (THEMES) -------------------- */
:root {
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --card-bg: #0f3460;
    --card-border: #2c3e66;
    --panel-bg: rgba(26, 26, 46, 0.75);
    --btn-primary: #e94560;
    --btn-primary-text: #ffffff;
    --cell-bg: #ffffff;
    --cell-shadow: rgba(0, 0, 0, 0.25);
    --text-light: #eeeeee;
    --text-muted: #a0a0a0;
    --turn-bg: #16213e;
    --winner-msg-bg: rgba(0, 23, 31, 0.85);
    --name-input-bg: #1a1a2e;
    --name-label-bg: #0f3460;
    --footer-bg: rgba(7, 22, 28, 0.85);
    --howto-bg: rgba(10, 39, 46, 0.85);
    --footer-text: #b9d8dd;
}

body.light-theme {
    --bg-gradient-start: #f5f7fa;
    --bg-gradient-end: #c3cfe2;
    --card-bg: #ffffff;
    --card-border: #d1d9e6;
    --panel-bg: rgba(232, 238, 243, 0.85);
    --btn-primary: #ff6b4a;
    --btn-primary-text: #ffffff;
    --cell-bg: #ffffff;
    --cell-shadow: rgba(0, 0, 0, 0.12);
    --text-light: #1a2a3a;
    --text-muted: #5a7a8a;
    --turn-bg: #e8eef3;
    --winner-msg-bg: rgba(200, 210, 220, 0.9);
    --name-input-bg: #f0f4f8;
    --name-label-bg: #d4e2ed;
    --footer-bg: rgba(200, 210, 220, 0.9);
    --howto-bg: rgba(232, 238, 243, 0.95);
    --footer-text: #2c6e7a;
}

/* -------------------- GLOBAL -------------------- */
body {
    background: linear-gradient(145deg, var(--bg-gradient-start), var(--bg-gradient-end));
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* -------------------- MAIN LAYOUT -------------------- */
.game-hub {
    max-width: 600px;
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 28px;
    padding: 18px;
    backdrop-filter: blur(6px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
}

.game-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 22px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
}

/* -------------------- HEADER -------------------- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.logo-area {
    display: flex;
    gap: 6px;
}

.logo-part1,
.logo-part2 {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.logo-part1 {
    background: linear-gradient(135deg, #FF6B4A, #FF8E53);
    -webkit-background-clip: text;
    color: transparent;
}

.logo-part2 {
    background: linear-gradient(135deg, #4AE4FF, #1E90FF);
    -webkit-background-clip: text;
    color: transparent;
}

/* -------------------- BUTTONS -------------------- */
button {
    border: none;
    cursor: pointer;
    font-weight: 600;
    border-radius: 40px;
    background: var(--btn-primary);
    color: var(--btn-primary-text);
    padding: 10px 20px;
    font-size: 0.9rem;
    transition: all 0.25s ease;
}

button:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

button:active {
    transform: scale(0.97);
}

/* -------------------- PANEL -------------------- */
.name-panel {
    background: var(--panel-bg);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 18px;
}

/* -------------------- MODE -------------------- */
.mode-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.mode-btn {
    flex: 1;
    background: rgba(0,0,0,0.25);
    padding: 10px;
    border-radius: 40px;
    font-size: 0.85rem;
}

.mode-btn.active {
    background: var(--btn-primary);
    box-shadow: 0 0 10px rgba(233,69,96,0.5);
}

/* -------------------- INPUTS -------------------- */
.name-input-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 40px;
}

.name-label {
    background: var(--name-label-bg);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: #fff;
}

.name-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 8px 12px;
    border-radius: 40px;
    background: var(--name-input-bg);
    color: var(--text-light);
}

/* -------------------- STATUS -------------------- */
.status-bar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-radius: 40px;
    background: rgba(0,0,0,0.35);
    margin-bottom: 18px;
}

.turn-box {
    background: var(--turn-bg);
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
}

.score-item {
    font-size: 0.8rem;
    padding: 5px 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 30px;
}

/* -------------------- BOARD -------------------- */
.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 16px;
    border-radius: 20px;
    background: rgba(0,0,0,0.25);
}

.cell {
    aspect-ratio: 1;
    background: var(--cell-bg);
    border-radius: 16px;
    font-size: 2.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 0 var(--cell-shadow);
    transition: all 0.2s ease;
}

.cell:hover {
    transform: translateY(-2px);
}

.cell:active {
    transform: scale(0.96);
}

/* -------------------- WINNER -------------------- */
.winner-msg {
    text-align: center;
    padding: 10px;
    border-radius: 40px;
    background: var(--winner-msg-bg);
    color: #ffdf9c;
    font-weight: bold;
    margin-top: 12px;
}

/* -------------------- HOW TO -------------------- */
.howto-section {
    margin-top: 16px;
    padding: 16px;
    border-radius: 20px;
    background: var(--howto-bg);
}

/* -------------------- FOOTER -------------------- */
.modern-footer {
    margin-top: 16px;
    padding: 16px;
    border-radius: 20px;
    background: var(--footer-bg);
    text-align: center;
    color: var(--footer-text);
    font-size: 0.75rem;
}

/* -------------------- RESPONSIVE -------------------- */
@media (max-width: 650px) {
    .game-hub {
        padding: 12px;
    }

    .cell {
        font-size: 2rem;
    }

    button {
        font-size: 0.8rem;
        padding: 8px 14px;
    }
}

/* -------------------- ACCESSIBILITY -------------------- */
button:focus-visible,
.cell:focus-visible,
.name-input:focus-visible {
    outline: 3px solid var(--btn-primary);
    outline-offset: 2px;
}