/* ── Places workspace (barbotaipa's redesign, 2026-08-28): the place stays on
   screen and the UI works around it — strip of places up top, the current view
   as the fixed workspace, actions directly under it, one Views & History strip
   for every output, and a right rail (place card / CREATE / PLACE STRUCTURE).
   Same doctrine as the rest of the app: no framework, theme variables only. ── */

.pl-shell { display: flex; flex-direction: column; gap: 14px; }

/* ── My Places strip ── */
.pl-striprow { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pl-mylabel {
  flex: 0 0 auto; font-size: 13px; font-weight: 700; color: var(--accent);
  display: flex; align-items: center; gap: 8px;
}
.pl-strip {
  display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px;
  scrollbar-width: thin; min-width: 0;
}
.pl-tile {
  flex: 0 0 128px; cursor: pointer; border-radius: 10px; overflow: hidden;
  border: 2px solid var(--border-strong); background: var(--surface-2);
  position: relative;
}
.pl-tile img { width: 100%; height: 72px; object-fit: cover; display: block; }
.pl-tile .nm {
  display: block; font-size: 11px; padding: 4px 7px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: var(--text);
}
.pl-tile.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pl-tile .kd { position: absolute; top: 4px; right: 5px; font-size: 11px; }
.pl-tile.add {
  display: flex; align-items: center; justify-content: center; height: 98px;
  border-style: dashed; font-size: 22px; color: var(--text-dim);
}
.pl-tile.add:hover { color: var(--accent); border-color: var(--accent); }

/* ── workspace: main column + right rail ── */
.pl-work {
  display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px;
  align-items: start;
}
.pl-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.pl-viewer {
  position: relative; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border-strong); background: var(--surface-2);
  min-height: 220px;
}
.pl-viewer img { width: 100%; display: block; max-height: 68vh; object-fit: contain; }
.pl-viewer canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
#plAnnoCanvas { touch-action: none; }
.pl-annochips {
  position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 3;
}
.pl-dropzones {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 5; flex-wrap: wrap; justify-content: center;
  max-width: 92%;
}
.pl-dropzones .dz {
  font-size: 12.5px; font-weight: 700; padding: 10px 16px; border-radius: 999px;
  border: 1.5px dashed var(--accent); background: var(--bg); color: var(--accent);
}
.pl-dropzones .dz.over { background: var(--accent); color: #000; border-style: solid; }
.pl-shot[draggable="true"] { cursor: grab; }
.pl-annochips .download-btn { background: var(--bg); }
.pl-pen {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-2);
  cursor: pointer; padding: 0;
}
.pl-pen.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pl-annonote {
  position: absolute; z-index: 4; width: 200px; font-size: 12px; padding: 6px 9px;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg);
  color: var(--text); outline: none;
}
.pl-spotpanel { width: 224px; padding: 9px; }
.pl-viewtag {
  position: absolute; left: 10px; bottom: 10px; font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff;
}
.pl-viewer .empty {
  display: flex; align-items: center; justify-content: center; min-height: 220px;
  color: var(--text-faint); font-size: 13px; text-align: center; padding: 20px;
}

.pl-actionbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pl-actionbar .trait-input { flex: 1 1 180px; min-width: 140px; font-size: 12.5px; }
.pl-stations { display: flex; gap: 6px; flex-wrap: wrap; }
.pl-station {
  font-size: 12px; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
}
.pl-station.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.pl-actionbar .gen-btn { flex: 0 0 auto; max-width: 170px; font-size: 12px; padding: 10px 16px; margin: 0; }

.pl-historyrow .section-label { display: flex; align-items: center; gap: 8px; }
.pl-history {
  display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px 8px; scrollbar-width: thin;
}
.pl-shot {
  flex: 0 0 104px; cursor: pointer; border-radius: 9px; overflow: hidden;
  border: 2px solid var(--border-strong); background: var(--surface-2); position: relative;
}
.pl-shot img { width: 100%; height: 64px; object-fit: cover; display: block; }
.pl-shot .nm {
  display: block; font-size: 10px; padding: 3px 6px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: var(--text-dim); text-align: center;
}
.pl-shot.active { border-color: var(--accent); }
.pl-shot.pending { border-style: dashed; }
.pl-shot .keep {
  position: absolute; top: 3px; left: 3px; right: 3px; display: flex; gap: 4px;
  justify-content: center;
}
.pl-shot .keep button {
  font-size: 10px; padding: 2px 7px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: rgba(0, 0, 0, .65); color: #fff;
}
.pl-shot .keep button:first-child { border-color: var(--accent); color: var(--accent); }
.pl-shot .star {
  position: absolute; top: 2px; right: 4px; font-size: 12px; text-shadow: 0 0 4px #000;
}

/* ── right rail ── */
.pl-rail { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pl-panel {
  border: 1px solid var(--border-strong); border-radius: 14px; padding: 12px 14px;
  background: var(--surface);
}
.pl-paneltitle {
  font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.pl-paneltitle .spacer { flex: 1; }

.pl-card { display: flex; gap: 10px; position: relative; }
.pl-card img {
  width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: 0 0 auto;
  border: 1px solid var(--border);
}
.pl-card .meta { min-width: 0; flex: 1; }
.pl-card b { font-size: 14px; cursor: pointer; }
.pl-card b:hover { color: var(--accent); }
.pl-card textarea {
  width: 100%; margin-top: 6px; padding: 7px 9px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-2); color: var(--text); font: inherit;
  font-size: 11.5px; min-height: 40px; resize: vertical;
}
.pl-counts { font-size: 11px; color: var(--text-dim); margin-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pl-counts select { font-size: 11px; padding: 3px 6px; width: auto; }
.pl-menu-btn {
  position: absolute; top: 0; right: 0; background: none; border: 0; cursor: pointer;
  color: var(--text-dim); font-size: 16px; padding: 2px 6px;
}
.pl-menu {
  position: absolute; top: 24px; right: 0; z-index: 20; display: none;
  flex-direction: column; gap: 2px; padding: 6px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border-strong);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
}
.pl-menu.open { display: flex; }
.pl-menu button {
  background: none; border: 0; color: var(--text); font: inherit; font-size: 12.5px;
  cursor: pointer; text-align: left; padding: 6px 10px; border-radius: 7px; white-space: nowrap;
}
.pl-menu button:hover { background: var(--surface-2); }

.pl-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.pl-tab {
  background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  color: var(--text-dim); font: inherit; font-size: 12.5px; padding: 6px 10px;
}
.pl-tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

.pl-drop {
  border: 1.5px dashed var(--border-strong); border-radius: 10px; padding: 16px 12px;
  text-align: center; font-size: 12px; color: var(--text-dim); cursor: pointer;
}
.pl-drop:hover, .pl-drop.over { border-color: var(--accent); color: var(--accent); }

.pl-obj { border: 1px solid var(--border); border-radius: 9px; margin-bottom: 6px; }
.pl-obj summary {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer;
  font-size: 12.5px; list-style: none;
}
.pl-obj summary::-webkit-details-marker { display: none; }
.pl-obj summary .zn { font-size: 10px; color: var(--text-faint); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; }
.pl-obj summary .cnt { margin-left: auto; font-size: 11px; color: var(--text-faint); }
.pl-obj[open] { border-color: var(--accent); }
.pl-obj .body { padding: 0 10px 9px; font-size: 11.5px; color: var(--text-dim); }
.pl-obj .acts { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }

.pl-refrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
.pl-refrow .rf { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); cursor: pointer; }
.pl-refrow .rf img { width: 100%; height: 56px; object-fit: cover; display: block; }
.pl-refrow .rf .b3 { position: absolute; top: 2px; left: 3px; font-size: 9px; font-weight: 800; background: var(--accent); color: #000; border-radius: 999px; padding: 0 5px; }

.pl-empty { max-width: 640px; }

/* ── narrow: rail drops below the main column ── */
@media (max-width: 1020px) {
  .pl-work { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .pl-striprow { flex-direction: column; align-items: stretch; gap: 6px; }
  .pl-viewer img { max-height: 46vh; }
}

.pl-spotspill {
  position: absolute; top: 10px; right: 10px; z-index: 3; cursor: pointer;
  font-size: 11.5px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  border: 1px solid rgba(77, 107, 255, .8); background: var(--bg); color: #7d9aff;
}
.pl-spotspill:hover { background: rgba(77, 107, 255, .18); }

/* ── 🎬 film studio (storyboard → FLUX 3 clip) ───────────────────────────── */
.film-sheet {
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 16px;
  width: min(980px, 94vw); max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.film-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.film-sub { font-size: 11.5px; color: var(--text-dim); }
.film-body { display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 16px; padding: 14px 16px; overflow-y: auto; }
.film-left { min-width: 0; }
.film-right { display: flex; flex-direction: column; }
.film-lbl { font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--text-dim); margin: 10px 0 5px; }
.film-lbl span { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-faint); }
.film-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.film-chip {
  font-size: 12px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
}
.film-chip.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.film-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; max-height: 40vh; overflow-y: auto; }
.film-shot { position: relative; border-radius: 9px; overflow: hidden; border: 2px solid var(--border); cursor: pointer; }
.film-shot img { width: 100%; height: 68px; object-fit: cover; display: block; }
.film-shot.on { border-color: var(--accent); }
.film-num {
  position: absolute; top: 3px; left: 3px; min-width: 18px; height: 18px; border-radius: 999px;
  background: var(--accent); color: #000; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.film-list { display: flex; flex-direction: column; gap: 10px; }
.film-card { border: 1px solid var(--border); border-radius: 11px; padding: 8px; }
.film-card.pending { border-style: dashed; }
.film-card.err { border-color: #f8717155; }
.film-card video { width: 100%; border-radius: 8px; display: block; background: #000; }
.film-row { display: flex; align-items: center; gap: 7px; margin-top: 7px; flex-wrap: wrap; }
.film-name { font-size: 12px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.film-cost { font-size: 11.5px; color: var(--accent); margin: 8px 0 0; }
.film-note { font-size: 11px; color: var(--text-faint); margin: 6px 0 0; }
.film-empty { font-size: 12px; color: var(--text-faint); }
@media (max-width: 860px) { .film-body { grid-template-columns: 1fr; } }
.film-cast { display: flex; gap: 6px; flex-wrap: wrap; }
.film-castchip {
  font-size: 11.5px; padding: 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.film-castchip.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }

/* ── ➜ motion pen: draw how the subject moves through one beat ───────────── */
.film-motionbtn {
  position: absolute; bottom: 3px; right: 3px; font-size: 9.5px; font-weight: 700;
  padding: 2px 6px; border-radius: 999px; cursor: pointer; line-height: 1.5;
  border: 1px solid rgba(255, 40, 200, .75); background: rgba(0, 0, 0, .66); color: #ff7ad9;
}
.film-motionbtn.on { background: rgba(255, 40, 200, .9); color: #fff; border-color: #ff28c8; }
#filmMotion {
  position: fixed; inset: 0; z-index: 9400; background: rgba(0, 0, 0, .78);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
#filmMotion .fm-sheet {
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 14px;
  padding: 12px; max-width: min(1000px, 94vw); display: flex; flex-direction: column; gap: 10px;
}
#filmMotion .fm-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
#filmMotion .fm-stage { position: relative; line-height: 0; }
#filmMotion .fm-stage img { max-width: 100%; max-height: 66vh; border-radius: 10px; display: block; }
#filmMotion .fm-stage canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair;
}
#filmMotion .fm-note { width: 100%; font-size: 12.5px; }
.film-tpl {
  position: absolute; top: 3px; right: 3px; font-size: 8.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em; padding: 1px 5px; border-radius: 999px;
  background: rgba(0, 0, 0, .7); color: var(--accent);
}

/* ── 🎞 Studio: library · stage · inspector, timeline underneath ─────────── */
.st-shell { display: flex; flex-direction: column; gap: 12px; }
.st-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-lbl { font-size: 11px; color: var(--text-dim); display: flex; align-items: center; gap: 5px; }
.st-lbl select { width: auto; font-size: 12px; padding: 5px 8px; }
.st-body { display: grid; grid-template-columns: 232px minmax(0, 1fr) 244px; gap: 12px; align-items: start; }
.st-lib, .st-inspect {
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 10px;
  background: var(--surface);
}
.st-libbody {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 7px;
  max-height: 46vh; overflow-y: auto;
}
.st-libitem {
  position: relative; border-radius: 8px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2);
}
.st-libitem img, .st-libitem video { width: 100%; height: 52px; object-fit: cover; display: block; }
.st-libitem:hover { border-color: var(--accent); }
.st-libitem .st-add {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .55); color: var(--accent); font-size: 20px; font-weight: 700;
}
.st-libitem:hover .st-add { display: flex; }
.st-badge {
  position: absolute; top: 2px; right: 3px; font-size: 9px; font-weight: 800;
  background: rgba(0, 0, 0, .7); color: #fff; border-radius: 999px; padding: 0 5px;
}
.st-uploadbtn {
  grid-column: 1 / -1; border: 1.5px dashed var(--border-strong); border-radius: 9px;
  padding: 12px 8px; text-align: center; font-size: 12px; color: var(--text-dim); cursor: pointer;
}
.st-uploadbtn:hover { border-color: var(--accent); color: var(--accent); }
.st-stage { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.st-preview {
  border: 1px solid var(--border-strong); border-radius: 12px; background: #000;
  min-height: 260px; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.st-preview img, .st-preview video { max-width: 100%; max-height: 52vh; display: block; }
.st-preview .film-empty { padding: 24px; text-align: center; }
.st-status { font-size: 12px; color: var(--accent); min-height: 18px; display: flex; align-items: center; gap: 8px; }
.st-timeline-wrap { border-top: 1px solid var(--border); padding-top: 8px; }
.st-timeline {
  display: flex; gap: 4px; overflow-x: auto; padding: 8px 2px; align-items: stretch;
  min-height: 92px; scrollbar-width: thin;
}
.st-clip {
  position: relative; flex: 0 0 108px; border-radius: 9px; overflow: hidden; cursor: grab;
  border: 2px solid var(--border-strong); background: var(--surface-2);
}
.st-clip.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.st-clip.over { border-color: #7d9aff; border-style: dashed; }
.st-clip img, .st-clip video { width: 100%; height: 62px; object-fit: cover; display: block; }
.st-clipdur {
  display: block; font-size: 10px; text-align: center; color: var(--text-dim); padding: 2px 0;
}
.st-trans {
  position: absolute; right: -3px; top: 22px; font-size: 8.5px; font-weight: 700;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 1px 5px; color: var(--text-faint); z-index: 2;
}
@media (max-width: 1100px) { .st-body { grid-template-columns: 1fr; } }
.st-music { display: inline-flex; align-items: center; gap: 6px; }
.st-musicname {
  font-size: 11.5px; color: var(--accent); max-width: 150px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.st-vol { width: 76px; accent-color: var(--accent); }
