:root {
  --max-w: 1400px;
  --teal: #1a9b8f;
  --teal-dark: #0d7a70;
  --bg: #f4f8f7;
  --card: #fff;
  --text: #333;
  --text-muted: #888;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

#searchInput{
  background-color: transparent !important;
  height: 22px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.noscript-tip {
  margin: 12px 16px 0;
  padding: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.page {
  max-width: var(--max-w);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
}

/* Hero */
.hero {
  position: relative;
  width: 100%;
  height: clamp(168px, 20vw, 220px);
  overflow: hidden;
}

.hero-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
}

/* Search */
.search-wrap {
  padding: 0 16px;
  margin-top: -8px;
  position: relative;
  z-index: 2;
}

@media (min-width: 768px) {
  .search-wrap {
    padding: 0 32px;
  }
}

.search {
  display: flex;
  align-items: center;
  background: var(--card);
  border-radius: 28px;
  padding: 6px 6px 6px 16px;
  box-shadow: var(--shadow);
  max-width: 720px;
  margin: 0 auto;
}

.search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  min-width: 0;
}

.search input::placeholder {
  color: #bbb;
}

.search-btn {
  flex-shrink: 0;
  padding: 10px 24px;
  border: none;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.search-btn:hover {
  opacity: 0.9;
}

/* Tabs */
.tabs-wrap {
  padding: 16px 16px 0;
  overflow: hidden;
}

@media (min-width: 768px) {
  .tabs-wrap {
    padding: 20px 32px 0;
  }
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

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

.tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  background: var(--card);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab:hover {
  color: var(--teal);
}

.tab.is-active {
  background: rgba(26, 155, 143, 0.12);
  color: var(--teal-dark);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--teal);
}

/* Grid */
.main {
  padding: 16px;
}

@media (min-width: 768px) {
  .main {
    padding: 20px 32px 32px;
  }
}

.coupon-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .coupon-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}

@media (min-width: 900px) {
  .coupon-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
}

.coupon-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 12px 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.coupon-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.coupon-card::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.06;
  background: var(--brand);
  pointer-events: none;
}

.coupon-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.coupon-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
  background: #fff;
}

.coupon-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.coupon-value {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: center;
}

.coupon-amount {
  flex-shrink: 0;
  font-size: 26px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1;
}

.coupon-amount span {
  font-size: 15px;
  font-weight: 700;
}

.coupon-desc {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.35;
  /* white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; */
}

.coupon-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.coupon-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.claim-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border: none;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  z-index: 2;
  transition: opacity 0.2s, transform 0.15s;
}

.claim-btn:hover {
  opacity: 0.88;
  transform: scale(1.02);
}

/* Mobile：保持两列，紧凑排版 */
@media (max-width: 599px) {
  .main {
    padding: 12px;
  }

  .coupon-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
  }

  .coupon-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 140px;
    padding: 10px 8px;
    gap: 6px;
    border-radius: 10px;
  }

  .coupon-head {
    flex-shrink: 0;
    gap: 6px;
    min-width: 0;
  }

  .coupon-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .coupon-name {
    font-size: 12px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .coupon-value {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    align-items: center;
    justify-content: center;
  }

  .coupon-amount {
    flex-shrink: 0;
    font-size: 22px;
    line-height: 1.2;
    text-align: center;
  }

  .coupon-amount span {
    font-size: 13px;
  }

  .coupon-desc {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 2px;
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
    /* white-space: normal;
    word-break: break-word;
    overflow: hidden; */
  }

  .coupon-foot {
    flex-shrink: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-top: 0;
  }

  .coupon-meta {
    font-size: 10px;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .claim-btn {
    width: 100%;
    padding: 7px 8px;
    font-size: 12px;
    min-height: 32px;
    border-radius: 16px;
  }

  .modal {
    padding: 16px 12px;
    align-items: flex-end;
  }

  .modal-dialog {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }

  .modal-close {
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
  }

  .modal-title {
    font-size: 20px;
  }

  .modal-title::before,
  .modal-title::after {
    width: 20px;
    margin: 0 8px;
  }

  .modal-info {
    font-size: 14px;
  }

  .modal-qr {
    width: min(72vw, 200px);
    height: min(72vw, 200px);
  }
}

.empty-tip {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Footer */
.features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 24px 16px;
  margin-top: 8px;
}

@media (min-width: 600px) {
  .features {
    grid-template-columns: repeat(4, 1fr);
    padding: 32px;
  }
}

.feature {
  text-align: center;
}

.feature-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: rgba(26, 155, 143, 0.1);
  color: var(--teal);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.feature-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.page-footer {
  text-align: center;
  padding: 0 16px 32px;
  font-size: 12px;
  color: #aaa;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 100;
  max-width: 90%;
  text-align: center;
}

.toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Claim modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.modal-dialog {
  position: relative;
  width: min(100%, 340px);
  z-index: 1;
}

.modal-card {
  --modal-brand: #ffc300;
  --modal-head: #1e6bff;
  position: relative;
  border: 4px solid var(--modal-head);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #333;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-head {
  background: var(--modal-head);
  padding: 16px 44px 12px 14px;
  text-align: center;
}

.modal-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--modal-brand);
  letter-spacing: 1px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.modal-title::before,
.modal-title::after {
  content: "";
  display: inline-block;
  width: 28px;
  height: 3px;
  background: var(--modal-brand);
  vertical-align: middle;
  margin: 0 10px;
  border-radius: 2px;
}

.modal-sub {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 255, 255, 0.95);
  font-size: 13px;
  font-weight: 600;
}

.modal-qr-wrap {
  padding: 20px 16px 12px;
  background: var(--modal-head);
}

.modal-qr-bubble {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: center;
}

.modal-qr-bubble::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-bottom-color: #fff;
}

.modal-qr {
  display: block;
  width: 200px;
  height: 200px;
  object-fit: contain;
}

.modal-divider {
  position: relative;
  height: 20px;
  background: #fff;
}

.modal-divider::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  border-top: 2px dashed var(--modal-head);
}

.modal-divider::after {
  content: "";
  position: absolute;
  left: -10px;
  right: -10px;
  top: 50%;
  height: 20px;
  transform: translateY(-50%);
  background:
    radial-gradient(circle at 0 50%, transparent 10px, #fff 10px),
    radial-gradient(circle at 100% 50%, transparent 10px, #fff 10px);
  pointer-events: none;
}

.modal-info {
  padding: 4px 16px 18px;
  font-size: 13px;
  line-height: 1.7;
  color: #333;
}

.modal-tip-line em {
  font-style: normal;
  background: linear-gradient(transparent 60%, rgba(255, 235, 120, 0.9) 60%);
}

.modal-scan-line {
  margin-top: 4px;
  color: #555;
}

.modal-open-app-btn {
  display: none;
  width: 100%;
  margin-top: 12px;
  padding: 11px 14px;
  border: none;
  border-radius: 999px;
  background: var(--modal-head);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.modal-open-app-btn[hidden] {
  display: none;
}

@media (max-width: 599px) {
  .modal-open-app-btn:not([hidden]) {
    display: block;
  }
}
