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

body {
    font-family: 'Arial', sans-serif;
    background: #fffee6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    text-align: center;
}

.screen.active {
    display: flex;
}

.screen.overlay {
    position: absolute;
    top: 0;
    left: 0;
    background: rgba(255, 254, 230, 0.95);
    z-index: 1000;
}

/* Start Screen */
.game-title {
    font-size: 3.5rem;
    color: #212121;
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.game-subtitle {
    font-size: 1.5rem;
    color: #212121;
    margin-bottom: 2rem;
    font-weight: 400;
    opacity: 0.8;
}

.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 15px 30px;
    font-size: 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #8ec622;
    color: #fffee6;
    border: 2px solid #8ec622;
}

.btn-primary:hover {
    background: #7ab01d;
    border-color: #7ab01d;
}

.btn-secondary {
    background: #4daadd;
    color: #fffee6;
    border: 2px solid #4daadd;
}

.btn-secondary:hover {
    background: #3b9bc8;
    border-color: #3b9bc8;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
    text-transform: none;
}

.status-message {
    margin-top: 1rem;
    padding: 10px;
    border-radius: 10px;
    font-size: 1rem;
    min-height: 30px;
}

.status-message.success {
    background: rgba(142, 198, 34, 0.2);
    color: #8ec622;
    border: 1px solid #8ec622;
}

.status-message.error {
    background: rgba(219, 90, 152, 0.2);
    color: #db5a98;
    border: 1px solid #db5a98;
}

/* Game Screen */
.game-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    background: rgba(255, 254, 230, 0.95);
    border-bottom: 2px solid #212121;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    flex-wrap: wrap;
    gap: 10px;
}

.game-header-buttons {
    display: flex;
    gap: 10px;
}

.score-display {
    color: #212121;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    gap: 20px;
}

.timer-display {
    color: #212121;
    font-size: 1.2rem;
    font-weight: 600;
}

.game-area {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid #212121;
    border-radius: 8px;
    background: transparent;
    z-index: 10;
}

#video {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scaleX(-1);
    border-radius: 8px;
    border: 3px solid #212121;
    opacity: 1;
    pointer-events: none;
    z-index: 1;
    object-fit: cover;
}

#face-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scaleX(-1);
    border-radius: 8px;
    z-index: 5;
    pointer-events: none;
}

/* End Screen */
.score-summary {
    margin: 2rem 0;
}

.final-score {
    font-size: 2.5rem;
    color: #212121;
    margin-bottom: 1rem;
    font-weight: 700;
}

.high-score-text {
    font-size: 1.5rem;
    color: #ff8222;
    font-weight: 600;
}

/* Pause Screen */
.pause-content {
    background: #fffee6;
    padding: 40px;
    border-radius: 8px;
    border: 3px solid #212121;
}

.pause-content h2 {
    font-size: 2.5rem;
    color: #212121;
    margin-bottom: 2rem;
    font-weight: 700;
}

.pause-content .btn {
    margin: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }

    .game-subtitle {
        font-size: 1.2rem;
    }

    .btn {
        padding: 12px 24px;
        font-size: 1rem;
    }

    .game-header {
        flex-direction: column;
        padding: 10px;
    }

    .score-display {
        font-size: 1rem;
        flex-direction: column;
        gap: 5px;
    }

    .timer-display {
        font-size: 1rem;
    }

    #game-canvas,
    #video,
    #face-canvas {
        width: 90vw !important;
        height: auto !important;
    }
}

/* Food Object Animation */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

.food-object {
    animation: float 2s ease-in-out infinite;
}

/* Settings Screen */
.settings-content {
    background: #fffee6;
    padding: 40px;
    border-radius: 8px;
    border: 3px solid #212121;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.settings-content h2 {
    font-size: 2.5rem;
    color: #212121;
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 700;
}

.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #212121;
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h3 {
    font-size: 1.5rem;
    color: #212121;
    margin-bottom: 1rem;
    font-weight: 600;
}

.setting-item {
    margin-bottom: 1.5rem;
}

.setting-item label {
    display: block;
    font-size: 1rem;
    color: #212121;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Toggle Switch */
.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: #212121;
    border-radius: 26px;
    transition: background-color 0.3s;
    margin-left: 15px;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #fffee6;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider {
    background-color: #8ec622;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* Slider */
.slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #212121;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8ec622;
    cursor: pointer;
    border: 2px solid #212121;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8ec622;
    cursor: pointer;
    border: 2px solid #212121;
}

/* Select Input */
.select-input {
    width: 100%;
    padding: 10px 15px;
    font-size: 1rem;
    border: 2px solid #212121;
    border-radius: 8px;
    background: #fffee6;
    color: #212121;
    cursor: pointer;
    transition: all 0.3s;
}

.select-input:hover {
    border-color: #8ec622;
    background: #fffee6;
}

.select-input:focus {
    outline: none;
    border-color: #8ec622;
    background: #fffee6;
}

/* Tutorial Screen */
.tutorial-content {
    background: #fffee6;
    padding: 40px;
    border-radius: 8px;
    border: 3px solid #212121;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.tutorial-content h2 {
    font-size: 2.5rem;
    color: #212121;
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 700;
}

.tutorial-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #212121;
}

.tutorial-section:last-child {
    border-bottom: none;
}

.tutorial-section h3 {
    font-size: 1.5rem;
    color: #212121;
    margin-bottom: 1rem;
    font-weight: 600;
}

.tutorial-section p {
    font-size: 1rem;
    color: #212121;
    line-height: 1.6;
    opacity: 0.8;
}

.tutorial-list {
    list-style: none;
    padding: 0;
}

.tutorial-list li {
    font-size: 1rem;
    color: #212121;
    line-height: 1.8;
    margin-bottom: 0.8rem;
    padding-left: 1.5rem;
    position: relative;
    opacity: 0.8;
}

.tutorial-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #8ec622;
    font-weight: bold;
    font-size: 1.2rem;
}

.tutorial-list li strong {
    color: #212121;
    opacity: 1;
    font-weight: 600;
}

/* Responsive for Settings and Tutorial */
@media (max-width: 768px) {
    .settings-content,
    .tutorial-content {
        padding: 20px;
        max-width: 95%;
    }

    .settings-content h2,
    .tutorial-content h2 {
        font-size: 2rem;
    }

    .settings-section h3,
    .tutorial-section h3 {
        font-size: 1.2rem;
    }

    .game-header-buttons {
        flex-direction: column;
        gap: 5px;
    }
}

