.drop-history-page {
    color: #f2f0e8;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.history-gallery-section {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 12px 0 0;
    background:
        radial-gradient(circle at top, rgba(120, 101, 72, 0.16), transparent 34%),
        #0f0d0b;
}

.month-nav {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 10px;
    padding: 0 18px 12px;
}

.month-nav-panel {
    display: grid;
    grid-template-columns: minmax(0, 280px) auto minmax(360px, 1fr);
    align-items: center;
    gap: 10px;
    width: 100%;
}

.month-nav-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px;
    gap: 10px;
    min-width: 0;
}

.month-nav-submit {
    min-height: 42px;
    min-width: 62px;
    padding: 0 12px;
    border-radius: 14px;
    font-weight: 700;
}

.month-nav-arrow {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #f2f0e8;
    text-decoration: none;
    font-size: 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.month-nav-arrow:hover {
    color: #f2f0e8;
    background: rgba(255, 255, 255, 0.14);
}

.history-select {
    position: relative;
    min-width: 0;
}

.history-select-trigger,
.history-search-input {
    width: 100%;
    min-height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: #f2f0e8;
}

.history-select-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 14px;
    text-align: left;
}

.history-select-trigger:focus-visible,
.history-search-input:focus {
    outline: none;
    border-color: rgba(255, 238, 209, 0.55);
    box-shadow: 0 0 0 3px rgba(255, 227, 180, 0.16);
}

.history-select-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-select-chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    opacity: 0.82;
    flex: 0 0 auto;
}

.history-select-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    display: none;
    padding: 8px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(17, 14, 11, 0.97);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.44);
    z-index: 30;
    max-height: min(320px, 48vh);
    overflow-y: auto;
}

.history-select.is-open .history-select-menu {
    display: grid;
    gap: 4px;
}

.history-select.is-open .history-select-chevron {
    transform: rotate(225deg) translateY(2px);
}

.history-select-option {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #f3ecdf;
    text-align: left;
}

.history-select-option:hover,
.history-select-option:focus-visible {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.12);
    outline: none;
}

.history-select-option.is-selected {
    background: rgba(237, 209, 160, 0.18);
    border-color: rgba(245, 225, 181, 0.26);
    color: #fff7eb;
}

.history-select-option-mark {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #efd9b0;
}

.history-select.is-disabled .history-select-trigger {
    cursor: not-allowed;
    color: rgba(242, 240, 232, 0.44);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.history-select.is-disabled .history-select-menu {
    display: none !important;
}

.history-search-box {
    min-width: 0;
}

.history-search-input {
    padding: 0 14px;
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #f2f0e8 !important;
}

.history-search-input:focus,
.history-search-input:active,
.history-search-input:focus-visible {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #f2f0e8 !important;
}

.history-search-input::placeholder {
    color: rgba(242, 240, 232, 0.68);
}

.history-gallery-frame {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-results-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable both-edges;
    scrollbar-width: thin;
    scrollbar-color: rgba(242, 201, 76, 0.72) rgba(255, 255, 255, 0.08);
}

.history-results-scroll::-webkit-scrollbar {
    width: 10px;
}

.history-results-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
}

.history-results-scroll::-webkit-scrollbar-thumb {
    background: rgba(242, 201, 76, 0.72);
    border-radius: 999px;
    border: 2px solid rgba(15, 13, 11, 0.9);
}

.history-gallery-frame.is-scrollable-results .history-results-scroll {
    min-height: 0;
}

.history-mosaic {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: auto;
    width: 100%;
    min-height: 100%;
    flex: 1 1 auto;
    overflow: visible;
}

.history-gallery-frame.is-scrollable-results .history-mosaic {
    min-height: 100%;
}

.history-card {
    position: relative;
    flex: 1 1 0;
    min-height: clamp(140px, 18vh, 220px);
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #090807;
    padding: 0;
    cursor: pointer;
    width: 100%;
    display: block;
}

.history-gallery-frame.is-scrollable-results .history-card {
    flex: 0 0 var(--live-card-height, clamp(220px, 31vh, 320px));
    min-height: var(--live-card-height, clamp(220px, 31vh, 320px));
}

.history-card + .history-card {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

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

.history-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.22) 100%);
    pointer-events: none;
}

.history-card .card-badge {
    position: absolute;
    top: 12px;
    right: 14px;
    background: rgba(10, 10, 10, 0.74);
    color: #f4f1e6;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    z-index: 2;
    pointer-events: none;
}

.history-card.is-missing img {
    opacity: 0.14;
    filter: blur(1.8px) saturate(0.36);
}

.history-card .missing-overlay {
    position: absolute;
    inset: 0;
    display: block;
    background: rgba(0, 0, 0, 0.36);
    pointer-events: none;
    z-index: 2;
}

.history-card .missing-ribbon-shell {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-18deg);
    width: min(72%, 540px);
    max-width: calc(100% - 56px);
    border: 2px solid #ffdd6b;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    padding: 0;
    box-sizing: border-box;
}

.history-card .missing-ribbon {
    display: block;
    width: 100%;
    border-radius: 8px;
    text-align: center;
    color: #ffdd6b;
    padding: 10px 16px;
    font-size: clamp(0.9rem, 1.9vw, 1.45rem);
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-shadow: 0 0 14px rgba(255, 221, 107, 0.22);
    background: transparent;
    box-sizing: border-box;
}

.history-empty-state {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 18px 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #e9e0cf;
    font-size: 1.02rem;
}

.history-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: stretch;
    justify-content: stretch;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2100;
    padding: 0;
}

.history-modal.is-open {
    display: flex;
}

.history-modal-content {
    width: 100%;
    height: 100%;
    background: #111;
    color: #f0f0f0;
    display: flex;
    flex-direction: column;
}

.history-modal-header {
    display: flex;
    justify-content: flex-end;
    padding: 8px 14px 0;
    min-height: 48px;
}

.history-modal-title {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 4px 24px 0;
}

.history-modal-close {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    line-height: 1;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.history-modal-body {
    display: grid;
    grid-template-columns: 72px 1fr 72px;
    align-items: center;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    padding: 6px 0;
}

.history-modal-side {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.history-modal-nav {
    width: 48px;
    height: 80%;
    border: none;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.history-modal-nav.is-hidden {
    display: none;
}

.history-modal-media {
    width: 100%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    min-height: 0;
    position: relative;
}

.history-modal-media img {
    max-width: 100%;
    max-height: 76vh;
    object-fit: contain;
}

.history-modal-meta {
    padding: 12px 24px 18px;
    display: grid;
    gap: 6px;
    background: #111;
}

@media (max-width: 1100px) {
    .month-nav-panel {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .history-search-box {
        grid-column: 1 / -1;
    }
}

@media (max-width: 991px) {
    .month-nav {
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        padding-left: 14px;
        padding-right: 14px;
    }

    .month-nav-fields {
        grid-template-columns: minmax(0, 1fr) 118px;
    }

    .history-card .missing-ribbon-shell {
        width: min(82%, 480px);
    }
}

@media (max-width: 767px) {
    .history-gallery-section {
        padding-top: 10px;
    }

    .month-nav {
        gap: 8px;
    }

    .month-nav-panel {
        grid-template-columns: 1fr;
    }

    .month-nav-fields {
        grid-template-columns: 1fr;
    }

    .month-nav-submit,
    .history-search-box {
        width: 100%;
    }

    .month-nav-arrow {
        width: 42px;
        height: 42px;
        font-size: 1.15rem;
    }

    .history-gallery-frame.is-scrollable-results .history-card {
        flex-basis: var(--live-card-height, clamp(180px, 26vh, 240px));
        min-height: var(--live-card-height, clamp(180px, 26vh, 240px));
    }

    .history-card .card-badge {
        top: 10px;
        right: 10px;
        font-size: 0.8rem;
    }

    .history-card .missing-ribbon-shell {
        max-width: calc(100% - 28px);
        padding: 4px;
    }

    .history-card .missing-ribbon {
        letter-spacing: 0.11em;
        padding: 10px 14px;
        font-size: clamp(0.86rem, 4.8vw, 1.2rem);
    }

    .history-empty-state {
        margin: 0 14px 14px;
    }

    .history-modal-title {
        font-size: 1.1rem;
    }

    .history-modal-body {
        grid-template-columns: 44px 1fr 44px;
    }

    .history-modal-nav {
        width: 36px;
        border-radius: 14px;
    }

    .history-modal-media {
        padding-left: 6px;
        padding-right: 6px;
    }

    .history-modal-meta {
        padding: 12px 14px 16px;
    }
}
