/* Training & alignment deep dive — page-specific styles. Loaded after lab.css,
   which supplies the shell, cards, buttons and tokens. Everything here is
   prefixed dd- so it cannot collide with the main guide. */

.dd-stage-pipe { height: 176px; cursor: pointer; }
.dd-stage-funnel { height: 250px; }
.dd-stages { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dd-stages .lab-button { flex: 1 1 auto; }
.dd-jump { margin-left: 4px; font-weight: 800; white-space: nowrap; }
.dd-cap { margin-bottom: 8px; color: var(--lab-dim); font-size: 10.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.dd-aside { margin: 12px 0 0; color: var(--lab-muted); font-size: 13.5px; line-height: 1.5; }
.dd-top { margin-top: 0; }

/* fact cards (the old page's bullet lists) */
.dd-points { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.dd-points.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dd-points > div { padding: 12px 14px; border: 1px solid rgba(110,159,205,0.22); border-radius: 10px; background: rgba(255,255,255,0.03); color: var(--lab-muted); font-size: 13.5px; line-height: 1.5; }
.dd-points b { display: block; margin-bottom: 4px; color: #fff; font-size: 13.5px; }

/* shared horizontal bar rows */
.dd-bars { display: grid; gap: 6px; }
.dd-bar { display: grid; grid-template-columns: 96px minmax(0, 1fr) 48px; gap: 8px; align-items: center; color: #e6f3f9; font: 13px var(--mono); }
.dd-bar > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.dd-bar > div { height: 12px; border-radius: 99px; background: rgba(255,255,255,0.07); overflow: hidden; }
.dd-bar i { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: var(--lab-rose); transition: width .55s cubic-bezier(.2,.8,.2,1), background .3s; }
.dd-bar em { color: var(--lab-muted); font: normal 12px var(--mono); text-align: right; }
.dd-bar.hit { color: var(--lab-gold); }
.dd-bar.hit i { background: var(--lab-gold); box-shadow: 0 0 12px rgba(230,189,103,.55); }
.dd-bar.low { color: var(--lab-dim); }
.dd-bar.low i { background: #5d7286; }

/* 03 one training example */
.dd-ex-toks { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; padding: 14px; border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; background: rgba(0,0,0,0.26); }
.dd-ex-toks .tok { font-size: 15px; padding: 7px 9px; }
.tok.dd-q { color: #10202b; background: var(--lab-gold); border-color: var(--lab-gold); font-weight: 800; animation: dd-pulse 1.1s ease-in-out infinite; }
.tok.dd-hid { color: var(--lab-dim); border-style: dashed; background: transparent; }
@keyframes dd-pulse { 50% { box-shadow: 0 0 0 5px rgba(230,189,103,0.25); } }
.dd-ex-grid { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 16px; margin-top: 14px; align-items: start; }
.dd-ex-side { display: grid; gap: 8px; }
.dd-ftlist { margin: 0 0 14px; padding: 12px 12px 12px 34px; columns: 2; column-gap: 28px; border: 1px solid rgba(157,134,255,0.34); border-radius: 10px; background: rgba(157,134,255,0.06); color: #e8e1ff; font: 13px/1.7 var(--mono); }

/* 04 base model vs assistant */
.dd-prompt { margin-top: 0; }
.dd-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.dd-panel { min-height: 150px; padding: 14px; border-radius: 10px; border: 1px solid; }
.dd-panel strong { display: block; margin-bottom: 8px; color: #fff; font-size: 13.5px; }
.dd-panel p { margin: 0; white-space: pre-wrap; line-height: 1.55; font-size: 14px; }
.dd-panel.base { border-color: rgba(255,127,156,0.34); background: rgba(255,127,156,0.05); }
.dd-panel.base p { color: #f1bec9; font-family: var(--mono); font-size: 13px; }
.dd-panel.tuned { border-color: rgba(132,227,122,0.36); background: rgba(132,227,122,0.05); }
.dd-panel.tuned p { color: #dfffe0; }
.dd-typing::after { content: "\2581"; color: var(--lab-cyan); animation: dd-blink 1s steps(2) infinite; }
@keyframes dd-blink { 50% { opacity: 0; } }

/* 05 RLHF */
.dd-rl { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.dd-question { padding: 12px 14px; border-left: 4px solid var(--lab-gold); border-radius: 0 10px 10px 0; background: rgba(230,189,103,0.07); color: #fff; font: 600 16px/1.45 Georgia, serif; }
.dd-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.ai-lab .dd-answer {
  padding: 13px; text-align: left; cursor: pointer; line-height: 1.5; font-size: 14px; min-height: 100%;
  border: 1px solid rgba(110,159,205,0.34) !important; border-radius: 10px !important;
  background: rgba(255,255,255,0.04) !important; color: #d8eaf2 !important;
  transition: border-color .18s, background .18s, transform .12s; animation: dd-rise .4s ease both;
}
.ai-lab .dd-answer:hover { border-color: var(--lab-line-hot) !important; background: rgba(57,207,255,0.1) !important; transform: translateY(-2px); }
.dd-answer b { display: block; margin-bottom: 6px; color: var(--lab-gold); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
@keyframes dd-rise { from { opacity: 0; transform: translateY(8px); } }
.dd-reward { display: grid; gap: 7px; margin-top: 12px; }
.dd-rw { display: grid; grid-template-columns: minmax(0, 1fr) 92px 26px; gap: 8px; align-items: center; color: var(--lab-muted); font-size: 12px; transition: color .3s; }
.dd-rw.up { color: #dfffe0; } .dd-rw.down { color: #ffd9e1; }
.dd-rw em { font: normal 700 12px var(--mono); text-align: right; }
.dd-div { position: relative; height: 12px; border-radius: 99px; background: rgba(255,255,255,0.07); }
.dd-div::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: rgba(255,255,255,0.45); }
.dd-div i { position: absolute; top: 0; bottom: 0; width: 0; max-width: 50%; transition: width .6s cubic-bezier(.2,1.3,.4,1); }
.dd-div .pos { left: 50%; border-radius: 0 99px 99px 0; background: var(--lab-green); }
.dd-div .neg { right: 50%; border-radius: 99px 0 0 99px; background: var(--lab-rose); }
.dd-policy .dd-bar { grid-template-columns: 190px minmax(0, 1fr) 44px; }
.dd-policy .dd-bar i { background: var(--lab-cyan); }
.dd-policy .dd-bar.hit i { background: var(--lab-green); box-shadow: none; }
.dd-policy .dd-bar.hit { color: #dfffe0; }

/* 06 evals */
.dd-evals { display: grid; gap: 6px; margin-top: 12px; }
.dd-eval { position: relative; display: grid; grid-template-columns: minmax(0, 1.6fr) 76px 86px 150px; gap: 10px; align-items: center; padding: 10px 12px; overflow: hidden; border: 1px solid rgba(110,159,205,0.2); border-radius: 8px; background: rgba(255,255,255,0.035); color: #d8eaf2; font-size: 13.5px; transition: border-color .3s, background .3s, opacity .3s; }
.dd-eval.head { border-color: transparent; background: none; color: var(--lab-dim); font-size: 10.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; padding-block: 2px; }
.dd-eval span:nth-child(n+2) { font-family: var(--mono); font-size: 12.5px; }
.dd-eval.wait { opacity: .5; }
.dd-eval.run { border-color: var(--lab-line-hot); background: rgba(57,207,255,0.08); }
.dd-eval.run::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--lab-cyan); transform-origin: left; animation: dd-fill .6s linear both; }
@keyframes dd-fill { from { transform: scaleX(0); } }
.dd-eval.done span:last-child { font-weight: 800; }
.dd-eval.up span:last-child { color: var(--lab-green); }
.dd-eval.flat span:last-child { color: var(--lab-muted); }
.dd-eval.down { border-color: rgba(255,127,156,0.6); background: rgba(255,127,156,0.09); }
.dd-eval.down span:last-child { color: var(--lab-rose); }
.dd-verdict { margin-top: 12px; padding: 14px; border: 1px solid rgba(255,127,156,0.5); border-radius: 10px; background: rgba(255,127,156,0.08); color: #ffd9e1; line-height: 1.55; font-size: 14.5px; animation: dd-rise .4s ease both; }
.dd-verdict.pass { border-color: rgba(132,227,122,0.5); background: rgba(132,227,122,0.08); color: #dfffe0; }
.dd-verdict strong { color: #fff; }

/* 07 deployment */
.dd-wrap { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.ai-lab .dd-layer {
  position: relative; padding: 12px 6px 10px; cursor: pointer; text-align: center; font-size: 12.5px; font-weight: 750; line-height: 1.25;
  border: 1px solid rgba(110,159,205,0.3) !important; border-radius: 9px !important;
  background: rgba(255,255,255,0.035) !important; color: #cfe2ec !important;
  transition: border-color .25s, background .25s, transform .25s, box-shadow .25s;
}
.dd-layer b { display: block; margin-bottom: 4px; color: var(--lab-dim); font: 800 11px var(--mono); }
.ai-lab .dd-layer.done { border-color: rgba(132,227,122,0.45) !important; background: rgba(132,227,122,0.07) !important; }
.ai-lab .dd-layer.active { border-color: var(--lab-gold) !important; background: rgba(230,189,103,0.16) !important; color: #fff !important; transform: translateY(-4px); box-shadow: 0 12px 28px rgba(230,189,103,0.16); }
.dd-layer.active b { color: var(--lab-gold); }
.dd-sys { display: block; margin-top: 8px; padding: 9px 11px; border-radius: 8px; background: rgba(0,0,0,0.35); color: #e8e1ff; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; }
.dd-reply { margin-top: 12px; padding: 14px; border: 1px solid rgba(57,207,255,0.32); border-radius: 10px; background: rgba(57,207,255,0.06); }
.dd-reply span { display: block; margin-bottom: 6px; color: var(--lab-dim); font-size: 10.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.dd-reply p { margin: 0; min-height: 66px; color: #e2f8ff; line-height: 1.55; font-size: 14.5px; }

/* 08 RAG */
.dd-query { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px; border: 1px dashed rgba(230,189,103,0.4); border-radius: 10px; }
.dd-query span { margin-right: 4px; color: var(--lab-dim); font-size: 10.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.dd-query b { padding: 3px 8px; border-radius: 99px; background: rgba(230,189,103,0.16); color: var(--lab-gold); font: 700 12px var(--mono); animation: dd-rise .3s ease both; }
.dd-rag { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; margin-top: 14px; align-items: start; }
.dd-docs { display: grid; gap: 7px; }
.dd-doc { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid rgba(110,159,205,0.22); border-radius: 9px; background: rgba(255,255,255,0.035); transition: border-color .3s, background .3s, opacity .4s, transform .3s; }
.dd-doc strong { color: #fff; font-size: 13px; }
.dd-doc p { margin: 3px 0 0; color: var(--lab-muted); font-size: 12.5px; line-height: 1.45; }
.dd-doc mark { padding: 0 2px; border-radius: 3px; background: rgba(230,189,103,0.3); color: #fff; }
.dd-score div { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
.dd-score i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--lab-gold); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.dd-score em { display: block; margin-top: 4px; color: var(--lab-dim); font: normal 700 10.5px var(--mono); text-transform: uppercase; text-align: right; }
.dd-doc.scan { border-color: var(--lab-line-hot); background: rgba(57,207,255,0.09); transform: translateX(4px); }
.dd-doc.got { border-color: rgba(132,227,122,0.6); background: rgba(132,227,122,0.08); }
.dd-doc.got .dd-score em { color: var(--lab-green); }
.dd-doc.got .dd-score i { background: var(--lab-green); }
.dd-doc.skip { opacity: .45; }
.dd-context { display: grid; gap: 7px; min-height: 92px; padding: 10px; border: 2px solid rgba(57,207,255,0.5); border-radius: 10px; background: rgba(0,0,0,0.28); }
.dd-empty { align-self: center; color: var(--lab-dim); font-size: 12.5px; text-align: center; }
.dd-ctxdoc { padding: 9px 11px; border-radius: 8px; background: rgba(132,227,122,0.12); border: 1px solid rgba(132,227,122,0.45); color: #dfffe0; font-size: 12.5px; line-height: 1.45; animation: dd-fly .6s cubic-bezier(.2,.8,.2,1) both; }
.dd-ctxdoc b { display: block; color: #fff; font-size: 12px; }
@keyframes dd-fly { from { opacity: 0; transform: translate(-60px, -10px) scale(.94); } }
.dd-answerbox { margin-top: 10px; padding: 14px; min-height: 70px; border: 1px solid rgba(110,159,205,0.3); border-radius: 10px; background: rgba(255,255,255,0.03); color: var(--lab-muted); font-size: 14px; line-height: 1.55; }
.dd-answerbox.ready { border-color: rgba(57,207,255,0.4); background: rgba(57,207,255,0.07); color: #e2f8ff; animation: dd-rise .5s ease both; }
.dd-answerbox strong { color: #fff; }
.dd-nb { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; align-items: start; }
.dd-nb label { display: grid; gap: 6px; color: var(--lab-muted); font-size: 13px; font-weight: 700; }
.dd-nb .dd-bar i { background: var(--lab-violet); }

/* 09 limits */
.dd-limits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dd-limit { padding: 14px 16px; border: 1px solid rgba(255,127,156,0.28); border-left: 4px solid var(--lab-rose); border-radius: 10px; background: rgba(255,127,156,0.05); color: #f3c8d1; font-size: 14px; line-height: 1.5; opacity: 0; transform: translateY(10px); transition: opacity .5s ease, transform .5s ease; }
.dd-limit b { display: block; margin-bottom: 4px; color: #ffe3e9; font: 700 1.02rem Georgia, serif; }
.dd-limit:last-child { grid-column: 1 / -1; }
.dd-limits:not(.dd-anim) .dd-limit, .dd-in .dd-limit { opacity: 1; transform: none; }
.dd-in .dd-limit:nth-child(2) { transition-delay: .1s; } .dd-in .dd-limit:nth-child(3) { transition-delay: .2s; }
.dd-in .dd-limit:nth-child(4) { transition-delay: .3s; } .dd-in .dd-limit:nth-child(5) { transition-delay: .4s; }

/* Fallback layout for the shared trainer widget. :where() keeps these at zero
   specificity, so any rule lab.css gives the same classes wins. */
:where(.tr-grid) { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; margin-top: 14px; align-items: start; }
:where(.tr-loss) { height: 200px; }
:where(.tr-map) { height: 400px; margin-top: 14px; }
:where(.tr-line) { margin: 8px 0 0; font: 13px/1.5 var(--mono); }
:where(.tr-line b) { color: var(--lab-gold); }
:where(.tr-line span) { color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .dd-limit { opacity: 1; transform: none; }
}
@media (max-width: 860px) {
  .dd-ex-grid, .dd-rl, .dd-rag, .dd-nb, .dd-compare { grid-template-columns: 1fr; }
  .dd-points.three { grid-template-columns: 1fr; }
  .dd-wrap { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  :where(.tr-grid) { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .dd-stage-pipe { height: 150px; } .dd-stage-funnel { height: 220px; }
  .dd-points, .dd-pair, .dd-limits { grid-template-columns: 1fr; }
  .dd-ftlist { columns: 1; }
  .dd-wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dd-bar { grid-template-columns: 78px minmax(0, 1fr) 44px; }
  .dd-policy .dd-bar { grid-template-columns: 124px minmax(0, 1fr) 40px; font-size: 11.5px; }
  .dd-eval { grid-template-columns: minmax(0, 1fr) 46px 54px; font-size: 12.5px; }
  .dd-eval span:last-child { grid-column: 1 / -1; }
  .dd-eval.head span:last-child { display: none; }
  .dd-doc { grid-template-columns: 1fr; }
  .dd-score em { text-align: left; }
  :where(.tr-map) { height: 340px; }
}
