/* The chat bubble that grows into the page: the home screen of a made-up banking app (Larkway) on a soft grey page.
   The round help bubble grows like a liquid until it fills the screen and becomes the help chat. */
:root {
  --page: #eceae6;          /* the page around the phone */
  --page-light: #f7f6f3;    /* the soft light on the page */
  --app: #fbfaf8;           /* the home screen */
  --card: #ffffff;          /* the cards of the home screen */
  --ink: #16161a;           /* the words */
  --muted: #84828a;         /* the small words */
  --line: rgba(22, 22, 26, 0.07); /* the hairlines */
  --accent: #3a37e8;        /* indigo: the bubble, the chat, the sent message */
  --accent-deep: #2a27c9;   /* the shade at the bottom of the bubble */
  --accent-soft: rgba(58, 55, 232, 0.1); /* the tint of the chips */
  --sheet: #ffffff;         /* the sheet of the chat */
  --bubble-in: #f2f1f6;     /* the messages from Mira */
  --app-w: min(420px, 92vw);   /* the width of the screen */
  --app-h: min(560px, 88vh);   /* the height of the screen */
  --fab: clamp(46px, 9.6vmin, 58px); /* the size of the bubble */
  --gap: clamp(12px, 3vmin, 18px);   /* the space between the bubble and the corner */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

html { font-size: clamp(11px, min(1.55vw, 2.6vh), 15px); }

body {
  background:
    radial-gradient(70% 60% at 50% 14%, var(--page-light), transparent 72%),
    var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
}

/* ---- the screen ---- */
.app {
  position: relative;
  width: var(--app-w);
  height: var(--app-h);
  border-radius: clamp(18px, 4.4vmin, 28px);
  background: var(--app);
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 0 0 1px rgba(22, 22, 26, 0.06),
    0 1px 2px rgba(22, 22, 26, 0.05),
    0 24px 48px -22px rgba(22, 22, 26, 0.28),
    0 60px 90px -60px rgba(58, 55, 232, 0.25);
}

.base {
  position: absolute;
  inset: 0;
  padding: 1.25rem 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.base__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; gap: 0.45rem; }
.brand__mark {
  width: 1.45rem;
  height: 1.45rem;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.7;
  stroke-linecap: round;
}
.brand__mark circle { fill: var(--accent); stroke: none; }
.brand__name { font-weight: 640; font-variation-settings: 'wdth' 108; letter-spacing: -0.01em; }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  flex: none;
}
.avatar--me { background: #e9e6df; color: #5b574e; }
.avatar--agent {
  background: #ffffff;
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22);
}

.hello { margin: 0.2rem 0 0; display: flex; flex-direction: column; }
.hello__small { color: var(--muted); font-size: 0.82rem; }
.hello__name { font-size: 1.6rem; font-weight: 600; font-variation-settings: 'wdth' 96; letter-spacing: -0.02em; line-height: 1.15; }

.balance {
  background: var(--card);
  border-radius: 1.1rem;
  padding: 1rem 1.1rem 1.05rem;
  box-shadow: 0 0 0 1px var(--line), 0 10px 22px -16px rgba(22, 22, 26, 0.2);
  display: grid;
  gap: 0.25rem;
}
.balance__label { color: var(--muted); font-size: 0.78rem; }
.balance__value { font-size: 1.85rem; font-weight: 620; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.balance__cents { color: var(--muted); font-size: 1.1rem; }
.balance__line { height: 4px; border-radius: 4px; background: #efedf6; overflow: hidden; margin-top: 0.4rem; }
.balance__fill { display: block; height: 100%; width: 62%; border-radius: inherit; background: var(--accent); }
.balance__note { color: var(--muted); font-size: 0.74rem; margin-top: 0.15rem; }

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--card);
  border-radius: 0.95rem;
  padding: 0.65rem 0.85rem;
  box-shadow: 0 0 0 1px var(--line);
}
.row__icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.65rem;
  background: #f3f2ef;
  display: grid;
  place-items: center;
  flex: none;
}
.row__icon svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: #4a4850; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.row__text { display: grid; flex: 1; min-width: 0; }
.row__text b { font-size: 0.86rem; font-weight: 600; }
.row__text small { color: var(--muted); font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__tag { font-size: 0.72rem; font-weight: 600; color: #b4541e; background: #fbeee5; padding: 0.22rem 0.55rem; border-radius: 999px; }
.row__amount { font-size: 0.84rem; font-variant-numeric: tabular-nums; }

/* ---- the liquid ---- */
.goo {
  position: absolute;
  inset: 0;
  z-index: 5;
  filter: url(#goo);
  pointer-events: none;
}
.blob, .drop {
  position: absolute;
  left: 0;
  top: 0;
  background: var(--accent);
  border-radius: 50%;
}
.blob { width: var(--fab); height: var(--fab); }
.drop { width: 1px; height: 1px; opacity: 0; }

.fab-shadow {
  position: absolute;
  z-index: 4;
  left: 0;
  top: 0;
  width: var(--fab);
  height: var(--fab);
  border-radius: 50%;
  box-shadow: 0 14px 22px -10px rgba(42, 39, 201, 0.55), 0 3px 6px -2px rgba(22, 22, 26, 0.25);
  pointer-events: none;
}

.fab {
  position: absolute;
  z-index: 20;
  right: var(--gap);
  bottom: var(--gap);
  width: var(--fab);
  height: var(--fab);
  border-radius: 50%;
  display: grid;
  place-items: center;
}
/* a soft light on the top of the bubble, over the liquid, and a hairline of light on its rim */
.fab__light {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(60% 50% at 40% 24%, rgba(255, 255, 255, 0.3), transparent 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -2px 4px rgba(20, 16, 120, 0.25);
  pointer-events: none;
}
.fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.fab__icon {
  grid-area: 1 / 1;
  width: 46%;
  height: 46%;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fab__icon--close { opacity: 0; }

/* ---- the chat ---- */
.chat {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  color: #fff;
  pointer-events: none;
  visibility: hidden;
}
.chat.is-open { pointer-events: auto; }

.chat__head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.25rem 4.2rem 1.15rem 1.25rem;
}
.chat__who { display: grid; }
.chat__who b { font-size: 0.95rem; font-weight: 620; }
.chat__who small { font-size: 0.74rem; color: rgba(255, 255, 255, 0.72); }
.chat__who small.is-typing {
  color: transparent;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.55) 0%, #fff 45%, rgba(255, 255, 255, 0.55) 90%) 0 0 / 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
}

.sheet {
  flex: 1;
  margin: 0 0.45rem 0.45rem;
  background: var(--sheet);
  color: var(--ink);
  border-radius: 1.15rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: 0 -10px 24px -18px rgba(10, 8, 80, 0.6);
}

.msgs {
  flex: 1;
  min-height: 0;
  padding: 1rem 0.95rem 0.6rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.6rem;
  overflow: hidden;
}

.msg {
  margin: 0;
  max-width: 82%;
  padding: 0.62rem 0.8rem;
  font-size: 0.84rem;
  line-height: 1.38;
  border-radius: 1rem;
}
.msg--in { background: var(--bubble-in); border-bottom-left-radius: 0.35rem; align-self: flex-start; }
.msg--out { background: var(--accent); color: #fff; border-bottom-right-radius: 0.35rem; align-self: flex-end; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font-size: 0.78rem;
  font-weight: 560;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  transition: background-color 0.2s, transform 0.2s;
}
.chip:active { transform: scale(0.96); }
@media (hover: hover) {
  .chip:hover { background: rgba(58, 55, 232, 0.16); }
}
.chip.is-hover { background: rgba(58, 55, 232, 0.16); }

.composer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0.6rem 0.6rem;
  padding: 0.35rem 0.35rem 0.35rem 0.85rem;
  border-radius: 999px;
  background: #f5f4f8;
  box-shadow: inset 0 0 0 1px var(--line);
}
.composer__field { flex: 1; color: var(--muted); font-size: 0.82rem; }
.composer__send {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  display: grid;
  place-items: center;
}
.composer__send svg { width: 1rem; height: 1rem; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- the pointer that plays by itself ---- */
.cursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 80;
  width: 22px;
  height: 22px;
  fill: #16161a;
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
  opacity: 0;
  pointer-events: none;
  transform-origin: 5px 3px;
}

.defs { position: absolute; }
