* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system,
  BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #0f172a; color: #e2e8f0; }

.hidden { display: none !important; }
.muted { color: #94a3b8; font-size: 0.9rem; }

.center { min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 1rem; }

.card { background: #1e293b; padding: 2rem; border-radius: 12px;
  width: 100%; max-width: 460px; box-shadow: 0 10px 30px rgba(0,0,0,0.4); }

.launch-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin-top: 1rem;
}

.result-topline {
  margin-top: 0.8rem;
}

.result-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.clean-launch {
  margin-top: 0.85rem;
  gap: 0.75rem;
}

.launch-choice {
  text-align: left;
  border: 1px solid #334155;
  background: linear-gradient(180deg, rgba(30, 41, 59, 1) 0%, rgba(17, 24, 39, 1) 100%);
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.8rem 0.95rem;
}

.launch-choice:hover {
  border-color: #64748b;
  transform: translateY(-1px);
}

.launch-choice .launch-title {
  font-weight: 700;
  color: #f8fafc;
}

.launch-choice .launch-sub {
  font-size: 0.83rem;
  color: #93c5fd;
}

.choice-note {
  margin-top: 0.9rem;
  line-height: 1.45;
}

.extension-guide {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid #334155;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.8);
}

.extension-guide strong {
  display: block;
  margin-bottom: 0.45rem;
}

.extension-guide ol {
  margin: 0;
  padding-left: 1.1rem;
  color: #cbd5e1;
}

.card h1, .card h2 { margin-top: 0; }

.btn { background: #334155; color: #e2e8f0; border: 0; padding: 0.6rem 1rem;
  border-radius: 8px; cursor: pointer; font-size: 0.95rem;
  text-decoration: none; display: inline-block; transition: 0.15s ease; }
.btn:hover { background: #475569; }
.btn.primary { background: #6366f1; }
.btn.primary:hover { background: #4f46e5; }
.btn.small { padding: 0.4rem 0.7rem; font-size: 0.85rem; }

.row { display: flex; gap: 0.5rem; align-items: center; margin: 0.5rem 0; }
input[type=text], #input, #nameInput {
  flex: 1; padding: 0.6rem 0.8rem; border-radius: 8px;
  border: 1px solid #334155; background: #0f172a; color: #e2e8f0;
  font-size: 1rem; outline: none;
}
input:focus { border-color: #6366f1; }

#nameForm { display: flex; gap: 0.5rem; margin-top: 1rem; }

.overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.95);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; z-index: 10; }

/* Chat layout */
.chat { display: flex; flex-direction: column; height: 100vh; max-width: 780px;
  margin: 0 auto; background: #0f172a; }
.chat-header { display: flex; justify-content: space-between; align-items: center;
  padding: 0.8rem 1rem; border-bottom: 1px solid #1e293b; }

.chat-header-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: #1d4ed8;
  color: #dbeafe;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

body.chat-compact .chat {
  max-width: none;
}

body.chat-compact .chat-header {
  padding: 0.65rem 0.75rem;
}

body.chat-compact .chat-header-main {
  align-items: flex-start;
}

body.chat-compact .chat-header .row {
  flex-wrap: wrap;
  justify-content: flex-end;
}

body.chat-compact .messages {
  padding: 0.75rem;
}

body.chat-compact .messages li.msg {
  max-width: 88%;
}

body.chat-compact .composer {
  padding: 0.7rem 0.75rem;
}

body[data-chat-mode="widget"] {
  background: transparent;
}

body[data-chat-mode="widget"] .chat {
  border: 1px solid rgba(59, 130, 246, 0.16);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
}

body[data-chat-mode="widget"] .chat-header {
  background: rgba(15, 23, 42, 0.96);
  border-bottom-color: rgba(59, 130, 246, 0.2);
}

body[data-chat-mode="widget"] .messages {
  padding-top: 0.6rem;
}

body[data-chat-mode="widget"] #decoyBtn,
body[data-chat-mode="widget"] #hotkeyBtn,
body[data-chat-mode="widget"] #feedbackBtn {
  display: none;
}

body[data-chat-mode="widget"] .composer {
  background: rgba(15, 23, 42, 0.9);
}

body[data-chat-mode="widget"] .overlay .card,
body[data-chat-mode="mini"] .overlay .card {
  max-width: 340px;
}

.messages { list-style: none; margin: 0; padding: 1rem; flex: 1;
  overflow-y: auto; display: flex; flex-direction: column; gap: 0.6rem; }

.messages li.msg { max-width: 75%; }
.messages li.msg.me { align-self: flex-end; text-align: right; }
.meta { font-size: 0.75rem; color: #94a3b8; margin-bottom: 2px; }
.meta .name { font-weight: 600; margin-right: 0.4rem; color: #c7d2fe; }
.me .meta .name { color: #fda4af; }
.bubble { background: #1e293b; padding: 0.55rem 0.8rem; border-radius: 12px;
  display: inline-block; word-wrap: break-word; white-space: pre-wrap;
  text-align: left; }
.me .bubble { background: #6366f1; color: white; }

.messages li.system { align-self: center; font-size: 0.8rem;
  color: #94a3b8; font-style: italic; }

.typing { padding: 0 1rem; height: 1.2rem; font-size: 0.8rem; color: #94a3b8; }

.composer { display: flex; gap: 0.5rem; padding: 0.8rem 1rem;
  border-top: 1px solid #1e293b; }

/* Emoji & sticker pickers */
.btn.icon { font-size: 1.1rem; padding: 0.45rem 0.6rem; }
.btn.disabled { opacity: 0.5; }

.picker { background: #111827; border-top: 1px solid #1e293b;
  max-height: 280px; display: flex; flex-direction: column; }

.picker-tabs { display: flex; gap: 0.25rem; overflow-x: auto;
  padding: 0.4rem 0.6rem; border-bottom: 1px solid #1e293b; }
.picker-tabs .tab { background: transparent; border: 0; color: #94a3b8;
  padding: 0.3rem 0.6rem; font-size: 0.8rem; border-radius: 6px;
  cursor: pointer; white-space: nowrap; }
.picker-tabs .tab:hover { background: #1e293b; color: #e2e8f0; }
.picker-tabs .tab.active { background: #334155; color: #fff; }

.picker-grid { display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 4px; padding: 0.6rem; overflow-y: auto; }
.emoji-cell { background: transparent; border: 0; cursor: pointer;
  font-size: 1.4rem; padding: 4px; border-radius: 6px; line-height: 1; }
.emoji-cell:hover { background: #1e293b; }

.picker-header { padding: 0.5rem 0.6rem; border-bottom: 1px solid #1e293b; }
.picker-header input { width: 100%; padding: 0.45rem 0.7rem;
  border-radius: 8px; border: 1px solid #334155;
  background: #0f172a; color: #e2e8f0; }

.sticker-grid { display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px; padding: 0.6rem; overflow-y: auto; }
.sticker-thumb { width: 100%; height: 96px; object-fit: contain;
  background: #1e293b; border-radius: 8px; cursor: pointer;
  transition: transform 0.1s; }
.sticker-thumb:hover { transform: scale(1.05); }

.picker-footer { padding: 0.3rem 0.6rem; font-size: 0.7rem;
  border-top: 1px solid #1e293b; text-align: right; }
.muted.pad { padding: 1rem; text-align: center; }

.sticker-bubble { background: transparent !important; padding: 0 !important; }
.me .sticker-bubble { background: transparent !important; }
.sticker { display: block; max-width: 200px; height: auto;
  border-radius: 12px; }

.lock { display: inline-block; margin-left: 0.5rem; font-size: 0.75rem;
  background: #064e3b; color: #6ee7b7; padding: 0.15rem 0.5rem;
  border-radius: 999px; cursor: help; }

/* Lottie picker */
.lottie-pane { padding: 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; }
.lottie-row { display: flex; gap: 0.4rem; }
.lottie-row input { flex: 1; padding: 0.45rem 0.7rem; border-radius: 8px;
  border: 1px solid #334155; background: #0f172a; color: #e2e8f0; }
.lottie-grid { display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px; }
.lottie-cell { background: #1e293b; border: 0; border-radius: 8px;
  padding: 6px; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 2px; color: #e2e8f0; }
.lottie-cell:hover { background: #334155; }
.lottie-label { font-size: 0.7rem; color: #94a3b8; }

.messages li.fading { opacity: 0; transform: translateY(-4px);
  transition: opacity 0.5s ease, transform 0.5s ease; }

/* ---------- Privacy overlay (hide on blur/hidden) ---------- */
.privacy-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #e2e8f0;
  z-index: 9999;
  padding: 1.5rem;
}
.privacy-overlay.hidden { display: none; }
.privacy-title { font-size: 1.4rem; font-weight: 600; margin-bottom: 0.4rem; }
.privacy-sub { color: #94a3b8; font-size: 0.9rem; }

/* ---------- Decoy iframe + resume button ---------- */
.privacy-overlay { padding: 0; }
.decoy-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.decoy-frame.hidden { display: none; }
.privacy-blank {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  color: #e2e8f0;
  text-align: center;
  padding: 1.5rem;
}
.privacy-blank.hidden { display: none; }

.resume-btn {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 10000;
  background: #2563eb;
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.resume-btn:hover { background: #1d4ed8; }
.resume-btn.hidden { display: none; }

/* Transparent capture layer above the decoy iframe so we can detect
   the secret right-click gesture. */
.privacy-catcher {
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 1;
  cursor: default;
}

.hotkey-display {
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  background: #0f172a;
  border: 1px dashed #334155;
  border-radius: 8px;
  text-align: center;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 1rem;
  color: #e2e8f0;
}

.card textarea {
  width: 100%;
  box-sizing: border-box;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 0.6rem;
  font: inherit;
  resize: vertical;
  margin-bottom: 0.5rem;
}
.card textarea:focus { outline: none; border-color: #2563eb; }

@media (max-width: 640px) {
  .launch-grid {
    grid-template-columns: 1fr;
  }

  .chat-header {
    align-items: flex-start;
    gap: 0.75rem;
  }

  .chat-header .row {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}
