/* ========================================
   머문자리 (Meomunjari) - Travel Blog
   ======================================== */

/* Fonts — subsetted to Korean syllables + Latin, WOFF2 compressed.
   Pretendard is loaded via <link rel="preload"> in index.html to avoid
   the render-blocking @import. */

@font-face {
    font-family: 'SunBatang-Medium';
    src: url('../assets/fonts/SunBatang-Medium.subset.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'NanumGothic';
    src: url('../assets/fonts/NanumGothic.subset.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* CSS Variables */
:root {
    --bg:           #F5F0E8;
    --bg-alt:       #EDE7DC;
    --surface:      #FFFDF8;
    --text:         #3D3528;
    --text-sub:     #7A7062;
    --border:       #E0D9CE;
    --blue:         #5A9CB5;
    --blue-soft:    #7BB4C9;
    --blue-light:   #A8D1E0;
    --yellow:       #FACE68;
    --yellow-soft:  #FBD98A;
    --orange:       #FAAC68;
    --orange-soft:  #FBC08A;
    --coral:        #FA6868;
    --coral-soft:   #FB8A8A;
    --shadow:       rgba(61, 53, 40, 0.08);
    --shadow-md:    rgba(61, 53, 40, 0.12);
    --pin-color:    #FA6868;
    --pin-glow:     rgba(250, 104, 104, 0.3);
    --overlay:      rgba(245, 240, 232, 0.85);
    --font-title:   'SunBatang-Medium', 'Pretendard', sans-serif;
    --font-body:    'NanumGothic', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
    --bg:           #1E1E24;
    --bg-alt:       #28282F;
    --surface:      #32323A;
    --text:         #E8E4DC;
    --text-sub:     #9E998F;
    --border:       #3E3E46;
    --shadow:       rgba(0, 0, 0, 0.2);
    --shadow-md:    rgba(0, 0, 0, 0.3);
    --pin-glow:     rgba(250, 104, 104, 0.4);
    --overlay:      rgba(30, 30, 36, 0.9);
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    transition: background-color 0.5s ease, color 0.5s ease;
    -webkit-font-smoothing: antialiased;
}

/* ===== APP LAYOUT ===== */
#app {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    pointer-events: none;
}

/* Shared vanilla cream strip behind the fixed header. Short (just the
   logo row) in single-month mode; tall (covers the 전체 보기 title) in
   overview mode. CSS height-transition drives the shrink/grow animation
   when body.overview-mode is toggled by diary.js. */
.top-strip {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 84px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 2;
    pointer-events: none;
    transition: height 0.55s cubic-bezier(0.65, 0, 0.35, 1);
}
/* Subtle per-month accent wash — only visible in single-month mode so
   each month feels distinct. Fades out when switching to overview. */
.top-strip::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--month-accent, #7BB4C9) 14%, transparent) 0%,
        transparent 100%
    );
    pointer-events: none;
    transition: opacity 0.4s ease;
}
body.overview-mode .top-strip {
    height: 200px;
}
body.overview-mode .top-strip::after {
    opacity: 0;
}

.header > * {
    pointer-events: auto;
}

.logo {
    font-family: var(--font-title);
    font-size: 28px;
    color: var(--text);
    letter-spacing: 2px;
    cursor: pointer;
    user-select: none;
    opacity: 0;
    transform: translateY(-20px);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(-20px);
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow);
}

.header-btn:hover {
    background: var(--bg-alt);
    color: var(--text);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-md);
}

.header-btn.active {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

.header-btn svg {
    width: 20px;
    height: 20px;
}

/* ===== MAP SWITCHER (Korea/World toggle, bigger button below header) ===== */
.map-switcher-btn {
    position: fixed;
    top: 80px;
    right: 28px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 18px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-sub);
    cursor: pointer;
    gap: 5px;
    box-shadow: 0 4px 16px var(--shadow-md);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.map-switcher-btn:hover {
    background: var(--bg-alt);
    color: var(--text);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow-md);
}

.map-switcher-btn.active {
    background: var(--blue);
    border-color: var(--blue);
    color: white;
    box-shadow: 0 4px 16px rgba(90, 156, 181, 0.4);
}

.map-switcher-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    /* Make black icon match current color: invert for dark mode handled below */
    filter: invert(35%) sepia(8%) saturate(600%) hue-rotate(10deg) brightness(0.7);
    transition: filter 0.3s ease;
}

.map-switcher-btn.active .map-switcher-icon {
    filter: brightness(0) invert(1);
}

[data-theme="dark"] .map-switcher-icon {
    filter: invert(80%) sepia(5%) saturate(300%) brightness(1.1);
}

[data-theme="dark"] .map-switcher-btn.active .map-switcher-icon {
    filter: brightness(0) invert(1);
}

.map-switcher-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-family: var(--font-body);
}

/* ===== MAP CONTAINER ===== */
.map-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.map-container:active {
    cursor: grabbing;
}

.map-wrapper {
    position: relative;
    transform-origin: 0 0;
    will-change: transform;
}

.map-wrapper svg {
    display: block;
    width: 100%;
    height: auto;
}

.map-wrapper svg path {
    transition: fill 0.3s ease, opacity 0.3s ease;
    stroke: var(--border);
    stroke-width: 0.3;
    user-select: none;
    -webkit-user-select: none;
}

.map-wrapper svg path:hover {
    opacity: 0.85;
    filter: brightness(1.05);
}

/* ===== ZOOM CONTROLS ===== */
.zoom-controls {
    position: fixed;
    bottom: 32px;
    right: 32px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 50;
    opacity: 0;
    transform: translateY(20px);
}

.zoom-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow);
}

.zoom-btn:hover {
    background: var(--bg-alt);
    transform: scale(1.05);
}

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

.zoom-level {
    text-align: center;
    font-size: 11px;
    color: var(--text-sub);
    padding: 4px 0;
    font-weight: 500;
}

/* ===== PINS ===== */
.pin-group {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    z-index: 10;
}

/* Anchor wraps pulse + pin SVG + badge, centered on the geographic point */
.pin-anchor {
    position: relative;
    display: inline-block;
    transform: translate(-50%, -100%);
}

.pin {
    display: block;
    width: 24px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    transition: filter 0.3s ease;
}

.pin:hover {
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.pin-marker {
    fill: var(--pin-color);
    transition: fill 0.3s ease;
}

.pin-dot {
    fill: white;
}

/* Pulse ring - centered on the pin's circle (top area of the pin SVG) */
.pin-pulse {
    position: absolute;
    top: 0;
    left: 50%;
    width: 28px;
    height: 28px;
    transform: translate(-50%, -2px);
    border-radius: 50%;
    background: var(--pin-glow);
    animation: pinPulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pinPulse {
    0%, 100% { transform: translate(-50%, -2px) scale(0.8); opacity: 0.6; }
    50% { transform: translate(-50%, -2px) scale(1.5); opacity: 0; }
}

/* Badge for multiple trips at same location */
.pin-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--blue);
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 1px 4px var(--shadow);
    pointer-events: none;
}

/* Cluster Pin */
.cluster-pin {
    position: relative;
    width: 40px;
    height: 40px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--coral);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 2px 8px var(--pin-glow), 0 0 0 3px rgba(255,255,255,0.4);
    cursor: pointer;
    transition: all 0.3s ease;
}

.cluster-pin:hover {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 4px 16px var(--pin-glow), 0 0 0 4px rgba(255,255,255,0.5);
}

.cluster-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--coral-soft);
    opacity: 0.4;
    animation: clusterRing 2s ease-in-out infinite;
}

@keyframes clusterRing {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.2); opacity: 0; }
}

/* ===== HOVER PREVIEW ===== */
.hover-preview {
    position: absolute;
    pointer-events: none;
    z-index: 200;
    opacity: 0;
    transform: translateY(8px) scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease;
    width: 220px;
}

.hover-preview.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.hover-preview-card {
    background: var(--surface);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px var(--shadow-md), 0 0 0 1px var(--border);
}

.hover-preview-img {
    width: 100%;
    height: 130px;
    object-fit: cover;
}

.hover-preview-info {
    padding: 12px;
}

.hover-preview-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text);
}

.hover-preview-location {
    font-size: 12px;
    color: var(--text-sub);
}

.hover-preview-date {
    font-size: 11px;
    color: var(--blue);
    margin-top: 4px;
    font-weight: 500;
}

/* ===== TRIP DETAIL POPUP (center modal) ===== */
.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.trip-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    width: 520px;
    max-width: 92vw;
    max-height: 85vh;
    background: var(--surface);
    z-index: 301;
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.2), 0 0 0 1px var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    pointer-events: none;
}

.trip-panel-header {
    position: relative;
    height: 260px;
    overflow: hidden;
    border-radius: 24px 24px 0 0;
}

.trip-panel-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.trip-panel-header-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: white;
}

.trip-panel-title {
    font-family: var(--font-title);
    font-size: 26px;
    margin-bottom: 4px;
}

.trip-panel-location {
    font-size: 14px;
    opacity: 0.9;
}

.trip-panel-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.trip-panel-close:hover {
    background: rgba(255,255,255,0.35);
    transform: rotate(90deg);
}

.trip-panel-body {
    padding: 24px;
}

/* Trip selector tabs (for multiple trips at same location) */
.trip-tabs {
    display: flex;
    gap: 6px;
    padding: 0 24px 0;
    overflow-x: auto;
    margin-top: -4px;
    padding-top: 16px;
}

.trip-tab {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-sub);
    font-size: 12px;
    font-family: var(--font-body);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.trip-tab:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.trip-tab.active {
    background: var(--blue);
    border-color: var(--blue);
    color: white;
}

.trip-panel-dates {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-alt);
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-sub);
}

.trip-panel-dates svg {
    width: 18px;
    height: 18px;
    color: var(--blue);
    flex-shrink: 0;
}

.trip-panel-comment {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 24px;
    white-space: pre-wrap;
}

.trip-panel-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-sub);
    margin-bottom: 12px;
}

.trip-panel-images {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.trip-panel-images img {
    display: block;
    width: 100%;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.trip-panel-images img:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px var(--shadow-md);
}

/* Smart layout rows */
.img-row-full { width: 100%; }
.img-row-full img { width: 100%; }

.img-row-pair {
    display: flex;
    gap: 8px;
}
.img-row-pair img {
    flex: 1;
    min-width: 0;
    object-fit: cover;
}

/* ===== IMAGE LIGHTBOX ===== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    cursor: zoom-out;
}

.lightbox.visible {
    opacity: 1;
    pointer-events: auto;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    transform: scale(0.9);
    transition: transform 0.4s ease;
}

.lightbox.visible img {
    transform: scale(1);
}

/* ===== SIDEBAR FILTERS ===== */
.filter-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    background: var(--surface);
    z-index: 200;
    transform: translateX(-100%);
    box-shadow: 8px 0 32px var(--shadow-md);
    overflow-y: auto;
    padding: 24px;
}

.filter-panel-title {
    font-family: var(--font-title);
    font-size: 22px;
    margin-bottom: 24px;
    padding-top: 40px;
}

.filter-section {
    margin-bottom: 24px;
}

.filter-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-sub);
    margin-bottom: 12px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-sub);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-body);
}

.filter-chip:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.filter-chip.active {
    background: var(--blue);
    border-color: var(--blue);
    color: white;
}

/* ===== TIMELINE ===== */
.timeline-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 80;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px var(--shadow);
    transform: translateY(100%);
    transition: transform 0.4s ease;
}

.timeline-bar.visible {
    transform: translateY(0);
}

.timeline-content {
    padding: 16px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.timeline-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.timeline-track {
    flex: 1;
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
}

.timeline-line {
    width: 100%;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    position: relative;
}

.timeline-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--blue);
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px var(--shadow);
}

.timeline-dot:hover {
    transform: translate(-50%, -50%) scale(1.4);
    background: var(--coral);
}

.timeline-dot-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-sub);
    white-space: nowrap;
    padding-bottom: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.timeline-dot:hover .timeline-dot-label {
    opacity: 1;
}

.timeline-range {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-sub);
    white-space: nowrap;
}

.timeline-range input[type="range"] {
    width: 100px;
    accent-color: var(--blue);
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-title {
    font-family: var(--font-title);
    font-size: 48px;
    color: var(--text);
    margin-bottom: 16px;
    opacity: 0;
}

.loading-subtitle {
    font-size: 14px;
    color: var(--text-sub);
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0;
}

.loading-dots {
    display: flex;
    gap: 8px;
    margin-top: 32px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--blue);
    opacity: 0;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 600;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    box-shadow: 0 4px 16px var(--shadow-md);
    border: 1px solid var(--border);
    opacity: 0;
    transform: translateX(20px);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-sub);
}

/* ===== DIARY VIEWPORT ===== */
.diary-viewport {
    width: 100%;
    height: 100vh;
    position: relative;
}

/* ===== SINGLE MONTH VIEW ===== */
.month-view {
    width: 100%;
    height: 100%;
    position: relative;
}

.month-view-header {
    position: absolute;
    top: 84px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 5;
    pointer-events: none;
    padding-top: 16px;
    padding-bottom: 16px;
    background: var(--bg);
}

.month-title-btn {
    pointer-events: auto;
    font-family: var(--font-title);
    font-size: 32px;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
    letter-spacing: 3px;
    padding: 8px 24px 12px;
    border-radius: 16px;
    transition: all 0.3s ease;
    display: inline-block;
    border-bottom: 2px solid color-mix(in srgb, var(--month-accent, #5A9CB5) 40%, transparent);
}

.month-title-btn:hover {
    background: var(--bg-alt);
    color: var(--month-accent, var(--blue));
}

.month-date-count {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-sub);
    letter-spacing: 1px;
}

.month-view-canvas {
    width: 100%;
    position: absolute;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

/* Decorative radial gradient background */
.month-view-canvas::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.06;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 20% 75%, var(--month-accent, var(--blue-light)) 0%, transparent 50%),
        radial-gradient(circle at 80% 25%, var(--month-accent, var(--yellow-soft)) 0%, transparent 50%);
    z-index: 0;
    transition: opacity 0.6s ease;
}

/* Subtle dot pattern */
.month-view-canvas::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.025;
    pointer-events: none;
    background-image: radial-gradient(circle, var(--text) 1px, transparent 1px);
    background-size: 28px 28px;
    z-index: 0;
}

/* ===== DATE BUBBLE (Polaroid style) ===== */
.date-bubble {
    position: absolute;
    background: #fff;
    padding: 6px 6px 28px 6px;
    border-radius: 2px;
    /* Warm, paper-like drop shadows in two layers: a tight contact shadow
       and a soft lifted one. Both use the theme's warm-brown shadow tint. */
    box-shadow:
        0 1px 2px rgba(61, 53, 40, 0.09),
        0 4px 12px rgba(61, 53, 40, 0.10),
        0 12px 28px rgba(61, 53, 40, 0.07);
    cursor: pointer;
    will-change: transform;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

[data-theme="dark"] .date-bubble {
    background: #2a2a30;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.35),
        0 4px 12px rgba(0, 0, 0, 0.28),
        0 12px 28px rgba(0, 0, 0, 0.18);
}

.date-bubble:hover {
    box-shadow:
        0 2px 4px rgba(61, 53, 40, 0.12),
        0 8px 20px rgba(61, 53, 40, 0.15),
        0 20px 44px rgba(61, 53, 40, 0.10);
    z-index: 20;
}

.date-bubble-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background-size: cover;
    background-position: center;
    border-radius: 1px;
}

.date-bubble-date {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px 6px;
    color: color-mix(in srgb, var(--month-accent, #8E9AAB) 75%, var(--text));
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    font-family: var(--font-title);
    letter-spacing: 0.5px;
    border-top: 1.5px solid color-mix(in srgb, var(--month-accent, #8E9AAB) 25%, transparent);
}

[data-theme="dark"] .date-bubble-date {
    color: color-mix(in srgb, var(--month-accent, #8E9AAB) 60%, #9E998F);
}

/* ===== ALL MONTHS OVERVIEW ===== */
/* Two-tone cream: the top strip — containing the fixed header (logo +
   map buttons) and the "전체 보기" title — sits on vanilla --surface.
   Everything below the divider line is the usual --bg cream. */
.months-overview {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 210px 0 100px;
}

.overview-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    text-align: center;
    padding: 116px 32px 36px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.overview-title {
    font-family: var(--font-title);
    font-size: 28px;
    color: var(--text);
    letter-spacing: 2px;
}

.overview-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 32px;
}

/* Overview card: a "box" of stacked polaroids */
.overview-month-card {
    cursor: pointer;
    text-align: center;
    padding: 12px 8px;
    transition: transform 0.3s ease;
}

.overview-month-card:hover {
    transform: scale(1.03);
}

.overview-card-stack {
    position: relative;
    width: 130px;
    height: 150px;
    margin: 0 auto 12px;
}

/* Individual polaroid in the stack */
.overview-card-polaroid {
    position: absolute;
    background: #fff;
    padding: 5px 5px 20px 5px;
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.10), 0 4px 14px rgba(0,0,0,0.07);
    width: 100px;
    left: 50%;
    top: 50%;
    transform-origin: center center;
}

[data-theme="dark"] .overview-card-polaroid {
    background: #2a2a30;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3), 0 4px 14px rgba(0,0,0,0.2);
}

.overview-card-polaroid img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    border-radius: 1px;
}

.overview-card-label {
    font-family: var(--font-title);
    font-size: 17px;
    color: var(--text);
    letter-spacing: 1px;
}

.overview-card-count {
    font-size: 12px;
    color: var(--text-sub);
    margin-top: 2px;
}

/* Year divider in overview grid — a dividing line to the left/right of
   the year numerals, creating a clear break between year groups. */
.overview-year-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 18px;
    font-family: var(--font-title);
    font-size: 30px;
    color: var(--text);
    opacity: 0.55;
    letter-spacing: 6px;
    padding: 28px 0 10px;
    text-align: center;
    justify-content: center;
}

.overview-year-header::before,
.overview-year-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: color-mix(in srgb, var(--month-accent, #C4A67D) 35%, var(--border));
    max-width: 200px;
}

/* First year header sits right under the overview-header's own border,
   so drop its top padding to avoid a double gap. */
.overview-year-header:first-child {
    padding-top: 8px;
}

/* ===== MONTH NAVIGATION BAR ===== */
.month-nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 80;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px var(--shadow);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 12px 12px 56px;
    transform: translateY(100%);
    transition: transform 0.4s ease;
}

.month-nav-bar.visible {
    transform: translateY(0);
}

.month-nav-overview-btn {
    position: absolute;
    left: 12px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-sub);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.month-nav-overview-btn:hover {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

.month-nav-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
}

.month-nav-pills::-webkit-scrollbar {
    display: none;
}

.month-nav-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-sub);
    font-size: 13px;
    font-family: var(--font-body);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.month-nav-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.month-nav-btn.active {
    background: var(--month-accent, var(--blue));
    border-color: var(--month-accent, var(--blue));
    color: white;
    position: relative;
}
.month-nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--month-accent, var(--blue));
}

/* ===== LOADING TITLE LETTERS (flip-open) ===== */
.loading-title {
    perspective: 600px;
}

.loading-title .letter {
    display: inline-block;
    opacity: 0;
    transform-origin: center bottom;
}

/* ===== DATE DETAIL PANEL ===== */
.date-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
}

.date-detail-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.date-detail-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    /* Scale is transitioned in CSS to keep translate(-50%, -50%) intact
       throughout the animation — anime.js's scale override would drop
       the translate and visually fling the panel to the bottom-right
       of center until the animation completed. */
    transform: translate(-50%, -50%) scale(0.92);
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
                opacity 0.4s ease;
    width: 520px;
    max-width: 92vw;
    max-height: 85vh;
    background: var(--surface);
    z-index: 301;
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.2), 0 0 0 1px var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    pointer-events: none;
}

.date-detail-panel.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.date-detail-header {
    position: relative;
    height: 280px;
    overflow: hidden;
    border-radius: 24px 24px 0 0;
}

.date-detail-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.date-detail-header-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: white;
}

.date-detail-title {
    font-family: var(--font-title);
    font-size: 24px;
    margin-bottom: 4px;
}

.date-detail-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.date-detail-close:hover {
    background: rgba(255,255,255,0.35);
    transform: rotate(90deg);
}

.date-detail-body {
    padding: 24px;
}

/* Edit / Delete action row at the bottom of the date-detail modal */
.date-detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.date-detail-edit-btn,
.date-detail-delete-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--bg);
    color: var(--text-sub);
    font-size: 14px;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-detail-edit-btn:hover {
    background: var(--bg-alt);
    color: var(--text);
    border-color: var(--month-accent, var(--blue));
}

.date-detail-delete-btn {
    margin-left: auto;
    border-color: transparent;
    color: var(--text-sub);
}

.date-detail-delete-btn:hover {
    background: #FEE8E8;
    color: #C44;
    border-color: #E8A0A0;
}

[data-theme="dark"] .date-detail-delete-btn:hover {
    background: rgba(204, 68, 68, 0.15);
    border-color: rgba(204, 68, 68, 0.3);
}

/* Dark theme icon fix for diary header buttons */
[data-theme="dark"] .header-btn img {
    filter: invert(80%) sepia(5%) saturate(300%) brightness(1.1) !important;
}

/* ===== UPLOAD: FAB + MODAL ===== */
.upload-fab {
    position: fixed;
    bottom: 88px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--month-accent, #5A9CB5);
    color: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, background-color 0.4s ease, box-shadow 0.25s ease;
}

.upload-fab:hover {
    transform: scale(1.06) translateY(-1px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22), 0 4px 8px rgba(0, 0, 0, 0.14);
}

.upload-fab:active {
    transform: scale(0.96);
}

.upload-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    z-index: 400;
    opacity: 0;
    pointer-events: none;
}

.upload-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.upload-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    /* Scale baked into the transform and transitioned in CSS so the
       translate(-50%, -50%) centering survives the open animation. */
    transform: translate(-50%, -50%) scale(0.96);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
                opacity 0.32s ease;
    width: 560px;
    max-width: 92vw;
    max-height: 88vh;
    background: var(--surface);
    color: var(--text);
    z-index: 401;
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--border);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.upload-panel.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.upload-panel-inner {
    padding: 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.upload-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.upload-header h2 {
    font-family: var(--font-title);
    font-size: 22px;
    margin: 0;
    color: var(--text);
}

.upload-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-alt);
    border: none;
    color: var(--text-sub);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.upload-close:hover {
    background: var(--border);
    color: var(--text);
    transform: rotate(90deg);
}

.upload-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
    letter-spacing: 0.02em;
}

.upload-panel input[type="password"],
.upload-panel textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    /* 16px prevents iOS Safari from zooming in on focus */
    font-size: 16px;
    transition: border-color 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
    min-height: 48px;
}

/* Date input is controlled by flatpickr, which swaps type to text and adds
   .flatpickr-input. Give it its own rule with a cleaner numeric font so the
   "YYYY-MM-DD" display doesn't render in NanumGothic (which has awkward
   hyphens and digit spacing). */
.upload-panel input.flatpickr-input,
.upload-panel input[type="date"] {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.04em;
    line-height: 1.2;
    transition: border-color 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
    min-height: 48px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.upload-panel input.flatpickr-input:focus,
.upload-panel input[type="date"]:focus,
.upload-panel input[type="password"]:focus,
.upload-panel textarea:focus {
    outline: none;
    border-color: var(--month-accent, #5A9CB5);
    background: var(--surface);
}

.upload-panel textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.5;
}

.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: 14px;
    padding: 22px;
    background: var(--bg);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--month-accent, #5A9CB5);
    background: var(--bg-alt);
}

.upload-dropzone-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-sub);
}

.upload-dropzone-text strong {
    color: var(--text);
    font-size: 14px;
}

.upload-dropzone-text span {
    font-size: 12px;
}

.upload-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 4px;
}

.upload-image-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-alt);
    border: 1px solid var(--border);
}

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

.upload-image-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    z-index: 2;
}

.upload-image-remove:hover {
    background: rgba(220, 50, 50, 0.9);
    transform: scale(1.08);
}

.upload-image-thumb.is-cover {
    outline: 3px solid #FACE68;
    outline-offset: -3px;
    box-shadow: 0 0 0 2px rgba(250, 206, 104, 0.25);
}

.upload-image-cover-btn {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #D4A93A;
    border: 2px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 2;
}

.upload-image-cover-btn:hover {
    transform: scale(1.1);
}

.upload-image-thumb.is-cover .upload-image-cover-btn {
    background: #FACE68;
    color: #fff;
    border-color: #FACE68;
}

.upload-image-cover-btn svg {
    width: 18px;
    height: 18px;
}

.upload-cover-hint {
    font-size: 13px;
    color: var(--text-sub);
    margin-top: -2px;
    margin-bottom: 6px;
    line-height: 1.4;
}

.upload-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: var(--bg-alt);
    border-radius: 10px;
}

/* Belt-and-suspenders: the form uses inline `style="display:none"` to hide
   this bar pre-upload (the `hidden` attribute was losing to `display:flex`
   in earlier builds). Keep the attribute fallback AND the inline-style match. */
.upload-progress[hidden],
.upload-progress[style*="display:none"],
.upload-progress[style*="display: none"] {
    display: none !important;
}

.upload-progress-text {
    font-size: 13px;
    color: var(--text-sub);
}

.upload-progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--month-accent, #5A9CB5);
    transition: width 0.3s ease;
}

/* ===== Flatpickr overrides — cream theme ===== */
.flatpickr-calendar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(61, 53, 40, 0.15),
                0 2px 6px rgba(61, 53, 40, 0.08);
    font-family: var(--font-body);
    padding: 6px 10px 10px;
    width: auto;
}
.flatpickr-innerContainer,
.flatpickr-rContainer {
    width: 100%;
}
.flatpickr-days {
    width: 100%;
}
.dayContainer {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 4px 2px;
}
.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after,
.flatpickr-calendar.arrowBottom::before,
.flatpickr-calendar.arrowBottom::after { display: none; }
.flatpickr-months {
    padding-top: 6px;
    align-items: center;
}
.flatpickr-months .flatpickr-month {
    color: var(--text);
    height: 44px;
}
.flatpickr-current-month {
    font-size: 16px;
    font-weight: 600;
    padding-top: 8px;
    color: var(--text);
}
.flatpickr-current-month .numInputWrapper,
.flatpickr-current-month input.cur-year {
    color: var(--text);
}
.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: transparent;
    color: var(--text);
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.15s ease;
}
.flatpickr-current-month .flatpickr-monthDropdown-months:hover {
    background: var(--bg-alt);
}
.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
    background: var(--surface);
    color: var(--text);
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    color: var(--text-sub);
    fill: var(--text-sub);
    padding: 10px;
    border-radius: 8px;
    transition: background 0.15s ease;
}
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    background: var(--bg-alt);
    color: var(--text);
    fill: var(--text);
}
.flatpickr-weekdays {
    background: transparent;
    margin-top: 4px;
}
.flatpickr-weekday {
    color: var(--text-sub);
    font-weight: 500;
    font-size: 12px;
    background: transparent;
}
.flatpickr-days {
    border: none;
}
.flatpickr-day {
    color: var(--text);
    border-radius: 10px;
    font-weight: 500;
    height: 36px;
    line-height: 36px;
    margin: 1px 0;
    border: none;
}
.flatpickr-day:hover {
    background: var(--bg-alt);
    border-color: transparent;
}
.flatpickr-day.today {
    border-color: transparent;
    color: var(--month-accent, #5A9CB5);
    font-weight: 700;
    background: transparent;
}
.flatpickr-day.today::after {
    content: '';
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--month-accent, #5A9CB5);
    margin: -4px auto 0;
}
.flatpickr-day.today:hover {
    background: var(--bg-alt);
    color: var(--month-accent, #5A9CB5);
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--month-accent, #5A9CB5);
    border-color: var(--month-accent, #5A9CB5);
    color: #fff;
    box-shadow: 0 2px 6px rgba(61, 53, 40, 0.2);
}
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: var(--text-sub);
    opacity: 0.4;
}
.flatpickr-day.flatpickr-disabled { color: var(--border); }
/* Dark mode */
[data-theme="dark"] .flatpickr-calendar {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.25);
}
[data-theme="dark"] .flatpickr-day.today::after {
    background: var(--month-accent, #5A9CB5);
}

.upload-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.upload-actions-spacer {
    flex: 1;
}

.upload-btn-primary,
.upload-btn-secondary,
.upload-btn-danger {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-btn-primary {
    background: var(--month-accent, #5A9CB5);
    color: white;
}

.upload-btn-primary:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.upload-btn-secondary {
    background: var(--bg-alt);
    color: var(--text);
}

.upload-btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

.upload-btn-danger {
    background: transparent;
    color: #c44;
    border: 1.5px solid #e8b8b8;
}

.upload-btn-danger:hover:not(:disabled) {
    background: rgba(220, 60, 60, 0.08);
}

.upload-btn-primary:disabled,
.upload-btn-secondary:disabled,
.upload-btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upload-password h2 {
    font-family: var(--font-title);
    font-size: 22px;
    margin: 0;
    color: var(--text);
}

.upload-hint {
    font-size: 14px;
    color: var(--text-sub);
    margin: 0;
    line-height: 1.5;
}

.upload-pw-error {
    font-size: 13px;
    color: #c44;
    min-height: 18px;
}

@media (max-width: 768px) {
    .upload-fab {
        bottom: 80px;
        right: 16px;
        width: 52px;
        height: 52px;
    }

    .upload-panel {
        width: 100%;
        max-width: 100vw;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        top: auto;
        bottom: 0;
        left: 0;
        /* Slide-up bottom sheet: start offscreen below, slide up when visible */
        transform: translateY(100%);
    }

    .upload-panel.visible {
        transform: translateY(0);
    }

    .upload-panel-inner {
        padding: 20px 18px 28px;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
    }

    .logo {
        font-size: 22px;
    }

    .trip-panel {
        width: 100%;
    }

    .filter-panel {
        width: 100%;
    }

    .zoom-controls {
        bottom: 16px;
        right: 16px;
    }

    .timeline-content {
        padding: 12px 16px;
    }

    /* Diary responsive */
    .month-title-btn {
        font-size: 24px;
    }

    .date-bubble {
        border-width: 2px;
    }

    .overview-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .overview-card-stack {
        width: 100px;
        height: 120px;
    }

    .overview-card-polaroid {
        width: 80px;
    }

    .months-overview {
        padding: 210px 0 100px;
    }

    .overview-header {
        padding: 116px 16px 32px;
    }

    .overview-grid {
        padding: 0 16px;
    }

    .overview-card-label {
        font-size: 15px;
    }

    .month-nav-bar {
        padding: 8px 8px 8px 50px;
    }

    .date-detail-panel {
        width: 100%;
        max-width: 100vw;
        max-height: 90vh;
        border-radius: 20px 20px 0 0;
        top: auto;
        bottom: 0;
        left: 0;
        transform: translateY(100%);
    }

    .date-detail-panel.visible {
        transform: translateY(0);
    }

    .date-detail-header {
        height: 200px;
    }
}
