:root {
    --primary: #007AFF;
    --text-main: #1c1c1e;
    --text-muted: #8e8e93;
    --bg-body: #f2f2f7;
    --bg-container: rgba(255, 255, 255, 0.85);
    --border-color: rgba(255, 255, 255, 0.4);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    margin: 0;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.app-wrapper {
    flex: 1;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}
/* Bubble Background */
.bubble-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}
.bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(0, 122, 255, 0.08);
    animation: float 15s infinite ease-in-out alternate;
    filter: blur(40px);
}
.bubble-1 { width: 400px; height: 400px; top: -100px; left: -100px; }
.bubble-2 { width: 500px; height: 500px; bottom: -150px; right: -100px; animation-delay: -2s; background: rgba(52, 199, 89, 0.08); }
.bubble-3 { width: 300px; height: 300px; bottom: 20%; left: 20%; animation-delay: -5s; background: rgba(255, 59, 48, 0.05); }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, -50px) scale(1.1); }
}
.container {
    background: var(--bg-container);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
    z-index: 1;
}
.game-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    background-color: #1a252f;
    background-image: url("data:image/svg+xml,%3Csvg width='6' height='6' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%2334495e' fill-opacity='0.4' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E");
    padding: 20px;
    border-radius: 15px;
    border: 5px solid #4a6278;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 5px 15px rgba(0,0,0,0.5);
    color: #ecf0f1;
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
}
.game-box canvas {
    background-color: #34495e;
    border: 4px solid #ecf0f1;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    width: 100%;
    height: auto;
}
.game-box .info {
    margin-top: 10px;
    margin-bottom: 15px;
    text-align: center;
    width: 100%;
}
.game-box h1 {
    margin: 0 0 15px 0;
    font-size: 2.5rem;
    color: #f1c40f;
    text-shadow: 3px 3px 0px #e74c3c;
    font-family: 'Press Start 2P', cursive;
    text-align: center;
}
.game-box h2 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    letter-spacing: 1px;
    font-family: 'Press Start 2P', cursive;
}
.game-box .controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.game-box #difficulty-container {
    margin-bottom: 10px;
}
.game-box #difficulty {
    padding: 5px;
    border-radius: 5px;
    border: 2px solid #ecf0f1;
    background-color: #34495e;
    color: #ecf0f1;
    font-size: 14px;
    font-family: 'Press Start 2P', cursive;
    cursor: pointer;
}
.game-box button {
    padding: 10px 25px;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Press Start 2P', cursive;
    cursor: pointer;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    border-bottom: 4px solid #c0392b;
    transition: background-color 0.2s;
    touch-action: manipulation;
}
.game-box #pauseBtn {
    background-color: #3498db;
    border-bottom-color: #2980b9;
}
.game-box #pauseBtn:hover {
    background-color: #5dade2;
}
.game-box button:hover {
    background-color: #ff6b57;
}
.game-box .mobile-controls {
    display: none;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
    width: 100%;
}
.game-box .mobile-controls .row {
    display: flex;
    gap: 40px;
}
.game-box .mobile-controls button {
    width: 60px;
    height: 60px;
    font-size: 24px;
    padding: 0;
    background-color: #4a6278;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border-bottom: 4px solid #2c3e50;
}
.game-box .mobile-controls button:active {
    background-color: #5a7288;
    transform: translateY(2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.info-container {
    background: var(--bg-container);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    width: 98%;
    max-width: 1200px;
    box-sizing: border-box;
    z-index: 1;
    margin-top: 30px;
}
.info-container h2 {
    color: var(--text-main);
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 22px;
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: none;
}
.info-container p, .info-container li {
    color: var(--text-main);
    line-height: 1.6;
    margin-bottom: 10px;
    font-size: 15px;
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: none;
}
.faq-item {
    border-bottom: 1px solid rgba(0,0,0,0.1);
    margin-bottom: 10px;
}
.faq-item:last-child {
    border-bottom: none;
}
.faq-question {
    width: 100%;
    max-width: none;
    margin: 0;
    background: none;
    border: none;
    text-align: left;
    padding: 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: none;
    box-shadow: none !important;
    border-radius: 0;
}
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}
.faq-answer p {
    padding-bottom: 15px;
    color: var(--text-muted);
    margin: 0;
}
.arrow {
    transition: transform 0.3s;
    font-size: 12px;
}
.faq-item.active .arrow {
    transform: rotate(180deg);
}

@media (min-width: 769px) {
    .container {
        width: 80%;
        max-width: 1200px;
    }
    .game-box {
        max-width: 100%;
    }
    .info-container {
        width: 80%;
    }
}

@media (max-width: 768px) {
    .game-box .mobile-controls {
        display: flex;
    }
}
@media (max-height: 720px) and (max-width: 500px) {
    .app-wrapper {
        padding: 20px 10px;
    }
    .container {
        padding: 15px;
    }
    .game-box {
        padding: 15px 10px;
        border-width: 3px;
    }
    .game-box h1 {
        font-size: 2rem;
        margin-bottom: 10px;
    }
    .game-box h2 {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }
    .game-box #difficulty-container {
        margin-bottom: 8px;
    }
    .game-box .mobile-controls {
        margin-top: 15px;
        gap: 5px;
    }
    .game-box .mobile-controls button {
        width: 50px;
        height: 50px;
    }
}

/* Immersive Focus Mode */
body.playing-snake #global-header,
body.playing-snake #global-footer,
body.playing-snake .info-container {
    display: none !important;
}
body.playing-snake .app-wrapper {
    justify-content: center;
}