/* How AI Works — extras. Styles for the demos ported from the classic guide:
   js/bigmodel.js (#bigModel), js/spot.js (#spotGame), js/basechat.js (#baseVsChat).
   Load after lab.css. Every rule is scoped under .ai-lab. The site theme forces
   background, colour, border and radius on bare `button` with !important, so the
   one custom button here (.bm-row) answers in kind, as lab.css does. */

/* ---------- shared (the keyframes cannot be scoped, so the name is unique) ---------- */
.ai-lab .x-cap { margin-bottom: 6px; color: var(--lab-dim); font-size: 10.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
@keyframes extras-grow { from { transform: scaleX(0); } }

/* ---------- chapter 6: the larger recorded model ---------- */
.ai-lab .bm-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-lab .bm-line .p { color: #fff; }
.ai-lab .bm-line .g { color: var(--lab-gold); }
.ai-lab .bm-line .g.rare { color: #ffc2cf; text-decoration: underline dotted var(--lab-rose); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.ai-lab .bm-line .g.mine { color: #d6ffd0; text-decoration: underline solid var(--lab-green); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.ai-lab .bm-head, .ai-lab .bm-row { display: grid; grid-template-columns: minmax(0, 128px) 46px minmax(0, 1fr) 74px; gap: 8px; align-items: center; }
.ai-lab .bm-head { margin: 0 0 6px; padding: 0 7px; color: var(--lab-dim); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.ai-lab .bm-head span:last-child { grid-column: 3 / -1; }
.ai-lab .bm-bars { display: grid; gap: 3px; }
.ai-lab .bm-row {
  width: 100%; min-height: 28px; margin: 0; padding: 3px 6px;
  border: 1px solid transparent !important; border-radius: 7px !important;
  background: transparent !important; color: #e6f3f9 !important;
  font: 13px/1.25 var(--mono, ui-monospace, Consolas, monospace); text-align: left;
}
.ai-lab .bm-row.can { cursor: pointer; border-color: rgba(86,163,232,0.32) !important; background: rgba(255,255,255,0.04) !important; }
.ai-lab .bm-row.can:hover { border-color: var(--lab-line-hot) !important; background: rgba(57,207,255,0.14) !important; color: #fff !important; }
.ai-lab .bm-row .w { font-weight: 700; overflow-wrap: anywhere; }
.ai-lab .bm-row .s { color: var(--lab-dim); font-size: 11.5px; }
.ai-lab .bm-row .bar { display: block; height: 13px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,0.06); }
.ai-lab .bm-row .bar i { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, #2787c4, var(--lab-cyan)); transform-origin: left; animation: extras-grow .4s ease both; transition: width .35s ease; }
.ai-lab .bm-bars.still .bar i { animation: none; }
.ai-lab .bm-row em { color: var(--lab-muted); font: normal 12px var(--mono, ui-monospace, Consolas, monospace); text-align: right; white-space: nowrap; }
.ai-lab .bm-row.other { color: var(--lab-muted) !important; }
.ai-lab .bm-row.other .w { font-weight: 400; font-style: italic; }
.ai-lab .bm-row.other .bar i { background: rgba(159,184,201,0.55); }
.ai-lab .bm-row.picked { border-color: rgba(230,189,103,0.6) !important; background: rgba(230,189,103,0.09) !important; color: var(--lab-gold) !important; }
.ai-lab .bm-row.picked .bar i { background: var(--lab-gold); }
.ai-lab .bm-row.picked em { color: var(--lab-gold); font-weight: 800; }
.ai-lab .bm-runs { margin-top: 14px; }
.ai-lab .bm-runs[hidden] { display: none; }
.ai-lab .bm-runlist { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.ai-lab .bm-runlist li { padding: 8px 12px; border-left: 3px solid var(--lab-cyan); border-radius: 0 8px 8px 0; background: rgba(0,0,0,0.25); color: #cfe2ec; font: 13px/1.5 var(--mono, ui-monospace, Consolas, monospace); white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-lab .bm-runlist b { color: var(--lab-muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.ai-lab .bm-runlist .p { color: #fff; }
.ai-lab .bm-runlist .g { color: var(--lab-gold); }

/* ---------- chapter 13: spot the hallucination ---------- */
.ai-lab .spot-game { scroll-margin-top: 18px; }
.ai-lab .spot-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.ai-lab .spot-lines { margin: 0; padding-left: 26px; color: #d8eaf2; font: 13px/1.5 var(--mono, ui-monospace, Consolas, monospace); }
.ai-lab .spot-lines li { margin-top: 4px; padding: 3px 6px; border-radius: 6px; overflow-wrap: anywhere; transition: background .3s, color .3s; }
.ai-lab .spot-lines li::marker { color: var(--lab-muted); }
.ai-lab .spot-lines li.cite { background: rgba(132,227,122,0.22); color: #fff; }
.ai-lab .spot-lines li.clash { background: rgba(255,127,156,0.24); color: #fff; }
.ai-lab .spot-claims { display: grid; gap: 8px; }
.ai-lab .spot-claim {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px;
  border: 1px solid rgba(110,159,205,0.28); border-left-width: 4px; border-radius: 10px;
  background: rgba(255,255,255,0.035); color: #e8f4fa; font-size: 14px; line-height: 1.45; cursor: pointer;
}
.ai-lab .spot-claim input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--lab-rose); cursor: inherit; }
.ai-lab .spot-claim:hover { border-color: var(--lab-line-hot); }
.ai-lab .spot-claim.flagged { border-color: rgba(255,127,156,0.75); background: rgba(255,127,156,0.09); }
.ai-lab .spot-claim.revealed { cursor: default; border-color: rgba(110,159,205,0.28); }
.ai-lab .spot-claim .t, .ai-lab .spot-claim .v { display: block; overflow-wrap: anywhere; }
.ai-lab .spot-claim .v { margin-top: 5px; color: var(--lab-muted); font-size: 12.5px; }
.ai-lab .spot-claim .v:empty { display: none; }
.ai-lab .spot-claim.ok .v b { color: var(--lab-green); }
.ai-lab .spot-claim.bad .v b { color: var(--lab-rose); }
.ai-lab .spot-claim.right { border-left-color: var(--lab-green); }
.ai-lab .spot-claim.wrong { border-left-color: var(--lab-rose); }
.ai-lab .spot-round { align-self: center; margin-left: auto; color: var(--lab-muted); font-size: 12.5px; font-weight: 700; }

/* ---------- chapter 8: base model against chat model ---------- */
.ai-lab .bc-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.ai-lab .bc-col.bc-base { border-color: rgba(255,176,96,0.45); }
.ai-lab .bc-col.bc-chat { border-color: rgba(132,227,122,0.45); }
.ai-lab .bc-base .x-cap { color: var(--lab-orange); }
.ai-lab .bc-chat .x-cap { color: var(--lab-green); }
.ai-lab .bc-text { min-height: 120px; color: #d8eaf2; font: 13px/1.55 var(--mono, ui-monospace, Consolas, monospace); white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-lab .bc-text .q { color: #fff; font-weight: 800; }

/* ---------- narrow screens ---------- */
@media (max-width: 860px) {
  .ai-lab .spot-grid, .ai-lab .bc-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .ai-lab .bm-head, .ai-lab .bm-row { grid-template-columns: minmax(0, 96px) minmax(0, 1fr) 62px; }
  .ai-lab .bm-head .s, .ai-lab .bm-row .s { display: none; }
  .ai-lab .bm-head span:last-child { grid-column: 2 / -1; }
  .ai-lab .spot-game { scroll-margin-top: 70px; }
  .ai-lab .spot-round { margin-left: 0; }
}
