/* Image-first Places. Keep the viewer and its canvases in the same box;
   detailed tools use native disclosure and normal page scrolling. */
#placesLayout { padding: 18px 24px 32px; min-width: 0; }
#placesLayout .pl-shell { display: flex; flex-direction: column; gap: 14px; max-width: 1180px; margin: 0 auto; }
.pl-workspace-heading h1 { margin: 0; font-size: 18px; font-weight: 600; }
.pl-workspace-heading p { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); }
#placesLayout .pl-striprow { align-items: center; gap: 14px; }
#placesLayout .pl-mylabel { font-size: 11px; }
#placesLayout .pl-tile { flex-basis: 86px; }
#placesLayout .pl-tile img { height: 48px; }
#placesLayout .pl-tile.add { height: 74px; }
#placesLayout .pl-strip { padding-bottom: 4px; }
#placesLayout .pl-work { display: flex; flex-direction: column; gap: 18px; }
#placesLayout .pl-main, #placesLayout .pl-rail { width: 100%; }
.pl-hero-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pl-hero-heading h2 { margin: 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.pl-hero-heading button { flex-shrink: 0; }
#placesLayout .pl-viewer { min-height: 0; }
#placesLayout .pl-viewer img { max-height: clamp(240px, 43dvh, 500px); }
#placesLayout .pl-panel { padding: 16px; }
.pl-play label { display: block; font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.pl-prompt-row { display: flex; align-items: stretch; gap: 12px; }
#placesLayout #plDreamPrompt { width: 100%; flex: 1; min-width: 0; resize: vertical; font-size: 14px; line-height: 1.5; min-height: 64px; }
#placesLayout #plDreamBtn { margin: 0; padding: 12px 24px; width: auto; min-width: 150px; font-size: 15px; flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
#plDreamBtn span { font-size: 11px; font-weight: 400; }
.pl-suggestions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pl-play-hint { font-size: 12px; line-height: 1.5; color: var(--text-muted); margin: 10px 0 0; }
.pl-preview-actions { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid var(--accent); border-radius: 12px; background: var(--surface); }
.pl-preview-actions[hidden] { display: none; }
.pl-preview-actions > div { flex: 1; }
.pl-preview-actions strong { font-size: 14px; }
.pl-preview-actions p { font-size: 12px; color: var(--text-muted); margin: 4px 0 0; }
#placesLayout .pl-keep-btn { color: var(--accent); border-color: var(--accent); }
#placesLayout .pl-historyrow .section-label { flex-wrap: wrap; }
#placesLayout .pl-rail { display: block; border-top: 1px solid var(--border); }
#plDetails > summary { cursor: pointer; padding: 16px 2px; font-size: 14px; font-weight: 600; }
#plDetails > summary span { margin-left: 12px; font-size: 12px; font-weight: 400; color: var(--text-muted); }
.pl-details-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.pl-view-tools, #plStructurePanel { grid-column: 1 / -1; }
#plDetails:not([data-section="Refs"]) .pl-card,
#plDetails:not([data-section="Refs"]) #plTabEnv { display: none; }
#plDetails .pl-details-grid { margin-top: 12px; }
.pl-library-filter, .pl-organize-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pl-library-filter input { margin-left: auto; width: min(260px, 100%); }
#placesLayout .pl-tile[hidden] { display: none; }
.pl-build-target { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; font-size: 12px; color: var(--accent); }
.pl-build-target[hidden] { display: none; }
.pl-build-target span { overflow-wrap: anywhere; }
.pl-organize-tabs { overflow-x: auto; }
.pl-organize-tabs button { flex-shrink: 0; }
.pl-area-grid { display: flex; gap: 10px; overflow-x: auto; padding: 12px 2px; }
.pl-area-tile, .pl-element-tile { border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); border-radius: 10px; padding: 0; overflow: hidden; cursor: pointer; text-align: left; font: inherit; }
.pl-area-tile { flex: 0 0 156px; }
.pl-area-tile img, .pl-area-placeholder { width: 100%; height: 84px; object-fit: cover; display: block; }
.pl-area-placeholder, .pl-element-placeholder { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 11px; text-align: center; padding: 10px; }
.pl-area-tile strong, .pl-element-tile strong { display: block; padding: 8px 10px; font-size: 13px; overflow-wrap: anywhere; }
.pl-area-tile > span:last-child:not(.pl-area-placeholder) { display: block; padding: 0 10px 8px; font-size: 11px; color: var(--text-muted); }
.pl-area-tile.active, .pl-element-tile.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pl-area-add { padding: 16px; text-align: center; border-style: dashed; }
.pl-area-notes { margin-top: 14px; font-size: 12px; }
.pl-area-notes summary { cursor: pointer; padding: 8px 0; }
.pl-area-notes textarea { display: block; width: 100%; margin: 8px 0; min-height: 64px; }
.pl-element-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(130px,1fr)); gap: 12px; margin: 14px 0; }
.pl-element-frame { height: 104px; display: flex; align-items: center; justify-content: center; }
.pl-element-crop { position: relative; display: block; width: min(100%, calc(104px * var(--pl-crop-ratio, 1))); aspect-ratio: var(--pl-crop-ratio, 1); overflow: hidden; }
.pl-element-crop img { position: absolute; max-width: none; object-fit: fill; }
.pl-element-placeholder { height: 104px; }
#plElementInspector:not(:empty) { border-top: 1px solid var(--border); padding-top: 12px; }
#plElementInspector h3 { font-size: 15px; margin: 0 0 8px; }
#plElementInspector p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
#plDetails, #plCreatePanel, #plViewer { scroll-margin-top: 180px; }
#placesLayout .pl-actionbar { gap: 8px; margin-top: 12px; }
#placesLayout .pl-station { padding: 8px 12px; }
#placesLayout .pl-drop { width: 100%; margin-top: 12px; background: transparent; font: inherit; font-size: 13px; }
#placesLayout .pl-drop span { font-size: 11px; }
#placesLayout button:focus-visible, #placesLayout summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#placesLayout button:disabled { opacity: .5; cursor: not-allowed; }
#placesLayout button.busy { opacity: 1; }
@media (max-width: 768px) {
  #placesLayout { padding: 12px 10px 24px; }
  #placesLayout .pl-striprow { flex-direction: column; align-items: stretch; gap: 4px; }
  #placesLayout .pl-viewer img { max-height: 42dvh; }
  #placesLayout .pl-panel { padding: 12px; }
  .pl-prompt-row { flex-direction: column; gap: 8px; }
  #placesLayout #plDreamBtn { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; }
  .pl-suggestions { flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 6px; }
  .pl-suggestions button { flex-shrink: 0; }
  .pl-hero-heading { flex-wrap: wrap; }
  .pl-preview-actions { flex-wrap: wrap; padding: 12px; }
  .pl-preview-actions > div { flex-basis: 100%; }
  .pl-preview-actions button { flex: 1; }
  .pl-details-grid { grid-template-columns: minmax(0, 1fr); }
  .pl-library-filter input { flex-basis: 100%; width: 100%; margin-left: 0; }
  .pl-build-target { flex-wrap: wrap; }
  #plDetails > summary span { display: block; margin: 6px 0 0 16px; }
  #placesLayout .pl-actionbar .trait-input { flex-basis: 100%; }
  #placesLayout input, #placesLayout textarea, #placesLayout select, #placesLayout #plDreamPrompt { font-size: 16px; }
  #placesLayout button, #placesLayout summary { min-height: 44px; }
  #placesLayout .pl-pen { min-width: 44px; }
  #placesLayout .pl-shot { flex-basis: 118px; }
  #placesLayout .pl-shot .keep { position: static; background: var(--surface); padding: 2px; }
  #placesLayout .pl-shot .keep button { background: var(--surface-2); color: var(--text); border-radius: 6px; min-width: 44px; }
}
