/* ==========================================================
 * 明厨亮灶 H5 · 样式
 * 移动优先，最大宽度 480px，桌面端居中显示
 * ========================================================== */

:root {
  --primary: #1677ff;
  --primary-dark: #0d5fd6;
  --danger: #f5222d;
  --warn: #fa8c16;
  --ok: #00a870;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #8a94a6;
  --line: #eaecf0;
  --bg: #f5f7fa;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .14);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: #e9edf3;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

img { display: block; max-width: 100%; }
button { font-family: inherit; border: 0; background: none; padding: 0; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }

.phone {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(16, 24, 40, .04), 0 30px 80px -30px rgba(16, 24, 40, .35);
}

.app { min-height: 100vh; }

.page {
  padding-bottom: calc(84px + var(--safe-b));
  animation: page-in .28s cubic-bezier(.22, .61, .36, 1);
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------------- 顶部 ---------------- */

.hero {
  position: relative;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 20px 74px;
  background: linear-gradient(150deg, #1b3a8f 0%, #1677ff 46%, #2ea3ff 100%);
  color: #fff;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -80px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .28), transparent 68%);
}

.hero-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  z-index: 1;
}

.hero-greeting {
  display: block;
  font-size: 13px;
  opacity: .82;
  letter-spacing: .3px;
}

.hero-title {
  display: block;
  margin-top: 2px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
}

.hero-sub {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  opacity: .78;
}

.hero-bell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .26);
  font-size: 12.5px;
  backdrop-filter: blur(6px);
  transition: transform .15s;
}

.hero-bell:active { transform: scale(.95); }

.badge {
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #fff;
  color: var(--danger);
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

/* ---------------- 统计卡 ---------------- */

.stats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: -56px 16px 0;
  padding: 16px 6px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat { text-align: center; }

.stat + .stat { box-shadow: inset 1px 0 0 var(--line); }

.stat-num {
  display: block;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.4px;
}

.stat-label {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--ink-3);
}

/* ---------------- 区块 ---------------- */

.section { margin-top: 22px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 10px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .2px;
}

.section-more {
  font-size: 12.5px;
  color: var(--ink-3);
  transition: color .15s;
}

.section-more:active { color: var(--primary); }

.card {
  margin: 0 16px 10px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------------- 直播横滑 ---------------- */

.cam-scroll {
  display: flex;
  gap: 12px;
  padding: 2px 16px 6px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cam-scroll::-webkit-scrollbar { display: none; }

.cam-card {
  position: relative;
  flex: 0 0 220px;
  scroll-snap-align: start;
  border-radius: 14px;
  overflow: hidden;
  background: #0b0f17;
  box-shadow: var(--shadow);
  transition: transform .16s;
}

.cam-card:active { transform: scale(.97); }

.cam-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b0f17;
}

.cam-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cam-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .35) 0%, transparent 38%, rgba(0, 0, 0, .55) 100%);
}

.cam-live {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .5);
  color: #fff;
  font-size: 10.5px;
  letter-spacing: .5px;
  backdrop-filter: blur(4px);
}

.cam-live i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff4d4f;
  animation: blink 1.4s infinite;
}

.cam-live.off i { background: #8a94a6; animation: none; }

@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .25; transform: scale(.8); }
}

.cam-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  border: 1px solid rgba(255, 255, 255, .5);
  backdrop-filter: blur(6px);
}

.cam-play::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 12px;
  border-left: 11px solid #fff;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.cam-name {
  position: absolute;
  left: 10px;
  bottom: 8px;
  z-index: 2;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}

/* ---------------- 厨房列表 ---------------- */

.kitchen {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  transition: transform .15s;
}

.kitchen:active { transform: scale(.99); }

.kitchen-main { flex: 1; min-width: 0; }

.kitchen-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kitchen-name {
  font-size: 15.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .2px;
}

.tag.online { color: var(--ok); background: rgba(0, 168, 112, .1); }
.tag.offline { color: var(--ink-3); background: rgba(138, 148, 166, .14); }
.tag.alert { color: var(--danger); background: rgba(245, 34, 45, .09); }

.kitchen-sub {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kitchen-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 7px;
  font-size: 12px;
  color: var(--ink-2);
}

.kitchen-meta .m-alert { color: var(--danger); }

.arrow {
  flex: 0 0 auto;
  color: #c4cbd6;
  font-size: 20px;
  line-height: 1;
}

/* ---------------- 告警卡 ---------------- */

.alert-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  margin: 0 16px 10px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: transform .15s;
}

.alert-card:active { transform: scale(.99); }

.alert-thumb {
  position: relative;
  flex: 0 0 92px;
  height: 66px;
  border-radius: 10px;
  overflow: hidden;
  background: #0b0f17;
}

.alert-thumb img { width: 100%; height: 100%; object-fit: cover; }

.alert-thumb .thumb-tag {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 1px 6px;
  border-top-right-radius: 8px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 10px;
}

.alert-body { flex: 1; min-width: 0; }

.alert-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.alert-type {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status {
  margin-left: auto;
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
}

.status.pending { color: var(--warn); background: rgba(250, 140, 22, .1); }
.status.resolved { color: var(--ok); background: rgba(0, 168, 112, .1); }

.alert-meta {
  margin-top: 5px;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.conf {
  padding: 1px 6px;
  border-radius: 5px;
  background: #f2f4f7;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 筛选 ---------------- */

.chips {
  display: flex;
  gap: 8px;
  padding: 12px 16px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 6px 13px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
  transition: all .15s;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 500;
}

.chip:active { transform: scale(.96); }

/* ---------------- 播放页 ---------------- */

.live-page { background: #0b0f17; min-height: 100vh; padding-bottom: calc(28px + var(--safe-b)); }

.live-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  color: #fff;
}

.back {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .1);
  font-size: 20px;
  line-height: 1;
  padding-bottom: 2px;
  transition: transform .15s;
}

.back:active { transform: scale(.92); }

.live-top-main { flex: 1; min-width: 0; }

.live-top-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-top-sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, .58);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player {
  position: relative;
  margin: 0 0 2px;
  background: #000;
  aspect-ratio: 16 / 9;
}

.player video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

.player-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 7px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 11px;
  letter-spacing: .4px;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.player-badge i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff4d4f;
  animation: blink 1.4s infinite;
}

.live-top-clock {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .62);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .6px;
}

.player-off {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(8, 11, 17, .82);
  color: rgba(255, 255, 255, .8);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

.player-off .big { font-size: 26px; opacity: .7; }

.live-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px 16px 4px;
}

.live-actions.one { grid-template-columns: 1fr; }

.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .07);
  color: rgba(255, 255, 255, .92);
  font-size: 11.5px;
  transition: transform .15s, background .15s;
}

.action:active { transform: scale(.95); background: rgba(255, 255, 255, .14); }

.action .ico {
  font-size: 17px;
  line-height: 1;
  opacity: .92;
}

.live-panel {
  margin: 16px 12px 0;
  background: #131a26;
  border-radius: 18px;
  padding: 4px 4px 4px;
  color: #fff;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, .55);
  font-weight: 500;
}

.panel-title .more { color: rgba(255, 255, 255, .38); font-size: 12px; }

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 14px;
  font-size: 13px;
}

.info-row + .info-row { border-top: 1px solid rgba(255, 255, 255, .06); }

.info-row .k { flex: 0 0 68px; color: rgba(255, 255, 255, .45); }
.info-row .v { flex: 1; text-align: right; color: rgba(255, 255, 255, .9); word-break: break-all; }

.live-alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  font-size: 12.5px;
  color: rgba(255, 255, 255, .88);
}

.live-alert-item img {
  width: 54px;
  height: 38px;
  border-radius: 7px;
  object-fit: cover;
  flex: 0 0 auto;
}

.live-alert-item .la-main { flex: 1; min-width: 0; }
.live-alert-item .la-time { display: block; margin-top: 2px; font-size: 11px; color: rgba(255, 255, 255, .45); }

/* ---------------- 详情页 ---------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav .back { background: #f2f4f7; color: var(--ink); }

.nav-title { font-size: 16px; font-weight: 600; }

.detail-head {
  padding: 18px 20px 16px;
  background: #fff;
}

.detail-type {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 700;
}

.detail-time {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.detail-video {
  margin: 0 16px;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
}

.detail-video video {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #000;
}

.alert-note {
  margin: 12px 16px 0;
  padding: 13px 15px;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.6;
}

.alert-note b { color: var(--ink); font-weight: 600; }

/* ---------------- 我的 ---------------- */

.me-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 20px 24px;
  background: linear-gradient(150deg, #1b3a8f 0%, #1677ff 60%, #2ea3ff 100%);
  color: #fff;
}

.avatar {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .35);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 1px;
}

.me-name { font-size: 18px; font-weight: 600; }
.me-role { margin-top: 3px; font-size: 12.5px; opacity: .8; }

.me-list { margin-top: -12px; }

.me-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  font-size: 14px;
}

.me-row + .me-row { border-top: 1px solid var(--line); }
.me-row .k { color: var(--ink-2); }
.me-row .v { margin-left: auto; color: var(--ink-3); font-size: 13px; }

.me-note {
  margin: 16px 16px 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(22, 119, 255, .06);
  border: 1px solid rgba(22, 119, 255, .12);
  font-size: 12.5px;
  color: #1b4c96;
  line-height: 1.65;
}

.me-note b { display: block; margin-bottom: 3px; font-size: 13px; }

/* ---------------- 空态 ---------------- */

.empty {
  margin: 0 16px;
  padding: 34px 16px;
  border-radius: 14px;
  background: #fff;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  box-shadow: var(--shadow);
}

/* ---------------- 底部 tab ---------------- */

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 50;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 7px 0 calc(6px + var(--safe-b));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}

.tabbar[hidden] { display: none; }

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 3px 0;
  color: var(--ink-3);
  font-size: 10.5px;
  transition: color .15s;
}

.tab .tab-ico { font-size: 19px; line-height: 1; }

.tab.active { color: var(--primary); font-weight: 600; }

.tab .tab-dot {
  position: absolute;
  top: 0;
  right: 50%;
  margin-right: -22px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 9.5px;
  line-height: 15px;
  text-align: center;
  font-weight: 700;
}

/* ---------------- 抓图弹层 ---------------- */

.shot-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 11, 17, .78);
  backdrop-filter: blur(6px);
}

.shot-mask[hidden] { display: none; }

.shot-box { width: 100%; max-width: 420px; }

.shot-box img {
  width: 100%;
  border-radius: 12px;
  background: #000;
}

.shot-ops {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  flex: 1;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14.5px;
  font-weight: 500;
  transition: transform .15s, opacity .15s;
}

.btn:active { transform: scale(.97); }
.btn.ghost { background: rgba(255, 255, 255, .14); color: #fff; }
.btn.primary { background: var(--primary); color: #fff; }

@media (max-width: 360px) {
  .stat-num { font-size: 18px; }
  .cam-card { flex-basis: 190px; }
}
