:root{
  --bg: #07080a;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.09);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.62);
  --line: rgba(255,255,255,0.10);
  --blue: #0a84ff;           /* iMessage blue */
  --bubbleDark: rgba(255,255,255,0.08);
  --shadow: 0 14px 40px rgba(0,0,0,0.55);
  --radius: 22px;
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  background: radial-gradient(1200px 800px at 30% -10%, rgba(10,132,255,0.12), transparent 60%),
              radial-gradient(800px 600px at 80% 30%, rgba(255,255,255,0.05), transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, system-ui, Segoe UI, Roboto, Arial, sans-serif;
  overflow:hidden;
}

/* iPhone-perfect layout */
.phone{
  height:100svh;
  width:100vw;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  display:flex;
  flex-direction:column;
}

/* Top bar */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  background: rgba(0,0,0,0.25);
}

.title .name{
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 16px;
  line-height: 1.2;
}
.title .subtitle{
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.status{
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
}
.status.busy{
  background: rgba(10,132,255,0.18);
  border-color: rgba(10,132,255,0.35);
}

/* Upper half image bubble */
.hero{
  position:relative;
  flex: 0 0 48svh; /* moitié supérieure */
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 14px;
}

.avatarBubble{
  width:min(92vw, 430px);
  height: calc(48svh - 28px);
  border-radius: 28px;
  overflow:hidden;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: var(--shadow);
  position:relative;
}

.avatarImg{
  width:100%;
  height:100%;
  object-fit: cover;
  object-position: center 20%; /* ⬅️ descend le cadrage */
  display:block;
  transform: scale(1.05); /* léger zoom premium */
}

.heroFade{
  position:absolute;
  bottom:0;
  left:0;
  right:0;
  height: 120px;
  background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(7,8,10,0.85), rgba(7,8,10,1));
  pointer-events:none;
}

/* Lower half chat */
.chatWrap{
  flex: 1 1 auto;
  display:flex;
  flex-direction:column;
  min-height: 0;
  padding: 8px 12px 12px 12px;
}

.chat{
  flex: 1 1 auto;
  min-height: 0;
  overflow:auto;
  padding: 6px 4px 10px 4px;
  scroll-behavior:smooth;
}

/* Messages iMessage-ish */
.msg{
  display:flex;
  margin: 10px 0;
}
.msg-ai{ justify-content:flex-start; }
.msg-user{ justify-content:flex-end; }

.bubble{
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 18px;
  line-height: 1.28;
  font-size: 15px;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  word-wrap: break-word;
  white-space: pre-wrap;
}

.msg-ai .bubble{
  background: var(--bubbleDark);
  color: var(--text);
  border-top-left-radius: 8px;
}

.msg-user .bubble{
  background: var(--blue);
  color: white;
  border: none;
  border-top-right-radius: 8px;
}

/* Composer */
.composer{
  display:flex;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(12px);
}

.input{
  flex:1;
  border:none;
  outline:none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  padding: 10px 8px;
}

.input::placeholder{
  color: rgba(255,255,255,0.40);
}

.sendBtn{
  border: none;
  outline: none;
  cursor:pointer;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(10,132,255,1), rgba(10,132,255,0.82));
  color:#fff;
  font-weight: 700;
  font-size: 14px;
  min-width: 92px;
  box-shadow: 0 10px 22px rgba(10,132,255,0.22);
}

.sendBtn:disabled{
  opacity: 0.6;
  cursor:not-allowed;
}

.hint{
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  text-align:center;
}