 :root {
     --bg-color: #071016;
     --chat-bg: #09151d;
     --header-bg: rgba(20, 34, 43, .94);
     --bubble-user: #075e54;
     --bubble-assistant: #202c33;
     --text-color: #e9edef;
     --text-muted: #8b9ba4;
     --accent-color: #00a884;
     --accent-light: #53e8c1;
     --pending: #aebbc1;
     --sent: #b6c7cd;
     --read: #53d9ff;
 }

 * {
     box-sizing: border-box;
     outline: none;
     -webkit-tap-highlight-color: transparent;
     font-family: Vazirmatn, sans-serif;
 }

 html,
 body {
     width: 100%;
     height: 100%;
     margin: 0;
     overflow: hidden;
 }

 body {
     color: var(--text-color);
     background:
         radial-gradient(circle at 50% 0%, rgba(78, 255, 214, .18), transparent 23%),
         radial-gradient(circle at 15% 25%, rgba(0, 200, 255, .12), transparent 25%),
         radial-gradient(circle at 85% 20%, rgba(120, 90, 255, .13), transparent 28%),
         linear-gradient(180deg, #02070b 0%, #07151f 60%, #020508 100%);
 }

 body::before {
     content: "";
     position: fixed;
     inset: -20%;
     pointer-events: none;
     background:
         conic-gradient(from 180deg at 50% 50%,
             transparent,
             rgba(0, 255, 213, .08),
             rgba(126, 87, 255, .08),
             transparent);
     filter: blur(55px);
     animation: auraShift 14s ease-in-out infinite alternate;
 }

 @keyframes auraShift {
     from {
         transform: translate(-1%, -1%) scale(1);
     }

     to {
         transform: translate(1%, 1%) scale(1.08);
     }
 }

 main {
     position: relative;
     z-index: 1;
     width: min(65ch, 100%);
     height: 100dvh;
     margin-inline: auto;
     display: flex;
     flex-direction: column;
 }

 header {
     flex-shrink: 0;
     display: flex;
     align-items: center;
     justify-content: space-between;
     padding: 12px 16px;
     background: var(--header-bg);
     border-bottom: 1px solid rgba(255, 255, 255, .06);
     box-shadow: 0 4px 20px rgba(0, 0, 0, .2);
     backdrop-filter: blur(18px);
 }

 .bot-profile {
     display: flex;
     align-items: center;
     gap: 12px;
 }

 .bot-avatar {
     width: 42px;
     height: 42px;
     display: grid;
     place-items: center;
     color: #fff;
     background:
         radial-gradient(circle at 35% 25%, #fff, #9ffff0 9%, #00a884 42%, #075e54 100%);
     border: 1px solid rgba(255, 255, 255, .25);
     border-radius: 50%;
     box-shadow:
         0 0 0 5px rgba(0, 168, 132, .08),
         0 0 24px rgba(0, 255, 210, .25);
     animation: avatarFloat 4s ease-in-out infinite;
 }

 .bot-avatar svg {
     width: 25px;
     height: 25px;
     fill: currentColor;
     filter: drop-shadow(0 0 5px rgba(255, 255, 255, .7));
 }

 @keyframes avatarFloat {

     0%,
     100% {
         transform: translateY(0) rotate(0);
     }

     50% {
         transform: translateY(-2px) rotate(4deg);
     }
 }

 .bot-info {
     display: flex;
     flex-direction: column;
     gap: 2px;
 }

 .bot-name {
     font-size: 16px;
     font-weight: 700;
 }

 .bot-status {
     display: flex;
     align-items: center;
     gap: 5px;
     color: var(--accent-light);
     font-size: 11px;
 }

 .bot-status::before {
     content: "";
     width: 6px;
     height: 6px;
     border-radius: 50%;
     background: var(--accent-light);
     box-shadow: 0 0 9px var(--accent-light);
     animation: onlineBlink 2s infinite;
 }

 @keyframes onlineBlink {
     50% {
         opacity: .35;
     }
 }

 .clear-btn {
     border: 1px solid rgba(83, 232, 193, .28);
     border-radius: 10px;
     padding: 8px 16px;
     color: #c9fff3;
     background: linear-gradient(135deg, rgba(0, 168, 132, .35), rgba(0, 96, 84, .5));
     font-size: 13px;
     cursor: pointer;
     transition: .2s ease;
     box-shadow: 0 4px 16px rgba(0, 168, 132, .12);
 }

 .clear-btn:hover {
     transform: translateY(-1px);
     background: linear-gradient(135deg, rgba(0, 188, 148, .52), rgba(0, 96, 84, .62));
     box-shadow: 0 6px 20px rgba(0, 168, 132, .22);
 }

 .clear-btn:active {
     transform: scale(.96);
 }

 .clear-btn:disabled {
     opacity: .5;
     cursor: wait;
 }

 .chat-container {
     flex: 1;
     min-height: 0;
     overflow-y: auto;
     padding: 18px 16px;
     display: flex;
     flex-direction: column;
     gap: 12px;
     scroll-behavior: smooth;
 }

 .chat-container::-webkit-scrollbar {
     width: 5px;
 }

 .chat-container::-webkit-scrollbar-thumb {
     border-radius: 8px;
     background: rgba(255, 255, 255, .12);
 }

 .message {
     position: relative;
     max-width: 85%;
     padding: 9px 12px 7px;
     border-radius: 13px;
     line-height: 1.6;
     font-size: 15px;
     word-wrap: break-word;
     display: flex;
     flex-direction: column;
     gap: 6px;
     opacity: 0;
     transform: translateY(10px) scale(.97);
     animation: messageIn .3s cubic-bezier(.2, .8, .2, 1) forwards;
     box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
 }

 @keyframes messageIn {
     to {
         opacity: 1;
         transform: translateY(0) scale(1);
     }
 }

 .message.user {
     align-self: flex-start;
     background: linear-gradient(135deg, #086b5e, var(--bubble-user));
     border-top-left-radius: 3px;
 }

 .message.assistant {
     align-self: flex-end;
     background: linear-gradient(135deg, #26343b, var(--bubble-assistant));
     border-top-right-radius: 3px;
 }

 .message.sending {
     animation:
         messageIn .3s forwards,
         sendingGlow 1.1s ease-in-out infinite;
 }

 @keyframes sendingGlow {
     50% {
         box-shadow: 0 0 0 3px rgba(83, 232, 193, .08), 0 5px 20px rgba(0, 168, 132, .2);
     }
 }

 .message-footer {
     direction: ltr;
     display: flex;
     align-items: center;
     justify-content: flex-start;
     gap: 5px;
     min-height: 15px;
     color: rgba(233, 237, 239, .62);
     font-size: 10px;
     user-select: none;
 }

 .message.user .message-footer {
     justify-content: flex-end;
 }

 .message-time {
     letter-spacing: .2px;
 }

 .message-status {
     display: inline-flex;
     width: 16px;
     height: 15px;
     align-items: center;
     justify-content: center;
 }

 .message-status svg {
     width: 15px;
     height: 15px;
     fill: none;
     stroke: currentColor;
     stroke-width: 2.2;
     stroke-linecap: round;
     stroke-linejoin: round;
 }

 .status-pending {
     color: var(--pending);
     animation: rotatePending 1s linear infinite;
 }

 .status-sent {
     color: var(--sent);
 }

 .status-read {
     color: var(--read);
     filter: drop-shadow(0 0 3px rgba(83, 217, 255, .5));
     animation: readPop .25s ease-out;
 }

 @keyframes rotatePending {
     to {
         transform: rotate(360deg);
     }
 }

 @keyframes readPop {
     from {
         transform: scale(.6);
         opacity: .3;
     }

     to {
         transform: scale(1);
         opacity: 1;
     }
 }

 .audio-player-custom {
     direction: ltr;
     display: flex;
     align-items: center;
     gap: 10px;
     min-width: 220px;
     margin-top: 4px;
     padding: 8px 10px;
     border-radius: 12px;
     background: rgba(0, 0, 0, .17);
     border: 1px solid rgba(255, 255, 255, .06);
 }

 .play-btn {
     flex-shrink: 0;
     width: 32px;
     height: 32px;
     display: grid;
     place-items: center;
     border: 0;
     border-radius: 50%;
     color: #fff;
     background: var(--accent-color);
     cursor: pointer;
     transition: .2s;
 }

 .play-btn:hover {
     transform: scale(1.08);
     box-shadow: 0 0 14px rgba(0, 168, 132, .45);
 }

 .play-btn svg {
     width: 14px;
     height: 14px;
     fill: currentColor;
 }

 .audio-seek-wrap {
     flex: 1;
     display: flex;
     align-items: center;
     gap: 8px;
     min-width: 0;
 }

 .audio-seek {
     width: 100%;
     height: 18px;
     margin: 0;
     background: transparent;
     -webkit-appearance: none;
     appearance: none;
     cursor: pointer;
 }

 .audio-seek:focus {
     outline: none;
 }

 .audio-seek::-webkit-slider-runnable-track {
     height: 4px;
     border-radius: 999px;
     background: linear-gradient(90deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .09));
     box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
 }

 .audio-seek::-moz-range-track {
     height: 4px;
     border-radius: 999px;
     background: linear-gradient(90deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .09));
     box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
 }

 .audio-seek::-webkit-slider-thumb {
     -webkit-appearance: none;
     appearance: none;
     width: 14px;
     height: 14px;
     margin-top: -5px;
     border-radius: 50%;
     background: var(--accent-light);
     border: 2px solid rgba(255, 255, 255, .9);
     box-shadow: 0 0 0 3px rgba(0, 168, 132, .18);
     transition: transform .15s ease;
 }

 .audio-seek::-moz-range-thumb {
     width: 14px;
     height: 14px;
     border: 2px solid rgba(255, 255, 255, .9);
     border-radius: 50%;
     background: var(--accent-light);
     box-shadow: 0 0 0 3px rgba(0, 168, 132, .18);
 }

 .audio-seek:hover::-webkit-slider-thumb {
     transform: scale(1.08);
 }

 .audio-time {
     flex-shrink: 0;
     font-size: 10px;
     color: rgba(233, 237, 239, .6);
     min-width: 32px;
     text-align: center;
 }

 .typing-message {
     padding: 10px 14px;
 }

 .typing-indicator {
     display: flex;
     align-items: center;
     gap: 5px;
     height: 18px;
 }

 .typing-indicator span {
     width: 7px;
     height: 7px;
     border-radius: 50%;
     background: var(--accent-light);
     box-shadow: 0 0 8px rgba(83, 232, 193, .55);
     animation: typingBounce 1.25s infinite ease-in-out;
 }

 .typing-indicator span:nth-child(2) {
     animation-delay: .16s;
 }

 .typing-indicator span:nth-child(3) {
     animation-delay: .32s;
 }

 @keyframes typingBounce {

     0%,
     60%,
     100% {
         transform: translateY(0);
         opacity: .45;
     }

     30% {
         transform: translateY(-7px);
         opacity: 1;
     }
 }

 .input-bar {
     flex-shrink: 0;
     display: flex;
     justify-content: center;
     padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
     background: var(--header-bg);
     border-top: 1px solid rgba(255, 255, 255, .06);
     backdrop-filter: blur(18px);
 }

 .input-bar-inner {
     display: flex;
     flex-direction: column;
     align-items: center;
     gap: 5px;
 }

 .record-btn {
     position: relative;
     width: 72px;
     height: 72px;
     display: grid;
     place-items: center;
     border: 0;
     border-radius: 50%;
     color: #fff;
     background: var(--accent-color);
     cursor: pointer;
     transition: transform .15s, background .2s;
     box-shadow: 0 0 0 0 rgba(0, 168, 132, .5);
 }

 .record-btn::before,
 .record-btn::after {
     content: "";
     position: absolute;
     inset: -7px;
     border: 1px solid rgba(83, 232, 193, .25);
     border-radius: 50%;
     opacity: 0;
 }

 .record-btn.recording {
     background: #e53935;
     animation: pulse 1.2s ease-in-out infinite;
 }

 .record-btn.recording::before {
     opacity: 1;
     animation: voiceRing 1.4s infinite;
 }

 .record-btn.recording::after {
     opacity: 1;
     animation: voiceRing 1.4s .45s infinite;
 }

 .record-btn.ai-speaking {
     background: #625cff;
     animation: aiSpeaking .65s ease-in-out infinite alternate;
 }

 @keyframes voiceRing {
     from {
         transform: scale(.8);
         opacity: .8;
     }

     to {
         transform: scale(1.45);
         opacity: 0;
     }
 }

 @keyframes aiSpeaking {
     from {
         transform: scale(.96);
         box-shadow: 0 0 12px rgba(98, 92, 255, .3);
     }

     to {
         transform: scale(1.05);
         box-shadow: 0 0 34px rgba(98, 92, 255, .7);
     }
 }

 @keyframes pulse {
     0% {
         box-shadow: 0 0 0 0 rgba(229, 57, 53, .55);
     }

     70% {
         box-shadow: 0 0 0 18px rgba(229, 57, 53, 0);
     }

     100% {
         box-shadow: 0 0 0 0 rgba(229, 57, 53, 0);
     }
 }

 .record-btn:active {
     transform: scale(.93);
 }

 .record-btn:disabled {
     opacity: .65;
     cursor: wait;
 }

 .record-btn svg {
     width: 30px;
     height: 30px;
     fill: currentColor;
 }

 .record-status {
     min-height: 20px;
     color: var(--text-muted);
     font-size: 12px;
     text-align: center;
 }

 .stage-status {
     display: inline-flex;
     align-items: center;
     gap: 5px;
 }

 .stage-status::before {
     content: "";
     width: 6px;
     height: 6px;
     border-radius: 50%;
     background: var(--accent-color);
     box-shadow: 0 0 8px var(--accent-color);
 }

 @media (prefers-reduced-motion: reduce) {

     *,
     *::before,
     *::after {
         animation-duration: .001ms !important;
         animation-iteration-count: 1 !important;
         scroll-behavior: auto !important;
     }
 }