/* ==================== ОСНОВНЫЕ СТИЛИ ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(120, 219, 255, 0.3) 0%, transparent 50%);
    z-index: -1;
}

.container {
    width: 95%;
    max-width: 1400px;
    height: 95vh;
    background: rgba(25, 25, 35, 0.95);
    border-radius: 25px;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==================== ОБЩИЕ ЭКРАНЫ ==================== */
.screen {
    width: 100%;
    height: 100%;
    padding: 30px;
    display: none;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 0;
    animation: fadeIn 0.5s ease-out;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== ЭКРАН СТАРТА ==================== */
.start-content {
    text-align: center;
    margin: auto;
    max-width: 800px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    flex: 1;
    gap: 16px;
    overflow: hidden;
}

h1 {
    font-family: 'Press Start 2P', cursive;
    color: #00ff9d;
    font-size: 2.6rem;
    margin: 0;
    text-shadow:
        0 0 10px #00ff9d,
        0 0 20px #00ff9d,
        3px 3px 0 #000;
    letter-spacing: 2px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 10px #00ff9d, 0 0 20px #00ff9d, 3px 3px 0 #000; }
    to { text-shadow: 0 0 15px #00ff9d, 0 0 30px #00ff9d, 3px 3px 0 #000; }
}

.subtitle {
    font-size: 1.7rem;
    color: #fff;
    margin: 0;
    font-weight: 700;
    text-shadow: 2px 2px 0 #000;
}

.character-container {
    margin: 0;
    width: 300px;
    height: 210px;
    position: relative;
}

.character {
    width: 120px;
    height: 180px;
    position: relative;
    margin: 0 auto;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.char-head {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #ff9966, #ff5e62);
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 20px;
    border: 5px solid #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.char-body {
    width: 90px;
    height: 100px;
    background: linear-gradient(135deg, #36d1dc, #5b86e5);
    border-radius: 20px;
    position: absolute;
    top: 60px;
    left: 15px;
    border: 5px solid #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.char-arm-left, .char-arm-right {
    width: 50px;
    height: 20px;
    background: linear-gradient(135deg, #36d1dc, #5b86e5);
    border-radius: 10px;
    position: absolute;
    top: 80px;
    border: 3px solid #fff;
}

.char-arm-left {
    left: -15px;
    transform: rotate(45deg);
    animation: waveLeft 1.5s infinite;
}

.char-arm-right {
    right: 15px;
    transform: rotate(-45deg);
    animation: waveRight 1.5s infinite;
}

.char-eye {
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 30px;
    left: 40px;
    box-shadow: 0 0 0 8px #000;
}

@keyframes waveLeft {
    0%, 100% { transform: rotate(45deg); }
    50% { transform: rotate(60deg); }
}

@keyframes waveRight {
    0%, 100% { transform: rotate(-45deg); }
    50% { transform: rotate(-60deg); }
}

.speech-bubble {
    position: absolute;
    top: 85%;
    left: 65%;
    transform: translateX(-50%) translateY(-50%);
    background: white;
    padding: 12px 16px;
    border-radius: 20px;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    max-width: 220px;
    text-align: center;
    z-index: 10;
    word-wrap: break-word;
    font-size: 1rem;
    white-space: normal;
    line-height: 1.3;

}

.speech-bubble::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 10px 10px;
    border-style: solid;
    border-color: transparent transparent white;
}

.instructions {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    max-height: 280px;
    overflow-y: hidden;
    margin: 0;
    flex: 1;
}

.instructions::-webkit-scrollbar {
    display: none;
}

.instructions::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.instructions::-webkit-scrollbar-thumb {
    background: #00ff9d;
    border-radius: 10px;
}

.instructions h3 {
    color: #00ff9d;
    margin-bottom: 12px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    transition: transform 0.3s;
}

.rule-item:hover {
    transform: translateX(10px);
    background: rgba(0, 0, 0, 0.5);
}

.rule-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.rule-text {
    color: white;
    font-size: 1.05rem;
}

.controls {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 12px 20px;
    margin-bottom: 10px;
}

.controls h3 {
    color: #ffcc00;
    margin-bottom: 4px;
    font-size: 1.3rem;
    gap: 8px;
}

.controls p {
    color: #ccc;
    font-size: 1.05rem;
    margin: 0;
}

.btn {
    background: linear-gradient(45deg, #00ff9d, #00b8ff);
    color: #000;
    border: none;
    padding: 18px 50px;
    font-size: 1.3rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    box-shadow:
        0 5px 20px rgba(0, 255, 157, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow:
        0 10px 30px rgba(0, 255, 157, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

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

.btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    transition: all 0.5s;
}

.btn:hover::after {
    left: 100%;
}

.start-button {
    margin: 2px 0 0 0;
    font-size: 1.4rem;
    padding: 14px 55px;
    align-self: center;
    flex-shrink: 0;
}

.author {
    margin-top: auto;
    padding: 10px 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

/* ==================== ИГРОВОЙ ЭКРАН ==================== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    margin-bottom: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.game-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bug-icon {
    font-size: 2rem;
    animation: bugWiggle 2s infinite;
}

@keyframes bugWiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    75% { transform: rotate(15deg); }
}

.game-title h2 {
    font-family: 'Press Start 2P', cursive;
    color: #fff;
    font-size: 1.2rem;
}

.stats-container {
    display: flex;
    gap: 20px;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    min-width: 140px;
    transition: all 0.3s;
}

.stat-box:hover {
    transform: translateY(-5px);
    border-color: #00ff9d;
    box-shadow: 0 5px 20px rgba(0, 255, 157, 0.3);
}

.stat-icon {
    font-size: 1.8rem;
    color: #00ff9d;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 255, 157, 0.1);
    border-radius: 12px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    color: #aaa;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    color: #fff;
    font-size: 1.8rem;
    font-weight: bold;
    font-family: 'Press Start 2P', cursive;
}

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

.icon-btn {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(0, 255, 157, 0.2);
    border-color: #00ff9d;
    transform: scale(1.1);
}

/* Прогресс-бар */
.progress-container {
    margin-bottom: 20px;
}

.progress-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.progress-bar {
    width: 100%;
    height: 15px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#boss-progress {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #00ff9d, #00b8ff);
    border-radius: 8px;
    transition: width 1s linear;
}

/* Игровая область */
#game-area {
    flex-grow: 1;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 30%, rgba(0, 255, 157, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 184, 255, 0.05) 0%, transparent 50%);
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
}

/* Файлы (баги, фичи) */
.bug, .feature, .bonus {
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 2.5rem;
    user-select: none;
    transition: all 0.2s;
    z-index: 10;
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: floatItem 3s ease-in-out infinite;
}

@keyframes floatItem {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

.bug {
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    border: 3px solid #ff9900;
}

.bug:hover {
    transform: scale(1.2) rotate(10deg);
    box-shadow:
        0 0 30px rgba(255, 65, 108, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.feature {
    background: linear-gradient(135deg, #36d1dc, #5b86e5);
    border: 3px solid #00ccff;
}

.feature:hover {
    transform: scale(1.2) rotate(-10deg);
    box-shadow:
        0 0 30px rgba(54, 209, 220, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.bonus {
    background: linear-gradient(135deg, #fdc830, #f37335);
    border: 3px solid #ffcc00;
    animation: bonusGlow 1s infinite alternate;
}

@keyframes bonusGlow {
    from { box-shadow: 0 0 20px rgba(253, 200, 48, 0.5); }
    to { box-shadow: 0 0 40px rgba(253, 200, 48, 0.8); }
}

/* Босс */
.boss {
    position: absolute;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #8e2de2, #4a00e0);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 3.5rem;
    z-index: 100;
    border: 5px solid #ff0000;
    box-shadow:
        0 0 50px rgba(255, 0, 0, 0.7),
        inset 0 0 20px rgba(255, 255, 255, 0.3);
    animation: bossPulse 2s infinite;
    transition: all 0.3s;
}

@keyframes bossPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 50px rgba(255, 0, 0, 0.7); }
    50% { transform: scale(1.05); box-shadow: 0 0 80px rgba(255, 0, 0, 0.9); }
}

.boss:hover {
    transform: scale(1.1);
    box-shadow: 0 0 100px rgba(255, 0, 0, 1);
}

.boss-health-bar {
    position: absolute;
    bottom: -25px;
    left: 5%;
    width: 90%;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#boss-health-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #00ff9d, #00b8ff);
    transition: width 0.3s;
}

/* Статус босса */
#boss-status {
    background: rgba(255, 0, 0, 0.1);
    border: 2px solid #ff0000;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
    animation: statusPulse 1s infinite;
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 0, 0, 0.3); }
    50% { box-shadow: 0 0 20px rgba(255, 0, 0, 0.6); }
}

.boss-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    color: #fff;
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.boss-health-container {
    margin-bottom: 10px;
}

.boss-health-text {
    text-align: center;
    color: #fff;
    font-size: 0.9rem;
    margin-top: 5px;
}

.boss-hint {
    text-align: center;
    color: #ffcc00;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.hidden {
    display: none !important;
}

/* Подсказки */
.hints {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 0.9rem;
}

.hint-icon {
    font-size: 1.5rem;
}

/* ==================== ЭКРАН ОКОНЧАНИЯ ==================== */
.end-content {
    text-align: center;
    margin: auto;
    max-width: 700px;
    background: rgba(0, 0, 0, 0.7);
    padding: 40px;
    border-radius: 30px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.result-header {
    margin-bottom: 30px;
}

.trophy {
    font-size: 4rem;
    color: #ffcc00;
    margin-bottom: 20px;
    animation: spin 2s ease-in-out;
}

@keyframes spin {
    0% { transform: rotate(0deg) scale(0); }
    100% { transform: rotate(360deg) scale(1); }
}

.result-header h2 {
    color: #fff;
    font-size: 2.5rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.final-stats {
    display: flex;
    justify-content: space-around;
    margin: 40px 0;
}

.final-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.final-icon {
    font-size: 2.5rem;
    color: #00ff9d;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 255, 157, 0.1);
    border-radius: 50%;
    border: 3px solid rgba(0, 255, 157, 0.3);
}

.final-value {
    color: #fff;
    font-size: 3rem;
    font-weight: bold;
    font-family: 'Press Start 2P', cursive;
}

.final-label {
    color: #aaa;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.achievement {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px;
    margin: 30px 0;
    border-left: 5px solid #ffcc00;
}

.achievement-icon {
    font-size: 4rem;
    min-width: 80px;
}

.achievement-text {
    text-align: left;
}

.achievement-text h3 {
    color: #ffcc00;
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.achievement-text p {
    color: #ccc;
    font-size: 1.1rem;
}

.message-box {
    background: rgba(0, 255, 157, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin: 30px 0;
    border: 2px solid rgba(0, 255, 157, 0.3);
}

.message-box p {
    color: #fff;
    font-size: 1.3rem;
    font-weight: bold;
}

.action-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
}

.action-btn {
    padding: 15px 40px;
    font-size: 1.1rem;
}

.share-btn {
    background: linear-gradient(45deg, #8e2de2, #4a00e0);
}

.high-score {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.high-score h4 {
    color: #ffcc00;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.score-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
}

.score-display span:first-child {
    color: #00ff9d;
    font-size: 3rem;
    font-weight: bold;
    font-family: 'Press Start 2P', cursive;
}

.score-label {
    color: #aaa;
    font-size: 1.2rem;
}

/* ==================== СООБЩЕНИЯ ==================== */
#message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 300px;
}

.message {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    border-left: 5px solid #00ff9d;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.5s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.message.success { border-color: #00ff9d; }
.message.error { border-color: #ff416c; }
.message.warning { border-color: #ffcc00; }
.message.info { border-color: #36d1dc; }

.message-icon {
    font-size: 1.5rem;
}

/* ==================== АДАПТИВНОСТЬ ==================== */
@media (max-width: 1200px) {
    .container {
        height: 100vh;
        border-radius: 0;
        width: 100%;
    }

    .stats-container {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stat-box {
        min-width: 120px;
    }
}

@media (max-width: 768px) {
    .screen {
        padding: 15px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1.3rem;
    }

    .character-container {
        width: 250px;
        height: 200px;
    }

    .rules {
        grid-template-columns: 1fr;
    }

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

    .stats-container {
        order: 3;
        width: 100%;
        justify-content: space-around;
    }

    .stat-box {
        min-width: 100px;
        padding: 10px 15px;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .hints {
        flex-direction: column;
        gap: 10px;
    }

    .final-stats {
        flex-direction: column;
        gap: 30px;
    }

    .action-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.4rem;
    }

    .bug, .feature, .bonus {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .boss {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }

    .end-content {
        padding: 20px;
    }
}