/* SkyJEPA task card. Dark by choice: the sky at dusk. Ember = the plan chosen and the goals, forest = imagined futures,
   violet = costs. Same family as MacroSwan/clear-the-playroom. */
:root {
  --bg: #121212; --surface: #1a1a1a; --surface-2: #222220; --fg: #e8e3da; --muted: #a39d92; --line: #2c2b28;
  --ember: #e68e0d; --forest: #5fb68b; --shadow: #a07ce0; --cost: #a07ce0; --warn: #e5604a; --ok: #5fb68b;
  --display: "Archivo", system-ui, sans-serif;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font); }
.app { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: 100%; }
.stage { position: relative; min-width: 0; min-height: 320px; }
#view { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#view.grab { cursor: grabbing; }
.hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: rgb(18 18 18 / 0.82);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 12.5px; color: var(--muted);
  white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.toast { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); background: var(--surface-2);
  border: 1px solid var(--warn); color: var(--fg); padding: 8px 14px; border-radius: 8px; font-size: 13px; max-width: 90%; }
.legend { position: absolute; left: 14px; top: 14px; display: flex; flex-direction: column; gap: 4px; font-size: 12px;
  color: var(--muted); background: rgb(18 18 18 / 0.75); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }
.legend span { display: flex; align-items: center; gap: 8px; }
.sw { display: inline-block; width: 18px; height: 4px; border-radius: 2px; }
.sw.ember { background: var(--ember); } .sw.future { background: var(--forest); opacity: .7; }
.sw.trail { background: var(--fg); opacity: .5; height: 2px; }
.sw.field { background: var(--cost); opacity: .45; height: 10px; }

.panel { border-left: 1px solid var(--line); overflow-y: auto; padding: 22px 20px 28px; display: flex; flex-direction: column; gap: 18px; }
.mark { font-family: var(--display); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 12px;
  color: var(--ember); margin: 0 0 8px; }
.mark span { color: var(--forest); }
h1 { font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1.1; margin: 0 0 8px; text-wrap: balance; }
h2 { font-family: var(--display); font-weight: 700; font-size: 14px; margin: 0 0 10px; letter-spacing: .01em; }
.lede { color: var(--muted); margin: 0; }
.fine { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
footer.fine p { margin: 0 0 6px; }
a { color: var(--ember); }

button { font: inherit; color: var(--fg); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  min-height: 36px; padding: 0 12px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
button.primary { background: var(--ember); color: #121212; border-color: var(--ember); font-weight: 600; min-width: 84px; }
button.ghost { background: transparent; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; min-width: 40px; color: var(--muted); }
.seg button.on { background: var(--surface-2); color: var(--fg); }

.status .phase { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 10px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.live { background: var(--ember); box-shadow: 0 0 0 4px rgb(230 142 13 / .18); }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kpis div { display: flex; flex-direction: column; min-width: 0; }
.kpis b { font-family: var(--display); font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpis span { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
#contacts.bad { color: var(--warn); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }

.split { display: flex; height: 10px; border-radius: 3px; overflow: hidden; margin-top: 12px; gap: 2px; }
.split i { display: block; height: 100%; min-width: 2px; }
.split-key { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.split-key span { display: inline-flex; align-items: center; gap: 5px; }
.split-key i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.terms { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.terms li { display: grid; grid-template-columns: 74px minmax(0, 1fr) 46px; gap: 8px; align-items: center; font-size: 12.5px; }
.terms .bar { height: 8px; background: var(--surface-2); border-radius: 0 4px 4px 0; position: relative; }
.terms .bar i { position: absolute; inset: 0 auto 0 0; background: var(--ember); border-radius: 0 4px 4px 0; min-width: 1px; }
.terms li[data-k="obstacles"] .bar i, .terms li[data-k="bounds"] .bar i { background: var(--cost); }
.terms .v { font-family: var(--mono); font-size: 11.5px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.add { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.add button { min-height: 32px; font-size: 13px; }
.furn { display: flex; flex-direction: column; gap: 6px; }
.fi { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.fi.sel { border-color: var(--shadow); }
.fi .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fi .row b { font-weight: 600; font-size: 13px; }
.fi .row button { min-height: 26px; padding: 0 8px; font-size: 12px; }
.fi .sliders { display: grid; grid-template-columns: auto minmax(0, 1fr) 46px; gap: 2px 8px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--muted); }
.fi .sliders output { font-family: var(--mono); font-size: 11.5px; text-align: right; }
input[type="range"] { width: 100%; accent-color: var(--shadow); }
.check { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; color: var(--muted); }
.log { margin: 0; padding: 0 0 0 0; list-style: none; font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  display: flex; flex-direction: column; gap: 2px; min-height: 40px; }
.log li b { color: var(--fg); font-weight: 500; }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 58vh auto; height: auto; }
  .panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible;
    padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .hint { white-space: normal; text-align: center; border-radius: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.lede b.g { color: var(--ember); font-weight: 600; } .lede b.c { color: var(--cost); font-weight: 600; }
.tools { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); display: flex; gap: 4px; align-items: center;
  background: rgb(18 18 18 / 0.85); border: 1px solid var(--line); border-radius: 10px; padding: 5px; max-width: calc(100% - 24px);
  overflow-x: auto; scrollbar-width: none; }
.tools button { min-height: 32px; font-size: 13px; padding: 0 10px; background: transparent; border-color: transparent; white-space: nowrap; }
.tools button.on { background: var(--surface-2); border-color: var(--muted); }
.tools button[data-tool="ring"], .tools button[data-tool="goal"] { color: var(--ember); }
.tools button[data-tool="pillar"], .tools button[data-tool="sphere"], .tools button[data-tool="wall"] { color: #c3a9ee; }
.tools .sep { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 2px 0 8px; }
.alt { position: absolute; right: 14px; top: 64px; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted);
  background: rgb(18 18 18 / 0.8); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.alt input { width: 110px; accent-color: var(--ember); }
.alt output { font-family: var(--mono); font-size: 11.5px; color: var(--fg); min-width: 38px; text-align: right; }
.legend { top: 64px; }
.yaml { margin: 0; font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 260px; overflow-y: auto; background: var(--bg); border-radius: 6px; padding: 10px; border: 1px solid var(--line); }
.yaml .k { color: var(--fg); } .yaml .g { color: var(--ember); } .yaml .c { color: #c3a9ee; } .yaml .cm { color: #6d685f; }
.yaml .now { background: rgb(230 142 13 / .16); border-radius: 3px; }
.row-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.row-label .seg button { min-width: 38px; min-height: 30px; font-size: 12.5px; }
@media (max-width: 860px) {
  .legend { display: none; }
  .hint { display: none; }
  .alt { top: auto; bottom: 12px; right: 50%; transform: translateX(50%); }
}
