:root {
  --green: #008069;
  --send-green: #00a884;
  --bubble: #d9fdd3;
  --blue-tick: #53bdeb;
  --ink: #111b21;
  --muted: #667781;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(#00a884 0 128px, #e5ddd5 128px);
}

.install-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgb(37 211 102 / 18%), transparent 35%),
    linear-gradient(145deg, #f5fff9, #e6f3ee);
}

.install-card {
  width: min(100%, 430px);
  padding: 34px 30px;
  border: 1px solid rgb(0 128 105 / 12%);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 22px 60px rgb(11 20 26 / 16%);
  text-align: center;
}

.install-logo {
  width: 96px;
  height: 96px;
  margin-bottom: 14px;
  border-radius: 23px;
  box-shadow: 0 10px 25px rgb(0 128 105 / 22%);
}

.install-badge {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.3px;
}

.install-card h1 { margin: 0 0 10px; font-size: 28px; }
.install-card > p { margin: 0 auto 20px; color: var(--muted); line-height: 1.55; }
.install-card small { display: block; margin-top: 16px; color: #8696a0; font-size: 11px; }

.install-benefits {
  margin: 24px 0;
  padding: 0;
  list-style: none;
  color: #34464f;
  text-align: left;
}

.install-benefits li { margin: 12px 0; }
.install-benefits span { margin-right: 10px; color: var(--send-green); font-weight: 800; }

.primary-install-button,
.browser-button {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

.primary-install-button {
  border: 0;
  color: #fff;
  background: var(--send-green);
}

.primary-install-button:disabled { cursor: wait; opacity: .55; }
.browser-button { margin-top: 10px; border: 1px solid #d3dcdf; color: var(--green); background: #fff; }
.install-status { min-height: 20px; margin-bottom: 12px !important; font-size: 13px; }

.ios-install-help {
  margin: 18px 0;
  padding: 16px;
  border-radius: 12px;
  color: #34464f;
  background: #e9f8f2;
  text-align: left;
}

.ios-install-help ol { margin: 10px 0 0; padding-left: 20px; line-height: 1.6; }

.update-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 50;
  width: min(calc(100% - 24px), 430px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #fff;
  background: #202c33;
  box-shadow: 0 8px 30px rgb(11 20 26 / 28%);
  transform: translateX(-50%);
}

.update-banner span { flex: 1; font-size: 13px; }
.update-banner button { border: 0; color: #25d366; cursor: pointer; font-weight: 700; background: transparent; }
.update-banner #dismissUpdate { color: #fff; font-size: 22px; font-weight: 400; }

button, textarea { font: inherit; }
[hidden] { display: none !important; }

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.chat-window {
  width: min(100%, 430px);
  height: min(850px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #efeae2;
  border-radius: 16px;
  box-shadow: 0 12px 45px rgb(11 20 26 / 28%);
}

.chat-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: #fff;
  background: var(--green);
}

.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(145deg, #8bc34a, #3d8c74);
}

.contact-details { min-width: 0; flex: 1; }
.contact-details strong, .contact-details span { display: block; }
.contact-details strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.contact-details span { margin-top: 2px; font-size: 12px; opacity: .9; }
.header-actions { display: flex; align-items: center; }
.selection-header { gap: 8px; }
.selection-count { flex: 1; font-size: 18px; font-weight: 500; }
.delete-button { margin-left: auto; }

.icon-button, .inside-button, .send-button {
  border: 0;
  cursor: pointer;
  background: transparent;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 9px;
  color: #fff;
  border-radius: 50%;
}

.icon-button:hover { background: rgb(255 255 255 / 10%); }
.icon-button svg, .inside-button svg, .send-button svg { width: 22px; fill: currentColor; }
.back-button { padding: 0; font-size: 38px; line-height: 1; }
.menu-button { padding: 0; font-size: 28px; }

.messages {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 20px;
  background-color: #efeae2;
  background-image: radial-gradient(rgb(125 110 90 / 8%) 1px, transparent 1px);
  background-size: 18px 18px;
  scrollbar-width: thin;
}

.date-chip, .encryption-note {
  width: max-content;
  max-width: 86%;
  margin: 0 auto 10px;
  padding: 6px 10px;
  border-radius: 7px;
  color: #54656f;
  background: #fff;
  box-shadow: 0 1px 1px rgb(11 20 26 / 12%);
  font-size: 12px;
  text-align: center;
}

.encryption-note { background: #ffeecd; }

.message {
  position: relative;
  width: fit-content;
  max-width: 82%;
  margin: 5px 0;
  padding: 7px 9px 5px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 1px rgb(11 20 26 / 13%);
  animation: message-in .18s ease-out;
  cursor: default;
  touch-action: pan-y;
  transition: box-shadow .15s ease, filter .15s ease;
}

.message.selected {
  box-shadow: 0 0 0 3px rgb(0 128 105 / 42%), 0 1px 1px rgb(11 20 26 / 13%);
  filter: saturate(.78) brightness(.95);
}

.message.received { border-top-left-radius: 2px; }
.message.sent { margin-left: auto; border-top-right-radius: 2px; background: var(--bubble); }
.message p { display: inline; margin: 0; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.4; white-space: pre-wrap; }
.message-meta { margin-left: 8px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.ticks { letter-spacing: -4px; font-size: 15px; font-weight: 700; }
.ticks.read { color: var(--blue-tick); }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px;
  background: #f0f2f5;
}

.input-wrap {
  min-height: 46px;
  display: flex;
  align-items: flex-end;
  flex: 1;
  padding: 0 5px;
  border-radius: 24px;
  background: #fff;
}

textarea {
  min-width: 0;
  max-height: 110px;
  flex: 1;
  resize: none;
  overflow-y: auto;
  padding: 13px 6px 10px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  line-height: 1.35;
}

textarea::placeholder { color: #8696a0; }
.inside-button { width: 38px; height: 43px; padding: 10px 8px; color: #8696a0; }
.emoji-button { padding: 4px; font-size: 27px; line-height: 1; }

.send-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  border-radius: 50%;
  background: var(--send-green);
  box-shadow: 0 1px 2px rgb(11 20 26 / 20%);
}

.send-icon { display: none; transform: translateX(1px); }
.send-button.has-text .send-icon { display: block; }
.send-button.has-text .mic-icon { display: none; }

.dialog-backdrop {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(11 20 26 / 36%);
}

.delete-dialog {
  width: min(100%, 340px);
  padding: 24px;
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 12px 35px rgb(11 20 26 / 24%);
}

.delete-dialog h2 {
  margin: 0 0 28px;
  font-size: 17px;
  font-weight: 500;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-actions button {
  padding: 9px 11px;
  border: 0;
  border-radius: 6px;
  color: var(--green);
  font-weight: 600;
  cursor: pointer;
  background: transparent;
}

.dialog-actions button:hover,
.dialog-actions button:focus-visible { background: #e7fce8; outline: none; }

@keyframes message-in {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 520px) {
  body { background: #efeae2; }
  .app-shell { display: block; min-height: 100dvh; padding: 0; }
  .chat-window { width: 100%; height: 100dvh; border-radius: 0; box-shadow: none; }
  .camera-button { display: none; }
  .install-screen { padding: 16px; }
  .install-card { padding: 28px 22px; }
  .update-banner { top: 10px; }
}
