@import url("https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css");

:root{
  --bg:#0b0c10;
  --muted:rgba(255,255,255,.65);
  --line:rgba(255,255,255,.08);
  --primary:#4a90e2;
  --danger:#ff3b30;
  --pill:rgba(255,255,255,.12);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*{box-sizing:border-box; -webkit-font-smoothing: antialiased;}
html,body{height:100%; margin:0; background:var(--bg); color:#fff; font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;}

#root{height:100%; display:flex; flex-direction:column;}

.topbar{
  display:flex; justify-content:space-between; align-items:center;
  padding: calc(14px + var(--safe-top)) 14px 10px;
  border-bottom:1px solid var(--line);
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0));
}
.brand-title{font-size:18px; font-weight:800;}
.brand-sub{font-size:12px; color:var(--muted); margin-top:4px;}
.pill{
  border:none; border-radius:999px; padding:10px 12px;
  background:var(--pill); color:#fff; cursor:pointer;
}

.main{flex:1; overflow:auto; padding:14px;}
.view{max-width:540px; margin:0 auto;}
.hidden{display:none;}

.searchbox input{
  width:100%;
  padding:14px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.06);
  color:#fff;
  outline:none;
}
.searchbox input::placeholder{color:rgba(255,255,255,.35);}

.section-title{
  margin:14px 0 8px;
  font-weight:800;
  font-size:13px;
  letter-spacing:.3px;
  color:rgba(255,255,255,.75);
}

.list{display:flex; flex-direction:column; gap:10px;}
.item{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 12px;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  cursor:pointer;
}
.item-left{display:flex; align-items:center; gap:10px;}
.avatar{
  width:42px; height:42px; border-radius:14px;
  background:rgba(255,255,255,.10);
  display:flex; align-items:center; justify-content:center;
  font-weight:900;
}
.item-title{font-weight:800; font-size:14px;}
.item-sub{font-size:12px; color:var(--muted); margin-top:4px;}
.badge{font-size:12px; padding:6px 10px; border-radius:999px; background:rgba(255,255,255,.10); color:#fff;}

.card{
  border:1px solid var(--line);
  background:rgba(255,255,255,.06);
  border-radius:18px;
  padding:14px;
}
.row{display:flex; align-items:center; justify-content:space-between; margin-top:12px;}
.gap{gap:10px;}

.btn{
  flex:1;
  border:none;
  border-radius:14px;
  padding:14px 12px;
  background:rgba(255,255,255,.10);
  color:#fff;
  cursor:pointer;
  font-weight:800;
}
.btn.primary{background:rgba(74,144,226,.85);}
.btn.danger{background:rgba(255,59,48,.80);}

.hint{
  padding:14px;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  color:rgba(255,255,255,.8);
  line-height:1.35;
}

.bottomnav{
  border-top:1px solid var(--line);
  background:rgba(0,0,0,.25);
  display:flex;
  padding:10px 10px calc(10px + var(--safe-bottom));
  gap:10px;
}
.navbtn{
  flex:1;
  border:none;
  border-radius:14px;
  padding:12px;
  background:rgba(255,255,255,.08);
  color:rgba(255,255,255,.85);
  cursor:pointer;
  font-weight:800;
}
.navbtn.active{background:rgba(255,255,255,.14); color:#fff;}

/* ------------------ CALL SCREEN (выровненный + responsive) ------------------ */

.call-shell{
  display:flex;
  justify-content:center;
}

.call-screen-base {
  position: relative;
  width: min(420px, 100%);
  aspect-ratio: 9 / 16;         /* держит форму */
  min-height: 640px;            /* если очень высокий экран — не ломаем */
  max-height: calc(100vh - 140px);
  overflow:hidden;
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.08);
  background:#000;
}

/* remote video background */
.call-bg-video{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  z-index:0;
  background:#000;
}

/* fallback image */
.call-screen-base .image{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  z-index:1;
}

.call-screen-base .rectangle-4{
  position:absolute;
  top:-18px; left:0; right:0;
  height:110px;
  background: linear-gradient(180deg, rgba(0,0,0,.70) 0%, rgba(0,0,0,0) 100%);
  z-index:3;
}

.call-screen-base .rectangle{
  position:absolute;
  left:0; right:0;
  bottom:0;
  height:140px;
  background: linear-gradient(0deg, rgba(0,0,0,.85) 0%, rgba(0,0,0,0) 100%);
  z-index:3;
}

.element{
  position:absolute;
  top: calc(18px + var(--safe-top));
  left:0; right:0;
  height:34px;
  display:flex;
  justify-content:center;
  align-items:center;
  font-weight:900;
  font-size:20px;
  z-index:5;
  color:#fff;
  text-shadow: 0 2px 10px rgba(0,0,0,.35);
}

.call-sub{
  position:absolute;
  top: calc(52px + var(--safe-top));
  left:0; right:0;
  text-align:center;
  font-size:13px;
  color:rgba(255,255,255,.80);
  z-index:5;
  text-shadow: 0 2px 10px rgba(0,0,0,.35);
}

/* top-right camera button (round glass) */
.group-4{
  position:absolute;
  top: calc(60px + var(--safe-top));
  right: 14px;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: rgba(255,255,255,.60);
  border: 1px solid rgba(255,255,255,.65);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:6;
}
.btn-ico{font-size:20px;}

/* emoji button */
.ellipse-2{
  position:absolute;
  left:14px;
  bottom: 170px;
  width: 46px;
  height: 46px;
  border-radius: 23px;
  background: rgba(255,255,255,.60);
  border: 1px solid rgba(255,255,255,.65);
  z-index:6;
  display:flex;
  align-items:center;
  justify-content:center;
}
.text-wrapper{
  font-weight:900;
  font-size:20px;
  color:#000;
}

/* local PIP */
.call-local-pip{
  position:absolute;
  right: 14px;
  top: calc(130px + var(--safe-top));
  width: 110px;
  height: 165px;
  border-radius: 14px;
  object-fit: cover;
  z-index:6;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.35);
  display:none; /* show after permission */
}

/* bottom control row (aligned) */
.call-bottom{
  position:absolute;
  left:0; right:0;
  bottom: calc(18px + var(--safe-bottom));
  display:flex;
  justify-content:center;
  align-items:flex-end;
  gap: 16px;
  z-index:6;
}

.call-small{
  width: 62px;
  height: 62px;
  border-radius: 31px;
  background: rgba(255,255,255,.60);
  border: 1px solid rgba(255,255,255,.65);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 20px;
  color:#000;
  padding:0;
}

.call-hang{
  width: 102px;
  height: 102px;
  border-radius: 51px;
  padding:0;
  background: transparent;
}

.call-hang-inner{
  width:100%;
  height:100%;
  border-radius: 51px;
  background: rgba(255,0,0,.60);
  border: 1px solid rgba(255,255,255,.85);
  display:flex;
  align-items:center;
  justify-content:center;
}

.hangup-icon{
  width:42px;
  height:14px;
  border-radius:999px;
  background: rgba(255,255,255,.95);
}

/* accept/start button */
.call-accept{
  position:absolute;
  left: 16px;
  right: 16px;
  bottom: calc(142px + var(--safe-bottom));
  height: 54px;
  border-radius: 18px;
  background: rgba(74, 227, 142, .88);
  color:#000;
  font-weight:900;
  z-index:7;
  display:flex;
  align-items:center;
  justify-content:center;
}

/* small screens */
@media (max-height: 720px){
  .call-screen-base{ min-height: 600px; }
  .call-accept{ bottom: calc(130px + var(--safe-bottom)); }
}
/* ===== CALL SCREEN CLEAN ===== */

.call {
  position: relative;
  width: 100%;
  height: 100vh;
  background: #000;
  overflow: hidden;
}

.call-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-top {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  z-index: 5;
  text-align: center;
  color: #fff;
}

.call-name {
  font-size: 20px;
  font-weight: 800;
}

.call-time {
  font-size: 14px;
  opacity: .7;
  margin-top: 4px;
}

.call-pip {
  position: absolute;
  top: 80px;
  right: 16px;
  width: 110px;
  height: 160px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.3);
  z-index: 6;
}

.call-controls {
  position: absolute;
  bottom: 36px;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
}

.call-btn {
  border: none;
  background: rgba(255,255,255,.75);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.call-btn.small {
  width: 60px;
  height: 60px;
  border-radius: 30px;
  font-size: 22px;
}

.call-btn.hangup {
  width: 96px;
  height: 96px;
  border-radius: 48px;
  background: rgba(255,0,0,.75);
}

.call-btn.hangup span {
  width: 42px;
  height: 14px;
  border-radius: 8px;
  background: #fff;
}
