:root {
    --bg-start: #1a2a3a;
    --bg-end: #0f1a24;
    --surface: rgba(25, 35, 45, 0.85);
    --accent: #6ba5d9;
    --danger: #c97b6b;
    --success: #6b9c7a;
    --text: #e2e8f0;
    --text-muted: #9ab3c5;
}
* {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; user-select: none;
}
body {
    font-family: system-ui, -apple-system, sans-serif;
    background: radial-gradient(ellipse at 30% 40%, var(--bg-start), var(--bg-end));
    color: var(--text); min-height: 100vh;
    display: flex; justify-content: center; align-items: center;
}
.app {
    width: 100%; max-width: 400px; aspect-ratio: 9/16;
    margin: 0 auto; display: flex; flex-direction: column;
    position: relative; background: radial-gradient(ellipse at 30% 40%, var(--bg-start), var(--bg-end));
    border-radius: 32px; overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 20px 40px rgba(0,0,0,0.4);
}
.app-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0; position: relative; }

/* Экран загрузки */
.loading-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: #0f1a24; display: flex; flex-direction: column;
    align-items: center; justify-content: center; z-index: 200;
    transition: opacity 0.5s ease;
}
.loading-screen.hidden { opacity: 0; pointer-events: none; }
.loading-video { width: 100%; height: 100%; object-fit: cover; }
.sound-toggle {
    position: absolute; top: 20px; left: 20px;
    background: rgba(0,0,0,0.5); border: 2px solid rgba(255,255,255,0.5);
    border-radius: 50%; width: 56px; height: 56px;
    font-size: 28px; cursor: pointer; z-index: 201;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s ease; color: white;
}
.sound-toggle:active { transform: scale(0.9); }

/* Меню */
.menu-screen { display: flex; flex-direction: column; height: 100%; padding: 20px 16px; }
.menu-screen.hidden { display: none; }
.app-header { text-align: center; padding: 10px 0 16px; cursor: pointer; }
.app-header h1 {
    font-size: 22px; font-weight: 800;
    background: linear-gradient(90deg, var(--accent), var(--success));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.app-header img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; transition: transform 0.2s ease; }
.app-header:active img { transform: scale(0.95); }
.app-header p { color: var(--text-muted); font-size: 11px; margin-top: 4px; }
.menu-grid { display: flex; flex-direction: column; gap: 14px; flex: 1; }

/* 3D КНОПКИ */
.menu-btn {
    background: linear-gradient(145deg, rgba(40,55,70,0.95), rgba(25,35,45,0.9));
    backdrop-filter: blur(10px); border: 2px solid rgba(107,165,217,0.3);
    border-radius: 20px; padding: 20px 18px; color: white;
    display: flex; align-items: center; gap: 16px; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    box-shadow: 0 8px 0 rgba(0,0,0,0.3), 0 15px 20px rgba(0,0,0,0.4), inset 0 2px 0 rgba(255,255,255,0.1);
    transform: translateY(0);
}
.menu-btn:active {
    transform: translateY(4px);
    box-shadow: 0 4px 0 rgba(0,0,0,0.3), 0 8px 10px rgba(0,0,0,0.4), inset 0 2px 0 rgba(255,255,255,0.1);
    background: linear-gradient(145deg, rgba(25,35,45,0.95), rgba(40,55,70,0.9));
}
.menu-btn .icon {
    font-size: 36px; width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 16px; flex-shrink: 0;
    background: rgba(107,165,217,0.2); box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.menu-btn .label { font-weight: 700; font-size: 17px; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.menu-btn .desc { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.menu-btn.emergency {
    background: linear-gradient(145deg, rgba(201,123,107,0.4), rgba(150,80,70,0.3));
    border: 2px solid rgba(201,123,107,0.5);
    box-shadow: 0 8px 0 rgba(100,50,40,0.4), 0 15px 20px rgba(0,0,0,0.4), inset 0 2px 0 rgba(255,255,255,0.1);
}
.menu-btn.emergency:active {
    box-shadow: 0 4px 0 rgba(100,50,40,0.4), 0 8px 10px rgba(0,0,0,0.4), inset 0 2px 0 rgba(255,255,255,0.1);
}

/* Экраны */
.section-screen {
    display: none; flex-direction: column; height: 100%;
    opacity: 0; transform: translateY(10px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}
.section-screen.active { display: flex; opacity: 1; transform: translateY(0); }
.screen-header {
    padding: 14px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(15,26,36,0.9); backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 10;
}
.screen-back {
    width: 36px; height: 36px; border: none; border-radius: 10px;
    background: var(--surface); color: var(--text); font-size: 18px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.2s ease;
}
.screen-back:active { transform: scale(0.95); }
.screen-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.screen-content { flex: 1; padding: 14px; overflow-y: auto; }

/* Дыхание */
@keyframes breathe {
    0%, 100% { transform: scale(1); opacity: 0.7; box-shadow: 0 0 20px rgba(107,165,217,0.3); }
    50% { transform: scale(1.12); opacity: 1; box-shadow: 0 0 40px rgba(107,165,217,0.6); }
}
.breathing-circle { animation: breathe 5s ease-in-out infinite; }

/* Карточки */
.instruction-card, .support-card, .diary-form-card, .stat-card, .tech-card {
    background: var(--surface); backdrop-filter: blur(10px);
    border-radius: 20px; padding: 16px; margin-bottom: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}
.instruction-card h3 { color: var(--accent); margin-bottom: 10px; font-size: 16px; }
.instruction-card p { color: var(--text-muted); font-size: 13px; line-height: 1.4; }
.instruction-card .step { display: flex; gap: 10px; margin-bottom: 12px; align-items: flex-start; }
.instruction-card .step-num {
    background: var(--accent); width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12px; flex-shrink: 0;
}

.support-card {
    background: linear-gradient(135deg, rgba(107,165,217,0.1), rgba(107,156,122,0.05));
    border: 1px solid rgba(107,165,217,0.2); text-align: center;
}
.support-phone { font-size: 20px; font-weight: 800; color: var(--success); letter-spacing: 1px; margin-bottom: 12px; }
.copy-btn {
    background: var(--success); border: none; border-radius: 60px;
    padding: 10px 20px; color: white; font-weight: 700;
    cursor: pointer; width: 100%; transition: all 0.2s ease; font-size: 14px;
}
.copy-btn:active { transform: scale(0.96); }

.projects-grid { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.project-card {
    background: var(--surface); backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.06); border-radius: 14px;
    padding: 10px 14px; text-decoration: none; color: var(--text);
    display: flex; align-items: center; gap: 10px; transition: all 0.3s ease;
}
.project-card:active { transform: scale(0.98); border-color: var(--accent); }
.project-card .icon {
    font-size: 22px; width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(107,165,217,0.15); border-radius: 10px;
}
.project-card .title { font-weight: 600; font-size: 13px; }
.project-card .desc { font-size: 10px; color: var(--text-muted); }
.project-card .arrow { margin-left: auto; color: var(--text-muted); }

.tech-card { cursor: pointer; transition: all 0.3s ease; border: 1px solid rgba(255,255,255,0.05); }
.tech-card:active { transform: scale(0.98); }
.tech-card h3 { font-size: 16px; margin-bottom: 4px; }
.tech-card p { font-size: 12px; color: var(--text-muted); }

/* Дыхание и шарик */
.breath-wrap, .balloon-wrap {
    text-align: center; padding: 20px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 70%;
}
.circle-anim {
    width: 180px; height: 180px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #4a7a9e);
    margin: 20px auto; transition: transform 4s ease-in-out;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    box-shadow: 0 0 30px rgba(107,165,217,0.2);
}
.circle-anim .timer-inside { color: white; font-size: 56px; font-weight: 800; line-height: 1; }
.circle-anim .phase-text { color: white; font-size: 16px; font-weight: 600; margin-top: 6px; }
.circle-anim.inhale { transform: scale(1.3); }
.circle-anim.exhale { transform: scale(1); }
.btn-group { display: flex; gap: 10px; width: 100%; margin-top: 16px; }
.btn {
    flex: 1; padding: 12px; border: none; border-radius: 14px;
    font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.2s ease;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:active { transform: scale(0.96); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid rgba(255,255,255,0.1); }

.balloon {
    width: 90px; height: 110px;
    background: radial-gradient(circle at 30% 30%, #6ba5d9, #3b6e8a, #1d4ed8);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    margin: 20px auto 0; transition: transform 2s ease-in-out;
    position: relative; box-shadow: 0 0 20px rgba(107,165,217,0.2);
}
.balloon.inflate { transform: scale(1.4); }
.balloon::after {
    content: ''; position: absolute; bottom: -10px; left: 50%;
    transform: translateX(-50%); width: 0; height: 0;
    border-left: 6px solid transparent; border-right: 6px solid transparent;
    border-top: 10px solid #1d4ed8;
}
.balloon-string { width: 2px; height: 40px; background: #94a3b8; margin: 0 auto; }

/* Босс */
#physicalScreen { background: var(--bg-start); }
.boss-fullscreen {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: flex-start;
    position: relative; padding: 16px 0 0;
}
.boss-video {
    width: 70%; max-width: 240px; object-fit: contain;
    transition: transform 0.1s; filter: drop-shadow(0 8px 20px rgba(0,0,0,0.4));
    margin-top: 10px;
}
.boss-video.hit { transform: scale(0.95) rotate(1deg); }
.boss-zones {
    position: absolute; top: 10px; left: 0; right: 0; bottom: 0;
    pointer-events: none;
}
.boss-zone {
    position: absolute; cursor: pointer; pointer-events: auto; border-radius: 12px;
}
.zone-head { top: 0%; left: 18%; width: 64%; height: 12%; }
.zone-face { top: 12%; left: 25%; width: 50%; height: 15%; }
.zone-body { top: 27%; left: 28%; width: 44%; height: 35%; }
.zone-legs { top: 62%; left: 25%; width: 50%; height: 38%; }
.boss-ui {
    margin-top: 16px; padding: 12px 16px 20px;
    background: linear-gradient(transparent, rgba(15,26,36,0.95)); width: 100%;
}
.stress-label { text-align: center; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.stress-bar {
    width: 100%; height: 6px; background: rgba(255,255,255,0.08);
    border-radius: 4px; overflow: hidden; margin-bottom: 12px;
}
.stress-bar-fill {
    height: 100%; background: linear-gradient(90deg, var(--success), var(--danger));
    border-radius: 4px; transition: width 0.3s ease; width: 100%;
}

/* Летящие предметы */
.flying-item {
    position: fixed; font-size: 28px; z-index: 1000;
    pointer-events: none; will-change: left, top, transform;
}
.flying-item.trace { opacity: 0.3; filter: blur(2px); z-index: 999; }
.green-clip { filter: hue-rotate(80deg) brightness(1.2); }
.particle {
    position: fixed; font-size: 22px; pointer-events: none;
    z-index: 1001; animation: explode 0.5s ease-out forwards;
}
@keyframes explode {
    0% { transform: scale(0.5) translate(0, 0); opacity: 1; }
    100% { transform: scale(1.2) translate(var(--tx), var(--ty)); opacity: 0; }
}

/* Дневник и Прогресс */
.diary-tabs { display: flex; gap: 10px; margin-bottom: 14px; }
.diary-tab {
    flex: 1; padding: 12px; border: none; border-radius: 12px;
    background: var(--surface); color: var(--text-muted);
    font-weight: 700; cursor: pointer; transition: all 0.3s ease;
}
.diary-tab.active { background: var(--accent); color: white; }
.diary-form-card textarea {
    width: 100%; min-height: 70px; padding: 10px; border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05);
    color: var(--text); font-size: 13px; resize: vertical; font-family: inherit;
}
.diary-save {
    width: 100%; padding: 12px; border: none; border-radius: 14px;
    background: var(--accent); color: white; font-size: 14px;
    font-weight: 700; cursor: pointer; transition: all 0.2s ease;
}
.diary-entry { background: rgba(255,255,255,0.04); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.diary-entry-level { color: var(--danger); font-weight: 700; }
.stat-card {
    background: var(--surface); backdrop-filter: blur(10px);
    border-radius: 16px; padding: 16px; text-align: center;
    margin-bottom: 10px; border: 1px solid rgba(255,255,255,0.05);
}
.stat-val {
    font-size: 32px; font-weight: 800;
    background: linear-gradient(90deg, var(--accent), var(--success));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* Экстренный */
.emergency-steps {
    background: var(--surface); backdrop-filter: blur(10px);
    padding: 16px; border-radius: 16px; margin: 16px 0; text-align: left;
}
.step { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 14px; }
.emergency-timer {
    font-size: 40px; font-weight: 800; font-family: monospace;
    color: var(--danger); margin: 16px 0; text-align: center;
}
.breath-circle {
    width: 100px; height: 100px; border-radius: 50%;
    background: var(--accent); margin: 16px auto;
    transition: transform 4s ease-in-out;
    box-shadow: 0 0 20px rgba(107,165,217,0.2);
}
.emergency-content {
    text-align: center; display: flex; flex-direction: column;
    align-items: center; justify-content: center; min-height: 70%; padding: 16px;
}

@media (max-width: 380px) {
    .menu-grid { gap: 10px; }
    .menu-btn { padding: 16px 14px; }
    .menu-btn .icon { width: 48px; height: 48px; font-size: 30px; }
    .menu-btn .label { font-size: 15px; }
}