:root {
  --bg: #f5f8fc;
  --card: #fff;
  --ink: #172334;
  --muted: #69778a;
  --soft: #eef5ff;
  --line: #dfe8f5;
  --blue: #1267f1;
  --blue2: #0b4fd4;
  --red: #ef3d38;
  --orange: #ff5a1f;
  --green: #18a66a;
  --amber: #f59f00;
  --shadow: 0 10px 28px rgba(37, 84, 145, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.app { min-height: 100vh; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.desktop-nav { display: none; }
.mobile-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(150deg, #0759df, #1679ff);
  color: #fff;
  padding: 10px 16px 12px;
}
.mobile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
}
.brand-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-row img { width: 36px; height: 36px; flex: 0 0 auto; }
.brand-row strong { display: block; font-size: 20px; line-height: 23px; font-weight: 900; }
.brand-row span { display: block; margin-top: 2px; font-size: 12px; opacity: .9; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.search-mark {
  width: 24px; height: 24px; border: 3px solid currentColor; border-radius: 50%; position: relative; flex: 0 0 auto;
}
.search-mark::after {
  content: ""; position: absolute; right: -7px; bottom: -5px; width: 10px; height: 3px; border-radius: 2px; background: currentColor; transform: rotate(45deg);
}
.mobile-tagline {
  display: none;
}
.page { max-width: 1260px; margin: 0 auto; padding: 12px 16px 24px; }
.search-wrap { margin: 0 0 12px; }
.search {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 0 16px;
  color: var(--ink);
  outline: none;
  box-shadow: 0 5px 16px rgba(38, 89, 153, .05);
}
.search:focus { border-color: #8db9ff; box-shadow: 0 0 0 4px rgba(18, 103, 241, .10); }
.category-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}
.category-strip::-webkit-scrollbar { display: none; }
.category {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--ink);
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 72px;
  padding: 4px 2px;
  font-size: 13px;
  font-weight: 800;
}
.category-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #eef5ff;
  display: grid;
  place-items: center;
  position: relative;
}
.category-icon img { width: 24px; height: 24px; }
.category.active .category-icon { background: #dcebff; outline: 2px solid rgba(18,103,241,.18); }
.hot-badge {
  position: absolute;
  top: -8px;
  right: -9px;
  color: #fff;
  background: var(--red);
  border-radius: 12px;
  padding: 2px 6px;
  font-size: 10px;
  line-height: 12px;
}
.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin: 0 0 12px;
  padding: 0 12px;
  border-radius: 16px;
  background: #eaf3ff;
  color: var(--muted);
  font-size: 13px;
}
.notice b { color: var(--blue); white-space: nowrap; }
.notice span { min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.notice button { border: 0; background: transparent; color: var(--muted); font-weight: 800; white-space: nowrap; }
.content-grid { display: grid; gap: 18px; }
.desktop-hero { display: none; }
.main-panel, .guide-panel, .side-card, .collection-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.main-panel { padding: 14px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-title { margin: 0; font-size: 21px; line-height: 27px; font-weight: 900; }
.section-sub { color: var(--muted); font-size: 14px; font-weight: 700; }
.toggle-expired, .more-link {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 800;
  white-space: nowrap;
}
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.coupon-card {
  position: relative;
  min-height: 256px;
  padding: 15px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.corner-label {
  position: absolute;
  left: 0;
  top: 0;
  padding: 5px 10px;
  border-radius: 0 0 12px 0;
  background: #fff3db;
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
}
.corner-label.red { background: #fff0f2; color: var(--red); }
.coupon-top { display: flex; align-items: center; gap: 10px; margin-top: 24px; min-width: 0; }
.logo-badge {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #eef5ff;
  color: var(--blue);
  border: 1px solid #dce9fb;
  font-weight: 900;
}
.logo-badge.bank { width: 38px; height: 38px; border-radius: 50%; font-size: 17px; }
.logo-badge.merchant { width: 54px; height: 38px; border-radius: 10px; font-size: 14px; }
.logo-badge img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.merchant-text { min-width: 0; }
.merchant-text strong { display: block; font-size: 17px; line-height: 22px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.merchant-text span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.discount {
  margin-top: 18px;
  color: var(--orange);
  font-size: 31px;
  line-height: 36px;
  font-weight: 950;
  text-align: center;
}
.sub-offer { margin-top: 4px; min-height: 20px; color: var(--muted); text-align: center; font-size: 14px; font-weight: 800; }
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 12px 0 8px;
}
.meta-pill {
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f5f8fc;
  border: 1px solid #e4edf8;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.expire-line { color: var(--ink); font-size: 13px; font-weight: 800; }
.expire-line b { color: var(--red); }
.use-btn {
  margin-top: auto;
  width: 100%;
  height: 40px;
  border: 1px solid #bdd5ff;
  border-radius: 11px;
  background: #f3f8ff;
  color: var(--blue);
  font-weight: 900;
}
.more-wrap { display: flex; justify-content: center; margin-top: 14px; }
.more-primary {
  border: 0;
  border-radius: 999px;
  padding: 11px 22px;
  background: linear-gradient(135deg, #ff8a1c, #ff5a1f);
  color: #fff;
  font-weight: 900;
}
.collection-section { margin-top: 14px; padding: 14px; }
.collection-grid { display: grid; gap: 10px; }
.collection-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #f3f8ff;
}
.collection-art {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-weight: 900;
  border: 1px solid #dce9fb;
}
.collection-card strong { display: block; font-size: 16px; font-weight: 900; }
.collection-card span { display: block; color: var(--muted); font-size: 13px; line-height: 19px; }
.collection-card a, .collection-card button, .guide-actions a {
  margin-top: 6px;
  display: inline-flex;
  border: 1px solid #bdd5ff;
  border-radius: 999px;
  padding: 7px 13px;
  background: #fff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}
.collection-card a {
  padding: 8px 15px;
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: 0 8px 16px rgba(18, 103, 241, .16);
}
.side-panel { display: none; }
.side-card { padding: 16px; margin-bottom: 16px; }
.side-card h3 { margin: 0 0 14px; font-size: 18px; }
.rank-item, .ending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #edf2f8;
  font-size: 14px;
}
.rank-item:last-child, .ending-item:last-child { border-bottom: 0; }
.rank-no {
  width: 22px; height: 22px; border-radius: 50%; background: #ffaf20; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 900;
}
.rank-name { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 850; }
.count-badge { color: var(--red); background: #fff0f0; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 900; white-space: nowrap; }
.ending-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ending-item b { color: var(--red); font-size: 13px; white-space: nowrap; }
.use-guide-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.9;
  font-size: 14px;
}
.use-guide-list li::marker {
  color: var(--blue);
  font-weight: 900;
}
.guide-panel { padding: 18px; }
.guide-panel h2 { margin: 0 0 8px; font-size: 24px; }
.guide-panel p { margin: 0 0 14px; color: var(--muted); line-height: 1.7; }
.guide-list { display: grid; gap: 10px; margin: 16px 0; }
.guide-item { padding: 13px; border-radius: 14px; background: #f3f8ff; border: 1px solid #dce9fb; }
.guide-item strong { display: block; margin-bottom: 4px; }
.guide-item span { color: var(--muted); font-size: 14px; line-height: 1.6; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.empty-friendly {
  padding: 22px;
  border-radius: 14px;
  background: #f3f8ff;
  color: var(--muted);
  line-height: 1.7;
}
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.bottom-nav a, .bottom-nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 850;
  min-width: 0;
}
.bottom-nav .active { color: var(--blue); }
.bottom-nav i { font-style: normal; font-size: 19px; line-height: 19px; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: flex-end;
  background: rgba(12, 24, 45, .42);
}
.modal.show { display: flex; }
.sheet {
  width: 100%;
  max-height: 88vh;
  overflow: auto;
  border-radius: 22px 22px 0 0;
  background: #fff;
  padding: 18px;
}
.sheet-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sheet h3 { margin: 0 0 14px; font-size: 21px; line-height: 28px; }
.close { border: 0; background: #f2f6fb; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; }
.detail-hero { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 16px; background: #f3f8ff; }
.detail-discount { color: var(--orange); font-size: 28px; font-weight: 950; }
.detail-block { margin-top: 12px; padding: 13px; border-radius: 14px; background: #fff; border: 1px solid var(--line); line-height: 1.65; color: var(--muted); }
.detail-block strong { display: block; margin-bottom: 5px; color: var(--ink); }
.steps { margin: 0; padding-left: 20px; }
.source-link { color: var(--blue); font-weight: 850; word-break: break-all; }
.feedback-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.feedback-actions button { border: 1px solid var(--line); border-radius: 12px; background: #f8fbff; padding: 10px; font-weight: 850; }

@media (max-width: 370px) {
  .cards { gap: 9px; }
  .coupon-card { padding-left: 9px; padding-right: 9px; }
  .discount { font-size: 27px; }
  .merchant-text strong { font-size: 15px; }
}

@media (min-width: 760px) {
  .app { padding-bottom: 0; }
  .mobile-top, .bottom-nav { display: none; }
  .desktop-nav {
    display: block;
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }
  .nav-inner {
    max-width: 1260px;
    margin: 0 auto;
    height: 70px;
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 0 16px;
  }
  .desktop-brand { display: flex; align-items: center; gap: 10px; min-width: 204px; }
  .desktop-brand img { width: 44px; height: 44px; }
  .desktop-brand strong { display: block; font-size: 20px; font-weight: 900; }
  .desktop-brand span { display: block; color: var(--muted); font-size: 12px; }
  .nav-links { flex: 1; display: flex; justify-content: center; gap: 4px; }
  .nav-links a {
    padding: 24px 12px 21px;
    border-bottom: 3px solid transparent;
    font-weight: 850;
    font-size: 14px;
  }
  .nav-links a.active { color: var(--blue); border-bottom-color: var(--blue); }
  .desktop-location { color: var(--blue); font-weight: 850; white-space: nowrap; }
  .desktop-search { width: 210px; height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; outline: 0; }
  .page { padding: 14px 20px 34px; }
  .desktop-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 24px;
    align-items: center;
    min-height: 188px;
    margin-bottom: 20px;
    padding: 26px 34px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(110deg, #f3f8ff, #fff);
    box-shadow: var(--shadow);
  }
  .desktop-hero h2 { margin: 0; color: #0b3f9c; font-size: 34px; line-height: 42px; }
  .desktop-hero p { margin: 10px 0 18px; color: #18427a; font-size: 18px; }
  .hero-bullets { display: flex; gap: 24px; color: #1457c6; font-weight: 850; }
  .hero-stats { padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
  .hero-stats span { display: block; color: var(--muted); font-weight: 750; }
  .hero-stats strong { display: block; margin: 8px 0; color: var(--blue); font-size: 34px; }
  .search-wrap { display: none; }
  .category-strip { justify-content: space-between; overflow: visible; margin-bottom: 8px; }
  .category { min-width: 92px; }
  .category-icon { width: 56px; height: 56px; }
  .content-grid { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .side-panel { display: block; position: sticky; top: 86px; }
  .main-panel, .collection-section { padding: 18px; }
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .coupon-card { min-height: 276px; }
  .collection-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .collection-card { align-items: flex-start; }
  .modal { align-items: center; justify-content: center; padding: 30px; }
  .sheet { max-width: 620px; border-radius: 18px; }
}
