:root {
    --bg-cream: #f7f0e6;
    --panel: rgba(255, 252, 246, 0.86);
    --panel-strong: rgba(255, 250, 244, 0.94);
    --ink: #1f1a18;
    --muted: #7e756f;
    --line: rgba(77, 61, 54, 0.12);
    --accent: #ea5b57;
    --shadow: 0 22px 60px rgba(58, 41, 28, 0.14);
    --calendar-image: none;
    color-scheme: light;
    font-family: "Avenir Next", "SUIT Variable", "Pretendard Variable", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.9), transparent 44%),
        linear-gradient(180deg, #fdf7ef 0%, #f2ebe1 100%);
    color: var(--ink);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: var(--calendar-image);
    background-size: cover;
    background-position: center;
    filter: blur(10px) saturate(0.9);
    opacity: 0;
    transform: scale(1.08);
    transition: opacity 220ms ease;
    z-index: 0;
}

body.has-photo-bg::before {
    opacity: 0.28;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 249, 241, 0.84), rgba(249, 239, 226, 0.92)),
        radial-gradient(circle at 10% 0%, rgba(255, 255, 255, 0.72), transparent 30%);
    z-index: 0;
}

.page-backdrop {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 90% 10%, rgba(255, 215, 167, 0.42), transparent 28%),
        radial-gradient(circle at 0% 100%, rgba(120, 169, 231, 0.24), transparent 25%);
    pointer-events: none;
    z-index: 1;
}

.app-shell {
    position: relative;
    z-index: 2;
    max-width: 520px;
    margin: 0 auto;
    padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(env(safe-area-inset-bottom, 0px) + 28px);
}

.topbar,
.month-hero,
.panel-head,
.modal-head,
.floating-bar,
.modal-actions,
.split,
.panel-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.month-hero,
.day-panel,
.calendar-frame {
    animation: rise-in 320ms ease both;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ghost-pill,
.icon-pill {
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--ink);
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(76, 63, 51, 0.08);
}

.ghost-pill {
    min-height: 42px;
    padding: 0 16px;
    font-size: 0.95rem;
    font-weight: 700;
}

.ghost-pill.subtle {
    background: rgba(255, 248, 239, 0.9);
}

.ghost-pill.accent {
    background: linear-gradient(135deg, #ec625d, #e58f56);
    color: #fff;
}

.icon-pill {
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
    font-weight: 700;
}

.icon-pill.wide {
    width: auto;
    min-width: 62px;
    padding: 0 14px;
    font-size: 0.9rem;
}

.year-pill {
    font-size: 1rem;
    font-weight: 700;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.month-hero {
    margin: 18px 0 16px;
}

.month-hero h1,
.day-panel h2,
.modal-sheet h3,
.background-panel h4 {
    margin: 0;
}

.month-hero h1 {
    font-size: clamp(2.4rem, 8vw, 3.2rem);
    line-height: 0.96;
}

.calendar-frame {
    padding: 14px;
    border-radius: 32px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.weekday-row {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    text-align: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.day-cell {
    min-height: 96px;
    padding: 8px 6px;
    border-radius: 20px;
    border: 1px solid transparent;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.5));
    text-align: left;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
    position: relative;
    overflow: hidden;
}

.day-cell:hover,
.day-cell:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(111, 136, 194, 0.35);
    box-shadow: 0 12px 24px rgba(79, 75, 111, 0.12);
    outline: none;
}

.day-cell.other-month {
    opacity: 0.44;
}

.day-cell.selected {
    border-color: rgba(234, 91, 87, 0.32);
    box-shadow: 0 16px 26px rgba(234, 91, 87, 0.14);
}

.day-cell.today .day-number {
    background: var(--accent);
    color: #fff;
}

.day-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1rem;
}

.day-body {
    margin-top: 6px;
    display: grid;
    gap: 4px;
}

.event-chip {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #18314e;
    background: var(--chip-color, rgba(110, 167, 231, 0.25));
    backdrop-filter: blur(10px);
}

.more-chip {
    font-size: 0.7rem;
    color: var(--muted);
}

.day-photo-thumb {
    height: 38px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.day-photo-thumb::after {
    content: "사진";
    position: absolute;
    right: 6px;
    bottom: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.day-panel {
    margin-top: 18px;
    padding: 18px;
    border-radius: 28px;
    background: var(--panel-strong);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.76);
    backdrop-filter: blur(18px);
}

.panel-head {
    align-items: flex-start;
}

.panel-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.day-image-card,
.background-preview {
    min-height: 128px;
    border-radius: 22px;
    margin-top: 16px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(244, 236, 225, 0.7)),
        linear-gradient(180deg, rgba(111, 170, 231, 0.16), rgba(234, 91, 87, 0.08));
    border: 1px solid rgba(91, 109, 142, 0.12);
    overflow: hidden;
}

.image-card-empty,
.empty-card,
.empty-member {
    min-height: 128px;
    display: grid;
    place-items: center;
    padding: 18px;
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
}

.image-card-full {
    position: relative;
    min-height: 128px;
}

.image-card-full img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-card-caption {
    position: absolute;
    left: 14px;
    bottom: 14px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(20, 22, 24, 0.42);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

.event-list,
.member-list {
    margin-top: 16px;
    display: grid;
    gap: 12px;
}

.event-card,
.member-card {
    padding: 14px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(76, 63, 51, 0.07);
}

.event-card-head,
.member-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.event-card-title {
    margin: 8px 0 0;
    font-size: 1rem;
}

.event-time {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.event-description {
    margin: 10px 0 0;
    color: #453d39;
    font-size: 0.92rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.member-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.72);
}

.member-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.card-actions {
    display: flex;
    gap: 8px;
}

.mini-button {
    border: 0;
    border-radius: 999px;
    background: rgba(244, 238, 230, 0.9);
    color: var(--ink);
    padding: 7px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.floating-bar {
    margin-top: 16px;
    padding: 12px 4px 0;
}

.floating-note {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 20;
}

.modal.hidden,
.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(34, 28, 26, 0.35);
    backdrop-filter: blur(6px);
}

.modal-sheet {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(100%, 520px);
    max-height: calc(100% - 20px);
    overflow: auto;
    padding: 22px 18px calc(env(safe-area-inset-bottom, 0px) + 24px);
    border-radius: 32px 32px 0 0;
    background: rgba(255, 249, 243, 0.98);
    box-shadow: 0 -20px 60px rgba(29, 20, 13, 0.18);
    animation: modal-rise-in 320ms ease both;
}

@keyframes modal-rise-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.stack-form {
    margin-top: 16px;
    display: grid;
    gap: 14px;
}

.stack-form.compact {
    gap: 12px;
}

label {
    display: grid;
    gap: 8px;
    font-size: 0.92rem;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(109, 91, 72, 0.18);
    border-radius: 16px;
    padding: 14px 14px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
    font: inherit;
}

textarea {
    resize: vertical;
    min-height: 112px;
}

.split.two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.background-panel {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
    transform: translateX(-50%);
    z-index: 30;
    min-width: 180px;
    max-width: calc(100% - 32px);
    padding: 12px 18px;
    border-radius: 999px;
    background: rgba(24, 22, 21, 0.88);
    color: #fff;
    text-align: center;
    font-size: 0.92rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
}

@media (max-width: 420px) {
    .app-shell {
        padding-left: 12px;
        padding-right: 12px;
    }

    .day-cell {
        min-height: 88px;
        padding: 6px 5px;
    }

    .month-hero h1 {
        font-size: 2.6rem;
    }

    .event-chip {
        font-size: 0.68rem;
        padding: 4px 7px;
    }

    .split.two {
        grid-template-columns: 1fr;
    }
}
.top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.today-shortcut {
    min-width: 58px;
    padding: 0 14px;
}

.compact-sheet {
    padding-top: 20px;
}

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

.year-choice {
    min-height: 48px;
    border: 1px solid rgba(109, 91, 72, 0.16);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(76, 63, 51, 0.06);
}

.year-choice.is-selected {
    border-color: rgba(234, 91, 87, 0.32);
    background: rgba(234, 91, 87, 0.14);
    color: #8f2f2c;
}

@media (max-width: 420px) {
    .top-actions {
        gap: 8px;
    }

    .today-shortcut {
        min-width: 52px;
        padding: 0 12px;
    }

    .year-chip-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
.popup-event-list {
    max-height: min(56vh, 520px);
    overflow: auto;
    padding-right: 2px;
}

.popup-event-card {
    gap: 10px;
}

.popup-event-card .member-badge {
    width: fit-content;
}.member-filter-strip {
    margin: 0 0 16px;
    padding: 16px 18px;
    border-radius: 28px;
    background: rgba(255, 250, 244, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.76);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.filter-strip-head,
.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.member-filter-strip h2,
.section-head h4,
.backup-panel h4 {
    margin: 0;
    font-size: 1rem;
}

.filter-chip-row {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    overflow: auto;
    padding-bottom: 2px;
}

.filter-chip-row::-webkit-scrollbar,
.event-attachment-gallery::-webkit-scrollbar,
.search-result-list::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.filter-chip-row::-webkit-scrollbar-thumb,
.event-attachment-gallery::-webkit-scrollbar-thumb,
.search-result-list::-webkit-scrollbar-thumb {
    background: rgba(109, 91, 72, 0.22);
    border-radius: 999px;
}

.filter-chip {
    border: 1px solid rgba(109, 91, 72, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--ink);
    min-height: 40px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    white-space: nowrap;
}

.filter-chip.active {
    border-color: var(--member-color);
    background: var(--member-color-soft, rgba(255, 255, 255, 0.92));
}

.empty-inline {
    color: var(--muted);
    font-size: 0.9rem;
}

.mini-pill {
    min-height: 36px;
    padding: 0 14px;
    font-size: 0.82rem;
}

.day-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.info-chip-row {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.info-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(245, 238, 229, 0.92);
    color: #6a4d39;
    font-size: 0.78rem;
    font-weight: 700;
}

.event-attachment-gallery {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    overflow: auto;
    padding-bottom: 2px;
}

.attachment-thumb-card {
    min-width: 112px;
    margin: 0;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(109, 91, 72, 0.12);
}

.attachment-thumb-card img {
    width: 112px;
    height: 88px;
    object-fit: cover;
    display: block;
}

.attachment-thumb-card figcaption {
    padding: 8px 10px 10px;
    font-size: 0.76rem;
    color: var(--muted);
    line-height: 1.4;
}

.attachment-editor {
    margin-top: 18px;
}

.attachment-list,
.search-result-list {
    margin-top: 16px;
    display: grid;
    gap: 12px;
}

.attachment-editor-card {
    padding: 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    display: grid;
    gap: 12px;
}

.attachment-editor-thumb {
    border-radius: 16px;
    overflow: hidden;
    background: rgba(245, 239, 232, 0.82);
}

.attachment-editor-thumb img {
    width: 100%;
    height: 168px;
    object-fit: cover;
    display: block;
}

.attachment-empty {
    min-height: 108px;
    display: grid;
    place-items: center;
    padding: 18px;
    text-align: center;
    color: var(--muted);
    border-radius: 20px;
    border: 1px dashed rgba(109, 91, 72, 0.16);
    background: rgba(255, 255, 255, 0.58);
}

.section-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.5;
}

.backup-panel {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.wrap-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
}

.warning-note {
    color: #8a4d3d;
}

.search-card .card-actions {
    align-self: center;
}

.floating-bar {
    display: grid;
    gap: 6px;
    justify-content: flex-start;
}

body.has-photo-bg::before {
    opacity: 0.42;
    filter: blur(8px) saturate(1.02);
}

body::after {
    background:
        linear-gradient(180deg, rgba(255, 249, 241, 0.74), rgba(249, 239, 226, 0.82)),
        radial-gradient(circle at 10% 0%, rgba(255, 255, 255, 0.68), transparent 30%);
}

@media (max-width: 420px) {
    .member-filter-strip {
        padding: 14px 14px 16px;
        border-radius: 24px;
    }

    .filter-chip {
        min-height: 38px;
        padding: 0 12px;
    }

    .attachment-editor-thumb img {
        height: 148px;
    }

    .attachment-thumb-card {
        min-width: 102px;
    }

    .attachment-thumb-card img {
        width: 102px;
        height: 82px;
    }
}