:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-strong: #eef2f6;
  --text: #17202a;
  --muted: #687684;
  --line: #dfe5eb;
  --accent: #0f8b8d;
  --accent-dark: #0a6668;
  --warn: #c8522c;
  --shadow: 0 12px 30px rgba(22, 32, 42, 0.08);
}

* { box-sizing: border-box; }

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

button, input, select { font: inherit; }

.topbar { background: #111820; color: #fff; }

.topbar__inner {
  width: min(1120px, calc(100% - 32px));
  min-height: 132px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #8fd4d1;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: 34px; line-height: 1.15; }

.status {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  color: #d9e3ea;
  font-size: 13px;
}

.shell { width: min(1120px, calc(100% - 32px)); margin: 20px auto 40px; }

.search-panel {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.search-box {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  box-shadow: var(--shadow);
}

.search-box svg { width: 18px; height: 18px; fill: var(--muted); flex: 0 0 auto; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; }

.filters { display: flex; gap: 10px; }

.filters select {
  height: 44px;
  min-width: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  box-shadow: var(--shadow);
}

.summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 24px;
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.summary strong { color: var(--text); font-size: 18px; }

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

.course-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* Cover: keep Geekbang portraits fully visible instead of cropping into close-ups. */
.cover {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-strong);
  overflow: hidden;
}

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

.cover__fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  font-size: 13px;
}

.card-body { padding: 10px 12px 12px; }

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 20px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.tag {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e7f3f2;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
}

.course-title {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-title a { color: inherit; text-decoration: none; }
.course-title a:hover { color: var(--accent-dark); }

.student-count {
  margin: -2px 0 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.price-row { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 6px; }

.price { color: var(--warn); font-size: 18px; font-weight: 800; }
.origin-price { color: var(--muted); text-decoration: line-through; font-size: 12px; }

.commission {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0 10px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #fff4ee;
  color: #7b361f;
  font-size: 12px;
}

.commission strong { color: var(--warn); font-size: 14px; font-weight: 800; }

.buy-link {
  width: 100%;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
}

.buy-link:hover { background: var(--accent-dark); }
.buy-link svg { width: 16px; height: 16px; fill: currentColor; }

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

.footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto 32px;
  color: var(--muted);
  font-size: 13px;
}

/* ── Cashback contact bar ── */
.cashback-bar {
  background: linear-gradient(135deg, #fff8f4 0%, #fff3ec 100%);
  border-bottom: 1px solid #f0d9cc;
}

.cashback-inner {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.cashback-qr {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #f0d9cc;
}

.cashback-body { flex: 1; min-width: 0; }

.cashback-title {
  margin: 0 0 3px;
  font-size: 14px;
  font-weight: 800;
  color: #b84c1e;
}

.cashback-desc {
  margin: 0 0 4px;
  font-size: 13px;
  color: #7b361f;
  line-height: 1.5;
}

.cashback-rules {
  margin: 0;
  font-size: 11px;
  color: #a05030;
  line-height: 1.5;
  opacity: 0.85;
}

.cashback-desc strong {
  color: #b84c1e;
  font-weight: 700;
}

@media (max-width: 560px) {
  .cashback-inner { gap: 10px; padding: 10px 0; }
  .cashback-qr { flex: 0 0 60px; width: 60px; height: 60px; }
  .cashback-title { font-size: 13px; }
  .cashback-desc { font-size: 12px; }
}

.redirect-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

.redirect-box {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow);
}

.redirect-box h1 { font-size: 22px; }
.redirect-box a { color: var(--accent-dark); font-weight: 700; }

/* Tablet */
@media (max-width: 860px) {
  .topbar__inner {
    min-height: 100px;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    padding: 18px 0;
  }
  h1 { font-size: 24px; }
  .status { width: 100%; }
  .search-panel { grid-template-columns: 1fr; }
  .filters { width: 100%; }
  .filters select { flex: 1 1 0; min-width: 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

/* Mobile: keep 2 columns, very compact */
@media (max-width: 560px) {
  .topbar__inner, .shell, .footer { width: min(100% - 20px, 1120px); }
  h1 { font-size: 20px; }
  .eyebrow { font-size: 11px; }
  .topbar__inner { min-height: 88px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card-body { padding: 8px 10px 10px; }
  .course-title { font-size: 13px; }
  .student-count { font-size: 11px; }
  .price { font-size: 16px; }
  .commission { font-size: 11px; padding: 5px 8px; }
  .commission strong { font-size: 13px; }
  .buy-link { min-height: 34px; font-size: 13px; }
  .search-box { height: 40px; }
  .filters select { height: 40px; }
}
