:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #15191f;
  --muted: #5e6672;
  --line: #e4e7ec;
  --accent: #128c4a;        /* chat / WhatsApp action */
  --accent-soft: #e6f5ec;
  --radius: 14px;
  --gutter: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: inherit; }
svg { width: 24px; height: 24px; flex: none; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255,255,255,.94); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.bar-inner {
  max-width: 1000px; margin: 0 auto; min-height: 56px;
  display: flex; align-items: center; gap: 8px; padding: 0 var(--gutter);
}
.logo { font-weight: 800; font-size: 20px; letter-spacing: -.02em; text-decoration: none; }
.bar-title { margin: 0; font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin-left: -10px; border-radius: 50%; text-decoration: none;
}
.back:active { background: var(--line); }
.back svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- page ---------- */
.page { max-width: 1000px; margin: 0 auto; padding: 8px var(--gutter) 32px; }
.intro h1 { font-size: 24px; line-height: 1.2; margin: 16px 0 6px; letter-spacing: -.01em; }
.intro p, .hint { color: var(--muted); margin: 0 0 16px; }
.hint { margin-top: 12px; font-size: 15px; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }

/* ---------- card grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  display: flex; flex-direction: column; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform .12s ease, box-shadow .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.card:active { transform: scale(.98); }
@media (hover: hover) { .card:hover { box-shadow: 0 6px 20px rgba(20,25,35,.08); transform: translateY(-2px); } }
.card-img { display: block; aspect-ratio: 1 / 1; background: #eef0f3; }
.card-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-name {
  display: flex; align-items: center; min-height: 52px; padding: 10px 12px;
  font-weight: 600; font-size: 15px; line-height: 1.25;
}

/* ---------- "other" button ---------- */
.other {
  display: flex; align-items: center; gap: 14px; margin-top: 24px; padding: 16px 18px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid #c6e8d3;
  border-radius: var(--radius); text-decoration: none; min-height: 64px;
}
.other svg { width: 28px; height: 28px; fill: currentColor; }
.other span { display: grid; }
.other b { color: var(--text); font-size: 16px; }
.other small { font-size: 14px; }
.other:active { filter: brightness(.96); }

.home-link { color: var(--accent); font-weight: 600; display: inline-block; padding: 10px 0; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 8px 0 calc(24px + env(safe-area-inset-bottom)); }

/* ---------- language switch ---------- */
.bar-title { flex: 1; min-width: 0; }
.langs {
  margin-left: auto; display: flex; flex: none; padding: 3px; gap: 2px;
  background: #eef0f3; border-radius: 999px;
}
.langs a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; min-height: 36px; padding: 0 10px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.langs a[aria-current] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(20,25,35,.12); }
@media (max-width: 359px) { .langs a { min-width: 34px; padding: 0 7px; } }

/* ---------- search ---------- */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.search { position: relative; margin: 4px 0 20px; }
.search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px;
  fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; pointer-events: none;
}
.search input {
  width: 100%; min-height: 50px; padding: 0 16px 0 44px; font: inherit; font-size: 16px; /* 16px stops iOS zoom */
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 1px 2px rgba(20,25,35,.04); -webkit-appearance: none; appearance: none;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.section-title { font-size: 17px; margin: 0 0 10px; letter-spacing: -.01em; }
#browse > .section-title { margin-top: 24px; }

.results { list-style: none; margin: 0; padding: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.results li + li { border-top: 1px solid var(--line); }
.results a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 64px; text-decoration: none;
  -webkit-tap-highlight-color: transparent; }
.results a:active { background: var(--bg); }
@media (hover: hover) { .results a:hover { background: var(--bg); } }
.results img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: #eef0f3; flex: none; }
.results span { display: grid; min-width: 0; }
.results b { font-weight: 600; }
.results small { color: var(--muted); font-size: 13px; }
.empty-search { color: var(--muted); background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 16px; margin: 0; }

/* ---------- popular ---------- */
.mini-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 128px; gap: 10px;
  overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px;
  margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter);
  scroll-padding-left: var(--gutter); scrollbar-width: none;
}
.mini-row::-webkit-scrollbar { display: none; }
@media (min-width: 900px) {
  .mini-row { grid-auto-flow: row; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0; padding: 0; overflow: visible; }
}
.mini {
  scroll-snap-align: start; display: flex; flex-direction: column; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.mini:active { transform: scale(.98); }
.mini img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; background: #eef0f3; }
.mini span { padding: 8px 10px; font-size: 14px; font-weight: 600; line-height: 1.25; }

/* ---------- offline notice ---------- */
.offline {
  display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 4px; padding: 12px 14px;
  background: #fff6df; color: #6b4a00; border: 1px solid #f1dfae; border-radius: 12px;
  font-size: 15px; line-height: 1.4;
}
.offline svg { width: 20px; height: 20px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
