:root {
  color-scheme: dark;
  --bg: #0a0d0c;
  --bg-elevated: #101514;
  --bg-soft: #151a19;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f4f7f6;
  --text-muted: #93a09c;
  --text-subtle: #6f7b77;
  --brand-deep: #073b3a;
  --brand: #0b6e4f;
  --brand-bright: #08a045;
  --brand-soft: rgba(8, 160, 69, 0.12);
  --brand-border: rgba(8, 160, 69, 0.28);
  --accent: var(--brand-bright);
  --accent-soft: var(--brand-soft);
  --danger: #ff7b7b;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.18);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 999px;
  --max-width: 1080px;
  --font: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  background: var(--bg);
  scrollbar-gutter: stable;
}

body {
  background:
    radial-gradient(circle 520px at 50% 0, rgba(8, 160, 69, 0.08), transparent 100%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 16px 0;
}

.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-top: clamp(24px, 8vh, 72px);
  text-align: center;
}

.hero__title {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero__subtitle {
  margin: 12px auto 28px;
  max-width: 28rem;
  color: var(--text-muted);
  font-size: clamp(1rem, 3.5vw, 1.125rem);
  font-style: italic;
}

.search-form {
  max-width: 42rem;
  margin: 0 auto;
}

.search-form__field {
  position: relative;
}

.search-form__icon {
  position: absolute;
  top: 50%;
  left: 18px;
  width: 20px;
  height: 20px;
  fill: var(--text-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-form__input {
  width: 100%;
  min-height: 56px;
  padding: 16px 18px 16px 52px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search-form__input:focus {
  border-color: var(--brand-border);
  background: rgba(255, 255, 255, 0.05);
}

.bank-filters,
.offer-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
}

.offer-filters {
  margin-top: 8px;
  gap: 6px 10px;
}

.offer-filters__group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.offer-filters__separator {
  width: 1px;
  height: 16px;
  margin: 0 2px;
  background: var(--border-strong);
}

.chip {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.04);
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 28px auto 0;
}

.site-footer {
  width: 100%;
  max-width: var(--max-width);
  margin: 40px auto 0;
  padding: 20px 0 calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--text-subtle);
  font-size: 0.75rem;
  line-height: 1.65;
  text-align: center;
}

.site-footer p {
  margin: 0 auto;
  max-width: 42rem;
}

.site-footer strong {
  color: var(--text-muted);
  font-weight: 600;
}

.status {
  min-height: 1.5rem;
  color: var(--text-muted);
  text-align: center;
}

.status--error {
  color: var(--danger);
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 18px;
}

.offer-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.offer-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-border);
  box-shadow: var(--shadow);
}

.offer-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.offer-card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg);
  overflow: hidden;
}

.offer-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.offer-card__media-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.875rem;
  background: linear-gradient(135deg, rgba(7, 59, 58, 0.35), rgba(11, 110, 79, 0.12));
}

.offer-card__benefit {
  position: absolute;
  left: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px);
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(7, 59, 58, 0.82);
  backdrop-filter: blur(6px);
  color: #d7f5e4;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.offer-card__benefit--muted {
  color: #cbd5d1;
  letter-spacing: 0.03em;
}

.offer-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  flex: 1;
}

.offer-card__merchant {
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
}

.offer-card__merchant--placeholder {
  color: var(--text-muted);
}

.offer-card__bank {
  color: var(--brand-bright);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.offer-card__title {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.offer-card__validity {
  margin-top: 2px;
  color: var(--text);
  font-size: 0.8125rem;
}

.offer-card__highlights {
  margin: 4px 0 0;
  padding-left: 1.1rem;
  color: var(--text-subtle);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.offer-card__highlights li + li {
  margin-top: 4px;
}

.offer-card__category {
  align-self: flex-start;
  margin-top: auto;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-subtle);
  font-size: 0.75rem;
}

.results-actions {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.results-actions[hidden] {
  display: none;
}

.button {
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.button--secondary {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.button--primary {
  width: 100%;
  background: linear-gradient(180deg, var(--brand-bright), var(--brand));
  color: #f4fff8;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(8, 160, 69, 0.22);
}

.button:focus-visible,
.button--secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.modal {
  width: min(720px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal::backdrop {
  background: rgba(4, 8, 7, 0.76);
  backdrop-filter: blur(4px);
}

.modal__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 20px);
  overflow: hidden;
}

.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
}

.modal__content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 20px);
  overflow: hidden;
}

.modal__hero {
  width: auto;
  margin: -24px -22px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.modal__image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
  object-position: center;
}

.modal__scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px 22px 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modal__scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.modal__header {
  padding-right: 48px;
}

.modal__bank {
  color: var(--brand-bright);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modal__merchant {
  margin-top: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
}

.modal__title {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.45;
}

.modal__benefit {
  display: inline-flex;
  margin-top: 16px;
  padding: 10px 14px;
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  background: var(--accent-soft);
  color: #d7f5e4;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.modal__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.fact__label {
  color: var(--text-subtle);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fact__value {
  margin-top: 6px;
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.modal__section {
  margin-top: 22px;
}

.modal__section-title {
  margin: 0 0 10px;
  color: var(--text-subtle);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.modal__copy p {
  margin: 0 0 12px;
  color: var(--text);
  line-height: 1.65;
}

.modal__copy p:last-child {
  margin-bottom: 0;
}

.condition-list {
  display: grid;
  gap: 10px;
}

.condition-list__item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.condition-list__label {
  color: var(--text-subtle);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.condition-list__value {
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: normal;
}

.modal__section--terms .modal__copy,
.modal__terms {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
}

.modal__terms {
  margin: 0;
  list-style: disc;
  padding-left: 2.1rem;
}

.modal__terms li + li {
  margin-top: 0.55rem;
}

.modal__footer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 16px 22px 22px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(10, 13, 12, 0.72), var(--bg));
}

.modal__footer .button--primary {
  flex: 1;
  width: auto;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 640px) {
  .modal {
    width: 100vw;
    max-height: 100vh;
    margin: 0;
    border-radius: 18px 18px 0 0;
  }

  .modal__panel,
  .modal__content {
    max-height: 100vh;
    overflow: hidden;
  }

  .modal__scroll {
    padding: 22px 18px 10px;
  }

  .modal__hero {
    margin: -22px -18px 22px;
  }

  .modal__footer {
    padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
  }

  .modal__facts {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 768px) {
  .page {
    padding-inline: 24px;
  }

  .hero {
    padding-top: clamp(48px, 12vh, 96px);
  }
}
