/* Command Drills (app/templates/command_drills*.html) – Hell + Royalblau wie die Website,
   Mock-up: docs/prototypes/command-drills/. Handy-Regeln unter 768 px. */
.cd, .cd-trainer, .cd-embed { --cd-blue: #2952e3; --cd-blue-ink: #2244c4; --cd-ink: #0f172a; --cd-ink-2: #475569; --cd-ink-3: #64748b;
  --cd-line: #e2e8f0; --cd-soft: #f8fafc; --cd-warn: #b45309; --cd-ok: #15803d; color: var(--cd-ink); }
.cd [hidden], .cd-trainer [hidden], .cd-embed [hidden] { display: none !important; }
.cd { max-width: 1180px; margin: 0 auto; padding: 40px 24px 64px; display: flex; flex-direction: column; gap: 32px; }
.cd h2 { margin: 0; font-size: 22px; font-weight: 700; }
.cd-hero { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-end; justify-content: space-between; }
.cd-hero-text { flex: 999 1 560px; min-width: 0; }
.cd-hero h1 { margin: 0; font-size: clamp(30px, 4vw, 44px); line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
.cd-kicker { margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--cd-blue); }
.cd-sub { margin: 12px 0 0; font-size: 18px; color: var(--cd-ink-2); max-width: 640px; }
.cd-hero-cta { flex: 1 1 260px; display: flex; flex-direction: column; gap: 8px; }
.cd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px;
  font: inherit; font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.cd-btn-sm { align-self: flex-start; margin-top: auto; font-size: 14px; min-height: 40px; }
.cd-btn-go { background: var(--cd-blue); color: #fff; }
.cd-btn-go:hover { background: var(--cd-blue-ink); color: #fff; }
.cd-btn-line { border-color: var(--cd-blue); color: var(--cd-blue); background: #fff; }
.cd-btn-plain { border-color: #cbd5e1; color: var(--cd-ink); background: #fff; justify-content: flex-start; }
.cd-btn-warn { border-color: #fecaca; color: #b91c1c; background: #fff; justify-content: flex-start; }
.cd-card { border: 1px solid var(--cd-line); border-radius: 12px; padding: 16px 20px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.cd-soft { background: var(--cd-soft); }
.cd-accent { border-color: #c7d2fe; background: #eef2ff; }
.cd-label { font-size: 13px; font-weight: 600; color: var(--cd-ink-2); text-transform: uppercase; letter-spacing: .06em; }
.cd-blue { color: var(--cd-blue); }
.cd-big { font-size: 28px; font-weight: 700; }
.cd-title { font-size: 18px; font-weight: 600; }
.cd-small { font-size: 13px; color: var(--cd-ink-2); }
.cd-muted { color: var(--cd-ink-3); }
.cd-center { text-align: center; }
.cd-mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.cd-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; text-decoration: none; color: var(--cd-ink); font-size: 14px; }
.cd-list { display: flex; flex-direction: column; gap: 8px; }
.cd-warn { color: var(--cd-warn); white-space: nowrap; }
.cd-ok { color: var(--cd-ok); white-space: nowrap; }
.cd-error:empty { display: none; }
.cd-error { color: #b91c1c; }
.cd-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.cd-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cd-track { display: block; height: 8px; border-radius: 4px; background: var(--cd-line); overflow: hidden; }
.cd-fill { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--cd-blue); transition: width .3s; }
.cd-split { display: flex; flex-wrap: wrap; gap: 24px; }
.cd-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.cd-side { flex: 1 1 320px; display: flex; flex-direction: column; gap: 12px; }
.cd-techs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cd-tech { text-decoration: none; color: var(--cd-ink); }
.cd-tech:hover { border-color: var(--cd-blue); }
.cd-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-pill { padding: 2px 8px; border-radius: 99px; background: #f1f5f9; font-size: 12px; color: var(--cd-ink-2); }
.cd-mastery .cd-track { height: 6px; margin-top: 4px; }

/* Trainer */
.cd-trainer { display: flex; flex-direction: column; min-height: calc(100vh - 64px); background: var(--cd-soft); }
.cd-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 10px 24px; border-bottom: 1px solid var(--cd-line); background: #fff; }
.cd-back { display: inline-flex; align-items: center; gap: 6px; color: var(--cd-ink-2); text-decoration: none; font-size: 14px; min-height: 44px; }
.cd-sep { color: #cbd5e1; }
.cd-qlabel { font-size: 14px; font-weight: 600; }
.cd-qtrack { width: 160px; height: 6px; }
.cd-grow { flex-grow: 1; }
.cd-modes { display: flex; border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; font-size: 13px; }
.cd-modes a { padding: 9px 12px; color: var(--cd-ink-2); text-decoration: none; }
.cd-modes a[aria-current] { background: var(--cd-blue); color: #fff; font-weight: 600; }
.cd-icon { width: 44px; height: 44px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: var(--cd-ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.cd-stage { flex-grow: 1; display: flex; gap: 20px; padding: 20px 24px; min-height: 0; }
.cd-stage:fullscreen, .cd-stage.cd-full { background: var(--cd-soft); padding: 16px; }
.cd-stage.cd-full { position: fixed; inset: 0; z-index: 60; }
.cd-term-wrap { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; border-radius: 12px; background: #0f172a; overflow: hidden; }
/* feste Höhe: xterm passt Zeilen an den Kasten an – ein vom Inhalt abhängiger Kasten würde mitwachsen */
.cd-term { height: clamp(420px, calc(100vh - 230px), 760px); overflow: hidden; padding: 16px 18px; box-sizing: border-box; }
.cd-keys { display: none; gap: 6px; padding: 8px; background: #1e293b; overflow-x: auto; }
.cd-keys button { min-width: 44px; height: 40px; border-radius: 6px; border: 0; background: #334155; color: #e2e8f0; font: 13px "JetBrains Mono", monospace; flex-shrink: 0; }
.cd-help { flex: 0 0 340px; display: flex; flex-direction: column; gap: 12px; }
.cd-help p { margin: 0; font-size: 14px; color: #334155; }
.cd-params { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; font-size: 13px; }
.cd-params dt { font-family: "JetBrains Mono", ui-monospace, monospace; color: var(--cd-ink); word-break: break-all; max-width: 150px; }
.cd-params dd { margin: 0; color: var(--cd-ink-2); }
.cd-actions { display: flex; gap: 8px; margin-top: auto; }
.cd-actions .cd-btn { flex: 1; }
.cd-actions .cd-btn-go { flex: 2; }
.cd-pulse { box-shadow: 0 0 0 4px rgba(41, 82, 227, .25); }
.cd-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 1023px) {
  .cd-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cd-trio { grid-template-columns: minmax(0, 1fr); }
  .cd-stage { flex-direction: column; }
  .cd-help { flex: 0 0 auto; }
}
@media (max-width: 767px) {
  .cd { padding: 20px 16px 96px; gap: 20px; }
  .cd-sub { font-size: 16px; }
  .cd-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cd-card { padding: 14px 16px; }
  .cd-big { font-size: 22px; }
  .cd-techs { grid-template-columns: minmax(0, 1fr); }
  .cd-trainer { min-height: 0; background: #0f172a; }
  .cd-bar { padding: 4px 12px; }
  .cd-qtrack, .cd-sep { display: none; }
  .cd-stage { padding: 0; gap: 0; }
  .cd-term-wrap { border-radius: 0; }
  .cd-term { height: 52vh; min-height: 0; padding: 10px 12px; }
  .cd-keys { display: flex; }
  .cd-help { padding: 12px; gap: 8px; background: #fff; }
}

/* Kästen auf Kursseiten (partials/command_drills_chapter.html, partials/command_drills_course.html):
   Kapitelende mit eingebettetem Terminal, Kursseite mit Kacheln je Kapitel. */
.cd-embed { border: 1px solid #c7d4fb; background: #f5f8ff; border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.cd-embed p { margin: 0; }
.cd-embed h2 { margin: 2px 0 4px; font-size: 20px; font-weight: 700; line-height: 1.3; }
.cd-embed-head { min-width: 0; }
.cd-stripes { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.cd-stripes li { flex: 1 1 0; min-width: 0; }
.cd-stripes button { display: block; width: 100%; height: 8px; padding: 0; border: 0; border-radius: 4px; background: var(--cd-line); cursor: pointer; }
.cd-stripes button.cd-done { background: var(--cd-ok); }
.cd-stripes button[aria-current] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cd-blue); }
.cd-embed-task { display: flex; flex-direction: column; gap: 4px; }
.cd-embed .cd-term { height: 300px; padding: 12px 14px; }
.cd-embed .cd-term-wrap { flex: 0 0 auto; }
.cd-feedback .cd-ok { white-space: normal; font-weight: 600; font-size: 14px; }
.cd-feedback .cd-ok:empty { display: none; }
.cd-feedback p { font-size: 14px; color: #334155; }
.cd-embed-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cd-embed-actions .cd-btn-plain { justify-content: center; }
.cd-embed-all { margin-left: auto; font-size: 14px; font-weight: 600; }
.cd-course-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.cd-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cd-tile a { display: flex; flex-direction: column; gap: 4px; height: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--cd-line); border-radius: 10px; background: #fff; color: var(--cd-ink); text-decoration: none; }
.cd-tile a:hover { border-color: var(--cd-blue); }
.cd-tile-title { font-weight: 600; font-size: 14px; }
.cd-status { align-self: flex-start; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: #f1f5f9; color: var(--cd-ink-2); }
.cd-status[data-status="due"] { background: #fef3c7; color: var(--cd-warn); }
.cd-status[data-status="secure"] { background: #dcfce7; color: var(--cd-ok); }
.cd-status[data-status="started"] { background: #e0e7ff; color: var(--cd-blue-ink); }
@media (max-width: 767px) {
  .cd-embed { padding: 14px; }
  .cd-embed .cd-term { height: 260px; padding: 8px 10px; }
  .cd-embed .cd-keys { display: flex; }
  .cd-embed-actions .cd-btn { flex: 1 1 auto; }
  .cd-embed-all { margin-left: 0; flex-basis: 100%; }
  .cd-course-head .cd-btn { width: 100%; }
  .cd-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
