/* ============================================================
   DOLPHIN.pentest — neon-noir chat UI
   ============================================================ */

:root {
  --bg-0: #050507;
  --bg-1: #0c0c12;
  --bg-2: #16161e;
  --line: rgba(255, 38, 64, 0.18);
  --line-2: rgba(255, 38, 64, 0.4);
  --accent: #ff2640;
  --accent-glow: rgba(255, 38, 64, 0.55);
  --accent-soft: rgba(255, 38, 64, 0.08);
  --text: #e8e8ec;
  --text-dim: #8a8a96;
  --text-faint: #4a4a55;
  --ok: #2bff88;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --display: 'Rajdhani', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  /* фон близкий к серому студийному фону видео, с лёгким red glow → matches character backdrop */
  background:
    radial-gradient(ellipse 50% 70% at 25% 50%, #6e6e76 0%, #4d4d54 60%, #2a2a30 100%);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* === Character video stage ============================================ */

.char-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.char {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 30% center; /* shift character slightly left so chat right doesn't cover */
  opacity: 0;
  transition: opacity 0.45s ease;
  filter: contrast(1.08) saturate(1.1);
}

.char.active { opacity: 1; }

/* gradient overlay: subtle dim left → strong dark wall on right for chat readability */
.char-vignette {
  position: absolute;
  inset: 0;
  background:
    /* gentle red haze for cyberpunk feel */
    radial-gradient(ellipse 40% 60% at 30% 55%, rgba(255, 38, 64, 0.10) 0%, transparent 70%),
    /* fade to dark on right side where chat panel is */
    linear-gradient(90deg, transparent 35%, rgba(5, 5, 7, 0.45) 60%, rgba(5, 5, 7, 0.85) 100%);
  pointer-events: none;
}

/* === Chat panel ======================================================= */

.chat-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 42vw);
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(12, 12, 18, 0.62) 0%, rgba(5, 5, 7, 0.85) 100%);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-left: 1px solid var(--line);
  box-shadow: -40px 0 80px -20px rgba(0, 0, 0, 0.6);
}

.chat-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.logo {
  color: var(--accent);
  font-size: 22px;
  text-shadow: 0 0 12px var(--accent-glow);
  animation: logo-pulse 2.4s ease-in-out infinite;
}

@keyframes logo-pulse {
  0%, 100% { text-shadow: 0 0 12px var(--accent-glow); }
  50%      { text-shadow: 0 0 22px var(--accent), 0 0 6px var(--accent); }
}

.brand-name { color: var(--text); }
.accent { color: var(--accent); }

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 0 currentColor;
}
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* === Messages ========================================================= */

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px 22px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

.msg { display: flex; }
.msg-user { justify-content: flex-end; }
.msg-bot, .msg-system { justify-content: flex-start; }

.bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.55;
}

.msg-user .bubble {
  background: rgba(255, 38, 64, 0.13);
  border: 1px solid rgba(255, 38, 64, 0.32);
  color: var(--text);
}

.msg-bot .bubble {
  background: rgba(20, 20, 26, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.msg-system .bubble {
  background: transparent;
  border: 1px dashed var(--line-2);
  color: var(--text-dim);
  font-size: 11.5px;
  font-style: italic;
}

.who {
  display: block;
  font-size: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  font-weight: 700;
}

/* typing indicator */
.typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* === Input row ======================================================== */

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.25);
}

.prompt-prefix {
  color: var(--accent);
  font-weight: 700;
  font-size: 18px;
  line-height: 38px;
  user-select: none;
  text-shadow: 0 0 8px var(--accent-glow);
}

#input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  padding: 9px 0;
  resize: none;
  max-height: 200px;
  caret-color: var(--accent);
}
#input::placeholder { color: var(--text-faint); }

#sendBtn {
  background: var(--accent);
  border: none;
  color: #fff;
  width: 38px; height: 38px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
#sendBtn:hover  { box-shadow: 0 0 18px var(--accent-glow); transform: translateY(-1px); }
#sendBtn:active { transform: translateY(0); }
#sendBtn:disabled {
  background: var(--bg-2);
  color: var(--text-faint);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* === Footer =========================================================== */

.chat-foot {
  padding: 8px 22px 10px;
  font-size: 10px;
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.admin-link {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}
.admin-link:hover { color: var(--accent); }

/* === Responsive ======================================================= */

@media (max-width: 900px) {
  /* layout: персонаж сверху 38vh, чат снизу 62vh */
  .char-stage {
    height: 38vh;
    inset: auto;
    top: 0; left: 0; right: 0;
  }

  .char {
    object-position: 50% 25%; /* лицо в верхней трети */
  }

  .char-vignette {
    background:
      radial-gradient(ellipse 60% 80% at 50% 40%, rgba(255, 38, 64, 0.12) 0%, transparent 70%),
      linear-gradient(180deg, transparent 0%, transparent 60%, rgba(5, 5, 7, 0.85) 100%);
  }

  .chat-panel {
    width: 100%;
    height: 62vh;
    top: auto;
    bottom: 0;
    border-left: none;
    border-top: 1px solid var(--line);
    box-shadow: 0 -30px 60px -10px rgba(0, 0, 0, 0.7);
    background: linear-gradient(180deg, rgba(12, 12, 18, 0.85) 0%, rgba(5, 5, 7, 0.97) 100%);
  }

  .chat-head { padding: 12px 16px; }
  .brand { font-size: 16px; }
  .messages { padding: 14px 16px 10px; gap: 10px; }
  .bubble { font-size: 13px; padding: 9px 12px; }
  .input-row { padding: 10px 16px; gap: 8px; }
  .chat-foot { padding: 6px 16px 8px; }
}

/* === Small phones (iPhone SE etc) ===================================== */

@media (max-width: 480px) {
  .char-stage { height: 32vh; }
  .chat-panel { height: 68vh; }
  .brand { font-size: 15px; }
  .meta { font-size: 10px; }
}
