:root {
    --bg: #f3f0e9;
    --surface: #fbfaf7;
    --surface-strong: #ffffff;
    --text: #171717;
    --muted: #6e6a63;
    --border: #ded9d0;
    --accent: #171717;
    --accent-text: #ffffff;
    --soft: #ebe7df;
    --shadow: 0 10px 30px rgba(20, 18, 15, 0.06);
}

html[data-theme="dark"] {
    --bg: #111317;
    --surface: #181b20;
    --surface-strong: #1e2228;
    --text: #f3f4f6;
    --muted: #a8adb5;
    --border: #2d323a;
    --accent: #f1f3f5;
    --accent-text: #111317;
    --soft: #23272e;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
}

button,
input,
a {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.page-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 20px 16px 56px;
}

.storefront-header {
    display: grid;
    gap: 22px;
    margin-bottom: 18px;
}

.brand-line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    font-size: clamp(26px, 7vw, 44px);
    line-height: 1.05;
    letter-spacing: -0.035em;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    box-shadow: var(--shadow);
}

html[data-theme="light"] .theme-toggle__light,
html[data-theme="dark"] .theme-toggle__dark {
    display: none;
}

.search-panel {
    display: grid;
    gap: 8px;
}

.search-panel label {
    font-size: 14px;
    font-weight: 700;
}

.search-box {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 22px;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    min-height: 54px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-strong);
    color: var(--text);
    padding: 0 18px 0 46px;
    outline: none;
    box-shadow: var(--shadow);
}

.search-box input:focus {
    border-color: var(--text);
}

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

.category-menu {
    margin: 0 0 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.category-menu > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    padding: 0 16px;
    color: var(--text);
    cursor: pointer;
    font-size: 15px;
    font-weight: 800;
    list-style: none;
}

.category-menu > summary::-webkit-details-marker {
    display: none;
}

.category-menu > summary::after {
    content: "↓";
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 16px;
}

.category-menu[open] > summary::after {
    content: "↑";
}

.category-menu__current {
    min-width: 0;
    margin-left: auto;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-menu__list {
    display: grid;
    border-top: 1px solid var(--border);
    background: var(--surface-strong);
}

.category-menu__item {
    width: 100%;
    min-height: 46px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    padding: 11px 16px;
    text-align: left;
    cursor: pointer;
}

.category-menu__item:last-child {
    border-bottom: 0;
}

.category-menu__item.is-active {
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 800;
}

.category-list {
    display: none;
    gap: 8px;
    margin: 0 -16px 20px;
    padding: 0 16px 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.category-list::-webkit-scrollbar {
    display: none;
}

.category-chip {
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    padding: 10px 14px;
    cursor: pointer;
}

.category-chip.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-text);
}

.brand-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.brand-card {
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.brand-card[hidden] {
    display: none;
}

.brand-card__header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
}

.brand-logo {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    border-radius: 14px;
    object-fit: contain;
    background: var(--surface-strong);
    border: 1px solid var(--border);
}

.brand-logo--placeholder {
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 800;
}

.brand-card__identity {
    min-width: 0;
}

.brand-card__identity h2 {
    margin: 0;
    font-size: 21px;
    line-height: 1.15;
}

.brand-card__identity p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.offer-list {
    display: grid;
}

.offer-card {
    padding: 18px;
    border-top: 1px solid var(--border);
}

.offer-card h3 {
    margin: 0 0 14px;
    font-size: 17px;
    line-height: 1.35;
}

.promo-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 13px 14px;
    border-radius: 14px;
    background: var(--soft);
}

.promo-label {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 12px;
}

.promo-row code {
    color: var(--text);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.copy-button {
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-strong);
    color: var(--text);
    padding: 9px 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.offer-condition {
    margin: 0 0 10px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.condition-details {
    margin: -2px 0 12px;
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
}

.condition-details summary {
    width: fit-content;
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    list-style: none;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.condition-details summary::-webkit-details-marker {
    display: none;
}

.condition-details summary::after {
    content: " ↓";
    color: var(--muted);
}

.condition-details[open] summary::after {
    content: " ↑";
}

.condition-details__body {
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--soft);
    white-space: pre-line;
}

.offer-expiry {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 13px;
}

.offer-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.primary-action,
.secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 12px;
    padding: 10px 14px;
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    font-weight: 750;
}

.primary-action {
    background: var(--accent);
    color: var(--accent-text);
}

.secondary-action {
    border: 1px solid var(--border);
    background: var(--surface-strong);
    color: var(--text);
}

.ad-marking {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}

.empty-state {
    margin: 28px 0;
    color: var(--muted);
    text-align: center;
}

.empty-state--initial {
    padding: 36px 20px;
    border: 1px dashed var(--border);
    border-radius: 20px;
    background: var(--surface);
}

.empty-state--initial h2 {
    margin: 0 0 8px;
    color: var(--text);
}

.empty-state--initial p {
    margin: 0;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    z-index: 20;
    transform: translateX(-50%);
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-text);
    padding: 10px 16px;
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 700;
}

@media (min-width: 640px) {
    .page-shell {
        padding: 28px 24px 72px;
    }

    .category-menu {
        display: none;
    }

    .category-list {
        display: flex;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .brand-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
    }

    .offer-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .offer-actions .primary-action:only-child,
    .offer-actions .secondary-action:only-child {
        grid-column: 1 / -1;
    }
}

@media (min-width: 980px) {
    .storefront-header {
        grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
        align-items: end;
        gap: 36px;
        margin-bottom: 24px;
    }

    .brand-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
