*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  background: #000;
  overflow: hidden;
  touch-action: manipulation;
}

/* ── App wrapper: fixed 1080×1920, scaled by JS ───────────── */
#app-wrap {
  position: absolute;
  width: 1080px;
  height: 1920px;
  transform-origin: 0 0;
  overflow: hidden;
  background: #0a0a0a;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  user-select: none;
}

/* ── Rotate overlay (mobile landscape) — lives outside app-wrap ── */
.rotate-overlay {
  position: fixed;
  inset: 0;
  background: #0a0a0a;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
}
.rotate-overlay.hidden { display: none; }
.rotate-icon {
  font-size: 130px;
  color: rgba(255,255,255,0.8);
  animation: rotate-hint 2s ease-in-out infinite;
}
@keyframes rotate-hint {
  0%, 100% { transform: rotate(0deg); }
  50%       { transform: rotate(-90deg); }
}
.rotate-text { font-size: 50px; color: rgba(255,255,255,0.7); }

/* ── Screen visibility ─────────────────────────────────────── */
.screen        { display: block; width: 1080px; height: 1920px; }
.screen.hidden { display: none !important; }

/* ── PIN / Landing screen ─────────────────────────────────── */
.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0d0d;
}

.landing-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 50px;
  padding: 60px 80px;
}

.landing-title { font-size: 194px; line-height: 1; }

.landing-sub {
  font-size: 65px;
  color: rgba(255,255,255,0.6);
  text-align: center;
}

.landing-hint {
  font-size: 49px;
  color: rgba(255,255,255,0.4);
  min-height: 1em;
  text-align: center;
}

.copy-link-btn {
  padding: 27px 54px;
  border-radius: 54px;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
  font-size: 43px;
  cursor: pointer;
  transition: background 0.15s;
}
.copy-link-btn:hover { background: rgba(255,255,255,0.15); }

/* ── PIN dots ─────────────────────────────────────────────── */
.pin-dots { display: flex; gap: 38px; }
.pin-dots span {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.25);
  transition: background 0.15s, border-color 0.15s;
}
.pin-dots span.filled { background: #fff; border-color: #fff; }

/* ── Numpad ───────────────────────────────────────────────── */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 227px);
  gap: 27px;
}

.np {
  height: 227px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 86px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.12s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.np:hover  { background: rgba(255,255,255,0.18); }
.np:active { transform: scale(0.92); }

.np-del { background: transparent; font-size: 60px; }
.np-ok  { background: #22c55e; font-size: 60px; }
.np-ok:hover    { background: #16a34a; }
.np-ok:disabled { background: rgba(34,197,94,0.4); cursor: default; }

/* ── Call screen ──────────────────────────────────────────── */
.app { position: relative; background: #000; }

.call-container {
  position: absolute;
  inset: 0;
  background: #111;
  overflow: hidden;
}

/* ── Remote canvas (fills call-container) ─────────────────── */
#remoteCanvas {
  position: absolute;
  inset: 0;
  display: block;
}

/* ── Local video PiP ──────────────────────────────────────── */
#localVideo {
  position: absolute;
  bottom: 238px;
  right: 32px;
  width: 238px;
  height: 421px;
  object-fit: cover;
  border-radius: 22px;
  border: 2px solid rgba(255,255,255,0.2);
  background: #222;
  z-index: 40;
  transition: opacity 0.2s;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
#localVideo.dragging { cursor: grabbing; transition: none; }

/* ── Status bar ───────────────────────────────────────────── */
.status-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 32px 43px;
  display: flex;
  align-items: center;
  gap: 22px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.65), transparent);
  z-index: 30;
  pointer-events: none;
  transition: opacity 0.3s;
}

.status-dot {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #555;
}

.status-dot.connecting   { background: #f59e0b; animation: blink 1s infinite; }
.status-dot.waiting      { background: #f59e0b; animation: blink 1.5s infinite; }
.status-dot.connected    { background: #22c55e; }
.status-dot.reconnecting { background: #ef4444; animation: blink 0.6s infinite; }
.status-dot.error        { background: #ef4444; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.15; }
}

#statusText {
  font-size: 38px;
  font-weight: 500;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

/* ── Waiting overlay ──────────────────────────────────────── */
.waiting-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  background: rgba(0,0,0,0.75);
  z-index: 10;
  padding: 60px;
}
.waiting-overlay.hidden { display: none; }

.waiting-msg {
  font-size: 59px;
  font-weight: 500;
  opacity: 0.8;
  text-align: center;
}

.my-info-row {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 59px;
}
.my-info-label { color: rgba(255,255,255,0.45); }
.my-info-value { font-weight: 700; }

#notifyList {
  display: flex;
  flex-direction: column;
  gap: 30px;
  width: 100%;
  max-width: 900px;
}

.notify-btn {
  width: 100%;
  padding: 43px 65px;
  border-radius: 54px;
  border: none;
  background: #22c55e;
  color: #fff;
  font-size: 59px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.notify-btn:hover   { background: #16a34a; }
.notify-btn:active  { transform: scale(0.97); }
.notify-btn:disabled { background: rgba(34,197,94,0.4); cursor: default; }

/* ── Controls ─────────────────────────────────────────────── */
.controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 32px 43px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 43px;
  background: linear-gradient(to top, rgba(0,0,0,0.65), transparent);
  z-index: 30;
  transition: opacity 0.3s;
}
.ui-hidden { opacity: 0 !important; pointer-events: none !important; }

.ctrl-btn {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 70px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  backdrop-filter: blur(6px);
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.ctrl-btn:hover  { background: rgba(255,255,255,0.28); }
.ctrl-btn:active { transform: scale(0.92); }
.ctrl-btn.off    { background: rgba(239,68,68,0.8); }

/* ── Call timer ───────────────────────────────────────────── */
.call-timer {
  margin-left: auto;
  font-size: 38px;
  font-weight: 600;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}
.call-timer.hidden { display: none; }

/* ── Name input (misc) ────────────────────────────────────── */
.name-input {
  width: 100%;
  padding: 30px 40px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.07);
  color: #fff;
  font-size: 50px;
  outline: none;
  text-align: center;
}
.name-input::placeholder { color: rgba(255,255,255,0.3); }
.name-input:focus { border-color: rgba(255,255,255,0.35); background: rgba(255,255,255,0.1); }
