:root {
    --bg-color: #7A2828;
    --header-bg: rgba(122, 40, 40, 0.95);
    --pill-bg: #C5A880;
    --pill-active-text: #5E1E1E;
    --pill-inactive-text: rgba(255, 255, 255, 0.6);
    --card-bg: #F9F3E9;
    --text-main: #5E1E1E;
    --text-light: #C5A880;
    --accent-gold: #D4AF37;
    --input-bg: #FFF8F0;
    --radius-soft: 20px;

    /* ЦВЕТА ИНСТИТУТОВ */
    --inst-poly: #B22222;
    --inst-econ: #D4AF37;
    --inst-hum: #800080;
    --inst-nat: #E67E22;
    --inst-law: #4169E1;
    --inst-med: #2E8B57;
    --inst-col: #87CEEB;
}

html {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-color);
    background-image: radial-gradient(circle at 50% 10%, rgba(255,255,255,0.05) 0%, transparent 40%);
    color: var(--text-main); 
    font-family: 'Nunito', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100%;
    display: flex; 
    flex-direction: column; 
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ЗАСТАВКА */
#splash-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color); z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.5s ease;
}
.splash-logo { 
    margin-bottom: 20px; 
    animation: bounce 2s infinite;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.splash-logo img {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.splash-text {
    color: #C5A880; font-family: 'Fraunces', serif; font-size: 24px;
    letter-spacing: 2px; text-transform: uppercase; animation: pulse 2s infinite;
}
@keyframes bounce { 0%, 100% {transform: translateY(0);} 50% {transform: translateY(-20px);} }
@keyframes pulse { 0%, 100% {opacity: 0.7;} 50% {opacity: 1;} }

/* HEADER */
.app-header {
    position: sticky; 
    top: 0; 
    z-index: 100;
    background: var(--header-bg); 
    backdrop-filter: blur(10px);
    padding: 10px 16px; 
    border-bottom: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    width: 100%;
}

.music-btn {
    background: rgba(0,0,0,0.25); 
    width: 38px; 
    height: 38px; 
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 18px; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    color: var(--pill-bg);
    border: 1px solid rgba(255,255,255,0.15);
    flex-shrink: 0;
}
.music-btn:hover {
    background: rgba(0,0,0,0.35);
    transform: scale(1.05);
}
.music-btn.playing { 
    background: var(--pill-bg); 
    color: #5E1E1E; 
    box-shadow: 0 0 12px rgba(197, 168, 128, 0.5); 
    animation: spinMusic 3s linear infinite; 
}
@keyframes spinMusic { 
    0% {transform: rotate(0deg);} 
    100% {transform: rotate(360deg);} 
}

.nav-segment { 
    background: rgba(0,0,0,0.25); 
    border-radius: 12px; 
    padding: 4px; 
    display: flex; 
    position: relative; 
    flex: 1;
    min-width: 0;
}
.nav-item { 
    flex: 1; 
    text-align: center; 
    padding: 8px 6px; 
    font-size: 12px; 
    font-weight: 700; 
    color: var(--pill-inactive-text); 
    cursor: pointer; 
    z-index: 2; 
    transition: 0.3s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-item:hover {
    color: rgba(255,255,255,0.8);
}
.nav-indicator { 
    position: absolute; 
    top: 4px; 
    bottom: 4px; 
    left: 4px; 
    width: calc(50% - 6px); 
    background: var(--pill-bg); 
    border-radius: 9px; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    z-index: 1; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.nav-item.active { 
    color: var(--pill-active-text); 
}
.nav-segment.has-admin[data-active="0"] .nav-indicator { 
    width: calc(33.3% - 6px); 
    transform: translateX(0); 
}
.nav-segment.has-admin[data-active="1"] .nav-indicator { 
    width: calc(33.3% - 6px); 
    transform: translateX(100%); 
}
.nav-segment.has-admin[data-active="2"] .nav-indicator { 
    width: calc(33.3% - 4px); 
    transform: translateX(200%); 
}
.nav-segment[data-active="0"] .nav-indicator { 
    transform: translateX(0); 
}
.nav-segment[data-active="1"] .nav-indicator { 
    transform: translateX(100%); 
    width: calc(50% - 2px); 
}

.main-container { 
    flex: 1; 
    padding: 15px; 
    padding-bottom: 40px; 
    max-width: 500px; 
    margin: 0 auto; 
    width: 100%; 
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 480px) {
    .main-container {
        padding: 12px;
        padding-bottom: 30px;
    }
}

@media (min-width: 501px) {
    .main-container {
        padding: 20px;
    }
}

.card {
    background: linear-gradient(145deg, #FFFDF7, #F3E5D0);
    border-radius: var(--radius-soft);
    padding: 22px 20px;
    margin-bottom: 18px;
    box-shadow: 0 14px 32px rgba(0,0,0,0.18);
    border: 1px solid rgba(255,255,255,0.7);
    outline: 1px solid rgba(0,0,0,0.03);
    animation: floatIn 0.5s ease-out;
    position: relative;
}
@keyframes floatIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

h1 { color: #C5A880; font-size: 24px; text-align: center; margin-bottom: 20px; }
h2 { 
    color: var(--text-main); 
    font-size: 22px; 
    text-align: center; 
    margin-bottom: 24px; 
    font-family: 'Fraunces', serif;
    font-weight: 600;
}
#profile-card h2 {
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid #E8DDD0;
}
p { text-align: center; font-size: 15px; color: #666; }

input, textarea, select {
    width: 100%; 
    background: #FFFFFF;
    border: 2px solid #E0D5C0; 
    border-radius: 12px;
    padding: 14px 16px; 
    font-family: 'Nunito', sans-serif;
    font-size: 15px; 
    color: var(--text-main);
    box-sizing: border-box; 
    margin-bottom: 20px; 
    outline: none; 
    appearance: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
input:focus, textarea:focus, select:focus { 
    background: #FFF; 
    border-color: #C5A880; 
    box-shadow: 0 0 0 3px rgba(197, 168, 128, 0.15);
    transform: translateY(-1px);
}
input::placeholder, textarea::placeholder {
    color: #B8A68A;
    opacity: 0.7;
}
label { 
    font-weight: 700; 
    font-size: 13px; 
    color: #5E1E1E; 
    margin-left: 4px; 
    display: block; 
    margin-bottom: 8px; 
    opacity: 1;
    letter-spacing: 0.3px;
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235E1E1E' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    cursor: pointer;
}

button {
    width: 100%; padding: 16px; border-radius: 50px; border: none;
    font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 16px;
    cursor: pointer; margin-top: 10px; position: relative;
}
.btn-primary { background: #4A6D4A; color: #FFF; }
.btn-gold { background: #C5A880; color: #5E1E1E; }
.btn-outline { 
    background: transparent; 
    border: 2px solid #C5A880; 
    color: #C5A880; 
}
.btn-contact-santa {
    margin-top: 15px;
    font-size: 15px;
    width: 100%;
}
.btn-admin-action { flex: 1; padding: 12px; font-size: 13px; margin: 0; }

.btn-disabled,
button:disabled {
    opacity: 0.6;
    cursor: default;
}

.helper-text {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: #8B5E3C;
    opacity: 0.8;
}

/* --- АДМИН: СТАТУС И ПРОГРЕСС --- */
.admin-state-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.admin-state-pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(0,0,0,0.05);
    color: #000;
}

.admin-state-pill.registration {
    background: rgba(76, 175, 80, 0.25);
    color: #000;
}

.admin-state-pill.gifting {
    background: rgba(255, 193, 7, 0.25);
    color: #000;
}

.admin-state-pill.reveal {
    background: rgba(103, 58, 183, 0.25);
    color: #000;
}

.admin-progress-text {
    font-size: 11px;
    color: #000;
}

.admin-progress-bar {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
    margin-bottom: 10px;
}

.admin-progress-bar-inner {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #4A6D4A, #D4AF37);
    transition: width 0.3s ease;
}

.toggle-container {
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    background: #F8F5F0; 
    padding: 18px 16px; 
    border-radius: 12px;
    margin-top: 10px; 
    margin-bottom: 20px;
    transition: 0.2s;
    border: 2px solid #E8DDD0;
}
.toggle-container:hover {
    background: #F5F0E8;
    border-color: #D4C5B0;
}
.toggle-text {
    flex: 1;
    padding-right: 12px;
}
.toggle-switch-wrapper {
    position: relative;
    cursor: pointer;
    display: inline-block;
}
.toggle-switch-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-switch { 
    position: relative; 
    width: 52px; 
    height: 30px; 
    background: #D0D0D0; 
    border-radius: 20px; 
    transition: 0.3s ease;
    display: block;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.toggle-knob {
    position: absolute; 
    top: 3px; 
    left: 3px; 
    width: 24px; 
    height: 24px;
    background: #FFF; 
    border-radius: 50%; 
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.toggle-switch-wrapper input[type="checkbox"]:checked + .toggle-switch { 
    background: #4A6D4A; 
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
}
.toggle-switch-wrapper input[type="checkbox"]:checked + .toggle-switch .toggle-knob { 
    transform: translateX(22px); 
    box-shadow: 0 2px 8px rgba(74, 109, 74, 0.4);
}

/* АДМИНКА */
.admin-dashboard { display: grid; gap: 10px; margin-bottom: 20px; }
.stat-card { background: #FFF; padding: 15px; border-radius: 15px; text-align: center; border: 1px solid rgba(0,0,0,0.05); box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.stat-val { font-size: 24px; font-weight: 800; color: #333; }
.stat-label { font-size: 12px; color: #888; text-transform: uppercase; }

.inst-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.inst-item {
    background: #FFF; padding: 10px; border-radius: 12px; font-size: 12px;
    display: flex; align-items: center; justify-content: space-between;
    border-left: 4px solid #ccc;
}
.inst-count { font-weight: 800; font-size: 14px; }

.user-list-container { background: rgba(0,0,0,0.2); border-radius: 15px; padding: 10px; max-height: 400px; overflow-y: auto; }
.user-row {
    background: rgba(255,253,247,0.96);
    padding: 10px 12px;
    border-radius: 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #ccc;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.user-row-details { display: flex; flex-direction: column; }
.user-row-name { font-weight: 700; color: #333; }
.user-row-inst { font-size: 11px; color: #888; }
.user-row-status { font-size: 16px; }

.photo-upload {
    border: 2px dashed #C5A880;
    padding: 18px;
    text-align: center;
    border-radius: 16px;
    cursor: pointer;
    color: #8B5E3C;
    background: rgba(255,255,255,0.6);
    transition: 0.2s ease;
}
.photo-upload:hover {
    background: rgba(255,255,255,0.9);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}
.gif-container { 
    width: 100%; 
    border-radius: 15px; 
    overflow: hidden; 
    margin-bottom: 20px;
    background: rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.gif-container img { 
    width: 100%; 
    height: auto;
    display: block; 
    object-fit: contain;
    background: transparent;
}
.hidden { display: none !important; }
.footer { 
    text-align: center; 
    margin-top: auto; 
    padding: 20px 10px; 
    border-top: 1px solid rgba(255,255,255,0.1);
    position: relative;
    overflow: hidden;
}
.footer a { 
    color: rgba(255,255,255,0.4); 
    text-decoration: none; 
    font-size: 12px; 
    font-weight: 600;
    display: block;
    margin: 10px 0;
    z-index: 2;
    position: relative;
}

.footer-decorations {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 5px 0;
    animation: twinkle 3s ease-in-out infinite;
}

.footer-emoji {
    font-size: 18px;
    display: inline-block;
    animation: float 2s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(255,255,255,0.3));
}

.footer-emoji:nth-child(1) { animation-delay: 0s; }
.footer-emoji:nth-child(2) { animation-delay: 0.2s; }
.footer-emoji:nth-child(3) { animation-delay: 0.4s; }
.footer-emoji:nth-child(4) { animation-delay: 0.6s; }
.footer-emoji:nth-child(5) { animation-delay: 0.8s; }
.footer-emoji:nth-child(6) { animation-delay: 1s; }
.footer-emoji:nth-child(7) { animation-delay: 1.2s; }

@keyframes float {
    0%, 100% { 
        transform: translateY(0) rotate(0deg);
        opacity: 0.7;
    }
    50% { 
        transform: translateY(-8px) rotate(5deg);
        opacity: 1;
    }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}
.loader { display: inline-block; width: 16px; height: 16px; border: 2px solid #FFF; border-bottom-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.snowflake { position: fixed; top: -10px; color: rgba(255,255,255,0.15); font-size: 20px; user-select: none; z-index: -1; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(110vh); } }

/* --- ОТКРЫТЬ ПОДАРОК (REVEAL) --- */
#screen-reveal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
}

#screen-reveal h1 {
    margin-top: 10px;
    margin-bottom: 10px;
    font-family: 'Fraunces', serif;
    font-size: 26px;
    color: #FFE9B5;
    text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

#gift-content {
    width: 100%;
}

.mystery-box {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    border-radius: 20px;
    background: #C5A880;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.2);
    transition: opacity 0.2s ease;
}

.mystery-box p {
    margin: 6px 0 0 0;
    font-size: 16px;
    color: #FFF;
    font-weight: 600;
}

.mystery-box:hover {
    opacity: 0.9;
}

.shake-it {
    animation: shakeGift 0.5s ease-in-out;
}

@keyframes shakeGift {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

.reveal-anim {
    animation: fadeUp 0.6s ease-out;
}

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

.admin-preview {
    margin: 0 0 10px 0;
    padding: 10px;
    border-radius: 10px;
    background: rgba(249,243,233,0.95);
}

/* ... Оставляешь свои старые стили ... */

/* --- ИСПРАВЛЕННЫЙ СНЕГ (PURE CSS) --- */
/* Контейнер для снега, чтобы он не перекрывал клики */
.snow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Важно: пропускает клики сквозь себя */
    z-index: 1; /* Поверх фона, но под контентом */
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -10px;
    color: #FFF;
    font-size: 1em;
    font-family: Arial, sans-serif;
    text-shadow: 0 0 5px #000;
    animation-name: fall, shake;
    animation-duration: 10s, 3s;
    animation-timing-function: linear, ease-in-out;
    animation-iteration-count: infinite, infinite;
}

@keyframes fall {
    0% { top: -10%; }
    100% { top: 100%; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(80px); }
}

/* --- СТИЛИ ДЛЯ МЕДИА (Видео и Картинки) --- */
.media-content {
    width: 100%;
    border-radius: 15px;
    margin-top: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: block;
    object-fit: cover; /* Чтобы красиво заполняло */
}

/* Специфика для видео */
video.media-content {
    background: #000;
    max-height: 400px; /* Ограничение высоты */
}