    /* =========================
       Base / Theme
       ========================= */
    :root {
      --primary-color: #ff6db5;
      --secondary-color: #8d5bff;
      --bg-dark: #070a12;
      --surface: rgba(13, 16, 28, 0.78);
      --surface-strong: rgba(18, 21, 35, 0.9);
      --line: rgba(255, 255, 255, 0.14);
      --line-hot: rgba(255, 112, 188, 0.52);
      --text-main: #fff5fb;
      --text-soft: rgba(255, 245, 252, 0.68);
      --text-muted: rgba(255, 245, 252, 0.42);
      --pink: #e8549e;
      --pink-2: #f080b8;
      --violet: #9450e8;
      --cyan: #68d4ec;
      --gold: #f7bc56;
      --glass: blur(18px) saturate(1.25);
      --phone-max: 480px;
      --danger: #ff7373;
      --success: #6ae08c;
      --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.22);
      --safe-top: max(14px, env(safe-area-inset-top));
      --safe-bottom: max(14px, env(safe-area-inset-bottom));
      --font-title: clamp(2.8rem, 10vw, 5.8rem);
      --font-subtitle: clamp(1rem, 4vw, 1.25rem);
      --font-body: clamp(0.85rem, 3.2vw, 0.95rem);
      --font-btn: clamp(0.9rem, 3.8vw, 1.05rem);
      --welcome-copy-bottom: clamp(68px, 14vh, 92px);
      --welcome-footer-bottom: clamp(14px, 3.5vh, 26px);
      --chat-header-px: clamp(10px, 4vw, 18px);
      --chat-header-py: clamp(10px, 3vw, 16px);
      --chat-pane-width: clamp(92px, 31vw, 178px);
      --chat-gutter: clamp(8px, 3vw, 14px);
      --icon-btn-size: clamp(30px, 8.8vw, 36px);
      --header-avatar-size: clamp(34px, 10.4vw, 42px);
      --message-avatar-size: clamp(24px, 7vw, 30px);
      --message-bubble-max: min(70vw, 20rem);
      --tool-column: clamp(32px, 9vw, 42px);
      --tool-icon-size: clamp(22px, 6vw, 28px);
      --tool-label-size: clamp(0.55rem, 1.8vw, 0.62rem);
      --input-pill-h: clamp(30px, 7vw, 36px);
      --send-btn-h: clamp(28px, 6vw, 34px);
      --send-btn-px: clamp(12px, 3vw, 16px);
      --send-btn-minw: clamp(48px, 14vw, 64px);
      --gift-grid-min: clamp(110px, 22vw, 160px);
      --gift-row-peek: clamp(20px, 4vw, 28px);
      --quick-strip-gap: clamp(22px, 5vw, 30px);
      --quick-strip-stack-h: clamp(56px, 14vw, 72px);
      --chat-input-total-h: clamp(52px, 12vw, 64px);
    }

    * {
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
    }

    html,
    body {
      width: 100%;
      height: 100%;
      margin: 0;
      overflow: hidden;
      background: var(--bg-dark);
      color: var(--text-main);
      font-family: "Trebuchet MS", "Segoe UI", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", sans-serif;
    }

    body {
      overscroll-behavior: none;
      touch-action: manipulation;
      user-select: none;
      -webkit-touch-callout: none;
    }

    button,
    input {
      font: inherit;
    }

    button {
      border: 0;
      cursor: pointer;
    }

    img,
    video,
    canvas,
    svg {
      max-width: 100%;
      height: auto !important;
      object-fit: contain;
    }

    .hidden {
      display: none !important;
    }

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

    /* =========================
       Shared App Shell
       ========================= */
    #app {
      position: relative;
      width: 100vw;
      height: 100dvh;
      min-height: 100svh;
      overflow: hidden;
    }

    .screen {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      transition: opacity 0.65s ease, transform 0.65s ease, visibility 0.65s ease;
    }

    .screen.is-hidden {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transform: scale(1.02);
    }

    .screen.is-hidden .particle {
      animation-play-state: paused;
    }

    .glass-panel {
      background: rgba(255, 255, 255, 0.16);
      backdrop-filter: blur(18px);
      border: 1px solid rgba(255, 255, 255, 0.18);
      box-shadow: var(--shadow-soft);
    }

    .soft-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-height: 34px;
      padding: 0 12px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.16);
      color: #fff;
      font-size: 0.82rem;
      line-height: 1;
      border: 1px solid rgba(255, 255, 255, 0.18);
      backdrop-filter: blur(12px);
    }

    .primary-btn {
      position: relative;
      overflow: hidden;
      min-height: 56px;
      border-radius: 999px;
      padding: 0 26px;
      width: min(100%, 420px);
      font-size: var(--font-btn);
      font-weight: 700;
      color: #fff;
      background: linear-gradient(120deg, var(--primary-color), var(--secondary-color));
      box-shadow: 0 16px 35px rgba(155, 98, 255, 0.38);
      transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
    }

    #enterChatBtn {
      animation: gentle-shake 3s ease-in-out infinite;
      transform-origin: center;
    }

    @keyframes gentle-shake {
      0%, 80%, 100% {
        transform: rotate(0deg) scale(1);
      }
      82% {
        transform: rotate(2deg) scale(1.02);
      }
      86% {
        transform: rotate(-2deg) scale(1.02);
      }
      90% {
        transform: rotate(2deg) scale(1.02);
      }
      94% {
        transform: rotate(-2deg) scale(1.02);
      }
      98% {
        transform: rotate(0deg) scale(1.02);
      }
    }

    .primary-btn:hover,
    .primary-btn:active {
      transform: translateY(-1px) scale(1.01);
      box-shadow: 0 18px 42px rgba(155, 98, 255, 0.48);
      filter: saturate(1.08);
      animation: none !important;
    }

    .primary-btn::after {
      content: "";
      position: absolute;
      inset: 0;
      background: radial-gradient(circle at center, rgba(255, 255, 255, 0.38), transparent 50%);
      opacity: 0;
      transform: scale(0.2);
      transition: transform 0.45s ease, opacity 0.45s ease;
    }

    .primary-btn.is-ripple::after {
      opacity: 1;
      transform: scale(2.4);
    }

    .secondary-btn {
      min-height: 48px;
      border-radius: 16px;
      padding: 0 16px;
      color: #fff;
      background: rgba(255, 255, 255, 0.15);
      border: 1px solid rgba(255, 255, 255, 0.2);
      backdrop-filter: blur(12px);
    }

    .toast {
      position: absolute;
      left: 50%;
      bottom: calc(90px + var(--safe-bottom));
      transform: translate(-50%, 12px);
      opacity: 0;
      visibility: hidden;
      padding: 12px 18px;
      border-radius: 16px;
      color: #fff;
      background: rgba(25, 20, 39, 0.85);
      border: 1px solid rgba(255, 255, 255, 0.14);
      backdrop-filter: blur(16px);
      transition: opacity 0.24s ease, transform 0.24s ease, visibility 0.24s ease;
      z-index: 40;
      font-size: 0.92rem;
      white-space: normal;
      word-break: break-word;
      text-align: center;
      width: max-content;
      max-width: 90vw;
      line-height: 1.4;
    }

    .toast.is-visible {
      opacity: 1;
      visibility: visible;
      transform: translate(-50%, 0);
    }

    /* =========================
       Welcome Screen
       ========================= */
    #welcomeScreen {
      background: var(--bg-dark);
    }

    .welcome-overlay {
      position: absolute;
      inset: 0;
      background:
        linear-gradient(180deg, rgba(13, 9, 20, 0.12) 0%, rgba(13, 9, 20, 0.5) 100%);
      pointer-events: none;
    }

    .welcome-particles {
      position: absolute;
      inset: 0;
      overflow: hidden;
      pointer-events: none;
    }

    .particle {
      position: absolute;
      bottom: -80px;
      color: rgba(255, 255, 255, 0.26);
      font-size: clamp(14px, 3.6vw, 24px);
      animation: float-heart linear infinite;
      filter: blur(0.2px);
    }

    @keyframes float-heart {
      0% {
        transform: translate3d(0, 0, 0) scale(0.9);
        opacity: 0;
      }
      15% {
        opacity: 1;
      }
      100% {
        transform: translate3d(var(--drift, 0px), -115vh, 0) scale(1.25);
        opacity: 0;
      }
    }

    .welcome-shell {
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      align-items: center;
      width: 100%;
      height: 100%;
      padding: 0;
    }

    .welcome-topbar,
    .welcome-footer {
      width: min(1080px, 100%);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      z-index: 2;
    }

    .welcome-main {
      position: relative;
      width: 100%;
      flex: 1;
      display: grid;
      place-items: center;
      padding: 0;
    }

    .welcome-hero {
      position: relative;
      width: 100%;
      height: 100%;
      display: grid;
      place-items: center;
    }

    .welcome-hero::before {
      display: none;
    }

    .welcome-art-shell {
      position: relative;
      width: 100%;
      height: 100%;
      display: grid;
      place-items: center;
      animation: none;
      z-index: 1;
    }

    @keyframes hero-float {
      0%,
      100% {
        transform: translateY(0) scale(1);
      }
      50% {
        transform: translateY(-10px) scale(1.01);
      }
    }

    .welcome-glow {
      position: absolute;
      inset: 0;
      border-radius: 0;
      background:
        linear-gradient(180deg, rgba(8, 6, 15, 0.05) 0%, rgba(8, 6, 15, 0.12) 40%, rgba(8, 6, 15, 0.3) 100%);
      filter: none;
      z-index: 1;
    }

    .character-visual {
      position: relative;
      width: min(100%, 420px);
      height: min(100%, 640px);
      border-radius: 36px;
      display: grid;
      place-items: center;
      overflow: hidden;
      z-index: 1;
    }

    .character-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: none;
      filter: drop-shadow(0 22px 46px rgba(11, 4, 22, 0.45));
      will-change: transform;
      transform: translateZ(0);
    }

    .character-img.is-ready {
      display: block;
    }

    .character-img.video-loop-buffer {
      position: absolute;
      inset: 0;
      display: block;
      width: 100%;
      height: 100% !important;
      object-fit: cover;
      object-position: center top;
      pointer-events: none;
      z-index: 2;
    }

    .character-fallback {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      align-items: center;
      padding: 26px;
      border-radius: 36px;
      background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
        radial-gradient(circle at 50% 25%, rgba(255, 186, 228, 0.4), transparent 30%),
        linear-gradient(180deg, rgba(255, 109, 181, 0.38), rgba(141, 91, 255, 0.24));
      border: 1px solid rgba(255, 255, 255, 0.16);
      backdrop-filter: blur(10px);
      box-shadow: 0 22px 55px rgba(18, 7, 36, 0.28);
      color: #fff;
      text-align: center;
    }

    .character-fallback::before {
      content: "";
      position: absolute;
      top: 10%;
      left: 50%;
      transform: translateX(-50%);
      width: 56%;
      height: 62%;
      border-radius: 40% 40% 26% 26%;
      background:
        radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.42), transparent 20%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.12));
      opacity: 0.85;
      filter: blur(0.2px);
    }

    .character-fallback::after {
      content: "";
      position: absolute;
      bottom: 16%;
      left: 50%;
      transform: translateX(-50%);
      width: 72%;
      height: 30%;
      border-radius: 40px 40px 24px 24px;
      background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.18));
      opacity: 0.8;
    }

    .character-fallback strong,
    .character-fallback span {
      position: relative;
      z-index: 1;
    }

    .character-fallback strong {
      font-size: 1.15rem;
      margin-bottom: 6px;
    }

    .welcome-copy {
      position: absolute;
      bottom: calc(var(--welcome-copy-bottom) + var(--safe-bottom) + 34px);
      left: 50%;
      transform: translateX(-50%);
      width: min(100%, 720px);
      text-align: center;
      z-index: 3;
      padding: 0 18px;
    }

    .welcome-title {
      margin: 0;
      font-size: var(--font-title);
      line-height: 0.95;
      letter-spacing: 0.04em;
      font-weight: 900;
      color: #fff;
    }

    .welcome-subtitle {
      margin: 12px auto 0;
      max-width: 28ch;
      font-size: var(--font-subtitle);
      line-height: 1.5;
      color: rgba(255, 248, 252, 0.92);
      text-shadow: 0 6px 18px rgba(26, 12, 48, 0.3);
    }

    .welcome-footer {
      position: absolute;
      left: 18px;
      right: 18px;
      bottom: calc(var(--welcome-footer-bottom) + var(--safe-bottom));
      width: auto;
      flex-direction: column;
      justify-content: center;
      gap: 0;
      z-index: 4;
    }

    .welcome-actions {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      flex-wrap: wrap;
    }

    #welcomeVisual.character-visual {
      width: 100%;
      height: 100%;
      border-radius: 0;
      background: #120d1d;
    }

    #welcomeVisual .character-img {
      width: 100%;
      height: 100% !important;
      object-fit: cover;
      object-position: center top;
      filter: none;
    }

    #welcomeFallback {
      border-radius: 0;
      box-shadow: none;
    }

    /* =========================
       Chat Screen
       ========================= */
    #chatScreen {
      background: var(--bg-dark);
    }

    .chat-shell {
      position: relative;
      width: 100%;
      height: 100%;
      padding: 0;
      overflow: hidden;
    }

    .chat-header {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      display: block;
      padding:
        calc(var(--safe-top) + var(--chat-header-py))
        var(--chat-header-px)
        clamp(8px, 2vw, 12px);
      color: #fff;
      z-index: 14;
      pointer-events: none;
    }

    .chat-header-top {
      width: 100%;
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      align-items: center;
      gap: clamp(8px, 2.6vw, 12px);
      min-width: 0;
    }

    .header-left,
    .header-right {
      display: flex;
      align-items: center;
      gap: clamp(6px, 2.6vw, 12px);
      min-width: 0;
      pointer-events: auto;
    }

    .header-right {
      display: flex;
      align-items: flex-end;
      justify-content: flex-end;
      min-width: 0;
      pointer-events: auto;
      align-self: flex-end;
      margin-bottom: 2px;
    }

    .header-coin-pill {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      height: 28px;
      padding: 0 4px 0 10px;
      border-radius: 999px;
      cursor: pointer;
      transition: transform 0.2s ease, background 0.2s ease;
      position: relative;
    }

    .coin-float-text {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      color: #ff4757;
      font-weight: 900;
      font-size: 1rem;
      pointer-events: none;
      opacity: 0;
      z-index: 10;
      text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    }

    @keyframes coin-float-up {
      0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
      }
      100% {
        opacity: 0;
        transform: translate(-50%, -150%) scale(1.2);
      }
    }

    .coin-float-text.animate {
      animation: coin-float-up 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    }

    .header-coin-pill:active {
      transform: scale(0.96);
      background: rgba(0, 0, 0, 0.6);
    }

    .header-coin-pill .coin-icon {
      font-size: 0.7rem;
      color: #ff9cd0;
    }

    .header-coin-pill strong {
      font-size: 0.85rem;
      font-weight: 700;
      color: #fff;
    }

    .header-coin-pill .coin-add {
      display: grid;
      place-items: center;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background: linear-gradient(120deg, #ff9cd0, #f080c4);
      color: #fff;
      font-size: 1rem;
      font-weight: 900;
      line-height: 1;
      margin-left: 2px;
    }

    .icon-btn {
      width: var(--icon-btn-size);
      height: var(--icon-btn-size);
      border-radius: 999px;
      display: grid;
      place-items: center;
      color: #fff;
      font-size: 1.1rem;
    }

    .header-collection-btn {
      position: relative;
      background: rgba(255, 255, 255, 0.1);
      box-shadow: 0 10px 22px rgba(89, 69, 123, 0.08);
    }

    .chat-background {
      position: relative;
      width: 100%;
      height: 100%;
      overflow: hidden;
      z-index: 0;
    }

    .header-portrait-stage {
      position: absolute;
      inset: 0;
      overflow: hidden;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      z-index: 1;
      pointer-events: none;
    }

    .header-portrait-stage .character-img {
      width: 100%;
      max-width: 100%;
      height: 100% !important;
      object-fit: cover;
      object-position: center top;
    }

    .header-meta-panel {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: clamp(8px, 2vw, 10px);
      padding: 0;
      max-width: min(58vw, 280px);
      pointer-events: auto;
    }

    .header-summary {
      display: flex;
      flex-wrap: nowrap;
      align-items: center;
      gap: 8px;
    }

    .header-summary strong {
      font-size: clamp(1rem, 3.8vw, 1.2rem);
      color: #fff;
    }

    .header-summary .level-pill {
      min-height: 24px;
      padding: 0 10px;
      font-size: 0.72rem;
    }

    .header-affinity {
      display: block;
      padding: 0;
      border-radius: 0;
      background: none;
      border: 0;
      backdrop-filter: none;
    }

    .header-affinity .affinity-row {
      display: none;
    }

    .header-affinity .affinity-bar {
      height: 6px;
      background: rgba(255, 255, 255, 0.22);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    }

    .chat-body {
      position: absolute;
      inset: 0;
      display: block;
      overflow: hidden;
    }

    @keyframes portrait-breathe {
      0%,
      100% {
        transform: translateY(0) scale(1);
      }
      50% {
        transform: translateY(-4px) scale(1.012);
      }
    }

    .portrait-fallback,
    .chat-background .portrait-fallback {
      border-radius: 0;
      background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08)),
        linear-gradient(180deg, rgba(218, 197, 244, 0.98), rgba(206, 187, 236, 0.98));
    }

    #portraitVisual.character-visual {
      width: 100%;
      height: 100%;
      min-width: 0;
      min-height: 0;
      border-radius: 0;
      overflow: hidden;
      display: flex;
      align-items: flex-end;
      justify-content: center;
    }

    #portraitVisibleImg.character-img {
      width: 100%;
      height: 100% !important;
      max-width: 100%;
      min-width: 100%;
      min-height: 100%;
      border-radius: 0;
      object-fit: cover;
      object-position: center top;
      filter: none;
      display: block;
      transform: translateX(0);
    }

    .portrait-fallback::before,
    .portrait-fallback::after {
      opacity: 0.35;
    }

    .level-pill {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 20px;
      padding: 0 8px;
      border-radius: 999px;
      font-size: 0.68rem;
      font-weight: 700;
      color: #fff;
    }

    .affinity-panel {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .affinity-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      font-size: 0.74rem;
      color: #8671aa;
    }

    .affinity-bar {
      width: 100%;
      height: 8px;
      border-radius: 999px;
      background: rgba(188, 164, 227, 0.24);
      overflow: hidden;
    }

    .affinity-fill {
      width: 0;
      height: 100%;
      border-radius: inherit;
      background: linear-gradient(120deg, #fd88c4, #b57bff);
      transition: width 0.3s ease;
    }

    .portrait-card-note {
      margin-top: 8px;
      font-size: 0.72rem;
      line-height: 1.45;
      color: #8e7fa5;
    }

    .portrait-card-cta {
      width: 100%;
      min-height: 34px;
      margin-top: 10px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.74);
      color: #6c5d89;
      border: 1px solid rgba(185, 165, 223, 0.42);
      font-size: 0.78rem;
      font-weight: 700;
    }

    .chat-header,
    .conversation-panel,
    .quick-strip-wrap,
    .chat-input-area {
      transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .ui-transparent-mode .chat-header,
    .ui-transparent-mode .conversation-panel,
    .ui-transparent-mode .quick-strip-wrap,
    .ui-transparent-mode .chat-input-area {
      opacity: 0.1 !important;
      pointer-events: none !important;
    }

    .conversation-panel {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      height: clamp(400px, 65dvh, 650px);
      z-index: 8;
      overflow: hidden;
      min-width: 0;
      display: grid;
      grid-template-rows: auto 1fr auto auto;
      gap: clamp(6px, 2vw, 10px);
      padding:
        clamp(14px, 3.2vw, 20px)
        0
        calc(var(--chat-input-total-h) + var(--safe-bottom) + var(--quick-strip-stack-h));
      background: transparent;
      border-radius: 0;
      border: 0;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
      box-shadow: none;
      min-height: 0;
    }

    .conversation-panel::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: 0;
      pointer-events: none;
    }

    .day-divider {
      position: relative;
      z-index: 1;
      justify-self: center;
      min-height: 24px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0 12px;
      border-radius: 999px;
      font-size: 0.74rem;
    }

    .message-list {
      position: relative;
      z-index: 1;
      min-height: 0;
      overflow-x: hidden;
      overflow-y: auto;
      padding: 10px clamp(10px, 3vw, 16px) 0 clamp(10px, 3vw, 14px);
      display: flex;
      flex-direction: column;
      gap: clamp(8px, 2.6vw, 14px);
      scroll-behavior: smooth;
      scrollbar-width: none;
      -ms-overflow-style: none;
      background: transparent;
    }

    .message-list::-webkit-scrollbar {
      display: none;
      width: 0;
      height: 0;
    }

    .message-row {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 6px;
    }

    .message-row.user {
      align-items: flex-end;
    }

    .message-row.user.is-sending .message-bubble {
      opacity: 0.78;
    }

    .message-row.user.is-failed .message-bubble {
      border-color: rgba(255, 115, 115, 0.55);
    }

    .message-header-wrap {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .message-row.user .message-header-wrap {
      flex-direction: row-reverse;
    }

    .message-content-wrap {
      display: grid;
      grid-auto-flow: column;
      gap: 4px;
      align-items: end;
    }

    .message-row.user .message-content-wrap {
      justify-content: end;
    }

    .avatar-dot {
      width: var(--message-avatar-size);
      height: var(--message-avatar-size);
      flex: 0 0 var(--message-avatar-size);
      border-radius: 999px;
      display: grid;
      place-items: center;
      font-size: 0.75rem;
      color: #fff;
    }

    .avatar-dot.ai-avatar {
      background-image: url("/cdn/ai-adultlife/avatars/avatar_1.png");
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      color: transparent;
      overflow: hidden;
    }

    .message-row.user .avatar-dot {
      background: linear-gradient(120deg, #ff9cd0, #f080c4);
    }

    .message-meta {
      font-size: 0.68rem;
      color: #b0a4b2;
    }

    .message-bubble {
      max-width: var(--message-bubble-max);
      flex-shrink: 0;
      padding: clamp(8px, 2vw, 12px) clamp(10px, 3vw, 14px);
      border-radius: clamp(12px, 3vw, 16px);
      font-size: var(--font-body);
      line-height: 1.5;
      overflow-wrap: break-word;
      word-break: normal;
      white-space: pre-wrap;
      position: relative;
      width: max-content;
    }

    .message-row.ai .message-bubble {
      border-bottom-left-radius: 8px;
    }

    .message-row.user .message-bubble {
      border-bottom-right-radius: 8px;
    }

    .message-delivery {
      display: inline-flex;
      align-items: center;
      justify-content: flex-end;
      min-height: 12px;
      min-width: 12px;
      width: 12px;
      flex: 0 0 12px;
      color: #b0a4b2;
      transform: translateY(1px);
    }

    .message-delivery[hidden] {
      display: none !important;
    }

    .message-delivery.is-idle {
      display: none !important;
      visibility: hidden;
      pointer-events: none;
    }

    .message-status-text {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 12px;
      height: 12px;
      line-height: 1;
      position: relative;
    }

    .message-delivery.is-sending .message-status-text::before {
      content: "";
      width: 9px;
      height: 9px;
      border-radius: 50%;
      border: 1px solid rgba(176, 164, 178, 0.76);
      box-sizing: border-box;
    }

    .message-delivery.is-sending .message-status-text::after {
      content: "";
      position: absolute;
      width: 1px;
      height: 3px;
      top: 3px;
      left: 5px;
      background: rgba(176, 164, 178, 0.78);
      border-radius: 999px;
      transform-origin: bottom center;
      transform: rotate(22deg);
    }

    .message-status-retry {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: #ff8fa1;
      border: 1px solid rgba(255, 255, 255, 0.48);
      box-shadow: 0 1px 4px rgba(255, 111, 134, 0.12);
      padding: 0;
      color: #fff;
      font-size: 0.5rem;
      font-weight: 900;
      line-height: 1;
    }

    .message-status-retry:disabled {
      opacity: 0.6;
      cursor: default;
    }

    .system-card {
      padding: 14px 16px;
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.54);
      border: 1px dashed rgba(210, 184, 214, 0.6);
      color: #8f7a91;
      font-size: 0.82rem;
      line-height: 1.5;
      text-align: center;
    }

    .system-card.system-card-error {
      background: rgba(255, 71, 87, 0.15);
      border: 1px dashed rgba(255, 71, 87, 0.4);
      color: #ff4757;
    }

    .typing-indicator-row {
      opacity: 0.85;
      transition: opacity 0.2s ease;
    }

    .typing-bubble {
      display: flex !important;
      align-items: center;
      gap: 4px;
      min-width: 44px;
      min-height: 28px;
      padding: 10px 14px;
    }

    .typing-dot {
      width: 6px;
      height: 6px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.65);
      animation: typingBounce 1.2s infinite ease-in-out;
    }

    .typing-dot:nth-child(2) {
      animation-delay: 0.15s;
    }

    .typing-dot:nth-child(3) {
      animation-delay: 0.3s;
    }

    @keyframes typingBounce {
      0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
      }
      30% {
        transform: translateY(-5px);
        opacity: 1;
      }
    }

    .message-bubble.is-typing {
      border-right: 2px solid rgba(255, 255, 255, 0.4);
      animation: typingCursor 0.85s step-end infinite;
    }

    @keyframes typingCursor {
      0%, 100% { border-right-color: rgba(255, 255, 255, 0.4); }
      50% { border-right-color: transparent; }
    }

    .quick-strip-wrap {
      position: absolute;
      left: 0;
      right: 0;
      bottom: calc(var(--chat-input-total-h) + var(--safe-bottom) + var(--quick-strip-gap));
      z-index: 10;
      display: flex;
      align-items: center;
      overflow: hidden;
      padding: 0;
      opacity: 0.65;
      transition: opacity 0.2s ease;
    }

    .quick-strip-wrap:hover,
    .quick-strip-wrap:active {
      opacity: 0.9;
    }

    .quick-strip {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      padding: 0 clamp(10px, 3vw, 18px) 4px clamp(10px, 3vw, 18px);
      scrollbar-width: none;
      flex: 1;
      min-width: 0;
    }

    .quick-strip::-webkit-scrollbar {
      display: none;
    }

    .quick-btn {
      flex: 0 0 auto;
      min-height: clamp(34px, 9vw, 38px);
      padding: 0 clamp(10px, 3vw, 14px);
      border-radius: 14px;
      font-size: 0.84rem;
    }

    .quota-actions {
      position: relative;
      z-index: 1;
      display: none;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 0 14px;
    }

    .quota-note {
      font-size: 0.78rem;
      color: #a493a5;
    }

    .link-btn {
      background: none;
      padding: 0;
      color: #9d78d0;
      font-size: 0.82rem;
      font-weight: 700;
    }

    .chat-input-area {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 12;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto auto;
      gap: clamp(8px, 2.4vw, 12px);
      align-items: center;
      padding: clamp(12px, 3.2vw, 16px) clamp(10px, 3vw, 16px) calc(clamp(4px, 1.2vw, 6px) + var(--safe-bottom));
      min-height: calc(var(--chat-input-total-h) + var(--safe-bottom));
    }

    .tool-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: clamp(2px, 1vw, 4px);
      min-width: 0;
      color: #9f93a6;
      background: transparent;
      box-shadow: none;
    }

    .tool-btn .tool-icon {
      width: var(--tool-icon-size);
      height: var(--tool-icon-size);
      border-radius: 999px;
      display: grid;
      place-items: center;
      color: #fff;
      font-size: 1.2rem;
      box-shadow: 0 10px 22px rgba(89, 69, 123, 0.08);
    }

    .tool-btn .tool-label {
      font-size: var(--tool-label-size);
      line-height: 1;
      white-space: nowrap;
    }

    .quick-btn-trigger .tool-icon {
      background: linear-gradient(120deg, #ae8eff, #8b73f8);
    }

    .gift-btn .tool-icon {
      background: transparent;
      box-shadow: none;
      font-size: clamp(1.8rem, 7vw, 2.2rem);
      width: auto;
      height: auto;
      margin-bottom: clamp(2px, 1vw, 4px);
    }

    .emoji-btn .tool-icon {
      background: linear-gradient(120deg, #c9b5ea, #ad95da);
    }

    .send-btn {
      min-width: var(--send-btn-minw);
      height: var(--send-btn-h);
      padding: 0 var(--send-btn-px);
      border-radius: 999px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-weight: 700;
    }

    .input-pill {
      min-width: 0;
      min-height: var(--input-pill-h);
      display: flex;
      align-items: center;
      padding: 0 16px;
      border-radius: 999px;
    }

    .text-input {
      width: 100%;
      min-height: 44px;
      padding: 0;
      border-radius: 0;
      border: 0;
      background: transparent;
      outline: none;
    }

    /* =========================
       Gift Sheet
       ========================= */
    .sheet-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(13, 8, 24, 0.54);
      backdrop-filter: blur(6px);
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.28s ease, visibility 0.28s ease;
      z-index: 20;
    }

    .sheet-backdrop.is-open {
      opacity: 1;
      visibility: visible;
    }

    .gift-sheet {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      top: auto;
      height: auto;
      max-height: calc(100dvh - var(--safe-top) - 12px);
      padding: clamp(12px, 3vw, 16px) clamp(12px, 3vw, 16px) calc(clamp(14px, 4vw, 18px) + var(--safe-bottom));
      border-radius: 30px 30px 0 0;
      transform: translateY(100%);
      opacity: 0;
      visibility: hidden;
      transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease, visibility 0.3s ease;
      z-index: 21;
      color: #fff;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    .gift-sheet.is-open {
      opacity: 1;
      visibility: visible;
      transform: translateY(0);
    }

    .collection-sheet {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      max-height: min(78dvh, 640px);
      padding: clamp(12px, 3vw, 16px) clamp(12px, 3vw, 16px) calc(clamp(14px, 4vw, 18px) + var(--safe-bottom));
      border-radius: 30px 30px 0 0;
      transform: translateY(100%);
      opacity: 0;
      visibility: hidden;
      transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease, visibility 0.3s ease;
      z-index: 21;
      color: #fff;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    .collection-sheet.is-open {
      opacity: 1;
      visibility: visible;
      transform: translateY(0);
    }

    .collection-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      overflow-y: auto;
      min-height: 0;
      padding-right: 2px;
    }

    .collection-card,
    .gift-card {
      border-radius: 18px;
      border: 1px solid rgba(255, 255, 255, 0.14);
      box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.04),
        0 12px 24px rgba(17, 9, 33, 0.16);
      transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    }

    @media (hover: hover) {
      .collection-card:hover,
      .gift-card:hover {
        transform: translateY(-2px);
        border-color: rgba(255, 214, 238, 0.22);
        box-shadow:
          inset 0 0 0 1px rgba(255, 255, 255, 0.05),
          0 16px 28px rgba(17, 9, 33, 0.2);
      }
    }

    .collection-card:active,
    .gift-card:active {
      transform: translateY(-1px) scale(0.99);
    }

    .collection-card {
      padding: 10px;
      background: rgba(255, 255, 255, 0.08);
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .collection-card.is-locked {
      opacity: 0.84;
    }

    .collection-preview,
    .gift-icon {
      border-radius: 14px;
      border: 1px solid rgba(255, 255, 255, 0.12);
      box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.03),
        0 8px 18px rgba(18, 10, 35, 0.14);
      background: radial-gradient(circle at center, rgba(255, 170, 224, 0.2), rgba(255, 255, 255, 0.03));
    }

    .collection-preview {
      position: relative;
      aspect-ratio: 0.86;
      overflow: hidden;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .collection-preview img,
    .collection-preview video {
      width: 100%;
      height: 100% !important;
      object-fit: cover;
      display: block;
    }

    .collection-blur-overlay {
      position: absolute;
      inset: 0;
      z-index: 2;
      backdrop-filter: blur(6px) saturate(1.2);
      background: rgba(12, 14, 26, 0.18);
      border-radius: inherit;
    }

    .collection-lock {
      position: absolute;
      inset: 0;
      z-index: 3;
      display: grid;
      place-items: center;
      font-size: 1.6rem;
      opacity: 0.9;
    }

    .collection-card strong,
    .gift-card strong {
      display: block;
      font-size: 0.86rem;
      line-height: 1.25;
      font-weight: 700;
    }

    .collection-card p,
    .gift-cost {
      font-size: 0.74rem;
      line-height: 1.4;
    }

    .collection-card p {
      margin: 0;
    }

    .collection-kind {
      font-size: 0.68rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .sheet-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 16px;
      flex-shrink: 0;
    }

    .sheet-header strong {
      display: block;
      font-size: 1.25rem;
      line-height: 1.15;
      margin-bottom: 4px;
    }

    .sheet-header span {
      display: block;
      font-size: 0.65rem;
      line-height: 1.25;
      margin-top: 2px;
    }

    .sheet-close {
      width: 36px;
      height: 36px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.08);
      color: #fff;
      border: 1px solid rgba(255, 255, 255, 0.16);
      font-size: 1rem;
    }

    .gift-sheet-close {
      position: relative;
      width: 44px;
      height: 44px;
      flex-shrink: 0;
      background: rgba(255, 255, 255, 0.04);
      border: 1.5px solid rgba(255, 255, 255, 0.2);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
      color: transparent;
      font-size: 0;
    }

    .gift-sheet-close::before,
    .gift-sheet-close::after {
      content: "";
      position: absolute;
      top: 50%;
      left: 50%;
      width: 22px;
      height: 2.5px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.96);
      transform-origin: center;
    }

    .gift-sheet-close::before {
      transform: translate(-50%, -50%) rotate(45deg);
    }

    .gift-sheet-close::after {
      transform: translate(-50%, -50%) rotate(-45deg);
    }

    .gift-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: clamp(6px, 2vw, 10px);
      padding-bottom: 8px;
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      padding-right: 2px;
    }

    .gift-grid::-webkit-scrollbar {
      width: 4px;
    }

    .gift-grid::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.18);
      border-radius: 999px;
    }

    .gift-card {
      padding: 10px 8px;
      text-align: center;
    }

    .gift-icon {
      width: 100%;
      aspect-ratio: 1;
      position: relative;
      overflow: hidden;
      display: grid;
      place-items: center;
      margin-bottom: 6px;
      font-size: 1.8rem;
      line-height: 1;
    }

    .gift-icon-img {
      width: min(84%, 120px);
      height: min(84%, 120px);
      position: relative;
      z-index: 1;
      display: block;
      object-fit: contain;
      filter: drop-shadow(0 12px 18px rgba(22, 10, 40, 0.28));
    }

    .gift-card strong {
      margin-bottom: 6px;
      min-height: 1.4em;
    }

    .gift-card p {
      display: none;
    }

    .gift-card-footer {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 6px;
    }

    .gift-cost {
      font-weight: 700;
      color: #ffd8ef;
    }

    .gift-send {
      width: 100%;
      min-height: 30px;
      padding: 0 10px;
      border-radius: 999px;
      color: #fff;
      font-size: 0.75rem;
    }

    .gift-sheet-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: clamp(8px, 2vw, 12px);
      margin-top: 12px;
      padding-top: 12px;
      border-top: 1px solid rgba(224, 170, 255, 0.16);
      flex-shrink: 0;
    }

    .gift-balance {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .gift-balance-value {
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .gift-balance-value .coin-icon {
      font-size: 1rem;
      color: #ff9cd0;
    }

    .gift-balance span:not(.coin-icon) {
      color: rgba(245, 231, 255, 0.72);
      font-size: 0.72rem;
    }

    .gift-balance strong {
      color: #fff;
      font-size: 1.4rem;
      line-height: 1;
    }

    .recharge-btn {
      min-width: clamp(100px, 28vw, 140px);
      min-height: clamp(38px, 10vw, 46px);
      padding: 0 clamp(14px, 4vw, 20px);
      border-radius: 999px;
      color: #fff;
      font-size: clamp(0.85rem, 2.8vw, 0.95rem);
      font-weight: 800;
    }

    /* =========================
       Level Up Modal
       ========================= */
    .level-up-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.8);
      z-index: 100;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.3s ease, visibility 0.3s ease;
      backdrop-filter: blur(8px);
    }

    .level-up-overlay.is-visible {
      opacity: 1;
      visibility: visible;
    }

    .level-up-modal {
      position: relative;
      width: clamp(240px, 75vw, 320px);
      display: flex;
      flex-direction: column;
      align-items: center;
      transform: scale(0.9) translateY(20px);
      transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .level-up-title {
      font-size: clamp(1.4rem, 5vw, 1.8rem);
      font-weight: 800;
      color: #fff;
      margin-bottom: 16px;
      margin-top: 12px;
      text-align: center;
      letter-spacing: -0.02em;
    }

    .level-up-overlay.is-visible .level-up-modal {
      transform: scale(1) translateY(0);
    }

    .level-up-image-container {
      position: relative;
      width: 100%;
      aspect-ratio: 3 / 4;
      border-radius: 24px;
      overflow: hidden;
      box-shadow: 0 0 60px rgba(255, 109, 181, 0.4), 0 20px 50px rgba(0, 0, 0, 0.5);
      animation: pulse-glow 2s infinite alternate;
      background: #111;
    }

    @keyframes pulse-glow {
      0% {
        box-shadow: 0 0 40px rgba(255, 109, 181, 0.3), 0 20px 50px rgba(0, 0, 0, 0.5);
      }
      100% {
        box-shadow: 0 0 80px rgba(255, 109, 181, 0.6), 0 0 120px rgba(141, 91, 255, 0.4), 0 20px 50px rgba(0, 0, 0, 0.5);
      }
    }

    .level-up-image-container::after {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: 24px;
      box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3), inset 0 0 30px rgba(255, 186, 228, 0.4);
      pointer-events: none;
    }

    .level-up-image-mask {
      position: absolute;
      inset: 0;
      background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.4) 100%);
      pointer-events: none;
    }

    .level-up-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: center top;
    }

    .level-up-text {
      position: absolute;
      bottom: 20px;
      left: 0;
      right: 0;
      text-align: center;
      font-size: clamp(2.5rem, 8vw, 3.5rem);
      font-weight: 900;
      color: #fff;
      text-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 109, 181, 0.6);
      z-index: 2;
    }

    .level-up-btn {
      margin-top: 30px;
      width: min(100%, 240px);
    }
    @media (max-width: 560px) {
      :root {
        --message-bubble-max: min(72vw, 18rem);
      --welcome-copy-bottom: clamp(60px, 12vh, 80px);
      --chat-input-total-h: clamp(50px, 11vw, 60px);
      }

      .welcome-shell {
        padding: 0;
      }

      .welcome-hero {
        height: 100%;
      }

      .header-affinity {
        padding: 0;
      }

      .conversation-panel {
        height: clamp(380px, 60dvh, 580px);
      }

      .tool-btn .tool-label {
        display: none;
      }

      .input-pill {
        min-height: 50px;
      }

      .gift-sheet-footer {
        flex-direction: row;
        align-items: center;
        margin-top: 10px;
        padding-top: 10px;
      }

      .gift-balance strong {
        font-size: 1.1rem;
      }

      .gift-sheet,
      .collection-sheet {
        padding: 12px 12px calc(12px + var(--safe-bottom));
      }

      .sheet-header {
        margin-bottom: 12px;
      }

      .sheet-header strong {
        font-size: 1.1rem;
      }

      .recharge-btn {
        width: auto;
        min-width: 80px;
        min-height: 32px;
        padding: 0 16px;
        font-size: 0.8rem;
      }
    }

    @media (max-width: 380px) {
      :root {
        --tool-column: clamp(34px, 12vw, 42px);
        --tool-icon-size: clamp(28px, 9vw, 34px);
        --icon-btn-size: clamp(30px, 9vw, 34px);
        --send-btn-minw: clamp(54px, 16vw, 66px);
      --send-btn-px: clamp(10px, 3vw, 14px);
      --message-bubble-max: min(74vw, 16rem);
      --chat-input-total-h: clamp(48px, 11vw, 56px);
      }

      .chat-header {
        padding-right: 8px;
      }

      .header-right {
        gap: 0;
      }

      .message-list {
        padding-right: 8px;
      }

      .header-meta-panel {
        gap: 8px;
        max-width: min(62vw, 220px);
      }

      .gift-send {
        min-height: 28px;
        font-size: 0.72rem;
      }
    }

    @media (max-height: 760px) {
      :root {
        --welcome-copy-bottom: clamp(50px, 10vh, 70px);
        --welcome-footer-bottom: clamp(10px, 2.4vh, 18px);
        --tool-column: clamp(36px, 11vw, 46px);
        --tool-icon-size: clamp(28px, 8vw, 36px);
      --input-pill-h: clamp(40px, 10vw, 46px);
      --send-btn-h: clamp(36px, 9vw, 40px);
      --chat-input-total-h: clamp(48px, 11vw, 56px);
      }

      .welcome-subtitle {
        margin-top: 8px;
      }

      .tool-btn .tool-label {
        display: none;
      }

      .conversation-panel {
        gap: 6px;
        height: clamp(340px, 58dvh, 500px);
      }

      .gift-sheet,
      .collection-sheet {
        padding-top: 10px;
        padding-bottom: calc(12px + var(--safe-bottom));
      }

      .sheet-header {
        margin-bottom: 10px;
      }

      .gift-sheet-footer {
        margin-top: 8px;
        padding-top: 8px;
      }
    }

    @media (orientation: landscape) and (max-height: 560px) {
      :root {
        --welcome-copy-bottom: clamp(40px, 8vh, 60px);
        --chat-input-total-h: 48px;
      }

      #chatScreen::before {
        display: none;
      }

      .welcome-subtitle {
        display: none;
      }

      .welcome-title {
        font-size: clamp(2rem, 7vw, 3.2rem);
      }

      .chat-header {
        padding-top: 8px;
        padding-bottom: 10px;
      }

      .conversation-panel {
        height: clamp(320px, 65dvh, 420px);
      }

      .chat-input-area {
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 0;
      }
    }

/* Sticker message */
.message-sticker {
  display: block;
  max-width: 160px;
  max-height: 160px;
  width: auto;
  height: auto;
  border-radius: 12px;
  object-fit: contain;
  margin: 4px 0;
}

@media (max-width: 480px) {
  .message-sticker {
    max-width: 120px;
    max-height: 120px;
  }
}

/* =========================
   Message Entrance Animations
   ========================= */
.message-row.message-appear {
  animation: msgAppear 0.36s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.message-row.user.message-appear {
  animation-name: msgAppearUser;
}

.message-row.ai.message-appear {
  animation-name: msgAppearAi;
}

@keyframes msgAppearUser {
  0% {
    opacity: 0;
    transform: translateX(18px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes msgAppearAi {
  0% {
    opacity: 0;
    transform: translateX(-18px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* Typing indicator entrance */
.typing-indicator-row.typing-appear {
  animation: typingAppear 0.28s ease both;
}

@keyframes typingAppear {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Button pop feedback */
.send-btn.is-popping,
.quick-btn.is-popping {
  animation: btnPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes btnPop {
  0%   { transform: scale(1); }
  30%  { transform: scale(0.92); }
  60%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* Send button specific glow pulse on click */
.send-btn.is-popping {
  filter: brightness(1.15);
}

/* System card entrance */
.system-card {
  animation: sysCardIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes sysCardIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Smooth scroll for message list */
.message-list {
  scroll-behavior: smooth;
}

/* Sticker message entrance */
.message-sticker {
  animation: stickerIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes stickerIn {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
