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

body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at 30% 20%, #2b3040, #16181f 70%);
  min-height: 100vh;
  color: #e8eaf0;
}

#stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
  min-height: 100vh;
  padding: 32px 16px;
}

/* ---- side panel ---- */

#sim-controls { max-width: 300px; }
#sim-controls h1 { font-size: 1.4rem; margin-bottom: 10px; }
#sim-controls .hint { color: #9aa1b3; font-size: 0.9rem; line-height: 1.5; margin-bottom: 18px; }
#sim-controls .hint a { color: #6ea8ff; }
#sim-controls label { display: block; font-size: 0.85rem; color: #9aa1b3; }
#sim-controls input {
  display: block; width: 100%; margin-top: 6px;
  background: #1f2330; color: #e8eaf0;
  border: 1px solid #343a4d; border-radius: 8px;
  padding: 9px 12px; font-size: 1rem;
}
#sim-controls input:focus { outline: none; border-color: #6ea8ff; }
.error { color: #ff7a7a; font-size: 0.85rem; margin-top: 10px; }

/* ---- the phone ---- */

#phone-frame {
  width: 375px; height: 760px;
  background: #0a0a0c;
  border-radius: 54px;
  padding: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 2px #2c2f3a inset;
  flex-shrink: 0;
}

#phone-screen {
  position: relative;
  width: 100%; height: 100%;
  background: #000;
  border-radius: 42px;
  overflow: hidden;
  display: flex; flex-direction: column;
}

#status-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px 6px;
  font-size: 0.8rem; font-weight: 600; color: #fff;
  background: #1c1c1e;
  position: relative;
}
.notch {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
  width: 110px; height: 24px; background: #000; border-radius: 14px;
}
.status-icons { font-size: 0.7rem; letter-spacing: 1px; }

#contact-header {
  background: #1c1c1e;
  border-bottom: 1px solid #2c2c2e;
  text-align: center;
  padding: 4px 12px 10px;
}
#contact-avatar {
  width: 44px; height: 44px; line-height: 44px;
  margin: 0 auto 4px;
  background: linear-gradient(#8e8e93, #636366);
  border-radius: 50%;
  font-size: 1.3rem;
}
#contact-name { font-size: 0.78rem; color: #fff; }

#thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 3px;
  background: #000;
}
.thread-note {
  color: #8e8e93; text-align: center; font-size: 0.85rem;
  margin: auto; line-height: 1.6;
}
.routed-note {
  margin: 8px 12px; font-size: 0.75rem; font-style: italic;
}

.bubble {
  max-width: 75%;
  padding: 8px 13px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #fff;
}
.bubble.mine {
  align-self: flex-end;
  background: #0b84fe;
  border-bottom-right-radius: 5px;
}
.bubble.theirs {
  align-self: flex-start;
  background: #26262a;
  border-bottom-left-radius: 5px;
}
.bubble + .bubble.mine.first, .bubble + .bubble.theirs.first { margin-top: 8px; }

.day-stamp {
  text-align: center; color: #8e8e93; font-size: 0.7rem;
  margin: 10px 0 6px;
}

#typing {
  align-self: flex-start;
  background: #26262a;
  border-radius: 18px; border-bottom-left-radius: 5px;
  padding: 12px 15px;
  display: flex; gap: 4px;
}
#typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #8e8e93;
  animation: blink 1.2s infinite;
}
#typing span:nth-child(2) { animation-delay: 0.2s; }
#typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

#compose {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 10px;
  background: #1c1c1e;
  border-top: 1px solid #2c2c2e;
}
#compose-input {
  flex: 1;
  background: #000; color: #fff;
  border: 1px solid #3a3a3c; border-radius: 18px;
  padding: 8px 14px;
  font-size: 0.95rem; font-family: inherit;
  resize: none;
  max-height: 110px;
}
#compose-input:focus { outline: none; }
#compose-send {
  width: 34px; height: 34px;
  border: none; border-radius: 50%;
  background: #0b84fe; color: #fff;
  font-size: 1.1rem; font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
#compose-send:disabled { background: #3a3a3c; cursor: default; }

#home-indicator {
  width: 130px; height: 5px;
  background: #3a3a3c; border-radius: 3px;
  margin: 6px auto 8px;
}

@media (max-width: 820px) {
  #stage { gap: 24px; }
  #sim-controls { max-width: 375px; text-align: center; }
}
