*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-card: #151d2e;
    --bg-card-hover: #1a2438;
    --accent-cyan: #00d4ff;
    --accent-purple: #a855f7;
    --accent-green: #22c55e;
    --accent-orange: #f97316;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: rgba(0, 212, 255, 0.15);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    font-size: 18px;
    overflow-x: hidden;
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
}

.bg-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

.bg-glow--left {
    top: -200px;
    left: -200px;
    background: var(--accent-cyan);
}

.bg-glow--right {
    bottom: -200px;
    right: -200px;
    background: var(--accent-purple);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    border-bottom: 1px solid var(--border);
    background: rgba(11, 15, 25, 0.92);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header__bar {
    display: flex;
    align-items: center;
    height: 64px;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 0;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.brand__mark {
    flex-shrink: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent var(--accent-cyan);
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.55));
}

.brand__text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-width: 0;
}

.brand__title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.15;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand__subtitle {
    font-size: 0.8rem;
    line-height: 1.15;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    height: 100%;
}

.nav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 14px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    white-space: nowrap;
    transition: color 0.2s, background 0.2s;
}

.nav__link:hover {
    color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.08);
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
}

.store-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}

.store-switch__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: color 0.2s, background 0.2s;
}

.store-switch__btn:hover {
    color: var(--accent-cyan);
}

.store-switch__btn.is-active {
    color: #041018;
    background: linear-gradient(135deg, var(--accent-cyan), #38bdf8);
}

.toolbar__select,
.toolbar__btn {
    box-sizing: border-box;
    height: 36px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 34px;
    color: var(--text-primary);
    background-color: var(--bg-card);
    vertical-align: middle;
}

.toolbar__select {
    -webkit-appearance: none;
    appearance: none;
    min-width: 148px;
    max-width: 100%;
    padding-right: 34px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px 7px;
}

.toolbar__select:focus,
.toolbar__btn:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.toolbar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 16px;
    line-height: 1;
    color: var(--accent-cyan);
    cursor: pointer;
    background-image: linear-gradient(135deg, rgba(0, 212, 255, 0.18), rgba(168, 85, 247, 0.18));
    transition: background 0.2s;
}

.toolbar__btn:hover {
    background-image: linear-gradient(135deg, rgba(0, 212, 255, 0.28), rgba(168, 85, 247, 0.28));
}

/* Hero / Search */
.hero {
    margin: 28px 0 8px;
    text-align: center;
}

.hero__title {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero__desc {
    color: var(--text-secondary);
    max-width: 720px;
    margin: 0 auto 20px;
    font-size: 1.05rem;
}

.search {
    display: flex;
    gap: 8px;
    max-width: 640px;
    margin: 0 auto;
}

.search__input,
.search__btn {
    box-sizing: border-box;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
}

.search__input {
    flex: 1;
    min-width: 0;
    padding: 0 16px;
    background: var(--bg-card);
    color: var(--text-primary);
}

.search__input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.search__btn {
    flex-shrink: 0;
    padding: 0 20px;
    color: #041018;
    background: linear-gradient(135deg, var(--accent-cyan), #38bdf8);
    cursor: pointer;
}

.search__btn:hover {
    filter: brightness(1.05);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: end;
    margin-top: 16px;
}

.filters__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: left;
}

.filters__field select,
.filters__apply {
    box-sizing: border-box;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--bg-card);
    color: var(--text-primary);
}

.filters__field select {
    min-width: 140px;
    padding: 0 12px;
}

.filters__apply {
    padding: 0 16px;
    color: var(--accent-cyan);
    cursor: pointer;
    background-image: linear-gradient(135deg, rgba(0, 212, 255, 0.18), rgba(168, 85, 247, 0.18));
}

.filters__apply:hover {
    filter: brightness(1.08);
}

.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;
}

.is-hidden,
[hidden] {
    display: none !important;
}

.load-sentinel {
    height: 1px;
    width: 100%;
    margin-top: 8px;
}

.loader {
    text-align: center;
    color: var(--text-muted);
    padding: 16px 0 8px;
    font-size: 0.95rem;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 32px 0;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card--free::before { background: var(--accent-green); }
.stat-card--deals::before { background: var(--accent-orange); }
.stat-card--time::before { background: var(--accent-purple); }

.stat-card__value {
    display: block;
    font-family: var(--font-body);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}

.stat-card__value--small {
    font-size: 1.75rem;
}

.stat-card--free .stat-card__value { color: var(--accent-green); }
.stat-card--deals .stat-card__value { color: var(--accent-orange); }
.stat-card--time .stat-card__value { color: var(--accent-purple); }

.stat-card__label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Sections */
.section {
    margin-bottom: 56px;
}

.section__header {
    margin-bottom: 28px;
}

.section__title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.section__badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 4px;
    letter-spacing: 0.15em;
}

.section__badge--free {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.section__badge--sale {
    background: rgba(249, 115, 22, 0.2);
    color: var(--accent-orange);
    border: 1px solid rgba(249, 115, 22, 0.4);
}

.section__desc {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Games grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.25s ease;
}

.game-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(0, 212, 255, 0.35);
    transform: translateY(-4px);
    box-shadow: var(--shadow), 0 0 24px rgba(0, 212, 255, 0.1);
}

.game-card__link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.game-card__image-wrap {
    position: relative;
    aspect-ratio: 460 / 215;
    overflow: hidden;
    background: var(--bg-secondary);
}

.game-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.game-card:hover .game-card__image {
    transform: scale(1.05);
}

.game-card__placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
}

.game-card__discount {
    position: absolute;
    top: 12px;
    right: 12px;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(249, 115, 22, 0.9);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.game-card__discount--free {
    background: rgba(34, 197, 94, 0.9);
}

.game-card__body {
    padding: 16px;
}

.game-card__title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.game-card__prices {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
}

.game-card__price-old {
    color: var(--text-muted);
    text-decoration: line-through;
    font-size: 0.95rem;
}

.game-card__price-new {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.game-card__rating {
    font-size: 0.85rem;
    color: var(--accent-green);
    margin-top: 4px;
}

.game-card__expires {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.empty-state__icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto;
}

.empty-state__hint {
    margin-top: 8px !important;
    font-size: 0.9rem;
    color: var(--text-muted) !important;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    margin-top: 64px;
    padding: 32px 0;
    background: rgba(11, 15, 25, 0.5);
}

.footer__inner {
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.footer a {
    color: var(--accent-cyan);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer__note {
    font-size: 0.8rem !important;
}

/* Game page */
.game-page {
    padding-top: 24px;
    padding-bottom: 48px;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
}

.back-link:hover {
    color: var(--accent-cyan);
}

.game-hero {
    display: grid;
    grid-template-columns: minmax(220px, 420px) 1fr;
    gap: 24px;
    align-items: start;
    margin-bottom: 28px;
}

.game-hero__image {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: block;
}

.game-hero__title {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3vw, 2rem);
    margin-bottom: 12px;
    line-height: 1.2;
}

.game-hero__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge--low {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.game-hero__prices {
    margin-bottom: 12px;
}

.game-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-family: var(--font-body);
    border: 1px solid var(--border);
}

.btn--primary {
    color: #041018;
    background: linear-gradient(135deg, var(--accent-cyan), #38bdf8);
    border-color: transparent;
}

.btn--ghost {
    color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.08);
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
}

.panel__title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.panel__text {
    color: var(--text-secondary);
}

.panel__hint {
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.table-wrap {
    overflow-x: auto;
}

.price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.price-table th,
.price-table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.price-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
}

.price-table a {
    color: var(--accent-cyan);
    text-decoration: none;
}

.price-table a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 900px) {
    .header__bar {
        height: auto;
        min-height: 64px;
        padding: 12px 0;
        flex-wrap: wrap;
        row-gap: 10px;
    }

    .brand {
        flex: 1 1 auto;
    }

    .toolbar {
        flex: 0 0 auto;
        margin-left: auto;
    }

    .nav {
        flex: 1 1 100%;
        height: auto;
        order: 3;
    }
}

@media (max-width: 640px) {
    .header__bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .brand,
    .nav,
    .toolbar {
        flex: none;
        width: 100%;
        margin-left: 0;
    }

    .nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nav::-webkit-scrollbar {
        display: none;
    }

    .toolbar {
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .store-switch {
        width: 100%;
    }

    .store-switch__btn {
        flex: 1;
    }

    .toolbar__select {
        flex: 1;
        min-width: 0;
    }

    .brand__title {
        font-size: 1.1rem;
    }

    .search {
        flex-direction: column;
    }

    .search__btn {
        width: 100%;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filters__field select,
    .filters__apply {
        width: 100%;
    }

    .game-hero {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .stat-card__value {
        font-size: 2rem;
    }

    body {
        font-size: 16px;
    }

    .games-grid {
        grid-template-columns: 1fr;
    }

    .section__title {
        font-size: 1.2rem;
        flex-wrap: wrap;
    }
}
