/* Clearframe: a three column studio (queue, stage, inspector) on top of tool.css.
 * Collapses to one column under 980px; everything works at 360px wide. */
.wrap.cf { width: min(1380px, 100% - 32px); }
.cf-hero { grid-template-columns: auto 1fr; align-items: center; gap: 22px; padding: 64px 0 18px; }
.cf-hero > div { display: grid; gap: 12px; }
.cf-icon { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 18px 40px -16px rgba(84, 197, 222, .55); }
@media (max-width: 600px) { .cf-hero { grid-template-columns: 1fr; } .cf-icon { width: 64px; height: 64px; } }

.cf-tabs { display: inline-flex; gap: 4px; padding: 4px; margin: 6px 0 14px; border-radius: 999px; background: rgba(11, 19, 61, .8); border: 1px solid rgba(255, 255, 255, .06); }
.cf-tabs button { border: 0; background: transparent; color: #aeb7d0; font: 700 14px/1 var(--sans); padding: 10px 18px; border-radius: 999px; cursor: pointer; }
.cf-tabs button[aria-selected="true"] { background: linear-gradient(180deg, var(--cobalt), #123f6a); color: #fff; }

.studio { display: grid; grid-template-columns: 230px minmax(0, 1fr) 300px; grid-template-areas: "queue stage insp" "status status status"; gap: 14px; }
.queue { grid-area: queue; } .stage { grid-area: stage; } .inspector { grid-area: insp; } .statusbar { grid-area: status; }
.queue, .stage, .inspector, .statusbar, .td-col { border-radius: var(--radius); background: rgba(11, 19, 61, .72); border: 1px solid rgba(255, 255, 255, .06); padding: 14px; min-width: 0; }
.statusbar { padding: 4px 14px 12px; }

.queue { display: grid; grid-template-rows: auto auto 1fr auto; gap: 10px; max-height: 760px; }
.queue-head { display: flex; justify-content: space-between; font: 600 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #aeb7d0; }
.queue-head span { color: var(--sky); }
.add { position: relative; }
.add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#list { list-style: none; margin: 0; padding: 0; overflow: auto; display: grid; gap: 6px; align-content: start; min-height: 60px; }
#list li button { width: 100%; display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; text-align: left; padding: 6px; border-radius: 12px; border: 1px solid transparent; background: rgba(255, 255, 255, .03); color: var(--paper); cursor: pointer; }
#list li button[aria-current="true"] { border-color: var(--sky); background: rgba(84, 197, 222, .08); }
#list img { width: 52px; height: 40px; object-fit: cover; border-radius: 7px; background: #050a22; }
#list .nm { font: 600 12px/1.25 var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
#list .st { font: 500 10.5px/1.3 var(--mono); color: var(--mist); display: block; }
#list .st.ok { color: #7fd9a6; } #list .st.bad { color: var(--bloom); } #list .st.run { color: var(--sky); }
.btn.small { padding: 9px 14px; font-size: 13px; }

.stage { display: grid; gap: 10px; align-content: start; }
.stage-top { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }
.stage-name { display: grid; gap: 2px; min-width: 0; }
.stage-name b { font: 700 15px/1.25 var(--sans); overflow-wrap: anywhere; }
.stage-name span { font: 500 12px/1.3 var(--mono); color: var(--mist); }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--night); border: 1px solid var(--rule); }
.seg button { border: 0; background: transparent; color: #aeb7d0; padding: 7px 13px; border-radius: 999px; font: 600 12px/1 var(--sans); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: inset 0 0 0 1px rgba(84, 197, 222, .5); }

.canvas-wrap { position: relative; min-height: 380px; border-radius: 14px; overflow: hidden; display: grid; place-items: center;
  background: repeating-conic-gradient(#060b24 0% 25%, #0a1030 0% 50%) 50% / 22px 22px; border: 1px solid rgba(255, 255, 255, .06); }
.drop.big { width: 100%; height: 100%; min-height: 380px; border-radius: 14px; box-shadow: none; }
#view { max-width: 100%; max-height: 66vh; display: block; image-rendering: auto; touch-action: none; }
#view.pixel { image-rendering: pixelated; }
.canvas-wrap.drawing #view { cursor: crosshair; }
.canvas-wrap.over::after { content: "Drop to add"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(88, 27, 159, .45); font: 800 22px/1 var(--serif); border: 2px dashed var(--bloom); border-radius: 14px; }
.mask-draft, .masks i { position: absolute; border: 1.5px dashed var(--sky); background: rgba(84, 197, 222, .12); pointer-events: none; }
.masks i { border-style: solid; border-color: var(--bloom); background: rgba(223, 71, 104, .14); }
.masks i button { position: absolute; top: -10px; right: -10px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--bloom); color: #fff; font: 700 12px/20px var(--sans); cursor: pointer; pointer-events: auto; padding: 0; }
.busy { position: absolute; inset: auto 12px 12px auto; display: flex; gap: 8px; align-items: center; padding: 7px 12px; border-radius: 999px; background: rgba(1, 6, 27, .85); font: 500 12px/1 var(--mono); }
.busy i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--sky); border-top-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.timeline { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; font: 500 12px/1 var(--mono); color: #aeb7d0; }
.timeline input { accent-color: var(--bloom); width: 100%; }
.timeline[hidden], #motionPlayer[hidden] { display: none; }
#motionPlayer { width: 100%; max-height: 50vh; border-radius: 12px; background: #000; }
.mask-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mask-tools .btn[aria-pressed="true"] { border-color: var(--sky); color: var(--sky); }
.hint { font: 500 12px/1.45 var(--mono); color: var(--mist); }

.inspector { display: grid; gap: 10px; align-content: start; max-height: none; }
.group { border-top: 1px solid rgba(255, 255, 255, .06); padding-top: 10px; display: grid; gap: 8px; }
.group:first-child { border-top: 0; padding-top: 0; }
.group summary { cursor: pointer; font: 600 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--sky); list-style: none; padding: 2px 0 4px; }
.group summary::-webkit-details-marker { display: none; }
.group summary::after { content: " +"; color: var(--mist); }
.group[open] summary::after { content: " -"; }
.group[open] > :not(summary) { margin-top: 0; }
.lab { display: grid; gap: 6px; font: 600 11px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: #aeb7d0; }
.lab output { color: var(--paper); }
.inspector select, .inspector input[type="number"] { width: 100%; padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid var(--rule); background: var(--night); color: var(--paper); font: 500 14px/1.2 var(--sans); }
.inspector input[type="range"] { width: 100%; accent-color: var(--bloom); }
.check { display: flex; gap: 8px; align-items: center; font: 500 13.5px/1.3 var(--sans); color: var(--paper); cursor: pointer; }
.check input { accent-color: var(--bloom); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > select, .row > input { flex: 1 1 auto; width: auto; min-width: 0; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; }
.icon-btn { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--rule); background: var(--night); color: var(--paper); font: 700 18px/1 var(--sans); cursor: pointer; }
.icon-btn:hover { border-color: var(--sky); }
.icon-btn[hidden] { display: none; }
.actions { display: grid; gap: 8px; padding-top: 6px; }
.actions .btn[hidden] { display: none; }
.motion-only[hidden] { display: none; }

.textdesk { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.textdesk[hidden] { display: none; }
.td-col { display: grid; gap: 10px; align-content: start; }
.td-head { display: flex; justify-content: space-between; font: 600 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #aeb7d0; }
.td-head span { color: var(--sky); letter-spacing: .04em; }
.textdesk textarea { width: 100%; min-height: 360px; resize: vertical; padding: 14px; border-radius: 12px; border: 1px solid var(--rule); background: var(--night); color: var(--paper); font: 400 15px/1.6 var(--sans); }
.edits { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font: 500 12px/1.4 var(--mono); color: #aeb7d0; }
.edits li b { color: var(--sky); font-weight: 600; }
.textdesk label.btn { position: relative; }

.note-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 28px; margin-top: 10px; }
.note-grid .note { margin: 22px 0 0; }
.note-grid .note:last-child { margin-bottom: 60px; }
code { font: 500 .92em var(--mono); color: var(--sky); }

@media (max-width: 980px) {
  .studio { grid-template-columns: 1fr; grid-template-areas: "stage" "queue" "insp" "status"; }
  .queue { max-height: 340px; }
  .textdesk { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .canvas-wrap, .drop.big { min-height: 260px; }
  .timeline { grid-template-columns: 1fr auto; }
  .timeline > span { display: none; }
  .timeline #motion { grid-column: 1 / -1; }
}

/* The hidden attribute must win over the display rules above. */
.cf [hidden] { display: none !important; }
.inspector .row > input, .inspector .row > select { width: auto; flex: 1 1 0; min-width: 0; }
