/* ============ iOS 风格 · 毛玻璃 ============ */
:root {
  --bg: #f2f2f7;
  --glass: rgba(255, 255, 255, .66);
  --glass-strong: rgba(252, 252, 253, .82);
  --ink: #1c1c1e;
  --ink-2: rgba(60, 60, 67, .72);
  --ink-3: rgba(60, 60, 67, .42);
  --line: rgba(60, 60, 67, .12);
  --line-strong: rgba(60, 60, 67, .2);
  --accent: #007aff;          /* iOS system blue */
  --accent-deep: #0062cc;
  --accent-tint: rgba(0, 122, 255, .1);
  --green: #34c759;
  --amber: #ff9500;
  --gray: #8e8e93;
  --fill: rgba(118, 118, 128, .12);   /* iOS systemFill */
  --shadow-card: 0 8px 30px rgba(30, 30, 45, .09);
  --shadow-float: 0 18px 50px rgba(30, 30, 45, .18);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --serif: var(--sans);  /* admin 兼容：统一系统字体 */
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
/* 背景色块：给毛玻璃提供可模糊的色彩层 */
body::before {
  content: ""; position: fixed; inset: -18%; z-index: -1;
  background:
    radial-gradient(42% 34% at 16% 6%, rgba(255, 179, 136, .5) 0%, transparent 70%),
    radial-gradient(40% 32% at 88% 10%, rgba(140, 190, 255, .48) 0%, transparent 70%),
    radial-gradient(48% 38% at 80% 80%, rgba(174, 236, 198, .45) 0%, transparent 70%),
    radial-gradient(42% 34% at 10% 84%, rgba(255, 210, 230, .42) 0%, transparent 70%),
    linear-gradient(180deg, #f7f7fa, #edefF4);
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
img { display: block; }

/* ============ 门禁（毛玻璃卡片） ============ */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.gate-card {
  width: 100%; max-width: 360px;
  background: var(--glass);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 22px;
  padding: 40px 30px 26px;
  text-align: center;
  box-shadow: var(--shadow-float);
}
.gate-mark {
  width: 60px; height: 60px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff;
  font-size: 26px; font-weight: 700;
  border-radius: 14px;                     /* squircle app-icon 风格 */
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.gate-title { font-size: 22px; font-weight: 700; letter-spacing: .02em; }
.gate-sub { font-size: 13px; color: var(--ink-3); margin: 6px 0 24px; }
#gateForm input {
  width: 100%; height: 46px;
  border: none; outline: none;
  background: var(--fill);
  border-radius: 13px;
  padding: 0 16px; font-size: 16px;
  letter-spacing: .12em; text-align: center;
}
#gateForm input:focus { box-shadow: 0 0 0 3px var(--accent-tint); }
#gateForm button {
  width: 100%; height: 46px; margin-top: 12px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 13px;
  font-size: 16px; font-weight: 600;
  transition: transform .15s, background .2s;
}
#gateForm button:active { transform: scale(.97); background: var(--accent-deep); }
.gate-err { color: #ff3b30; font-size: 13px; min-height: 20px; margin-top: 10px; }
.gate-foot { font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 8px; letter-spacing: .04em; }

/* ============ 页眉（毛玻璃吸顶） ============ */
.masthead {
  position: sticky; top: 0; z-index: 30;
  background: rgba(248, 248, 251, .72);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  max-width: 480px; margin: 0 auto; padding: 14px 16px 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark, .gate-mark {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff;
  font-size: 20px; font-weight: 700;
  border-radius: 11px; overflow: hidden; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .14);
}
.brand-mark img, .gate-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-title { font-size: 22px; font-weight: 700; letter-spacing: .01em; line-height: 1.15; }
.brand-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.searchbox {
  display: flex; align-items: center; gap: 7px;
  background: var(--fill);
  border-radius: 12px;
  padding: 0 12px; height: 38px; width: 100%; color: var(--ink-3);
}
.searchbox input { border: none; outline: none; background: transparent; font-size: 16px; width: 100%; color: var(--ink); }
.searchbox input::placeholder { color: var(--ink-3); font-size: 15px; }

/* ============ 区县导航（横向滑动 · 毛玻璃胶囊） ============ */
.districts {
  max-width: 480px; margin: 0 auto;
  padding: 12px 16px;
  display: flex; flex-wrap: nowrap; gap: 8px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.districts::-webkit-scrollbar { display: none; }
.districts button {
  flex-shrink: 0;
  border: none;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(30, 30, 45, .06);
  color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  padding: 7px 15px; border-radius: 999px;
  transition: all .18s;
}
.districts button:hover { color: var(--ink); }
.districts button.active {
  background: var(--accent); color: #fff; font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 122, 255, .3);
}

/* ============ 卡片墙（两列玻璃卡） ============ */
.wrap { max-width: 480px; margin: 0 auto; padding: 4px 16px 48px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.card {
  background: var(--glass-strong);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 17px;
  cursor: pointer; overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform .22s, box-shadow .22s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(30, 30, 45, .14); }
.card:active { transform: scale(.98); }
.card-photo { position: relative; background: var(--fill); overflow: hidden; }
.card-photo img { width: 100%; height: auto; aspect-ratio: 3/4; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-photo img { transform: scale(1.04); }
.card-photo.noimg { aspect-ratio: 3/4; display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 36px; font-weight: 600; }
.card-badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(20, 20, 24, .48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff; font-size: 11px; font-weight: 500;
  padding: 4px 10px; border-radius: 9px;
}
.card-vid {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(20, 20, 24, .48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff; font-size: 11px; padding: 4px 10px; border-radius: 999px;
}
.card-body { padding: 12px 13px 14px; }
.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-name { font-size: 16.5px; font-weight: 650; letter-spacing: .01em; }
.card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip {
  font-size: 11px; font-weight: 500;
  color: var(--ink-2); background: var(--fill);
  border: none; padding: 3px 9px; border-radius: 7px;
}
.chip.level { color: var(--accent); background: var(--accent-tint); }

/* 在岗状态 */
.status-dot { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--gray); }
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gray); flex-shrink: 0; }
.status-dot.on { color: var(--green); }
.status-dot.on::before { background: var(--green); animation: pulse 2s infinite; }
.status-dot.rest { color: var(--amber); }
.status-dot.rest::before { background: var(--amber); }
.status-dot.off { color: var(--gray); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, .4); }
  50% { box-shadow: 0 0 0 5px rgba(52, 199, 89, 0); }
}
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600;
  padding: 5px 13px; border-radius: 999px;
  color: var(--gray); background: var(--fill);
}
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.on { color: var(--green); background: rgba(52, 199, 89, .12); }
.status-pill.rest { color: var(--amber); background: rgba(255, 149, 0, .13); }

/* ============ 空状态 ============ */
.empty { text-align: center; padding: 80px 0; color: var(--ink-3); font-size: 14px; }
.empty button {
  margin-top: 14px; background: var(--glass); border: none;
  padding: 9px 24px; font-size: 14px; font-weight: 500; color: var(--accent);
  border-radius: 12px; box-shadow: 0 2px 10px rgba(30, 30, 45, .07);
}
.colophon { text-align: center; font-size: 12px; color: var(--ink-3); padding-top: 26px; letter-spacing: .03em; }

/* ============ 详情（底部抽屉 · 玻璃板） ============ */
.modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(15, 15, 20, .32);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.modal-body {
  position: relative; width: 100%; max-width: 480px; max-height: 92vh;
  overflow: auto;
  background: var(--glass-strong);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .55); border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 26px 18px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 50px rgba(20, 20, 30, .22);
  animation: sheetUp .3s cubic-bezier(.3, .9, .4, 1);
}
.modal-body::before {           /* 抽屉把手 */
  content: ""; position: absolute; top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 38px; height: 5px; border-radius: 3px;
  background: rgba(60, 60, 67, .25);
}
@keyframes sheetUp {
  from { transform: translateY(60px); opacity: .3; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-close {
  position: absolute; top: 16px; right: 14px; z-index: 5;
  width: 32px; height: 32px; border: none;
  background: var(--fill); color: var(--ink-2);
  font-size: 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(118, 118, 128, .22); }
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
/* 轮播 */
.media-swiper { position: relative; border-radius: 15px; overflow: hidden; background: var(--fill); box-shadow: var(--shadow-card); }
.slides {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  aspect-ratio: 3/4;
}
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; min-width: 0; display: flex; align-items: center; justify-content: center; }
.slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide video { width: 100%; height: 100%; object-fit: contain; background: #101014; display: block; }
.media-count {
  position: absolute; top: 10px; left: 10px;
  background: rgba(20, 20, 24, .5);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #fff; font-size: 11.5px; font-weight: 600;
  padding: 4px 11px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.media-empty {
  aspect-ratio: 3/4; display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); border-radius: 15px; background: var(--fill); font-size: 14px;
}
/* 全屏查看器（沉浸式黑底） */
.viewer { position: fixed; inset: 0; z-index: 120; background: #000; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.viewer-slides {
  display: flex; height: 100%; overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.viewer-slides::-webkit-scrollbar { display: none; }
.viewer .slide { flex: 0 0 100%; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; display: flex; align-items: center; justify-content: center; }
.viewer .slide img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .slide video { width: 100%; max-height: 100%; background: #000; }
.viewer-close {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 5;
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: #fff; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.viewer-count {
  position: absolute; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); z-index: 5;
  color: #fff; font-size: 13px; font-weight: 600;
  background: rgba(255, 255, 255, .16);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 5px 15px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.detail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-head h2 { font-size: 25px; font-weight: 750; letter-spacing: .01em; }
.detail-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.detail-chips .chip { font-size: 12.5px; padding: 5px 12px; border-radius: 9px; }
.detail-intro { margin-top: 14px; font-size: 14.5px; color: var(--ink-2); white-space: pre-wrap; }
.detail-meta { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 12px; color: var(--ink-3); display: flex; gap: 16px; flex-wrap: wrap; }

/* ============ 响应式 ============ */
@media (min-width: 640px) {
  #main { max-width: 480px; margin: 0 auto; min-height: 100vh; box-shadow: 0 0 60px rgba(30, 30, 45, .14); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
