*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0D0D0D;
    --card: #161616;
    --border: #222;
    --text: #E8E8E8;
    --muted: #555;
    --label: #444;
}

html, body {
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    scrollbar-color: var(--scrollbar, #333) transparent;
    scrollbar-width: thin;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar, #333);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar, #333);
    filter: brightness(1.3);
}

.app {
    min-height: 100vh;
    font-family: 'Unbounded', sans-serif;
    padding-bottom: 40px;
    position: relative;
    overflow-x: hidden;
    max-width: 600px;
    margin: 0 auto;
}

/* ── Background effects ── */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 107, 0, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 107, 0, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

.bg-glow {
    position: fixed;
    top: -140px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 320px;
    background: radial-gradient(ellipse, rgba(255, 107, 0, 0.13) 0%, transparent 68%);
    pointer-events: none;
    z-index: 0;
}

/* ── Header ── */
.header {
    position: relative;
    z-index: 1;
    padding: 32px 20px 0;
}

.header-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.28em;
    color: var(--accent);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.header-label::before {
    content: '';
    width: 22px;
    height: 2px;
    background: var(--accent);
    display: inline-block;
    flex-shrink: 0;
}

.header-title {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(20px, 7vw, 32px);
    font-weight: 900;
    letter-spacing: 0.02em;
    line-height: 1.1;
    color: var(--header-color, #fff);
}

.header-divider {
    margin: 18px 20px 0;
    height: 1px;
    background: linear-gradient(90deg, var(--base, #262626) 0%, transparent 80%);
}

/* ── Search ── */
.search-wrap {
    position: relative;
    z-index: 1;
    padding: 16px 16px 0;
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    font-family: 'Unbounded', sans-serif;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.02em;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.search-input::placeholder {
    color: var(--muted);
}

.search-input:focus {
    border-color: var(--accent);
}

/* ── Tabs ── */
.tabs {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 8px;
    padding: 18px 16px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    flex-shrink: 0;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-family: 'Unbounded', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    background: var(--border);
    color: var(--muted);
    transition: all 0.2s;
}

.tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.tab.active .tab-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.tab:not(.active):hover {
    border-color: #333;
    color: var(--text);
}

/* ── Brands ── */
.brands {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 6px;
    padding: 10px 16px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
}

.brands:empty {
    display: none;
}

.brands::-webkit-scrollbar { display: none; }

.brand-btn {
    flex-shrink: 0;
    padding: 7px 14px;
    border: none;
    border-radius: 6px;
    background: var(--border);
    color: var(--muted);
    font-family: 'Unbounded', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.brand-btn.active {
    background: var(--base, #262626);
    color: var(--text);
}

.brand-btn:not(.active):hover {
    color: var(--text);
}

/* ── Loader ── */
.loader {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--muted);
    font-family: 'Unbounded', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    transition: opacity 0.3s;
}

.loader.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ── App content ── */
.app-content {
    opacity: 0;
    transition: opacity 0.3s;
}

.app-content.ready {
    opacity: 1;
}

/* ── Grid ── */
.grid {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 16px 0;
}

.sheet-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Card ── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s cubic-bezier(.22, .8, .36, 1),
                border-color 0.15s,
                box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    opacity: 0;
    transform: translateY(18px);
    display: flex;
    flex-direction: row;
}

.card.visible {
    animation: fadeUp 0.42s cubic-bezier(.22, .8, .36, 1) forwards;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 107, 0, 0.08) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.15s;
    border-radius: inherit;
    z-index: 1;
    pointer-events: none;
}

.card:hover {
    border-color: #333;
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.card.tapped {
    transform: scale(0.97);
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(255, 107, 0, 0.22), inset 0 0 0 1px rgba(255, 107, 0, 0.1);
}

.card.tapped::before { opacity: 1; }

/* Card image */
.card-image {
    width: 120px;
    min-height: 100px;
    flex-shrink: 0;
    overflow: hidden;
    background: #111;
    position: relative;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.card:hover .card-image img {
    transform: scale(1.05);
}

/* Card info */
.card-info {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    justify-content: center;
}

.card-brand {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.card-model-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.card-model {
    font-size: 13px;
    font-weight: 700;
    color: var(--card-name, var(--text));
    line-height: 1.3;
}

/* ── Tags ── */
.card-tags,
.modal-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.modal-tags .tag {
    font-size: 12px;
    padding: 4px 11px;
}

.card-sep {
    height: 1px;
    background: var(--base, #262626);
    margin-bottom: 10px;
}

.price-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.18em;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.card-price {
    font-family: 'Unbounded', sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--card-price, var(--accent));
    line-height: 1;
}

/* ── No data ── */
.no-data {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

/* ── Contact button ── */
.contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid var(--contact, var(--accent));
    border-radius: 10px;
    background: transparent;
    color: var(--contact, var(--accent));
    font-family: 'Unbounded', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.contact-btn:hover {
    background: var(--contact, var(--accent));
    color: #fff;
}

.contact-btn:active {
    transform: scale(0.97);
}

.modal-contact {
    margin-top: 12px;
    width: 100%;
    justify-content: center;
}

/* ── Footer ── */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 28px 16px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.footer-text {
    font-size: 11px;
    color: var(--label);
    letter-spacing: 0.04em;
}

.footer-contact {
    font-size: 11px;
}

/* ── To top ── */
.to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 10px;
    background: var(--top-btn, #CC5500);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.to-top.visible {
    opacity: 1;
    visibility: visible;
}

.to-top:hover {
    filter: brightness(1.15);
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
    -webkit-tap-highlight-color: transparent;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 70vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(.22, .8, .36, 1);
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.modal-image {
    width: 100%;
    background: #111;
    overflow: hidden;
}

.modal-image img {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    display: block;
}

.modal-body {
    padding: 16px 20px;
}

.modal-brand {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.modal-model-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.modal-model {
    font-size: 18px;
    font-weight: 700;
    color: var(--card-name, var(--text));
    line-height: 1.3;
}

.modal-desc {
    font-size: 12px;
    font-weight: 400;
    color: #fff;
    line-height: 1.5;
    margin-bottom: 14px;
    white-space: pre-line;
}

.modal-sep {
    height: 1px;
    background: var(--base, #262626);
    margin-bottom: 10px;
}

.modal-price {
    font-family: 'Unbounded', sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--card-price, var(--accent));
    line-height: 1;
}

/* ── Animations ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (min-width: 420px) {
    .card-image {
        width: 140px;
    }

    .card-model {
        font-size: 14px;
    }

    .card-price {
        font-size: 17px;
    }
}
