:root {
  --font: "Roboto Variable", Roboto, "Helvetica Neue", Helvetica, sans-serif;
  --red: #e31119;
  --red-deep: #9c0304;
  --ink: #231f20;
  --wa-header: #075e54;
  --wa-header-2: #128c7e;
  --wa-bg: #e5ddd5;
  --wa-out: #d9fdd3;
  --wa-in: #ffffff;
  --wa-meta: #667781;
  --wa-composer: #f0f2f5;
  --wa-send: #00a884;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, rgba(227, 17, 25, 0.16), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(18, 140, 126, 0.18), transparent 42%),
    linear-gradient(160deg, #f4f4f4 0%, #ebebeb 45%, #f8f8f8 100%);
}

.stage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
}

.stage-hint {
  width: min(390px, 100%);
  margin: 0;
  text-align: center;
  color: #666;
  font-size: 0.85rem;
}

.phone {
  width: min(390px, 100%);
  height: min(780px, calc(100vh - 72px));
  min-height: 560px;
  background: #000;
  border-radius: 28px;
  overflow: hidden;
  box-shadow:
    0 0 0 10px #1a1a1a,
    0 30px 80px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  position: relative;
}
.phone-notch {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 22px;
  background: #111;
  border-radius: 14px;
  z-index: 5;
}

.wa-header {
  background: linear-gradient(180deg, var(--wa-header-2), var(--wa-header));
  color: #fff;
  display: grid;
  grid-template-columns: 36px 42px 1fr auto;
  gap: 0.45rem;
  align-items: center;
  padding: 2.1rem 0.7rem 0.7rem;
}
.wa-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.wa-avatar img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  display: block;
}
.wa-peer strong {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
}
.wa-peer span {
  font-size: 0.75rem;
  opacity: 0.9;
}
.wa-actions {
  display: flex;
  gap: 0.25rem;
  padding-right: 0.2rem;
}
.wa-actions span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
}

.icon-btn {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
}
.icon-btn.soft { color: #54656f; font-size: 1.25rem; }

.wa-thread {
  flex: 1;
  overflow: auto;
  padding: 0.85rem 0.7rem 0.5rem;
  background-color: var(--wa-bg);
  background-image:
    linear-gradient(rgba(229, 221, 213, 0.92), rgba(229, 221, 213, 0.92)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h60v60H0z' fill='%23d6cfc6'/%3E%3Cpath d='M10 8h8M30 20h12M5 40h10M40 50h14' stroke='%23cbbfb3' stroke-width='2' stroke-linecap='round' opacity='.35'/%3E%3C/svg%3E");
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.day-chip {
  align-self: center;
  background: rgba(255,255,255,0.85);
  color: var(--wa-meta);
  font-size: 0.72rem;
  padding: 0.28rem 0.65rem;
  border-radius: 8px;
  margin: 0.35rem 0 0.5rem;
  box-shadow: 0 1px 1px rgba(0,0,0,0.06);
}

.msg {
  max-width: 86%;
  padding: 0.45rem 0.55rem 0.3rem;
  border-radius: 8px;
  position: relative;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.08);
  animation: pop 0.18s ease;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.msg.in {
  align-self: flex-start;
  background: var(--wa-in);
  border-top-left-radius: 0;
}
.msg.out {
  align-self: flex-end;
  background: var(--wa-out);
  border-top-right-radius: 0;
}
.msg.system {
  align-self: center;
  background: #ffe9a9;
  color: #5c4b12;
  font-size: 0.78rem;
  text-align: center;
  max-width: 92%;
  border-radius: 8px;
}
.msg .text {
  white-space: pre-wrap;
  font-size: 0.94rem;
  line-height: 1.35;
  color: #111;
}
.msg .meta {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
  margin-top: 0.15rem;
  font-size: 0.68rem;
  color: var(--wa-meta);
}
.msg.out .meta { color: #667781; }

.wa-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.55rem 0.7rem;
  background: rgba(240, 242, 245, 0.96);
  border-top: 1px solid #e0e0e0;
}
.wa-quick[hidden] { display: none !important; }
.chip {
  border: 1px solid var(--wa-header-2);
  background: #fff;
  color: var(--wa-header);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: 0.15s ease;
}
.chip:hover {
  background: #e7f8f5;
  border-color: var(--red);
  color: var(--red-deep);
}

.wa-composer {
  display: grid;
  grid-template-columns: 36px 1fr 44px;
  gap: 0.35rem;
  align-items: center;
  padding: 0.45rem 0.5rem 0.7rem;
  background: var(--wa-composer);
}
.wa-composer input {
  border: 0;
  border-radius: 22px;
  padding: 0.7rem 0.95rem;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  background: #fff;
  box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}
.send-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--wa-send);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0,168,132,0.35);
}
.send-btn:active { transform: scale(0.96); }

.typing {
  align-self: flex-start;
  background: #fff;
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  color: #667781;
  font-size: 0.85rem;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.08);
}

@media (max-width: 480px) {
  .stage { padding: 0.5rem 0 0; justify-content: flex-start; }
  .stage-brand, .stage-hint { width: 100%; padding: 0 0.75rem; }
  .phone {
    width: 100%;
    height: calc(100vh - 110px);
    border-radius: 0;
    box-shadow: none;
    min-height: 0;
  }
  .phone-notch { display: none; }
  .wa-header { padding-top: 0.75rem; }
}
