.light {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(5, 5, 6, 0.92);
    cursor: zoom-out;
    touch-action: none;
    overflow: hidden;
}

.light[hidden] { display: none; }

.light img {
    width: auto;
    height: auto;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    max-width: calc(100dvw - 40px);
    max-height: calc(100dvh - 40px);
    border: 1px solid var(--line2);
    touch-action: none;
    user-select: none;
    -webkit-user-drag: none;
}

.light-tools {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: linear-gradient(rgba(5, 5, 6, 0.9), rgba(5, 5, 6, 0));
    cursor: default;
}

.light-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font: 11px var(--mono);
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.light-count { font: 11px var(--mono); color: var(--dim); }

.lb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 28px;
    padding: 0 8px;
    font: 13px var(--mono);
    color: var(--text);
    background: #16161a;
    border: 1px solid var(--line2);
    cursor: pointer;
}

.lb:hover { color: var(--accent); border-color: var(--accent-dark); text-decoration: none; filter: none; }
.lb[hidden] { display: none; }
.lb-x { margin-left: 2px; }

.light-nav {
    position: absolute;
    top: 50%;
    z-index: 3;
    width: 44px;
    height: 64px;
    transform: translateY(-50%);
    font: 26px var(--mono);
    color: var(--text);
    background: rgba(16, 16, 18, 0.75);
    border: 1px solid var(--line2);
    cursor: pointer;
}

.light-nav:hover { color: var(--accent); border-color: var(--accent-dark); filter: none; }
.light-nav[hidden] { display: none; }
.l-prev { left: 8px; }
.l-next { right: 8px; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(5, 5, 6, 0.75);
}

.modal[hidden] { display: none; }

.modal-box {
    width: 100%;
    max-width: 360px;
    padding: 14px;
    background: var(--panel);
    border: 2px solid var(--line2);
}

.modal-title { margin-bottom: 6px; font: 700 13px var(--mono); }
.modal-title[hidden] { display: none; }
.modal-text { margin: 0; color: var(--dim); font-size: 13px; overflow-wrap: anywhere; }
.modal-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.modal-btns button { padding: 6px 12px; }

.modal-cancel {
    background: var(--panel);
    border: 1px solid var(--line2);
    color: var(--text);
}

.modal-ok.red { background: var(--danger); border-color: var(--danger); color: #f0dcd8; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 40;
    padding: 8px 14px;
    background: var(--panel2);
    border: 1px solid var(--accent-dark);
    color: var(--text);
    font: 12px var(--mono);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(3px); }
}

body.shake { animation: shake 0.45s; }

