/* Baileywiki Landing Page — helper panel + config forms. The buttons themselves are native
   Tiles/Drawings, so there are no canvas styles here. */

#baileywiki-landing-page-panel { background: none; border: none; box-shadow: none; }
#baileywiki-landing-page-panel .window-header { display: none; }
#baileywiki-landing-page-panel .window-content { padding: 0; background: none; }

.bwlp-panel {
  width: 210px; padding: 6px; border-radius: 8px;
  background: rgba(20, 20, 28, 0.92); border: 1px solid #000;
  color: #e9e2cf; font-size: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.bwlp-panel-head { display: flex; align-items: center; justify-content: space-between; cursor: move; margin-bottom: 6px; }
.bwlp-panel-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bwlp-collapse { color: #e9e2cf; opacity: 0.7; }
.bwlp-collapse:hover { opacity: 1; }

.bwlp-designmode-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.bwlp-dm-label { white-space: nowrap; }
.bwlp-switch { display: flex; align-items: center; gap: 6px; background: none; border: none; color: inherit; cursor: pointer; padding: 0; }
.bwlp-switch-track { width: 30px; height: 16px; border-radius: 10px; background: #444; position: relative; transition: background .15s; }
.bwlp-switch-thumb { position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #ddd; transition: left .15s; }
.bwlp-switch.on .bwlp-switch-track { background: #3a8f3a; }
.bwlp-switch.on .bwlp-switch-thumb { left: 16px; }
.bwlp-switch-state { width: 22px; text-align: left; }

.bwlp-actions-row { display: flex; flex-wrap: wrap; gap: 4px; }
.bwlp-actions-row button { flex: 1 1 auto; min-width: 30px; height: 28px; background: rgba(255,255,255,0.06); border: 1px solid #000; border-radius: 5px; color: #e9e2cf; cursor: pointer; }
.bwlp-actions-row button:hover { background: rgba(255,255,255,0.16); }
.bwlp-muted { opacity: 0.6; margin: 6px 2px 2px; font-style: italic; }

.bwlp-panel-collapsed { width: 34px; height: 34px; border-radius: 50%; background: rgba(20,20,28,0.92); border: 1px solid #000; color: #e9e2cf; cursor: move; box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
.bwlp-collapsed-window .window-content { overflow: visible; }

.bwlp-form .form-group { margin: 6px 0; }
.bwlp-footer { display: flex; justify-content: flex-end; margin-top: 8px; }

.bwlp-builder .bwlp-cats { border: 1px solid rgba(0,0,0,0.3); border-radius: 6px; padding: 6px 10px; margin: 6px 0; }
.bwlp-builder .bwlp-check { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.bwlp-builder .bwlp-check .notes { opacity: 0.6; }

.bwlp-offset { display: flex; gap: 6px; }
.bwlp-offset input { width: 50%; }

/* Custom-color scheme row (Builder + Scene Design) */
.bwlp-custom-color { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.bwlp-custom-color input[type="color"] { width: 44px; height: 28px; padding: 0; border: 1px solid var(--color-border-light-tertiary, #888); border-radius: 4px; background: none; cursor: pointer; }
.bwlp-custom-color .bwlp-eyedropper { flex: 0 0 auto; width: 30px; height: 28px; line-height: 26px; padding: 0; cursor: pointer; }

/* Custom button uploader */
.bwlp-file-row { display: flex; gap: 6px; align-items: center; }
.bwlp-file-row input[type="text"] { flex: 1 1 auto; }
.bwlp-btn-preview { display: block; max-width: 100%; max-height: 90px; margin-top: 8px; border: 1px solid var(--color-border-light-tertiary, #888); border-radius: 4px; background: rgba(0,0,0,0.15); }
.bwlp-custom-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.bwlp-custom-row .bwlp-btn-thumb { width: 64px; height: auto; max-height: 32px; object-fit: contain; }
.bwlp-custom-row .bwlp-custom-name { flex: 1 1 auto; }
.bwlp-custom-row .bwlp-remove { flex: 0 0 auto; }
.bwlp-tips { font-size: 12px; opacity: 0.85; margin: 4px 0 10px; }
.bwlp-tips ul { margin: 4px 0 0; padding-left: 18px; }

/* Scrollable TMFX preset checklist (per-tile hover editor + Builder/Scene Design) */
.bwlp-presets { max-height: 280px; overflow-y: auto; padding-right: 4px; }
.bwlp-hover-config { margin-top: 4px; }
.bwlp-hover-config .bwlp-presets { margin-top: 6px; border-top: 1px solid var(--color-border-light-tertiary, #555); padding-top: 6px; }
.bwlp-hover-glowfields { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; margin: 4px 0; }

/* Keep tall config forms (Builder / Scene Design) within the viewport with a reachable footer */
.bwlp-builder, .bwlp-scene-design { max-height: 78vh; overflow-y: auto; padding-right: 4px; }
.bwlp-builder .bwlp-footer, .bwlp-scene-design .bwlp-footer {
  position: sticky; bottom: 0; margin-top: 8px; padding-top: 8px;
  background: var(--color-bg, rgba(0,0,0,0.85)); backdrop-filter: blur(2px);
}
.bwlp-hover-config .bwlp-presets { max-height: 200px; }

/* Sectioned config layout (Builder / Scene Design) */
.bwlp-sec { border: 1px solid var(--color-border-light-tertiary, #555); border-radius: 5px; margin: 6px 0; padding: 2px 8px 6px; }
.bwlp-sec > summary { cursor: pointer; font-weight: 600; padding: 5px 0; list-style: revert; }
.bwlp-sec[open] > summary { margin-bottom: 4px; border-bottom: 1px solid var(--color-border-light-tertiary, #444); }
.bwlp-grid { display: grid; grid-template-columns: minmax(76px, auto) 1fr; gap: 6px 8px; align-items: center; margin: 4px 0; }
.bwlp-grid > label { white-space: nowrap; }
.bwlp-applyrow { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; }
.bwlp-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.bwlp-cats legend { grid-column: 1 / -1; }

/* Scene Design: per-section apply buttons */
.bwlp-scene-design .bwlp-apply { width: 100%; margin-top: 8px; }


/* Subtle Baileywiki property credits in the helper panel */
.bwlp-credits { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--color-border-light-tertiary, #3a3a3a); display: flex; flex-direction: column; gap: 2px; }
.bwlp-credits a { font-size: 10px; line-height: 1.3; opacity: 0.55; color: inherit; text-decoration: none; }
.bwlp-credits a:hover { opacity: 1; text-decoration: underline; }

/* Per-tile Tile Hover Effect modal: presets cascade across columns, no internal scrolling */
.bwlp-hover-modal .bwlp-preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px 14px; align-content: start; }
.bwlp-hover-modal .bwlp-preset-columns { border: 1px solid var(--color-border-light-tertiary, #555); border-radius: 4px; padding: 4px 8px; }
.bwlp-hover-modal .bwlp-preset-grid .bwlp-check { margin: 0; white-space: nowrap; }

/* Tile Hover Effect modal: Save pinned to the top so it's never cut off */
.bwlp-hover-modal .bwlp-top-actions { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; padding-bottom: 6px; margin-bottom: 4px; background: var(--color-bg, rgba(0,0,0,0.85)); border-bottom: 1px solid var(--color-border-light-tertiary, #444); }
.bwlp-hover-modal .bwlp-top-actions button { width: auto; }

/* Unified Designer: full-width per-section apply buttons */
.bwlp-designer .bwlp-apply { width: 100%; margin-top: 8px; }
.bwlp-designer .bwlp-applyrow .bwlp-apply { width: auto; }

/* Visual style browser */
.bwlp-style-browser { display: flex; flex-direction: column; height: 100%; }
.bwlp-sb-header { position: sticky; top: 0; z-index: 2; display: flex; gap: 8px; padding: 6px 8px; background: var(--color-bg, rgba(10,10,12,0.96)); border-bottom: 1px solid var(--color-border-light-tertiary, #444); }
.bwlp-sb-header input { flex: 1 1 auto; }
.bwlp-sb-header button { flex: 0 0 auto; }
.bwlp-sb-grid { flex: 1 1 auto; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; padding: 10px; align-content: start; }
.bwlp-sb-card { cursor: pointer; border: 2px solid transparent; border-radius: 6px; padding: 5px; text-align: center; background: rgba(255,255,255,0.05); }
.bwlp-sb-card:hover { background: rgba(255,255,255,0.12); }
.bwlp-sb-card.selected { border-color: var(--color-border-highlight, #ff7a1a); background: rgba(255,122,26,0.12); }
.bwlp-sb-card img { width: 100%; height: 56px; object-fit: contain; display: block; }
.bwlp-sb-label { display: block; margin-top: 5px; font-size: 12px; }
/* Designer style picker button */
.bwlp-style-choose { display: flex; align-items: center; gap: 6px; width: 100%; justify-content: flex-start; }
.bwlp-style-choose img { height: 24px; max-width: 90px; object-fit: contain; }
.bwlp-style-choose span { flex: 1 1 auto; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Category Defaults ("Settings") — scrollable body with a sticky Save bar pinned to the top, and a
   per-button [entity type | target] pair of dropdowns. */
.bwlp-catconfig { max-height: 78vh; overflow-y: auto; padding-right: 4px; }
.bwlp-catconfig .bwlp-top-actions { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; padding: 4px 0 6px; margin-bottom: 6px; background: var(--color-bg, rgba(0,0,0,0.85)); border-bottom: 1px solid var(--color-border-light-tertiary, #444); backdrop-filter: blur(2px); }
.bwlp-cat-row { display: grid; grid-template-columns: minmax(90px, auto) 1fr; gap: 6px 10px; align-items: center; }
.bwlp-cat-row > label { white-space: nowrap; }
.bwlp-cat-selects { display: grid; grid-template-columns: minmax(96px, 0.5fr) 1fr; gap: 6px; min-width: 0; }
.bwlp-cat-selects select { min-width: 0; }

/* Tile Hover Effect modal — type-ahead filter + scrollable preset grid (worlds can have 100s of presets) */
.bwlp-hover-modal .bwlp-preset-search { width: 100%; margin: 2px 0 6px; box-sizing: border-box; }
.bwlp-hover-modal .bwlp-preset-count { margin-top: 4px; }
/* Keep the modal within the viewport. The TMFX preset grid gets a DEFINITE height cap so it always
   scrolls internally (a flex-based cap doesn't work here — the ApplicationV2 window auto-sizes, so
   there's no bounded parent to flex against, and the grid would overflow onto the sound field). The
   whole modal also caps + scrolls as a fallback on very short windows, with Save pinned at the top. */
.bwlp-hover-modal { max-height: 86vh; overflow-y: auto; }
.bwlp-hover-modal .bwlp-preset-scroll { max-height: 40vh; overflow-y: auto; padding-right: 4px; }
.bwlp-hover-modal .bwlp-sound-field { margin-top: 8px; }

/* Immersive landing-page mode (per-scene, players only): hide the majority of Foundry chrome so the
   landing page is a clean front door. The canvas (#board / #ui-middle) stays; windows still open. */
body.bwlp-immersive #ui-left,
body.bwlp-immersive #ui-top,
body.bwlp-immersive #ui-right,
body.bwlp-immersive #ui-bottom,
body.bwlp-immersive #navigation,
body.bwlp-immersive #controls,
body.bwlp-immersive #sidebar,
body.bwlp-immersive #hotbar,
body.bwlp-immersive #players,
body.bwlp-immersive #logo { display: none !important; }

/* Panel header buttons: minimize + explicit close */
.bwlp-head-btns { display: flex; align-items: center; gap: 9px; }
.bwlp-head-btns a { cursor: pointer; }
.bwlp-close { color: #e9b0a8; opacity: 0.72; }
.bwlp-close:hover { opacity: 1; color: #ff8c7a; }

/* Sample landing-page importer */
.bwlp-samples .bwlp-sample-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--color-border-light-tertiary, #444); }
.bwlp-samples .bwlp-sample-row:last-child { border-bottom: none; }
.bwlp-samples .bwlp-sample-meta { min-width: 0; }
.bwlp-samples .bwlp-sample-row button { width: auto; white-space: nowrap; }

/* Scene base section (unified Background / Backdrop) */
.bwlp-radio-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.bwlp-radio-row .bwlp-check { display: inline-flex; align-items: center; gap: 5px; margin: 0; }
.bwlp-info { opacity: 0.6; cursor: help; }
.bwlp-info:hover { opacity: 1; }
.bwlp-backdrop-only { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--color-border-light-tertiary, rgba(0,0,0,0.1)); }

/* Sound fields (hover/click sound pickers) */
.bwlp-sound-row { display: flex; gap: 6px; align-items: center; }
.bwlp-sound-row select { flex: 1 1 auto; min-width: 0; }
.bwlp-preview { flex: 0 0 auto; width: 30px; height: 28px; cursor: pointer; }
.bwlp-range-row { display: flex; gap: 8px; align-items: center; }
.bwlp-range-row input[type="range"] { flex: 1 1 auto; }
.bwlp-range-val { flex: 0 0 auto; min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; opacity: 0.8; }
.bwlp-sound-field { margin: 6px 0; }

/* Sound browser modal */
.bwlp-sound-browser { display: flex; flex-direction: column; height: 100%; }
.bwlp-sbrowse-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 2; padding-bottom: 6px; background: var(--color-bg, rgba(0,0,0,0.9)); }
.bwlp-sound-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.bwlp-sound-tab { padding: 4px 14px; cursor: pointer; }
.bwlp-sound-tab.active { background: rgba(255,255,255,0.14); border-color: var(--color-border-highlight, #ff6400); }
.bwlp-sbrowse-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.bwlp-sbrowse-actions button { width: auto; }
.bwlp-sound-panel { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 4px; }
.bwlp-sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; align-content: start; padding: 4px 0; }
.bwlp-sound-chip { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 6px 8px; cursor: pointer; }
.bwlp-sound-chip.selected { background: rgba(255,255,255,0.16); border-color: var(--color-border-highlight, #ff6400); }
/* Sound field current-selection label */
.bwlp-sound-current { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 6px; border: 1px solid var(--color-border-light-tertiary, #555); border-radius: 4px; opacity: 0.9; }

/* Stage 5 — Lock Category: per-category padlock row in the Builder */
.bwlp-cats .bwlp-cat-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.bwlp-cats .bwlp-cat-row .bwlp-check { flex: 1 1 auto; margin: 0; }
.bwlp-catlock { flex: 0 0 auto; background: none; border: none; cursor: pointer; opacity: 0.55; padding: 2px 5px; line-height: 1; }
.bwlp-catlock:hover { opacity: 0.9; }
.bwlp-catlock.locked { opacity: 1; color: #e0a91b; }

/* Stage 6b — per-effect fine-tune panel (opened from a settings cog on each preset) */
.bwlp-hover-modal .bwlp-preset-item { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.bwlp-preset-cog { flex: 0 0 auto; background: none; border: none; cursor: pointer; opacity: 0.5; padding: 1px 4px; line-height: 1; }
.bwlp-preset-cog:hover { opacity: 0.9; }
.bwlp-preset-cog.customized { opacity: 1; color: #35c46b; }
.bwlp-preset-tweak .bwlp-ov-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
.bwlp-preset-tweak .bwlp-ov-grid input[type="number"] { width: 100%; }
.bwlp-preset-tweak .bwlp-ov-grid input[type="color"] { width: 48px; height: 24px; padding: 0; }
.bwlp-preset-tweak .bwlp-applyrow { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

/* Markers — selector marks section in the hover editor */
.bwlp-hover-modal .bwlp-marker-field { border: 1px solid var(--color-border-light-tertiary, #555); border-radius: 4px; padding: 4px 8px; margin-top: 6px; }
.bwlp-hover-modal .bwlp-marker-field legend { padding: 0 4px; }
.bwlp-hover-modal .bwlp-marker-row input[type="color"] { width: 48px; height: 22px; padding: 0; }

/* Per-effect invert toggle + effect rows in the hover editor */
.bwlp-hover-modal .bwlp-effect-row { display: flex; align-items: center; gap: 6px; }
.bwlp-hover-modal .bwlp-effect-row .bwlp-check { flex: 1 1 auto; margin: 0; }
.bwlp-invert { flex: 0 0 auto; background: none; border: none; cursor: pointer; opacity: 0.45; padding: 1px 5px; line-height: 1; }
.bwlp-invert:hover { opacity: 0.85; }
.bwlp-invert.on { opacity: 1; color: #6cb2ff; }

/* Preview User View — panel note while the GM is seeing the player front door */
.bwlp-preview-note { margin: 2px 0 6px; color: #e9c79a; font-style: italic; }
