.wgm-wrap {
    --wgm-bg: #fffaf6;
    --wgm-card: #ffffff;
    --wgm-ink: #2c2724;
    --wgm-muted: #6f625b;
    --wgm-line: #eadfd8;
    --wgm-accent: #8f5d46;
    --wgm-accent-dark: #6f432f;
    color: var(--wgm-ink);
    display: grid;
    gap: 24px;
    margin: 0 auto;
    max-width: 1120px;
}

.wgm-panel {
    background: var(--wgm-bg);
    border: 1px solid var(--wgm-line);
    border-radius: 8px;
    padding: clamp(18px, 4vw, 32px);
}

.wgm-heading {
    margin-bottom: 18px;
}

.wgm-heading h2 {
    font-size: clamp(1.45rem, 2vw, 2rem);
    line-height: 1.15;
    margin: 0 0 6px;
}

.wgm-heading p,
.wgm-empty {
    color: var(--wgm-muted);
    margin: 0;
}

.wgm-form {
    display: grid;
    gap: 16px;
}

.wgm-field {
    display: grid;
    gap: 8px;
    font-weight: 700;
}

.wgm-field input {
    appearance: none;
    background: var(--wgm-card);
    border: 1px solid var(--wgm-line);
    border-radius: 8px;
    color: var(--wgm-ink);
    font: inherit;
    min-height: 48px;
    padding: 10px 12px;
    width: 100%;
}

.wgm-dropzone {
    align-items: center;
    background: var(--wgm-card);
    border: 2px dashed #d8c6bc;
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    gap: 6px;
    justify-items: center;
    min-height: 150px;
    padding: 24px;
    text-align: center;
}

.wgm-dropzone__title {
    font-size: 1.05rem;
    font-weight: 800;
}

.wgm-dropzone__hint {
    color: var(--wgm-muted);
    font-size: 0.95rem;
}

.wgm-dropzone input {
    max-width: 100%;
}

.wgm-button {
    appearance: none;
    background: var(--wgm-accent);
    border: 0;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    min-height: 48px;
    padding: 12px 18px;
}

.wgm-button:hover,
.wgm-button:focus {
    background: var(--wgm-accent-dark);
}

.wgm-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.wgm-progress {
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--wgm-line);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    padding: 12px;
}

.wgm-progress[hidden],
.wgm-queue[hidden],
.wgm-filter-empty[hidden] {
    display: none;
}

.wgm-progress__top {
    align-items: center;
    display: flex;
    gap: 10px;
}

.wgm-spinner {
    animation: wgm-spin 0.8s linear infinite;
    border: 3px solid #eadfd8;
    border-top-color: var(--wgm-accent);
    border-radius: 999px;
    display: inline-block;
    flex: 0 0 auto;
    height: 22px;
    width: 22px;
}

.wgm-progress__label {
    color: var(--wgm-ink);
    font-weight: 800;
}

.wgm-progress__track {
    background: #eadfd8;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}

.wgm-progress__bar {
    background: var(--wgm-accent);
    display: block;
    height: 100%;
    transition: width 180ms ease;
    width: 0;
}

@keyframes wgm-spin {
    to {
        transform: rotate(360deg);
    }
}

.wgm-queue {
    display: grid;
    gap: 8px;
}

.wgm-queue__row {
    align-items: center;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--wgm-line);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 10px 12px;
}

.wgm-queue__name {
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wgm-queue__state {
    color: var(--wgm-muted);
    flex: 0 0 auto;
    font-size: 0.92rem;
    font-weight: 800;
}

.wgm-queue__row--active .wgm-queue__state {
    color: var(--wgm-accent-dark);
}

.wgm-queue__row--success .wgm-queue__state {
    color: #245d31;
}

.wgm-queue__row--error .wgm-queue__state {
    color: #8a2525;
}

.wgm-notice {
    border-radius: 8px;
    font-weight: 700;
    padding: 12px 14px;
}

.wgm-notice--success {
    background: #edf8ef;
    color: #245d31;
}

.wgm-notice--error {
    background: #fff0f0;
    color: #8a2525;
}

.wgm-filter {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.wgm-filter span {
    font-weight: 800;
}

.wgm-filter select {
    appearance: none;
    background: #fff;
    border: 1px solid var(--wgm-line);
    border-radius: 8px;
    color: var(--wgm-ink);
    font: inherit;
    min-height: 46px;
    padding: 10px 12px;
}

.wgm-gallery {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.wgm-load-more {
    margin-top: 18px;
    width: 100%;
}

.wgm-load-more[hidden] {
    display: none;
}

.wgm-card {
    background: var(--wgm-card);
    border: 1px solid var(--wgm-line);
    border-radius: 8px;
    overflow: hidden;
}

.wgm-card[hidden],
.wgm-card--hidden {
    display: none !important;
}

.wgm-media {
    appearance: none;
    aspect-ratio: 1;
    background: #1f1b18;
    border: 0;
    cursor: zoom-in;
    display: block;
    overflow: hidden;
    padding: 0;
    position: relative;
    text-align: inherit;
    width: 100%;
}

.wgm-media img,
.wgm-media video {
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.wgm-play {
    background: rgba(255, 250, 246, 0.92);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(31, 27, 24, 0.18);
    height: 48px;
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
}

.wgm-play::before {
    border-bottom: 12px solid transparent;
    border-left: 18px solid var(--wgm-accent-dark);
    border-top: 12px solid transparent;
    content: "";
    left: 18px;
    position: absolute;
    top: 12px;
}

.wgm-card__meta {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 12px;
}

.wgm-card__meta span {
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wgm-card__meta a {
    color: var(--wgm-accent-dark);
    font-weight: 800;
}

.wgm-lightbox-open {
    overflow: hidden;
}

.wgm-lightbox[hidden] {
    display: none;
}

.wgm-lightbox {
    inset: 0;
    position: fixed;
    z-index: 999999;
}

.wgm-lightbox__backdrop {
    background: rgba(24, 20, 18, 0.88);
    inset: 0;
    position: absolute;
}

.wgm-lightbox__dialog {
    display: grid;
    grid-template-rows: 1fr auto;
    inset: clamp(12px, 3vw, 32px);
    position: absolute;
}

.wgm-lightbox__close {
    align-items: center;
    appearance: none;
    background: rgba(255, 255, 255, 0.94);
    border: 0;
    border-radius: 999px;
    color: var(--wgm-ink);
    cursor: pointer;
    display: grid;
    font-size: 30px;
    font-weight: 400;
    height: 44px;
    justify-content: center;
    line-height: 1;
    padding: 0 0 4px;
    position: absolute;
    right: 0;
    top: 0;
    width: 44px;
    z-index: 2;
}

.wgm-lightbox__nav {
    align-items: center;
    appearance: none;
    background: rgba(255, 255, 255, 0.88);
    border: 0;
    border-radius: 999px;
    color: var(--wgm-ink);
    cursor: pointer;
    display: grid;
    font-size: 46px;
    font-weight: 300;
    height: 52px;
    justify-content: center;
    line-height: 1;
    padding: 0 0 6px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    z-index: 2;
}

.wgm-lightbox__nav[hidden] {
    display: none;
}

.wgm-lightbox__nav--prev {
    left: 0;
}

.wgm-lightbox__nav--next {
    right: 0;
}

.wgm-lightbox__media {
    align-items: center;
    display: grid;
    justify-items: center;
    min-height: 0;
    padding: 54px 0 14px;
}

.wgm-lightbox__media img,
.wgm-lightbox__media video {
    border-radius: 8px;
    max-height: calc(100vh - 150px);
    max-width: 100%;
    object-fit: contain;
}

.wgm-lightbox__footer {
    align-items: center;
    background: rgba(255, 250, 246, 0.96);
    border-radius: 8px;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 12px 14px;
}

.wgm-lightbox__details {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.wgm-lightbox__title {
    font-weight: 800;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wgm-lightbox__count {
    color: var(--wgm-muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.wgm-lightbox__download {
    color: var(--wgm-accent-dark);
    flex: 0 0 auto;
    font-weight: 900;
}

@media (max-width: 520px) {
    .wgm-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .wgm-card__meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .wgm-queue__row,
    .wgm-lightbox__footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .wgm-lightbox__media img,
    .wgm-lightbox__media video {
        max-height: calc(100vh - 180px);
    }

    .wgm-lightbox__nav {
        bottom: 74px;
        top: auto;
        transform: none;
    }
}
