:root {
    --bg: #f4f6f8;
    --fg: #17202a;
    --accent: #2e7d32;
    --accent-2: #43a047;
    --muted: #5f6b76;
    --card-bg: #ffffff;
    --chip-bg: #edf1f4;
    --border: #dbe2e8;
    --notice-bg: #fff3cd;
    --notice-fg: #664d03;
    --shadow: 0 10px 30px rgba(23, 32, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1417;
        --fg: #edf1f4;
        --accent: #4caf50;
        --accent-2: #66bb6a;
        --muted: #98a4ae;
        --card-bg: #171f24;
        --chip-bg: #1f2930;
        --border: #2b363e;
        --notice-bg: #3a3115;
        --notice-fg: #ffd970;
        --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    }
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--bg)), var(--bg) 320px);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 18px;
    line-height: 1.45;
}

main {
    max-width: 480px;
    margin: 24px auto 24px;
    padding: 28px 20px 32px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    animation: card-in 0.45s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@media (max-width: 520px) {
    main {
        margin: 12px 12px 24px;
        padding: 24px 18px 28px;
    }
}

h1 {
    font-size: 1.5em;
    margin: 0 0 0.6em;
    letter-spacing: -0.01em;
    animation: rise 0.4s 0.05s ease both;
}

p {
    color: var(--muted);
    margin: 0.4em 0 1em;
}

/* --- страница товара --- */

.notice {
    padding: 12px 16px;
    margin: 0 0 16px;
    border-radius: 12px;
    border-left: 4px solid var(--notice-fg);
    background: var(--notice-bg);
    color: var(--notice-fg);
    animation: rise 0.45s 0.1s ease both;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 16px;
    animation: rise 0.45s 0.15s ease both;
}

.chip {
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--fg);
    border: 1px solid var(--border);
    font: inherit;
    font-size: 0.95em;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.chip:active {
    transform: scale(0.95);
}

.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    animation: chip-pop 0.25s ease;
}

form > p {
    animation: rise 0.45s 0.12s ease both;
}

input[type="text"] {
    display: block;
    width: 100%;
    padding: 14px 16px;
    margin: 0 0 16px;
    font: inherit;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--fg);
    transition: border-color 0.2s, box-shadow 0.2s;
    animation: rise 0.45s 0.2s ease both;
}

input[type="text"]::placeholder {
    color: var(--muted);
    opacity: 0.8;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

button[type="submit"], .btn {
    display: block;
    width: 100%;
    padding: 16px;
    margin: 6px 0 0;
    font: inherit;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
    transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
    animation: fade-in 0.5s 0.25s ease both;
}

button[type="submit"]:hover, .btn:hover {
    filter: brightness(1.05);
}

button[type="submit"]:active, .btn:active {
    transform: translateY(1px) scale(0.985);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* --- экран успеха --- */

.order-result {
    text-align: center;
}

.order-result h1 {
    font-size: 1.3em;
}

.success-icon {
    width: 88px;
    height: 88px;
    margin: 8px auto 16px;
}

.success-icon svg {
    width: 100%;
    height: 100%;
}

.success-icon circle {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-dasharray: 152;
    stroke-dashoffset: 152;
    transform: rotate(-90deg);
    transform-origin: center;
    animation: draw 0.6s ease forwards;
}

.success-icon path {
    fill: none;
    stroke: var(--accent);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 36;
    stroke-dashoffset: 36;
    animation: draw 0.35s 0.55s ease forwards;
}

/* --- заглушки (главная, 404, 410) --- */

.stub {
    text-align: center;
    padding-top: 44px;
    padding-bottom: 48px;
}

.stub-emoji {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 12px;
    animation: rise 0.45s ease both;
}

.stub h1 {
    font-size: 1.7em;
}

/* --- анимации --- */

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

@keyframes chip-pop {
    50% {
        transform: scale(1.08);
    }
}

@keyframes draw {
    to {
        stroke-dashoffset: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
    }
}
