:root {
  --bg0: #050816;
  --bg1: #020617;
  --card: rgba(2, 6, 23, 0.92);
  --card2: rgba(10, 12, 28, 0.82);
  --text: #e5e7eb;
  --muted: #93a4bf;
  --accent: #00f2ff;
  --accent2: #6ee7ff;
  --kor: #8b5cf6;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --radius: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at top, rgba(0, 242, 255, 0.14) 0%, rgba(0, 242, 255, 0) 55%),
    radial-gradient(circle at bottom right, rgba(139, 92, 246, 0.12) 0%, rgba(139, 92, 246, 0) 60%),
    radial-gradient(circle at top, #141827 0, var(--bg0) 55%, var(--bg1) 100%);
  color: var(--text);
}

.kor-shell {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 16px;
}

.kor-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.kor-title {
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-weight: 900;
  color: var(--accent);
  font-size: 1.35rem;
  text-shadow: 0 0 18px rgba(0, 242, 255, 0.65);
}

.kor-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.kor-card {
  background: radial-gradient(circle at top left, rgba(0, 242, 255, 0.18), transparent 55%), var(--card);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 18px 52px rgba(5, 10, 25, 0.85);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(18px);
}

.kor-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.kor-gap {
  height: 12px;
}

.kor-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.kor-input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(2, 6, 23, 0.72);
  color: var(--text);
  outline: none;
}

.kor-input:focus {
  border-color: rgba(0, 242, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(0, 242, 255, 0.12);
}

.kor-btn {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.12s ease, background 0.12s ease, opacity 0.12s ease;
  user-select: none;
  -webkit-user-select: none;
}

.kor-btn:hover {
  border-color: rgba(0, 242, 255, 0.55);
}

.kor-btn:active {
  transform: translateY(1px);
}

.kor-btn-primary {
  border-color: rgba(0, 242, 255, 0.5);
  background: linear-gradient(135deg, rgba(0, 242, 255, 0.18), rgba(139, 92, 246, 0.18));
}

.kor-btn-kor {
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(139, 92, 246, 0.14);
}

.kor-btn-mic {
  min-width: 54px;
  min-height: 54px;
  padding: 0;
  border-radius: 16px;
  display: grid;
  place-items: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.kor-mic-icon {
  width: 22px;
  height: 22px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cline x1='12' y1='19' x2='12' y2='23'/%3E%3Cline x1='8' y1='23' x2='16' y2='23'/%3E%3C/svg%3E")
    center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cline x1='12' y1='19' x2='12' y2='23'/%3E%3Cline x1='8' y1='23' x2='16' y2='23'/%3E%3C/svg%3E")
    center/contain no-repeat;
}

.kor-page-chat {
  padding-bottom: 90px; /* espace sous la barre fixe */
}

.kor-chat-wrap {
  height: calc(100vh - 140px);
  min-height: 360px;
  overflow: auto;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.25);
  margin-bottom: 12px;
}

.kor-message {
  margin: 10px 0;
  display: flex;
}

.kor-message-bubble {
  max-width: 76%;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.55);
}

.kor-message-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.kor-message-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.35;
}

.kor-message-me {
  justify-content: flex-end;
}

.kor-message-me .kor-message-bubble {
  border-color: rgba(0, 242, 255, 0.4);
  background: rgba(0, 242, 255, 0.1);
}

.kor-message-bot .kor-message-bubble {
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.11);
}

.kor-bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 14px max(14px, env(safe-area-inset-bottom, 0));
  background: linear-gradient(to top, rgba(5, 8, 22, 0.95), rgba(5, 8, 22, 0.65), rgba(5, 8, 22, 0));
}

.kor-bottom-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.kor-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.kor-status {
  color: var(--muted);
  font-size: 0.85rem;
}

.kor-composer {
  flex: 1;
  min-width: 0;
}

.kor-textarea {
  width: 100%;
  min-height: 54px;
  max-height: 140px;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(2, 6, 23, 0.72);
  color: var(--text);
  outline: none;
}

.kor-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.kor-hidden {
  display: none !important;
}

.kor-mic-listening {
  border-color: rgba(251, 113, 133, 0.65);
  background: rgba(251, 113, 133, 0.12);
  color: #ffe4e6;
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.15);
  animation: kor-mic-pulse 1.1s ease-in-out infinite;
}

@keyframes kor-mic-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.03);
    opacity: 0.8;
  }
}

/* Mobile : version très simple */
@media (max-width: 640px) {
  .kor-shell {
    padding: 18px 12px 18px;
  }

  .kor-chat-wrap {
    height: calc(100vh - 170px);
    min-height: 320px;
    padding: 10px;
  }

  .kor-message-bubble {
    max-width: 92%;
  }

  .kor-toolbar {
    gap: 8px;
  }

  .kor-btn-mic {
    min-width: 50px;
    min-height: 50px;
    border-radius: 14px;
  }
}

