:root {
    --bg: #0b0c10;
    --bg-elev: #11131a;
    --surface: rgba(17, 19, 26, .86);
    --surface-2: rgba(15, 17, 23, .72);
    --surface-solid: #12141c;
    --text: #e9ecf1;
    --text-soft: #c9cfda;
    --muted: #8f98a9;
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .14);
    --accent: #6ee7ff;
    --accent-2: #a78bfa;
    --accent-ink: #061218;
    --accent-soft: rgba(110, 231, 255, .12);
    --accent-line: rgba(110, 231, 255, .3);
    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, .12);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, .12);
    --danger: #ff5c7a;
    --danger-soft: rgba(255, 92, 122, .12);
    --wa: #25d366;
    --ring: 0 0 0 3px rgba(110, 231, 255, .28);
    --shadow-sm: 0 6px 18px rgba(0, 0, 0, .22);
    --shadow: 0 14px 40px rgba(0, 0, 0, .34);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, .45);
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --max: 1120px;
    --topbar-h: 64px;
    --ease: cubic-bezier(.2, .8, .2, 1);
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color-scheme: dark;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--topbar-h) + 16px);
}

html.no-scroll,
html.no-scroll body {
    overflow: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(1000px 520px at 50% -12%, rgba(110, 231, 255, .13), transparent 62%),
        radial-gradient(700px 480px at -12% 8%, rgba(167, 139, 250, .1), transparent 60%),
        radial-gradient(700px 480px at 112% 22%, rgba(110, 231, 255, .07), transparent 60%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

main {
    flex: 1 0 auto;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.2;
}

:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

::selection {
    background: rgba(110, 231, 255, .3);
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 100;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
    transition: top 160ms ease;
}

.skip-link:focus {
    top: 12px;
}

.icon {
    flex: 0 0 auto;
}

.container {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 16px 16px 40px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    padding-top: env(safe-area-inset-top);
    background: rgba(11, 12, 16, .72);
    backdrop-filter: saturate(160%) blur(16px);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    max-width: var(--max);
    margin: 0 auto;
    min-height: var(--topbar-h);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-title {
    flex: 1;
    min-width: 0;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.brand-logo {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-title {
    font-weight: 800;
    font-size: 17px;
    letter-spacing: .2px;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .2px;
    white-space: nowrap;
    user-select: none;
    transition: transform 140ms var(--ease), background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.btn:hover:not(:disabled) {
    border-color: var(--accent-line);
    background: rgba(255, 255, 255, .07);
}

.btn:active:not(:disabled) {
    transform: scale(.98);
}

.btn:disabled,
.btn.is-disabled {
    opacity: .5;
    pointer-events: none;
}

.btn-primary {
    border-color: transparent;
    background: linear-gradient(100deg, var(--accent), #8fb8ff 55%, var(--accent-2));
    color: var(--accent-ink);
    box-shadow: 0 10px 26px rgba(110, 231, 255, .18);
}

.btn-primary:hover:not(:disabled) {
    border-color: transparent;
    background: linear-gradient(100deg, #8cedff, #a5c6ff 55%, #b9a2fb);
    box-shadow: 0 14px 32px rgba(110, 231, 255, .26);
}

.btn-ghost {
    background: transparent;
}

.btn-danger {
    border-color: transparent;
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    border-color: transparent;
    background: #ff7690;
}

.btn-sm {
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 10px;
}

.btn-block {
    width: 100%;
}

.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--accent-ink);
    border-right-color: transparent;
    animation: spin 700ms linear infinite;
}

.btn-ghost.loading::after {
    border-color: var(--text);
    border-right-color: transparent;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.icon-btn {
    position: relative;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    transition: background 160ms ease, border-color 160ms ease, transform 140ms var(--ease);
}

.icon-btn:hover {
    border-color: var(--accent-line);
    background: rgba(255, 255, 255, .07);
}

.icon-btn:active {
    transform: scale(.95);
}

.link-btn {
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
}

.link-btn:hover {
    text-decoration: underline;
}

.link-btn.danger {
    color: var(--danger);
}

.search {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 44px;
    padding: 0 44px 0 42px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: rgba(15, 17, 23, .8);
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
    -webkit-appearance: none;
    appearance: none;
}

.search-input::-webkit-search-cancel-button {
    display: none;
}

.search-input::placeholder {
    color: var(--muted);
}

.search-input:focus {
    border-color: var(--accent-line);
    box-shadow: var(--ring);
    background: rgba(15, 17, 23, .95);
}

.search-clear {
    position: absolute;
    right: 6px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
    color: var(--muted);
}

.search-clear:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .12);
}

.select-wrap {
    position: relative;
    flex: 0 0 auto;
}

.select-wrap::after {
    content: "";
    position: absolute;
    right: 13px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

.select {
    height: 38px;
    padding: 0 34px 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: rgba(15, 17, 23, .8);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.select:focus {
    border-color: var(--accent-line);
    box-shadow: var(--ring);
}

.select option {
    background: var(--surface-solid);
}

.chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 10px;
    margin: 0 -2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, .03);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.chip:hover {
    border-color: var(--accent-line);
    color: var(--text);
}

.chip.active {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent);
}

.chip-count {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .07);
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chip.active .chip-count {
    background: rgba(110, 231, 255, .18);
}

.dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
}

.dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .22);
    transition: width 240ms var(--ease), background 200ms ease;
}

.dot.active {
    width: 22px;
    background: var(--accent);
}

.media-box {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #141722, #0d0f15);
}

.media-box img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 300ms ease, transform 400ms var(--ease);
}

.media-box img.is-loaded {
    opacity: 1;
}

.media-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, .16);
}

.media-box.has-image .media-fallback {
    display: none;
}

.discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    padding: 3px 8px;
    border-radius: 8px;
    background: var(--danger);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .2px;
    box-shadow: 0 6px 16px rgba(255, 92, 122, .3);
}

.discount-badge.static {
    position: static;
    box-shadow: none;
}

.stock-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 3px 8px;
    border-radius: 7px;
    border: 1px solid rgba(110, 231, 255, .22);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .2px;
}

.stock-badge.low {
    border-color: rgba(251, 191, 36, .3);
    background: var(--warn-soft);
    color: var(--warn);
}

.stock-badge.out {
    border-color: rgba(255, 92, 122, .3);
    background: var(--danger-soft);
    color: var(--danger);
}

.qty {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: rgba(15, 17, 23, .8);
}

.qty-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9px;
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    transition: background 140ms ease;
}

.qty-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, .12);
}

.qty-btn:disabled {
    opacity: .35;
}

.qty-input {
    width: 44px;
    height: 34px;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: center;
    font-weight: 800;
    font-size: 15px;
    outline: none;
}

.qty-input:disabled {
    opacity: .5;
}

.skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, .04) 0%, rgba(255, 255, 255, .09) 50%, rgba(255, 255, 255, .04) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
}

.skeleton-line {
    height: 12px;
    border-radius: 999px;
}

.skeleton-line.lg {
    height: 22px;
}

.w-30 {
    width: 30%;
}

.w-50 {
    width: 50%;
}

.w-80 {
    width: 80%;
}

@keyframes shimmer {
    from {
        background-position: 200% 0;
    }
    to {
        background-position: -200% 0;
    }
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 56px 16px;
    text-align: center;
}

.empty-icon {
    width: 72px;
    height: 72px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
}

.empty-title {
    font-weight: 800;
    font-size: 17px;
}

.empty-text {
    max-width: 340px;
    color: var(--muted);
    font-size: 14px;
}

.empty-state .btn,
.empty-actions {
    margin-top: 10px;
}

.empty-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.app-toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 120;
    max-width: min(440px, calc(100% - 32px));
    padding: 12px 18px;
    border-radius: 14px;
    border: 1px solid var(--line-strong);
    background: rgba(20, 22, 30, .97);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 16px);
    transition: opacity 200ms ease, transform 260ms var(--ease);
}

.app-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.app-toast[data-variant="success"] {
    border-color: rgba(74, 222, 128, .35);
}

.app-toast[data-variant="warn"] {
    border-color: rgba(251, 191, 36, .4);
}

.app-toast[data-variant="error"] {
    border-color: rgba(255, 92, 122, .45);
}

body.has-floating-cart .app-toast,
body.has-buybar .app-toast {
    bottom: calc(96px + env(safe-area-inset-bottom));
}

.dialog {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 180ms ease;
}

.dialog-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line-strong);
    background: var(--surface-solid);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(12px) scale(.98);
    transition: opacity 180ms ease, transform 220ms var(--ease);
}

.dialog.open .dialog-backdrop,
.dialog.open .dialog-card {
    opacity: 1;
}

.dialog.open .dialog-card {
    transform: none;
}

.dialog-title {
    font-weight: 800;
    font-size: 18px;
    word-break: break-word;
}

.dialog-message {
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.site-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.footer-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    text-align: center;
}

body.has-floating-cart .footer-inner {
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
