/* FW远程 设计系统 v1.0 —— 深蓝青色 · 专业远控风格 */
:root {
  --brand: #0ea5e9;
  --brand-deep: #0284c7;
  --brand-glow: rgba(14, 165, 233, .28);
  --accent: #06b6d4;
  --violet: #6366f1;

  --bg: #f4f6fb;
  --bg-soft: #eef2f9;
  --panel: #ffffff;
  --border: #e3e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-sub: #64748b;
  --text-mute: #94a3b8;

  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 10px 30px rgba(15, 23, 42, .08), 0 2px 8px rgba(15, 23, 42, .04);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .16);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-deep); text-decoration: none; }
a:hover { color: var(--brand); }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--brand-glow); }

/* ---------- 布局 ---------- */
.app { max-width: 1240px; margin: 0 auto; padding: 0 28px 48px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } .app { padding: 0 16px 32px; } }

/* ---------- 顶栏 ---------- */
.topbar { display: flex; align-items: center; gap: 14px; padding: 18px 0; margin-bottom: 8px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 13px; flex: none;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 700; letter-spacing: -1px;
  box-shadow: 0 6px 18px var(--brand-glow);
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-name { font-size: 21px; font-weight: 700; letter-spacing: -.3px; line-height: 1.2; }
.brand-sub { color: var(--text-sub); font-size: 12px; margin-top: 2px; }
.spacer { flex: 1; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--bg-soft); color: var(--text-sub); border: 1px solid var(--border);
  white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-mute); flex: none; }
.badge.online { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge.online .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(16,185,129,.16); }
.badge.busy { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge.busy .dot { background: var(--warn); }
.badge.user { background: #eff6ff; color: var(--brand-deep); border-color: #bfdbfe; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 26px;
}
.card.tint { background: linear-gradient(160deg, #ffffff 0%, #f8fbff 100%); }
.section-title {
  font-size: 12px; font-weight: 700; color: var(--text-sub);
  margin: 0 0 14px; text-transform: uppercase; letter-spacing: 1px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::before { content: ''; width: 3px; height: 14px; border-radius: 2px; background: var(--brand); }

/* ---------- 英雄区（首页） ---------- */
.hero {
  background: linear-gradient(135deg, #0c2340 0%, #123a5e 55%, #0e7490 100%);
  border-radius: 22px; padding: 46px 48px; color: #fff;
  position: relative; overflow: hidden; margin-bottom: 24px; box-shadow: var(--shadow);
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -80px;
  width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(6,182,212,.35), transparent 65%);
}
.hero-tag {
  display: inline-block; padding: 5px 14px; border-radius: 999px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  font-size: 12px; letter-spacing: .5px; margin-bottom: 18px;
}
.hero h1 { font-size: 38px; margin: 0 0 12px; letter-spacing: -1px; font-weight: 700; line-height: 1.25; }
.hero p { color: rgba(255,255,255,.82); font-size: 15px; margin: 0; max-width: 560px; line-height: 1.8; }
.hero-stats { display: flex; gap: 36px; margin-top: 30px; position: relative; z-index: 1; }
.hero-stats div .n { font-size: 24px; font-weight: 700; }
.hero-stats div .l { font-size: 12px; color: rgba(255,255,255,.7); }

/* ---------- 角色卡 ---------- */
.role-card {
  cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s;
  padding: 30px; position: relative; overflow: hidden;
}
.role-card::after {
  content: ''; position: absolute; right: -30px; bottom: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--brand-glow); opacity: 0; transition: opacity .2s;
}
.role-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--brand); }
.role-card:hover::after { opacity: 1; }
.role-icon {
  width: 56px; height: 56px; border-radius: 15px; display: grid; place-items: center;
  font-size: 28px; margin-bottom: 18px; position: relative; z-index: 1;
  background: linear-gradient(135deg, #e0f2fe, #cffafe); color: var(--brand-deep);
}
.role-card.alt .role-icon { background: linear-gradient(135deg, #eef2ff, #e0e7ff); color: var(--violet); }
.role-card h2 { font-size: 20px; margin: 0 0 8px; letter-spacing: -.3px; position: relative; z-index: 1; }
.role-card p { color: var(--text-sub); margin: 0; line-height: 1.75; font-size: 13px; position: relative; z-index: 1; }
.role-arrow {
  position: absolute; right: 28px; top: 32px; font-size: 22px;
  color: var(--text-mute); transition: transform .2s, color .2s;
}
.role-card:hover .role-arrow { transform: translateX(4px); color: var(--brand); }

/* ---------- 表单 ---------- */
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-sub); margin: 16px 0 8px; }
input[type=text], input[type=password], input[type=email] {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; background: #fbfcfe; color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px var(--brand-glow); }
input::placeholder { color: var(--text-mute); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border: 1.5px solid transparent; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; color: #fff;
  background: var(--brand); transition: transform .12s, background .15s, box-shadow .15s;
  box-shadow: 0 4px 12px var(--brand-glow);
}
.btn:hover { background: var(--brand-deep); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--border-strong); box-shadow: none; }
.btn.ghost:hover { background: var(--bg-soft); border-color: var(--brand); color: var(--brand-deep); }
.btn.danger { background: var(--danger); box-shadow: 0 4px 12px rgba(239,68,68,.25); }
.btn.danger:hover { background: #dc2626; }
.btn.sm { padding: 7px 14px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; margin-top: 18px; padding: 14px; font-size: 15px; }
.btn.lg { padding: 14px 26px; font-size: 15px; }

/* ---------- 设备码 ---------- */
.device-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 40px; font-weight: 700; letter-spacing: 6px;
  color: var(--brand-deep); text-align: center;
  background: linear-gradient(135deg, #f0f9ff, #ecfeff);
  border: 2px dashed #7dd3fc; border-radius: 14px;
  padding: 22px 12px; margin: 14px 0 10px; user-select: all;
}

/* ---------- 提示文本 ---------- */
.hint { color: var(--text-sub); font-size: 12px; line-height: 1.75; }
.hint b { color: var(--text); }

/* ---------- 日志 ---------- */
.log {
  margin-top: 18px; padding: 14px 16px;
  background: #0b1220; color: #7c8ba1;
  border: 1px solid #1e293b; border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.85; height: 168px; overflow-y: auto;
}
.log .ok { color: #34d399; }
.log .warn { color: #fbbf24; }
.log .err { color: #f87171; }
.log::-webkit-scrollbar { width: 8px; }
.log::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

/* ---------- 设备列表 ---------- */
.device-list { margin-top: 6px; display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.device-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: #fbfcfe; transition: border-color .15s, background .15s;
}
.device-item:hover { border-color: var(--brand); background: #f0f9ff; }
.device-item .dev-icon { width: 38px; height: 38px; border-radius: 10px; flex: none; background: var(--bg-soft); display: grid; place-items: center; font-size: 19px; }
.device-item .name { font-weight: 600; flex: 1; }
.device-item .id { font-family: ui-monospace, monospace; color: var(--text-mute); font-size: 11px; }
.device-item .live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.device-item .off { width: 7px; height: 7px; border-radius: 50%; background: var(--text-mute); flex: none; }
.empty { color: var(--text-mute); text-align: center; padding: 36px 16px; font-size: 13px; }

/* ---------- 画面舞台 ---------- */
.stage-wrap {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: #0a1020; border-radius: 14px; overflow: hidden;
  border: 1px solid #1e293b; box-shadow: inset 0 0 60px rgba(0,0,0,.5);
}
.stage-wrap video { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage-overlay { position: absolute; inset: 0; cursor: crosshair; }
.cursor-dot {
  position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 1px #000, 0 0 10px rgba(0,0,0,.6);
  pointer-events: none; transition: left .05s linear, top .05s linear;
}
.stage-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #64748b; text-align: center; padding: 20px; }
.stage-placeholder .big { font-size: 52px; opacity: .5; margin-bottom: 10px; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.status-line { display: flex; align-items: center; gap: 8px; color: var(--text-sub); font-size: 13px; font-weight: 500; }
.grow { flex: 1; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(8, 15, 30, .55);
  backdrop-filter: blur(4px); display: none; place-items: center; z-index: 50; padding: 20px;
}
.modal-mask.show { display: grid; }
.modal {
  background: #fff; border-radius: 20px; padding: 32px;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal .modal-icon {
  width: 56px; height: 56px; border-radius: 16px; margin-bottom: 18px;
  background: linear-gradient(135deg, #fef3c7, #fde68a); color: #b45309;
  display: grid; place-items: center; font-size: 28px;
}
.modal h3 { margin: 0 0 8px; font-size: 21px; }
.modal p { color: var(--text-sub); line-height: 1.75; margin: 0 0 6px; }
.modal .actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 26px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: 26px; transform: translateX(-50%) translateY(-90px);
  background: #0f172a; color: #fff; padding: 12px 22px; border-radius: 12px;
  font-size: 13px; font-weight: 500; opacity: 0;
  transition: all .3s cubic-bezier(.2,.8,.2,1); z-index: 100; pointer-events: none;
  box-shadow: var(--shadow-lg); border: 1px solid #334155;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---------- 工具 ---------- */
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mt24 { margin-top: 24px; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.feature-row { display: flex; gap: 14px; align-items: flex-start; margin-top: 16px; }
.feature-row .fi { width: 34px; height: 34px; border-radius: 9px; flex: none; background: #ecfdf5; color: var(--ok); display: grid; place-items: center; font-size: 16px; }
.feature-row .ft { font-weight: 600; font-size: 13px; }
.feature-row .fd { color: var(--text-sub); font-size: 12px; }
.footer-note { text-align: center; color: var(--text-mute); font-size: 12px; margin-top: 32px; }
