/* Maternal-resource site - kzo.moe-inspired card layout, mobile-first.
 *
 * Breakpoints:
 *   - default (mobile)        : 2-column grid, 16px padding
 *   - >= 600px (tablet)       : 3-column grid
 *   - >= 960px (desktop)      : 4-5 column grid + wider gutter
 *
 * Touch targets are >= 44px tall, taps don't sit on tiny SVGs, and the
 * top category bar is horizontally scrollable on narrow screens.
 */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", sans-serif;
  background: #f6f7fb;
  color: #2b2d33;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(255, 118, 147, 0.15);
}
a { color: #ff7693; text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; height: auto; }
code { background: #f0f0f5; padding: 1px 6px; border-radius: 4px; font-size: 0.95em; }
.muted { color: #888; }
.small { font-size: 0.85em; }

/* ------------- top bar (mobile-first) ------------- */
.topbar {
  background: linear-gradient(135deg, #ffeef4 0%, #fff7eb 100%);
  border-bottom: 1px solid #f0d6e0;
  padding: 14px 0 0;
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(8px);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #2b2d33;
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #ff7693, #ffb56b);
  color: #fff;
  font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(255, 118, 147, 0.35);
}
.brand-name { font-size: 18px; font-weight: 700; }
.brand-tag  { font-size: 11px; color: #999; }
.search { flex: 1 1 100%; min-width: 0; order: 99; margin-top: 8px; }
.search input {
  width: 100%; padding: 10px 14px;
  border: 1px solid #ecd6df; border-radius: 999px;
  background: #fff; font-size: 15px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input:focus { border-color: #ff7693; box-shadow: 0 0 0 3px rgba(255,118,147,0.15); }

/* category nav: horizontally scrollable on narrow screens */
.cats {
  max-width: 1200px;
  margin: 10px auto 0;
  padding: 4px 16px 12px;
  display: flex; gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: rgba(255,255,255,0.7); color: #5a5d66;
  font-size: 13px; text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}
.cat:hover { background: #fff; border-color: #f0d6e0; text-decoration: none; }
.cat.active { background: #ff7693; color: #fff; border-color: #ff7693; }
.cat .badge {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: rgba(0,0,0,0.08); color: inherit;
}
.cat.active .badge { background: rgba(255,255,255,0.3); }

/* ------------- main ------------- */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}
.page-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 4px 0 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.page-head h1 { margin: 0; font-size: 20px; }

/* card grid - mobile-first 2 cols */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.card {
  display: block;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none; color: inherit;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover, .card:active {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.1);
  text-decoration: none;
}
.card-cover {
  position: relative;
  aspect-ratio: 3/4;
  background: #f0f0f5;
  overflow: hidden;
}
.card-cover img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.3s;
}
.card:hover .card-cover img { transform: scale(1.04); }
.cover-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #fff7eb 0%, #ffeef4 100%);
  color: #c89aa8;
}
.placeholder-label { font-size: 13px; color: #b59; font-weight: 600; }
.cover-placeholder svg { width: 64px; height: 64px; }
.card-cat {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
}
.card-type {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,0.92);
  color: #444;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.type-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef1f7;
  color: #3a4055;
}
.type-audio,    .card-type.type-audio    { background: #fff1d6; color: #a06a00; }
.type-video,    .card-type.type-video    { background: #ffe2e2; color: #b03030; }
.type-document, .card-type.type-document { background: #e3f0ff; color: #1f5aa6; }
.type-image,    .card-type.type-image    { background: #e9ffe6; color: #2c7c2c; }
.type-mixed,    .card-type.type-mixed    { background: #f0eaff; color: #5b3eb1; }
.card-body { padding: 10px 12px 12px; }
.card-title {
  font-size: 13px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}
.card-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: #999;
  margin-top: 6px;
}

/* empty state */
.empty {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border-radius: 12px;
  color: #555;
}
.empty h1 { font-size: 56px; margin: 0 0 12px; color: #ff7693; }

/* ------------- detail page ------------- */
.detail {
  background: #fff;
  border-radius: 10px;
  padding: 18px 16px 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.back {
  display: inline-block; font-size: 13px; color: #888;
  margin-bottom: 10px;
  padding: 6px 0;
}
.detail-title {
  font-size: 19px;
  margin: 0 0 10px;
  line-height: 1.35;
  word-break: break-word;
}
.detail-meta {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 12px;
  margin-bottom: 16px;
}
/* carousel: cover + gallery merged into one swipeable preview */
.carousel {
  position: relative;
  margin: 0 -16px 16px;
  background: #1a1a22;     /* dark backdrop highlights book covers */
  overflow: hidden;
  user-select: none;
}
.carousel-frame {
  position: relative;
  width: 100%;
  /* viewport that keeps a stable aspect ratio so navigation feels stable */
  aspect-ratio: 16 / 11;
  display: flex;
  align-items: center;
  justify-content: center;
}
.carousel-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.carousel-img.active {
  opacity: 1;
  pointer-events: auto;
}
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.85);
  color: #333;
  border: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 26px;
  line-height: 38px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  transition: background 0.15s, transform 0.1s;
}
.carousel-btn:hover { background: #fff; }
.carousel-btn:active { transform: translateY(-50%) scale(0.94); }
.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }
.carousel-btn[hidden] { display: none; }

.carousel-counter {
  position: absolute;
  top: 12px; right: 14px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.5px;
}
.carousel-dots {
  position: absolute;
  bottom: 10px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 6px;
}
.carousel-dots .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.carousel-dots .dot.active {
  background: #fff;
  transform: scale(1.3);
}

/* pan block */
.pan-block {
  margin: 18px 0;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fff7eb, #ffeef4);
  border-radius: 10px;
}
.pan-block h2 { margin: 0 0 10px; font-size: 15px; }
.pan-masked {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #fff;
  border: 1px dashed #f0c0d0;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 10px;
  color: #b59;
  letter-spacing: 1px;
  font-size: 13px;
  word-break: break-all;
  overflow-wrap: break-word;
}
.pan-reveal {
  background: #ff7693; color: #fff; border: none;
  padding: 12px 22px; border-radius: 999px;
  font-size: 15px; cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 10px rgba(255,118,147,0.3);
  transition: all 0.15s;
  min-height: 44px;
}
.pan-reveal:hover:not(:disabled),
.pan-reveal:active:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(255,118,147,0.4);
}
.pan-reveal:disabled { background: #c5c8d0; cursor: not-allowed; box-shadow: none; }
.pan-real {
  margin-top: 12px;
  padding: 12px 14px;
  background: #fff;
  border-left: 3px solid #ff7693;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
  font-size: 13px;
}
.pan-real a { color: #ff7693; }
.pan-real .row { margin: 4px 0; }

/* description */
.desc { margin: 20px 0; }
.desc h2 { font-size: 15px; margin: 0 0 8px; }
.desc.xhs .desc-body {
  background: linear-gradient(135deg, #fff5f7 0%, #fff9ee 100%);
  border: 1px solid #ffd6e0;
  color: #4a2030;
  font-size: 14px;
  line-height: 1.85;
  letter-spacing: 0.2px;
}
.desc.raw .desc-body {
  color: #555;
  font-size: 12.5px;
  max-height: 200px;
  overflow: auto;
}
.desc-body {
  white-space: pre-wrap;
  font-family: inherit;
  background: #fafbfd;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #eef0f4;
  font-size: 13.5px;
  line-height: 1.7;
  margin: 0;
  word-break: break-word;
}

/* gallery */
.gallery h2 { font-size: 15px; margin: 20px 0 8px; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.gallery-grid img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 6px;
  background: #f0f0f5;
  cursor: pointer;
}

/* footer */
.footer {
  max-width: 1200px;
  margin: 32px auto 0;
  padding: 20px 16px;
  text-align: center;
  font-size: 12px;
  color: #888;
}
.footer div + div { margin-top: 4px; }

/* ============================================================
 * Account / VIP / admin pages
 * ============================================================ */

/* top user nav (right side of topbar) */
.user-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}
.user-link {
  color: #5a5d66;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
}
.user-link:hover { background: rgba(255,255,255,0.6); text-decoration: none; color: #2b2d33; }
.user-link.primary {
  background: #ff7693; color: #fff;
}
.user-link.primary:hover { background: #ff5a7d; color: #fff; }
.user-link.admin {
  background: #ffe6b3; color: #6e4500;
}
.user-link.admin:hover { background: #ffd87a; color: #6e4500; }
.vip-pill {
  display: inline-flex; align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fff7eb; color: #a06a00;
  border: 1px solid #ffd683;
  white-space: nowrap;
}
.vip-pill.active {
  background: linear-gradient(135deg, #ffd54a, #ff9a3d);
  color: #5a3300;
  border-color: transparent;
}
.vip-pill:hover { text-decoration: none; }

/* shared auth/account card */
.auth-card,
.account-page,
.vip-page,
.admin-page {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  padding: 28px 24px;
  max-width: 560px;
  margin: 20px auto;
}
.admin-page { max-width: 1100px; }
.vip-page { max-width: 720px; }
.auth-card h1, .account-page h1, .vip-page h1, .admin-page h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

.flash {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13.5px;
  margin: 12px 0;
  line-height: 1.55;
}
.flash-success { background: #e8f6e3; border: 1px solid #c6e6bc; color: #2c6a23; }
.flash-error   { background: #fce4e4; border: 1px solid #f5b7b7; color: #962020; }

/* auth form */
.auth-form { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; }
.auth-form label > span { font-size: 13px; color: #555; }
.auth-form input,
.auth-form select,
.auth-form textarea {
  padding: 10px 14px;
  border: 1px solid #e0e2ea;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fafbfd;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus {
  border-color: #ff7693;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,118,147,0.13);
}
.auth-form textarea { resize: vertical; }

.btn-primary, .btn-secondary {
  display: inline-block;
  min-height: 44px;
  padding: 10px 22px;
  font-size: 15px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}
.btn-primary {
  background: #ff7693; color: #fff;
  box-shadow: 0 4px 10px rgba(255,118,147,0.3);
}
.btn-primary:hover { background: #ff5a7d; transform: translateY(-1px); }
.btn-secondary {
  background: #f0f1f6; color: #444;
}
.btn-secondary:hover { background: #e6e8ee; }
.btn-link-inline {
  display: inline-block;
  margin-left: 8px;
  color: #ff7693;
  font-size: 13px;
}

.auth-foot { margin-top: 14px; font-size: 13px; text-align: center; }

/* account page */
.acct-card {
  background: #fafbfd;
  border: 1px solid #eef0f4;
  border-radius: 10px;
  padding: 16px 18px;
  margin: 18px 0;
}
.acct-card h2 { margin: 0 0 12px; font-size: 15px; }
.acct-row {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed #e7e9f0;
  font-size: 13.5px;
}
.acct-row:last-child { border-bottom: none; }
.acct-label {
  flex-shrink: 0;
  width: 90px;
  color: #888;
  font-size: 12.5px;
}
.acct-val { flex: 1; word-break: break-word; }
.acct-val b { color: #ff7693; }

.vip-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.vip-badge.active {
  background: linear-gradient(135deg, #ffd54a, #ff9a3d);
  color: #5a3300;
}
.vip-badge.inactive {
  background: #eef0f4;
  color: #888;
}

.acct-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* order table */
.order-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.order-table th, .order-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef0f4;
  text-align: left;
  vertical-align: top;
}
.order-table th { color: #888; font-weight: normal; font-size: 12px; }
.order-table code { font-size: 12px; }
.order-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.order-status.paid     { background: #e4f5dd; color: #2c7c2c; }
.order-status.pending  { background: #fff4d6; color: #8a5b00; }
.order-status.rejected { background: #fce4e4; color: #962020; }

/* vip page */
.vip-hero {
  text-align: center;
  margin-bottom: 16px;
}
.vip-hero h1 {
  background: linear-gradient(135deg, #ff7693, #ff9a3d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.vip-sub { color: #888; font-size: 14px; margin: 4px 0 0; }
.vip-price-card {
  text-align: center;
  padding: 22px 20px;
  background: linear-gradient(135deg, #fff7eb 0%, #ffeef4 100%);
  border-radius: 12px;
  margin: 16px 0 20px;
}
.vip-price {
  font-weight: 700;
  margin-bottom: 14px;
}
.amt-yuan { font-size: 22px; color: #ff7693; vertical-align: top; }
.amt-num  { font-size: 56px; color: #ff5a7d; }
.amt-unit { font-size: 14px; color: #888; margin-left: 4px; }
.vip-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  max-width: 380px;
  margin: 0 auto;
  gap: 6px;
}
.vip-features li { font-size: 13.5px; color: #2b2d33; }
.vip-already {
  margin-top: 14px;
  padding: 8px 12px;
  background: #fff;
  border-left: 3px solid #ff9a3d;
  border-radius: 6px;
  font-size: 13px;
}
.vip-pending {
  margin: 18px 0;
  padding: 16px;
  background: #fff8e6;
  border: 1px solid #ffd683;
  border-radius: 10px;
  font-size: 13.5px;
}
.vip-pending h2 { margin: 0 0 8px; font-size: 15px; }

.vip-pay { margin: 20px 0; }
.vip-pay h2 { margin: 0 0 10px; font-size: 15px; }
.pay-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.pay-tab {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #e0e2ea;
  background: #fff;
  color: #5a5d66;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.pay-tab.active {
  background: #ff7693;
  border-color: #ff7693;
  color: #fff;
}
.pay-panel { text-align: center; padding: 14px 0; }
.pay-panel.hidden { display: none; }
.qr-box {
  display: inline-block;
  padding: 8px;
  background: #fff;
  border: 1px solid #e0e2ea;
  border-radius: 8px;
}
.qr-box img { width: 220px; height: 220px; display: block; }
.qr-placeholder {
  width: 220px; height: 220px;
  background: #f7f8fb;
  display: flex; align-items: center; justify-content: center;
  color: #999; font-size: 13px; text-align: center;
}
.pay-note { font-size: 13.5px; color: #555; margin-top: 12px; }
.pay-note b { color: #ff5a7d; font-size: 16px; }

.vip-form { margin-top: 20px; }
.vip-form h2 { font-size: 15px; margin: 0 0 4px; }

.vip-faq { margin-top: 24px; }
.vip-faq h2 { font-size: 15px; margin: 0 0 8px; }
.vip-faq details {
  border: 1px solid #eef0f4;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: #fafbfd;
  font-size: 13.5px;
}
.vip-faq summary { cursor: pointer; font-weight: 500; }
.vip-faq p { margin: 8px 0 0; color: #555; }

/* quota hints on the detail page */
.quota-hint {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin: 10px 0;
  line-height: 1.5;
}
.quota-hint.ok   { background: #e8f6e3; color: #2c6a23; border: 1px solid #c6e6bc; }
.quota-hint.warn { background: #fce4e4; color: #962020; border: 1px solid #f5b7b7; }
.quota-hint.info { background: #fff4d6; color: #8a5b00; border: 1px solid #f5dcc0; }
.quota-hint a { color: inherit; text-decoration: underline; font-weight: 600; }

/* admin orders */
.admin-tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.admin-tabs .tab {
  padding: 7px 14px;
  background: #f0f1f6;
  color: #555;
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
}
.admin-tabs .tab.active {
  background: #ff7693;
  color: #fff;
}
.admin-tabs .tab .badge {
  background: rgba(0,0,0,0.1);
  color: inherit;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  margin-left: 6px;
}
.admin-tabs .tab.active .badge { background: rgba(255,255,255,0.25); }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.admin-table th, .admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef0f4;
  vertical-align: top;
  text-align: left;
}
.admin-table th { color: #888; font-weight: normal; font-size: 11.5px; }
.admin-table .cell-wrap { max-width: 200px; word-break: break-all; white-space: normal; }
.btn-sm {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  margin-right: 4px;
}
.btn-good { background: #2c7c2c; color: #fff; }
.btn-bad  { background: #b53030; color: #fff; }

/* error rows in reveal panel */
.pan-real .row.err {
  background: #fce4e4;
  color: #962020;
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 3px solid #b53030;
}

/* ============================================================
 * VIP redeem (兑换码) UI
 * ============================================================ */

.acct-card.redeem-inline {
  background: linear-gradient(135deg, #fff7eb 0%, #ffeef4 100%);
  border: 1px solid #ffd6e0;
}
.acct-card.redeem-inline h2 {
  margin: 0 0 6px;
  font-size: 15px;
}

.redeem-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.redeem-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 12px 14px;
  font-size: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 1px solid #ffc9d8;
  border-radius: 8px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.redeem-input:focus {
  border-color: #ff7693;
  box-shadow: 0 0 0 3px rgba(255,118,147,0.15);
}
.redeem-input::placeholder {
  color: #c5a4b1;
  letter-spacing: 0.5px;
}
.redeem-btn {
  flex: 0 0 auto;
}

.vip-buy ol.buy-steps {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  counter-reset: step;
}
.vip-buy ol.buy-steps li {
  counter-increment: step;
  padding: 12px 16px 12px 50px;
  background: #fafbfd;
  border: 1px solid #eef0f4;
  border-radius: 10px;
  margin-bottom: 8px;
  position: relative;
  font-size: 13.5px;
}
.vip-buy ol.buy-steps li::before {
  content: counter(step);
  position: absolute;
  left: 14px; top: 14px;
  width: 26px; height: 26px;
  background: #ff7693;
  color: #fff;
  font-weight: 600;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.vip-buy ol.buy-steps li p {
  margin: 4px 0 0;
}
.customer-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 10px 0;
}
.customer-qr img {
  width: 160px; height: 160px;
  border: 1px solid #e0e2ea;
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}

.vip-redeem {
  margin: 22px 0;
  padding: 18px 18px 22px;
  background: linear-gradient(135deg, #fff7eb 0%, #ffeef4 100%);
  border-radius: 12px;
}
.vip-redeem h2 { margin: 0 0 6px; font-size: 16px; }

/* admin stats card row */
.admin-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.admin-stats .stat {
  flex: 1 1 110px;
  background: #fafbfd;
  border: 1px solid #eef0f4;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
  min-width: 100px;
}
.admin-stats .stat b {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: #2b2d33;
  line-height: 1.1;
  margin-bottom: 2px;
}
.admin-stats .stat span {
  display: block;
  font-size: 12px;
  color: #888;
}
.admin-stats .stat.ok   b { color: #2c7c2c; }
.admin-stats .stat.used b { color: #1f5aa6; }
.admin-stats .stat.bad  b { color: #b53030; }

.admin-toolbar {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: #fafbfd;
  border: 1px solid #eef0f4;
  border-radius: 10px;
}
.genkey-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  flex: 1;
}
.genkey-form label {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 11.5px;
  color: #888;
}
.genkey-form input {
  padding: 7px 10px;
  border: 1px solid #e0e2ea;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  width: 110px;
  font-family: inherit;
}
.genkey-form input[name="batch"],
.genkey-form input[name="note"] { width: 150px; }
.export-area { display: flex; gap: 6px; flex-wrap: wrap; }

.key-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: 0.5px;
  background: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #e6e8ee;
}

@media (min-width: 600px) {
  .redeem-form { flex-wrap: nowrap; }
  .redeem-input { font-size: 18px; padding: 14px 18px; }
}

/* ============================================================
 * Static pages (about / privacy / terms / feedback)
 * ============================================================ */
.static-page {
  max-width: 760px;
  margin: 20px auto;
  padding: 28px 28px 40px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #eef0f4;
  font-size: 14.5px;
  line-height: 1.75;
  color: #2b2d33;
}
.static-page h1 {
  font-size: 26px;
  margin: 0 0 6px;
  color: #1d1f23;
}
.static-body h2 {
  font-size: 17px;
  margin: 28px 0 8px;
  color: #1d1f23;
  padding-bottom: 4px;
  border-bottom: 1px solid #f0f1f5;
}
.static-body p   { margin: 10px 0; }
.static-body ul  { padding-left: 22px; margin: 8px 0; }
.static-body li  { margin: 4px 0; }
.static-body a   { color: #2b6ad9; }

/* filter bar */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0 16px;
  padding: 10px 14px;
  background: #fafbfd;
  border: 1px solid #eef0f4;
  border-radius: 10px;
  align-items: center;
}
.filter-bar .filt {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-bar .filt label {
  font-size: 12px;
  color: #888;
}
.filter-bar select {
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid #e0e2ea;
  border-radius: 6px;
  background: #fff;
  font-family: inherit;
  color: #333;
  min-width: 96px;
  cursor: pointer;
}
.filter-bar select:focus {
  outline: 2px solid rgba(255,118,147,0.25);
}

/* pagination */
.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 24px 0 8px;
}
.pager .pg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #e0e2ea;
  border-radius: 6px;
  background: #fff;
  color: #333;
  text-decoration: none;
  font-size: 13.5px;
}
.pager .pg:hover { background: #ffeef4; border-color: #ffc9d8; color: #ff7693; }
.pager .pg.active {
  background: #ff7693;
  color: #fff;
  border-color: #ff7693;
  font-weight: 600;
}
.pager .pg.disabled {
  color: #c8c8d0;
  background: #fafafa;
  cursor: not-allowed;
}
.pager .pg.ellipsis {
  border: none;
  background: transparent;
  color: #aaa;
}

/* error page */
.error-page {
  max-width: 480px;
  margin: 60px auto;
  text-align: center;
  padding: 40px 24px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #eef0f4;
}
.error-emoji { font-size: 72px; line-height: 1; margin-bottom: 12px; }
.error-page h1 { font-size: 26px; margin: 6px 0 14px; color: #1d1f23; }
.error-actions {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
}
.error-actions li { margin: 8px 0; }
.error-actions a {
  display: inline-block;
  padding: 8px 16px;
  background: #f5f5f7;
  color: #333;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13.5px;
}
.error-actions a:hover { background: #ff7693; color: #fff; }

/* footer links */
.footer-links {
  margin-bottom: 8px;
  font-size: 13px;
}
.footer-links a {
  color: #555;
  text-decoration: none;
  margin: 0 2px;
}
.footer-links a:hover { color: #ff7693; }
.footer-links .sep { color: #ccc; margin: 0 4px; }

/* ============================================================
 * Phase B: encyclopedia detail page + richer cards
 * ============================================================ */

/* ---- card extras ---- */
.card-one-liner {
  font-size: 12px;
  color: #5a5d66;
  line-height: 1.45;
  margin: 6px 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}
.card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 6px;
}
.pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f0f1f6;
  color: #555;
  white-space: nowrap;
  line-height: 1.6;
}
.pill.age   { background: #fff4d6; color: #8a5b00; }
.pill.diff  { background: #e9f0ff; color: #2150a0; }
.pill.cefr  { background: #ecf6e4; color: #2e6b1d; }
.pill.rate  { background: #fff0f0; color: #b53030; font-weight: 600; }
.card-pick {
  position: absolute; top: 8px; right: 8px;
  background: #ffd54a;
  color: #5a3a00;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
/* When editor_pick exists, push the type pill down so they don't overlap */
.card .card-pick + .card-type,
.card-cover .card-pick ~ .card-type {
  top: 34px;
}

/* ---- detail header ---- */
.detail-head {
  margin-bottom: 16px;
}
.detail-subtitle {
  color: #888;
  font-size: 13px;
  margin: -4px 0 8px;
}
.one-liner {
  font-size: 15px;
  color: #2b2d33;
  background: linear-gradient(135deg, #fff7eb 0%, #ffeef4 100%);
  border-left: 3px solid #ff7693;
  padding: 12px 14px;
  border-radius: 0 8px 8px 0;
  margin: 12px 0 0;
  line-height: 1.6;
  font-weight: 500;
}

/* extra meta pills */
.age-pill {
  display: inline-block;
  background: #fff4d6;
  color: #8a5b00;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.diff-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef1f7;
  color: #3a4055;
}
.diff-pill.diff-starter      { background: #fef0d8; color: #9c6b00; }
.diff-pill.diff-beginner     { background: #e8f0ff; color: #1f5aa6; }
.diff-pill.diff-intermediate { background: #f0eaff; color: #5b3eb1; }
.diff-pill.diff-advanced     { background: #ffe2e2; color: #b03030; }
.rating-pill {
  display: inline-block;
  background: #fff0f0;
  color: #b53030;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

/* ---- specs grid ---- */
.specs {
  margin: 22px 0;
  padding: 16px 16px 12px;
  background: #fafbfd;
  border: 1px solid #eef0f4;
  border-radius: 10px;
}
.specs h2 {
  font-size: 15px;
  margin: 0 0 12px;
}
.specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
  margin: 0;
}
.spec {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
  margin: 0;
  min-width: 0;
}
.spec.full { grid-column: 1 / -1; }
.spec dt {
  font-size: 11px;
  color: #999;
  margin: 0 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.spec dd {
  margin: 0;
  font-size: 13.5px;
  color: #2b2d33;
  word-break: break-word;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block;
  background: #fff;
  color: #ff7693;
  border: 1px solid #ffd6e0;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
}
.file-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fb-item {
  background: #fff;
  border: 1px solid #e6e8ee;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: #555;
}

/* ---- review (pros / cons) ---- */
.review {
  margin: 22px 0;
}
.review h2 { font-size: 15px; margin: 0 0 12px; }
.review-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.review-col {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid #eef0f4;
}
.review-col h3 {
  font-size: 14px;
  margin: 0 0 10px;
}
.review-col.pros {
  background: #f4fbf3;
  border-color: #d6ebd2;
}
.review-col.pros h3 { color: #2c7c2c; }
.review-col.cons {
  background: #fff8f0;
  border-color: #f5dcc0;
}
.review-col.cons h3 { color: #a06a00; }
.review-col ul {
  margin: 0;
  padding-left: 18px;
}
.review-col li {
  margin: 4px 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: #333;
}

/* ---- fit (best for / not for / how to use) ---- */
.fit {
  margin: 22px 0;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #eef0f4;
  border-radius: 10px;
}
.fit h2 { font-size: 15px; margin: 0 0 12px; }
.fit-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px dashed #eef0f4;
}
.fit-row:last-child { border-bottom: none; }
.fit-row p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: #2b2d33;
}
.fit-tag {
  flex-shrink: 0;
  display: inline-block;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 600;
  min-width: 76px;
  text-align: center;
}
.fit-row.good .fit-tag { background: #e4f4dd; color: #1f6a18; }
.fit-row.bad  .fit-tag { background: #fde2e2; color: #a02020; }
.fit-row.how  .fit-tag { background: #e1ecff; color: #1f4f9a; }

/* ---- raw body collapsible toggle ---- */
.raw-toggle {
  cursor: pointer;
  user-select: none;
}
.raw-toggle:hover { color: #ff7693; }

/* ============================================================
 * TABLET  (>= 600px)
 * ============================================================ */
@media (min-width: 600px) {
  .topbar-inner {
    padding: 0 24px;
    flex-wrap: nowrap;
  }
  .brand-name { font-size: 20px; }
  .brand-tag  { font-size: 12px; margin-left: 4px; }
  .search { flex: 1; max-width: 420px; order: 0; margin-top: 0; margin-left: auto; }
  .cats { padding: 6px 24px 14px; }
  .main { padding: 24px; }
  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  .card-title { font-size: 14px; min-height: 2.9em; }
  .card-body { padding: 12px 14px; }
  .page-head h1 { font-size: 22px; }
  .detail { padding: 24px 28px; }
  .detail-cover { margin: 0 -28px 22px; }
  .detail-title { font-size: 22px; }
  .pan-reveal { width: auto; }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }
  .specs-grid { grid-template-columns: repeat(3, 1fr); }
  .review-cols { grid-template-columns: 1fr 1fr; }
  .user-nav { gap: 10px; }
  .user-link, .vip-pill { font-size: 13px; padding: 6px 12px; }
}

/* ============================================================
 * DESKTOP (>= 960px)
 * ============================================================ */
@media (min-width: 960px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
  }
  .detail { padding: 28px 32px; }
  .detail-cover { margin: 0 -32px 24px; }
  .detail-title { font-size: 24px; }
}
