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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
}

.game-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

.game-top-bar .logo { font-size: 1.1rem; font-weight: 900; background: linear-gradient(45deg, #ff6b6b, #ffd93d); -webkit-background-clip: text; background-clip: text; color: transparent; text-decoration: none; }

.lang-switcher { display: flex; gap: 2px; }
.lang-btn { background: rgba(255,255,255,0.05); color: #888; border: 1px solid #2a2a4e; padding: 0.25rem 0.5rem; font-size: 0.7rem; font-weight: 700; cursor: pointer; transition: 0.3s; text-transform: uppercase; }
.lang-btn:first-child { border-radius: 6px 0 0 6px; }
.lang-btn:last-child { border-radius: 0 6px 6px 0; }
.lang-btn.active { background: #ffd93d; color: #1a1a3e; border-color: #ffd93d; }
.lang-btn:hover:not(.active) { color: #ffd93d; border-color: #4d96ff; }

.game-container {
    background: rgba(26, 26, 46, 0.95);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid #2a2a4e;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    max-width: 95vw;
    text-align: center;
    width: fit-content;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.game-header h1 {
    font-size: 1.5rem;
    background: linear-gradient(45deg, #ff6b6b, #ffd93d);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.back-btn {
    color: #4d96ff;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.35rem 0.9rem;
    border: 1px solid #4d96ff;
    border-radius: 8px;
    transition: 0.3s;
    white-space: nowrap;
}

.back-btn:hover { background: #4d96ff; color: #fff; }

.btn-restart {
    background: linear-gradient(45deg, #ff6b6b, #ff4757);
    color: #fff;
    border: none;
    padding: 0.5rem 1.8rem;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.3s;
    font-weight: 600;
}

.btn-restart:hover { transform: scale(1.05); box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4); }

.btn { background: linear-gradient(45deg, #ff6b6b, #ff4757); color: #fff; border: none; padding: 0.5rem 1.5rem; border-radius: 50px; font-size: 0.85rem; cursor: pointer; font-weight: 600; transition: 0.3s; }
.btn:hover { transform: scale(1.05); box-shadow: 0 6px 20px rgba(255,107,107,0.4); }
.btn-small { padding: 0.3rem 0.8rem; font-size: 0.75rem; }

.score { font-size: 1.1rem; color: #ffd93d; font-weight: bold; white-space: nowrap; }

.canvas-wrapper {
    display: inline-block;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #2a2a4e;
    max-width: 100%;
}

canvas {
    display: block;
    background: #0f0f23;
    max-width: 100%;
    height: auto;
}

.stats-bar { display: flex; justify-content: center; gap: 1.5rem; margin-top: 0.5rem; font-size: 0.9rem; flex-wrap: wrap; }
.stats-bar span { font-weight: bold; }
.p1-color { color: #ff6b6b; } .p2-color { color: #ffd93d; }

.controls-info {
    background: #0f0f23;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #aaa;
    line-height: 1.5;
}

.help-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 1000; justify-content: center; align-items: center; }
.help-overlay.active { display: flex; }
.help-box { background: #1a1a3e; border-radius: 20px; padding: 2rem; max-width: 500px; width: 90%; border: 1px solid #ffd93d; text-align: left; max-height: 80vh; overflow-y: auto; }
.help-box h2 { color: #ffd93d; margin-bottom: 0.8rem; }
.help-box p, .help-box li { color: #ccc; font-size: 0.9rem; line-height: 1.6; }
.help-box .close-help { float: right; cursor: pointer; color: #ff6b6b; font-size: 1.5rem; }
.help-box strong { color: #ffd93d; }

.controls { margin-top: 0.8rem; }
.controls p { color: #888; font-size: 0.8rem; margin-bottom: 0.4rem; }

/* Ad slots */
.ad-slot { width: 100%; max-width: 728px; margin: 0.5rem auto; text-align: center; }
.ad-placeholder { width: 100%; min-height: 90px; background: rgba(255,255,255,0.03); border: 1px dashed #2a2a4e; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #555; font-size: 0.8rem; }
.ad-slot-top { margin-bottom: 0.5rem; }
.ad-slot-bottom { margin-top: 0.5rem; }
.ad-slot-sidebar { margin: 0.5rem; }

/* Touch hint */
.touch-hint { display: none; color: #aaa; font-size: 0.8rem; margin-top: 0.3rem; }

@media (pointer: coarse) {
    .touch-hint { display: block; }
}

@media (max-width: 600px) {
    body { padding: 0.3rem; align-items: flex-start; }
    .game-container { padding: 1rem; max-width: 100vw; border-radius: 14px; }
    .game-header h1 { font-size: 1.2rem; }
    .game-header { gap: 0.5rem; }
    .back-btn { font-size: 0.8rem; padding: 0.3rem 0.7rem; }
    .btn-restart { font-size: 0.8rem; padding: 0.4rem 1.2rem; }
    .score { font-size: 0.95rem; }
    .controls p { font-size: 0.7rem; }
    canvas { max-width: 100%; height: auto; }
}
