:root {
  --bg1: #ffe0ec;
  --bg2: #ffc2d9;
  --bg3: #f8a5c2;
  --header1: #ff5e94;
  --header2: #c44dff;
  --header3: #8e2de2;
  --mine1: #7c4dff;
  --mine2: #b388ff;
  --hers1: #ff77a9;
  --hers2: #ff4f8b;
  --chat-bg: #fff5f9;
  --text: #3a2233;
  --muted: rgba(255,255,255,0.85);
  --input-bg: #ffffff;
  --chip-bg: #ffffff;
  --chip-text: #c1447e;
  --panel-bg: #ffffff;
}

html.dark {
  --bg1: #2a0d2e;
  --bg2: #3d1240;
  --bg3: #4a1550;
  --header1: #7a1f5a;
  --header2: #5a1f7a;
  --header3: #3d1250;
  --mine1: #6a3fd1;
  --mine2: #8e5fff;
  --hers1: #d94f8b;
  --hers2: #b8306e;
  --chat-bg: #1a0a1f;
  --text: #f5e6f0;
  --muted: rgba(255,255,255,0.75);
  --input-bg: #2a132f;
  --chip-bg: #35163a;
  --chip-text: #ffb3d1;
  --panel-bg: #2a132f;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Vazirmatn', sans-serif;
  background: linear-gradient(160deg, var(--bg1), var(--bg2), var(--bg3));
  color: var(--text);
  overflow: hidden;
}
#root { height: 100%; }

.app-shell {
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--chat-bg);
  box-shadow: 0 0 60px rgba(150,20,90,0.25);
  overflow: hidden;
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(120deg, var(--header1), var(--header2), var(--header3));
  color: #fff;
  box-shadow: 0 4px 20px rgba(140,30,110,0.35);
  z-index: 5;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.avatar-wrap { position: relative; }
.online-dot {
  position: absolute; bottom: 1px; left: 1px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #2ecc71; border: 2px solid #fff;
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46,204,113,0.6); }
  70% { box-shadow: 0 0 0 8px rgba(46,204,113,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}
.header-name { font-weight: 900; font-size: 19px; line-height: 1.1; }
.header-status { font-size: 12px; font-weight: 300; opacity: 0.92; margin-top: 2px; }
.header-actions { display: flex; gap: 6px; }
.hbtn {
  background: rgba(255,255,255,0.18);
  border: none; color: #fff; font-size: 17px;
  width: 38px; height: 38px; border-radius: 12px; cursor: pointer;
  transition: transform .15s, background .2s;
}
.hbtn:hover { background: rgba(255,255,255,0.32); }
.hbtn:active { transform: scale(0.88); }

/* Avatar */
.nazi-avatar {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffd1e3, #ff6faa 70%);
  box-shadow: inset 0 -3px 8px rgba(180,20,90,0.3), 0 2px 8px rgba(200,40,110,0.3);
  animation: bob 3.2s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-3px);} }

/* Chat area */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  background:
    radial-gradient(circle at 90% 10%, rgba(255,120,170,0.08), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(180,120,255,0.08), transparent 40%),
    var(--chat-bg);
  scroll-behavior: smooth;
}
.chat-inner { display: flex; flex-direction: column; gap: 10px; }

.msg-row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.msg-row.mine { flex-direction: row-reverse; }
.msg-row.hers { justify-content: flex-start; }
.bubble-avatar { flex-shrink: 0; margin-bottom: 2px; }

.bubble {
  max-width: 78%;
  padding: 10px 14px 6px;
  border-radius: 20px;
  position: relative;
  animation: slideIn .35s cubic-bezier(.22,1,.36,1);
  word-break: break-word;
  line-height: 1.7;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.b-mine {
  background: linear-gradient(135deg, var(--mine1), var(--mine2));
  color: #fff; border-bottom-right-radius: 6px;
}
.b-hers {
  background: linear-gradient(135deg, var(--hers1), var(--hers2));
  color: #fff; border-bottom-left-radius: 6px;
}
.bubble-text { font-size: 15px; font-weight: 400; }
.bubble-time { font-size: 10px; opacity: 0.75; margin-top: 3px; text-align: left; }

/* Typing */
.typing-bubble { display: flex; gap: 5px; padding: 14px 16px; align-items: center; }
.typing-bubble .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff; opacity: 0.85;
  animation: blink 1.2s infinite;
}
.typing-bubble .dot:nth-child(2) { animation-delay: .2s; }
.typing-bubble .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { transform: scale(0.6); opacity: .4;} 40% { transform: scale(1); opacity: 1;} }

/* Quick replies */
.quick-row {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 10px 12px;
  background: var(--chat-bg);
  border-top: 1px solid rgba(200,80,140,0.12);
  scrollbar-width: none;
}
.quick-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  background: var(--chip-bg);
  color: var(--chip-text);
  border: 1.5px solid rgba(200,80,140,0.3);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px; font-weight: 500;
  font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: transform .15s, background .2s;
}
.chip:hover { background: linear-gradient(135deg, var(--hers1), var(--hers2)); color: #fff; }
.chip:active { transform: scale(0.93); }
.chip:disabled { opacity: 0.5; }

/* Emoji panel */
.emoji-panel {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 10px 12px;
  background: var(--panel-bg);
  border-top: 1px solid rgba(200,80,140,0.12);
  max-height: 140px; overflow-y: auto;
}
.emoji-btn {
  background: transparent; border: none; font-size: 24px;
  cursor: pointer; border-radius: 10px; padding: 4px 6px;
  transition: transform .12s, background .2s;
}
.emoji-btn:hover { background: rgba(255,120,170,0.15); transform: scale(1.2); }

/* Input bar */
.input-bar {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--panel-bg);
  border-top: 1px solid rgba(200,80,140,0.15);
}
.emoji-toggle {
  background: transparent; border: none; font-size: 26px;
  cursor: pointer; padding: 4px; line-height: 1;
  transition: transform .15s;
}
.emoji-toggle:active { transform: scale(0.85); }
.chat-input {
  flex: 1;
  resize: none;
  border: 1.5px solid rgba(200,80,140,0.3);
  border-radius: 22px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 11px 16px;
  max-height: 120px;
  outline: none;
  transition: border .2s, box-shadow .2s;
}
.chat-input:focus {
  border-color: var(--hers2);
  box-shadow: 0 0 0 3px rgba(255,79,139,0.15);
}
.send-btn {
  flex-shrink: 0;
  width: 46px; height: 46px; border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #ccc, #bbb);
  color: #fff; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transform: rotate(180deg);
  transition: transform .2s, background .3s, box-shadow .2s;
}
.send-btn.active {
  background: linear-gradient(135deg, var(--header1), var(--header2));
  box-shadow: 0 4px 14px rgba(200,40,110,0.4);
}
.send-btn.active:active { transform: rotate(180deg) scale(0.85); }
.send-btn:disabled { cursor: default; }

/* Footer credit */
.footer-credit {
  text-align: center; padding: 4px 0 6px;
  background: var(--panel-bg);
  font-size: 11px;
}
.footer-credit a { color: var(--chip-text); text-decoration: none; opacity: 0.7; }
.footer-credit a:hover { opacity: 1; text-decoration: underline; }

/* Floating hearts */
.hearts-layer {
  position: absolute; inset: 0; pointer-events: none; z-index: 20; overflow: hidden;
}
.floating-heart {
  position: absolute; bottom: 60px;
  animation-name: floatUp; animation-timing-function: ease-out; animation-fill-mode: forwards;
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(0.6) rotate(0deg); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(-70vh) scale(1.3) rotate(25deg); opacity: 0; }
}
</parameter>