/* sandbox.css: the sandbox screen (left panel, start dialog, log box, rebase host).
   Reference: maquettes/A3-Sandbox.dc.html (panel 368 px, scene 1012 x 796).
   Colours: tokens.css variables and the derived shades of base.css only. */

.sandbox { padding-top: 20px; }
.sb-panel {
  max-height: calc(796px * var(--scene-scale, 1)); overflow-y: auto; overflow-x: hidden; scrollbar-width: thin;
  gap: 12px;
}
.sb-title { font-size: 32px; line-height: 1.05; margin: 0; }
.sb-start-row { display: flex; align-items: center; gap: 10px; }
.sb-start-btn {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%;
  padding: 5px 12px; border: 1.5px solid var(--charbon); border-radius: var(--rayon-pastille);
  background: var(--blanc); font-size: 13px; font-weight: 500;
}
.sb-start-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-start-btn:hover { background: var(--lin); }

/* terminal (component from ui.css) */
.sb-term .terminal { min-height: 150px; }

/* argument field (commit message, branch name) */
.sb-ask { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--lin); }
.sb-ask-label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.sb-ask-input {
  height: 32px; padding: 0 10px; border: 1.5px solid var(--charbon); border-radius: 10px;
  background: var(--blanc); font-family: var(--font-mono); font-size: 13px;
}
.sb-ask-buttons { display: flex; gap: 8px; }

/* what just happened */
.sb-happened { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--trait); }
.sb-explain { font-size: 14px; line-height: 1.45; }
.sb-explain.is-error { color: var(--annotation-texte); }
.sb-ai-text { font-family: var(--font-note); font-size: 19px; line-height: 1.15; color: var(--annotation-texte); }
.sb-why-btn { align-self: flex-start; padding: 0; border: 0; background: none; font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.sb-why { font-size: 13px; line-height: 1.45; color: var(--texte-secondaire); }
.sb-details { margin: 0; padding: 8px 10px; list-style: none; border-radius: 10px; background: var(--lin); font-size: 12px; line-height: 1.5; max-height: 160px; overflow-y: auto; }
.sb-details li { white-space: pre-wrap; word-break: break-all; border-radius: 4px; }
.sb-details li.is-mapped { cursor: default; }
.sb-details li.is-mapped:hover { background: var(--ciel-wash); }

/* controls */
.sb-controls, .sb-share, .sb-world-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sb-controls .btn, .sb-share .btn, .sb-world-row .btn { gap: 6px; }
.sb-details-btn[aria-pressed="true"] { background: var(--charbon); color: var(--creme); }
.sb-world { display: flex; flex-direction: column; gap: 6px; }
.sb-check-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.sb-check { width: 16px; height: 16px; accent-color: var(--charbon); }

/* palette */
.sb-palette { display: flex; flex-direction: column; gap: 8px; }
.sb-group { display: flex; flex-direction: column; gap: 5px; }
.sb-cmds { display: flex; flex-wrap: wrap; gap: 6px; }
.sb-cmd {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px;
  border: 1.5px solid var(--charbon); border-radius: var(--rayon-pastille); background: var(--blanc);
  font-family: var(--font-mono); font-size: 12.5px;
}
.sb-cmd:hover { background: var(--lin); }
.sb-cmd.is-web { font-family: var(--font-ui); border-style: dashed; }

/* history */
.sb-history { display: flex; flex-direction: column; gap: 5px; }
.sb-history-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; max-height: 168px; overflow-y: auto; scrollbar-width: thin; }
.sb-hist {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 3px 8px; border: 0; border-radius: 8px;
  background: transparent; font-size: 12.5px; text-align: left;
}
.sb-hist span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-hist:hover { background: var(--survol); }
.sb-hist.is-current { background: var(--lin); font-weight: 500; }

/* stage: scene + overlays */
.sb-stage { position: relative; flex: 0 0 1012px; width: 1012px; height: 796px; }
.sb-log {
  position: absolute; z-index: 20; top: 192px; right: 0; width: 380px; height: 292px;
  display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: var(--surface-forte);
}
.sb-log-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sb-log-list { overflow-y: auto; min-height: 0; flex: 1; }
.sb-rebase-host {
  position: absolute; inset: 0; z-index: 35; display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 24px; background: color-mix(in srgb, var(--creme) 88%, transparent);
}
.sb-rebase-host:empty { display: none; }

/* start dialog */
.sb-dialog-backdrop {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px; overflow-y: auto; background: color-mix(in srgb, var(--charbon) 35%, transparent);
}
.sb-dialog { width: min(760px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 24px 28px; background: var(--creme); }
.sb-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sb-dialog-head h2 { font-size: 32px; }
.sb-starts { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sb-start-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; height: 100%;
  padding: 12px 14px; border: 1.5px solid var(--trait-fort); border-radius: 16px; background: var(--blanc); text-align: left;
}
.sb-start-card:hover { border-color: var(--charbon); }
.sb-start-card strong { font-size: 15px; }
.sb-start-text { font-size: 13px; line-height: 1.4; color: var(--texte-secondaire); }
.sb-paste-area { width: 100%; padding: 8px 10px; border: 1.5px solid var(--charbon); border-radius: 12px; background: var(--blanc); font-size: 12.5px; resize: vertical; }
.sb-paste-error { color: var(--annotation-texte); font-size: 13px; }
.sb-paste-error:empty { display: none; }
.sb-pop-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sb-pop-files { color: var(--texte-secondaire); word-break: break-all; }

@media (prefers-reduced-motion: reduce) {
  .sb-hist, .sb-cmd { transition: none; }
}
