/* G1 Playground — dashboard umanoide. Usa ../css/base.css (grafite + giallo segnale, angoli vivi). */
html, body { overflow: hidden; }
body { display: grid; grid-template-rows: 54px 1fr; height: 100vh; }
.hidden { display: none !important; }

/* barra in alto */
.top { display: flex; align-items: center; gap: 24px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 300px; }
.brand h1 { font-size: 19px; font-stretch: 125%; letter-spacing: 0.01em; }
.brand .eyebrow { font-size: 10px; margin-top: 2px; }
.mark { width: 22px; height: 22px; background: var(--signal); display: block; clip-path: polygon(0 0, 100% 0, 100% 62%, 62% 100%, 0 100%); }
.modes { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.tag.off { color: var(--faint); border-color: var(--line); }
.sys { color: var(--muted); font-size: 11px; margin-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spend { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.spend .num { font-size: 18px; }
.clock { color: var(--faint); margin-left: 12px; font-size: 11px; }

/* griglia */
.grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) 372px; min-height: 0; }
.col { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.col.left { border-right: 1px solid var(--line); }
.col.right { border-left: 1px solid var(--line); }
.col .panel { border: 0; border-bottom: 1px solid var(--line); backdrop-filter: none; background: var(--bg-2); }
.panel.grow { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panel > header h2 { font-size: 13px; letter-spacing: 0.02em; }
.panel > header .n { font: 700 11px var(--f-mono); color: var(--signal); }
.panel > header .r { margin-left: auto; }

/* robot */
.robots { list-style: none; margin: 0; padding: 4px 0; }
.robots li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 7px 12px; cursor: pointer; border-left: 2px solid transparent; }
.robots li:hover { background: var(--bg-3); }
.robots li.sel { border-left-color: var(--signal); background: var(--bg-3); }
.robots .ico { width: 26px; height: 26px; border: 1px solid var(--line-2); display: grid; place-items: center; font: 700 10px var(--f-mono); color: var(--muted); }
.robots li.sel .ico { border-color: var(--signal); color: var(--signal); }
.robots .nm { font-family: var(--f-title); font-weight: 700; font-stretch: 110%; font-size: 13px; text-transform: uppercase; }
.robots .sub { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.tag.on { color: var(--ok); border-color: #2e5a36; }
.tag.tr { color: var(--cyan); border-color: #24535b; }

/* coda */
.queue { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.queue li { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.queue li:hover { background: var(--bg-3); }
.queue .th { width: 74px; height: 42px; background: #000 center/cover; position: relative; border: 1px solid var(--line-2); }
.queue .th::after { content: '▶'; position: absolute; right: 3px; bottom: 1px; font-size: 9px; color: var(--signal); }
.queue .pr { font-size: 11px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.queue .meta { font-size: 10px; color: var(--muted); margin-top: 3px; display: flex; gap: 6px; align-items: center; }
.queue li.run { background: color-mix(in srgb, var(--signal) 7%, var(--bg-2)); }
.queue li.run .bar { margin-top: 6px; }
.queue li.run .th::after { content: ''; }

/* vista 3D */
.view { position: relative; min-width: 0; min-height: 0; background: #0b0c0d; overflow: hidden; }
#c3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.vcap { position: absolute; left: 12px; top: 10px; font-size: 10px; pointer-events: none; background: rgba(14,15,16,.78); padding: 5px 9px; border-left: 2px solid var(--signal); }
.vcap .dim { color: var(--muted); }
.vtools { position: absolute; right: 12px; top: 10px; display: flex; gap: 6px; }
.btn.sm { padding: 5px 9px; font-size: 10px; background: color-mix(in srgb, var(--bg) 70%, transparent); }
.btn.sm.on { color: var(--signal); border-color: var(--signal); }

.promptwrap { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(860px, calc(100% - 28px)); }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); margin-bottom: 8px; background: rgba(14,15,16,.82); padding: 4px 9px; }
.status .dot { width: 7px; height: 7px; background: var(--ok); display: block; }
.status.busy .dot { background: var(--signal); animation: blink 0.8s steps(2) infinite; }
.status.busy { color: var(--text); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { font: 500 11px var(--f-mono); color: var(--text); background: color-mix(in srgb, var(--bg) 78%, transparent); border: 1px solid var(--line-2); padding: 5px 9px; cursor: pointer; }
.chip:hover { border-color: var(--signal); color: var(--signal); }
.chip b { color: var(--signal); font-weight: 700; margin-right: 6px; }
.chip.real::after { content: 'vero'; margin-left: 6px; font-size: 9px; color: var(--muted); border: 1px solid var(--line-2); padding: 0 3px; }
.chip:disabled { opacity: .35; cursor: not-allowed; }
.prompt { display: flex; align-items: center; background: color-mix(in srgb, var(--bg-2) 92%, transparent); border: 1px solid var(--line-2); padding: 6px 6px 6px 14px; gap: 10px; backdrop-filter: blur(8px); }
.prompt:focus-within { border-color: var(--signal); }
.prompt .caret { color: var(--signal); font: 700 18px var(--f-mono); }
.prompt input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: 500 15px var(--f-mono); padding: 8px 0; }
.prompt input::placeholder { color: var(--faint); }

.notice { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); width: min(520px, 86%); background: color-mix(in srgb, var(--bg-2) 94%, transparent); border: 1px solid var(--line-2); border-top: 3px solid var(--signal); padding: 18px 20px; }
.notice h3 { font-size: 20px; margin: 4px 0 10px; }
.notice p { color: var(--muted); line-height: 1.5; margin: 6px 0; font-size: 12px; }
.notice dl { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: 11px; margin: 10px 0; }
.notice dt { color: var(--faint); text-transform: uppercase; letter-spacing: .08em; font-size: 10px; }

.clipov { position: absolute; inset: 0; background: #000; display: flex; align-items: center; justify-content: center; z-index: 5; }
.clipov video { width: 100%; height: 100%; object-fit: contain; }
.cliplab { position: absolute; left: 16px; bottom: 16px; font-size: 12px; background: rgba(14,15,16,.82); padding: 8px 12px; border-left: 3px solid var(--signal); }
.clipov .close { position: absolute; right: 12px; top: 12px; }

/* piano */
.plan { padding: 10px 12px 12px; max-height: 41vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.plan .empty { color: var(--muted); line-height: 1.55; font-size: 12px; margin: 4px 0; }
.plan .q { font-family: var(--f-title); font-stretch: 105%; font-size: 15px; line-height: 1.3; margin: 2px 0 10px; color: var(--text); }
.plan .q::before { content: '“'; color: var(--signal); }
.plan .q::after { content: '”'; color: var(--signal); }
.plan ol { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.plan li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s; }
.plan li.in { opacity: 1; transform: none; }
.plan li .ck { width: 16px; height: 16px; border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 11px; margin-top: 1px; color: #111; }
.plan li.run .ck { border-color: var(--signal); box-shadow: inset 0 0 0 3px var(--bg-2), inset 0 0 0 8px var(--signal); animation: blink .9s steps(2) infinite; }
.plan li.done .ck { background: var(--signal); border-color: var(--signal); }
.plan li .lb { font-size: 12px; line-height: 1.3; }
.plan li.run .lb { color: var(--signal); }
.plan li.done .lb { color: var(--text); }
.plan li .tl { font-size: 10px; color: var(--muted); margin-top: 2px; }
.plan li .tl code { color: var(--cyan); }
.plan li .rlb { font-size: 9px; color: #111; background: var(--cyan); padding: 0 4px; margin-left: 6px; letter-spacing: .08em; }
.plan .thinking { color: var(--muted); font-size: 12px; padding: 4px 0 8px; }
.plan .thinking i { display: inline-block; width: 6px; height: 6px; background: var(--signal); margin-right: 4px; animation: blink .6s steps(2) infinite; }
.plan .thinking i:nth-child(2) { animation-delay: .2s; } .plan .thinking i:nth-child(3) { animation-delay: .4s; }
.plan .reply { margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-left: 3px solid var(--signal); font-size: 12px; line-height: 1.5; color: var(--text); background: var(--bg); }
.plan .reply .eyebrow { display: block; margin-bottom: 4px; font-size: 9px; }
.plan .acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* camera testa */
.cam { position: relative; aspect-ratio: 4 / 3; max-height: 26vh; margin: 0 auto; background: #000; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam .rec { position: absolute; left: 8px; top: 6px; font-size: 10px; color: var(--err); font-weight: 700; animation: blink 1.2s steps(2) infinite; }
.cam .camlab { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; padding: 4px 8px; background: linear-gradient(transparent, rgba(0,0,0,.8)); color: var(--muted); }

/* RL */
.tabs { display: flex; gap: 0; }
.tab { font: 600 10px var(--f-mono); text-transform: uppercase; letter-spacing: .06em; padding: 3px 7px; background: transparent; color: var(--muted); border: 1px solid var(--line-2); cursor: pointer; }
.tab + .tab { border-left: 0; }
.tab.on { color: #111; background: var(--signal); border-color: var(--signal); }
.rl { padding: 8px 12px 12px; }
#rlc { width: 100%; height: 132px; display: block; }
.rlstats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 8px 0; font-size: 10px; color: var(--muted); }
.rlstats b { display: block; font-size: 15px; color: var(--text); font-weight: 700; }
.rlstats b.y { color: var(--signal); }
.rlstats .full { grid-column: 1 / -1; line-height: 1.4; }
.rlbtn { display: flex; gap: 6px; }

@keyframes blink { 50% { opacity: .25; } }

#loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 50; transition: opacity .5s; }

/* ---------------- regia ---------------- */
body.regia, body.regia * { cursor: none !important; }
body.regia { grid-template-rows: 1fr; }
body.regia .top, body.regia .col, body.regia .vtools, body.regia .chips, body.regia .status { display: none; }
body.regia .grid { grid-template-columns: 1fr; }
body.regia .vcap { display: none; }
body.regia .promptwrap { width: 1000px; bottom: 54px; transition: opacity .6s; }
body.regia .prompt input { font-size: 20px; }
body.regia #pPlan { display: block; position: fixed; right: 56px; top: 64px; width: 440px; border: 1px solid var(--line-2); border-top: 3px solid var(--signal); background: color-mix(in srgb, var(--bg-2) 90%, transparent); backdrop-filter: blur(8px); z-index: 4; transition: opacity .6s, transform .6s; }
body.regia #pPlan .plan { max-height: none; }
body.regia #pPlan .plan li .lb { font-size: 15px; }
body.regia #pPlan .plan li .tl { font-size: 11px; }
body.regia #pPlan .q { font-size: 18px; }
#regia { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.rg-fade { position: absolute; inset: 0; background: #000; opacity: 1; }
.rg-type { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 1300px; max-width: 92vw; z-index: 2; }
.rg-type .eyebrow { color: var(--signal); font-size: 14px; }
.rg-line { font: 500 46px var(--f-mono); color: var(--text); margin-top: 18px; line-height: 1.25; }
.rg-line .caret { color: var(--signal); margin-right: 18px; }
.cursor { display: inline-block; width: 0.55em; height: 1em; background: var(--signal); vertical-align: -0.12em; margin-left: 4px; }
.rg-title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 3; opacity: 0; }
.rg-title h1 { font-size: 220px; font-stretch: 125%; font-weight: 900; letter-spacing: -0.02em; line-height: .9; color: var(--text); }
.rg-title h1::first-letter { color: var(--signal); }
.rg-title p { font: 500 26px var(--f-mono); color: var(--muted); margin-top: 34px; letter-spacing: .04em; }
.rg-lower { position: absolute; left: 56px; bottom: 50px; z-index: 3; font: 600 15px var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text); border-left: 4px solid var(--signal); padding: 10px 16px; background: rgba(10,11,12,.72); opacity: 0; transition: opacity .5s; }
.rg-lower small { display: block; color: var(--muted); letter-spacing: .06em; font-size: 12px; margin-top: 4px; text-transform: none; }

/* responsive: in un iframe stretto i pannelli vanno sotto la vista */
@media (max-width: 1180px) {
  html, body { overflow: auto; }
  body { height: auto; grid-template-rows: auto auto; }
  .top { flex-wrap: wrap; padding: 8px 12px; gap: 10px; }
  .brand { min-width: 0; }
  .sys { display: none; }
  .grid { grid-template-columns: 1fr 1fr; }
  .view { grid-column: 1 / -1; grid-row: 1; height: 66vh; min-height: 420px; }
  .col.left, .col.right { border: 0; }
  .queue { max-height: 340px; }
  .plan { max-height: none; }
}
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .view { height: 72vh; }
  .promptwrap { bottom: 10px; }
  .chips { display: none; }
  .prompt input { font-size: 13px; }
  .spend .eyebrow { display: none; }
  .brand { width: 100%; }
  .modes { order: 3; flex-basis: 100%; }
  .vcap { display: none; }
  .vtools { left: 10px; right: auto; }
}
body.regia .col.right { display: contents; }
body.regia #pCam, body.regia #pRL { display: none; }
body.regia .clipov video { object-fit: cover; }
