/* ============================================================
 * 凤鸣智能开机卡 · 网页版（PWA + 电脑版 响应式）
 * 对齐小程序：主色 #007aff / 导航 #e6eefb / 背景 #f4f7fc
 * ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: #f4f7fc;
  color: #1f2329;
  overflow-x: hidden;           /* 移动端禁止左右滑动 */
  -webkit-font-smoothing: antialiased;
}
button, input { font-family: inherit; font-size: inherit; outline: none; }
img { -webkit-user-drag: none; user-select: none; }

#app { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0; }

/* ===== 顶部导航（手机：标题栏 + 操作；电脑：导航条） ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: #e6eefb;
  border-bottom: 1px solid rgba(0,0,0,.06);
  padding-top: calc(14px + env(safe-area-inset-top));
}
.topbar-title { font-size: 18px; font-weight: 600; color: #1f2329; }
.topbar-actions { display: flex; gap: 10px; }
.topbar-btn {
  padding: 6px 14px; border-radius: 16px; background: #ffffff;
  color: #007aff; font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid #dbe6f5;
  user-select: none;
}
.topbar-btn:active { opacity: .75; }
.topbar-btn.done { background: #007aff; color: #fff; border-color: #007aff; }

/* ===== 桌面导航 ===== */
.desktop-nav { display: none; }

/* ===== 页面容器 ===== */
.page { padding: 12px 16px calc(84px + env(safe-area-inset-bottom)); max-width: 1200px; margin: 0 auto; }
.sort-tip { text-align: center; color: #86909c; font-size: 13px; padding: 8px 0 4px; }

/* ===== 设备网格 ===== */
.device-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin-top: 4px;
}
.device-card {
  position: relative; min-height: 118px;
  background: #ffffff; border-radius: 14px; padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  cursor: pointer; transition: box-shadow .15s;
  border: 1px solid rgba(0,0,0,.04);
}
.device-card:active { box-shadow: 0 2px 10px rgba(0,122,255,.18); }
.device-card.dragging {
  transform: scale(1.05); z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  background: #f0f6ff;
}
.card-icon { position: absolute; top: 14px; left: 14px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; }
.card-icon img { max-width: 30px; max-height: 30px; }
.wol-badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 10px; padding: 2px 7px; border-radius: 8px;
  background: #e8f1ff; color: #007aff;
}
.wol-badge.ban { background: #ffecec; color: #ff4d4f; }
.card-switch { position: absolute; top: 14px; right: 14px; }
.switch-track {
  width: 44px; height: 26px; border-radius: 13px; background: #d8dde5;
  position: relative; transition: background .2s;
}
.switch-track.active { background: #007aff; }
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: left .2s;
}
.switch-track.active .switch-thumb { left: 20px; }
.card-switch.locked { opacity: .45; pointer-events: none; }
.card-info { position: absolute; top: 14px; right: 14px; display: flex; align-items: center; gap: 3px; }
.card-info-text { font-size: 11px; color: #86909c; }
.card-info-text.on { color: #007aff; }
.card-info-text.ban { color: #ff4d4f; }
.card-name { position: absolute; left: 14px; bottom: 14px; font-size: 14px; font-weight: 600; color: #1f2329; max-width: calc(100% - 80px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-status { position: absolute; right: 14px; bottom: 14px; font-size: 11px; color: #86909c; }
.card-status.on { color: #00b578; }
.card-status.off { color: #c4c9d3; }

/* WOL 网关卡片：被控电脑唤醒行 */
.wol-body { display: flex; flex-direction: column; gap: 8px; margin: 34px 0 26px; }
.wol-row { display: flex; align-items: center; justify-content: space-between; }
.wol-name { font-size: 13px; color: #4e5969; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wol-btn {
  flex: none; padding: 4px 14px; border-radius: 14px; background: #007aff; color: #fff;
  font-size: 12px; cursor: pointer; user-select: none;
}
.wol-btn:active { opacity: .8; }

/* 添加卡片 */
.device-card.add-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1px dashed #c4c9d3; background: transparent; box-shadow: none; }
.add-plus { font-size: 28px; color: #007aff; line-height: 1; }
.add-text { font-size: 13px; color: #86909c; }

/* 温湿度卡片主体 */
.card-th { margin: 34px 0 26px; display: flex; flex-direction: column; gap: 6px; }
.card-th-row { display: flex; align-items: center; gap: 6px; }
.card-th-val { font-size: 22px; font-weight: 700; color: #86909c; }
.card-th-val.on { color: #1f2329; }
.card-th-emoji { font-size: 16px; }
.card-th-weather { position: absolute; top: 14px; right: 14px; display: flex; align-items: center; gap: 3px; font-size: 11px; color: #86909c; }

/* ===== 空状态 ===== */
.empty-wrap { text-align: center; padding: 80px 0 20px; }
.empty-img { display: block; margin: 0 auto; }
.empty-text { color: #86909c; font-size: 14px; margin: 12px 0 20px; display: block; }

/* ===== 按钮 ===== */
.btn { display: inline-block; padding: 10px 22px; border-radius: 22px; font-size: 14px; cursor: pointer; border: none; user-select: none; }
.btn-primary { background: #007aff; color: #fff; }
.btn-ghost { background: #ffffff; color: #007aff; border: 1px solid #dbe6f5; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn:active { opacity: .8; }
.btn:disabled { opacity: .4; pointer-events: none; }

/* ===== 登录/注册页 ===== */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.auth-logo { width: 72px; height: 72px; border-radius: 18px; background: #007aff; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 34px; font-weight: 800; margin-bottom: 10px; }
.auth-app-name { font-size: 20px; font-weight: 700; color: #1f2329; margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: #86909c; margin-bottom: 28px; }
.auth-card { width: 100%; max-width: 360px; background: #fff; border-radius: 16px; padding: 24px 22px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tab { flex: 1; text-align: center; padding: 8px 0; border-radius: 10px; color: #86909c; font-size: 14px; cursor: pointer; background: #f4f7fc; }
.auth-tab.active { background: #e8f1ff; color: #007aff; font-weight: 600; }
.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; color: #4e5969; margin-bottom: 6px; }
.field-input {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid #e1e6ef;
  background: #fafbfd; font-size: 15px;
}
.field-input:focus { border-color: #007aff; background: #fff; }
.auth-hint { font-size: 12px; color: #86909c; margin-top: 12px; line-height: 1.6; }
.auth-submit { width: 100%; margin-top: 6px; }
.auth-wechat { width: 100%; margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.auth-wechat.disabled { opacity: .55; pointer-events: none; }

/* ===== 我的页 ===== */
.mine-head { background: #fff; border-radius: 14px; padding: 20px; margin-bottom: 12px; display: flex; align-items: center; gap: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.mine-avatar { width: 52px; height: 52px; border-radius: 50%; background: #e8f1ff; color: #007aff; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; }
.mine-name { font-size: 17px; font-weight: 600; }
.mine-sub { font-size: 12px; color: #86909c; margin-top: 3px; }
.mine-menu { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.mine-item { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid #f2f3f5; cursor: pointer; font-size: 14px; }
.mine-item:last-child { border-bottom: none; }
.mine-item:active { background: #f7f9fc; }
.mine-item .arrow { color: #c4c9d3; font-size: 14px; }
.mine-item.danger { color: #ff4d4f; }

/* ===== 详情页 ===== */
.back-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; color: #4e5969; font-size: 14px; user-select: none; }
.back-row .back-arrow { font-size: 18px; }
.detail-title { font-size: 17px; font-weight: 600; }
.card { background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.control-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.banned-banner { background: #ffecec; color: #ff4d4f; border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }
.status-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; }
.status-label { color: #86909c; }
.status-value { color: #1f2329; font-weight: 500; }
.status-value.on { color: #00b578; }
.status-value.off { color: #c4c9d3; }
.status-capsule { padding: 2px 12px; border-radius: 10px; font-size: 12px; background: #eef0f4; color: #4e5969; }
.status-capsule.on { background: #e8f8ef; color: #00b578; }
.status-capsule.off { background: #f2f3f5; color: #c4c9d3; }
.pc-status-icon { display: flex; align-items: center; justify-content: center; padding: 14px 0 6px; font-size: 54px; }
.pc-status-sub { text-align: center; font-size: 12px; color: #86909c; padding-bottom: 6px; }
.power-row { display: flex; gap: 12px; }
.power-btn { flex: 1; text-align: center; padding: 16px 0; border-radius: 12px; cursor: pointer; user-select: none; transition: opacity .15s; }
.power-btn:active { opacity: .75; }
.power-btn.on { background: #e8f1ff; color: #007aff; border: 1px solid #cfe3ff; }
.power-btn.off { background: #f4f6f8; color: #4e5969; border: 1px solid #e1e6ef; }
.power-btn:disabled { opacity: .4; pointer-events: none; }
.power-btn-icon { display: block; font-size: 26px; line-height: 1.2; }
.power-btn-text { font-size: 13px; }
.wol-rows { display: flex; flex-direction: column; gap: 8px; }
.wol-tip { font-size: 12px; color: #c4c9d3; text-align: center; padding: 4px 0; }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-cell { text-align: center; padding: 14px 6px; background: #f7f9fc; border-radius: 12px; cursor: pointer; font-size: 12px; color: #4e5969; }
.menu-cell:active { background: #eef3fb; }
.menu-cell .m-icon { display: block; font-size: 22px; margin-bottom: 4px; }

/* ===== 分组页 ===== */
.group-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.group-tabs::-webkit-scrollbar { display: none; }
.group-tab { flex: none; padding: 7px 16px; border-radius: 16px; background: #fff; color: #4e5969; font-size: 13px; cursor: pointer; border: 1px solid #e1e6ef; }
.group-tab.active { background: #007aff; color: #fff; border-color: #007aff; }

/* ===== 弹窗 ===== */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: flex; align-items: center; justify-content: center; }
.dialog { width: 88%; max-width: 380px; max-height: 86vh; overflow-y: auto; background: #fff; border-radius: 16px; padding: 20px; }
.dialog-title { font-size: 17px; font-weight: 600; text-align: center; margin-bottom: 10px; }
.dialog-tip { font-size: 12px; color: #86909c; margin-bottom: 10px; line-height: 1.6; }
.code-row { display: flex; gap: 8px; align-items: center; }
.code-input { flex: 1; }
.code-text { background: #f0f6ff; border-color: #cfe3ff; color: #007aff; font-weight: 700; letter-spacing: 1px; }
.dialog-actions { display: flex; gap: 10px; margin-top: 16px; }
.dialog-btn { flex: 1; text-align: center; }
.picker-value { padding: 11px 14px; border-radius: 10px; border: 1px solid #e1e6ef; background: #fafbfd; font-size: 14px; cursor: pointer; }
.picker-value:after { content: "▾"; float: right; color: #c4c9d3; }
.action-menu { width: 78%; max-width: 300px; background: #fff; border-radius: 14px; overflow: hidden; }
.menu-item { padding: 15px; text-align: center; font-size: 14px; border-bottom: 1px solid #f2f3f5; cursor: pointer; }
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: #f7f9fc; }
.menu-item.danger { color: #ff4d4f; }
.menu-item.menu-item-ls { border-bottom: 8px solid #f4f7fc; }

/* ===== Toast ===== */
#toast-root { position: fixed; top: 60px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 300; pointer-events: none; }
.toast { background: rgba(0,0,0,.75); color: #fff; font-size: 13px; padding: 9px 18px; border-radius: 20px; max-width: 80%; text-align: center; animation: toast-in .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== 底部 TabBar（手机） ===== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; background: #fff; border-top: 1px solid #f0f1f3;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; color: #9ca3af; font-size: 11px; cursor: pointer; user-select: none; }
.tabbar-item.active { color: #007aff; }
.tabbar-icon { font-size: 20px; line-height: 1; }
.tabbar-icon svg { width: 22px; height: 22px; }

/* ===== 配网页 / 协议页 ===== */
.step-card { display: flex; gap: 12px; margin-bottom: 14px; }
.step-num { flex: none; width: 24px; height: 24px; border-radius: 50%; background: #e8f1ff; color: #007aff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.step-body { flex: 1; }
.step-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.step-desc { font-size: 13px; color: #86909c; line-height: 1.7; }
.agree-text { font-size: 13px; color: #4e5969; line-height: 1.9; white-space: pre-wrap; }

/* ===== 桌面端（宽度 ≥ 900px）===== */
@media (min-width: 900px) {
  .topbar { display: none; }
  .tabbar { display: none; }
  .desktop-nav {
    display: flex; position: sticky; top: 0; z-index: 50;
    align-items: center; justify-content: space-between;
    background: #e6eefb; border-bottom: 1px solid rgba(0,0,0,.06);
    padding: 0 24px; height: 56px;
  }
  .desktop-nav .nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: #1f2329; }
  .desktop-nav .nav-brand .brand-icon { width: 30px; height: 30px; border-radius: 8px; background: #007aff; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; }
  .desktop-nav .nav-links { display: flex; gap: 6px; }
  .nav-link { padding: 8px 16px; border-radius: 18px; color: #4e5969; font-size: 14px; cursor: pointer; user-select: none; }
  .nav-link.active { background: #fff; color: #007aff; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
  .desktop-nav .nav-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #4e5969; }
  .nav-user .logout { color: #ff4d4f; cursor: pointer; }
  .page { padding: 20px 24px 40px; }
  .device-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .device-card { min-height: 128px; }
  .device-card:hover { box-shadow: 0 4px 16px rgba(0,122,255,.12); }
  .detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .auth-page { min-height: calc(100vh - 56px); }
}
