:root {
    color-scheme: light;
    --ink: #17202a;
    --muted: #667085;
    --line: #d9e0e8;
    --panel: #ffffff;
    --soft: #f3f7fb;
    --accent: #0f7c80;
    --accent-strong: #0a6266;
    --danger: #a33a3a;
    --success: #14734d;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, #f7fafc 0%, #edf3f7 100%);
    color: var(--ink);
}

a {
    color: inherit;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 56px;
}

.topbar,
.viewer-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 5vw, 4.2rem);
    line-height: 0.95;
}

h2 {
    margin-bottom: 8px;
    font-size: 1.05rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.counter {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    padding: 9px 14px;
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
}

.upload-panel,
.empty-state,
.player-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 18px 45px rgba(21, 42, 57, 0.08);
}

.upload-panel {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
    padding: 18px;
}

.upload-form label {
    display: block;
    margin-bottom: 10px;
    font-weight: 800;
}

.upload-row {
    display: flex;
    gap: 10px;
}

input[type="file"] {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
    padding: 10px;
}

input[type="text"],
input[type="password"],
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
    padding: 10px 12px;
    color: var(--ink);
    font: inherit;
}

button,
.button,
.download-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 0 16px;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

button,
.primary,
.download-button {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

button:hover,
.primary:hover,
.download-button:hover {
    background: var(--accent-strong);
}

button:disabled {
    border-color: var(--line);
    background: #e8edf2;
    color: var(--muted);
    cursor: not-allowed;
}

small,
.video-info p,
.download-panel p {
    color: var(--muted);
}

.notice {
    margin: 0;
    border-radius: 8px;
    padding: 11px 13px;
    font-weight: 700;
}

.success {
    background: #e9f8f0;
    color: var(--success);
}

.error {
    background: #fff0f0;
    color: var(--danger);
}

.warning {
    background: #fff7df;
    color: #7a5200;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 18px;
}

.public-video-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.video-list {
    display: grid;
    gap: 12px;
}

.public-video-list {
    width: min(560px, 100%);
    margin: 0 auto;
}

.video-card {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 16px 34px rgba(21, 42, 57, 0.08);
}

.public-video-card {
    position: relative;
    aspect-ratio: 9 / 16;
    min-height: 245px;
    background: #111820;
}

.video-row-card {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 14px 28px rgba(21, 42, 57, 0.08);
}

.video-row-card video {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #111820;
    object-fit: cover;
}

.video-row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
}

.video-card video {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #111820;
    object-fit: cover;
}

.public-video-card video {
    height: 100%;
    aspect-ratio: auto;
    object-fit: cover;
}

.video-info {
    display: grid;
    grid-template-columns: 1fr 84px;
    gap: 14px;
    align-items: start;
    padding: 16px 16px 10px;
}

.qr {
    width: 84px;
    height: 84px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 6px;
}

.public-video-card .qr {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 76px;
    height: 76px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.qr img,
.qr canvas {
    width: 70px;
    height: 70px;
}

.public-video-card .qr img,
.public-video-card .qr canvas {
    width: 62px;
    height: 62px;
}

.actions {
    display: flex;
    gap: 10px;
    padding: 0 16px 16px;
}

.actions .button {
    flex: 1;
}

.empty-state {
    padding: 34px;
    text-align: center;
}

.empty-state h1,
.empty-state h2 {
    margin-bottom: 10px;
}

.viewer-body {
    background: #101820;
}

.viewer {
    width: min(980px, calc(100% - 28px));
    margin: 0 auto;
    padding: 28px 0;
}

.player-panel {
    padding: 18px;
}

.public-intro p {
    margin-bottom: 0;
    color: var(--muted);
    font-weight: 700;
}

.refresh-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    padding: 8px 0 12px;
    background: linear-gradient(180deg, #f7fafc 0%, rgba(247, 250, 252, 0.88) 75%, rgba(247, 250, 252, 0) 100%);
}

.refresh-button {
    width: min(100%, 560px);
}

.manager-shell {
    max-width: 1120px;
}

.login-panel,
.manager-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 18px 45px rgba(21, 42, 57, 0.08);
}

.login-panel {
    width: min(420px, 100%);
    margin: 9vh auto 0;
    padding: 24px;
}

.manager-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin: 18px 0;
}

.manager-panel {
    margin-bottom: 18px;
    padding: 18px;
}

.manager-form {
    display: grid;
    gap: 10px;
}

.manager-form label {
    font-weight: 800;
}

.panel-heading,
.wedding-row,
.row-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.panel-heading,
.wedding-row {
    justify-content: space-between;
}

.panel-heading {
    margin-bottom: 14px;
}

.panel-heading h2,
.wedding-row h3 {
    margin: 0;
}

.wedding-list {
    display: grid;
    gap: 10px;
}

.wedding-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
    padding: 14px;
}

.wedding-row p,
.muted {
    margin: 5px 0 0;
    color: var(--muted);
}

.row-actions form {
    margin: 0;
}

.compact-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.no-qr {
    grid-template-columns: 1fr;
}

.player {
    width: 100%;
    max-height: 72vh;
    border-radius: 8px;
    background: #05080b;
}

.download-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
}

.download-panel p {
    margin: 0;
    max-width: 560px;
}

@media (max-width: 720px) {
    .shell {
        width: min(100% - 14px, 1180px);
        padding: 7px 0 20px;
    }

    .topbar,
    .viewer-heading,
    .download-panel,
    .upload-row,
    .panel-heading,
    .wedding-row,
    .row-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .manager-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2.25rem;
        line-height: 1;
    }

    .video-info {
        grid-template-columns: 1fr;
    }

    .public-video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .public-video-card {
        min-height: 230px;
        border-radius: 7px;
    }

    .public-video-list {
        gap: 10px;
    }

    .video-row-actions {
        padding: 8px;
    }

    .video-row-actions .button {
        min-height: 48px;
    }

    .qr {
        width: 100%;
        height: auto;
        min-height: 104px;
    }

    .qr img,
    .qr canvas {
        width: 88px;
        height: 88px;
    }

    .public-video-card .qr {
        width: 70px;
        height: 70px;
        min-height: 0;
        padding: 5px;
    }

    .public-video-card .qr img,
    .public-video-card .qr canvas {
        width: 58px;
        height: 58px;
    }

    .actions {
        flex-direction: column;
    }
}
