/* Heavenly Key AI Assistance — display fixes (20 Nov 2026, hour 2;
 * form-in-view fix hour 5).
 * Display only: the chat backend is a separate Worker, untouched.
 * Header stays navy #11245b; the heading is white and the home link is
 * gold #ffe29b, both passing WCAG AA (4.5:1) on the navy header.
 * Approved colours only: pink magenta #b40059, bright blues, gold, white. */
*{box-sizing:border-box}
body{margin:0;background:#f3f5fa;color:#17233b;font:16px/1.6 system-ui,sans-serif}
/* Hour-5 fix: hour 2 set min-height:100dvh on body and flex:1 down the
 * chain, but a min-height is a floor, not a cap — the live body measured
 * 2399.5px tall (footer below main), so nothing ever constrained the chat
 * and #messages grew to its content instead of scrolling. main now has a
 * DEFINITE height — the viewport minus the 53px app-switcher bar above it
 * (summary min-height 52px + 1px border-bottom, app-switcher.css) — with
 * flex:none so the height is not overridden by a flex-basis. The flex
 * chain below it (chat flex:1, #messages flex:1 + min-height:0 +
 * overflow:auto) then has a real budget to distribute, and the question
 * form (flex-shrink:0) stays pinned at the bottom of the first viewport.
 * The 50px injected cross-app nav (hk-cross-app-nav.js inserts it after
 * <header>; summary 48px + 2px borders) is inside main, so the flex chain
 * absorbs it automatically — do not hard-code around it. */
body{display:flex;flex-direction:column;min-height:100vh;min-height:100dvh}
main{max-width:800px;width:100%;margin:auto;padding:24px;display:flex;flex-direction:column;flex:none;height:calc(100vh - 53px);height:calc(100dvh - 53px);min-height:0}
header{background:#11245b;color:white;padding:26px;border-radius:20px}
/* Family theme (loaded AFTER this file) paints every h1 #144D87 and every
 * link #007BD9 — nearly invisible on this navy header. These
 * assistant-scoped selectors outrank it (0-2-3 and 0-3-3 beat 0-1-2/0-2-2)
 * without touching the shared family-theme file. */
body.hk-account5-family header.assistant-header h1{color:#fff}
body.hk-account5-family header.assistant-header a.assistant-home-link{color:#ffe29b}
/* Header row: home link + photo + heading, with a real gap between them. */
header.assistant-header{display:flex;flex-wrap:wrap;align-items:center;gap:12px 16px}
header.assistant-header h1{flex:1 1 12rem;margin:0;line-height:1.2}
header.assistant-header a.assistant-home-link{flex-shrink:0}
header.assistant-header img.assistant-photo{flex-shrink:0;border-radius:12px}
header.assistant-header p{flex:1 1 100%;margin:0}
header.assistant-header .hk-site-share-button{flex-shrink:0}
h1{line-height:1.2}
.chat{background:white;border:1px solid #dce2ef;border-radius:20px;margin-top:18px;padding:22px;display:flex;flex-direction:column;flex:1;min-height:0}
/* No min-height floor on the message list: the old 200px floor, counted
 * with the 50px injected cross-app nav, overflowed 1280x800 by 85px. The
 * list scrolls internally instead (flex:1 + min-height:0 + overflow:auto
 * inside the definite-height main). */
#messages{flex:1 1 auto;min-height:0;overflow:auto}
.message{white-space:pre-wrap;overflow-wrap:anywhere;padding:14px;border-radius:12px;background:#edf2ff;margin:12px 0}
.user{background:#f3f4f7}
label{display:block;font-weight:600}
textarea{width:100%;padding:14px;font:inherit;border:1px solid #8896ad;border-radius:12px;resize:vertical}
#chat{flex-shrink:0}
#chat #status{margin:4px 0}
button{max-width:100%;overflow-wrap:anywhere;padding:13px 22px;border:0;border-radius:12px;background:#1746c9;color:white;font:inherit;cursor:pointer}
button:disabled{opacity:.6}
button:focus-visible,a:focus-visible,textarea:focus-visible{outline:3px solid #d7a52e;outline-offset:3px}
#status{min-height:26px;color:#7a2030}
.note{font-size:16px;color:#53617a}
@media(max-width:500px){
  main{padding:12px}
  /* Compact the header and chat card on a phone so the message list keeps
   * room to show the greeting: header padding 18->12, gap 10->8, chat
   * padding 18->14, note margin 10->8 (28px back to #messages at 360x740). */
  header{padding:12px}
  .chat{padding:14px}
  header.assistant-header{gap:8px 12px}
  header.assistant-header img.assistant-photo{width:48px;height:48px}
  header.assistant-header h1{font-size:32px}
  .chat{margin-top:12px}
  #messages{min-height:0}
  .note{margin:0 0 8px}
  textarea{height:68px}
  button{padding:11px 22px}
  #chat #status{margin:2px 0}
}
