/* The chat that answers: a dark chat on a black page, my messages in blue. */
:root {
  --page: #000000;          /* the page */
  --panel: #0c0c0f;         /* the chat's box */
  --edge: #1d1d23;
  --them: #1e1e26;          /* her bubbles */
  --ink: #f1f1f5;
  --muted: #8a8a96;
  --accent: #4f7cff;        /* my bubbles */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mulish Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 12px;
}

.chat {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(390px, 100%);
  height: min(640px, calc(100svh - 48px));
  border: 1px solid var(--edge);
  border-radius: 30px;
  background: var(--panel);
  overflow: hidden;
}

/* ---------------------------------------------------------------- the head */
.chat__head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #17171c;
  background: var(--panel);
}

.chat__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f4b9a0;
  color: #2b120a;
  font-size: 17px;
  font-weight: 850;
}

.chat__name {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.chat__where {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------------------------------------------------------------- the thread */
.chat__thread {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 16px 14px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.chat__thread::-webkit-scrollbar {
  display: none;
}

.chat__log {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  min-height: 100%;
}

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

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

.msg--them {
  align-self: flex-start;
  align-items: flex-start;
}

/* a new speaker leaves a little more room */
.msg--me + .msg--them,
.msg--them + .msg--me {
  margin-top: 8px;
}

.msg__bubble {
  margin: 0;
  padding: 10px 14px 11px;
  border-radius: 19px;
  font-size: 15px;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.msg--me .msg__bubble {
  border-bottom-right-radius: 6px;
  background: var(--accent);
  color: #ffffff;
}

.msg--them .msg__bubble {
  border-bottom-left-radius: 6px;
  background: var(--them);
  color: #ececf2;
}

/* the copy of a message on its way to its place, above the thread */
.msg__fly {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  border-bottom-right-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  pointer-events: none;
}

/* the little bubble of someone writing: a line that writes itself */
.typing {
  display: grid;
  place-items: center;
  width: 62px;
  height: 40px;
  padding: 0;
}

.typing svg {
  width: 34px;
  height: 14px;
  fill: none;
  stroke: #a9a9b6;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.msg__status {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 5px 4px 0;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.msg__status svg {
  width: 16px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.msg__status.is-read {
  color: #8fb0ff;
}

/* ---------------------------------------------------------------- the suggestions */
.chat__quick {
  display: flex;
  gap: 8px;
  min-height: 46px;
  padding: 6px 12px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chat__quick::-webkit-scrollbar {
  display: none;
}

.quick {
  flex: none;
  padding: 8px 13px;
  border: 1px solid #2b2b35;
  border-radius: 999px;
  background: transparent;
  color: #dcdce6;
  font: 650 13.5px 'Mulish Variable', system-ui, sans-serif;
  cursor: pointer;
  transition: background-color 0.25s, border-color 0.25s;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .quick:hover {
    border-color: #3d3d4a;
    background: #15151b;
  }
}

/* ---------------------------------------------------------------- the composer */
.chat__composer {
  display: flex;
  gap: 8px;
  padding: 8px 12px 14px;
}

.chat__input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 18px;
  border: 1px solid #26262f;
  border-radius: 23px;
  background: #141419;
  color: var(--ink);
  font: 16px 'Mulish Variable', system-ui, sans-serif;
  outline: none;
  transition: border-color 0.25s;
}

.chat__input::placeholder {
  color: #6c6c78;
}

.chat__input:focus {
  border-color: #3a4f9a;
}

.chat__send {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  transition: background-color 0.25s, color 0.25s;
  -webkit-tap-highlight-color: transparent;
}

.chat__send:disabled {
  background: #1b1b22;
  color: #50505c;
  cursor: default;
}

.chat__send svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick:focus-visible,
.chat__send:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html[data-using='pointer'] .quick:focus-visible,
html[data-using='pointer'] .chat__send:focus-visible {
  outline: none;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
