:root {
    --filter-btn-size: 64px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    background: #06080c;
}

body {
    margin: 0;
    color: #f6f7fb;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    position: relative;
}

body.is-loading #canvas {
    opacity: 0;
}

body.webgl-ready #canvas {
    opacity: 1;
    transition: opacity 0.35s ease;
}

body.webgl-unavailable #canvas {
    display: none;
}

#loading-screen {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    gap: 16px;
    background: radial-gradient(circle at 20% 20%, rgba(24, 35, 70, 0.85), rgba(6, 8, 12, 0.95));
    z-index: 1800;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    color: #e5e9ff;
    text-align: center;
}

body:not(.is-loading) #loading-screen {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-visual {
    width: clamp(72px, 6vw, 96px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 3px solid rgba(229, 233, 255, 0.25);
    border-top-color: rgba(229, 233, 255, 0.8);
    animation: spin 1s linear infinite;
}

.loading-copy {
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    opacity: 0.85;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.noscript-warning {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #06080c;
    z-index: 2000;
    color: #f6f7fb;
    text-align: center;
}

#webgl-fallback {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 6vw, 80px);
    background: rgba(6, 8, 12, 0.9);
    backdrop-filter: blur(24px);
    z-index: 1700;
    color: #f6f7fb;
}

#webgl-fallback[hidden] {
    display: none;
}

#webgl-fallback .fallback-inner {
    max-width: 720px;
    display: grid;
    gap: 16px;
    text-align: left;
}

#webgl-fallback h1 {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#webgl-fallback a {
    color: #8ab4ff;
    text-decoration: underline;
}

.fallback-actions {
    margin: 0;
    padding-left: 20px;
    color: rgba(246, 247, 251, 0.85);
}

#canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    background: #06080c;
}

#site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1400;
    padding: clamp(16px, 3vw, 28px);
    pointer-events: none;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(16px, 4vw, 40px);
    padding: clamp(14px, 2.2vw, 22px) clamp(18px, 4vw, 34px);
    border-radius: 18px;
    background: rgba(6, 8, 12, 0.48);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(24px);
    pointer-events: auto;
}

.header-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 0.95rem;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.3rem;
}

.brand-name {
    letter-spacing: 0.28em;
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.icon-button:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.28);
}

.icon-button i {
    font-size: 1.1rem;
}

.trigger-hint {
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.75rem;
    letter-spacing: 0.18em;
}

#canvas:active {
    cursor: grabbing;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transform: translateY(100%);
}

.modal.active {
    display: block;
}

.modal-scroll-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: clamp(24px, 4vw, 64px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    width: min(1200px, 92vw);
    max-height: calc(100vh - clamp(48px, 8vh, 96px));
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.2fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "header media"
        "details media";
    gap: clamp(24px, 4vw, 48px);
    align-items: stretch;
    margin: 0;
}

.modal-header {
    grid-area: header;
    margin: 0;
    align-self: end;
}

.modal-header h2 {
    font-size: clamp(2.4rem, 5vw, 5.6rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 0.95;
    margin: 0;
    text-align: left;
}
        
.modal-image-container {
    grid-area: media;
    margin: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 100%;
    border-radius: 18px;
    overflow: hidden;
}

.modal-image {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: 18px;
    display: block;
}

.modal-image.is-loading {
    filter: blur(12px);
    opacity: 0.6;
    transition: filter 0.3s ease, opacity 0.3s ease;
}
        
.modal-details {
    grid-area: details;
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 3vw, 36px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: clamp(20px, 3vw, 36px);
    max-width: min(480px, 100%);
    align-items: flex-start;
    justify-content: flex-start;
}

.modal-info .year {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    margin-bottom: 20px;
}
        
.modal-info .description {
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.85);
    max-width: 52ch;
}
        
.modal-meta .tags-title {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 20px;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.modal-tag {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 500;
}

.close-modal {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 1002;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
}
        
.close-modal i {
    font-size: 24px;
    line-height: 1;
    transform-origin: center;
}

.close-modal:hover {
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    transform-origin: center;
    transform: rotate(90deg) scale(1.1);
}
        
.modal-header h2, .modal-image-container, .modal-info, .modal-meta {
    opacity: 0;
    transform: translateY(20px);
}

#command-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(32px, 8vh, 96px) clamp(18px, 6vw, 64px);
    backdrop-filter: blur(16px);
    z-index: 1600;
}

#command-overlay.active {
    display: flex;
}

.command-shell {
    position: relative;
    width: min(880px, 92vw);
    max-height: 80vh;
    background: rgba(0, 0, 0, 0.92);
    border-radius: 32px;
    border: 2px solid rgba(255,255,255,0.12);
    box-shadow: 0 45px 120px rgba(0, 0, 0, 0.65);
    padding: clamp(24px, 4vw, 40px);
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
}

.search-bar-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    background: rgba(6, 8, 12, 0.55);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.search-bar-row i {
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.6);
}

#command-input {
    width: 100%;
    background: transparent;
    border: none;
    color: #f6f7fb;
    font-size: 1.2rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#command-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

#command-input:focus {
    outline: none;
}

#command-input:disabled {
    opacity: 0.6;
    cursor: progress;
}

#command-feedback {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.68);
    min-height: 22px;
}

#command-overlay.error #command-feedback {
    color: #ff8686;
}

#command-overlay.loading .search-bar-row {
    border-color: rgba(255, 255, 255, 0.35);
}

.command-shell .icon-button {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
    border-color: transparent;
    background: rgba(255, 255, 255, 0.08);
}

.command-shell .icon-button:hover {
    background: rgba(255, 255, 255, 0.16);
}

.link-button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.link-button:hover {
    color: rgba(255, 255, 255, 0.85);
}

.search-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    padding-right: 0;
    border-radius: 0;
    border: none;
    background: none;
    scrollbar-width: none;
}
.search-grid::-webkit-scrollbar {
    display: none;
}

.search-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-radius: 0;
    border: none;
    background: none;
    padding: 24px 0 0 0;
}

.search-section header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: rgba(255, 255, 255, 0.72);
}

.search-section h2 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 600;
}

.pill-collection {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.search-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 10px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px dashed rgba(255,255,255,0.12);
    color: rgba(255, 255, 255, 0.86);
    cursor: pointer;
    font-size: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transition: background 0.2s, border-color 0.2s;
}
.search-pill:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255,255,255,0.22);
}

.color-collection {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.color-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    min-width: 88px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.256);
    background: rgba(0,0,0,0.24);
    color: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    text-align: left;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.color-chip:hover {
    background: rgba(255, 255, 255, 0.268);
}

.color-chip__swatch {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: 0 1px 0 rgba(0,0,0,0.35) inset;
    border: 1px solid rgba(255,255,255,0.08);
}

.color-chip__label {
    font-size: 0.95rem;
    color: inherit;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.recently-viewed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.recent-card {
    display: block;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.12));
    border: 1px solid rgba(255,255,255,0.06);
    padding: 10px 14px;
    border-radius: 8px;
    min-height: 44px;
    color: rgba(255,255,255,0.95);
    cursor: pointer;
    text-align: left;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.recent-card__label {
    display: block;
    padding: 6px 0;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.recent-card__label {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.empty-hint {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.45);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    letter-spacing: 0.02em;
}

.search-pill:focus-visible,
.color-chip:focus-visible,
.recent-card:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 3px;
}

#command-hint {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(18, 22, 28, 0.75);
    backdrop-filter: blur(18px);
    color: rgba(240, 244, 250, 0.92);
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    letter-spacing: 0.01em;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
    z-index: 1500;
    pointer-events: auto; /* This allows the hint to be clicked */
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#command-hint .keycap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.9em;
    min-height: 1.9em;
    margin: 0 6px 0 8px;
    padding: 0 0.5em;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.85);
    color: #06080c;
    font-weight: 600;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}

#command-hint.hidden {
    opacity: 0;
    transform: translate(-50%, -12px);
}

/* hide command hint when overlay is active to avoid overlap */
#command-overlay.active + #command-hint,
#command-overlay.active ~ #command-hint,
#command-overlay.active #command-hint {
    display: none !important;
}

/* ===== RESPONSIVE STYLES ===== */

@media (max-width: 900px) {
    .modal-scroll-container {
        padding: clamp(24px, 6vw, 40px);
        align-items: flex-start;
    }
    .modal-content {
        width: 100%;
        max-width: 640px;
        max-height: none;
        display: flex;
        flex-direction: column;
        gap: clamp(20px, 5vw, 32px);
    }
    .modal-header {
        align-self: stretch;
    }
    .modal-header h2 {
        text-align: center;
        font-size: clamp(2.2rem, 8vw, 3.6rem);
    }
    .modal-image-container {
        order: 2;
        height: auto;
    }
    .modal-image {
        height: auto;
        max-height: 60vh;
    }
    .modal-details {
        order: 3;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        padding-top: clamp(20px, 5vw, 32px);
        max-width: 100%;
    }
    .modal-info .description {
        max-width: 100%;
    }
    .header-inner {
        flex-wrap: wrap;
        gap: 18px;
    }
    .header-actions {
        order: 2;
    }
}

@media (max-width: 720px) {
    #command-overlay {
        padding: 16px;
        align-items: flex-start;
    }
    .command-shell {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        border: 0;
        box-shadow: none;
        padding: 20px 18px 28px;
        gap: 20px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .search-bar-row {
        grid-template-columns: 1fr auto;
        gap: 12px;
        padding: 16px;
    }
    .search-bar-row i {
        display: none;
    }
    #command-input {
        font-size: 1rem;
    }
    .command-shell .icon-button {
        width: 34px;
        height: 34px;
    }
    #command-feedback {
        font-size: 0.85rem;
    }
    .search-grid {
        padding-right: 4px;
        gap: 12px;
    }
    .search-section {
        padding: 16px 0 0 0;
    }
    .search-section header h2 {
        font-size: 0.85rem;
    }
    .pill-collection,
    .recently-viewed,
    .color-collection {
        gap: 10px;
    }
    
    /* ADDED: Makes search pills smaller on mobile for a cleaner look */
    .search-pill {
        padding: 8px 14px;
        font-size: 0.9rem;
    }
}

@media (max-width: 600px) {
    /* UPDATED: Moves the hint to the bottom on mobile for better ergonomics */
    #command-hint {
        top: auto;
        bottom: 24px;
        left: 16px;
        right: 16px;
        width: auto;
        transform: none;
        padding: 12px;
        font-size: 0.9rem;
        text-align: center;
        border-radius: 14px;
    }
    #command-hint .keycap {
        min-width: 1.8em;
        min-height: 1.8em;
        margin: 0 4px;
        font-size: 0.9rem;
    }
    #command-hint.hidden {
        transform: translateY(12px);
    }
    
    .recent-card__label {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}

