/* Huami Mobile App — dark theme */
:root {
  --bg: #0f1117;
  --card: #1a1d27;
  --accent: #00be06;
  --accent2: #f539a5;
  --text: #e8eaef;
  --muted: #8b92a5;
  --border: rgba(255,255,255,.08);
  --nav-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

#app { min-height: 100%; padding-bottom: calc(var(--nav-h) + var(--safe-b)); }
.view { display: none; min-height: calc(100vh - var(--nav-h)); }
.view.active { display: block; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: rgba(15,17,23,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .logo { height: 28px; width: auto; }
.topbar .title { font-size: 17px; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .back { font-size: 22px; padding: 4px 8px; opacity: .85; }

.grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px;
}
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--card); border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); transition: transform .15s;
}
.card:active { transform: scale(.98); }
.card .thumb { position: relative; aspect-ratio: 16/9; background: #111; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .dur {
  position: absolute; right: 6px; bottom: 6px; font-size: 11px;
  background: rgba(0,0,0,.75); padding: 2px 6px; border-radius: 4px;
}
.card .hd {
  position: absolute; left: 6px; top: 6px; font-size: 10px;
  background: var(--accent); color: #000; font-weight: 700; padding: 1px 5px; border-radius: 3px;
}
.card .meta { padding: 8px 10px 10px; }
.card .meta h3 { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 500; }
.card .meta p { font-size: 11px; color: var(--muted); margin-top: 4px; }

.chips { display: flex; gap: 8px; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 999px; font-size: 13px;
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
}
.chip.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

.search-bar { padding: 8px 12px; }
.search-bar input {
  width: 100%; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 15px; outline: none;
}
.search-bar input:focus { border-color: var(--accent); }

.player-wrap { background: #000; aspect-ratio: 16/9; position: relative; }
.player-wrap video { width: 100%; height: 100%; background: #000; }
.detail { padding: 14px; }
.detail h1 { font-size: 18px; line-height: 1.4; margin-bottom: 8px; }
.detail .stats { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.detail .body { font-size: 14px; color: var(--muted); line-height: 1.6; }
.actions { display: flex; gap: 10px; padding: 0 14px 14px; flex-wrap: wrap; }
.btn {
  padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
  background: var(--card); border: 1px solid var(--border);
}
.btn-primary { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-accent { background: var(--accent2); color: #fff; border-color: var(--accent2); }
.gate {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.gate-card { max-width: 340px; text-align: center; }
.gate-card h2 { font-size: 20px; margin-bottom: 12px; }
.gate-card p { font-size: 14px; color: var(--muted); margin-bottom: 20px; line-height: 1.5; }
.gate-actions { display: flex; gap: 10px; justify-content: center; }

.profile { padding: 20px 14px; text-align: center; }
.profile .avatar {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 12px;
  background: var(--card); border: 2px solid var(--accent); display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.profile h2 { font-size: 18px; margin-bottom: 4px; }
.profile .sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.stats-row { display: flex; justify-content: center; gap: 24px; margin-bottom: 20px; }
.stats-row div { text-align: center; }
.stats-row b { display: block; font-size: 18px; color: var(--accent); }
.stats-row span { font-size: 11px; color: var(--muted); }

.form { padding: 14px; max-width: 400px; margin: 0 auto; }
.form label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.form input {
  width: 100%; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 15px;
}
.form .btn { width: 100%; margin-top: 16px; padding: 12px; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; background: rgba(15,17,23,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 10px; color: var(--muted); gap: 3px; padding-top: 6px;
}
.bottom-nav a.active { color: var(--accent); }
.bottom-nav svg { width: 22px; height: 22px; fill: currentColor; }

.loading, .empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 14px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + var(--safe-b));
  transform: translateX(-50%); background: rgba(0,0,0,.85); color: #fff;
  padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 90;
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.toast.show { opacity: 1; }

.paywall {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: rgba(0,0,0,.7); padding: 16px; text-align: center;
}
.paywall p { margin-bottom: 12px; font-size: 14px; }
