:root {
    --bg: #fff;
    --text: #212225;
    --muted: #606469;
    --chip: #f2f4f5;
}

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    overflow-x: hidden;
    overscroll-behavior: none;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button,
a,
.tab,
.chip,
.card,
.x-icon,
.icon {
    -webkit-user-select: none;
    user-select: none;
}

button:focus,
a:focus,
.tab:focus,
.chip:focus {
    outline: none;
}

/* Sign In Button */
.sign-in-btn {
    position: fixed !important;
    top: 21px !important;
    right: 21px !important;
    background: #1b74e9 !important;
    color: white !important;
    border: none !important;
    padding: 10px 11px !important;
    border-radius: 101px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    z-index: 9999 !important;
    transition: 0.2s ease !important;
    display: block !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
}

.sign-in-btn:hover {
    background: #1766cd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13), 0 1px 2px rgba(0, 0, 0, 0.25);
}

.sign-in-btn:active {
    background: #1558b1;
}

.search-focused .sign-in-btn {
    display: none;
}

button, a, .tab, .chip, .card, .x-icon, .icon {
    -webkit-user-select: none;
    user-select: none;
    outline: none;
}

button:focus, a:focus, .tab:focus, .chip:focus {
    outline: none;
}

/* Logo Container */
.logo-container {
    display: flex;
    justify-content: center;
    padding: 5% 0 1px 1px;
}

.logo-container img {
    width: 100px;
    height: auto;
}

/* Header */
.header {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 11px 13px;
}

.search-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 25px;
    padding: 9px 15px;
    font-size: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.29);
    gap: 13px;
    cursor: text;
    margin: 0 auto;
}

.search-bar .search-text {
    color: var(--muted);
    flex: 1;
}

.search-bar .icon {
    width: 21px;
    height: 21px;
    cursor: pointer;
    color: #606469;
    flex-shrink: 0;
}

.search-bar .search-icon {
    width: 21px;
    height: 21px;
    color: #606469;
    flex-shrink: 0;
}

.search-focused .search-icon {
    display: none;
}

.search-bar .x-icon {
    font-size: 19px;
    font-weight: 300;
    color: #606469;
    cursor: pointer;
    flex-shrink: 0;
    min-width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 4;
}

.search-bar .separator {
    width: 2px;
    height: 25px;
    background: #dcdde1;
    flex-shrink: 0;
}

.search-bar img {
    width: 21px;
    height: 21px;
    opacity: 0.71;
}

/* Search focused state */
body.search-focused {
    background: #fff;
}

.search-focused .header {
    padding: 0;
    margin: 0;
    flex-direction: column;
}

.search-focused .search-bar {
    max-width: 100%;
    border-radius: 0;
    box-shadow: none;
    gap: 9px;
    padding: 13px 17px;
    margin: 0;
    border-bottom: 1px solid #e1e1e1;
    width: 100%;
    overflow: visible;
    box-sizing: border-box;
}

.search-input-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.search-input-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    right: -2px;
    width: 36px;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, #fff 88%, #fff 100%);
}

.search-focused .logo-container,
.search-focused .tabs,
.search-focused .chips,
.search-focused .grid {
    display: none;
}

/* Search input field */
.search-input {
    border: none;
    outline: none;
    font-size: 16px;
    flex: 1;
    font-family: inherit;
    background: transparent;
    color: var(--text);
    min-width: 0;
    width: 100%;
    padding-right: 0;
}

.search-input-wrap {
    margin-right: -13px;
}

.search-focused .search-input {
    flex: 1;
}

.search-input::placeholder {
    color: var(--muted);
}

/* Back button */
.back-btn {
    width: 24px;
    height: 24px;
    cursor: pointer;
    color: #2074d5;
    flex-shrink: 0;
    display: none;
}

.search-focused .back-btn {
    display: block;
}

.search-focused .separator,
.search-focused .icon {
    display: none;
}

.search-focused .x-icon {
    display: block !important;
    flex-shrink: 0;
}

/* Search separator line */
.search-separator {
    display: none;
    height: 1px;
    background: #e0e0e0;
    margin: 0;
}

.search-focused .search-separator {
    display: block;
}

/* Search recommendations */
.search-recommendations {
    display: none;
    padding: 0;
    margin: 0;
}

.search-focused .search-recommendations {
    display: block;
}

.recommendation {
    display: flex;
    align-items: center;
    gap: 17px;
    padding: 13px 17px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.recommendation:hover {
    background: #f9fafb;
}

.recommendation-icon {
    width: 21px;
    height: 21px;
    color: #606469;
    flex-shrink: 0;
}

.recommendation-text {
    flex: 1;
    color: var(--text);
    font-size: 14px;
}

.recommendation-arrow {
    width: 14px;
    height: 14px;
    color: #606469;
    flex-shrink: 0;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 19px;
    padding: 9px 13px;
    font-size: 14px;
    border-bottom: 1px solid #e1e1e1;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.tab {
    color: var(--muted);
    padding-bottom: 7px;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s ease;
}

.tab.active {
    color: var(--text);
    border-bottom: 2px solid var(--text);
    font-weight: 500;
}

/* Chips */
.chips {
    display: flex;
    gap: 9px;
    padding: 11px 13px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chip {
    background: var(--chip);
    padding: 7px 13px;
    border-radius: 17px;
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chip:active {
    background: #e9ebee;
}

/* Image grid */
.grid {
    display: flex;
    gap: 9px;
    padding: 9px;
    align-items: flex-start;
}

.grid-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.card {
    cursor: pointer;
    min-width: 0;
}

.img-frame {
    width: 100%;
    border-radius: 13px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: #fff;
}

.copyright-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    color: #ffffff;
    mix-blend-mode: difference;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.45);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    user-select: none;
}

.copyright-subtle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.copyright-diagonal {
    display: block;
    background-image: repeating-linear-gradient(
        -32deg,
        rgba(255, 255, 255, 0.42) 0px,
        rgba(255, 255, 255, 0.42) 1px,
        transparent 1px,
        transparent 52px
    );
}

.copyright-diagonal::before {
    content: "© STOCK   © STOCK   © STOCK   © STOCK   © STOCK   © STOCK";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-26deg) scale(1.25);
    transform-origin: center;
    white-space: nowrap;
    font-size: 14px;
    letter-spacing: 0.12em;
}

.copyright-getty {
    display: block;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.copyright-getty::before {
    content: "gettyimages";
    position: absolute;
    left: var(--wm-left, 50%);
    top: var(--wm-top, 50%);
    transform: translate(-50%, -50%);
    white-space: nowrap;
}

.img {
    width: 100%;
    border-radius: 9px;
    border: none;
    display: block;
    object-fit: cover;
    transition: filter 0.2s ease;
}

.meta {
    padding: 5px 3px;
    font-size: 13px;
    min-width: 0;
}

.meta .desc {
    display: block;
    width: 100%;
    max-width: 100%;
    color: var(--text);
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta .source {
    color: var(--muted);
}

/* Subtle hover (desktop) */
@media (hover: hover) {
    .card:hover .img {
        filter: brightness(0.95);
    }
}

.inject-id-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.inject-id-modal-overlay.is-open {
    display: flex;
}

.inject-id-modal {
    width: min(92vw, 360px);
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.inject-id-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
}

.inject-id-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #dadce0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

.inject-id-input:focus {
    border-color: #1b74e9;
}

.inject-id-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.inject-id-btn {
    border: 1px solid #dadce0;
    background: #fff;
    border-radius: 10px;
    padding: 7px 12px;
    font-size: 13px;
    cursor: pointer;
}

.inject-id-save {
    background: #1b74e9;
    color: #fff;
    border-color: #1b74e9;
}

.chip-flash-success {
    animation: chipGlowGreen 0.85s ease;
}

.chip-flash-error {
    animation: chipGlowRed 0.85s ease;
}

.chip-flash-clear {
    animation: chipGlowBlue 0.85s ease;
}

@keyframes chipGlowGreen {
    0% { box-shadow: 0 0 0 rgba(24, 160, 88, 0); }
    40% { box-shadow: 0 0 0 3px rgba(24, 160, 88, 0.45); }
    100% { box-shadow: 0 0 0 rgba(24, 160, 88, 0); }
}

@keyframes chipGlowRed {
    0% { box-shadow: 0 0 0 rgba(208, 64, 64, 0); }
    40% { box-shadow: 0 0 0 3px rgba(208, 64, 64, 0.45); }
    100% { box-shadow: 0 0 0 rgba(208, 64, 64, 0); }
}

@keyframes chipGlowBlue {
    0% { box-shadow: 0 0 0 rgba(42, 108, 245, 0); }
    40% { box-shadow: 0 0 0 3px rgba(42, 108, 245, 0.45); }
    100% { box-shadow: 0 0 0 rgba(42, 108, 245, 0); }
}
