 *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --cream: #f5f0e8;
      --warm-white: #faf8f4;
      --ink: #1a1714;
      --ink-light: #4a4540;
      --ink-muted: #9a9590;
      --sage: #7a9e7e;
      --sage-light: #e8f0e9;
      --terracotta: #c4714a;
      --border: #e0d8cc;
      --shadow: rgba(26,23,20,0.12);
      --radius: 20px;
      --radius-sm: 12px;
    }

    body {
      font-family: 'Instrument Sans', sans-serif;
      background: var(--cream);
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }

    /* Subtle linen texture */
    body::before {
      content: '';
      position: fixed;
      inset: 0;
      background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c8b89a' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
      pointer-events: none;
      z-index: 0;
    }

    /* â”€â”€ Launcher button â”€â”€ */
    .chat-launcher {
      position: fixed;
      bottom: 32px;
      right: 32px;
      z-index: 1000;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 12px;
    }

    .launcher-hint {
      background: var(--ink);
      color: var(--cream);
      font-size: 13px;
      font-family: 'Fraunces', serif;
      font-style: italic;
      font-weight: 300;
      padding: 8px 16px;
      border-radius: 100px;
      white-space: nowrap;
      opacity: 1;
      transform: translateY(0);
      transition: opacity 0.3s, transform 0.3s;
      pointer-events: none;
    }

    .launcher-hint.hide { opacity: 0; transform: translateY(6px); }

    .launcher-btn {
      width: 60px;
      height: 60px;
      border-radius: 50%;
      background: var(--ink);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 8px 32px var(--shadow), 0 2px 8px var(--shadow);
      transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
      position: relative;
      overflow: hidden;
    }

    .launcher-btn:hover {
      transform: scale(1.08);
      box-shadow: 0 12px 40px rgba(26,23,20,0.22), 0 4px 12px var(--shadow);
    }

    .launcher-btn .icon-chat,
    .launcher-btn .icon-close {
      position: absolute;
      transition: opacity 0.25s, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
    }

    .launcher-btn .icon-close { opacity: 0; transform: rotate(-90deg) scale(0.6); }
    .launcher-btn.open .icon-chat { opacity: 0; transform: rotate(90deg) scale(0.6); }
    .launcher-btn.open .icon-close { opacity: 1; transform: rotate(0deg) scale(1); }

    /* Pulse ring */
    .launcher-btn::after {
      content: '';
      position: absolute;
      inset: -4px;
      border-radius: 50%;
      border: 2px solid var(--ink);
      opacity: 0;
      animation: pulse 2.5s ease-out infinite;
    }

    @keyframes pulse {
      0% { transform: scale(1); opacity: 0.6; }
      100% { transform: scale(1.5); opacity: 0; }
    }

    /* â”€â”€ Chat panel â”€â”€ */
    .chat-panel {
      position: fixed;
      bottom: 108px;
      right: 32px;
      width: 380px;
      max-height: 600px;
      z-index: 999;
      background: var(--warm-white);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      box-shadow: 0 24px 80px rgba(26,23,20,0.18), 0 8px 24px rgba(26,23,20,0.08);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      opacity: 0;
      transform: translateY(20px) scale(0.95);
      pointer-events: none;
      transition: opacity 0.35s cubic-bezier(0.16,1,0.3,1), transform 0.35s cubic-bezier(0.16,1,0.3,1);
      transform-origin: bottom right;
    }

    .chat-panel.open {
      opacity: 1;
      transform: translateY(0) scale(1);
      pointer-events: all;
    }

    /* Header */
    .chat-header {
      padding: 20px 22px 16px;
      border-bottom: 1px solid var(--border);
      background: var(--warm-white);
      display: flex;
      align-items: center;
      gap: 14px;
    }

    .bot-avatar {
      width: 40px;
      height: 40px;
      border-radius: 12px;
      background: var(--ink);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .header-info { flex: 1; }

    .header-name {
      font-family: 'Fraunces', serif;
      font-weight: 600;
      font-size: 16px;
      color: var(--ink);
      line-height: 1.2;
    }

    .header-status {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 11.5px;
      color: var(--ink-muted);
      margin-top: 2px;
    }

    .status-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--sage);
    }

    .header-clear {
      background: none;
      border: 1px solid var(--border);
      color: var(--ink-muted);
      font-size: 11px;
      font-family: 'Instrument Sans', sans-serif;
      padding: 5px 10px;
      border-radius: 100px;
      cursor: pointer;
      transition: color 0.2s, border-color 0.2s, background 0.2s;
    }

    .header-clear:hover {
      color: var(--ink);
      border-color: var(--ink-light);
      background: var(--cream);
    }

    /* Messages */
    .chat-messages {
      flex: 1;
      overflow-y: auto;
      padding: 20px 18px;
      display: flex;
      flex-direction: column;
      gap: 14px;
      scroll-behavior: smooth;
    }

    .chat-messages::-webkit-scrollbar { width: 4px; }
    .chat-messages::-webkit-scrollbar-track { background: transparent; }
    .chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

    .msg {
      display: flex;
      gap: 10px;
      animation: msgIn 0.3s cubic-bezier(0.16,1,0.3,1);
    }

    @keyframes msgIn {
      from { opacity: 0; transform: translateY(10px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .msg.user { flex-direction: row-reverse; }

    .msg-avatar {
      width: 28px;
      height: 28px;
      border-radius: 8px;
      background: var(--ink);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      margin-top: 2px;
    }

    .msg.user .msg-avatar {
      background: var(--sage-light);
    }

    .msg-bubble {
      max-width: 78%;
      padding: 11px 15px;
      border-radius: var(--radius-sm);
      font-size: 14px;
      line-height: 1.55;
      color: var(--ink);
    }

    .msg.bot .msg-bubble {
      background: var(--cream);
      border: 1px solid var(--border);
      border-bottom-left-radius: 4px;
    }

    .msg.user .msg-bubble {
      background: var(--ink);
      color: var(--cream);
      border-bottom-right-radius: 4px;
    }

    .msg-time {
      font-size: 10px;
      color: var(--ink-muted);
      margin-top: 4px;
      padding: 0 4px;
    }

    .msg.user .msg-time { text-align: right; }

    /* Typing indicator */
    .typing-indicator {
      display: flex;
      gap: 10px;
      align-items: flex-end;
    }

    .typing-dots {
      background: var(--cream);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      border-bottom-left-radius: 4px;
      padding: 13px 16px;
      display: flex;
      gap: 5px;
      align-items: center;
    }

    .typing-dots span {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--ink-muted);
      animation: bounce 1.2s ease-in-out infinite;
    }

    .typing-dots span:nth-child(2) { animation-delay: 0.15s; }
    .typing-dots span:nth-child(3) { animation-delay: 0.3s; }

    @keyframes bounce {
      0%, 60%, 100% { transform: translateY(0); }
      30% { transform: translateY(-5px); }
    }

    /* Suggestions */
    .suggestions {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
      padding: 0 18px 12px;
    }

    .suggestion-chip {
      background: var(--cream);
      border: 1px solid var(--border);
      color: var(--ink-light);
      font-size: 12px;
      font-family: 'Instrument Sans', sans-serif;
      padding: 6px 13px;
      border-radius: 100px;
      cursor: pointer;
      transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
      white-space: nowrap;
    }

    .suggestion-chip:hover {
      background: var(--ink);
      border-color: var(--ink);
      color: var(--cream);
      transform: translateY(-1px);
    }

    /* Input */
    .chat-input-area {
      padding: 14px 16px;
      border-top: 1px solid var(--border);
      background: var(--warm-white);
      display: flex;
      gap: 10px;
      align-items: flex-end;
    }

    .chat-input {
      flex: 1;
      background: var(--cream);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 10px 14px;
      font-size: 14px;
      font-family: 'Instrument Sans', sans-serif;
      color: var(--ink);
      resize: none;
      outline: none;
      max-height: 120px;
      min-height: 42px;
      line-height: 1.5;
      transition: border-color 0.2s, box-shadow 0.2s;
    }

    .chat-input::placeholder { color: var(--ink-muted); }
    .chat-input:focus {
      border-color: var(--ink-light);
      box-shadow: 0 0 0 3px rgba(26,23,20,0.06);
    }

    .send-btn {
      width: 42px;
      height: 42px;
      border-radius: 12px;
      background: var(--ink);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      transition: background 0.2s, transform 0.15s;
    }

    .send-btn:hover:not(:disabled) {
      background: var(--ink-light);
      transform: scale(1.05);
    }

    .send-btn:disabled { background: var(--border); cursor: not-allowed; }

    .chat-footer {
      text-align: center;
      padding: 8px 16px 12px;
      font-size: 10.5px;
      color: var(--ink-muted);
      font-family: 'Instrument Sans', sans-serif;
    }

    .chat-footer a {
      color: var(--terracotta);
      text-decoration: none;
    }

    /* Demo page background */
    .demo-page {
      text-align: center;
      z-index: 1;
      position: relative;
    }

    .demo-page h1 {
      font-family: 'Fraunces', serif;
      font-size: 52px;
      font-weight: 300;
      color: var(--ink);
      line-height: 1.15;
      margin-bottom: 16px;
    }

    .demo-page h1 em {
      font-style: italic;
      color: var(--terracotta);
    }

    .demo-page p {
      font-size: 16px;
      color: var(--ink-muted);
      max-width: 380px;
      line-height: 1.6;
    }

    @media (max-width: 440px) {
      .chat-panel { width: calc(100vw - 32px); right: 16px; bottom: 92px; }
      .chat-launcher { right: 16px; bottom: 20px; }
    }