:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #262b36;
  --text: #e8eaed;
  --text-dim: #8b909c;
  --accent: #6c5ce7;
  --accent-2: #00d1a0;
  --bubble-me: #6c5ce7;
  --bubble-them: #262b36;
  --danger: #ff5c5c;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--panel);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: var(--panel);
}

*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Landing page */
body.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(circle at 30% 20%, #1c1f2a 0%, #0f1115 60%);
  padding: 20px;
}

.landing-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.landing-logo {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 8px;
}

.landing-tagline {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 24px;
}

.landing-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.landing-form input[type="text"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  width: 100%;
}

.landing-form input[type="text"]:focus {
  border-color: var(--accent);
}

.gender-label {
  margin: -4px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-align: left;
}

.gender-select {
  display: flex;
  gap: 8px;
}

.gender-option {
  flex: 1;
  position: relative;
  cursor: pointer;
}

.gender-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.gender-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.15s;
}

.gender-icon {
  width: 22px;
  height: 22px;
}

.gender-option input:checked + .gender-pill {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.gender-option input:focus-visible + .gender-pill {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.landing-form button[type="submit"] {
  background: var(--accent);
  border: none;
  border-radius: 10px;
  padding: 14px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.landing-form button[type="submit"]:hover {
  background: #5a48d6;
}

.interest-hint {
  margin: 0 0 18px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-dim);
  text-align: left;
}

.interest-trigger {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s;
}

.interest-trigger:hover {
  border-color: var(--accent);
}

.modal-title {
  margin: 0 0 14px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.interest-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  text-align: left;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: all 0.15s;
}

.checkbox-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-option.is-checked {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.12);
}

.landing-note {
  color: var(--text-dim);
  font-size: 12px;
  margin: 20px 0 0;
}

/* Chat page */
body.chat-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: radial-gradient(circle at 30% 20%, #1c1f2a 0%, #0f1115 60%);
  padding: 16px;
}

.chat-widget {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 60%;
  height: 90%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

@media (max-width: 700px) {
  .chat-widget {
    max-width: 100%;
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  font-weight: 700;
  font-size: 18px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.online-count {
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 6px var(--accent-2);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  display: inline-block;
}

.topbar-btn:hover:not(:disabled) {
  background: #262b36;
}

.topbar-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.topbar-btn-skip {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  padding: 9px 18px;
  font-size: 14px;
}

.topbar-btn-skip:hover:not(:disabled) {
  background: #5a48d6;
  border-color: #5a48d6;
}

.topbar-btn-skip:disabled {
  background: var(--panel-2);
  border-color: var(--border);
  color: var(--text-dim);
}

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.waiting-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.waiting-card {
  text-align: center;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 44px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

.waiting-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin 0.8s linear infinite;
}

.waiting-card p {
  margin: 0;
  font-size: 14.5px;
}

.start-btn {
  margin-top: 16px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.start-btn:hover {
  background: #5a48d6;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.hidden { display: none !important; }

.system-msg {
  align-self: center;
  color: var(--text-dim);
  font-size: 12.5px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  margin: 10px 0;
  text-align: center;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.system-msg.fade-out {
  opacity: 0;
}

.bubble {
  max-width: 72%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.bubble.me {
  align-self: flex-end;
  background: var(--bubble-me);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble.them {
  align-self: flex-start;
  background: var(--bubble-them);
  border-bottom-left-radius: 4px;
}

.bubble .meta {
  display: block;
  font-size: 10.5px;
  opacity: 0.6;
  margin-top: 3px;
}

.typing-indicator {
  padding: 4px 16px;
  font-size: 12.5px;
  color: var(--text-dim);
  font-style: italic;
  flex-shrink: 0;
}

.composer-wrap {
  background: var(--panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding: 12px 16px;
}

.composer {
  display: flex;
  gap: 10px;
}

.privacy-note {
  margin: 8px 0 0;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--text-dim);
  text-align: center;
}

.composer textarea {
  flex: 1;
  resize: none;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  max-height: 100px;
  overflow-y: hidden;
}

.composer textarea:focus {
  border-color: var(--accent);
}

.composer button {
  background: var(--accent);
  border: none;
  border-radius: 10px;
  padding: 0 20px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.composer button:hover {
  background: #5a48d6;
}

@media (max-width: 480px) {
  .bubble { max-width: 85%; }
}

/* Skip confirmation modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

.modal-box p {
  margin: 0 0 20px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-btn {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.modal-btn-secondary {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.modal-btn-secondary:hover {
  background: #262b36;
}

.modal-btn-primary {
  background: var(--danger);
  color: #fff;
}

.modal-btn-primary:hover {
  background: #e04f4f;
}
