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

:root {
    --bg: #0a0a14;
    --bg-card: #1a1a2e;
    --text: #ffffff;
    --text-muted: #888;
    --accent: #e63946;
    --gold: #ffd700;
    --purple: #a855f7;
    --radius: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* ===== СНЕЖИНКИ ===== */
.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.snowflake {
    position: absolute;
    top: -20px;
    color: rgba(255,255,255,0.7);
    font-size: 20px;
    animation: fall linear infinite;
}

.snowflake:nth-child(1) { left: 5%; animation-duration: 10s; }
.snowflake:nth-child(2) { left: 15%; animation-duration: 12s; animation-delay: 1s; }
.snowflake:nth-child(3) { left: 25%; animation-duration: 8s; animation-delay: 2s; }
.snowflake:nth-child(4) { left: 35%; animation-duration: 11s; animation-delay: 0.5s; }
.snowflake:nth-child(5) { left: 50%; animation-duration: 9s; animation-delay: 3s; }
.snowflake:nth-child(6) { left: 65%; animation-duration: 13s; animation-delay: 1.5s; }
.snowflake:nth-child(7) { left: 75%; animation-duration: 10s; animation-delay: 2.5s; }
.snowflake:nth-child(8) { left: 90%; animation-duration: 11s; animation-delay: 0.8s; }

@keyframes fall {
    to { transform: translateY(100vh) rotate(360deg); }
}

/* ===== ОНБОРДИНГ ===== */
.onboarding {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1a1a3e 0%, #0a0a14 100%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.onboarding-slide {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.onboarding-emoji {
    font-size: 64px;
    margin-bottom: 30px;
}

.onboarding-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.onboarding-text {
    font-size: 18px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 30px;
}

.onboarding-decoration {
    font-size: 32px;
    display: flex;
    justify-content: center;
    gap: 16px;
}

.onboarding-decoration span {
    animation: bounce 1s ease-in-out infinite;
}
.onboarding-decoration span:nth-child(2) { animation-delay: 0.1s; }
.onboarding-decoration span:nth-child(3) { animation-delay: 0.2s; }
.onboarding-decoration span:nth-child(4) { animation-delay: 0.3s; }

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

.onboarding-bottom {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 0 20px;
}

.onboarding-dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #333;
}

.dot.active {
    width: 24px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--accent), var(--gold));
}

.onboarding-btn {
    width: 100%;
    max-width: 280px;
    padding: 16px 32px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    color: white;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.onboarding-btn:active {
    transform: scale(0.95);
}

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

/* ===== ЭКРАНЫ ===== */
.screen {
    padding: 20px;
    padding-bottom: 100px;
    min-height: 100vh;
    animation: fadeIn 0.3s ease;
}

/* ===== HEADER ===== */
.main-header {
    text-align: center;
    padding: 20px 0 30px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 48px;
}

.logo-text h1 {
    font-size: 28px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text .subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

header h1 {
    flex: 1;
    font-size: 20px;
    text-align: center;
}

.back-btn, .edit-btn, .delete-btn {
    background: var(--bg-card);
    border: none;
    color: var(--text);
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
}

.delete-btn { color: var(--accent); }

/* ===== СПИСОК РЕЦЕПТОВ ===== */
.recipes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recipe-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: transform 0.2s;
}

.recipe-card:active {
    transform: scale(0.98);
}

.recipe-card-photo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.recipe-card-info {
    flex: 1;
}

.recipe-card-name {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
}

.recipe-card-preview {
    font-size: 14px;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state-text {
    color: var(--text-muted);
}

/* ===== КНОПКА ДОБАВИТЬ ===== */
.add-btn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 28px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(230, 57, 70, 0.4);
}

/* ===== ФОРМА ===== */
.recipe-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.photo-upload {
    cursor: pointer;
}

.photo-preview {
    background: var(--bg-card);
    border: 2px dashed #444;
    border-radius: var(--radius);
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 16px;
}

.photo-preview span:first-child {
    font-size: 32px;
}

.photo-preview.has-photo {
    border: none;
    padding: 0;
    overflow: hidden;
}

.photo-preview.has-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.form-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
}

.form-card label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
}

.form-card input,
.form-card textarea {
    width: 100%;
    background: #0f0f1a;
    border: none;
    border-radius: 10px;
    padding: 14px;
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    resize: none;
}

.form-card input::placeholder,
.form-card textarea::placeholder {
    color: #555;
}

.form-card input:focus,
.form-card textarea:focus {
    outline: 2px solid var(--gold);
}

.ai-btn {
    padding: 14px;
    border: 2px solid var(--purple);
    border-radius: var(--radius);
    background: rgba(168, 85, 247, 0.1);
    color: var(--purple);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.ai-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

.save-btn {
    padding: 16px;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent), var(--gold));
    color: white;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
}

/* ===== ПРОСМОТР ===== */
.view-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.view-photo {
    width: 100%;
    height: 200px;
    border-radius: var(--radius);
    object-fit: cover;
}

.view-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
}

.view-section-title {
    color: var(--gold);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.view-section-content {
    font-size: 16px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ===== КНОПКИ ДЕЙСТВИЙ ===== */
.view-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-bottom: 20px;
}

.action-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn.edit {
    background: var(--bg-card);
    color: var(--gold);
    border: 2px solid var(--gold);
}

.action-btn.delete {
    background: rgba(230, 57, 70, 0.15);
    color: var(--accent);
    border: 2px solid var(--accent);
}

.action-btn:active {
    transform: scale(0.95);
}

/* ===== LOADING ===== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading::after {
    content: "Загрузка...";
}
