﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: 'Segoe UI', 'Arial Black', Arial, sans-serif;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}
#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}
#game-canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}
.hidden { display: none !important; }
#hud {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    pointer-events: none;
    z-index: 10;
}
#hud > * { pointer-events: auto; }
#hud-left, #hud-right {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
#hud-right { align-items: flex-end; }
#score-label, #best-label {
    font-size: 10px; font-weight: 700;
    color: rgba(255,255,255,0.7);
    letter-spacing: 2px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
#score-value {
    font-size: 28px; font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0,0,0,0.5);
    line-height: 1;
}
#best-value {
    font-size: 16px; font-weight: 700;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    line-height: 1;
}
#hud-center {
    position: absolute;
    left: 50%; top: 12px;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
}
#combo-text {
    font-size: 24px; font-weight: 900;
    color: #ffeb3b;
    text-shadow: 0 2px 8px rgba(255,235,59,0.6), 0 0 20px rgba(255,235,59,0.3);
    white-space: nowrap;
    pointer-events: none;
}
#lives-display {
    font-size: 18px; letter-spacing: 2px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    margin-top: 2px;
}
#pause-btn, #sound-btn {
    position: absolute;
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.2);
    color: #fff; font-size: 18px;
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    z-index: 11;
}
#pause-btn:active, #sound-btn:active { background: rgba(255,255,255,0.2); }
#pause-btn { top: calc(12px + env(safe-area-inset-top)); right: 64px; }
#sound-btn { top: calc(12px + env(safe-area-inset-top)); right: 16px; }
#sound-btn.muted { opacity: 0.5; }
#start-screen, #pause-screen, #gameover-screen {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    z-index: 20;
    background: linear-gradient(180deg, #2d1b69 0%, #1a1a5e 40%, #c62828 100%);
}
#start-content, #pause-content, #gameover-content {
    text-align: center;
    padding: 24px;
    max-width: 500px;
    width: 90%;
}
#game-title {
    font-size: 52px; font-weight: 900;
    color: #fff;
    text-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 0 40px rgba(255,100,100,0.3);
    letter-spacing: 4px; margin-bottom: 8px;
}
#game-subtitle {
    font-size: 14px; font-weight: 600;
    color: rgba(255,255,255,0.7);
    letter-spacing: 3px; margin-bottom: 32px;
}
#menu-fruits { font-size: 40px; margin-bottom: 24px; letter-spacing: 8px; }
#menu-best {
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 24px; letter-spacing: 1px;
}
.menu-btn {
    display: block; width: 220px;
    margin: 10px auto;
    padding: 14px 0;
    font-size: 18px; font-weight: 800;
    letter-spacing: 2px;
    border: none; border-radius: 50px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    text-transform: uppercase;
}
.menu-btn:active { transform: scale(0.95); }
.menu-btn:not(.secondary) {
    background: linear-gradient(135deg, #ff5722, #ff9800);
    color: #fff;
    box-shadow: 0 4px 20px rgba(255,87,34,0.4);
}
.menu-btn:not(.secondary):active { box-shadow: 0 2px 10px rgba(255,87,34,0.3); }
.menu-btn.secondary {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    border: 2px solid rgba(255,255,255,0.2);
}
.menu-btn.secondary:active { background: rgba(255,255,255,0.2); }
#pause-screen {
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 25;
}
#pause-content h2 {
    font-size: 36px; font-weight: 900;
    color: #fff; letter-spacing: 3px;
    margin-bottom: 32px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
#gameover-screen {
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    z-index: 25;
}
#gameover-title {
    font-size: 40px; font-weight: 900;
    color: #ff5252; letter-spacing: 3px;
    margin-bottom: 16px;
    text-shadow: 0 2px 10px rgba(255,82,82,0.4);
}
#new-best-label {
    font-size: 22px; font-weight: 800;
    color: #ffeb3b;
    text-shadow: 0 2px 8px rgba(255,235,59,0.4);
    margin-bottom: 16px;
    animation: comboPopIn 0.5s ease-out;
}
#final-score-display, #final-best-display { margin-bottom: 12px; }
#final-score-label, #final-best-label {
    font-size: 11px; font-weight: 700;
    color: rgba(255,255,255,0.6);
    letter-spacing: 2px;
}
#final-score-value {
    font-size: 42px; font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
#final-best-value {
    font-size: 24px; font-weight: 700;
    color: rgba(255,255,255,0.8);
}
#howto-modal {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    z-index: 30;
}
#howto-panel {
    background: linear-gradient(180deg, #1a1a4e 0%, #2d1b69 100%);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 28px 24px;
    max-width: 460px; width: 92%;
    max-height: 85vh; overflow-y: auto;
    text-align: center;
}
#howto-panel h2 {
    font-size: 28px; font-weight: 900;
    color: #fff; letter-spacing: 3px;
    margin-bottom: 20px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
#howto-sections {
    display: flex; flex-direction: column;
    gap: 14px; margin-bottom: 20px;
    text-align: left;
}
.howto-section {
    display: flex; align-items: flex-start;
    gap: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px; padding: 12px 14px;
}
.howto-icon { font-size: 28px; min-width: 36px; text-align: center; line-height: 1.3; }
.howto-text strong {
    font-size: 13px; color: #fff;
    display: block; margin-bottom: 2px;
}
.howto-text p {
    font-size: 12px; color: rgba(255,255,255,0.7);
    line-height: 1.4; margin: 0;
}
#bomb-flash {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,100,0,0.4);
    z-index: 15;
    animation: flashFade 0.3s ease-out forwards;
    pointer-events: none;
}
@keyframes flashFade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}
@keyframes comboPopIn {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
@media (max-width: 480px) {
    #game-title { font-size: 38px; letter-spacing: 3px; }
    #game-subtitle { font-size: 11px; letter-spacing: 2px; }
    .menu-btn { width: 200px; padding: 12px 0; font-size: 16px; }
    #score-value { font-size: 22px; }
    #best-value { font-size: 13px; }
    #howto-panel { padding: 20px 16px; }
    #howto-panel h2 { font-size: 22px; }
    .howto-icon { font-size: 24px; min-width: 30px; }
    .howto-text strong { font-size: 12px; }
    .howto-text p { font-size: 11px; }
}
@media (min-width: 769px) and (min-height: 500px) {
    #game-title { font-size: 64px; }
    #game-subtitle { font-size: 16px; }
    .menu-btn { width: 260px; padding: 16px 0; font-size: 20px; }
    #score-value { font-size: 32px; }
}
