/* ═══════════════════════════════════════════════════════════════════
   DeepSearch — light white theme  (Google / Apple aesthetic)
   ═══════════════════════════════════════════════════════════════════ */

/* Critical: ensure element.hidden always works regardless of
   display values set by component rules below.                      */
[hidden] { display: none !important; }

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Google's exact search palette */
    --bg:         #ffffff;
    --surface:    #f8f9fa;
    --surface2:   #f1f3f4;   /* hover / active */
    --border:     #dfe1e5;
    --border-int: #e8eaed;   /* inner dividers */
    --text:       #202124;
    --muted:      #5f6368;
    --url:        #0d652d;   /* Google green for displayed URLs */
    --link:       #1a0dab;   /* classic blue links */
    --primary:    #4285f4;   /* Google blue */
    --primary-h:  #3578e5;
    --error:      #c5221f;
    --mark:       rgba(255, 235, 59, 0.45);

    --pill:   24px;          /* pill radius — landing search box */
    --radius: 8px;
    --font:   'Inter', -apple-system, BlinkMacSystemFont,
              'Segoe UI', Roboto, Arial, sans-serif;

    /* Box shadows */
    --shadow-rest:  0 1px 6px rgba(32,33,36,.12);
    --shadow-focus: 0 2px 14px rgba(32,33,36,.22);
}

html { color-scheme: light; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Brand gradient title ──────────────────────────────────────── */
.brand-title {
    font-weight: 700;
    background: linear-gradient(90deg,
        #4285f4 0%, #ea4335 25%, #fbbc05 50%, #34a853 75%, #4285f4 100%);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: grad 8s linear infinite;
    display: inline-block;
    line-height: 1;
}
@keyframes grad {
    0%   { background-position: 0% 50%; }
    100% { background-position: 250% 50%; }
}
@supports not (background-clip: text) {
    .brand-title { color: #4285f4; background: none; }
}

/* ═══════════════════════════════════════════════════════════════════
   LANDING PAGE
   ═══════════════════════════════════════════════════════════════════ */
.landing {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.landing-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.landing-center {
    width: 100%;
    max-width: 580px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    /* slightly above true center — like Google */
    margin-bottom: 10vh;
}

.landing-brand { text-align: center; }
.landing-brand .brand-title { font-size: clamp(2.6rem, 8vw, 4.5rem); }

.brand-tagline {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--muted);
    letter-spacing: 0.04em;
}

.landing-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* ═══════════════════════════════════════════════════════════════════
   SEARCH BOX  (shared — landing pill style + SERP compact style)
   ═══════════════════════════════════════════════════════════════════ */

/* The wrapper is the positioning anchor for the dropdown */
.search-wrapper {
    position: relative;
    width: 100%;
}

/* LANDING — pill form */
.search-box {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--pill);
    padding: 6px 8px 6px 16px;
    box-shadow: var(--shadow-rest);
    transition: box-shadow 0.2s, border-radius 0.15s, border-color 0.15s;
}

/* When the autocomplete dropdown is open, square the bottom corners
   so the box and dropdown look like one connected unit (Google style) */
.search-wrapper.ac-open .search-box {
    border-radius: var(--pill) var(--pill) 0 0;
    border-bottom-color: var(--border-int);
    box-shadow: var(--shadow-focus);
}

.search-box:focus-within:not(.search-wrapper.ac-open .search-box) {
    box-shadow: var(--shadow-focus);
    border-color: rgba(223,225,229,0);
}

.search-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    stroke: var(--muted);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    padding: 8px 6px;
    outline: none;
    min-width: 0;
}
.search-box input::placeholder { color: var(--muted); }

.clear-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    color: var(--muted);
    transition: color 0.15s, background 0.15s;
}
.clear-btn:hover { color: var(--text); background: var(--surface2); }
.clear-btn svg {
    width: 15px; height: 15px;
    stroke: currentColor; fill: none;
    stroke-width: 2.2; stroke-linecap: round;
}

.search-btn {
    flex-shrink: 0;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 20px;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.search-btn:hover { background: var(--primary-h); }

/* ── Autocomplete dropdown ───────────────────────────────────────── */
.ac-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-top: 1px solid var(--border-int);
    border-radius: 0 0 var(--pill) var(--pill);
    box-shadow: var(--shadow-focus);
    z-index: 900;
    overflow: hidden;
}

.ac-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-int);
    transition: background 0.08s;
    user-select: none;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.active { background: var(--surface2); }

.ac-icon {
    flex-shrink: 0;
    width: 16px; height: 16px;
    stroke: var(--muted); fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ac-text {
    flex: 1;
    font-size: 0.9375rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ac-arrow {
    flex-shrink: 0;
    width: 13px; height: 13px;
    stroke: var(--muted); fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    opacity: 0;
    transition: opacity 0.1s;
}
.ac-item:hover .ac-arrow,
.ac-item.active .ac-arrow { opacity: 0.6; }

/* ── Did You Mean hint ──────────────────────────────────────────── */
.dym-hint {
    margin-top: 10px;
    font-size: 0.875rem;
    color: var(--muted);
    padding-left: 6px;
}
.dym-hint .dym-link { color: var(--link); font-weight: 500; }
.dym-hint .dym-link:hover { text-decoration: underline; }
.dym-sub { font-size: .9em; margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════════════
   SERP HEADER
   ═══════════════════════════════════════════════════════════════════ */
.serp-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.serp-header-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.serp-logo { text-decoration: none; }
.serp-logo:hover { text-decoration: none; }

.serp-brand {
    font-size: 1.4rem;
    letter-spacing: -0.04em;
    white-space: nowrap;
}

.serp-search-wrapper { flex: 1; min-width: 0; }

.serp-search-box {
    border-radius: var(--radius);
    padding: 4px 8px 4px 12px;
}
.serp-search-box input { font-size: 0.9375rem; padding: 6px 4px; }
.search-wrapper.ac-open .serp-search-box {
    border-radius: var(--radius) var(--radius) 0 0;
}
.serp-search-wrapper .ac-dropdown {
    border-radius: 0 0 var(--radius) var(--radius);
}
.serp-search-box .search-btn {
    border-radius: var(--radius);
    padding: 6px 16px;
    font-size: 0.85rem;
}

.serp-tabs {
    display: flex;
    padding: 0 20px;
    max-width: 1000px;
    margin: 0 auto;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 0;
}
.serp-tabs::-webkit-scrollbar { display: none; }

.serp-tab {
    display: inline-flex;
    align-items: center;
    padding: 11px 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: color 0.12s, border-color 0.12s;
}
.serp-tab:hover { color: var(--text); text-decoration: none; }
.serp-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.serp-tab.is-soon { opacity: 0.4; pointer-events: none; cursor: default; }

/* ═══════════════════════════════════════════════════════════════════
   SERP CONTENT
   ═══════════════════════════════════════════════════════════════════ */
.serp-main {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 20px 4rem;
    width: 100%;
    /* Transition width smoothly when the knowledge panel appears */
    transition: max-width 0.2s ease;
}

/* JS adds this class when a knowledge panel is present */
.serp-main.has-panel {
    max-width: 1080px;
}

.serp-dym { margin-bottom: 10px; }

.results-meta {
    font-size: 0.8125rem;
    color: var(--muted);
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ── Result item ─────────────────────────────────────────────────── */
.result-item {
    padding: 18px 0;
    border-bottom: 1px solid var(--border-int);
}
.result-item:last-child { border-bottom: none; }

.result-thumb {
    float: right;
    width: 92px;
    height: 68px;
    margin: 2px 0 10px 18px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
}
.result-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.result-url {
    font-size: 0.8rem;
    color: var(--url);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-title {
    display: block;
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--link);
    margin-bottom: 6px;
    line-height: 1.4;
}
.result-title:hover { text-decoration: underline; }

.result-snippet {
    display: -webkit-box;
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.58;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


.result-snippet mark {
    background: var(--mark);
    color: var(--text);
    border-radius: 2px;
    padding: 0 2px;
    font-style: normal;
}

.result-score {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--muted);
    background: var(--surface);
    padding: 1px 8px;
    border-radius: 99px;
    border: 1px solid var(--border);
}

.view-images-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--primary);
    cursor: pointer;
}
.view-images-link:hover { text-decoration: underline; }
.result-item::after { content: ''; display: table; clear: both; }

/* ── Pagination ──────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}
.page-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 20px;
    border-radius: 20px;
    font-family: var(--font);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.page-btn:hover:not(:disabled) { background: var(--surface2); border-color: var(--primary); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-indicator { font-size: 0.8rem; color: var(--muted); }

/* ── Loading ─────────────────────────────────────────────────────── */
.loading {
    text-align: center;
    padding: 3rem 0;
    color: var(--muted);
    font-size: 0.875rem;
}
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 0.75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error ───────────────────────────────────────────────────────── */
.error-box {
    background: #fce8e6;
    border: 1px solid #f5c6c2;
    color: var(--error);
    padding: 14px 18px;
    border-radius: var(--radius);
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.error-text { flex: 1; font-size: 0.9rem; }
.retry-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 7px 16px;
    border-radius: 20px;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s;
}
.retry-btn:hover { background: var(--primary-h); }

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 0;
    color: var(--muted);
}
.empty-icon {
    display: inline-flex;
    opacity: 0.2;
    margin-bottom: 1rem;
}
.empty-icon svg {
    width: 52px; height: 52px;
    stroke: var(--text); fill: none;
    stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.empty-hint { font-size: 0.875rem; }

/* ── SERP footer ─────────────────────────────────────────────────── */
.serp-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.75rem;
    color: var(--muted);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
    .landing-center { margin-bottom: 5vh; }
    .landing-brand .brand-title { font-size: 2.4rem; }
    .search-btn { padding: 8px 14px; font-size: 0.85rem; }
    .serp-header-inner { padding: 8px 12px; gap: 8px; }
    .serp-brand { font-size: 1.1rem; }
    .serp-tabs { padding: 0 12px; }
    .serp-main { padding: 14px 14px 3rem; }
    .result-thumb { width: 70px; height: 54px; margin-left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .brand-title { animation: none; }
    .spinner { animation-duration: 2s; }
}

/* ═══════════════════════════════════════════════════════════════════
   Fix 1: Two-pane SERP layout + Knowledge / entity panel
   ═══════════════════════════════════════════════════════════════════ */

/* Flex container: results pane left, knowledge panel right.
   Without the panel the single pane fills the same 720 px as before. */
.serp-layout {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

/* Left pane: grows to fill remaining space, never overflows */
.serp-content {
    flex: 1;
    min-width: 0;
}

/* ── Knowledge / entity panel sidebar ───────────────────────────── */
.knowledge-panel {
    width: 288px;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.15rem 1rem;
    box-shadow: var(--shadow-rest);
    animation: kp-in 0.18s ease-out;
}

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

/* Entity name */
.kp-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 2px;
}

/* Entity type (City, Person…) */
.kp-subtitle {
    font-size: 0.74rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.65rem;
}

/* Short description */
.kp-description {
    font-size: 0.84rem;
    color: var(--muted);
    line-height: 1.55;
    margin-bottom: 0.8rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* Key facts table */
.kp-facts {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.6rem;
    font-size: 0.84rem;
}
.kp-facts tr { border-bottom: 1px solid var(--border-int); }
.kp-facts tr:last-child { border-bottom: none; }

.kp-fact-label {
    color: var(--muted);
    padding: 0.33rem 0.5rem 0.33rem 0;
    white-space: nowrap;
    width: 42%;
    vertical-align: top;
    font-size: 0.79rem;
}
.kp-fact-value {
    color: var(--text);
    padding: 0.33rem 0;
    font-weight: 500;
}

/* Aliases */
.kp-aliases {
    font-size: 0.76rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    padding-top: 0.55rem;
    margin-top: 0.35rem;
    line-height: 1.55;
}
.kp-alias { font-style: italic; }

/* Source link */
.kp-source {
    display: inline-block;
    margin-top: 0.6rem;
    font-size: 0.77rem;
    color: var(--primary);
    text-decoration: none;
}
.kp-source:hover { text-decoration: underline; }

/* Confidence (subtle, transparency-oriented) */
.kp-confidence {
    font-size: 0.69rem;
    color: var(--muted);
    margin-top: 0.5rem;
    text-align: right;
    opacity: 0.65;
}

/* Mobile: stack vertically, panel above results */
@media (max-width: 860px) {
    .serp-layout { flex-direction: column; }
    .knowledge-panel {
        width: 100%;
        order: -1;   /* panel above results on narrow screens */
    }
    /* Restore the normal max-width on narrow screens */
    .serp-main.has-panel { max-width: 720px; }
}

/* ── Image Search Grid ──────────────────────────────────────────── */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    padding: 4px 0 16px;
}
.image-card {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    text-decoration: none;
    transition: box-shadow .15s, transform .15s;
}
.image-card:hover {
    box-shadow: var(--shadow-focus);
    transform: translateY(-2px);
    text-decoration: none;
}
.image-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    background: var(--surface2);
}
.image-caption {
    padding: 6px 8px;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-top: 1px solid var(--border-int);
}
/* ── Shopping Search Grid ───────────────────────────────────────── */
/*    Mirrors .image-grid / .image-card — same variable names,       */
/*    same column floor (180px), same gap, same hover lift.          */
/*    Added: body section with name / brand / rating / price.        */
.shopping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    padding: 4px 0 16px;
}
.shopping-card {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    text-decoration: none;
    transition: box-shadow .15s, transform .15s;
    cursor: pointer;
}
.shopping-card:hover {
    box-shadow: var(--shadow-focus);
    transform: translateY(-2px);
}
/* Sponsored variant — primary-blue accent border */
.shopping-card--sponsored {
    border-color: var(--primary);
    border-width: 2px;
}
/* Thumbnail — same height as .image-card img */
.shopping-thumb {
    width: 100%;
    height: 150px;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border-int);
}
.shopping-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
    display: block;
}
/* Body */
.shopping-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 10px 10px;
    flex: 1;
}
/* Sponsored badge */
.shopping-sponsored {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .04em;
}
/* Product name — 2-line clamp */
.shopping-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* Brand */
.shopping-brand {
    font-size: 11px;
    color: var(--muted);
}
/* Star rating + count */
.shopping-rating {
    font-size: 11px;
    color: var(--muted);
}
/* Price — pushed to the bottom with auto top-margin */
.shopping-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-top: auto;
    padding-top: 5px;
}



/* ============================================================
   Phase 40.5 — Video Search vertical styles
   Append to the bottom of style.css
   ============================================================ */

/* ── Video result grid ─────────────────────────────────────── */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 4px 0 20px;
}

/* ── Video card ─────────────────────────────────────────────── */
.video-card {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    overflow: hidden;
    transition: box-shadow .15s, transform .15s;
}
.video-card:hover {
    box-shadow: var(--shadow-focus);
    transform: translateY(-2px);
}

/* ── Thumbnail wrapper ──────────────────────────────────────── */
.video-thumb-wrap {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    background: var(--surface2);
    overflow: hidden;
    text-decoration: none;
}
.video-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.video-thumb-missing {
    /* fallback grey box when no thumbnail */
    background: var(--surface2);
}
.video-thumb-wrap::after {
    /* subtle dark gradient at bottom for badge legibility */
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 40%;
    background: linear-gradient(transparent, rgba(0,0,0,.55));
    pointer-events: none;
}

/* ── Play-button overlay ─────────────────────────────────────── */
.video-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    color: rgba(255,255,255,.90);
    text-shadow: 0 2px 8px rgba(0,0,0,.6);
    opacity: 0;
    transition: opacity .15s;
    pointer-events: none;
}
.video-thumb-wrap:hover .video-play-btn { opacity: 1; }

/* ── Duration badge ──────────────────────────────────────────── */
.video-duration {
    position: absolute;
    bottom: 6px;
    right: 7px;
    background: rgba(0,0,0,.80);
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    padding: 1px 5px;
    border-radius: 3px;
    z-index: 1;
}

/* ── Info section ────────────────────────────────────────────── */
.video-info {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.video-title {
    font-size: .95rem;
    font-weight: 500;
    color: var(--link);
    line-height: 1.35;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.video-title:hover { text-decoration: underline; }

.video-meta {
    font-size: .76rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Moment jump link (deep link to the matched second) ─────── */
.video-moment-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--primary, #1a73e8);
    text-decoration: none;
    background: color-mix(in srgb, var(--primary, #1a73e8) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary, #1a73e8) 30%, transparent);
    border-radius: 99px;
    padding: 2px 9px;
    width: fit-content;
    margin-top: 2px;
    transition: background .12s;
}
.video-moment-link:hover {
    background: color-mix(in srgb, var(--primary, #1a73e8) 18%, transparent);
    text-decoration: none;
}

/* fallback for browsers without color-mix */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
    .video-moment-link {
        background: rgba(26,115,232,.10);
        border-color: rgba(26,115,232,.30);
    }
    .video-moment-link:hover { background: rgba(26,115,232,.18); }
}

.video-snippet {
    font-size: .80rem;
    color: var(--muted);
    line-height: 1.50;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-style: italic;
}

/* ── Mobile: collapse to 1 column ───────────────────────────── */
@media (max-width: 600px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
}

.result-site-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.result-site-name {
    font-size: 14px;
    line-height: 1.3;
    color: var(--text-secondary, #4d5156);
}
.result-favicon {
    border-radius: 50%;
    flex: 0 0 16px;
}
/* Letter badge shown when a site's icon cannot be loaded (replaces the hidden <img>) */
.result-favicon--letter {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; flex: 0 0 16px;
    font-size: 10px; font-weight: 700; line-height: 1; color: #fff;
    background: var(--muted, #70757a);      /* overridden per site by JS (hsl colour) */
    border-radius: 50%;
}

.result-url-row {
    margin-top: 2px;
}
.result-url {
    font-size: 12px;
    color: var(--text-tertiary, #70757a);
}



/* ── Align results with the "All" tab ───────────────────────────────
   Header + tabs use a 1000px container with 20px side padding, and each
   tab has 16px of inner padding, so "All" text starts 36px in.
   Use the same container for the results and inset by the same 36px. */
.serp-main,
.serp-main.has-panel {
    max-width: 1000px;
    padding-left: 36px;
}

/* Keep the reading column at a comfortable width (left-aligned) */
.serp-content { max-width: 720px; }

/* With a knowledge panel, let the column shrink instead of widening the page */
.serp-main.has-panel .serp-content { max-width: none; }

@media (max-width: 860px) {
    .serp-main.has-panel { max-width: 1000px; }
}

/* Phones: header/tabs padding is smaller, so match it */
@media (max-width: 600px) {
    .serp-tabs { padding: 0; }
    .serp-main,
    .serp-main.has-panel { padding-left: 16px; }
}

/* AI Mode tab + the optional link on the All tab */
.serp-tab--ai { letter-spacing: .01em; }
.serp-tab--ai.is-active { color: var(--link, #1a73e8); }

.ab-promo {
    display: inline-flex; align-items: center; gap: 8px;
    margin: 0 0 14px; padding: 7px 14px; border-radius: 999px;
    border: 1px solid var(--border, #e0e0e0); background: var(--surface2, #f6f8fa);
    color: var(--text-secondary, #4d5156); font-size: .85rem; text-decoration: none;
    transition: background .15s, box-shadow .15s;
}
.ab-promo:hover { background: var(--surface, #fff); box-shadow: 0 1px 4px rgba(0,0,0,.12); text-decoration: none; }
.ab-promo-icon { color: var(--link, #1a73e8); }



/* ── News: freshness filter ─────────────────────────────────────── */
.news-filters { display: flex; align-items: center; gap: 8px; padding: 8px 0 0; max-width: 720px; }

.news-filter-label { font-size: 13px; color: var(--muted); }
.freshness-select {
    font: 13px var(--font); color: var(--text);
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--pill); padding: 6px 14px; cursor: pointer;
}
.freshness-select:hover { background: var(--surface2); }
.freshness-select:focus { outline: none; box-shadow: var(--shadow-focus); }

/* ── News: clickable card ───────────────────────────────────────── */
.news-card {
    display: flex; gap: 14px; padding: 14px 0;
    border-bottom: 1px solid var(--border-int);
    color: inherit; text-decoration: none;
}
.news-card:hover { text-decoration: none; }
.news-card:hover .news-card-title { text-decoration: underline; }
.news-card-media {
    flex: 0 0 168px; height: 112px; border-radius: var(--radius);
    overflow: hidden; background: var(--surface2);
}
.news-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-card-media--empty { display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: 600; color: var(--muted); }
.news-card-body { min-width: 0; flex: 1; }

.news-card-title { font-size: 18px; line-height: 1.3; color: var(--link); margin-bottom: 4px; }
.news-card-snippet {
    font-size: 14px; line-height: 1.5; color: var(--text);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.news-card-src {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-secondary, #4d5156);
    margin-bottom: 4px;
}
.news-card-src .result-favicon { flex: 0 0 16px; border-radius: 50%; }
.news-card-site { color: var(--text-secondary, #4d5156); }
.news-card-time { color: var(--text-tertiary, #70757a); font-size: 12px; }
@media (max-width: 600px) {
    .news-card-media { flex-basis: 96px; height: 76px; }
    .news-card-title { font-size: 16px; }
}

.news-more-btn {
    display: block; margin: 20px auto 8px;
    padding: 10px 28px; font: 500 14px var(--font); color: var(--text);
    background: 	#B2BEB5; border: 1px solid var(--border);
    border-radius: var(--pill); cursor: pointer;
    transition: background .15s, box-shadow .15s;
    width: 100%;
}
.news-more-btn:hover { background: var(--surface2); box-shadow: var(--shadow-rest); }
.news-more-btn[hidden] { display: none; }


/* ═══ Images tab: full-width layout ═══ */
.serp-main.is-images,
.serp-main.is-images.has-panel { max-width: none; padding-left: 20px; padding-right: 20px; }
.serp-main.is-images .serp-content { max-width: none; }
.serp-main.is-images .results-meta { display: none; }

/* Justified rows: equal height, tiles stretch to fill the row.
   --row-h ~ 1/6 of the width => about 4 per row (3 when images are wide). */
.img-grid {
    --row-h: clamp(110px, 17vw, 320px);
    display: flex; flex-wrap: wrap; gap: 8px;
}
.img-grid::after { content: ''; flex-grow: 100; }   /* keeps the last row from over-stretching */

.img-tile {
    position: relative; display: block; overflow: hidden;
    height: var(--row-h); min-width: 0;
    flex-grow: var(--r, 1.4); flex-shrink: 1;
    flex-basis: calc(var(--r, 1.4) * var(--row-h));
    border-radius: 8px; background: var(--surface2);
    cursor: zoom-in;
}
.img-tile img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform .25s ease;
}
.img-tile:hover img { transform: scale(1.04); }
.img-tile-cap {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 24px 10px 7px; color: #fff; font-size: 12px;
    background: linear-gradient(transparent, rgba(0,0,0,.7));
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    opacity: 0; transition: opacity .15s;
}
.img-tile:hover .img-tile-cap, .img-tile:focus-visible .img-tile-cap { opacity: 1; }
@media (hover: none) { .img-tile-cap { opacity: 1; } }
.img-sentinel { height: 1px; }

@media (max-width: 900px) { .img-grid { --row-h: clamp(90px, 22vw, 240px); } }
@media (max-width: 600px) { .img-grid { --row-h: 34vw; gap: 4px; } .serp-main.is-images { padding-left: 8px; padding-right: 8px; } }

/* ═══ Image viewer ═══ */
body.iv-open { overflow: hidden; }
.iv { position: fixed; inset: 0; z-index: 1000; display: flex; }
.iv[hidden] { display: none; }
.iv-backdrop { position: absolute; inset: 0; background: rgba(12,12,16,.94); opacity: 0; transition: opacity .2s; }
.iv.is-in .iv-backdrop { opacity: 1; }

.iv-body {
    position: relative; display: flex; width: 100%; height: 100%;
    padding: 24px 24px 24px 16px; gap: 24px; pointer-events: none;
}
.iv-stage {
    position: relative; flex: 1; min-width: 0; height: 100%;
    display: flex; align-items: center; justify-content: center;
    pointer-events: auto;
}
.iv-img {
    max-width: 100%; max-height: 100%; object-fit: contain;
    border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.5);
    transition: opacity .2s;
}
.iv-img.is-loading { opacity: .75; }

.iv-side { flex: 0 0 300px; align-self: center; color: #fff; pointer-events: auto; }
.iv-count { font-size: 12px; opacity: .6; margin-bottom: 8px; }
.iv-title { font-size: 18px; font-weight: 500; line-height: 1.35; margin: 0 0 8px; word-break: break-word; }
.iv-site  { font-size: 13px; opacity: .75; margin-bottom: 4px; word-break: break-all; }
.iv-dims  { font-size: 12px; opacity: .55; margin-bottom: 18px; min-height: 1em; }
.iv-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.iv-act {
    padding: 9px 18px; border-radius: 999px; font-size: 13px; font-weight: 500;
    color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.35);
    transition: background .15s;
}
.iv-act:hover { background: rgba(255,255,255,.14); text-decoration: none; }
.iv-visit { background: var(--primary, #1a73e8); border-color: transparent; }
.iv-visit:hover { background: var(--primary, #1a73e8); filter: brightness(1.12); }

.iv-btn {
    position: absolute; z-index: 2; width: 42px; height: 42px; border: 0; border-radius: 50%;
    background: rgba(255,255,255,.12); color: #fff; font-size: 26px; line-height: 1;
    cursor: pointer; pointer-events: auto; transition: background .15s;
}
.iv-btn:hover { background: rgba(255,255,255,.26); }
.iv-close { top: 14px; right: 16px; font-size: 28px; }
.iv-nav   { top: 50%; transform: translateY(-50%); }
.iv-prev  { left: 4px; }
.iv-next  { right: 4px; }

@media (max-width: 800px) {
    .iv-body { flex-direction: column; padding: 56px 8px 12px; gap: 10px; }
    .iv-stage { flex: 1 1 auto; height: auto; min-height: 0; }
    .iv-side  { flex: 0 0 auto; align-self: stretch; }
    .iv-title { font-size: 15px; }
}


/* ═══ Videos: grid ═══ */
.vgrid {
    display: grid; gap: 22px 16px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.vcard { min-width: 0; }
.vcard-thumb {
    position: relative; display: block; aspect-ratio: 16 / 9;
    border-radius: 10px; overflow: hidden; background: var(--surface2);
}
.vcard-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.vcard-thumb:hover img { transform: scale(1.04); }
.vcard-thumb--missing { background: linear-gradient(135deg, #2b2f38, #4a5060); }
.vcard-play {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.85);
    width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.62); color: #fff; font-size: 18px; padding-left: 3px;
    opacity: 0; transition: opacity .15s, transform .15s;
}
.vcard-thumb:hover .vcard-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.vcard-dur {
    position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px;
    background: rgba(0,0,0,.8); color: #fff; font-size: 12px; font-weight: 500;
}
.vcard-title {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    margin-top: 8px; font-size: 15px; line-height: 1.35; color: var(--text); text-decoration: none;
}
.vcard-title:hover { color: var(--link); text-decoration: underline; }
.vcard-meta { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 600px) { .vgrid { grid-template-columns: 1fr 1fr; gap: 16px 10px; } .vcard-title { font-size: 13px; } }

/* ═══ Video player (reuses .iv backdrop/buttons) ═══ */
.vp .iv-body { align-items: center; gap: 28px; padding: 56px 28px 24px; }
.vp-main { flex: 1; min-width: 0; pointer-events: auto; color: #fff; }
.vp-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 68vh; background: #000; border-radius: 10px; overflow: hidden; }
.vp-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vp-title { margin: 14px 0 6px; }
.vp-meta { margin-bottom: 12px; }
.vp-side { flex: 0 0 300px; max-height: 100%; overflow-y: auto; pointer-events: auto; color: #fff; align-self: flex-start; }
.vp-side-h { font-size: 13px; opacity: .65; margin-bottom: 10px; }
.vp-row { display: flex; gap: 10px; margin-bottom: 12px; color: #fff; text-decoration: none; font-size: 13px; line-height: 1.35; }
.vp-row:hover span { text-decoration: underline; }
.vp-row img { flex: 0 0 120px; width: 120px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; background: #222; }
@media (max-width: 900px) {
    .vp .iv-body { flex-direction: column; align-items: stretch; padding: 52px 12px 12px; overflow-y: auto; pointer-events: auto; }
    .vp-side { flex: 0 0 auto; max-height: none; align-self: stretch; }
}

/* ═══ Local tab: list + map ═══════════════════════════════════════════════ */

/* ---- layout: list left, sticky map right ---- */
.serp-main.is-local,
.serp-main.is-local.has-panel { max-width: none; padding-left: 20px; padding-right: 20px; }
.serp-main.is-local .serp-layout { gap: 24px; }
.serp-main.is-local .serp-content { flex: 0 0 min(580px, 46vw); max-width: 580px; }

.local-map { display: none; }
.serp-main.is-local .local-map {
    display: block; flex: 1; min-width: 0;
    position: sticky; top: calc(var(--hdr-h, 108px) + 14px);
    height: calc(100vh - var(--hdr-h, 108px) - 30px); min-height: 380px;
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
    box-shadow: var(--shadow-rest);
    isolation: isolate; z-index: 1;            /* keep Leaflet's z-indexes below the sticky header */
}
/* nothing to plot (no coordinates) or Leaflet could not load: back to a single column */
.serp-main.is-local.local-nomap .local-map { display: none; }
.serp-main.is-local.local-nomap .serp-content { flex: 1; max-width: 720px; }
.serp-main.is-local.local-nomap { max-width: 760px; }

.serp-main.is-local .knowledge-panel { display: none !important; }

/* ---- filter chips ---- */
.local-toolbar { display: none; }
.serp-main.is-local .local-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 6px;
}
.local-chip {
    padding: 7px 16px; font: 500 13px var(--font); color: var(--text); cursor: pointer;
    background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
    transition: background .15s, border-color .15s, color .15s;
}
.local-chip:hover { background: var(--surface2); }
.local-chip.active { color: var(--primary); border-color: var(--primary); background: #e8f0fe; }
.local-note { font-size: 12.5px; color: var(--muted); }

/* ---- cards ---- */
.loc-card {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px;
    padding: 16px 12px; margin: 0 -12px;
    border-bottom: 1px solid var(--border-int);
    border-radius: 8px; transition: background .15s;
}
.serp-main:not(.is-local) .loc-card { margin: 0; padding-left: 0; padding-right: 0; }
.serp-main.is-local .loc-card { cursor: pointer; }
.serp-main.is-local .loc-card:hover    { background: var(--surface); }
.serp-main.is-local .loc-card.selected { background: var(--surface2); box-shadow: inset 3px 0 0 var(--primary); }
.loc-main { min-width: 0; }
.loc-site {
    display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
    font-size: 13px; color: var(--muted);
}
.loc-num {
    flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff; background: var(--primary);
}
.loc-card.selected .loc-num { background: #d93025; }
.loc-site .result-favicon { flex: 0 0 16px; border-radius: 50%; }
.loc-title {
    display: inline-block; font-size: 19px; line-height: 1.3; color: var(--link);
    text-decoration: none; word-break: break-word;
}
.loc-title:hover { text-decoration: underline; }
.loc-meta {
    display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 4px;
    font-size: 13px; color: var(--muted);
}
.loc-open   { color: #188038; font-weight: 600; }
.loc-closed { color: var(--error); font-weight: 600; }
.loc-line   { margin-top: 4px; font-size: 13.5px; color: var(--text); }
.loc-snippet {
    margin-top: 6px; font-size: 14px; line-height: 1.5; color: var(--muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.loc-media {
    display: block; width: 112px; height: 112px; border-radius: var(--radius);
    overflow: hidden; background: var(--surface2); align-self: start;
}
.loc-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.loc-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.loc-act {
    padding: 6px 16px; font-size: 13px; color: var(--primary); text-decoration: none;
    background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
    transition: background .15s, border-color .15s;
}
.loc-act:hover { background: #e8f0fe; border-color: var(--primary); text-decoration: none; }
.loc-empty { padding: 28px 4px; color: var(--muted); font-size: 14px; }
.loc-empty a { color: var(--primary); }

/* ---- map pins (Leaflet divIcon): numbered teardrop like the mock-up ---- */
.lm-pin-wrap { background: transparent !important; border: 0 !important; }
.lm-pin {
    display: block; width: 30px; height: 30px; background: var(--primary);
    border: 3px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
    box-shadow: 0 2px 5px rgba(0,0,0,.35); transition: background .12s;
}
.lm-pin b { display: block; transform: rotate(45deg); color: #fff; font: 700 12px/24px var(--font); text-align: center; }
.lm-pin.sel { background: #d93025; }

/* ---- narrow screens: map on top, list below ---- */
@media (max-width: 860px) {
    .serp-main.is-local .serp-layout { flex-direction: column; }
    .serp-main.is-local .serp-content { flex: 1; max-width: none; width: 100%; }
    .serp-main.is-local .local-map {
        order: -1; position: relative; top: 0; width: 100%;
        height: 240px; min-height: 240px;
    }
}
@media (max-width: 600px) {
    .serp-main.is-local { padding-left: 12px; padding-right: 12px; }
    .loc-media { width: 84px; height: 84px; }
    .loc-title { font-size: 17px; }
}

/* ═══ Shopping tab: product grid ═══════════════════════════════════════════
   (uses the full-width layout switched on by setImagesMode, like Images/Videos) */
.sp-grid {
    display: grid; gap: 20px 16px;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.sp-card {
    display: flex; flex-direction: column; gap: 6px; min-width: 0;
    padding: 10px; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 12px; text-decoration: none;
    transition: box-shadow .15s, border-color .15s;
}
a.sp-card:hover { box-shadow: var(--shadow-focus); border-color: transparent; text-decoration: none; }
.sp-media {
    display: flex; align-items: center; justify-content: center;
    aspect-ratio: 1 / 1; overflow: hidden; border-radius: 8px; background: #fff;
}
.sp-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sp-media--empty { background: var(--surface2); color: var(--muted); font-size: 12px; }
.sp-price { font-size: 18px; font-weight: 600; line-height: 1.2; }
.sp-title {
    font-size: 14px; line-height: 1.35; color: var(--link); word-break: break-word;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
a.sp-card:hover .sp-title { text-decoration: underline; }
.sp-store { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-sponsored {
    align-self: flex-start; padding: 0 6px; font-size: 11px; color: var(--muted);
    border: 1px solid var(--border); border-radius: 4px;
}
@media (max-width: 600px) {
    .sp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
    .sp-price { font-size: 16px; }
}

