.collections-jarvis-modal {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0,0,0,.82);
}

.collections-jarvis-modal.is-open { display: flex; }

.collections-jarvis-dialog {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0,2fr) minmax(270px,1fr);
    gap: 16px;
    width: min(1196px,78.4vw);
    height: 76.8vh;
    max-height: 76.8vh;
    padding: 18px;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    background: #000;
    color: #fff;
}

.collections-jarvis-close {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 50;
    border: 0;
    background: none;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.collections-jarvis-viewer {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    background: #050505;
}

.collections-jarvis-slots {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    grid-template-rows: repeat(2,minmax(0,1fr));
    gap: 8px;
    width: 100%;
    height: 100%;
    padding: 8px;
    box-sizing: border-box;
}

.collections-jarvis-slot {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid #30303d;
    border-radius: 8px;
    background: #08080c;
    color: #fff;
    cursor: pointer;
    transition: border-color .15s ease, transform .15s ease;
}

.collections-jarvis-slot:hover,
.collections-jarvis-slot:focus-visible {
    border-color: rgba(255,255,255,.62);
    outline: none;
}

.collections-jarvis-slot img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.collections-jarvis-slot-label {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 30;
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(0,0,0,.72);
    font-size: 12px;
    font-weight: 800;
    pointer-events: none;
}

.collections-jarvis-info {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-top: 24px;
    overflow-y: auto;
    overflow-x: hidden;
}

.collections-jarvis-info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.collections-jarvis-info-header h2 { margin: 0; font-size: 18px; }
.collections-jarvis-info-header span { color: #aaa; font-size: 12px; font-weight: 700; }
.collections-jarvis-date { margin: 10px 0 0; color: #9d9daa; font-size: 12px; }

.collections-jarvis-prompt {
    flex: 0 1 auto;
    min-height: 0;
    max-height: min(240px, 40dvh);
    margin: 12px 0 0;
    padding: 12px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    background: rgba(255,255,255,.04);
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.collections-jarvis-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.collections-jarvis-copy,
.collections-jarvis-rotate {
    min-height: 36px;
    padding: 7px 14px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 7px;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.2;
}

.collections-jarvis-rotate:disabled { opacity:.45; cursor:not-allowed; }
.collections-jarvis-3d-host { position:absolute; inset:0; pointer-events:none; }
.collections-jarvis-3d-host canvas { width:100%!important; height:100%!important; display:block; }
.collections-jarvis-3d-overlay {
    position:absolute;
    inset:0;
    z-index:25;
    display:flex;
    align-items:center;
    justify-content:center;
    background:rgba(0,0,0,.45);
    color:#fff;
    font-size:12px;
    pointer-events:none;
}
@media (min-width:768px) and (max-width:1099px) {
    .collections-jarvis-modal { padding:24px; }
    .collections-jarvis-dialog {
        width:min(720px, calc(100vw - 48px));
        height:min(68vh, 640px);
        height:min(68dvh, 640px);
        max-height:calc(100dvh - 48px);
        grid-template-columns:minmax(0,1.4fr) minmax(240px,.8fr);
    }
}
@media (max-width:767px) {
    .collections-jarvis-modal { padding: 10px; }
    .collections-jarvis-dialog {
        display: flex;
        flex-direction: column;
        width: calc(100vw - 16px);
        height: calc(100dvh - 92px);
        max-height: calc(100dvh - 92px);
        padding: 14px;
        overflow-y: auto;
    }
    .collections-jarvis-viewer { flex: 0 0 58vh; }
    .collections-jarvis-info { flex: 0 0 auto; min-height: 260px; padding-top: 0; }
    .collections-jarvis-prompt { max-height: 220px; }
    .collections-jarvis-actions { flex-wrap:wrap; }
}

@media (min-width:768px) and (max-width:1099px) and (orientation:portrait) {
    .collections-jarvis-dialog {
        display: flex;
        flex-direction: column;
        width: min(920px, calc(100vw - 48px));
        height: auto;
        max-height: calc(100dvh - 48px);
        overflow-y: auto;
    }
    .collections-jarvis-info {
        flex: 0 0 auto;
        min-height: 0;
        padding-top: 0;
    }
    .collections-jarvis-prompt { max-height: 180px; }
    .collections-jarvis-actions { flex-wrap: wrap; }
}

@media (max-width:1099px) and (orientation:portrait) {
    .collections-jarvis-viewer {
        flex: 0 0 auto;
        aspect-ratio: 16 / 10;
    }
}

@media (min-width:1100px) and (max-width:1439px) and (hover:none) and (pointer:coarse) {
    .collections-jarvis-dialog {
        height: min(64dvh, 600px);
        max-height: calc(100dvh - 64px);
    }
}
