:root {
  --pink: #ff7eb3;
  --pink-deep: #ff5e9c;
  --purple: #845ec2;
  --green: #2ecc71;
  --green-deep: #27ae60;
  --red: #ff4d4d;
  --red-deep: #e63946;
  --dark: #2b2440;
  --soft: #f3effa;
  --shadow: 0 10px 30px rgba(80, 40, 120, 0.18);
}

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

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--dark);
  overscroll-behavior: none;
}

body {
  background: linear-gradient(160deg, #ffd3e0 0%, #e7d9ff 55%, #d3ecff 100%);
  min-height: 100dvh;
}

.hidden { display: none !important; }
.muted { color: #7a6f96; }
.center { text-align: center; }

.screen {
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* ---------- tlačítka / vstupy ---------- */
.btn {
  border: none;
  border-radius: 18px;
  padding: 16px 22px;
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--pink-deep); color: #fff; box-shadow: var(--shadow); }
.btn-primary:disabled { background: #d9cfe8; color: #fff; box-shadow: none; }
.btn-soft { background: #fff; color: var(--dark); box-shadow: var(--shadow); margin-bottom: 12px; }
.btn-soft.danger { color: var(--red-deep); }

input[type="text"], input[type="password"] {
  width: 100%;
  border: 3px solid #fff;
  border-radius: 18px;
  padding: 16px 18px;
  font-size: 20px;
  background: #fff;
  outline: none;
  box-shadow: var(--shadow);
}
input:focus { border-color: var(--pink); }

.error { color: var(--red-deep); font-weight: 600; }

/* ---------- vstupní heslo ---------- */
#screen-gate { justify-content: center; align-items: center; }
.gate-box {
  width: 100%; max-width: 360px;
  display: flex; flex-direction: column; gap: 16px; align-items: stretch; text-align: center;
}
.big-emoji { font-size: 80px; line-height: 1; }
.gate-box h1 { font-size: 40px; margin: 0; }

/* ---------- profil ---------- */
#screen-setup { justify-content: center; align-items: center; }
.setup-box {
  width: 100%; max-width: 360px;
  display: flex; flex-direction: column; gap: 18px; align-items: center; text-align: center;
}
.setup-box h1 { font-size: 34px; margin: 0; }
.avatar-pick {
  width: 180px; height: 180px; border-radius: 50%;
  border: 5px solid #fff; background: #fff;
  box-shadow: var(--shadow); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 0; color: var(--purple); font-weight: 700; font-size: 18px;
}
.avatar-pick img { width: 100%; height: 100%; object-fit: cover; display: none; }
.avatar-pick.has-photo img { display: block; }
.avatar-pick.has-photo span { display: none; }
.setup-box input, .setup-box .btn { width: 100%; }

/* ---------- domov ---------- */
.home-top { display: flex; align-items: center; justify-content: space-between; }
.me-chip { display: flex; align-items: center; gap: 10px; background: #ffffffcc; padding: 6px 14px 6px 6px; border-radius: 999px; box-shadow: var(--shadow); }
.me-chip img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #eee; }
.me-chip span { font-weight: 700; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: #ffffffcc; box-shadow: var(--shadow); font-size: 22px; cursor: pointer; }
.home-title { text-align: center; font-size: 26px; margin: 18px 0 14px; }

.people-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  align-content: start;
}
.person {
  background: #fff;
  border-radius: 26px;
  padding: 18px 10px 16px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer; border: none; position: relative;
  transition: transform .08s ease;
}
.person:active { transform: scale(.96); }
.person .pphoto { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; background: linear-gradient(135deg,#ffd3e0,#e7d9ff); }
.person .pname { font-size: 20px; font-weight: 800; color: var(--dark); }
.person .dot { position: absolute; top: 16px; right: 18px; width: 16px; height: 16px; border-radius: 50%; background: #c9c0db; border: 3px solid #fff; }
.person .dot.on { background: var(--green); }
.notif-cta { margin-top: 20px; }
.install-hint { margin-top: auto; background: #ffffffcc; border-radius: 18px; padding: 14px 16px; font-size: 15px; color: #6b6088; box-shadow: var(--shadow); }

/* ---------- sheet menu ---------- */
.sheet { position: fixed; inset: 0; background: rgba(40,30,60,.45); display: flex; align-items: flex-end; z-index: 50; }
.sheet-card { background: var(--soft); width: 100%; border-radius: 26px 26px 0 0; padding: 22px 18px max(22px, env(safe-area-inset-bottom)); }

/* ---------- hovor ---------- */
.call-screen { padding: 0; background: #14101f; position: relative; overflow: hidden; }
#remote-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #14101f; }
#local-video {
  position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px;
  width: 110px; height: 150px; object-fit: cover; border-radius: 16px;
  border: 2px solid #ffffff66; background: #000; z-index: 5; box-shadow: var(--shadow);
}

.call-overlay {
  position: absolute; inset: 0; z-index: 8;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 12vh 20px max(40px, env(safe-area-inset-bottom));
  background: radial-gradient(120% 90% at 50% 30%, rgba(132,94,194,.55), rgba(20,16,31,.92));
}
.caller { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.caller-photo-wrap { width: 190px; height: 190px; border-radius: 50%; padding: 6px; }
.caller-photo-wrap img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #2b2440; }
.pulse { animation: pulse 1.6s ease-in-out infinite; box-shadow: 0 0 0 0 rgba(255,126,179,.55); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,126,179,.55); }
  70% { box-shadow: 0 0 0 40px rgba(255,126,179,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,126,179,0); }
}
.caller-name { color: #fff; font-size: 32px; font-weight: 800; }
.call-status { color: #ffffffcc; font-size: 18px; }

.call-actions { display: flex; gap: 60px; align-items: center; }
.round-btn {
  width: 78px; height: 78px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 32px; color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); transition: transform .08s ease;
}
.round-btn:active { transform: scale(.92); }
.round-btn.green { background: var(--green); }
.round-btn.red { background: var(--red); transform: rotate(133deg); }
.round-btn.red:active { transform: rotate(133deg) scale(.92); }
.round-btn.dark { background: #ffffff2e; backdrop-filter: blur(6px); }
.round-btn.dark.off { background: #ffffffe0; color: var(--dark); }
.round-btn.big { width: 88px; height: 88px; font-size: 36px; }

.incall-bar {
  position: absolute; left: 0; right: 0; bottom: max(28px, env(safe-area-inset-bottom));
  z-index: 9; display: flex; gap: 34px; align-items: center; justify-content: center;
}
