* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background-color);
}

body {
    min-width: 280px;
    min-height: 100vh;
    margin: 0;
    background: var(--background-color);
    color: var(--text-color);
    font-family: Arial, sans-serif;
}

button,
input,
select {
    font: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--url-color) 70%, var(--input-border-color));
    outline-offset: 2px;
}

.app-shell {
    width: 100%;
    min-height: 100vh;
    padding-bottom: 54px;
}

.search-hero {
    display: grid;
    justify-items: center;
    align-content: center;
    width: min(560px, calc(100% - 32px));
    min-height: calc(100vh - 96px);
    min-height: calc(100svh - 96px);
    margin: 0 auto;
}

.brand-logo {
    width: clamp(112px, 16vw, 180px);
    height: clamp(112px, 16vw, 180px);
    object-fit: contain;
}

.search-hero h1 {
    margin: 0 0 24px;
    font-size: clamp(42px, 8vw, 64px);
}

.search-header {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    width: auto;
    max-width: 1240px;
    margin-left: clamp(18px, 8vw, 148px);
    margin-right: 24px;
    padding: 22px 0 14px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.search-form-shell {
    width: min(720px, 100%);
}

.search-form {
    display: flex;
    align-items: stretch;
    width: 100%;
    border: 1px solid var(--input-border-color);
    border-radius: 4px;
    background: var(--input-background-color);
}

.search-form:focus-within {
    border-color: var(--button-background-color);
}

.input-shell {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
}

input[type="search"] {
    width: 100%;
    min-width: 0;
    padding: 12px 48px 12px 14px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--input-text-color);
    font-size: 16px;
}

.operator-help {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 3;
}

.operator-help summary {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: var(--text-sub-color);
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

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

.operator-help summary:hover {
    background: color-mix(in srgb, var(--input-border-color) 45%, transparent);
    color: var(--text-color);
}

.operator-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    gap: 8px;
    width: min(300px, calc(100vw - 32px));
    padding: 12px;
    border: 1px solid var(--input-border-color);
    border-radius: 6px;
    background: var(--input-background-color);
    box-shadow: 0 10px 20px rgb(0 0 0 / 18%);
}

.operator-panel div {
    display: grid;
    grid-template-columns: minmax(132px, auto) 1fr;
    gap: 12px;
    font-size: 13px;
}

.operator-panel span {
    color: var(--text-sub-color);
}

.search-button {
    display: grid;
    flex: 0 0 48px;
    place-items: center;
    width: 48px;
    border: 0;
    border-radius: 0 3px 3px 0;
    background: var(--button-background-color);
    color: var(--button-text-color);
    cursor: pointer;
}

.search-button:hover {
    background: var(--button-hover-background-color);
}

.search-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.search-filter-panel {
    position: relative;
    z-index: 10;
    flex: 0 0 auto;
}

.search-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 100%;
    min-height: 44px;
    padding: 0 10px;
    border-left: 1px solid var(--input-border-color);
    color: var(--text-sub-color);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    list-style: none;
    user-select: none;
}

.search-filter-toggle::-webkit-details-marker {
    display: none;
}

.search-filter-toggle:hover,
.search-filter-panel[open] .search-filter-toggle {
    background: color-mix(in srgb, var(--input-border-color) 35%, transparent);
    color: var(--text-color);
}

.search-filter-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.filter-count {
    display: inline-grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--button-background-color);
    color: var(--button-text-color);
    font-size: 11px;
}

.search-filter-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: -48px;
    width: min(660px, calc(100vw - 32px));
    padding: 14px;
    border: 1px solid var(--input-border-color);
    border-radius: 7px;
    background: var(--input-background-color);
    box-shadow: 0 12px 30px rgb(0 0 0 / 22%);
}

.search-filter-heading,
.search-filter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.search-filter-heading {
    font-size: 14px;
}

.search-filter-heading-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.close-filters {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-sub-color);
    cursor: pointer;
}

.close-filters:hover {
    background: color-mix(in srgb, var(--input-border-color) 40%, transparent);
    color: var(--text-color);
}

.close-filters svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.8;
}

.search-filter-help {
    margin: 2px 0 12px;
    color: var(--text-sub-color);
    font-size: 11px;
}

.search-filter-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    align-items: end;
    gap: 10px;
}

.filter-field {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.filter-field > span,
.filter-field > legend {
    padding-left: 2px;
    color: var(--text-sub-color);
    font-size: 11px;
    font-weight: 700;
}

.filter-multi-field {
    padding: 0;
    border: 0;
    margin: 0;
}

.filter-multi-field > legend {
    margin-bottom: 3px;
}

.filter-multi-select {
    position: relative;
}

.filter-multi-select > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 34px;
    padding: 0 9px;
    border: 1px solid var(--input-border-color);
    border-radius: 4px;
    background: var(--input-background-color);
    color: var(--input-text-color);
    cursor: pointer;
    font-size: 12px;
    list-style: none;
}

.filter-multi-select > summary::-webkit-details-marker {
    display: none;
}

.filter-multi-select > summary:hover,
.filter-multi-select[open] > summary {
    border-color: color-mix(in srgb, var(--button-background-color) 55%, var(--input-border-color));
}

.filter-option-list {
    position: absolute;
    z-index: 2;
    top: calc(100% + 5px);
    left: 0;
    display: grid;
    width: 100%;
    max-height: 230px;
    padding: 5px;
    overflow-y: auto;
    border: 1px solid var(--input-border-color);
    border-radius: 5px;
    background: var(--input-background-color);
    box-shadow: 0 8px 20px rgb(0 0 0 / 18%);
}

.filter-option-list label {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 6px;
    border-radius: 3px;
    color: var(--input-text-color);
    cursor: pointer;
    font-size: 12px;
    line-height: 1.25;
}

.filter-option-list label:hover {
    background: color-mix(in srgb, var(--input-border-color) 35%, transparent);
}

.filter-option-list input {
    flex: 0 0 auto;
    margin: 1px 0 0;
    accent-color: var(--button-background-color);
}

.filter-field select {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0 26px 0 8px;
    border: 1px solid var(--input-border-color);
    border-radius: 4px;
    background: var(--input-background-color);
    color: var(--input-text-color);
    cursor: pointer;
    font-size: 12px;
}

.filter-field select:hover {
    border-color: color-mix(in srgb, var(--button-background-color) 55%, var(--input-border-color));
}

.clear-filters {
    padding: 4px 6px;
    color: var(--text-sub-color);
    font-size: 12px;
    text-decoration: none;
}

.clear-filters:hover {
    color: var(--text-color);
}

.search-filter-footer {
    justify-content: flex-end;
    margin-top: 12px;
}

.apply-filters {
    padding: 8px 13px;
    border: 0;
    border-radius: 4px;
    background: var(--button-background-color);
    color: var(--button-text-color);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.apply-filters:hover {
    background: var(--button-hover-background-color);
}

.hero-actions {
    position: fixed;
    top: 20px;
    right: 24px;
}

.search-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.preference-form {
    display: flex;
    margin: 0;
}

.search-actions button,
.search-actions .page-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 12px 0 9px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.search-actions button:hover,
.search-actions .page-action:hover {
    background: color-mix(in srgb, var(--input-border-color) 32%, transparent);
}

.search-actions .icon-action {
    width: 36px;
    padding: 0;
    color: var(--text-sub-color);
}

.search-actions svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.plus-mark {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--button-background-color);
    color: var(--button-text-color);
}

.plus-mark svg {
    width: 14px;
    height: 14px;
}

.search-actions .theme-choice-light {
    display: none;
}

.search-actions .theme-choice-dark {
    display: inline-flex;
}

[data-theme="dark"] .theme-choice-dark {
    display: none;
}

[data-theme="dark"] .theme-choice-light {
    display: inline-flex;
}

.favicon-slash {
    stroke-width: 2.4;
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .theme-choice-dark {
        display: none;
    }

    [data-theme="auto"] .theme-choice-light {
        display: inline-flex;
    }
}

.search-column {
    width: auto;
    max-width: 900px;
    margin-left: clamp(18px, 8vw, 148px);
    margin-right: 24px;
    padding: 8px 0 36px;
}

.search-tabs {
    display: flex;
    gap: 22px;
    width: auto;
    max-width: 900px;
    margin: 0 24px 4px clamp(18px, 8vw, 148px);
    border-bottom: 1px solid var(--input-border-color);
}

.search-tabs a {
    position: relative;
    padding: 8px 2px 10px;
    color: var(--text-sub-color);
    font-size: 14px;
    text-decoration: none;
}

.search-tabs a.active {
    color: var(--text-color);
    font-weight: 700;
}

.search-tabs a.active::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: var(--button-background-color);
    content: "";
}

.image-search-column {
    width: auto;
    margin: 0 24px 0 clamp(18px, 8vw, 148px);
    padding: 8px 0 36px;
}

.image-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 20px 14px;
    max-width: 1400px;
}

.image-result {
    min-width: 0;
}

.image-result-link {
    display: grid;
    gap: 6px;
    color: inherit;
    text-decoration: none;
}

.image-frame {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 7px;
    background: color-mix(in srgb, var(--input-border-color) 35%, var(--input-background-color));
}

.image-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 140ms ease;
}

.image-result-link:hover .image-frame img {
    transform: scale(1.02);
}

.image-fallback {
    display: none;
    padding: 12px;
    color: var(--text-sub-color);
    font-size: 13px;
    text-align: center;
}

.image-frame.image-load-failed img {
    display: none;
}

.image-frame.image-load-failed .image-fallback {
    display: block;
}

.image-result-title {
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-result-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    overflow: hidden;
    color: var(--text-sub-color);
    font-size: 12px;
}

.image-result-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-pagination {
    max-width: 420px;
    margin-top: 28px;
}

.results-count {
    margin: 2px 0 18px;
    color: var(--text-sub-color);
    font-size: 13px;
}

.query-adjustment {
    margin: 2px 0 12px;
    color: var(--text-color);
    font-size: 14px;
}

.query-adjustment span {
    font-weight: 700;
}

.query-adjustment a {
    color: var(--url-color);
    font-weight: 600;
}

.result-item {
    padding: 14px 0 18px;
}

.result-source {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    margin-bottom: 7px;
    color: inherit;
    text-decoration: none;
}

.source-mark {
    position: relative;
    display: grid;
    flex: 0 0 30px;
    place-items: center;
    width: 30px;
    height: 30px;
    overflow: hidden;
    border: 1px solid var(--input-border-color);
    border-radius: 50%;
    background: var(--input-background-color);
    color: var(--text-sub-color);
    font-size: 13px;
    font-weight: 700;
}

.result-favicon {
    position: absolute;
    z-index: 1;
    width: 18px;
    height: 18px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

.source-lines {
    display: grid;
    min-width: 0;
    line-height: 1.35;
}

.source-host {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
}

.result-url {
    overflow: hidden;
    color: var(--text-sub-color);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-title {
    display: inline-block;
    max-width: 100%;
    margin-bottom: 5px;
    color: var(--url-color);
    font-size: 20px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    text-decoration: none;
}

a.result-title:hover {
    text-decoration: underline;
}

.result-snippet {
    margin: 0;
    color: var(--text-sub-color);
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.status-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 10px;
    padding: 18px;
    border: 1px solid var(--input-border-color);
    border-radius: 8px;
    background: var(--input-background-color);
}

.status-card h2 {
    margin: 0 0 6px;
    font-size: 18px;
}

.status-card p {
    margin: 0;
    color: var(--text-sub-color);
    font-size: 14px;
}

.error-card {
    border-color: color-mix(in srgb, #e57373 55%, var(--input-border-color));
}

.retry-link {
    padding: 10px 16px;
    border-radius: 4px;
    background: var(--button-background-color);
    color: var(--button-text-color);
    text-decoration: none;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 24px 0 12px;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-page,
.pagination-arrow {
    display: grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
}

a.pagination-page:hover,
a.pagination-arrow:hover,
.pagination-page.active {
    background: color-mix(in srgb, var(--input-border-color) 45%, transparent);
}

.pagination-page.active {
    color: var(--url-color);
    font-weight: 700;
}

.pagination-arrow {
    font-size: 28px;
    line-height: 1;
}

.pagination-arrow.disabled {
    color: var(--input-border-color);
}

.pagination-ellipsis {
    padding: 0 5px;
    color: var(--text-sub-color);
}

.pagination-summary {
    display: none;
    color: var(--text-sub-color);
    font-size: 13px;
}

.app-footer {
    position: fixed;
    right: 24px;
    bottom: 14px;
    display: flex;
    gap: 16px;
    font-size: 13px;
}

.app-footer a {
    color: var(--text-sub-color);
    text-decoration: none;
}

.app-footer a:hover {
    color: var(--text-color);
    text-decoration: underline;
}

.submit-status.error {
    color: #e57373;
}

.submit-status.success {
    color: var(--url-color);
}

.submit-page-shell {
    width: min(560px, calc(100% - 32px));
    margin: 0 auto;
    padding: clamp(36px, 8vh, 84px) 0 80px;
}

.submit-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    color: var(--text-color);
    font-size: 22px;
    font-weight: 700;
    text-decoration: none;
}

.submit-brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.submit-card {
    padding: 24px;
    border: 1px solid var(--input-border-color);
    border-radius: 8px;
    background: var(--input-background-color);
}

.submit-card h1 {
    margin: 0 0 8px;
    font-size: 26px;
}

.submit-card > p {
    margin: 0;
    color: var(--text-sub-color);
    font-size: 14px;
    line-height: 1.5;
}

.submit-card form {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.submit-card label {
    color: var(--text-sub-color);
    font-size: 13px;
}

.submit-card input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--input-border-color);
    border-radius: 4px;
    background: var(--background-color);
    color: var(--input-text-color);
    font-size: 16px;
}

.submit-page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

.submit-page-actions a,
.submit-page-actions button {
    padding: 10px 18px;
    border: 0;
    border-radius: 4px;
    font-size: 15px;
    text-decoration: none;
}

.submit-page-actions a {
    color: var(--text-color);
}

.submit-page-actions button {
    background: var(--button-background-color);
    color: var(--button-text-color);
    cursor: pointer;
}

.submit-page-actions button:hover {
    background: var(--button-hover-background-color);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

[hidden] {
    display: none !important;
}

@media (max-width: 880px) {
    .search-header {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .search-header .search-actions {
        grid-column: 2;
    }

}

@media (max-width: 620px) {
    .search-header {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding-top: 14px;
    }

    .brand-mark {
        display: none;
    }

    .search-header .search-actions {
        grid-column: 1;
    }

    .search-filter-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-toggle-label {
        display: none;
    }

    .search-filter-toggle {
        padding: 0 8px;
    }

    .pagination-pages {
        display: none;
    }

    .pagination-summary {
        display: inline;
        flex: 1;
        text-align: center;
    }

    .pagination {
        justify-content: space-between;
    }

    .search-hero {
        min-height: auto;
        padding-top: clamp(44px, 12svh, 84px);
    }

    .brand-logo {
        width: clamp(88px, 28vw, 124px);
        height: clamp(88px, 28vw, 124px);
    }

    .search-hero h1 {
        margin-bottom: 18px;
        font-size: clamp(34px, 12vw, 48px);
    }

    .hero-actions {
        position: static;
        width: min(100% - 32px, 420px);
        margin: 18px auto 0;
    }

    .hero-actions .search-actions {
        justify-content: center;
    }

    .app-footer {
        right: 16px;
        left: 16px;
        justify-content: center;
    }
}

@media (max-width: 760px) {
    .search-header,
    .search-column,
    .search-tabs,
    .image-search-column {
        width: calc(100% - 32px);
        margin-right: auto;
        margin-left: auto;
    }

    .image-results {
        grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
        gap: 16px 10px;
    }
}
