/* Tokens and bubble shapes come from docs/ui-prototype.html, so the page looks
   like the app it offers. Light is the base; dark follows the system. */
:root {
  --bg: rgba(255, 255, 255, .82);
  --ch-bg: rgba(248, 248, 252, .82);
  --txt: #1a1a2e;
  --txt2: #64748b;
  --brd: rgba(0, 0, 0, .08);
  --hov: rgba(0, 0, 0, .05);
  --acc: #7c6cf8;
  --on-acc: #fff;
  --msg-in: rgba(0, 0, 0, .07);
  --wall: linear-gradient(140deg, #dfe4f5 0%, #eef1fb 45%, #e4dcf6 100%);
  --rise: cubic-bezier(.22, .9, .28, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: rgba(18, 18, 30, .82);
    --ch-bg: rgba(15, 15, 25, .82);
    --txt: #e4e4f2;
    --txt2: #8b93a3;
    --brd: rgba(255, 255, 255, .07);
    --hov: rgba(255, 255, 255, .05);
    --msg-in: rgba(255, 255, 255, .09);
    --wall:
      radial-gradient(ellipse at 12% 12%, rgba(139, 92, 246, .5) 0%, transparent 50%),
      radial-gradient(ellipse at 88% 82%, rgba(6, 182, 212, .38) 0%, transparent 50%),
      radial-gradient(ellipse at 70% 20%, rgba(236, 72, 153, .28) 0%, transparent 42%),
      linear-gradient(140deg, #08071c 0%, #101233 52%, #071a2e 100%);
  }
}

* { box-sizing: border-box; }

html { background: #101233; }

body {
  margin: 0;
  min-height: 100dvh;
  padding: 32px 16px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: var(--wall) fixed center / cover;
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.win {
  width: 100%;
  max-width: 640px;
  border: 1px solid var(--brd);
  border-radius: 18px;
  background: var(--bg);
  -webkit-backdrop-filter: blur(26px);
  backdrop-filter: blur(26px);
  box-shadow: 0 24px 70px rgba(5, 5, 25, .28);
  overflow: hidden;
  animation: viewIn .38s var(--rise);
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px) scale(.994); }
  to { opacity: 1; transform: none; }
}

.ch {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--brd);
  background: var(--ch-bg);
}

.ch-logo { border-radius: 10px; flex-shrink: 0; }

.ch-av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--acc);
  color: var(--on-acc);
  font-weight: 700;
  transition: background .2s, color .2s;
}

.ch-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ch-sub { font-size: 12px; color: var(--txt2); line-height: 1.25; }

.msgs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 22px;
}

.m {
  max-width: 86%;
  padding: 9px 14px;
  border-radius: 16px;
  animation: mIn .24s ease backwards;
}

/* The conversation arrives once, on load, the way a chat fills in. */
.msgs > :nth-child(2) { animation-delay: .1s; }
.msgs > :nth-child(3) { animation-delay: .16s; }
.msgs > :nth-child(4) { animation-delay: .24s; }
.msgs > :nth-child(5) { animation-delay: .3s; }
.msgs > :nth-child(n + 6) { animation-delay: .36s; }

@keyframes mIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.m.in {
  align-self: flex-start;
  background: var(--msg-in);
  border-bottom-left-radius: 5px;
}

.m.out {
  align-self: flex-end;
  margin-top: 8px;
  background: var(--acc);
  color: var(--on-acc);
  border-bottom-right-radius: 5px;
  transition: background .2s, color .2s;
}

/* The one loud thing: the first message says what this is at the size of a headline. */
.lead { max-width: 100%; padding: 16px 20px; }

.lead h1 {
  margin: 0;
  font-size: clamp(24px, 5.2vw, 34px);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -.025em;
}

.m-file {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  padding: 11px 12px;
  color: inherit;
  text-decoration: none;
  transition: background .15s, transform .2s var(--rise);
}

.m-file:hover { background: var(--hov); transform: translateY(-1px); }
.m-file:hover .m-file-go { filter: brightness(1.08); }

.m-file-ico {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--acc);
  color: var(--on-acc);
  font-size: 11px;
  font-weight: 800;
  transition: background .2s, color .2s;
}

.m-file-t { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.m-file-n { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.m-file-s { font-size: 12.5px; color: var(--txt2); }

.m-file-go {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--acc);
  color: var(--on-acc);
  font-size: 14px;
  font-weight: 700;
  transition: background .2s, color .2s, filter .15s;
}

.others {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0 0 0 4px;
  font-size: 12.5px;
  animation: mIn .24s ease backwards;
}

.others a { color: var(--txt2); text-underline-offset: 2px; }
.others a:hover { color: var(--txt); }

.parts { margin: 0; }
.parts dt { font-weight: 700; }
.parts dd { margin: 0 0 9px; }
.parts dd:last-child { margin-bottom: 0; }

.acc-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; }
.acc-row:empty { display: none; }

.acc-dot {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}

.acc-dot:hover { transform: scale(1.12); }
.acc-dot.sel { border-color: var(--txt); box-shadow: 0 0 0 3px var(--hov); }

.acc-dot[data-accent='#7c6cf8'] { background: #7c6cf8; }
.acc-dot[data-accent='#6366f1'] { background: #6366f1; }
.acc-dot[data-accent='#06b6d4'] { background: #06b6d4; }
.acc-dot[data-accent='#ec4899'] { background: #ec4899; }
.acc-dot[data-accent='#10b981'] { background: #10b981; }
.acc-dot[data-accent='#f59e0b'] { background: #f59e0b; }

.m-act {
  margin-top: 9px;
  padding: 7px 13px;
  border: 1px solid var(--brd);
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .15s;
}

.m-act:hover { background: var(--hov); }
.m-act:active { transform: scale(.97); }

/* The page starts without an answer, so a wrong address never flashes a name. */
.if-no-user { display: none; }
.no-user .has-user { display: none; }
.no-user .if-no-user { display: block; }

:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

@media (max-width: 480px) {
  body { padding: 12px; }
  .m { max-width: 94%; }
  .m-file { flex-wrap: wrap; }
  .m-file-t { flex-basis: calc(100% - 54px); }
  .m-file-go { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
