/* 直呼 · P2P 语音通话 —— 轻量移动端样式 */
:root{
  --bg:#f4f6fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --line:#e7ebf3;
  --accent:#2563eb;
  --accent-2:#7c3aed;
  --green:#22c55e;
  --red:#ef4444;
  --dark:#0b1220;
  --radius:18px;
  --shadow:0 1px 2px rgba(15,23,42,.04), 0 8px 24px -12px rgba(15,23,42,.18);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0}
body{
  background:var(--bg);
  color:var(--text);
  font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  -webkit-font-smoothing:antialiased;
  min-height:100dvh;
}
.app{
  max-width:560px;margin:0 auto;
  padding:calc(12px + env(safe-area-inset-top)) 14px calc(20px + env(safe-area-inset-bottom));
}
.hidden{display:none !important}

/* 顶栏 */
.topbar{display:flex;align-items:center;gap:10px;padding:6px 2px 14px}
.brand{display:flex;align-items:center;gap:8px;font-weight:700;font-size:17px;letter-spacing:.3px}
.logo{
  width:30px;height:30px;border-radius:10px;display:grid;place-items:center;color:#fff;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  box-shadow:0 6px 14px -6px rgba(37,99,235,.7);
}
.sig{
  margin-left:auto;display:flex;align-items:center;gap:6px;
  font-size:12px;color:var(--muted);background:#fff;border:1px solid var(--line);
  padding:5px 10px;border-radius:999px;
}
.dot{width:7px;height:7px;border-radius:50%;background:#cbd5e1;transition:.25s}
.dot.on{background:var(--green);box-shadow:0 0 0 3px rgba(34,197,94,.15)}
.dot.warn{background:#f59e0b}
.dot.off{background:var(--red)}
.icon-btn{
  border:1px solid var(--line);background:#fff;color:var(--muted);
  width:34px;height:34px;border-radius:12px;display:grid;place-items:center;cursor:pointer;
}
.icon-btn:active{transform:scale(.94)}

/* 卡片 */
.card{
  background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  padding:16px;margin-bottom:12px;box-shadow:var(--shadow);
}
.label{font-size:13px;font-weight:600;color:#334155;margin-bottom:10px}
.label .tiny{display:block;font-weight:400;margin-top:2px;color:var(--muted)}
.tiny{font-size:12px;color:var(--muted)}
.row-between{display:flex;align-items:center;justify-content:space-between;gap:10px}

/* 我的号码 */
.id-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.my-id{
  font:700 26px/1.1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  letter-spacing:2px;
  background:linear-gradient(135deg,#eff6ff,#f5f3ff);
  border:1px solid #e0e7ff;color:#1e293b;
  padding:10px 14px;border-radius:14px;flex:1;text-align:center;min-width:180px;
}
.id-actions{display:flex;gap:8px}
.mini{
  border:1px solid var(--line);background:#fff;color:#334155;border-radius:10px;
  padding:8px 12px;font-size:13px;cursor:pointer;font-weight:500;
}
.mini:active{transform:scale(.96)}
.mini.wide{width:100%;margin-top:8px;padding:10px}

/* 拨号 */
.dial-row{display:flex;gap:10px}
.dial-input{
  flex:1;min-width:0;border:1px solid var(--line);border-radius:14px;padding:14px 16px;
  font:600 17px/1 ui-monospace,Menlo,Consolas,monospace;letter-spacing:1.5px;
  background:#f8fafc;color:var(--text);outline:none;transition:.2s;
}
.dial-input:focus{border-color:#bfdbfe;background:#fff;box-shadow:0 0 0 4px rgba(37,99,235,.08)}
.dial-input::placeholder{letter-spacing:0;font-family:inherit;font-size:14px;font-weight:400;color:#94a3b8}
.call-btn{
  border:0;border-radius:14px;padding:0 20px;color:#fff;font-size:15px;font-weight:600;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  display:flex;align-items:center;gap:6px;cursor:pointer;
  box-shadow:0 8px 18px -8px rgba(37,99,235,.9);
}
.call-btn:active{transform:scale(.97)}
.hint{margin-top:10px;font-size:12px;color:var(--muted);line-height:1.6}
.banner{
  background:#fef2f2;border:1px solid #fecaca;color:#b91c1c;border-radius:14px;
  padding:11px 14px;font-size:13px;line-height:1.65;margin-bottom:12px;
}
.banner b{color:#991b1b}
.steps{margin:0;padding-left:20px;font-size:13px;color:#475569;line-height:1.85}
.steps li{margin-bottom:5px}
.steps b{color:#0f172a;font-weight:600}

/* 录音列表 */
.rec-list{display:flex;flex-direction:column;gap:8px;max-height:260px;overflow:auto}
.empty{font-size:13px;color:#94a3b8;line-height:1.7;padding:6px 0}
.rec-item{
  display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--line);
  border-radius:12px;background:#fcfdff;
}
.rec-main{flex:1;min-width:0}
.rec-title{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rec-meta{font-size:11px;color:var(--muted);margin-top:2px}
.rec-btns{display:flex;gap:6px}
.rec-btns button{
  border:1px solid var(--line);background:#fff;border-radius:9px;font-size:12px;
  padding:6px 9px;color:#334155;cursor:pointer;
}

/* 底部 */
.foot{text-align:center;font-size:11px;color:#94a3b8;padding:8px 0 4px}

/* ============ 通话全屏 ============ */
.call-screen{
  position:fixed;inset:0;z-index:60;
  background:radial-gradient(120% 80% at 50% 0%,#1b2740 0%,#0b1220 55%,#070b14 100%);
  color:#fff;display:flex;flex-direction:column;align-items:center;
  padding:calc(28px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  animation:fadeIn .18s ease-out;
}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.cs-top{text-align:center;width:100%}
.cs-peer{font:600 15px/1 ui-monospace,Menlo,monospace;letter-spacing:2px;color:#93a4c0}
.cs-status{margin-top:10px;font-size:14px;color:#c7d2e5;min-height:20px}
.cs-timer{font:300 40px/1.2 ui-monospace,Menlo,monospace;letter-spacing:1px;margin-top:2px;color:#fff}
.cs-timer.is-hidden{visibility:hidden}
.cs-rec{
  margin:10px auto 0;display:inline-flex;align-items:center;gap:8px;
  font-size:12px;color:#fecaca;background:rgba(239,68,68,.14);
  border:1px solid rgba(239,68,68,.35);padding:5px 12px;border-radius:999px;
}
.rec-dot{width:8px;height:8px;border-radius:50%;background:var(--red);animation:pulse 1.4s infinite}
@keyframes pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.35;transform:scale(.8)}}
.cs-net{margin-top:10px;font-size:11px;color:#7b8aa6;min-height:16px}

.cs-mid{flex:1;display:grid;place-items:center}
.avatar{
  width:112px;height:112px;border-radius:50%;display:grid;place-items:center;
  font:600 40px/1 ui-monospace,Menlo,monospace;color:#dbeafe;
  background:linear-gradient(135deg,#1e3a8a,#4c1d95);
  box-shadow:0 0 0 10px rgba(147,197,253,.05), 0 20px 50px -20px #000;
}
.speaking .avatar{box-shadow:0 0 0 12px rgba(96,165,250,.14), 0 20px 50px -20px #000}
.avatar svg{opacity:.92;stroke:#dbeafe}

.cs-devices{width:100%;max-width:420px;display:grid;gap:8px;margin-bottom:14px}
.dev{display:flex;align-items:center;gap:10px;font-size:12px;color:#93a4c0}
.dev>span{flex:0 0 78px}
.dev select{
  flex:1;min-width:0;background:#16203a;color:#e2e8f0;border:1px solid #26324e;
  border-radius:10px;padding:8px 10px;font-size:12px;outline:none;
}

.cs-controls{display:flex;gap:14px;justify-content:center;width:100%;max-width:420px;padding-bottom:4px}
.cbtn{
  border:0;background:#1b2740;color:#e2e8f0;border-radius:999px;
  width:68px;height:68px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  font-size:11px;cursor:pointer;transition:.16s;
}
.cbtn:active{transform:scale(.93)}
.cbtn.on{background:#2563eb;color:#fff;box-shadow:0 10px 24px -10px rgba(37,99,235,.9)}
.cbtn.rec.on{background:var(--red);box-shadow:0 10px 24px -10px rgba(239,68,68,.9)}
.cbtn.hang{background:var(--red);color:#fff}
.cs-answer{display:flex;gap:44px;justify-content:center;align-items:center;width:100%;padding:8px 0 14px}
.cs-answer .cbtn{width:84px;height:84px;font-size:12px;gap:5px}
.cbtn.accept{background:var(--green);color:#04240f;box-shadow:0 12px 28px -10px rgba(34,197,94,.9)}
.cbtn.reject{background:#334155;color:#fff}

/* ============ 设置面板 ============ */
.sheet-wrap{position:fixed;inset:0;z-index:80;display:flex;align-items:flex-end;justify-content:center}
.sheet-mask{position:absolute;inset:0;background:rgba(8,15,30,.42);backdrop-filter:blur(2px)}
.sheet{
  position:relative;width:100%;max-width:560px;max-height:88dvh;overflow:auto;
  background:#fff;border-radius:22px 22px 0 0;animation:up .22s ease-out;
  padding-bottom:calc(24px + env(safe-area-inset-bottom));
}
@keyframes up{from{transform:translateY(24px);opacity:.6}to{transform:none;opacity:1}}
.sheet-head{
  position:sticky;top:0;background:#fff;z-index:2;display:flex;align-items:center;
  justify-content:space-between;padding:16px 18px 12px;border-bottom:1px solid var(--line);
}
.sheet-body{padding:14px 18px 8px}
.group-title{font-size:12px;font-weight:700;color:#94a3b8;letter-spacing:.6px;margin:18px 0 8px;text-transform:uppercase}
.group-title:first-child{margin-top:4px}
.switch-row{display:flex;align-items:center;gap:14px;padding:10px 0;border-bottom:1px solid #f1f5f9;font-size:14px}
.switch-row>div{flex:1}
.switch-row .tiny{margin-top:2px}
.sw{
  appearance:none;width:46px;height:27px;border-radius:999px;background:#e2e8f0;position:relative;
  cursor:pointer;transition:.2s;flex:0 0 auto;border:0;
}
.sw:checked{background:var(--accent)}
.sw::after{
  content:"";position:absolute;top:3px;left:3px;width:21px;height:21px;border-radius:50%;
  background:#fff;transition:.2s;box-shadow:0 1px 3px rgba(0,0,0,.2);
}
.sw:checked::after{transform:translateX(19px)}
.dev-row{display:flex;align-items:center;gap:10px;padding:8px 0;font-size:13px;color:#334155}
.dev-row>span{flex:0 0 74px;color:var(--muted)}
.dev-row.vertical{flex-direction:column;align-items:stretch}
.dev-row select,.txt{
  flex:1;min-width:0;border:1px solid var(--line);border-radius:10px;padding:9px 10px;
  font-size:13px;background:#f8fafc;color:var(--text);outline:none;
}
.txt:focus{border-color:#bfdbfe;background:#fff}
.btn-row{display:flex;gap:8px;margin-top:6px}

/* Toast */
.toast{
  position:fixed;left:50%;bottom:calc(28px + env(safe-area-inset-bottom));transform:translate(-50%,14px);
  background:rgba(15,23,42,.92);color:#fff;font-size:13px;padding:10px 16px;border-radius:12px;
  opacity:0;pointer-events:none;transition:.22s;z-index:120;max-width:86vw;text-align:center;
  box-shadow:0 12px 30px -10px rgba(0,0,0,.5);
}
.toast.show{opacity:1;transform:translate(-50%,0)}
/* 通话界面打开时，提示条上移，避免遮挡控制按钮 */
.call-screen:not(.hidden) ~ .toast{bottom:calc(150px + env(safe-area-inset-bottom))}

@media (max-width:360px){
  .my-id{font-size:22px}
  .cbtn{width:60px;height:60px}
  .cs-timer{font-size:34px}
}
