* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;
    background: #111;
    color: #f5f5f7;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.screen { min-height: 100vh; }

/* ==================== */
/* MODE PICKER SCREEN   */
/* ==================== */
.mode-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
}

.picker-logo {
    font-size: 48px;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -1.5px;
    color: #f5f5f7;
}

.picker-tagline {
    color: #86868b;
    font-size: 17px;
    font-weight: 400;
    margin-bottom: 48px;
}

.mode-cards {
    display: flex;
    gap: 12px;
    max-width: 680px;
    width: 100%;
}

.mode-card {
    flex: 1;
    padding: 28px 20px;
    border: 1px solid #2a2a2e;
    border-radius: 16px;
    background: #222224;
    color: #86868b;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.mode-card:hover {
    background: #2d2d2f;
    color: #f5f5f7;
    transform: scale(1.02);
}

.card-title {
    font-weight: 600;
    font-size: 16px;
    color: #f5f5f7;
}

.card-desc {
    font-size: 13px;
    opacity: 0.5;
}

/* ==================== */
/* SEARCH SCREEN        */
/* ==================== */

/* Top bar */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(17, 17, 17, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.top-logo {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: #f5f5f7;
    cursor: default;
}

.mode-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    color: #86868b;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.mode-switch:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f5f5f7;
}

/* Search area */
.search-area {
    padding-top: 52px;
    transition: all 0.3s;
}

.search-area.centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding-top: 0;
}

.search-area.top {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 68px 40px 20px;
    max-width: 800px;
}

.search-area.top .search-logo { display: none; }

.search-logo {
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -1.5px;
    margin-bottom: 32px;
    color: #f5f5f7;
}

.search-box {
    display: flex;
    width: 100%;
    max-width: 560px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: #222224;
    overflow: hidden;
    transition: all 0.2s;
}

.search-box:focus-within {
    border-color: rgba(255, 255, 255, 0.2);
    background: #2d2d2f;
}

#search-input {
    flex: 1;
    padding: 14px 18px;
    font-size: 16px;
    border: none;
    background: transparent;
    color: #f5f5f7;
    outline: none;
    font-weight: 400;
}

#search-input::placeholder { color: #48484a; }

#search-btn {
    padding: 14px 16px;
    border: none;
    background: transparent;
    color: #48484a;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

#search-btn:hover { color: #f5f5f7; }

/* Loading */
.loading {
    padding: 60px 40px;
    text-align: center;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid rgba(255, 255, 255, 0.1);
    border-top-color: #86868b;
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading p {
    color: #48484a;
    font-size: 14px;
}

/* Results */
.results-area {
    max-width: 800px;
    padding: 0 40px 40px;
    animation: fade-in 0.4s ease;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-card {
    margin-bottom: 24px;
    padding: 20px 0;
}

#result-title {
    font-size: 24px;
    font-weight: 600;
    color: #f5f5f7;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.result-content {
    font-size: 15px;
    line-height: 1.7;
    color: #86868b;
}

/* Images section */
.images-section, .videos-section {
    margin-bottom: 28px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.images-section h3, .videos-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.section-header h3 { margin-bottom: 0; }

.more-link {
    font-size: 13px;
    color: #2997ff;
    text-decoration: none;
    font-weight: 500;
}

.more-link:hover { text-decoration: underline; }

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 4px;
    border-radius: 12px;
    overflow: hidden;
}

.image-thumb {
    aspect-ratio: 1;
    object-fit: cover;
    width: 100%;
    background: #222224;
    cursor: pointer;
    transition: opacity 0.2s;
}

.image-thumb:hover {
    opacity: 0.8;
}

/* Videos section */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.video-card {
    display: block;
    text-decoration: none;
    background: #222224;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s;
}

.video-card:hover { transform: scale(1.02); }

.video-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
}

.video-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.video-info {
    padding: 10px 12px;
}

.video-title {
    font-size: 13px;
    font-weight: 500;
    color: #f5f5f7;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.video-meta {
    font-size: 11px;
    color: #48484a;
}

/* Search result links */
.result-links {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-link {
    display: block;
    text-decoration: none;
    padding: 16px;
    background: #222224;
    border-radius: 12px;
    transition: background 0.2s;
}

.search-link:hover {
    background: #2d2d2f;
}

.search-link:hover .link-title { color: #2997ff; }

.link-url {
    display: block;
    color: #48484a;
    font-size: 12px;
    margin-bottom: 4px;
    font-weight: 500;
}

.link-title {
    display: block;
    color: #f5f5f7;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    transition: color 0.2s;
}

.link-snippet {
    color: #86868b;
    font-size: 13px;
    line-height: 1.5;
}

/* Error */
.error {
    max-width: 800px;
    margin: 20px 40px;
    background: #222224;
    border-radius: 12px;
    padding: 20px;
    color: #ff453a;
    font-size: 14px;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: #2e2e32;
    border-radius: 20px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    animation: fade-in 0.2s ease;
}

.modal-content h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 17px;
    font-weight: 600;
    color: #86868b;
}

.modal-content .mode-cards {
    max-width: 100%;
}

.modal-content .mode-card {
    background: #3e3e42;
    border-color: #3e3e42;
}

.modal-content .mode-card:hover {
    background: #4e4e52;
}

/* Responsive */
@media (max-width: 600px) {
    .mode-cards { flex-direction: column; }
    .picker-logo { font-size: 40px; }
    .search-logo { font-size: 32px; }
    .results-area { padding: 0 16px 32px; }
    .search-area.top { padding: 68px 16px 16px; }
    .modal-content { padding: 24px 16px; }
    .search-link { padding: 12px; }
}
