:root {
  /* Palette Midnight (actée) — référence docs/design-reference/ */
  --paper: #f5f0ff;
  --paper-shade: #e8e0ff;
  --ink: #0a0820;
  --ink-soft: #4a3f7a;
  --accent: #6b5cff;
  --accent-soft: #dfd9ff;
  --accent-ink: #3a2bb8;
  --accent-2: #ff6b9d;
  --accent-2-soft: #ffd6e3;
  --line: rgba(10, 8, 32, 0.18);
  --shadow: 3px 3px 0 var(--ink);
  --radius: 10px;
  --font-hand: "Patrick Hand", "Caveat", system-ui, sans-serif;
  --font-script: "Caveat", "Patrick Hand", cursive;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 14% 18%, rgba(107, 92, 255, 0.06) 0, transparent 38%),
    radial-gradient(circle at 92% 78%, rgba(255, 107, 157, 0.05) 0, transparent 42%),
    repeating-linear-gradient(
      transparent 0,
      transparent 31px,
      rgba(10, 8, 32, 0.06) 32px
    );
  color: var(--ink);
  font-family: var(--font-hand);
  font-size: 19px;
  line-height: 1.5;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1.5px dashed var(--line);
  padding-bottom: 18px;
  margin-bottom: 22px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
}

.bottle {
  width: 38px;
  height: 56px;
  color: var(--accent);
}

.brand h1 {
  font-family: var(--font-script);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 0;
  line-height: 1;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 16px;
  color: var(--ink-soft);
  font-style: italic;
}

.agent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper-shade);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 8px 14px;
  box-shadow: var(--shadow);
}

.agent-card strong {
  display: block;
  font-size: 18px;
}

.agent-role {
  font-size: 14px;
  color: var(--ink-soft);
}

.agent-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 69, 110, 0.18);
}

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

.msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}

.msg-author {
  font-family: var(--font-script);
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0 6px 4px;
}

.msg-bubble {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  padding: 12px 16px;
  white-space: pre-wrap;
  box-shadow: 2px 2px 0 var(--ink);
}

.msg-awa {
  align-self: flex-start;
}

.msg-awa .msg-bubble {
  background: #fff;
}

.msg-user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-user .msg-author {
  color: var(--accent);
}

.msg-user .msg-bubble {
  background: rgba(232, 164, 184, 0.4);
  border-color: var(--accent);
  box-shadow: 2px 2px 0 var(--accent);
}

.msg-thinking .msg-bubble {
  font-style: italic;
  color: var(--ink-soft);
  background: transparent;
  border-style: dashed;
  box-shadow: none;
}

.msg-error .msg-bubble {
  background: #fff0e6;
  border-color: #b8460e;
  color: #6b2607;
  box-shadow: 2px 2px 0 #b8460e;
  font-size: 16px;
}

.composer {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  border-top: 1.5px dashed var(--line);
  padding-top: 16px;
  margin-top: 8px;
}

#input {
  flex: 1;
  font-family: var(--font-hand);
  font-size: 19px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 12px 14px;
  resize: none;
  max-height: 160px;
  box-shadow: var(--shadow);
  outline: none;
}

#input:focus {
  border-color: var(--accent);
  box-shadow: 3px 3px 0 var(--accent);
}

#send {
  font-family: var(--font-script);
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

#send:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

#send:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

#send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow);
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
}

.link-btn {
  font-family: var(--font-hand);
  font-size: 15px;
  color: var(--ink-soft);
  background: none;
  border: none;
  border-bottom: 1.5px dashed var(--ink-soft);
  cursor: pointer;
  padding: 0 1px 1px;
}

.link-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

@media (max-width: 540px) {
  .page { padding: 20px 16px 60px; }
  .header { flex-direction: column; align-items: flex-start; }
  .msg { max-width: 92%; }
  .brand h1 { font-size: 30px; }
}
