/* 3x3 favorites collage page */
.grid9-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

.grid9-header {
    text-align: center;
    margin-bottom: 20px;
}

.grid9-header h1 {
    margin: 0 0 6px;
    font-size: 32px;
    font-weight: 700;
    color: white;
}

.grid9-user {
    color: #888;
    text-decoration: none;
    font-size: 24px;
    font-weight: 400;
}

.grid9-user:hover {
    color: white;
}

.grid9-sub {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.grid9-hint {
    margin: 10px 0 0;
    color: #666;
    font-size: 12px;
}

#grid9 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.grid9-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #0d0d0d;
    border: 1px solid #222;
    overflow: hidden;
}

.grid9-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.grid9-cell.filled {
    cursor: pointer;
}

.grid9-cell.filled:hover img {
    filter: brightness(1.12);
}

.edit-mode .grid9-cell {
    cursor: pointer;
}

.edit-mode .grid9-cell:not(.filled) {
    border-style: dashed;
    border-color: #333;
}

.edit-mode .grid9-cell:not(.filled)::after {
    content: "+";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 300;
    color: #3a3a3a;
}

.edit-mode .grid9-cell:hover {
    border-color: #b506f4;
}

/* Swap button on a filled cell (owner only, always visible in edit mode — no hover on touch) */
.grid9-swap {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 26px;
    height: 26px;
    padding: 0;
    background: rgba(13, 13, 13, 0.85);
    border: 1px solid #444;
    border-radius: 3px;
    color: #aaa;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.grid9-swap:hover {
    border-color: #b506f4;
    color: white;
}

/* Album picker swapped into the sidebar */
.grid-picker-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.grid-picker-head h2 {
    margin: 0;
    font-size: 18px;
    color: #ccc;
}

.grid-picker-close {
    background: none;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
}

.grid-picker-close:hover {
    color: white;
}

.grid-picker-clear {
    width: 100%;
    margin-bottom: 12px;
    padding: 8px;
    background: #161616;
    border: 1px solid #3a2222;
    border-radius: 3px;
    color: #c88;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}

.grid-picker-clear:hover {
    border-color: #b506f4;
    color: white;
}

#grid-picker-q {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    background: #111;
    border: 1px solid #333;
    border-radius: 3px;
    color: #ccc;
    font-size: 14px;
    font-family: inherit;
}

#grid-picker-q:focus {
    outline: none;
    border-color: #555;
}

#grid-picker-results {
    margin: 10px 0 16px;
    max-height: 46vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.grid-picker-ext-header {
    margin: 10px 0 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
}

.grid-picker-badge {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 10px;
    color: #6a6a6a;
    border: 1px solid #2e2e2e;
    border-radius: 3px;
    padding: 2px 6px;
    white-space: nowrap;
}

.grid-picker-ext-note {
    color: #555;
    font-size: 12px;
    margin: 10px 0 0;
}

.grid-picker-hint,
.grid-picker-empty {
    color: #666;
    font-size: 13px;
    margin: 8px 0;
}

.grid-picker-item {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 6px;
    background: #141414;
    border: 1px solid #262626;
    border-radius: 3px;
    color: #ccc;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}

.grid-picker-item:hover {
    border-color: #b506f4;
}

.grid-picker-item-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.grid-picker-item-name {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-picker-item-artist {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-picker-add summary {
    color: #888;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 10px;
}

.grid-picker-add summary:hover {
    color: white;
}

.grid-picker-add form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.grid-picker-add input[type="text"],
.grid-picker-add input[type="file"] {
    padding: 8px 10px;
    background: #111;
    border: 1px solid #333;
    border-radius: 3px;
    color: #ccc;
    font-size: 14px;
    font-family: inherit;
}

.grid-picker-add input:focus {
    outline: none;
    border-color: #555;
}

.grid-picker-add button {
    padding: 8px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 3px;
    color: #ccc;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
}

.grid-picker-add button:hover {
    border-color: #b506f4;
    color: white;
}

@media (max-width: 480px) {
    #grid9 {
        gap: 6px;
    }
}
