:root {
    --bg-0: #f3efe7;
    --bg-1: #e7ecf4;
    --panel: rgba(255, 255, 255, 0.82);
    --panel-strong: #ffffff;
    --text: #142033;
    --muted: #64748b;
    --accent: #1f6feb;
    --accent-2: #16a34a;
    --danger: #e24a43;
    --ring: rgba(31, 111, 235, 0.14);
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.16);
    --shadow-md: 0 10px 24px rgba(15, 23, 42, 0.10);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

body {
    font-family: "Gill Sans", "Trebuchet MS", "Segoe UI", sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(31, 111, 235, 0.14), transparent 30%),
        radial-gradient(circle at top right, rgba(22, 163, 74, 0.11), transparent 26%),
        linear-gradient(180deg, var(--bg-0), var(--bg-1));
    min-height: 100vh;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0.75rem 0.75rem 1.25rem;
}

h1 {
    color: #2c3e50;
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    /* Reduced from 1.5rem to make it twice as small */
    margin-top: 0.5rem;
    /* Add a small top margin */
}

/* Greeting styles */
.greeting {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    min-height: 30px;
}

.user-greeting {
    color: #3498db;
}

.telegram-invite {
    color: #7f8c8d;
}

.telegram-invite a {
    color: #2980b9;
    text-decoration: none;
    font-weight: bold;
}

.telegram-invite a:hover {
    text-decoration: underline;
}

.username {
    font-weight: bold;
}

.instructions {
    background-color: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.instructions h2 {
    color: #3498db;
    margin-top: 0;
}

.instructions ul {
    padding-left: 1.5rem;
}

.instructions li {
    margin-bottom: 0.5rem;
}

.swipe-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

.word-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.88));
    height: auto;
    min-height: 520px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    position: relative;
    transition: transform 0.5s ease, box-shadow 0.3s ease;
    cursor: grab;
    user-select: none;
    overflow: hidden;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.word-card:active {
    cursor: grabbing;
}

.word-content {
    text-align: left;
    padding: 0.9rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.car-image {
    width: 100%;
    height: 320px;
    overflow: hidden;
    position: relative;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.04), rgba(31, 111, 235, 0.05));
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.car-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, filter 0.3s ease;
    display: block;
    filter: saturate(1.02) contrast(1.02);
}

/* Image navigation styling */
.image-nav {
    position: absolute;
    top: 0;
    width: 40%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    opacity: 0;
    transition: opacity 0.3s;
    cursor: pointer;
    z-index: 2;
}

.image-nav i {
    background-color: rgba(15, 23, 42, 0.52);
    border-radius: 50%;
    padding: 12px;
    font-size: 14px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
}

.car-image:hover .image-nav {
    opacity: 1;
}

.left-nav {
    left: 0;
    text-align: left;
    padding-left: 10px;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.3), transparent);
}

.right-nav {
    right: 0;
    text-align: right;
    padding-right: 10px;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.3), transparent);
}

.image-counter {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background-color: rgba(15, 23, 42, 0.65);
    color: white;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.03em;
    display: none;
}

#candidate-word {
    font-size: 1.55rem;
    margin: 0;
    color: var(--text);
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.02em;
}

#candidate-word a {
    color: inherit;
    text-decoration: none;
    border-bottom: none;
    -webkit-tap-highlight-color: transparent;
}

#candidate-word a:hover {
    color: inherit;
    text-decoration: none;
}

.car-details {
    display: grid;
    gap: 0.45rem;
    text-align: left;
    padding: 0;
    margin-top: -0.1rem;
}

.car-price {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--accent);
    margin: 0;
    padding: 0.2rem 0.85rem;
    border-radius: 999px;
    background: rgba(31, 111, 235, 0.09);
}

.car-specs {
    font-size: 0.93rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
}

.car-location {
    font-size: 0.92rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
}

.word-id {
    color: #94a3b8;
    font-size: 0.82rem;
    margin: 0;
    align-self: flex-start;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.swipe-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

.swipe-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-size: 1.35rem;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow-md);
}

.swipe-btn:hover {
    transform: translateY(-2px) scale(1.04);
}

.dislike {
    background: linear-gradient(180deg, #ef6b61, var(--danger));
    color: white;
}

.dislike:hover {
    background: linear-gradient(180deg, #f06e66, #c83830);
}

.like {
    background: linear-gradient(180deg, #2dd17c, var(--accent-2));
    color: white;
}

.like:hover {
    background: linear-gradient(180deg, #30d982, #149447);
}

.share {
    background: linear-gradient(180deg, #4aa6ea, var(--accent));
    color: white;
}

.share:hover {
    background: linear-gradient(180deg, #4aabf2, #155ed4);
}

.favorites {
    background: linear-gradient(180deg, #f8d95c, #e8b700);
    color: #1f2937;
}

.favorites:hover {
    background: linear-gradient(180deg, #fbe06f, #d9a900);
}

.feedback-message {
    text-align: center;
    margin-top: 1rem;
    min-height: 24px;
    font-size: 1rem;
    color: var(--muted);
}

.liked {
    color: #2ecc71;
    font-weight: bold;
}

.disliked {
    color: #e74c3c;
    font-weight: bold;
}

.shared {
    color: #3498db;
    font-weight: bold;
}

/* Card animations */
.card-entrance {
    animation: cardEntrance 0.5s ease;
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(25px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Flash animations for swipes */
.flash-red {
    animation: flashRed 0.3s ease;
}

.flash-green {
    animation: flashGreen 0.3s ease;
}

@keyframes flashRed {
    0% {
        background-color: #fff;
    }

    50% {
        background-color: rgba(231, 76, 60, 0.7);
        /* Red with transparency */
    }

    100% {
        background-color: #fff;
    }
}

@keyframes flashGreen {
    0% {
        background-color: #fff;
    }

    50% {
        background-color: rgba(46, 204, 113, 0.7);
        /* Green with transparency */
    }

    100% {
        background-color: #fff;
    }
}

.swiped-left {
    transform: translateX(-150%) rotate(-20deg);
    opacity: 0;
}

.swiped-right {
    transform: translateX(150%) rotate(20deg);
    opacity: 0;
}

/* Filter controls styles */
.filter-controls {
    margin-bottom: 20px;
    width: 100%;
    max-width: 600px;
    position: relative;
}

.toggle-filters-btn {
    width: 100%;
    max-width: 440px;
    /* Same as swipe-card max-width */
    height: auto;
    padding: 12px 0;
    margin: 0 auto 15px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    transition: transform 0.2s ease, background-color 0.3s ease;
    background: linear-gradient(180deg, #4aa6ea, var(--accent));
    color: white;
    box-shadow: var(--shadow-md);
}

.toggle-filters-btn:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #4caef3, #1458c9);
}

.toggle-filters-btn i {
    font-size: 1.2rem;
}

.filters-panel {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 22px;
    padding: 18px 16px 16px;
    margin-bottom: 15px;
    display: none;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.filters-panel.show {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

.filter-group {
    margin-bottom: 16px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

.price-range,
.year-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-select {
    padding: 11px 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    background-color: rgba(255, 255, 255, 0.92);
    flex: 1;
    color: var(--text);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.excluded-fuels {
    display: flex;
    gap: 18px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.apply-filters-btn,
.reset-filters-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: transform 0.2s ease, background-color 0.3s ease, box-shadow 0.2s ease;
}

.apply-filters-btn {
    background: linear-gradient(180deg, #2dd17c, var(--accent-2));
    color: white;
    box-shadow: 0 10px 20px rgba(22, 163, 74, 0.18);
}

.apply-filters-btn:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #33d980, #158f45);
}

.reset-filters-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.22);
    color: var(--text);
}

.reset-filters-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 1);
}

.filter-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.filter-error.show {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Media queries for responsiveness */
@media (max-width: 480px) {
    .container {
        padding: 0.8rem 0.65rem 1rem;
    }

    #candidate-word {
        font-size: 1.22rem;
    }

    .word-card {
        min-height: 490px;
        border-radius: 24px;
    }

    .car-image {
        height: 240px;
    }

    .swipe-btn {
        width: 52px;
        height: 52px;
    }

    .filters-panel {
        padding: 16px 12px 14px;
        border-radius: 20px;
    }

    .price-range,
    .year-range {
        gap: 8px;
    }

    .filter-select {
        padding: 10px 11px;
    }

    .word-content {
        padding: 0.8rem;
    }

    .swipe-actions {
        gap: 0.8rem;
    }
}
