@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700&display=swap');

:root {
    --bg: #0a101b;
    --card: #121b2a;
    --card-soft: #0f1726;
    --text: #f0f4ff;
    --muted: #98a9c7;
    --accent: #f59a67;
    --accent-2: #34b9b1;
    --border: rgba(150, 171, 205, 0.24);
    --nav-bg: rgba(9, 14, 24, 0.86);
    --shadow: 0 16px 34px rgba(1, 7, 20, 0.42);
    --radius: 14px;
    --list-nav-height: 70px;
    --list-search-height: 72px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: 'Outfit', sans-serif;
    color-scheme: dark;
    background:
        radial-gradient(circle at 8% 8%, rgba(245, 154, 103, 0.12), transparent 38%),
        radial-gradient(circle at 92% 2%, rgba(52, 185, 177, 0.1), transparent 34%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

input,
textarea {
    -webkit-user-select: text;
    user-select: text;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 13px 18px;
    box-shadow: 0 6px 22px rgba(1, 7, 20, 0.36);
}

.nav-inner {
    width: min(1100px, 96%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
}

.nav-left {
    justify-self: start;
}

.nav-right {
    justify-self: end;
}

.nav-spacer {
    min-height: 1px;
}

.brand-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-self: center;
    text-align: center;
    text-decoration: none;
}

.brand {
    font-size: clamp(1.06rem, 4.5vw, 1.36rem);
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.4px;
    color: var(--text);
    text-decoration: none;
    line-height: 1.1;
}

.nav-category {
    margin-top: 3px;
    font-size: 0.76rem;
    color: var(--muted);
    font-weight: 600;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-link {
    color: inherit;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    border: 1px solid var(--border);
    background: rgba(17, 26, 43, 0.96);
    border-radius: 12px;
    padding: 9px 12px;
    min-height: 42px;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.back-btn:hover,
.back-btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(1, 7, 20, 0.5);
}

.back-icon {
    font-size: 1rem;
    line-height: 1;
}

.container {
    flex: 1 0 auto;
    width: min(1100px, 93%);
    margin: 20px auto 44px;
}

.site-footer {
    flex-shrink: 0;
    width: 100%;
    padding: 0 0 10px;
}

.home-credit {
    margin: 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.86rem;
    letter-spacing: 0.2px;
}

.hero {
    margin: 8px 0 20px;
    animation: rise 550ms ease-out;
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.6rem, 7vw, 2.7rem);
    line-height: 1.16;
    letter-spacing: -0.02em;
}

.hero p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: clamp(0.96rem, 3.6vw, 1.08rem);
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.card {
    background: linear-gradient(165deg, var(--card) 0%, var(--card-soft) 100%);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transform: translateY(14px);
    opacity: 0;
    animation: reveal 550ms ease-out forwards;
    min-height: 232px;
}

.card:nth-child(2) { animation-delay: 80ms; }
.card:nth-child(3) { animation-delay: 140ms; }
.card:nth-child(4) { animation-delay: 200ms; }

.card img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    object-position: center;
    background: #ffffff;
    padding: 6px;
    display: block;
}

.card h2 {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.3;
    text-align: center;
}

.card-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-meta {
    margin: 8px 0 0;
    font-size: 0.78rem;
    letter-spacing: 0.3px;
    color: var(--meta-text, #0e1b2d);
    background: linear-gradient(120deg, var(--meta-a, #f7d06f), var(--meta-b, #f59a67));
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    text-transform: none;
    text-align: center;
    box-shadow: 0 6px 14px rgba(1, 7, 20, 0.26);
}

.card-meta-compact {
    transform: scale(1.04);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3), 0 8px 16px rgba(1, 7, 20, 0.3);
}

.card:hover,
.card:focus-visible {
    transform: translateY(-3px);
    transition: transform 220ms ease;
    box-shadow: 0 22px 42px rgba(1, 7, 20, 0.52);
    border-color: rgba(155, 176, 211, 0.45);
}

.card:active {
    transform: scale(0.995);
}

.list-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    align-items: center;
    margin-bottom: 14px;
    background: linear-gradient(165deg, var(--card) 0%, var(--card-soft) 100%);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    animation: rise 550ms ease-out;
}

.list-page.list-has-search .list-header {
    animation: none;
    position: fixed;
    top: calc(var(--list-nav-height) - 1px);
    left: 0;
    right: 0;
    width: 100%;
    z-index: 7;
    margin: 0;
    border-top: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
}

.list-page.list-has-search .container {
    margin-top: 0;
    padding-top: calc(var(--list-nav-height) + var(--list-search-height) + 20px);
}

.list-page.list-has-search .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 8;
}

.thumb-search {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid rgba(150, 171, 205, 0.2);
}

.list-page.list-has-search .list-header .thumb-search {
    width: min(1100px, 93%);
    margin: 0 auto;
    border-bottom: 0;
}

.category-thumb {
    width: 84px;
    height: 84px;
    border-radius: 12px;
    object-fit: cover;
    display: block;
    border: 1px solid var(--border);
}

.search-input {
    width: auto;
    flex: 1;
    margin-top: 0;
    min-height: 42px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
}

.search-input::placeholder {
    color: var(--muted);
}

.search-input:focus {
    outline: none;
    border-color: rgba(25, 199, 181, 0.78);
    box-shadow: 0 0 0 3px rgba(25, 199, 181, 0.16);
}

.list-header div {
    padding: 14px 14px 16px;
}

.list-header h1 {
    margin: 0;
    font-size: clamp(1.25rem, 5.6vw, 2rem);
    line-height: 1.24;
}

.list-header p {
    color: var(--muted);
    margin: 8px 0 0;
}

.list-box {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: 0;
    padding: 0;
    animation: rise 550ms ease-out;
}

.list-box ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.list-box li {
    padding: 12px 14px;
    font-size: 1rem;
    line-height: 1.48;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 11px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.no-results {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 0.94rem;
}

.search-highlight {
    background: #ffe45e;
    color: #2f2200;
    border-radius: 4px;
    padding: 0 2px;
}

.btn {
    display: inline-block;
    margin-top: 12px;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #fff;
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 600;
    min-height: 44px;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f5f7fb;
        --card: #ffffff;
        --card-soft: #f8fbff;
        --text: #102a43;
        --muted: #486581;
        --accent: #ff7a59;
        --accent-2: #00a8a8;
        --border: rgba(72, 101, 129, 0.28);
        --nav-bg: rgba(255, 255, 255, 0.92);
        --shadow: 0 12px 30px rgba(16, 42, 67, 0.12);
    }

    body {
        color-scheme: light;
        background:
            radial-gradient(circle at 10% 10%, rgba(255, 122, 89, 0.2), transparent 40%),
            radial-gradient(circle at 90% 0%, rgba(0, 168, 168, 0.15), transparent 30%),
            var(--bg);
    }

    .navbar {
        box-shadow: 0 4px 20px rgba(16, 42, 67, 0.08);
    }

    .back-btn {
        background: #fff;
    }

    .search-input {
        background: #fff;
    }

    .back-btn:hover,
    .back-btn:focus-visible {
        box-shadow: 0 8px 18px rgba(16, 42, 67, 0.14);
    }

    .card:hover,
    .card:focus-visible {
        box-shadow: 0 16px 34px rgba(16, 42, 67, 0.18);
    }

    .list-box li {
        background: linear-gradient(160deg, #ffffff, #f7fbff);
    }
}

@keyframes reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 760px) {
    .nav-inner {
        width: 100%;
        grid-template-columns: 1fr auto 1fr;
        gap: 8px;
    }

    .nav-right {
        display: block;
    }

    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 11px;
    }

    .grid .card:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .container {
        width: min(640px, 92%);
    }

    .navbar {
        padding: 11px 14px;
    }

    .list-page.list-has-search {
        --list-nav-height: 62px;
    }

    .back-btn {
        padding: 8px 10px;
        min-height: 40px;
        border-radius: 10px;
    }

    .thumb-search {
        padding: 10px;
        gap: 10px;
    }

    .category-thumb {
        width: 72px;
        height: 72px;
    }

    .card {
        border-radius: 14px;
        min-height: 198px;
    }

    .card img {
        height: 118px;
        padding: 5px;
    }

    .card h2 {
        font-size: 0.95rem;
    }

    .card-content {
        padding: 10px;
    }

    .card-meta {
        font-size: 0.78rem;
        margin-top: 5px;
    }

    .list-box {
        border-radius: 0;
        padding: 0;
    }

    .list-page.list-has-search .list-header {
    }

    .list-page.list-has-search .container {
        padding-top: calc(var(--list-nav-height) + var(--list-search-height) + 16px);
    }

    .nav-category {
        max-width: 160px;
    }

    .list-page.list-has-search .list-header .thumb-search {
        width: min(640px, 92%);
    }
}

@media (max-width: 420px) {
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .category-thumb {
        width: 62px;
        height: 62px;
    }

    .search-input {
        min-height: 40px;
        padding: 9px 10px;
    }

    .card {
        min-height: 186px;
    }

    .card img {
        height: 104px;
    }
}

@media (min-width: 761px) {
    .grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 18px;
    }

    .list-header {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .thumb-search {
        border-bottom: 0;
        border-right: 0;
        min-height: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .back-btn {
        transition: none;
    }

    .hero,
    .card,
    .list-header,
    .list-box {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
