@import url(fonts.css);
:root {
  --blue: var(--gold);
  --ink: var(--white);
  --muted: var(--lavender);
  --bg: var(--navy);
  --bar: #081524;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body.chat {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header, like a phone chat */
.bar {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 8px) 6px 8px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.back, .menu-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  color: var(--blue); background: none; border: 0; border-radius: 22px; cursor: pointer;
}
.back:focus-visible, .menu-btn:focus-visible { outline: 2px solid var(--blue); }
.who { text-align: center; line-height: 1.15; }
.who img { width: 44px; height: 44px; border-radius: 50%; display: block; margin: 0 auto 3px; }
.name { font-weight: 600; font-size: 15px; }
.name span { color: var(--gold); }
.status { font-size: 12px; color: #5fd38a; display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #34c759; }
.menu {
  position: absolute; right: 10px; top: calc(100% - 6px); z-index: 5;
  background: var(--navy-2); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.4);
  min-width: 170px; padding: 6px; display: flex; flex-direction: column;
}
.menu[hidden] { display: none; }
.menu button {
  font: 15px var(--font); text-align: left; padding: 11px 12px; border: 0; background: none;
  border-radius: 8px; color: var(--ink); cursor: pointer;
}
.menu button:hover, .menu button:focus-visible { background: var(--navy-3); outline: none; }

/* Messages */
.log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior: contain;
}
.row { display: flex; flex-direction: column; max-width: 100%; animation: pop .22s ease-out; }
.row.me { align-items: flex-end; }
.row.jesus { align-items: flex-start; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.bubble {
  max-width: min(78%, 520px);
  padding: 9px 14px 10px;
  border-radius: 20px;
  font: 17px/1.32 var(--font);
  text-align: left;
  border: 0;
  overflow-wrap: anywhere;
}
.me .bubble { background: var(--navy-3); color: #fff; border-bottom-right-radius: 6px; }
.jesus .bubble { background: var(--gold); color: var(--navy); font-weight: 500; border-bottom-left-radius: 6px; cursor: pointer; }
.jesus button.bubble:active { filter: brightness(.95); }
.jesus button.bubble:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.text { display: block; }
.ref { display: block; margin-top: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); opacity: .85; }
.note {
  max-width: min(86%, 560px); margin-top: 6px; padding: 10px 13px;
  background: var(--navy-2); border: 1px solid var(--line); border-radius: 14px;
  font-size: 14.5px; line-height: 1.4; color: var(--lavender);
}
.note a { color: var(--gold); font-weight: 700; }
.typing { display: inline-flex; gap: 5px; padding: 13px 16px; cursor: default; }
.typing { background: var(--navy-3) !important; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--lavender); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

/* Suggestions */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 12px 10px; flex: none; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips[hidden] { display: none; }
.chip {
  flex: none; font: 500 15px var(--font); color: var(--gold); background: transparent;
  border: 1.5px solid var(--line); border-radius: 18px; padding: 8px 14px; cursor: pointer;
}
.chip:hover { background: var(--navy-2); border-color: var(--gold); }

/* Input */
.composer {
  display: flex; gap: 8px; align-items: center; flex: none;
  padding: 8px 10px calc(env(safe-area-inset-bottom) + 10px);
  background: var(--bar); border-top: 1px solid var(--line);
}
.composer input {
  flex: 1; min-width: 0; font: 17px var(--font); padding: 9px 15px;
  border: 1px solid var(--navy-3); border-radius: 20px; background: var(--navy-2); color: var(--white);
}
.composer input::placeholder { color: #8d99c4; }
.composer input:focus { outline: none; border-color: var(--blue); }
.composer button {
  width: 36px; height: 36px; border-radius: 50%; border: 0; flex: none;
  background: var(--gold); color: var(--navy); display: grid; place-items: center; cursor: pointer;
}
.composer button:disabled { background: var(--navy-3); color: #8d99c4; cursor: default; }

/* Dialogs */
.sheet {
  border: 0; border-radius: 18px; padding: 22px 22px 18px; max-width: min(420px, 92vw);
  font: 16px/1.45 var(--font); color: var(--white); background: var(--navy-2); box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.sheet::backdrop { background: rgba(5,10,25,.6); }
.sheet h2 { margin: 0 0 10px; font-size: 20px; }
.sheet p, .sheet ol { margin: 0 0 10px; }
.sheet .small { font-size: 13px; color: var(--muted); }
.primary {
  font: 700 16px var(--font); color: var(--navy); background: var(--gold); border: 0;
  border-radius: 12px; padding: 12px 18px; width: 100%; margin-top: 6px; cursor: pointer;
}
[hidden] { display: none !important; }
.as-btn {
  display: block; text-align: center; text-decoration: none; box-sizing: border-box;
  font: 700 16px var(--font); border-radius: 12px; padding: 13px 18px; width: 100%; margin-top: 8px;
}
a.primary.as-btn { color: var(--navy); background: var(--gold); }
.secondary.as-btn { color: var(--white); border: 1.5px solid var(--line); }
.plain { font: 600 15px var(--font); color: var(--lavender); background: none; border: 0; width: 100%; padding: 12px; margin-top: 4px; cursor: pointer; }
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 84px); transform: translateX(-50%);
  background: var(--gold); color: var(--navy); font-weight: 600; padding: 9px 16px; border-radius: 18px; font: 14px var(--font);
}
.toast[hidden] { display: none; }

/* "Full verse" link under an answer */
.full-btn {
  margin: 4px 0 0 10px; padding: 4px 2px; border: 0; background: none; cursor: pointer;
  font: 600 13px var(--font); color: var(--gold); opacity: .9;
}
.full-btn:hover { text-decoration: underline; }
.full-btn:focus-visible { outline: 2px solid var(--gold); border-radius: 6px; }

/* Bible passage card */
.bubble.passage {
  background: var(--navy-2); color: var(--white); border: 1px solid var(--line);
  max-width: min(88%, 620px); border-bottom-left-radius: 6px; cursor: default; font-size: 16px; line-height: 1.5;
}
.p-title { font-weight: 700; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.passage p { margin: 0 0 6px; color: var(--lavender); }
.passage p.hi { color: var(--white); font-weight: 500; }
.passage sup { color: var(--gold); font-size: 10.5px; font-weight: 700; margin-right: 1px; }
.p-note { font-size: 13px; color: #8fa0bd; margin-top: 6px; }
.link-btn { margin-top: 6px; padding: 2px 0; border: 0; background: none; color: var(--gold); font: 600 13px var(--font); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) { .row, .typing i { animation: none; } }
