/* ===========================
   肌知道 · 全局变量
=========================== */
:root {
  --green:        #4a7c59;
  --green-dark:   #2d5a3d;
  --green-light:  #e8f3ec;
  --green-mid:    #8abf9a;
  --bg:           #f7f6f2;
  --white:        #ffffff;
  --text:         #1a1a1a;
  --text-sub:     #666666;
  --border:       #e4e4e0;
  --radius:       14px;
  --shadow:       0 2px 16px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 28px rgba(0,0,0,0.13);
  --font:         'Noto Sans SC', -apple-system, 'PingFang SC', 'Hiragino Sans GB', sans-serif;
}

/* ===========================
   Reset & Base
=========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

ul, ol { list-style: none; }

/* ===========================
   HEADER
=========================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.logo-zh {
  font-size: 20px;
  font-weight: 700;
  color: var(--green-dark);
  letter-spacing: 1px;
}

.logo-sub {
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 400;
}

.admin-link {
  font-size: 18px;
  color: var(--text-sub);
  opacity: 0.5;
  transition: opacity .2s;
  padding: 6px;
}
.admin-link:hover { opacity: 1; }

/* ===========================
   HERO
=========================== */
.hero {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
  color: #fff;
  padding: 52px 20px 48px;
  text-align: center;
}

.hero-inner { max-width: 600px; margin: 0 auto; }

.hero h1 {
  font-size: clamp(22px, 5vw, 32px);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.hero p {
  font-size: 14px;
  opacity: 0.88;
  line-height: 1.8;
}

/* ===========================
   FILTER BAR
=========================== */
.filter-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 58px;
  z-index: 90;
}

.filter-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  height: 52px;
  align-items: center;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.filter-inner::-webkit-scrollbar { display: none; }

.filter-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-sub);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--green-mid);
  color: var(--green);
}

.filter-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 500;
}

/* ===========================
   MAIN CONTENT
=========================== */
.main-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 16px 60px;
}

/* ===========================
   CARDS GRID
=========================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px 20px 18px;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeUp .35s ease both;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--green-mid);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-emoji {
  font-size: 28px;
  flex-shrink: 0;
  line-height: 1;
}

.card-names { flex: 1; }

.card-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.card-name-en {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 2px;
  font-weight: 400;
}

.card-category {
  display: inline-block;
  font-size: 11px;
  color: var(--green);
  background: var(--green-light);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
  align-self: flex-start;
}

.card-intro {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.card-count {
  font-size: 12px;
  color: var(--text-sub);
}

.card-btn {
  font-size: 12px;
  color: var(--green);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-btn::after {
  content: '→';
  transition: transform .2s;
}

.card:hover .card-btn::after {
  transform: translateX(3px);
}

/* hidden when filtered */
.card.hidden { display: none; }

/* ===========================
   COMMON NOTE BOX
=========================== */
.common-note-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.common-note-icon { font-size: 24px; }

.common-note-box h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.common-note-box ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.common-note-box ul li {
  font-size: 13px;
  color: var(--text-sub);
  padding-left: 16px;
  position: relative;
  line-height: 1.65;
}

.common-note-box ul li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--green-mid);
}

/* ===========================
   MODAL OVERLAY
=========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  backdrop-filter: blur(2px);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ===========================
   MODAL
=========================== */
.modal {
  background: var(--white);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 680px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 28px 24px 40px;
  position: relative;
  transform: translateY(40px);
  transition: transform .3s cubic-bezier(.22,1,.36,1);
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.modal::-webkit-scrollbar { display: none; }

.modal-overlay.open .modal {
  transform: translateY(0);
}

/* PC: center modal */
@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
  }
  .modal {
    border-radius: 20px;
    max-height: 85vh;
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 18px;
  background: var(--bg);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-sub);
  transition: background .2s;
}
.modal-close:hover { background: var(--border); }

/* ===========================
   MODAL CONTENT
=========================== */
.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
  padding-right: 36px;
}

.modal-emoji { font-size: 38px; line-height: 1; flex-shrink: 0; }

.modal-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.modal-name-en {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 3px;
}

.modal-devices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.device-tag {
  font-size: 11px;
  background: var(--green-light);
  color: var(--green-dark);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.modal-section {
  margin-bottom: 24px;
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-sub);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.aftercare-label { color: var(--green); }

.modal-intro {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.75;
}

.aftercare-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aftercare-list li {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
  display: flex;
  gap: 10px;
}

.aftercare-list li .num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: var(--green-light);
  color: var(--green);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.aftercare-list li.warning { color: #c0392b; }
.aftercare-list li.warning .num { background: #fdecea; color: #c0392b; }

.modal-common {
  background: var(--bg);
  border-radius: 12px;
  padding: 16px 18px;
  margin-top: 8px;
}

.common-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-sub);
  letter-spacing: 1px;
  display: block;
  margin-bottom: 10px;
}

.modal-common ul {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-common ul li {
  font-size: 12px;
  color: var(--text-sub);
  padding-left: 14px;
  position: relative;
  line-height: 1.6;
}

.modal-common ul li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--green-mid);
  font-size: 16px;
  line-height: 1.4;
}

/* ===========================
   FOOTER
=========================== */
.site-footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-sub);
  border-top: 1px solid var(--border);
  background: var(--white);
}

/* ===========================
   RESPONSIVE — mobile first
=========================== */
@media (max-width: 400px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .hero h1 { font-size: 20px; }
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 860px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
