/* SafetyBuddy AI Board — lives in the kitchen center column (ai.html). All classes ab-*. */
#aiBoard {
  --ab-bg: #0f172a;
  --ab-panel: #1e293b;
  --ab-ink: #e2e8f0;
  --ab-dim: #94a3b8;
  --ab-line: #334155;
  --ab-teal: var(--teal, #2dd4a8);
  --ab-gold: #fde047;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--ab-bg);
  color: var(--ab-ink);
  position: relative;
  font-size: 15px;
}
#aiBoard[hidden] { display: none !important; }
body.ab-on #muxThread,
body.ab-on #fsPathStrip,
body.ab-on #composer,
body.ab-on #composerAppendHint,
body.ab-on #chatViewBarMid,
body.ab-on #hobbLaunchStatus { display: none !important; }

.chat-view-bar__side.ab-toggle { border-color: #a16207; color: var(--ab-gold, #fde047); background: #2a2206; }
.chat-view-bar__side.ab-toggle:hover { border-color: #fde047; color: #fff; background: #3a3008; }
body.ab-on .chat-view-bar__side.ab-toggle { background: #fde047; color: #111; border-color: #fde047; }

.ab-head { flex: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--ab-line); background: #111827; }
.ab-q { flex: 1 1 240px; min-width: 0; padding: 9px 11px; border-radius: 10px; border: 1px solid #475569; background: #0b1220; color: #fff; font-size: 15px; font-family: inherit; }
.ab-btn { padding: 8px 11px; border-radius: 10px; border: 1px solid #475569; background: #334155; color: #fff; font-size: 13px; font-weight: 800; cursor: pointer; white-space: nowrap; font-family: inherit; }
.ab-btn:hover { border-color: #60a5fa; }
.ab-btn.ab-go { background: #2563eb; border-color: #2563eb; font-size: 14px; }
.ab-btn.on { background: #15803d; border-color: #22c55e; }
.ab-btn:disabled { opacity: .55; cursor: wait; }
.ab-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.ab-board { flex: 1; min-height: 0; position: relative; overflow-x: hidden; overflow-y: auto; isolation: isolate; }
.ab-empty { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; color: var(--ab-dim); font-size: 16px; text-align: center; padding: 24px; line-height: 1.5; }
.ab-empty b { color: var(--ab-ink); }

.ab-win { position: absolute; background: var(--ab-panel); border: 3px solid var(--c); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.45); display: flex; flex-direction: column; transition: left .35s ease, top .35s ease, width .35s ease; }
.ab-win.ab-dragging { box-shadow: 0 20px 50px rgba(0,0,0,.7); z-index: 400 !important; opacity: .93; transition: none; }
.ab-win.ab-pair { outline: 4px dashed var(--ab-gold); outline-offset: 4px; }
.ab-win.ab-drop::after { content: "Drop here to pair"; position: absolute; inset: 40px 12px 12px; display: flex; align-items: center; justify-content: center; border: 3px dashed var(--ab-gold); border-radius: 12px; background: rgba(11,18,32,.72); color: var(--ab-gold); font-weight: 900; font-size: 18px; pointer-events: none; z-index: 5; }
.ab-win.ab-hidden { display: none; }
.ab-win.ab-enter { animation: ab-swoosh .75s cubic-bezier(.2,1.3,.4,1) both; }
@keyframes ab-swoosh {
  0% { transform: translate(var(--fx,0px), var(--fy,0px)) scale(.04) rotate(-20deg); opacity: 0; }
  45% { opacity: 1; }
  78% { transform: translate(0,0) scale(1.03) rotate(1.2deg); }
  100% { transform: none; opacity: 1; }
}
.ab-win.ab-poof { animation: ab-poof .35s ease-in forwards; }
@keyframes ab-poof { to { transform: scale(.1) rotate(25deg); opacity: 0; } }

.ab-top { display: flex; align-items: center; gap: 7px; padding: 6px 9px; background: var(--c); color: #111; cursor: default; touch-action: none; border-radius: 10px 10px 0 0; user-select: none; }
.ab-top b, .ab-top .ab-grip, .ab-top [data-face] { cursor: grab; }
.ab-win.ab-min .ab-top { cursor: pointer; }
.ab-win.ab-dragging .ab-top, .ab-win.ab-dragging .ab-top * { cursor: grabbing; }
.ab-grip { font-size: 16px; opacity: .55; letter-spacing: -2px; }
.ab-top b { font-size: 16px; flex: 1 1 auto; min-width: 4.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-win:not(.ab-result) { container-type: inline-size; }
@container (max-width: 430px) {
  .ab-meta, .ab-say, .ab-grip, .ab-pickTxt { display: none; }
  .ab-top { gap: 5px; }
}
.ab-meta { font-size: 11px; font-weight: 700; opacity: .8; white-space: nowrap; }
.ab-top label { font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 3px; cursor: pointer; }
.ab-top button { border: none; background: rgba(255,255,255,.55); border-radius: 8px; padding: 3px 7px; cursor: pointer; font-size: 13px; }
.ab-wc { display: flex; gap: 4px; }
.ab-wc button { width: 26px; height: 24px; padding: 0; font-weight: 900; font-size: 14px; line-height: 24px; }
.ab-wc .ab-wx:hover { background: #dc2626; color: #fff; }
.ab-snip { display: none; padding: 6px 10px 8px; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-win.ab-min { cursor: pointer; }
.ab-win.ab-min .ab-body, .ab-win.ab-min .ab-ask, .ab-win.ab-min .ab-top label, .ab-win.ab-min .ab-meta, .ab-win.ab-min .ab-say, .ab-win.ab-min .ab-wmin, .ab-win.ab-min .ab-grip { display: none; }
.ab-win.ab-min .ab-snip { display: block; }
.ab-win.ab-max { z-index: 350; }
.ab-crown { display: none; } .ab-win.ab-final .ab-crown { display: inline; animation: ab-pop .4s cubic-bezier(.3,1.7,.5,1); }
@keyframes ab-pop { from { transform: scale(.2); opacity: 0; } }
.ab-win.ab-final { box-shadow: 0 0 0 4px var(--ab-gold), 0 0 30px rgba(253,224,71,.45); }

.ab-body { position: relative; overflow-y: auto; padding: 12px 16px; line-height: 1.5; font-size: 16px; overflow-wrap: anywhere; }
.ab-body p { margin: 0 0 8px; }
.ab-body h3, .ab-body h4, .ab-body h5 { margin: 10px 0 6px; line-height: 1.25; }
.ab-body ul, .ab-body ol { margin: 4px 0 8px; padding-left: 20px; }
.ab-body a { color: #7dd3fc; }
.ab-body pre { background: #0b1220; border: 1px solid #334155; border-radius: 8px; padding: 8px 10px; overflow-x: auto; white-space: pre; font-size: 13px; line-height: 1.4; margin: 6px 0 10px; position: relative; }
.ab-body code { font-family: Consolas, "Courier New", monospace; font-size: 13px; background: #0b1220; border-radius: 4px; padding: 0 3px; }
.ab-body pre code { background: none; padding: 0; }
.ab-q-div { margin: 12px 0 6px; padding: 5px 8px; border-radius: 6px; background: #0b1220; color: var(--ab-dim); font-size: 13px; font-weight: 700; }
.ab-q-div:first-child { margin-top: 0; }
.ab-you { background: #0b1220; border-left: 3px solid #64748b; padding: 6px 8px; margin: 10px 0 4px; border-radius: 6px; }
.ab-reply { border-left: 3px solid var(--c); padding: 6px 8px; margin: 4px 0; border-radius: 6px; background: rgba(255,255,255,.04); }
.ab-err { color: #fca5a5; font-weight: 700; }
.ab-copy { float: right; margin: 0 0 4px 8px; border: 1px solid #475569; background: #0b1220; color: #cbd5e1; border-radius: 6px; font-size: 12px; padding: 2px 7px; cursor: pointer; }
.ab-ask { display: flex; align-items: flex-end; gap: 6px; padding: 7px; border-top: 1px solid var(--ab-line); flex: none; }
.ab-ask input, .ab-ask .ab-askIn { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid #475569; background: #0b1220; color: #fff; font-size: 14px; font-family: inherit; }
.ab-ask button { padding: 6px 11px; border-radius: 8px; border: none; background: var(--c); color: #111; font-weight: 800; cursor: pointer; font-family: inherit; }
.ab-finalBtn { padding: 6px 9px; border-radius: 8px; border: 2px solid var(--ab-gold) !important; background: transparent !important; color: var(--ab-gold) !important; font-weight: 800; cursor: pointer; white-space: nowrap; font-size: 12px; font-family: inherit; }
.ab-win.ab-final .ab-finalBtn, .ab-finalBtn.ab-done { background: var(--ab-gold) !important; color: #111 !important; }
.ab-finalBtn.ab-big { font-size: 15px; padding: 9px 14px; }
.ab-typing span { display: inline-block; width: 8px; height: 8px; margin: 0 2px; border-radius: 50%; background: var(--c); animation: ab-dot 1s infinite; }
.ab-typing span:nth-child(2) { animation-delay: .15s; } .ab-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ab-dot { 50% { transform: translateY(-6px); opacity: .4; } }

.ab-face { display: inline-block; vertical-align: middle; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 3px solid #111; position: relative; flex: none; }
.ab-face::before, .ab-face::after { content: ""; position: absolute; top: 30%; width: 16%; height: 16%; background: #111; border-radius: 50%; animation: ab-blink 4s infinite; }
.ab-face::before { left: 24%; } .ab-face::after { right: 24%; }
@keyframes ab-blink { 0%,94%,100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
.ab-mouth { position: absolute; left: 50%; bottom: 20%; width: 40%; height: 10%; transform: translateX(-50%); background: #111; border-radius: 0 0 10px 10px; }
.ab-talking .ab-mouth { animation: ab-talk .16s infinite alternate; }
@keyframes ab-talk { to { height: 32%; border-radius: 0 0 50% 50%; } }
.ab-emo { position: absolute; right: -8px; bottom: -8px; font-size: 13px; }
.ab-peek { position: absolute; top: -24px; right: 118px; display: flex; align-items: center; gap: 6px; flex-direction: row-reverse; transform: scale(0) rotate(-40deg); transform-origin: 100% 0; transition: transform .38s cubic-bezier(.3,1.7,.5,1); z-index: 6; pointer-events: none; }
.ab-peek.ab-show { transform: scale(1) rotate(0); }
.ab-peek .ab-face { width: 44px; height: 44px; border-color: var(--c); border-width: 4px; }
.ab-bubble { background: #fff; color: #111; border-radius: 12px; padding: 5px 9px; font-size: 12px; font-weight: 700; width: max-content; max-width: 230px; line-height: 1.3; box-shadow: 0 4px 12px rgba(0,0,0,.4); }

.ab-tray { position: absolute; left: 0; right: 0; top: 8px; display: flex; justify-content: center; gap: 10px; z-index: 300; pointer-events: none; flex-wrap: wrap; padding: 0 8px; }
.ab-tf { display: flex; flex-direction: row; align-items: center; gap: 7px; padding: 5px 11px 5px 6px; border-radius: 999px; background: rgba(11,18,32,.9); border: 1px solid var(--c); animation: ab-bob 1s ease-in-out infinite; }
.ab-tf:nth-child(2) { animation-delay: .15s; } .ab-tf:nth-child(3) { animation-delay: .3s; } .ab-tf:nth-child(4) { animation-delay: .45s; }
.ab-tf .ab-face { width: 32px; height: 32px; border: 3px solid var(--c); }
.ab-tf .ab-emo { font-size: 11px; right: -6px; bottom: -6px; }
.ab-tf .ab-lbl { display: flex; flex-direction: column; font-size: 12px; font-weight: 800; color: var(--c); white-space: nowrap; line-height: 1.2; text-transform: none; }
.ab-tfLine { display: flex; gap: 5px; max-width: 128px; font-size: 11px; font-weight: 700; opacity: .9; }
.ab-tfLine .ab-trayTxt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ab-tfLine .ab-sec { flex: none; }
@keyframes ab-bob { 50% { transform: translateY(-4px); } }

.ab-bar { flex: none; margin: 6px auto 8px; background: #111827; border: 2px solid #475569; border-radius: 16px; padding: 7px 10px; display: flex; flex-direction: column; gap: 6px; width: min(640px, 96%); transition: border-color .2s, box-shadow .2s; }
.ab-bar.ab-armed { border-color: var(--ab-gold); box-shadow: 0 0 0 5px rgba(253,224,71,.3); animation: ab-armed .5s; }
@keyframes ab-armed { 40% { transform: scale(1.04); } }
.ab-who { font-size: 12px; color: var(--ab-dim); text-align: center; }
.ab-acts { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.ab-act { font-weight: 900; letter-spacing: .04em; padding: 9px 14px; border-radius: 12px; border: none; cursor: pointer; font-size: 14px; color: #fff; font-family: inherit; }
.ab-act.merge { background: #16a34a; } .ab-act.argue { background: #dc2626; } .ab-act.compare { background: #2563eb; } .ab-act.explain { background: #9333ea; } .ab-act.x { background: #475569; }
.ab-act:disabled { opacity: .5; cursor: wait; }

.ab-win.ab-result { --c: var(--ab-gold); }
.ab-tag { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 800; background: var(--c); color: #111; margin: 0 2px; }
.ab-line { padding: 8px 0; border-bottom: 1px solid var(--ab-line); }
.ab-lbl { font-size: 12px; color: var(--ab-dim); text-transform: uppercase; }
.ab-agree { color: #86efac; } .ab-differ { color: #fca5a5; }
.ab-say { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; }
.ab-say.ab-right { flex-direction: row-reverse; }
.ab-say .ab-bub { background: #0b1220; border: 2px solid var(--c); border-radius: 12px; padding: 7px 10px; max-width: 82%; }
.ab-judge { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ab-judge button { padding: 8px 12px; border-radius: 10px; border: 2px solid var(--c, #475569); background: #0b1220; color: #fff; font-weight: 800; cursor: pointer; font-family: inherit; }
.ab-decide { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: #1e3a5f; font-size: 13px; }
.ab-hint { color: var(--ab-dim); font-size: 13px; line-height: 1.4; }
.ab-te { font-size: 14px; line-height: 1.4; padding: 6px 8px; margin: 6px 0; border-radius: 8px; background: #0b1220; border-left: 3px solid #475569; white-space: pre-wrap; }
.ab-te.ab-ai { border-left-color: var(--c); }
.ab-te.ab-fin { border-left-color: var(--ab-gold); background: #2a2206; }
.ab-te time { color: var(--ab-dim); font-size: 11px; display: block; }
.ab-thread details { margin: 8px 0; border: 2px solid var(--c); border-radius: 10px; padding: 4px 10px; }
.ab-thread summary { cursor: pointer; font-weight: 800; padding: 4px 0; }
.ab-rules { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ab-rules span { background: #422006; border: 1px solid #a16207; color: #fde68a; border-radius: 999px; padding: 2px 6px 2px 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.ab-rules span.ab-new { animation: ab-ruleIn .6s ease; box-shadow: 0 0 0 2px var(--ab-gold); }
@keyframes ab-ruleIn { from { transform: scale(.6); opacity: 0; } }
.ab-ruleX { border: none; background: transparent; color: #fde68a; cursor: pointer; font-size: 11px; padding: 0 2px; line-height: 1; }
.ab-ruleX:hover { color: #fff; }
.ab-ruleRow { display: flex; gap: 6px; padding: 8px 0 4px; }
.ab-ruleRow input { flex: 1; min-width: 0; padding: 9px 11px; border-radius: 8px; border: 1px solid #475569; background: #0b1220; color: #fff; font-size: 15px; font-family: inherit; }
/* Two-choice pill switch: both choices stay readable; the active one is lit. */
.ab-pill { display: inline-flex; flex: none; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid #475569; background: #0b1220; }
.ab-pillOpt { padding: 6px 12px; border: none; border-radius: 999px; background: transparent; color: #64748b; font-size: 13px; font-weight: 700; font-family: inherit; white-space: nowrap; cursor: pointer; transition: background .15s, color .15s; }
.ab-pillOpt:hover { color: #cbd5e1; }
.ab-pillOpt.on { background: #2563eb; color: #fff; font-weight: 800; box-shadow: 0 1px 4px rgba(0,0,0,.45); cursor: default; }
.ab-pillOpt:focus-visible { outline: 2px solid #fde047; outline-offset: 1px; }
.ab-sec { font-variant-numeric: tabular-nums; opacity: .85; }
.ab-tip { position: absolute; z-index: 700; background: #111827; color: #e2e8f0; border: 2px solid #60a5fa; border-radius: 12px; padding: 10px 12px 10px; box-shadow: 0 12px 30px rgba(0,0,0,.55); font-size: 14px; line-height: 1.45; }
.ab-tipTxt { padding-right: 18px; }
.ab-tipX { position: absolute; top: 4px; right: 6px; border: none; background: transparent; color: #94a3b8; font-size: 15px; cursor: pointer; }
.ab-tipX:hover { color: #fff; }
.ab-tipFoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 13px; color: #94a3b8; }
.ab-tipFoot label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.ab-tipOk { padding: 6px 12px; font-size: 13px; }
.ab-score div { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 3px 0; }
.ab-score .ab-sbar { height: 8px; border-radius: 4px; background: var(--c); }

.ab-toast { position: absolute; top: 60px; left: 50%; transform: translateX(-50%) translateY(-30px); opacity: 0; background: var(--ab-gold); color: #111; font-weight: 800; padding: 8px 14px; border-radius: 12px; z-index: 600; transition: transform .3s, opacity .3s; max-width: 92%; text-align: center; pointer-events: none; }
.ab-toast.ab-show { transform: translateX(-50%) translateY(0); opacity: 1; }

.ab-ghost { position: absolute; z-index: 500; font-size: 34px; pointer-events: none; filter: drop-shadow(0 4px 8px rgba(0,0,0,.6)); transition: left 1.1s ease-in-out, top 1.1s ease-in-out, opacity .3s; }
.ab-ghost-cap { position: absolute; z-index: 500; left: 50%; transform: translateX(-50%); bottom: 12px; background: rgba(11,18,32,.92); border: 1px solid var(--ab-gold); color: var(--ab-gold); font-weight: 800; font-size: 13px; padding: 5px 12px; border-radius: 999px; pointer-events: none; }

@media (max-width: 768px) {
  #aiBoard { flex: none; height: calc(100dvh - 200px); min-height: 460px; }
  .ab-head { padding: 6px; gap: 5px; }
  .ab-q { flex: 1 1 120px; padding: 8px 9px; }
  #aiBoard { min-width: 0; max-width: 100%; }
  .ab-tools { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; contain: inline-size; }
  .ab-tools .ab-btn { padding: 6px 8px; font-size: 12px; flex: none; }
  .ab-pillOpt { padding: 5px 8px; font-size: 12px; }
  .ab-who { display: none; }
  .ab-bar { margin: 4px auto 6px; padding: 5px 6px; }
  .ab-acts { flex-wrap: nowrap; gap: 5px; overflow-x: auto; contain: inline-size; justify-content: flex-start; }
  .ab-act { padding: 8px 9px; font-size: 12px; letter-spacing: 0; flex: none; }
  .ab-top b { font-size: 15px; }
}

/* Growing text boxes (grow1): one line by default, the \25BD button makes a big typing box. */
textarea.ab-q, .ab-ask .ab-askIn { resize: none; line-height: 1.35; overflow-y: auto; box-sizing: border-box; }
textarea.ab-q { height: 40px; }
.ab-ask .ab-askIn { height: 36px; }
textarea.ab-q.ab-big { height: 38vh; }
.ab-ask .ab-askIn.ab-big { height: 11em; }
.ab-grow, .ab-ask .ab-grow { flex: none; width: 28px; height: 36px; padding: 0; border-radius: 8px; border: 1px solid #475569; background: #0b1220; color: #cbd5e1; font-size: 14px; font-weight: 400; cursor: pointer; font-family: inherit; }
.ab-head .ab-grow { height: 40px; }
.ab-grow:hover { color: #fff; border-color: #94a3b8; }
.ab-grow[aria-pressed="true"], .ab-ask .ab-grow[aria-pressed="true"] { background: #0f766e; color: #fff; border-color: #14b8a6; }
