:root {
    --ink: #10201f;
    --ink-2: #203433;
    --paper: #f6f2ea;
    --paper-strong: #fffdf7;
    --line: rgba(16, 32, 31, 0.14);
    --muted: #64716e;
    --teal: #1f8a7a;
    --teal-dark: #116457;
    --coral: #e46d52;
    --sage: #bbd3bc;
    --sun: #f3c35b;
    --shadow: 0 24px 70px rgba(7, 18, 17, 0.24);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(16, 32, 31, 0.94), rgba(24, 48, 45, 0.84)),
        url("photo-board.png") center / cover fixed;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-shell {
    width: min(100%, 680px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 24px 16px 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}

.brand-strip,
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--paper-strong);
}

.brand-strip h1,
.admin-header h1,
.login-panel h1 {
    margin: 2px 0 0;
    font-size: 2rem;
    line-height: 1.05;
}

.eyebrow {
    margin: 0;
    color: var(--sun);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.admin-pill,
.ghost-button,
.primary-mini {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 10px 14px;
    color: var(--paper-strong);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    font-size: 0.92rem;
    font-weight: 800;
}

.upload-panel,
.login-panel {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.52);
    border-radius: var(--radius);
    background: rgba(255, 253, 247, 0.94);
    box-shadow: var(--shadow);
}

.upload-panel {
    padding: 18px;
}

.panel-copy {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.panel-copy h2,
.empty-state h2 {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.15;
}

.panel-copy p,
.empty-state p,
.media-body p,
.muted-note {
    margin: 4px 0 0;
    color: var(--muted);
    line-height: 1.45;
}

.upload-form {
    display: grid;
    gap: 12px;
}

.dropzone {
    position: relative;
    min-height: 230px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    border: 2px dashed rgba(31, 138, 122, 0.46);
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(187, 211, 188, 0.38), rgba(243, 195, 91, 0.18)),
        rgba(255, 255, 255, 0.72);
    cursor: pointer;
    isolation: isolate;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.dropzone::after {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 6px;
    border: 1px solid rgba(16, 32, 31, 0.07);
    pointer-events: none;
}

.dropzone:hover,
.dropzone.is-dragging {
    transform: translateY(-2px);
    border-color: var(--teal);
    background:
        linear-gradient(135deg, rgba(187, 211, 188, 0.55), rgba(228, 109, 82, 0.16)),
        rgba(255, 255, 255, 0.82);
}

.dropzone-icon {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--ink);
    box-shadow: 0 14px 36px rgba(16, 32, 31, 0.22);
}

.dropzone-icon span {
    width: 31px;
    height: 26px;
    display: block;
    border: 3px solid var(--paper-strong);
    border-radius: 7px;
    position: relative;
}

.dropzone-icon span::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 6px;
    width: 13px;
    height: 8px;
    border: 3px solid var(--paper-strong);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
}

.dropzone-icon span::after {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: var(--sun);
}

.dropzone-title {
    font-size: 1.55rem;
    line-height: 1;
    font-weight: 900;
}

.dropzone-meta {
    color: var(--muted);
    font-weight: 700;
}

.picker-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.picker-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 8px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.78);
    font-size: 0.9rem;
    font-weight: 900;
    text-align: center;
    cursor: pointer;
}

.picker-button.is-video {
    color: var(--paper-strong);
    border-color: transparent;
    background: var(--coral);
}

.selection-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    background: rgba(255, 255, 255, 0.72);
}

.selection-summary strong,
.selection-summary span {
    display: block;
}

.selection-summary span {
    color: var(--muted);
    font-size: 0.92rem;
}

.upload-panel .ghost-button,
.login-panel .ghost-button,
.media-card .ghost-button {
    border-color: var(--line);
    color: var(--ink);
    background: rgba(255, 255, 255, 0.74);
}

.file-list {
    max-height: 212px;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
    overflow: auto;
    list-style: none;
}

.file-list li {
    min-height: 54px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.66);
}

.file-list strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.94rem;
}

.file-list span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.primary-button {
    width: 100%;
    min-height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: var(--radius);
    color: var(--paper-strong);
    background: linear-gradient(135deg, var(--teal), var(--teal-dark));
    box-shadow: 0 15px 36px rgba(31, 138, 122, 0.26);
    font-weight: 900;
}

.primary-button:disabled {
    cursor: not-allowed;
    color: rgba(255, 255, 255, 0.72);
    background: #9aa5a2;
    box-shadow: none;
}

.button-arrow {
    width: 26px;
    height: 26px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
}

.progress-stage {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 92px 1fr;
    align-items: center;
    gap: 14px;
    border: 1px solid rgba(31, 138, 122, 0.18);
    border-radius: var(--radius);
    padding: 14px;
    background: rgba(31, 138, 122, 0.08);
}

.progress-ring {
    --progress: 0deg;
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--coral) var(--progress), rgba(16, 32, 31, 0.1) 0deg);
    position: relative;
    transition: background 120ms linear;
}

.progress-ring::after {
    content: "";
    position: absolute;
    inset: 9px;
    border-radius: 50%;
    background: var(--paper-strong);
}

.progress-ring span {
    position: relative;
    z-index: 1;
    font-weight: 950;
}

.progress-details {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.progress-details span {
    color: var(--muted);
}

.progress-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(16, 32, 31, 0.1);
}

.progress-track span {
    width: 0;
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), var(--sun), var(--coral));
    transition: width 120ms linear;
}

.message-box {
    margin-top: 12px;
    border-radius: var(--radius);
    padding: 12px 14px;
    color: var(--ink);
    background: rgba(187, 211, 188, 0.46);
    border: 1px solid rgba(31, 138, 122, 0.22);
    line-height: 1.45;
}

.message-box.is-error {
    background: rgba(228, 109, 82, 0.16);
    border-color: rgba(228, 109, 82, 0.34);
}

.admin-shell {
    width: min(100%, 1180px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 24px 16px 42px;
}

.login-panel {
    width: min(100%, 430px);
    margin: 10vh auto 0;
    padding: 22px;
}

.login-form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.login-form label {
    display: grid;
    gap: 7px;
    font-weight: 800;
}

.login-form input {
    min-height: 50px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 13px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.84);
}

.alert {
    margin-top: 14px;
    border: 1px solid rgba(228, 109, 82, 0.34);
    border-radius: var(--radius);
    padding: 12px 14px;
    background: rgba(228, 109, 82, 0.16);
    font-weight: 800;
}

.text-link {
    display: inline-flex;
    margin-top: 14px;
    color: var(--teal-dark);
    font-weight: 900;
}

.admin-header {
    padding: 4px 0 18px;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.stats-row article,
.empty-state {
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: var(--radius);
    background: rgba(255, 253, 247, 0.92);
    box-shadow: 0 14px 38px rgba(7, 18, 17, 0.16);
}

.stats-row article {
    min-height: 92px;
    padding: 14px;
    display: grid;
    align-content: center;
    gap: 4px;
}

.stats-row span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
}

.stats-row strong {
    font-size: 1.55rem;
    line-height: 1;
}

.empty-state {
    padding: 24px;
}

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

.media-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.44);
    border-radius: var(--radius);
    background: rgba(255, 253, 247, 0.94);
    box-shadow: 0 14px 38px rgba(7, 18, 17, 0.18);
}

.media-preview {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #172827;
    position: relative;
}

.media-preview a,
.media-preview img,
.media-preview video {
    width: 100%;
    height: 100%;
    display: block;
}

.media-preview img,
.media-preview video {
    object-fit: contain;
}

.admin-preview-video {
    cursor: pointer;
}

.media-preview .play-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.media-preview .play-overlay::before {
    content: '';
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.media-preview .play-overlay::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 18px solid #fff;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    position: absolute;
}

.media-body {
    padding: 12px;
}

.media-topline,
.media-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.media-topline {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 900;
}

.kind-badge {
    border-radius: 999px;
    padding: 5px 9px;
    color: var(--ink);
    background: var(--sage);
}

.media-body h2 {
    min-height: 44px;
    margin: 9px 0 2px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 1rem;
    line-height: 1.25;
    word-break: break-word;
}

.media-actions {
    margin-top: 12px;
}

.media-actions .ghost-button,
.primary-mini {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 0.86rem;
}

.delete-button {
    background: rgba(228, 109, 82, 0.12);
    color: var(--ink);
    border: 1px solid rgba(228, 109, 82, 0.42);
}

.primary-mini {
    border-color: transparent;
    color: var(--paper-strong);
    background: var(--teal);
}

.unknown-file {
    color: var(--paper-strong);
    font-weight: 900;
}

.media-lightbox {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.68);
    padding: 18px;
}

.media-lightbox.hidden {
    display: none;
}

.media-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.media-lightbox-panel {
    position: relative;
    max-width: 900px;
    width: 100%;
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 34px 100px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.media-lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 1;
    border: none;
    background: rgba(255, 255, 255, 0.96);
    color: #0f1a19;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 1.35rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

#lightboxVideo {
    width: 100%;
    height: auto;
    max-height: 70vh;
    background: #000;
    display: block;
}

.media-lightbox-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 16px 18px 20px;
    background: #f5f5f5;
}

.media-lightbox-controls button {
    padding: 10px 18px;
    border: 1px solid rgba(16, 22, 24, 0.12);
    background: #fff;
    color: #111;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.media-lightbox-controls button:hover {
    transform: translateY(-1px);
    background: #f0f0f0;
}

.media-preview:hover {
    opacity: 0.98;
}

.delete-modal {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.45);
}

.delete-modal.is-visible {
    display: flex;
}

.delete-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.delete-modal-panel {
    position: relative;
    background: #fff;
    border-radius: 22px;
    padding: 28px 26px;
    max-width: 420px;
    width: 100%;
    z-index: 1;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.16);
    border: 1px solid rgba(16, 22, 24, 0.08);
}

.delete-modal-panel h2 {
    margin: 0 0 12px;
    font-size: 1.35rem;
}

.delete-modal-panel p {
    margin: 0 0 20px;
    color: #1c1c1c;
    line-height: 1.5;
}

.delete-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.delete-modal-hint {
    margin-top: 16px;
    color: #6a6a6a;
    font-size: 0.95rem;
}

.delete-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    border: none;
    background: transparent;
    color: #6a6a6a;
    font-size: 1.35rem;
    cursor: pointer;
}

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

@media (max-width: 640px) {
    body {
        background-attachment: scroll;
    }

    .app-shell {
        justify-content: flex-start;
        padding-top: 18px;
    }

    .brand-strip h1,
    .admin-header h1,
    .login-panel h1 {
        font-size: 1.65rem;
    }

    .panel-copy {
        display: block;
    }

    .dropzone {
        min-height: 255px;
    }

    .picker-actions {
        grid-template-columns: 1fr;
    }

    .progress-stage {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .progress-details {
        width: 100%;
    }

    .admin-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-actions {
        width: 100%;
        justify-content: stretch;
    }

    .admin-actions a {
        flex: 1;
    }

    .stats-row,
    .media-grid {
        grid-template-columns: 1fr;
    }

    .media-actions {
        align-items: stretch;
        flex-direction: column;
    }
}
