/* Roboto self-hosted (Latin only, 400/500/700 — weight 300 & latin-ext tidak dipakai) */

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../../fonts/google/CWB0XYA8bzo0kSThX0UTuA.woff2') format('woff2');
}
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../../fonts/google/RxZJdnzeo3R5zSexge8UUVtXRa8TVwTICgirnJhmVJw.woff2') format('woff2');
}
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../../fonts/google/d-6IYplOFocCacKzxwXSOFtXRa8TVwTICgirnJhmVJw.woff2') format('woff2');
}
:root {
    --color-bg:              #FFFFFF;
    --color-surface:         #F8F9FA;
    --color-text:            #1F1F1F;
    --color-text-secondary:  #5F6368;
    --color-primary:         #1A73E8;
    --color-primary-dark:    #1557B0;
    --color-primary-light:   #E8F0FE;
    --color-ai:              #34A853;
    --color-ai-light:        #E6F4EA;
    --color-border:          #DADCE0;
    --color-success:         #34A853;
    --color-warning:         #F9AB00;
    --color-error:           #EA4335;
    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:   16px;
    --radius-full: 24px;
    --shadow-1: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-2: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-3: 0 8px 24px rgba(0,0,0,0.16);
    --font-mono: 'Cascadia Mono', Consolas, 'Courier New', monospace;
}

[data-theme="dark"] {
    --color-bg:              #202124;
    --color-surface:         #303134;
    --color-text:            #E8EAED;
    --color-text-secondary:  #9AA0A6;
    --color-primary:         #8AB4F8;
    --color-primary-dark:    #AECBFA;
    --color-primary-light:   #1A3A5C;
    --color-ai:              #81C995;
    --color-ai-light:        #1A3A2C;
    --color-border:          #3C4043;
}* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a, button, [role="button"], input[type="submit"] {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.font-mono { font-family: var(--font-mono) !important; }.theme-toggle {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--color-text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    flex-shrink: 0;
}
.theme-toggle:hover { background: var(--color-surface); color: var(--color-text); border-color: var(--color-primary); }
.search-page .theme-toggle {
    position: fixed;
    top: 0.9rem;
    right: 1rem;
    z-index: 100;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.32);
    color: #fff;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.search-page .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
}
.serp-header .theme-toggle { margin-left: auto; }

/* Mode Toggle (legacy, no longer used on search home) */

/* Autocomplete */
.autocomplete-wrapper { position: relative; }
.autocomplete-dropdown {
    position: absolute;
    top: 4px;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-2);
    z-index: 200;
    max-height: 350px;
    overflow-y: auto;
}
.autocomplete-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text);
    font-size: 0.9375rem;
}
.autocomplete-item:hover, .autocomplete-item.active { background: var(--color-primary-light); }
.autocomplete-item .query-text { font-weight: 500; }

@media (max-width: 768px) {
    .search-page .theme-toggle {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(8, 10, 28, 0.6);
    }
}/* ---- Android-style app launcher grid ---- */

.app-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.6rem 0.6rem;
    width: 100%;
    max-width: 700px;
    margin: 2.4rem auto 0;
    padding: 0 1rem;
}

.app-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    outline: none;
    min-width: 0;
    animation: tile-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.app-tile:hover { text-decoration: none; }

/* Squircle icon with depth + glassy gloss */
.app-tile-icon {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 27%;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--app-accent, linear-gradient(145deg, #60a5fa, #1e3a8a));
    box-shadow:
        0 12px 26px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -8px 14px rgba(0, 0, 0, 0.2);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease;
}
.app-tile-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 28% 12%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 55%);
    pointer-events: none;
}
.app-tile-icon svg {
    position: relative;
    z-index: 1;
    width: 26px;
    height: 26px;
}
.app-tile-icon img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

/* Premium badge */
.app-tile-badge {
    position: absolute;
    top: -7px;
    right: -9px;
    z-index: 3;
    font-size: 0.48rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #382600;
    background: linear-gradient(135deg, #ffe9a8, #f5b93b 55%, #e09f1f);
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 0.16rem 0.5rem;
    border-radius: 999px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    pointer-events: none;
}
.app-tile.is-premium .app-tile-icon {
    filter: saturate(0.75) brightness(0.92);
}
.app-tile.is-premium:hover .app-tile-icon {
    filter: saturate(0.9) brightness(1);
}
.app-tile.is-premium .app-tile-icon {
    filter: saturate(0.75) brightness(0.92);
}
.app-tile.is-premium:hover .app-tile-icon {
    filter: saturate(0.9) brightness(1);
}

.app-tile:hover .app-tile-icon,
.app-tile:focus-visible .app-tile-icon {
    transform: translateY(-6px) scale(1.06);
    box-shadow:
        0 20px 36px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -8px 14px rgba(0, 0, 0, 0.2);
}
.app-tile:active .app-tile-icon { transform: translateY(-2px) scale(0.98); }
.app-tile:focus-visible { border-radius: 12px; }

/* Frosted label pill */
.app-tile-label {
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.4;
    color: #fff;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(8, 10, 28, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 0.28rem 0.72rem;
    border-radius: 999px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

/* Deep per-app gradients */
.app-drive               { --app-accent: linear-gradient(145deg, #7db8ff, #2563eb); }
.app-absensi-pesantren   { --app-accent: linear-gradient(145deg, #34d399, #047857); }
.app-absensi-sekolah     { --app-accent: linear-gradient(145deg, #2dd4bf, #0f766e); }
.app-ebook               { --app-accent: linear-gradient(145deg, #fb923c, #c2410c); }
.app-piket               { --app-accent: linear-gradient(145deg, #a5b4fc, #4338ca); }
.app-akuntansi-pesantren { --app-accent: linear-gradient(145deg, #fbbf24, #b45309); }
.app-akuntansi-sekolah   { --app-accent: linear-gradient(145deg, #94a3b8, #334155); }
.app-inventaris          { --app-accent: linear-gradient(145deg, #c084fc, #7e22ce); }
.app-inventory           { --app-accent: linear-gradient(145deg, #f472b6, #be185d); }
.app-produktivitas       { --app-accent: linear-gradient(145deg, #a3e635, #4d7c0f); }
.app-elfantube            { --app-accent: linear-gradient(145deg, #f87171, #b91c1c); }
.app-elfanmp3             { --app-accent: linear-gradient(145deg, #fbbf24, #d97706); }
.app-artikel              { --app-accent: linear-gradient(145deg, #22d3ee, #0e7490); }
.app-chat                 { --app-accent: linear-gradient(145deg, #4ade80, #15803d); }
.app-meeting              { --app-accent: linear-gradient(145deg, #f9a8d4, #db2777); }

/* Entrance stagger */
@keyframes tile-in {
    from { opacity: 0; transform: translateY(16px) scale(0.94); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.app-grid .app-tile:nth-child(1)  { animation-delay: 0.18s; }
.app-grid .app-tile:nth-child(2)  { animation-delay: 0.22s; }
.app-grid .app-tile:nth-child(3)  { animation-delay: 0.26s; }
.app-grid .app-tile:nth-child(4)  { animation-delay: 0.30s; }
.app-grid .app-tile:nth-child(5)  { animation-delay: 0.34s; }
.app-grid .app-tile:nth-child(6)  { animation-delay: 0.38s; }
.app-grid .app-tile:nth-child(7)  { animation-delay: 0.42s; }
.app-grid .app-tile:nth-child(8)  { animation-delay: 0.46s; }
.app-grid .app-tile:nth-child(9)  { animation-delay: 0.50s; }
.app-grid .app-tile:nth-child(10) { animation-delay: 0.54s; }
.app-grid .app-tile:nth-child(11) { animation-delay: 0.58s; }
.app-grid .app-tile:nth-child(12) { animation-delay: 0.62s; }
.app-grid .app-tile:nth-child(13) { animation-delay: 0.66s; }
.app-grid .app-tile:nth-child(14) { animation-delay: 0.70s; }
.app-grid .app-tile:nth-child(15) { animation-delay: 0.74s; }
.app-grid .app-tile:nth-child(16) { animation-delay: 0.78s; }
.app-grid .app-tile:nth-child(17) { animation-delay: 0.82s; }
.app-grid .app-tile:nth-child(18) { animation-delay: 0.86s; }
.app-grid .app-tile:nth-child(19) { animation-delay: 0.90s; }
.app-grid .app-tile:nth-child(20) { animation-delay: 0.94s; }
.app-grid .app-tile:nth-child(21) { animation-delay: 0.98s; }

@media (prefers-reduced-motion: reduce) {
    .app-tile { animation: none; }
    .app-tile:hover .app-tile-icon { transform: none; }
}

/* Mobile performance: kill backdrop blur + heavy shadows, no stagger */
@media (max-width: 768px) {
    .app-tile { animation: none; }
    .app-tile-icon {
        transition: none;
        transform: none;
    }
    .app-tile:hover .app-tile-icon,
    .app-tile:focus-visible .app-tile-icon {
        box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
        transform: none;
    }
    .app-tile:active .app-tile-icon { transform: scale(0.96); }
    .app-tile.is-premium:hover .app-tile-icon {
        filter: saturate(0.75) brightness(0.92);
    }
    .app-tile-label {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(8, 10, 28, 0.72);
        box-shadow: none;
    }
    .app-tile-badge { box-shadow: none; }
}
/* ---- Search home: cosmic Android launcher ---- */

.search-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    background-color: #0a0c1e;
    background-image:
        linear-gradient(180deg, rgba(6, 8, 24, 0.12) 0%, rgba(6, 8, 24, 0.35) 55%, rgba(4, 5, 16, 0.58) 100%),
        url('../../img/search-bg.jpg');
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}
[data-theme="dark"] .search-page {
    background-color: #0a0c1e;
    background-image:
        linear-gradient(180deg, rgba(6, 8, 24, 0.22) 0%, rgba(6, 8, 24, 0.45) 55%, rgba(4, 5, 16, 0.68) 100%),
        url('../../img/search-bg.jpg');
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Body ikut memakai class "search-page" (header.php), tapi jangan jadi flex container:
   flex + align-items:center di body membuat <main> menyusut ke fit-content
   (lebar max-content grid) sehingga overflow horizontal di mobile. */
body.search-page {
    display: block;
    min-height: 0;
    overflow-x: hidden;
}

.search-container {
    text-align: center;
    width: 100%;
    max-width: 760px;
    padding: 4rem 1rem 3rem;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.search-container.hidden { display: none; }

/* Brand wordmark */
.search-logo {
    font-size: 3.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
    text-shadow: 0 4px 28px rgba(0, 0, 0, 0.5);
    margin-bottom: 2rem;
    animation: logo-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.logo-area {
    padding: 10px 20px;
    margin-bottom: 3rem;
    background: rgba(255, 255, 255, 0.60);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    width: fit-content;
    border-radius: 16px;
}
.search-logo-img {
    max-width: 180px;
    height: auto;
    filter: drop-shadow(0 4px 28px rgba(0, 0, 0, 0.5));
}
.search-logo span {
    background: linear-gradient(100deg, #7db8ff 0%, #38e0c0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
@keyframes logo-in {
    from { opacity: 0; transform: translateY(-14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Search bar */
.search-form { width: 100%; position: relative; z-index: 1; animation: bar-in 0.55s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes bar-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.search-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-full);
    padding: 0.55rem 0.6rem 0.55rem 1.5rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.25s, border-color 0.25s, transform 0.25s;
}
.search-bar:focus-within {
    border-color: rgba(125, 184, 255, 0.8);
    box-shadow: 0 0 0 4px rgba(125, 184, 255, 0.18), 0 16px 48px rgba(0, 0, 0, 0.42);
    transform: translateY(-1px);
}
.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.05rem;
    background: transparent;
    color: var(--color-text);
    min-width: 0;
}
.search-input::placeholder { color: var(--color-text-secondary); }

/* AI action button — labelled pill docked inside the bar */
.search-ai-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 40px;
    padding: 0 0.9rem;
    margin-right: 0.35rem;
    border: none;
    border-radius: 999px;
    background: #f0ebff;
    color: #6d28d9;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.search-ai-btn:hover {
    background: #e4dbff;
    transform: scale(1.03);
    box-shadow: 0 2px 12px rgba(109, 40, 217, 0.3);
}
.search-ai-btn:active { transform: scale(0.96); }
.search-ai-btn:focus-visible {
    outline: 3px solid rgba(124, 92, 255, 0.5);
    outline-offset: 2px;
}
[data-theme="dark"] .search-ai-btn { background: rgba(124, 92, 255, 0.18); color: #c4b5fd; }
[data-theme="dark"] .search-ai-btn:hover { background: rgba(124, 92, 255, 0.3); color: #ddd6fe; }

.search-btn {
    background: linear-gradient(135deg, var(--color-primary), #4f6bff);
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(26, 115, 232, 0.4);
}
.search-btn:hover {
    box-shadow: 0 6px 20px rgba(26, 115, 232, 0.55);
    transform: translateY(-1px);
}

/* Dark theme: keep the bar readable on the fixed dark artwork */
[data-theme="dark"] .search-bar {
    background: #303134;
    border-color: #3c4043;
}

@media (prefers-reduced-motion: reduce) {
    .search-logo, .search-form { animation: none; }
    .search-bar { transition: none; }
}

/* Mobile performance: artwork yang sama, hanya scroll (fixed mahal di mobile) */
@media (max-width: 768px) {
    .search-page {
        background-attachment: scroll;
    }
    [data-theme="dark"] .search-page {
        background-attachment: scroll;
    }
    .logo-area {
        background: rgba(255, 255, 255, 0.78);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    [data-theme="dark"] .logo-area { background: rgba(30, 32, 38, 0.85); }
    .search-logo, .search-form { animation: none; }
    .search-bar { transition: none; }
    .search-ai-btn:hover,
    .search-ai-btn:active { transform: none; box-shadow: none; }
    .search-ai-btn:hover { background: #f0ebff; }
    [data-theme="dark"] .search-ai-btn:hover { background: rgba(124, 92, 255, 0.18); }
    .search-btn:hover,
    .search-btn:active {
        transform: none;
        box-shadow: 0 4px 14px rgba(26, 115, 232, 0.4);
    }
}
.serp-page { min-height: 100vh; }
.serp-header {
    position: sticky;
    top: 0;
    background: var(--color-bg);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
}
.serp-logo-link { text-decoration: none; flex-shrink: 0; }
.serp-logo-img {
    max-height: 48px;
    width: auto;
    display: block;
}
.serp-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
}
.serp-logo span { color: var(--color-primary); }
.serp-search-form { flex: 1; max-width: 640px; position: relative; }
.serp-search-input {
    width: 100%;
    padding: 0.55rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 0.9375rem;
    outline: none;
    background: var(--color-bg);
    color: var(--color-text);
}
.serp-search-input:focus { box-shadow: var(--shadow-1); border-color: transparent; }

.filter-panel {
    max-width: 680px;
    margin: 0.75rem auto 0;
    padding: 0 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.filter-chip {
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    cursor: pointer;
    background: var(--color-bg);
    color: var(--color-text-secondary);
    transition: all 0.2s;
}
.filter-chip:hover { background: var(--color-surface); }
.filter-chip.active { background: var(--color-primary-light); border-color: var(--color-primary); color: var(--color-primary); font-weight: 500; }

.serp-content { max-width: 680px; margin: 0 auto; padding: 0 1rem; }
.search-stats { color: var(--color-text-secondary); font-size: 0.8125rem; margin: 0.75rem 0; }
.search-results { margin: 0.5rem 0; }
.search-result {
    margin-bottom: 1.75rem;
    content-visibility: auto;
    contain-intrinsic-size: auto 140px;
}
.result-title {
    color: var(--color-primary);
    font-size: 1.25rem;
    text-decoration: none;
    display: block;
    margin-bottom: 0.1rem;
    line-height: 1.3;
}
.result-title:hover { text-decoration: underline; }
.result-url {
    color: var(--color-ai);
    font-size: 0.875rem;
    font-style: normal;
    display: block;
    margin-bottom: 0.2rem;
    word-break: break-all;
}
.result-snippet {
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
    margin: 0;
    line-height: 1.55;
}
.result-metadata {
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}
.result-metadata span { margin-right: 0.75rem; }
.result-source { text-transform: uppercase; letter-spacing: 0.03em; }

mark { background: #FEF08A; padding: 0 2px; border-radius: 2px; }
[data-theme="dark"] mark { background: #5C4B00; color: #E8EAED; }

.empty-state { text-align: center; padding: 3rem 0; color: var(--color-text-secondary); }
.empty-state svg { margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { font-size: 1.125rem; font-weight: 500; margin-bottom: 0.5rem; color: var(--color-text); }

/* AI Answer */
.ai-answer-card {
    margin: 0.75rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--color-ai-light);
    border: 1px solid var(--color-ai);
    border-radius: var(--radius-md);
}
.ai-answer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.ai-badge {
    background: var(--color-ai);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.btn-follow-up {
    background: none;
    border: 1px solid var(--color-ai);
    color: var(--color-ai);
    border-radius: 20px;
    padding: 0.35rem 0.85rem;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-follow-up:hover { background: var(--color-ai); color: #fff; }
.ai-answer-content { font-size: 0.9375rem; line-height: 1.65; color: var(--color-text); }
.ai-answer-content p { margin-bottom: 0.5rem; }
.btn-ai-load {
    background: var(--color-ai);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 0.5rem 1.1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: all 0.2s;
}
.btn-ai-load:hover { filter: brightness(1.12); color: #fff; }
.ai-answer-sources { margin-top: 0.75rem; padding-top: 0.5rem; border-top: 1px solid var(--color-border); font-size: 0.8125rem; color: var(--color-text-secondary); }
.ai-answer-sources span { margin-right: 0.5rem; }
.cite-link { color: var(--color-ai); text-decoration: none; margin-right: 0.75rem; }
.cite-link:hover { text-decoration: underline; }
.cite-ref { font-size: 0.7rem; color: var(--color-ai); cursor: pointer; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 0.25rem; margin: 2rem 0; }
.page-link {
    padding: 0.45rem 0.7rem;
    color: var(--color-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}
.page-link:hover { background: var(--color-primary-light); }
.page-link.active { background: var(--color-primary); color: #fff; }
.page-link.disabled { color: var(--color-text-secondary); cursor: default; }

/* Chat overlay on SERP */
.chat-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    display: flex; align-items: flex-end; justify-content: center; z-index: 1000;
    padding: 1rem;
}
.chat-panel {
    background: var(--color-bg); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%; max-width: 600px; max-height: 70vh;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-3);
}
.chat-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border); font-weight: 600; }
.chat-header button { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: var(--color-text-secondary); }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.chat-message { max-width: 80%; padding: 0.6rem 1rem; border-radius: var(--radius-md); font-size: 0.9375rem; line-height: 1.5; }
.user-message { align-self: flex-end; background: var(--color-primary-light); color: var(--color-text); }
.ai-message { align-self: flex-start; background: var(--color-surface); color: var(--color-text); }
.chat-typing { opacity: 0.6; }
.chat-typing::after { content: ''; display: inline-block; width: 1em; text-align: left; animation: chatDots 1.2s steps(4, end) infinite; }
@keyframes chatDots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.chat-input-area { display: flex; gap: 0.5rem; padding: 0.75rem 1.25rem; border-top: 1px solid var(--color-border); }
.chat-input { flex: 1; padding: 0.55rem 0.85rem; border: 1px solid var(--color-border); border-radius: var(--radius-full); font-size: 0.9375rem; outline: none; background: var(--color-bg); color: var(--color-text); }
.chat-send-btn { padding: 0.55rem 1.25rem; background: var(--color-primary); color: #fff; border: none; border-radius: var(--radius-full); cursor: pointer; font-size: 0.875rem; }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }/* ---- Premium modal ---- */

.premium-modal-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(4, 5, 16, 0.66);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.premium-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.premium-modal {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: rgba(13, 16, 38, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 26px;
    padding: 2.7rem 2rem 2.1rem;
    text-align: center;
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6);
    transform: translateY(20px) scale(0.96);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.premium-modal-overlay.show .premium-modal {
    transform: translateY(0) scale(1);
}

.premium-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: #b9bfd8;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.premium-modal-close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    transform: rotate(90deg);
}

.premium-modal-icon {
    position: relative;
    width: 84px;
    height: 84px;
    margin: 0 auto 1.3rem;
    border-radius: 27%;
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow:
        0 14px 30px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.premium-modal-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 28% 12%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 55%);
    pointer-events: none;
}
.premium-modal-icon svg {
    position: relative;
    z-index: 1;
}

.premium-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #3f2a00;
    background: linear-gradient(135deg, #fff7d6 0%, #ffd766 40%, #f0a92a 100%);
    border: 1px solid rgba(255, 240, 180, 0.95);
    padding: 0.3rem 0.95rem 0.3rem 0.75rem;
    border-radius: 8px 999px 999px 8px;
    box-shadow:
        0 4px 14px rgba(240, 169, 42, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 -2px 4px rgba(190, 130, 20, 0.35);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.premium-badge::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -6px;
    transform: translateY(-50%);
    width: 7px;
    height: 80%;
    background: linear-gradient(180deg, #f5b93b, #cf9218);
    border-radius: 4px 0 0 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.premium-badge::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 8px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #cf9218;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

.premium-modal-title {
    margin: 1.1rem 0 0.7rem;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
}

.premium-message {
    margin: 0 0 1.8rem;
    color: #c6cbe0;
    line-height: 1.7;
}
.premium-message strong {
    color: #ffd76e;
}

.premium-btn {
    display: inline-block;
    background: linear-gradient(135deg, #ffe9a8, #f5b93b 55%, #e09f1f);
    color: #382600;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    padding: 0.8rem 2rem;
    border-radius: 999px;
    box-shadow: 0 10px 26px rgba(245, 185, 59, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.premium-btn:hover {
    transform: translateY(-2px);
    color: #382600;
    box-shadow: 0 14px 32px rgba(245, 185, 59, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

body.modal-open {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .premium-modal,
    .premium-modal-overlay {
        transition: none;
    }
}

@media (max-width: 768px) {
    .premium-modal-overlay {
        display: none;
        opacity: 1;
        visibility: visible;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        transition: none;
    }
    .premium-modal-overlay.show {
        display: flex;
    }
    .premium-modal {
        transform: none;
        transition: none;
        box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
    }
    .premium-modal-overlay.show .premium-modal {
        transform: none;
    }
    .premium-modal-icon {
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    .premium-badge {
        box-shadow: none;
    }
    .premium-modal-close,
    .premium-btn {
        transition: none;
    }
}

/* ---- App-grid responsiveness: prevent label collision on narrow screens ---- */
@media (max-width: 900px) {
    .app-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .app-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.4rem 0.5rem;
        padding: 0 0.75rem;
    }
    .app-tile-icon {
        width: 52px;
        height: 52px;
    }
    .app-tile-label {
        font-size: 0.6rem;
        padding: 0.2rem 0.5rem;
    }
}

@media (max-width: 360px) {
    .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}