{{#if collapsed}}
  <button type="button" class="bwlp-panel-collapsed" data-action="toggleCollapse" data-tooltip="{{localize 'BWLP.PanelTitle'}}">
    <i class="fas fa-image-portrait"></i>
  </button>
{{else}}
  <section class="bwlp-panel">
    <div class="bwlp-panel-head">
      <span class="bwlp-panel-title" data-tooltip="{{sceneName}}">{{#if hasScene}}{{sceneName}}{{else}}{{localize "BWLP.PanelTitle"}}{{/if}}</span>
      <span class="bwlp-head-btns">
        <a class="bwlp-collapse" data-action="toggleCollapse" data-tooltip="{{localize 'BWLP.Collapse'}}"><i class="fas fa-window-minimize"></i></a>
        <a class="bwlp-close" data-action="closePanel" data-tooltip="{{localize 'BWLP.ClosePanel'}}"><i class="fas fa-xmark"></i></a>
      </span>
    </div>
    {{#if hasScene}}
      {{#if isGM}}
        {{#if previewMode}}
          <p class="bwlp-muted bwlp-preview-note">{{localize "BWLP.PreviewNote"}}</p>
          <div class="bwlp-designmode-row">
            <span class="bwlp-dm-label"><i class="fas fa-eye"></i> {{localize "BWLP.PreviewUserView"}}</span>
            <button type="button" class="bwlp-switch on" data-action="togglePreview" role="switch" aria-checked="true" data-tooltip="{{localize 'BWLP.PreviewTip'}}">
              <span class="bwlp-switch-track"><span class="bwlp-switch-thumb"></span></span>
              <span class="bwlp-switch-state">{{localize "BWLP.On"}}</span>
            </button>
          </div>
        {{else}}
          <div class="bwlp-designmode-row">
            <span class="bwlp-dm-label"><i class="fas fa-pen-ruler"></i> {{localize "BWLP.DesignMode"}}</span>
            <button type="button" class="bwlp-switch {{#if designMode}}on{{/if}}" data-action="toggleDesign" role="switch" aria-checked="{{designMode}}" data-tooltip="{{localize 'BWLP.DesignModeTip'}}">
              <span class="bwlp-switch-track"><span class="bwlp-switch-thumb"></span></span>
              <span class="bwlp-switch-state">{{#if designMode}}{{localize "BWLP.On"}}{{else}}{{localize "BWLP.Off"}}{{/if}}</span>
            </button>
          </div>

          <div class="bwlp-designmode-row">
            <span class="bwlp-dm-label"><i class="fas fa-eye"></i> {{localize "BWLP.PreviewUserView"}}</span>
            <button type="button" class="bwlp-switch" data-action="togglePreview" role="switch" aria-checked="false" data-tooltip="{{localize 'BWLP.PreviewTip'}}">
              <span class="bwlp-switch-track"><span class="bwlp-switch-thumb"></span></span>
              <span class="bwlp-switch-state">{{localize "BWLP.Off"}}</span>
            </button>
          </div>

          <div class="bwlp-actions-row">
            <button type="button" data-action="builder" data-tooltip="{{localize 'BWLP.DesignerTitle'}}"><i class="fas fa-wand-magic-sparkles"></i></button>
            <button type="button" data-action="settings" data-tooltip="{{localize 'BWLP.Settings'}}"><i class="fas fa-sliders"></i></button>
            <button type="button" data-action="samples" data-tooltip="{{localize 'BWLP.SamplesTitle'}}"><i class="fas fa-photo-film"></i></button>
            <button type="button" data-action="checkAccess" data-tooltip="{{localize 'BWLP.AccessCheck'}}"><i class="fas fa-user-check"></i></button>
          </div>
          <p class="bwlp-muted">{{buttonCount}} {{localize "BWLP.Buttons"}}</p>
        {{/if}}
      {{else}}
        <p class="bwlp-muted">{{localize "BWLP.PlayerHint"}}</p>
      {{/if}}
    {{else}}
      <p class="bwlp-muted">{{localize "BWLP.NoScene"}}</p>
    {{/if}}
    {{#if showCredits}}
    <div class="bwlp-credits">
      <a href="https://turnsheet.ai" target="_blank" rel="noopener">Character poses &amp; art: turnsheet.ai</a>
      <a href="https://madprops.ai" target="_blank" rel="noopener">Scenes &amp; props: madprops.ai</a>
      <a href="https://batlgrid.ai" target="_blank" rel="noopener">Top-down Assets: batlgrid.ai</a>
    </div>
    {{/if}}
  </section>
{{/if}}
