:root {
    --bg: #f8e3c8;
    --bg-soft: #f4d9b8;
    --card-bg: #fdf2dd;
    --card-stroke: #f0cfa2;
    --accent: #d78246;
    --accent-strong: #b66432;

    --text-main: #5a3a24;
    --text-soft: #8c6a49;
    --text-muted: #b58c63;

    --radius-lg: 26px;
    --radius-pill: 999px;

    --shadow-soft: 0 14px 30px rgba(203, 152, 92, 0.25);
}

/* базовый каркас */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
        sans-serif;
    background: radial-gradient(circle at top, var(--bg), var(--bg-soft));
    color: var(--text-main);
}

.app {
    min-height: 100vh;
    max-width: 420px;
    margin: 0 auto;
    padding: 16px 14px 80px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.app-beige {
    background: transparent;
}

.album-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* общие карточки */

.card {
    background-color: var(--card-bg);
    background-image: var(--snow-cap);
    background-repeat: no-repeat;
    background-size: 100% var(--snow-cap-height);
    background-position: 0 0;
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--card-stroke);
    box-shadow: var(--shadow-soft);
    padding: 14px 16px;
}

/* шапка */

.album-header h1 {
    margin: 0 0 6px;
    font-size: 22px;
}

.album-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--text-soft);
}

/* карточка "Новый момент" */

.album-new-card {
    padding: 16px 16px 18px;
}

.album-new-inner {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 14px;
    align-items: center;
}

.album-new-illustration {
    width: 120px;
    height: 120px;
    border-radius: 22px;
    background: var(--card-bg);
    border: 1px solid var(--card-stroke);
    display: flex;
    align-items: center;
    justify-content: center;
}

.album-new-icon {
    width: 80px;
    height: 80px;
    display: block;
    object-fit: contain;
}

.album-new-text h2 {
    margin: 0 0 6px;
    font-size: 18px;
}

.album-new-text p {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--text-soft);
}

/* сетка моментов */

.album-grid-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.album-grid-title {
    margin: 0 2px 2px;
    font-size: 16px;
    font-weight: 600;
}

.album-limit {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
}

.album-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.album-placeholder {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    padding: 10px 0 2px;
}

.album-card {
    position: relative;
    border-radius: 20px;
    --album-card-bg: var(--card-bg);
    --album-card-stroke: var(--card-stroke);
    --album-thumb-bg: #fbe8ca;
    border: 1px solid var(--album-card-stroke);
    background-color: var(--album-card-bg);
    background-image: var(--snow-cap);
    background-repeat: no-repeat;
    background-size: 100% var(--snow-cap-height);
    background-position: 0 0;
    padding: 6px 6px 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

body[data-theme="base"] .album-card {
    --album-card-bg: #fdf2dd;
    --album-card-stroke: #f0cfa2;
    --album-thumb-bg: #fbe8ca;
}

body[data-theme="cozy"] .album-card {
    --album-card-bg: #fff1da;
    --album-card-stroke: #e0b17c;
    --album-thumb-bg: #f2e0c8;
}

body[data-focus="sunset"] .album-new-card {
    border-color: rgba(216, 106, 62, 0.55);
    background: linear-gradient(180deg, #fff4ea 0%, #ffd9c6 100%);
    box-shadow: 0 18px 32px rgba(150, 90, 120, 0.22);
}

body[data-focus="sunset"] .album-new-illustration {
    background: linear-gradient(180deg, #ffd4a3 0%, #ffb58d 55%, #c98ad8 100%);
    border: 1px solid rgba(216, 106, 62, 0.4);
}

body[data-theme="sunset"] .album-card {
    --album-card-bg: #fff1e7;
    --album-card-stroke: #f0b59b;
    --album-thumb-bg: #ffd9c4;
}

body[data-focus="ocean"] .album-new-card {
    border-color: rgba(47, 126, 156, 0.4);
    background: linear-gradient(180deg, #f4fbff 0%, #d9f0ec 100%);
    box-shadow: 0 18px 32px rgba(90, 140, 160, 0.2);
}

body[data-focus="ocean"] .album-new-illustration {
    background: linear-gradient(180deg, #e5f5ff 0%, #daf3f0 65%, #fbe3c3 100%);
    border: 1px solid rgba(47, 126, 156, 0.3);
}

body[data-theme="ocean"] .album-card {
    --album-card-bg: #f2fbfb;
    --album-card-stroke: #9ecbd1;
    --album-thumb-bg: #d9f0ec;
}

body[data-focus="minimal"] .album-new-card {
    border-color: var(--card-stroke);
    background: #fffdf9;
    box-shadow: 0 2px 6px rgba(90, 60, 40, 0.06);
}

body[data-focus="minimal"] .album-new-illustration {
    background: #fffdf9;
    border: 1px solid var(--card-stroke);
    border-radius: 16px;
    box-shadow: none;
    position: relative;
}

body[data-focus="minimal"] .album-new-illustration img {
    opacity: 0;
}

body[data-focus="minimal"] .album-new-illustration::after {
    content: "+";
    position: absolute;
    font-size: 32px;
    color: var(--accent);
    font-weight: 600;
}

body[data-theme="minimal"] .album-card {
    --album-card-bg: #f9f7f4;
    --album-card-stroke: #d6d1c7;
    --album-thumb-bg: #eee9e2;
}

body[data-theme="festive"] .album-card {
    --album-card-bg: #fff0ec;
    --album-card-stroke: #e9a79b;
    --album-thumb-bg: #f6d9d2;
}

.album-card-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 16px;
    background: var(--album-thumb-bg);
    border: 1px solid var(--album-card-stroke);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 4px;
    overflow: hidden;
}

.album-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.album-card h3 {
    margin: 0 2px 2px;
    font-size: 13px;
}

.album-card-date {
    margin: 0 2px 0;
    font-size: 11px;
    color: var(--text-soft);
}

.album-heart {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: none;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
    color: var(--accent-strong);
    z-index: 3;
    line-height: 1;
}

.album-heart.is-active {
    color: var(--accent);
}

/* модалка добавления */

.album-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(41, 25, 11, 0.25);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 14px;
    z-index: 10;
}

.album-modal {
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    max-height: 80svh;
    background: var(--card-bg);
    border-radius: 22px;
    border: 1px solid var(--card-stroke);
    box-shadow: var(--shadow-soft);
    padding: 14px 14px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.album-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.album-modal-header h3 {
    margin: 0;
    font-size: 17px;
}

.album-modal-close {
    border: none;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-soft);
}

.album-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.album-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.album-field-label {
    font-size: 12px;
    color: var(--text-soft);
}

.album-field input,
.album-field textarea {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--card-stroke);
    background: var(--card-bg);
    padding: 10px 12px;
    font-size: 16px;
    color: var(--text-main);
    outline: none;
    font-family: inherit;
}

.album-field textarea {
    resize: vertical;
    min-height: 70px;
}

.album-file {
    position: relative;
    display: flex;
    width: 100%;
    align-items: center;
    gap: 8px;
    border-radius: 16px;
    border: 1.5px dashed var(--card-stroke);
    background: var(--card-bg);
    padding: 10px 12px;
}

.album-file input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    padding: 0;
    border: none;
    background: transparent;
}

.album-file:focus-within {
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.album-file-button {
    border-radius: 999px;
    border: 1px solid var(--card-stroke);
    background: var(--bg-soft);
    color: var(--text-main);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.album-file-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.album-file.has-file .album-file-name {
    color: var(--text-main);
}

.album-form-hint {
    margin: 0;
    font-size: 12px;
    color: #b6493a;
}

.album-preview {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--card-stroke);
    background: var(--card-bg);
    object-fit: cover;
    aspect-ratio: 4 / 3;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.album-form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.secondary-btn {
    flex: 1;
    border-radius: var(--radius-pill);
    border: 1px solid var(--card-stroke);
    background: var(--card-bg);
    color: var(--text-soft);
    padding: 8px 12px;
    font-weight: 600;
    cursor: pointer;
}

/* кнопки */

.primary-btn {
    border-radius: var(--radius-pill);
    border: none;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fffdf6;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(170, 105, 60, 0.55);
    transition: transform 0.12s ease, box-shadow 0.12s ease,
        filter 0.12s ease;
    white-space: nowrap;
}

.primary-btn:active {
    filter: brightness(0.96);
}

.primary-btn-full {
    width: 100%;
    text-align: center;
}

/* лёгкая анимация */

.primary-btn.btn-bounce {
    animation: btn-bounce 0.18s ease-out;
}

@keyframes btn-bounce {
    0% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(1px) scale(0.97);
    }

    100% {
        transform: translateY(0) scale(1);
    }
}

/* навигация снизу */

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 10px;
    max-width: 420px;
    margin: 0 auto;
    padding: 6px 14px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.beige-nav {
    background: transparent;
    backdrop-filter: none;
}

.nav-btn {
    flex: 1;
    border-radius: 999px;
    border: 1px solid var(--card-stroke);
    background: var(--card-bg);
    color: var(--text-soft);
    padding: 6px 0 7px;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(200, 150, 100, 0.15);
    transition: transform 0.1s ease, box-shadow 0.1s ease,
        background 0.1s ease;
}

.nav-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(200, 150, 100, 0.28);
}

.nav-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(200, 150, 100, 0.22);
}

.nav-btn-active {
    background: linear-gradient(
        180deg,
        var(--card-bg) 0%,
        var(--card-stroke) 100%
    );
    color: var(--text-main);
}

.nav-icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.nav-icon img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.nav-label {
    font-size: 11px;
}

/* адаптив */

@media (max-width: 380px) {
    .album-new-inner {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .album-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
