:root {
  --wa-header: #008069;
  --wa-header-2: #017561;
  --wa-send: #00a884;
  --wa-send-dark: #008f72;
  --wa-wallpaper: #efeae2;
  --wa-in: #ffffff;
  --wa-out: #d9fdd3;
  --wa-ink: #111b21;
  --wa-meta: #667781;
  --wa-tick: #53bdeb;
  --wa-bar: #f0f2f5;
  --wa-line: #e9edef;
  --wa-chip: #ffffff;
  --wa-danger: #ea0038;
  --wa-amber: #b7791f;
  --shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  color: var(--wa-ink);
  font-family: "Segoe UI", "Noto Sans Devanagari", "Nirmala UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #0b141a; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:active { transform: scale(0.96); }
img { max-width: 100%; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* PIN gate, in the same green as the chat header. */
.gate {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--wa-header);
  color: #fff;
  padding: calc(28px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}
.gate-hero { text-align: center; margin-bottom: 18px; }
.gate-hero h1 { margin: 10px 0 0; font-size: 28px; font-weight: 600; letter-spacing: 0.2px; }
.gate-hero p { margin: 4px 0 0; opacity: 0.9; font-size: 15px; }
.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: block;
  margin: 0 auto;
  background: #e7f6f2;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}
.avatar.sm { width: 40px; height: 40px; margin: 0; box-shadow: none; flex: 0 0 auto; }
.pad-card {
  background: #fff;
  color: var(--wa-ink);
  border-radius: 16px;
  padding: 18px 16px 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.pad-card h2 { margin: 0 0 12px; text-align: center; font-size: 16px; font-weight: 600; color: var(--wa-meta); }
.dots { display: flex; gap: 14px; justify-content: center; margin: 4px 0 12px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--wa-header); }
.dots i.on { background: var(--wa-header); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keys button {
  height: 58px;
  border-radius: 12px;
  background: var(--wa-bar);
  font-size: 24px;
  font-weight: 600;
}
.keys button.ghost { font-size: 15px; color: var(--wa-meta); font-weight: 600; }
.note {
  margin: 0 0 10px;
  text-align: center;
  color: #c0392b;
  font-size: 14px;
  font-weight: 600;
}

/* Chat column. On a wide screen it sits like a phone in the middle. */
.frame {
  max-width: 480px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--wa-wallpaper);
  overflow: hidden;
}

.top {
  background: var(--wa-header);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 6px 8px 12px;
  min-height: calc(56px + env(safe-area-inset-top));
  z-index: 5;
}
.who { flex: 1; min-width: 0; }
.who b { display: block; font-size: 17px; font-weight: 600; line-height: 1.2; }
.who small { display: block; margin-top: 1px; font-size: 13px; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.icon-btn svg { width: 22px; height: 22px; }
.menu {
  position: absolute;
  top: calc(52px + env(safe-area-inset-top));
  right: 8px;
  background: #fff;
  color: var(--wa-ink);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(11, 20, 26, 0.24);
  min-width: 210px;
  z-index: 8;
  overflow: hidden;
}
.menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  font-size: 15px;
}
.menu button + button { border-top: 1px solid var(--wa-line); }
.menu button.on { color: var(--wa-header); font-weight: 800; }
.lang-row { display: flex; }
.lang-row button { flex: 1; text-align: center; }

.msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 8px 4px;
  background-color: #ece7df;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'><g fill='none' stroke='%23c8bfb4' stroke-width='1.2' opacity='0.45'><circle cx='28' cy='36' r='8'/><path d='M24 48c6 8 14 8 18-2'/><path d='M120 28c8 2 12 10 8 16-6 2-12-2-14-8'/><path d='M70 110l8-16 8 16'/><circle cx='150' cy='130' r='6'/><path d='M40 140h22M48 134v14'/></g></svg>");
  -webkit-overflow-scrolling: touch;
}

.day { display: flex; justify-content: center; margin: 4px 0 6px; }
.day span {
  background: rgba(255, 255, 255, 0.72);
  color: var(--wa-meta);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(17, 27, 33, 0.05);
}

.row { display: flex; align-items: flex-end; gap: 6px; margin: 0; }
.row.in { justify-content: flex-start; }
.row.out { justify-content: flex-end; }
.row + .row { margin-top: 12px; }
.row.group { margin-top: 3px; }
.msg-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  border-radius: 50%;
}
.msg-mark .munshi, .msg-mark .avatar { width: 36px; height: 36px; margin: 0; box-shadow: none; display: block; overflow: visible; }
button.msg-mark { cursor: pointer; }
button.msg-mark:active { transform: scale(0.94); }

.bubble {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: min(78%, 320px);
  min-width: 0;
  padding: 4px 8px 2px;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(17, 27, 33, 0.06);
  font-size: 14.5px;
  line-height: 1.28;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.bubble.in { background: var(--wa-in); border-bottom-left-radius: 5px; }
.bubble.out { background: var(--wa-out); border-bottom-right-radius: 5px; }
.bubble.cardish { max-width: min(94%, 380px); }
.bubble p { margin: 0; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.bubble .shot {
  display: block;
  width: 220px;
  max-width: 100%;
  border-radius: 6px;
  margin-bottom: 4px;
}
.file-pill { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.file-pill svg { width: 28px; height: 28px; color: var(--wa-header); flex: 0 0 auto; }

.meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  align-self: flex-end;
  margin: 2px 0 0;
  color: var(--wa-meta);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}
.bubble.out .meta { color: #5f8f78; }
.ticks { width: 16px; height: 11px; color: var(--wa-tick); }
.ticks.wait { color: #8aa89a; }
.row.fresh { animation: msg-in 0.34s ease; }

.card {
  background: #f7f8fa;
  border-radius: 8px;
  margin: 2px 0 4px;
  overflow: hidden;
  width: 100%;
}
.bubble.out .card { background: rgba(255, 255, 255, 0.55); }
.card header {
  padding: 6px 8px 4px;
  background: #e7f6f2;
}
.card header b { display: block; font-size: 14px; color: var(--wa-header-2); }
.card header span { display: block; font-size: 12px; color: var(--wa-meta); font-weight: 600; }
.card header.good { background: #d9fdd3; }
.card header.warn { background: #fff4e0; }
.card header.warn b { color: #8a5a00; }
.card .line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  font-size: 13.5px;
}
.card .line + .line { border-top: 1px solid rgba(17, 27, 33, 0.06); }
.card .line span { color: var(--wa-meta); }
.card .line b { font-weight: 650; text-align: right; }
.card .line b.miss { color: var(--wa-amber); font-weight: 600; }
.card .body { margin: 0; padding: 8px 10px 10px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; }
.card ul { list-style: none; margin: 0; padding: 4px 0; }
.card li {
  padding: 5px 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13.5px;
}
.card li + li { border-top: 1px solid rgba(17, 27, 33, 0.06); }
.card .empty { margin: 0; padding: 10px; color: var(--wa-meta); font-size: 14px; }

.typing { display: inline-flex; gap: 4px; padding: 6px 4px; }
.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8d9aa3;
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 10px 2px;
  background: transparent;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: 0 0 auto;
  background: var(--wa-chip);
  color: #02735e;
  border: 1px solid #d6e3df;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--wa-bar);
}
.clip, .round {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #54656f;
}
.round { background: var(--wa-send); color: #fff; }
.round svg, .clip svg { width: 24px; height: 24px; }
.field {
  flex: 1;
  min-width: 0;
  background: #fff;
  border-radius: 24px;
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 6px 14px;
  box-shadow: var(--shadow);
}
.field input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
  padding: 6px 0;
}
.rec {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 24px;
  min-height: 46px;
  padding: 0 12px;
  box-shadow: var(--shadow);
  color: var(--wa-danger);
  font-weight: 650;
}
.rec .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--wa-danger);
  animation: blink 1s infinite;
}
.rec small { color: var(--wa-meta); font-weight: 600; margin-left: auto; }
.trash { color: #8696a0; width: 40px; height: 40px; display: grid; place-items: center; }
.trash svg { width: 22px; height: 22px; }

.sheet-bg {
  position: absolute;
  inset: 0;
  background: rgba(11, 20, 26, 0.35);
  z-index: 6;
}
.sheet {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(70px + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 16px;
  padding: 8px;
  z-index: 7;
  box-shadow: 0 12px 40px rgba(11, 20, 26, 0.28);
}
.sheet button {
  width: 100%;
  text-align: left;
  padding: 14px 12px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sheet button:active { background: var(--wa-bar); }
.sheet svg { width: 22px; height: 22px; color: var(--wa-header); }

.frame { animation: screen-in 0.4s ease; }
.top .munshi.sm {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: block;
  overflow: visible;
}
.gate-hero .munshi.md {
  width: 92px;
  height: 92px;
  margin: 0 auto 2px;
  display: block;
}
.splash {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
  background:
    radial-gradient(90% 55% at 50% 12%, rgba(245, 158, 11, 0.2), transparent 58%),
    linear-gradient(180deg, #163f3b 0%, #0c1c1a 100%);
  color: #f7f3ea;
  animation: screen-in 0.45s ease;
}
.splash-mark {
  display: grid;
  place-items: center;
  width: 168px;
  height: 168px;
  border-radius: 42px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 22px 48px rgba(0, 0, 0, 0.28);
}
.splash .munshi.lg { width: 132px; height: 132px; display: block; }
.splash-copy { text-align: center; }
.splash-rule {
  display: block;
  width: 36px;
  height: 2px;
  margin: 0 auto 12px;
  border-radius: 2px;
  background: #f59e0b;
}
.splash-name {
  margin: 0;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: 0.01em;
}
.gate { animation: screen-in 0.4s ease; }
.munshi-face { clip-path: circle(46px at 56px 56px); }
.munshi-ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: munshi-spin 16s linear infinite;
}
.munshi-bob {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: munshi-bob 2.8s ease-in-out infinite;
}
.munshi-eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: munshi-blink 3.6s ease-in-out infinite;
}
.munshi-pen {
  transform-box: fill-box;
  transform-origin: 18% 78%;
  animation: munshi-write 1.15s ease-in-out infinite;
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes munshi-spin { to { transform: rotate(360deg); } }
@keyframes munshi-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes munshi-blink {
  0%, 42%, 50%, 100% { transform: scaleY(1); }
  46% { transform: scaleY(0.12); }
}
@keyframes munshi-write {
  0%, 100% { transform: rotate(-7deg); }
  50% { transform: rotate(8deg); }
}

@media (prefers-reduced-motion: reduce) {
  .typing i, .rec .dot, .munshi-ring, .munshi-bob, .munshi-eye, .munshi-pen, .splash, .gate, .frame, .row.fresh { animation: none; }
  button:active { transform: none; }
}
