* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #2c3e50;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 40px 20px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

#products-screen.active {
    align-items: flex-start;
    padding-top: 20px;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Начальная страница */
#start-screen {
    text-align: center;
}

#start-screen h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: #2c3e50;
    letter-spacing: -0.5px;
}

.description {
    font-size: 1.35rem;
/*    line-height: 1.8;*/
/*    color: #5a6c7d;*/
    color: black;
    max-width: 600px;
    margin: 0 auto 40px;
}

/* Кнопки */
.btn {
    padding: 16px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #ffffff;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 12px 30px;
    font-size: 1rem;
}

.btn-secondary:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Шапка магазина */
.shop-header {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
    padding: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.shop-header h2 {
    font-size: 2rem;
    color: #2c3e50;
    margin: 0;
}

.shop-header > div:first-of-type {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.finish-btn-container {
    display: flex;
    justify-content: center;
    width: 100%;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.cart-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: #f8f9fa;
    border-radius: 12px;
    color: #667eea;
}

.cart-icon span {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.cart-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.cart-total-label {
    font-size: 0.85rem;
    color: #5a6c7d;
    font-weight: 500;
}

.cart-total-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: #667eea;
}

/* Сетка товаров */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Карточка товара */
.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.product-image {
    width: 100%;
    height: 280px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-info .cart-toggle-btn,
.product-info .add-to-cart-btn {
    margin-top: auto;
}

.product-name,
.product-name-link {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
    line-height: 1.4;
    min-height: 2.8em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
}

.product-name-link {
    color: #667eea;
    transition: color 0.3s ease;
}

.product-name-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 16px;
}

.cart-toggle-btn,
.add-to-cart-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-toggle-btn:hover,
.add-to-cart-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.cart-toggle-btn:active,
.add-to-cart-btn:active {
    transform: scale(0.98);
}

.cart-toggle-btn.added,
.add-to-cart-btn.added {
    animation: pulse 0.5s ease;
}

.cart-toggle-btn.in-cart,
.add-to-cart-btn.in-cart {
    background: #dc3545;
}

.cart-toggle-btn.in-cart:hover,
.add-to-cart-btn.in-cart:hover {
    background: #c82333;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Прогресс-бар */
.progress-bar-container {
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 30px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.progress-bar-container:hover {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

.progress-bar-wrapper {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: width 0.4s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-size: 0.95rem;
    color: #5a6c7d;
    margin: 0;
}

/* Страница результата */
#result-screen {
    text-align: center;
}

#result-screen h1 {
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: #2c3e50;
}

.result-content {
    background: white;
    border-radius: 20px;
    padding: 60px 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.result-image {
    width: 200px;
    height: 200px;
    margin: 0 auto 30px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-name {
    font-size: 3rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 20px;
}

.result-description {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #5a6c7d;
}

.share-section {
    margin-top: 40px;
    text-align: center;
}

.share-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5a6c7d;
    margin-bottom: 18px;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    color: #ffffff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    min-width: 180px;
}

.share-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
    filter: brightness(1.05);
}

.share-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.share-btn-vk {
    background: linear-gradient(135deg, #4a76a8 0%, #35618c 100%);
}

.share-btn-telegram {
    background: linear-gradient(135deg, #2aabee 0%, #1d8fd2 100%);
}

.receipt-section {
    margin-top: 32px;
}

.receipt-details {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    box-shadow: 0 16px 35px rgba(102, 126, 234, 0.12);
    padding: 0;
    border: 1px solid rgba(102, 126, 234, 0.15);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.receipt-details[open] {
    box-shadow: 0 20px 45px rgba(102, 126, 234, 0.18);
    transform: translateY(-2px);
}

.receipt-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    list-style: none;
    cursor: pointer;
    padding: 18px 56px 18px 24px;
    font-weight: 600;
    font-size: 1.05rem;
    color: #2c3e50;
    position: relative;
}

.receipt-summary::marker {
    display: none;
}

.receipt-summary::after {
    content: '';
    width: 10px;
    height: 10px;
    border-right: 2px solid #667eea;
    border-bottom: 2px solid #667eea;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    position: absolute;
    right: 26px;
}

.receipt-details[open] .receipt-summary::after {
    transform: rotate(-135deg);
}

.receipt-summary-title {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
    color: #667eea;
}

.receipt-summary-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #5a6c7d;
    font-size: 0.95rem;
}

.receipt-summary-separator {
    opacity: 0.4;
}

.receipt-content {
    padding: 0 24px 24px;
}

.receipt-paper {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px 20px 28px;
    position: relative;
    overflow: hidden;
}

.receipt-paper::before,
.receipt-paper::after {
    content: '';
    position: absolute;
    left: 10px;
    right: 10px;
    height: 6px;
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 10px,
        rgba(102, 126, 234, 0.2) 10px,
        rgba(102, 126, 234, 0.2) 20px
    );
}

.receipt-paper::before {
    top: 0;
}

.receipt-paper::after {
    bottom: 0;
}

.receipt-paper-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #99a8ba;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.receipt-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 0;
    border-top: 1px dashed rgba(102, 126, 234, 0.3);
    border-bottom: 1px dashed rgba(102, 126, 234, 0.3);
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 0.95rem;
    color: #2c3e50;
}

.receipt-item-name {
    flex: 1;
    text-align: left;
}

.receipt-item-price {
    text-align: right;
    font-weight: 600;
    color: #667eea;
    min-width: 120px;
}

.receipt-total-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
}

.receipt-empty {
    padding: 24px;
    text-align: center;
    color: #5a6c7d;
    font-size: 0.95rem;
}

/* Анимация летящего товара */
.flying-cart {
    position: fixed;
    width: 60px;
    height: 60px;
    background: #667eea;
    border-radius: 50%;
    display: none;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.6);
}

.flying-cart.active {
    display: block;
}

/* Адаптивность */
@media (max-width: 768px) {
    .shop-header {
        gap: 15px;
    }

    .shop-header > div:first-of-type {
        flex-direction: column;
        gap: 15px;
    }

    .shop-header h2 {
        font-size: 1.5rem;
        text-align: center;
    }

    .cart-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        width: 100%;
    }

    .cart-total {
        align-items: center;
    }

    .cart-total-label {
        font-size: 0.8rem;
    }

    .cart-total-amount {
        font-size: 1.1rem;
    }

    .finish-btn-container {
        padding-top: 15px;
    }

    #start-screen h1 {
        font-size: 2rem;
    }

    .description {
        font-size: 1rem;
    }

    .container {
        padding: 0 10px;
    }

    .screen {
        padding: 20px 10px;
    }

    .product-image {
        height: 220px;
        font-size: 2.5rem;
    }

    .product-info {
        padding: 16px;
    }

    .product-name,
    .product-name-link {
        font-size: 1rem;
    }

    .product-price {
        font-size: 1.3rem;
    }

    .btn {
        padding: 14px 30px;
        font-size: 1rem;
    }

    .result-content {
        padding: 40px 20px;
    }

    .result-name {
        font-size: 2rem;
    }

    .result-description {
        font-size: 1rem;
    }

    .share-btn {
        min-width: 160px;
        width: 100%;
        max-width: 240px;
    }
}

@media (max-width: 480px) {
    #start-screen h1 {
        font-size: 1.75rem;
    }

    .description {
        font-size: 0.9rem;
    }

    .shop-header {
        padding: 16px;
    }

    .shop-header h2 {
        font-size: 1.25rem;
    }

    .cart-icon {
        width: 45px;
        height: 45px;
    }

    .cart-total-label {
        font-size: 0.75rem;
    }

    .cart-total-amount {
        font-size: 1rem;
    }

    .btn-secondary {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .progress-bar-container {
        padding: 16px;
    }

    .progress-text {
        font-size: 0.85rem;
    }

    .product-image {
        height: 140px;
        font-size: 1.5rem;
    }

    .product-info {
        padding: 12px;
    }

    .product-name,
    .product-name-link {
        font-size: 0.9rem;
        margin-bottom: 8px;
        min-height: 2.4em;
    }

    .product-price {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }

    .cart-toggle-btn,
    .add-to-cart-btn {
        padding: 10px;
        font-size: 0.9rem;
        min-height: 40px;
    }

    .result-content {
        padding: 30px 16px;
    }

    .result-name {
        font-size: 1.75rem;
    }

    .share-btn {
        width: 100%;
        max-width: none;
    }

    .receipt-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 16px 48px 16px 20px;
    }

    .receipt-summary-meta {
        font-size: 0.85rem;
    }

    .receipt-content {
        padding: 0 16px 20px;
    }

    .receipt-paper {
        padding: 20px 16px 24px;
    }

    .receipt-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .receipt-item-price {
        min-width: auto;
    }
}

