*, *::before, *::after {
    box-sizing: border-box;
    font-family: sans-serif;
}

html {
    height:100%;
}

body {
    background-color:var(--bg-main);
    background-image:radial-gradient(circle at top end, var(--bg-card) 0%, var(--bg-main) 100%);
    background-attachment:fixed;
    color:var(--text-primary);
    margin:0;
    padding:0;
    min-height:100%;
    -webkit-tap-highlight-color: transparent;
}

img[src=""] {
  display: none;
}

.view-home {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.view-home .container {
    width: 100%;
    max-width: 580px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.view-home .hero-logo {
    font-size:4.5rem;
    margin-bottom:30px;
    letter-spacing:-3px;
    font-weight:800;
}
.view-home .search-input-wrapper {
    width: 100%;
    margin-bottom: 24px;
}

.view-home .search-box {
    font-size:1.1rem;
    padding:16px 28px;
    box-shadow:0 4px 6px -1px rgba(0,0,0,0.1),0 2px 4px -1px rgba(0,0,0,0.06);
}

.view-home .buttons {
    display:flex;
    gap:12px;
    justify-content:center;
}
.view-home button {
    padding:10px 24px;
    border-radius:8px;
    font-weight:600;
    font-size:0.9rem;
    cursor:pointer;
    transition:all 0.2s;
    border:1px solid transparent;
    touch-action:manipulation;
}
.view-home .btn-primary {
    background:var(--accent);
    color:var(--bg-main);
}
.view-home .btn-primary:hover {
    filter:brightness(1.1);
    transform:translateY(-1px);
}
.view-home .btn-secondary {
    background:var(--bg-card);
    color:var(--text-primary);
    border-color:var(--border);
    text-decoration:none;
    display:inline-flex;
    align-items:center;
    padding:10px 24px;
    border-radius:8px;
    font-weight:600;
    font-size:0.9rem;
    cursor:pointer;
    transition:all 0.2s;
    border:1px solid var(--border);
}
.view-home .btn-secondary:hover {
    background:var(--border);
    border-color:var(--text-secondary);
}
.home-settings-btn {
    position:fixed;
    top:27px;
    inset-inline-end:60px;
    width:24px;
    height:24px;
    background-color:var(--text-primary);
    -webkit-mask-image:url('/static/settings.svg');
    mask-image:url('/static/settings.svg');
    mask-size:contain;
    mask-repeat:no-repeat;
    mask-position:center;
    text-decoration:none;
}
.home-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 24px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}
.version-link {
    color: var(--text-muted);
    text-decoration: underline;
}
.version-link:hover {
    color: var(--text-primary);
}
.nav-settings-icon {
    width:24px;
    height:24px;
    flex-shrink:0;
    margin-inline-start:auto;
    margin-top:3px;
    background-color:var(--text-secondary);
    -webkit-mask-image:url('/static/settings.svg');
    mask-image:url('/static/settings.svg');
    mask-size:100% 100%;
    transition:background-color 0.2s;
    text-decoration:none;
}
.nav-settings-icon:hover,
.nav-settings-icon.active {
    background-color:var(--text-primary);
}
.nav-settings-link {
    display:none;
    margin-inline-start:auto;
}
header {
    display:flex;
    align-items:center;
    gap:20px;
    padding-block:15px;
    padding-inline:60px;
    border-bottom:1px solid var(--border);
    background:var(--bg-main);
    width:100%;
}
.search-form {
    flex-grow:1;
    max-width:600px;
}
h1 {
    font-size:1.5rem;
    margin:0;
    letter-spacing:-1px;
    white-space:nowrap;
}
h1 span {
    color:var(--accent);
}
.logo-link {
    text-decoration:none;
    color:inherit;
}
header .logo-link {
    transition:transform 0.2s;
}
header .logo-link:hover {
    transform:scale(1.03);
}
.search-box {
    width: 100%;
    padding: 12px 24px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus {
    border-color:var(--accent);
    box-shadow:0 0 0 4px var(--accent-glow);
}
.nav-tabs {
    padding-inline:60px;
    border-bottom:1px solid var(--border);
    background:var(--bg-main);
    width:100%;
}
.nav-container {
    display:flex;
    gap:30px;
}
.nav-tabs a {
    padding:14px 0;
    color:var(--text-secondary);
    text-decoration:none;
    font-size:0.9rem;
    font-weight:500;
    border-bottom:2px solid transparent;
    transition:color 0.2s;
    touch-action: manipulation;
}
.nav-tabs a:hover {
    color:var(--text-primary);
}
.nav-tabs a.active {
    color:var(--accent);
    border-bottom-color:var(--accent);
}
.nav-right {
    margin-inline-start:auto;
}
.image-results-container {
    padding:30px 60px;
}
.image-grid {
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(240px,1fr));
    gap:24px;
    max-width:1600px;
    margin:0 auto;
}
.image-card {
    background:var(--bg-card);
    border-radius:12px;
    overflow:hidden;
    border:1px solid var(--border);
    transition:transform 0.2s ease,border-color 0.2s;
}
.image-card:hover {
    transform:translateY(-4px);
    border-color:var(--accent);
}
.image-wrapper {
    position:relative;
    aspect-ratio:4/3;
    background:#000;
    overflow:hidden;
}
.image-wrapper img {
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
    transition:opacity 0.3s;
}
.image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.image-card:hover .image-overlay {
    opacity:1;
    pointer-events: auto;
}
.overlay-buttons {
    display:flex;
    flex-direction:column;
    gap:10px;
    width:70%;
}
.overlay-btn {
    padding:8px 16px;
    border-radius:20px;
    font-size:0.8rem;
    font-weight:700;
    text-decoration:none;
    text-align:center;
    transition:filter 0.2s;
    touch-action: manipulation;
}
.overlay-btn:hover {
    filter:brightness(1.1);
}
.overlay-btn.primary {
    background:var(--accent);
    color:var(--bg-main);
}
.overlay-btn.secondary {
    background:rgba(255,255,255,0.1);
    color:white;
    backdrop-filter:blur(4px);
    border:1px solid rgba(255,255,255,0.2);
}
.image-info {
    padding:12px;
}
.image-caption {
    display:block;
    font-size:0.85rem;
    color:var(--text-primary);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    margin-bottom:4px;
}
.image-source {
    display:block;
    font-size:0.75rem;
    color:var(--text-secondary);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.content-layout {
    display:grid;
    grid-template-columns:140px minmax(0,700px) 450px;
    gap:60px;
    padding-block:30px;
    padding-inline:60px;
}
.result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    position: relative;
}
.result-favicon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    position: absolute;
    inset-inline-start: -24px;
}
.url {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: block;
    margin-bottom: 4px;
}


@media (max-width: 768px) {
    .result-favicon {
        width: 14px;
        height: 14px;
        inset-inline-start: -20px;
    }
}

@media (max-width: 480px) {
    .result-favicon {
        width: 12px;
        height: 12px;
        inset-inline-start: -16px;
    }
}
.results-container {
    grid-column:2;
}
.engine-filter-list {
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    margin-bottom:24px;
}
.engine-filter {
    background:var(--bg-card);
    color:var(--text-secondary);
    border:1px solid var(--border);
    border-radius:999px;
    padding:6px 12px;
    text-decoration:none;
    font-size:0.85rem;
    font-weight:600;
}
.engine-filter.active {
    background:var(--accent);
    border-color:var(--accent);
    color:var(--bg-main);
}
.engine-warning-list {
    display:flex;
    flex-direction:column;
    gap:12px;
    margin-bottom:24px;
}
.engine-warning {
    background:var(--bg-card);
    border:1px solid var(--border);
    border-radius:12px;
    padding:14px 16px;
}
.engine-warning-title {
    display:block;
    font-size:0.95rem;
    font-weight:700;
    margin-bottom:4px;
}
.engine-warning-copy {
    color:var(--text-muted);
    line-height:1.5;
    margin:0;
}
.result {
    margin-bottom:32px;
}
.result > a {
    color:var(--accent);
    text-decoration:none;
    font-size:1.25rem;
    display:inline-block;
    margin-bottom:4px;
}
.desc {
    color:var(--text-muted);
    line-height:1.6;
    margin:0;
}
.cached {
    color: var(--text-secondary);
    font-size:0.85rem;
    display:inline-block;
    text-decoration: underline;
}
.infobox {
    grid-column:3;
    background:var(--bg-card);
    border:1px solid var(--border);
    border-radius:12px;
    align-self:start;
    margin-bottom: 10px;
}
.infobox-header {
    padding:20px;
    border-bottom:1px solid var(--border);
}
.infobox-title {
    font-size:1.5rem;
    font-weight:600;
    margin:0;
} .infobox-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.read-more {
    color: var(--accent);
    font-weight: bold;
    text-decoration: none;
    font-size: 0.9rem;
    align-self: flex-start;
}

.read-more:hover {
    text-decoration: underline;
} .infobox-main {
    display:flex;
    gap:15px;
    padding:20px;
}
.infobox-image {
    width:120px;
    height:120px;
    min-width:120px;
    border-radius:8px;
    border:1px solid var(--border);
    object-fit:cover;
}
.infobox-summary {
    display: block;
    font-size:0.95rem;
    line-height:1.5;
    color:var(--text-muted);
    margin:0;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 40px;
    padding-bottom: 40px;
}

.pagination-btn {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    touch-action: manipulation;
}

.pagination-btn:hover {
    background: var(--border);
    border-color: var(--text-secondary);
}


.pagination-current {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-main);
}

.pagination-current:hover {
    background: var(--accent);
    border-color: var(--accent);
}

[dir="rtl"] .pagination-btn.prev {
    transform: scaleX(-1);
}

[dir="rtl"] .pagination-btn.next {
    transform: scaleX(-1);
}


@media (max-width:1200px) {
    .content-layout {
        grid-template-columns:1fr;
        padding-block:20px;
        padding-inline:30px;
        gap:20px;
    }
    header {
        gap:20px;
    }
    .results-container,.infobox-sidebar {
        grid-column:1;
        max-width:100%;
    }
    .settings-layout {
        padding-block:20px;
        padding-inline:30px;
        display:flex;
        justify-content:center;
    }
    .infobox-sidebar {
        order:-1;
    }
    .nav-tabs,.image-results-container {
        padding-inline:30px;
    }
    header {
        padding-block:15px;
        padding-inline:30px;
    }
}

@media (max-width:768px) {
    .nav-settings-icon {
        display:none;
    }
    .nav-settings-link {
        display:inline;
    }
    header {
        flex-direction:column;
        gap:12px;
        padding-block:12px;
        padding-inline:16px;
        text-align:center;
    }
    h1 {
        font-size:1.3rem;
    }
    .search-form {
        width:100%;
        max-width:100%;
    }
    .search-form .search-box {
        width:100%;
    }
    .nav-tabs {
        overflow-x:auto;
        -webkit-overflow-scrolling:touch;
        padding-inline:16px;
    }
    .nav-container {
        gap:24px;
        min-width:max-content;
    }
    .nav-tabs a {
        padding:12px 0;
        font-size:0.95rem;
    }
    .content-layout {
        padding-inline-start:40px;
        padding-inline-end:16px;
        padding-block:16px;
        gap:16px;
    }
    .result {
        margin-bottom:24px;
    }
    .engine-warning {
        padding:12px 14px;
    }
    .result > a {
        font-size:1.1rem;
        word-break:break-word;
    }
    .url {
        font-size:0.8rem;
        word-break:break-all;
    }
    .desc {
        font-size:0.9rem;
    }
    .cached {
        font-size:0.8rem;
    }
    .infobox {
        margin-bottom:16px;
    }
    .infobox-header {
        padding:16px;
    }
    .infobox-title {
        font-size:1.2rem;
    }
    .infobox-main {
        flex-direction:column;
        padding:16px;
        gap:12px;
    }
    .infobox-image {
        width:100%;
        height:auto;
        min-width:unset;
        max-width:200px;
    }
    .image-results-container {
        padding-inline:16px;
    }
    .pagination {
        flex-wrap:wrap;
        gap:8px;
        padding:0 8px;
    }
    .pagination-btn {
        padding:10px 14px;
        font-size:0.85rem;
    }
    .view-home {
        display: flex;
        justify-content: center;
        align-items: center;
        padding:20px 16px;
        min-height: 100vh;
    }
    .view-home .container {
        padding:0;
        width:100%;
        max-width:580px;
    }
    .view-home .hero-logo {
        font-size:3rem;
        margin-bottom:24px;
    }
    .view-home .search-input-wrapper {
        margin-bottom:16px;
    }
    .view-home .search-box {
        width:100%;
        font-size:1rem;
        padding:14px 20px;
    }
    .view-home .buttons {
        gap:10px;
    }
    .view-home button {
        padding:12px 20px;
    }
}

@media (max-width:600px) {
    .content-layout {
        padding-inline-start:28px;
        padding-inline-end:16px;
        padding-block:16px;
    }
    .settings-layout {
        padding:0;
    }
    header {
        padding-inline:12px;
        padding-block:12px;
    }
    .search-box {
        font-size:0.95rem;
    }
    .view-home .search-box {
        width:100%;
    }
    .view-home {
        padding:20px 16px;
    }
    .image-grid {
        grid-template-columns:repeat(auto-fill,minmax(140px,1fr));
        gap:10px;
    }
    .image-card {
        border-radius:8px;
    }
    .image-info {
        padding:8px 10px;
    }
    .image-caption {
        font-size:0.8rem;
    }
    .image-source {
        font-size:0.7rem;
    }
    .overlay-buttons {
        width:80%;
    }
    .overlay-btn {
        padding:6px 12px;
        font-size:0.75rem;
    }
}

.settings-layout {
    padding-block: 30px;
    padding-inline-start: 260px;
    padding-inline-end: 60px;
}

.settings-container {
    max-width:700px;
}

.settings-title {
    font-size:1.8rem;
    font-weight:700;
    margin:0 0 32px 0;
    letter-spacing:-0.5px;
}

.settings-section {
    background:var(--bg-card);
    border:1px solid var(--border);
    border-radius:12px;
    padding:24px;
    margin-bottom:32px;
}

.settings-section-title {
    font-size:1.1rem;
    font-weight:700;
    margin:0 0 4px 0;
}

.settings-section-desc {
    color:var(--text-secondary);
    font-size:0.9rem;
    margin:0 0 20px 0;
    line-height:1.4;
}

.settings-field {
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:10px 0;
}

.settings-field + .settings-field {
    border-top:1px solid var(--border);
}

.settings-label {
    font-size:0.95rem;
    color:var(--text-primary);
}

.settings-select {
    padding:8px 12px;
    border-radius:8px;
    border:1px solid var(--border);
    background:var(--bg-main);
    color:var(--text-primary);
    font-size:0.9rem;
    outline:none;
    cursor:pointer;
    transition:border-color 0.2s;
}

.settings-select:focus {
    border-color:var(--accent);
}

.settings-checkbox {
    width:18px;
    height:18px;
    accent-color:var(--accent);
    cursor:pointer;
}

.settings-actions {
    display:flex;
    gap:12px;
    margin-top:8px;
    padding-bottom:40px;
    justify-content:flex-start;
}

.settings-actions .btn-primary {
    background:var(--accent);
    color:var(--bg-main);
    border:1px solid transparent;
    padding:10px 24px;
    border-radius:8px;
    font-weight:600;
    font-size:0.9rem;
    cursor:pointer;
    transition:all 0.2s;
    touch-action:manipulation;
}

.settings-actions .btn-primary:hover {
    filter:brightness(1.1);
    transform:translateY(-1px);
}

.settings-actions .btn-secondary {
    background:var(--bg-card);
    color:var(--text-primary);
    border:1px solid var(--border);
    padding:10px 24px;
    border-radius:8px;
    font-weight:600;
    font-size:0.9rem;
    cursor:pointer;
    transition:all 0.2s;
    touch-action:manipulation;
}

.settings-actions .btn-secondary:hover {
    background:var(--border);
    border-color:var(--text-secondary);
}

@media (max-width:768px) {
    .settings-layout {
        padding:12px;
        display:block;
    }
    .settings-container {
        max-width:100%;
    }
    .settings-title {
        font-size:1.4rem;
        margin-bottom:24px;
    }
    .settings-section {
        padding:16px;
    }
    .settings-field {
        flex-direction:column;
        align-items:stretch;
        gap:8px;
    }
    .settings-actions {
        flex-direction:column;
    }
    .settings-actions .btn-primary,
    .settings-actions .btn-secondary {
        width:100%;
        text-align:center;
    }
}

[dir="rtl"] {
    direction: rtl;
    unicode-bidi: embed;
}

[dir="rtl"] header {
    flex-direction: row-reverse;
    direction: ltr;
}

[dir="rtl"] .nav-container {
    flex-direction: row-reverse;
    direction: ltr;
}

[dir="rtl"] .search-box {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .url {
    text-align: end;
}

[dir="rtl"] .nav-settings-icon {
    margin-inline-start: unset;
    margin-inline-end: auto;
}

[dir="rtl"] .settings-actions .btn-primary {
    margin-inline-end: auto;
}

@media (max-width: 768px) {
    [dir="rtl"] header {
        flex-direction: column;
    }
}


