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

body {
    font-family: "Avenir Next", "Segoe UI", Tahoma, sans-serif;
    background: radial-gradient(circle at top right, #5eead4 0%, #0f766e 45%, #0b3d39 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: min(94vw, 1040px);
    max-width: 1040px;
    padding: clamp(20px, 2.8vw, 44px);
    text-align: center;
}

.logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.logo {
    width: 84px;
    height: 84px;
    object-fit: contain;
}

h1 {
    color: #0f172a;
    margin-bottom: 8px;
    font-size: 2.8em;
    letter-spacing: 0.02em;
}

.brand {
    color: #0f766e;
    font-size: 0.92em;
    margin-bottom: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.subtitle {
    color: #64748b;
    font-size: 0.88em;
    line-height: 1.6;
    margin-top: 16px;
    margin-bottom: 4px;
    font-weight: 400;
}

.links {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.links a {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.links a:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(15, 118, 110, 0.35);
}

.search-box {
    margin: 30px 0;
    position: relative;
}

.search-box input {
    padding: 12px;
    width: 100%;
    border: 2px solid #14b8a6;
    border-radius: 8px;
    font-size: 1em;
    margin-bottom: 10px;
}

.options-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid #99f6e4;
    border-radius: 8px;
    background: #f0fdfa;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.options-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.options-label {
    color: #0f172a;
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
}

.context-toggles {
    display: flex;
    gap: 16px;
    align-items: center;
}

.context-toggle-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.context-toggle-label {
    color: #0f172a;
    font-size: 0.85em;
    font-weight: 500;
    white-space: nowrap;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex: 0 0 auto;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 26px;
    transition: background 0.2s ease;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .slider {
    background: #0f766e;
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
}

.search-box button {
    margin-top: 10px;
    padding: 12px 24px;
    background: #0f766e;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.search-box button:hover {
    background: #0d5f59;
}

.search-box button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#result {
    margin-top: 20px;
    display: none;
}

.result-feed {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0;
    max-height: min(82vh, 740px);
    overflow-y: auto;
}

.result-skipped-note {
    margin-top: 10px;
    color: #64748b;
    font-size: 0.78em;
    line-height: 1.5;
    text-align: left;
}

@media (max-width: 600px) {
    .result-feed {
        grid-template-columns: repeat(2, 1fr);
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

.feed-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    animation: fadeIn 0.35s ease;
}

.image-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    text-decoration: none;
    /* Space-themed tile visible through transparent no-data areas */
    background:
        radial-gradient(circle, rgba(94,234,212,0.12) 1px, transparent 1px),
        linear-gradient(145deg, #0b2337 0%, #0f2d3d 45%, #0b1a2e 100%);
    background-size: 20px 20px, 100% 100%;
}

.feed-image {
    cursor: zoom-in;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    display: block;
    transition: transform 0.2s, box-shadow 0.2s;
}

.image-link:hover .feed-image {
    transform: scale(1.03);
    box-shadow: 0 8px 28px rgba(15, 118, 110, 0.35);
}

.feed-info {
    color: #475569;
    font-size: 0.78em;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

.metadata-details {
    position: relative;
    text-align: left;
}

.metadata-details summary {
    cursor: pointer;
    list-style: none;
    display: block;
}

.metadata-details summary::-webkit-details-marker {
    display: none;
}

.feed-info-summary {
    color: #475569;
    transition: color 0.2s ease;
}

.metadata-details[open] .feed-info-summary {
    color: #0f766e;
}

.metadata-popup {
    position: fixed;
    left: -9999px;
    top: -9999px;
    width: min(260px, calc(100vw - 16px));
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
    z-index: 100;
}

.metadata-row {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.35;
}

.metadata-row + .metadata-row {
    margin-top: 8px;
}

.metadata-label {
    color: #0f766e;
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.metadata-value {
    color: #0f172a;
    font-size: 0.8em;
    overflow-wrap: anywhere;
}

.error {
    color: #e53935;
    background: #ffebee;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
}

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

.loading {
    color: #0f766e;
    margin-top: 12px;
    display: none;
}

.loading-inner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    border-radius: 24px;
    padding: 8px 18px;
    font-weight: 600;
    font-size: 0.93em;
}

.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid #99f6e4;
    border-top-color: #0f766e;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    flex-shrink: 0;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin: 25px 0;
    text-align: left;
}

.feature {
    padding: 12px;
    background: #f0fdfa;
    border-radius: 8px;
}

.feature h4 {
    color: #0f172a;
    font-size: 0.85em;
    margin-bottom: 4px;
}

.feature p {
    color: #334155;
    font-size: 0.75em;
    line-height: 1.4;
}

.quick-start-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 30px;
    text-align: left;
}

.quick-start {
    min-width: 0;
    background: #ecfeff;
    border-left: 4px solid #0f766e;
    padding: 15px;
    border-radius: 4px;
    text-align: left;
}

.quick-start h3 {
    color: #0f172a;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.quick-start code {
    display: block;
    background: #1e1e1e;
    color: #9cdcfe;
    padding: 12px;
    border-radius: 4px;
    font-size: 0.85em;
    overflow-x: auto;
}

.quick-start p {
    color: #475569;
    margin-bottom: 10px;
    font-size: 0.88em;
}

.mcp-clients {
    margin-top: 12px;
}

.mcp-clients p {
    margin: 6px 0 0;
}

.mcp-clients a {
    color: #0f766e;
}

.mcp-clients code {
    display: inline;
    padding: 2px 4px;
    font-size: 0.92em;
}

@media (max-width: 700px) {
    .quick-start-grid {
        grid-template-columns: 1fr;
    }
}

/* Place disambiguation picker */
.place-picker {
    position: absolute;
    left: 0;
    right: 0;
    top: 52px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #99f6e4;
    border-radius: 8px;
    padding: 8px;
    text-align: left;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.place-picker-label {
    font-size: 0.85em;
    font-weight: 700;
    color: #0f766e;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.place-picker-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.place-picker-btn {
    background: white;
    border: 1px solid #99f6e4;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.88em;
    color: #0f172a;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.35;
}

.place-picker-btn:hover {
    background: #ccfbf1;
    border-color: #0f766e;
}
