:root {
  --bg: #0a0509;
  --bg-alt: #120810;
  --card: #170c16;
  --border: #3a1830;
  --pink: #ff4fa3;
  --pink-bright: #ff7ac2;
  --magenta: #d13bd6;
  --cyan: #4de8e0;
  --text: #f3dbe9;
  --text-dim: #a5839a;
  --danger: #ff5c5c;
  --warn: #ffb84d;
  --ok: #6de89a;
  --radius: 14px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
}

body {
  background:
    radial-gradient(circle at 15% 0%, rgba(209, 59, 214, 0.16), transparent 45%),
    radial-gradient(circle at 85% 100%, rgba(77, 232, 224, 0.10), transparent 40%),
    var(--bg);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.018) 0px,
    rgba(255, 255, 255, 0.018) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

.screen { position: relative; z-index: 2; }

/* ---------- Gate screen ---------- */
.gate-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.gate-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, var(--card), var(--bg-alt));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px 24px;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(255, 79, 163, 0.06), 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(209,59,214,0.08);
}

.gate-avatar {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--pink);
  box-shadow: 0 0 24px rgba(255, 79, 163, 0.45);
  margin-bottom: 14px;
}

.gate-card h1 {
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
  font-weight: 700;
}

.accent { color: var(--pink-bright); text-shadow: 0 0 12px rgba(255,79,163,0.6); }

.tagline {
  color: var(--text-dim);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  margin: 0 0 22px;
  text-transform: uppercase;
}

.field {
  display: block;
  text-align: left;
  margin-bottom: 14px;
}

.field span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.field input {
  width: 100%;
  padding: 11px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255,79,163,0.15);
}

#gate-submit {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--pink), var(--magenta));
  color: #180014;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 8px 24px rgba(255,79,163,0.25);
}

#gate-submit:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(255,79,163,0.4); }
#gate-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.error {
  color: var(--danger);
  font-size: 0.82rem;
  margin: 12px 0 0;
}

.fine-print {
  margin: 20px 0 0;
  font-size: 0.68rem;
  color: var(--text-dim);
  opacity: 0.7;
  letter-spacing: 0.02em;
}

/* ---------- Chat screen ---------- */
.chat-screen {
  height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 8, 16, 0.8);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 3;
}

.header-left { display: flex; align-items: center; gap: 12px; }

.header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--pink);
  box-shadow: 0 0 14px rgba(255,79,163,0.4);
  transition: box-shadow 0.3s;
}

.header-title {
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  font-size: 0.62rem;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(255,79,163,0.15);
  border: 1px solid rgba(255,79,163,0.4);
  color: var(--pink-bright);
  letter-spacing: 0.04em;
  text-transform: none;
  font-weight: 600;
}

.header-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  text-transform: uppercase;
  transition: border-color 0.15s, color 0.15s;
}
.ghost-btn:hover { border-color: var(--pink); color: var(--pink-bright); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg { display: flex; gap: 10px; max-width: 100%; }
.msg-user { justify-content: flex-end; }
.msg-suz { justify-content: flex-start; align-items: flex-end; }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--pink);
  flex-shrink: 0;
}

.bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 78%;
}

.msg-user .bubble {
  background: linear-gradient(135deg, rgba(255,79,163,0.22), rgba(209,59,214,0.18));
  border: 1px solid rgba(255,79,163,0.35);
  border-bottom-right-radius: 4px;
  color: #ffe8f4;
}

.msg-suz .bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg-typing .bubble { padding: 12px 16px; display: flex; gap: 4px; align-items: center; }
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--pink);
  animation: bounce 1.2s infinite ease-in-out;
}
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* ---------- Escalation card ---------- */
.escalation-card {
  background: linear-gradient(180deg, rgba(255,79,163,0.07), var(--card));
  border: 1px solid rgba(255,79,163,0.4);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 14px 16px;
  max-width: 85%;
  box-shadow: 0 0 24px rgba(255,79,163,0.08);
}

.escalation-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.escalation-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--pink-bright);
  background: rgba(255,79,163,0.15);
  border: 1px solid rgba(255,79,163,0.4);
  padding: 3px 8px;
  border-radius: 6px;
}

.urgency-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}
.urgency-low { color: var(--text-dim); background: rgba(255,255,255,0.05); border: 1px solid var(--border); }
.urgency-normal { color: var(--cyan); background: rgba(77,232,224,0.1); border: 1px solid rgba(77,232,224,0.35); }
.urgency-high { color: var(--danger); background: rgba(255,92,92,0.1); border: 1px solid rgba(255,92,92,0.4); }

.escalation-field { margin-bottom: 10px; }
.field-label {
  display: block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 3px;
}
.field-value { margin: 0; font-size: 0.88rem; line-height: 1.4; }
.field-value.steps { font-family: inherit; white-space: pre-wrap; }

.escalation-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.copy-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.copy-btn:hover { border-color: var(--pink); background: rgba(255,79,163,0.1); }
.copy-btn.copied { border-color: var(--ok); color: var(--ok); }

.ticket-link {
  background: linear-gradient(135deg, var(--pink), var(--magenta));
  color: #180014;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.transcript-details { margin-top: 10px; }
.transcript-details summary {
  cursor: pointer;
  font-size: 0.74rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.transcript-text {
  margin-top: 8px;
  max-height: 220px;
  overflow-y: auto;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.76rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text-dim);
}

/* ---------- Input row ---------- */
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px 18px;
  border-top: 1px solid var(--border);
  background: rgba(18, 8, 16, 0.9);
}

#chat-input {
  flex: 1;
  resize: none;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  max-height: 140px;
  transition: border-color 0.15s;
}
#chat-input:focus { border-color: var(--pink); }

#send-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--pink), var(--magenta));
  color: #180014;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(255,79,163,0.3);
  transition: transform 0.1s;
}
#send-btn:hover { transform: scale(1.05); }
#send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--pink); }

@media (max-width: 480px) {
  :root { font-size: 15px; }
  .bubble, .escalation-card { max-width: 88%; }
}
