:root {
    --brand: #ee4d2d;
    --brand-dark: #c43a1c;
    --text: #111827;
    --muted: #6b7280;
    --ring: #e5e7eb;
    --bg: #ffffff;
    --bg-soft: #f9fafb;
    --max-width: 1200px;
    --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

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

/* ── Header ── */
.site-header {
    border-bottom: 1px solid var(--ring);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: saturate(180%) blur(8px);
    background: rgba(255,255,255,0.92);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}
.brand {
    display: flex; align-items: center; gap: 8px;
    color: var(--text); text-decoration: none;
    font-weight: 700; font-size: 1.1rem;
}
.brand:hover, .brand:focus { text-decoration: none; opacity: 0.85; }
.brand:hover .brand-logo { transform: rotate(-6deg) scale(1.05); }
.brand-logo { transition: transform 0.18s ease; }
.brand-logo {
    width: 32px;
    height: 32px;
    display: block;
    border-radius: 7px;
}
.brand-text strong { color: var(--brand); }
.nav-right a {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 14px;
    border: 1px solid var(--ring);
    border-radius: 8px;
    transition: all 0.15s;
}
.nav-right a:hover {
    border-color: var(--brand);
    color: var(--brand);
    text-decoration: none;
}

/* ── Page head ── */
.page-head {
    padding: 24px 0 16px;
    border-bottom: 1px solid var(--ring);
    margin-bottom: 18px;
}
.page-head h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.page-head .lead {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.92rem;
    max-width: 760px;
}
.meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--muted);
    flex-wrap: wrap;
}
.meta-row strong { color: var(--text); font-weight: 600; }
.meta-row .sep { color: #d1d5db; }
.meta-row .live-dot {
    width: 7px; height: 7px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    animation: pulse 1.8s ease-in-out infinite;
}
.meta-row button {
    background: none;
    border: none;
    color: var(--brand);
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
    font-weight: 500;
}
.meta-row button:hover { text-decoration: underline; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── Slot bar ── */
.slot-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0 12px;
    margin-bottom: 12px;
    scrollbar-width: thin;
}
.slot-btn {
    flex: 0 0 auto;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--ring);
    background: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.15s;
}
.slot-btn .badge { color: #9ca3af; font-weight: 500; margin-left: 2px; font-size: 11px; }
.slot-btn:hover { border-color: var(--brand); color: var(--brand); }
.slot-btn.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}
.slot-btn.active .badge { color: rgba(255,255,255,0.85); }

/* ── Toolbar (search + sort) ── */
.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 280px;
    min-width: 240px;
    max-width: 480px;
    background: #fff;
    border: 1px solid var(--ring);
    border-radius: 999px;
    padding: 0 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(238,77,45,0.12);
}
.search-icon {
    color: var(--muted);
    font-size: 14px;
    margin-right: 4px;
}
.search-box input {
    flex: 1;
    border: none;
    outline: none;
    padding: 9px 4px;
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--text);
    background: transparent;
}
.search-clear {
    border: none;
    background: #f3f4f6;
    color: var(--muted);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.search-clear:hover { background: var(--brand); color: #fff; }
.sort-box {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.86rem;
    color: var(--muted);
}
.sort-box select {
    border: 1px solid var(--ring);
    background: #fff;
    border-radius: 8px;
    padding: 8px 28px 8px 12px;
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 4 L5 7 L8 4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
.sort-box select:focus, .sort-box select:hover {
    border-color: var(--brand);
    outline: none;
}
.result-count {
    font-size: 0.82rem;
    color: var(--muted);
    margin-left: auto;
}
@media (max-width: 640px) {
    .search-box { flex: 1 1 100%; max-width: 100%; }
    .sort-box { flex: 1 1 auto; }
    .sort-box select { flex: 1; }
    .result-count { width: 100%; margin-left: 0; }
}

/* ── Slot section ── */
.slot-section { margin-bottom: 24px; }
.slot-section.hidden { display: none; }
.slot-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--text);
}
.slot-title .muted { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

/* ── Grid ── */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.card {
    border: 1px solid var(--ring);
    border-radius: var(--radius);
    background: #fff;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    border-color: var(--brand);
    text-decoration: none;
}
.card-img {
    position: relative;
    aspect-ratio: 1/1;
    background: #f3f4f6;
}
.card-img img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.discount {
    position: absolute;
    top: 6px; left: 6px;
    background: var(--brand);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 4px;
}
.card-body { padding: 8px 10px 10px; }
.title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    margin: 0 0 6px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 32px;
}
.price-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
}
.price {
    color: var(--brand);
    font-weight: 700;
    font-size: 14px;
}
.original {
    text-decoration: line-through;
    color: var(--muted);
    font-size: 11px;
}
.stock {
    font-size: 10px;
    color: var(--muted);
    margin: 4px 0 0;
}

/* ── States ── */
.error-box {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 12px 16px;
    text-align: center;
    font-size: 13px;
    margin: 16px 0;
}
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}
.loading {
    text-align: center;
    padding: 50px 20px;
    color: var(--muted);
    font-size: 14px;
}
.spinner {
    width: 30px; height: 30px;
    border: 3px solid #f3f4f6;
    border-top-color: var(--brand);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.live-pill {
    width: 6px; height: 6px;
    background: #ef4444;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
    animation: pulse 1.4s ease-in-out infinite;
}

/* ── SEO content ── */
.seo-content {
    margin: 32px 0 16px;
    padding: 24px 0;
    border-top: 1px solid var(--ring);
    color: #374151;
    font-size: 0.92rem;
}
.seo-content h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin: 18px 0 8px;
}
.seo-content h2:first-child { margin-top: 0; }
.seo-content ul { padding-left: 20px; margin: 8px 0 12px; }
.seo-content li { margin-bottom: 4px; }
.seo-content p { margin: 0 0 10px; }
.seo-content a { color: var(--brand); }

/* ── Footer ── */
.site-footer {
    background: var(--bg-soft);
    border-top: 1px solid var(--ring);
    margin-top: 40px;
    padding: 32px 0 20px;
    font-size: 0.88rem;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 20px;
}
.footer-grid h3 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 4px; }
.footer-grid a { color: #4b5563; }
.footer-grid a:hover { color: var(--brand); }
.muted-text { color: var(--muted); margin: 0; line-height: 1.5; }
.footer-bottom {
    border-top: 1px solid var(--ring);
    padding-top: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 0.82rem;
}
.footer-bottom a { color: var(--brand); }

/* ── Responsive ── */
@media (max-width: 640px) {
    .page-head h1 { font-size: 1.3rem; }
    .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .card-body { padding: 6px 8px 8px; }
    .title { font-size: 11px; height: 30px; }
    .price { font-size: 13px; }
    .header-inner { padding: 10px 12px; }
    .brand { font-size: 0.95rem; }
    .nav-right a { padding: 6px 10px; font-size: 0.82rem; }
    .footer-grid { grid-template-columns: 1fr; gap: 18px; }
}
