/* === WORLD-BUILDER.CSS === */
/* =========================================
   WORLD NOTES TEMPORARILY HIDDEN FOR REDO
   ========================================= */
#btn-toggle-world,
#btn-world-m,
#accordion-world-notes,
#world-builder-panel,
#world-panel-resizer,
#lore-dossier-card {
    display: none !important;
}

/* =========================================
   WORLD BUILDER POP-OUT & DOCKING SYSTEM
   ========================================= */

#world-builder-panel {
    background: var(--panel-bg, var(--bg-color, #0a0a0a));
    color: var(--panel-text, var(--main-color));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 12;
    flex-shrink: 0;
    opacity: 0;
    transition:
        width 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
        opacity 0.2s ease,
        box-shadow 0.2s ease;
    width: 0;
    height: 100% !important;
    max-height: 100% !important;
    box-sizing: border-box;
    position: relative;
    border: none;
}

#world-builder-panel.panel-open {
    opacity: 1;
}

#world-builder-panel.panel-hidden {
    display: none !important;
}

/* =========================================
   WORKSPACE DOCKING POSITIONS FOR WORLD BUILDER
   ========================================= */

/* Left Dock */
#workspace-flex.world-pos-left #world-builder-panel {
    order: -3;
    width: var(--world-panel-w, 480px);
    max-width: 85vw;
    min-width: 280px;
    height: 100%;
    border-right: 2px solid var(--main-color);
    border-left: none;
    border-top: none;
    border-bottom: none;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.4);
}

#workspace-flex.world-pos-left #world-panel-resizer {
    order: -2;
    width: 8px;
    height: 100%;
    cursor: col-resize;
}

/* Right Dock */
#workspace-flex.world-pos-right #world-builder-panel {
    order: 4;
    width: var(--world-panel-w, 480px);
    max-width: 85vw;
    min-width: 280px;
    height: 100%;
    border-left: 2px solid var(--main-color);
    border-right: none;
    border-top: none;
    border-bottom: none;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.4);
}

#workspace-flex.world-pos-right #world-panel-resizer {
    order: 3;
    width: 8px;
    height: 100%;
    cursor: col-resize;
}

/* Expanded / Wide View */
#world-builder-panel.world-panel-expanded {
    width: min(75vw, 920px) !important;
}

/* Resizer Bar */
#world-panel-resizer {
    flex: 0 0 8px;
    width: 8px;
    height: 100%;
    background: transparent;
    z-index: 55;
    transition: background 0.2s;
    user-select: none;
}

#world-panel-resizer:hover,
#world-panel-resizer.active {
    background: var(--main-color);
    opacity: 0.35;
}

#world-builder-panel.panel-hidden~#world-panel-resizer,
#world-builder-panel:not(.panel-open)~#world-panel-resizer {
    display: none !important;
}

/* =========================================
   PANEL HEADER
   ========================================= */

.world-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--panel-bg, #111);
    border-bottom: 2px solid var(--main-color);
    color: var(--panel-text, var(--main-color));
    gap: 6px;
    flex-shrink: 0;
    min-height: 40px;
    box-sizing: border-box;
    user-select: none;
}

.world-panel-title-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: bold;
    letter-spacing: 1px;
    font-size: 12px;
    white-space: nowrap;
}

.world-icon {
    font-size: 14px;
}

.world-panel-title {
    color: var(--main-color);
    text-transform: uppercase;
}

.world-header-center {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

.world-tab-btn {
    background: transparent;
    border: 1px solid var(--main-color);
    color: var(--main-color);
    font-family: inherit;
    font-size: 10px;
    font-weight: bold;
    padding: 3px 7px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.15s ease;
    border-radius: 2px;
}

.world-tab-btn:hover,
.world-tab-btn.active {
    background: var(--main-color);
    color: var(--bg-color, #000);
}

.world-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.world-pos-quick-bar {
    display: flex;
    gap: 2px;
}

.world-pos-btn {
    background: transparent;
    border: 1px solid var(--main-color);
    color: var(--main-color);
    font-size: 10px;
    padding: 2px 5px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    transition: all 0.15s ease;
    border-radius: 2px;
}

.world-pos-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.world-pos-btn.active {
    opacity: 1;
    background: var(--main-color);
    color: var(--bg-color, #000);
}

.world-close-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--main-color);
    font-size: 13px;
    font-weight: bold;
    padding: 2px 7px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.15s ease;
    border-radius: 2px;
}

.world-close-btn:hover {
    background: var(--warning-color, #ff4444);
    color: #fff;
    border-color: var(--warning-color, #ff4444);
}

/* =========================================
   PANEL BODY & VIEWS
   ========================================= */

.world-panel-body-slot {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: calc(100% - 40px);
    position: relative;
}

.world-panel-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

#world-panel-slot .world-panel-body {
    height: 100%;
    padding: 10px 14px;
    box-sizing: border-box;
}

#world-panel-slot .world-view-container {
    padding: 2px 0;
}

#world-panel-slot #world-sidebar-dock-footer {
    display: none !important;
}

#world-sidebar-slot .world-panel-body {
    height: auto;
    max-height: none;
    padding: 0;
}

#world-sidebar-slot .world-notes-scroll,
#world-sidebar-slot .world-corkboard-scroll {
    max-height: 380px;
    overflow-y: auto;
}

#world-panel-slot .world-notes-scroll,
#world-panel-slot .world-corkboard-scroll {
    flex: 1 1 auto;
    height: 100%;
    max-height: none;
    overflow-y: auto;
}

.world-view-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    padding: 4px 0;
}

/* =========================================
   SEARCH & FILTER BAR
   ========================================= */

.world-search-bar {
    display: flex;
    gap: 6px;
    align-items: center;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.search-input-wrap {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-color);
    border: 1px solid var(--main-color);
    padding: 3px 6px;
    border-radius: 2px;
    box-sizing: border-box;
}

.search-input-wrap input {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--main-color);
    font-family: inherit;
    font-size: 10.5px;
    outline: none;
    text-transform: uppercase;
}

.search-input-wrap input::placeholder {
    opacity: 0.65;
    color: var(--main-color);
}

.clear-search-btn {
    background: transparent;
    border: none;
    color: var(--main-color);
    font-size: 10px;
    cursor: pointer;
    opacity: 0.7;
    padding: 0 2px;
    flex-shrink: 0;
}

.clear-search-btn:hover {
    opacity: 1;
}

.world-status-select {
    flex: 0 0 auto;
    max-width: 105px;
    background: var(--bg-color, #000);
    border: 1px solid var(--main-color);
    color: var(--main-color);
    font-family: inherit;
    font-size: 10px;
    padding: 3px 4px;
    outline: none;
    border-radius: 2px;
    cursor: pointer;
    box-sizing: border-box;
}

.world-status-select option {
    background: var(--panel-bg, var(--bg-color, #111));
    color: var(--panel-text, var(--main-color, #eee));
}

/* =========================================
   LIST VIEW & ACCORDIONS
   ========================================= */

.world-notes-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 8px;
    padding-right: 2px;
}

.acc-wrapper {
    margin-bottom: 8px;
    border: 1px solid rgba(127, 127, 127, 0.25);
    border-radius: 3px;
    overflow: hidden;
    background: var(--bg-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.acc-header {
    display: flex;
    align-items: center;
    background: rgba(127, 127, 127, 0.08);
    border-bottom: 1px solid rgba(127, 127, 127, 0.18);
}

.acc-btn {
    background: transparent;
    border: none;
    color: var(--panel-text, var(--main-color));
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    padding: 7px 10px;
    cursor: pointer;
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-transform: uppercase;
    transition: background 0.15s ease, color 0.15s ease;
}

.acc-btn:hover,
.acc-btn.active {
    background: rgba(127, 127, 127, 0.15);
    color: var(--main-color);
}

.acc-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
    background: var(--bg-color);
}

.acc-panel.open {
    padding: 4px 8px;
    overflow: visible;
}

.acc-chevron {
    transition: transform 0.15s ease;
    display: inline-block;
    user-select: none;
    font-size: 9px;
    opacity: 0.75;
}

#world-panel-slot #world-sidebar-dock-footer {
    display: none !important;
}

.note-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 4px;
    border-bottom: 1px dashed rgba(127, 127, 127, 0.22);
    transition: background 0.15s ease;
    border-radius: 2px;
}

.note-row:hover {
    background: rgba(127, 127, 127, 0.1);
}

.note-item {
    flex: 1 1 auto;
    background: transparent;
    border: none;
    color: var(--panel-text, var(--main-color));
    text-align: left;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 2px 4px;
    font-weight: 500;
}

.note-item:hover {
    text-decoration: underline;
    color: var(--main-color);
}

.note-snippet-text {
    font-size: 10px;
    opacity: 0.75;
    margin-left: 6px;
    font-weight: normal;
    color: inherit;
}

.note-add-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--main-color);
    color: var(--main-color);
    padding: 5px 8px;
    cursor: pointer;
    font-size: 11px;
    margin: 6px 0 2px 0;
    text-align: center;
    border-radius: 2px;
    transition: all 0.15s ease;
}

.note-add-btn:hover {
    background: var(--main-color);
    color: var(--bg-color, #000);
    font-weight: bold;
}

/* Add Category Bar */
.world-add-category-bar {
    display: flex;
    gap: 4px;
    padding-top: 6px;
    border-top: 1px solid rgba(127, 127, 127, 0.25);
    flex-shrink: 0;
}

.world-add-category-bar input {
    flex: 1 1 0;
    min-width: 0;
    background: var(--bg-color);
    border: 1px solid var(--main-color);
    color: var(--main-color);
    font-family: inherit;
    font-size: 10.5px;
    padding: 3px 6px;
    text-transform: uppercase;
    outline: none;
    box-sizing: border-box;
    border-radius: 2px;
}

/* =========================================
   STATUS BADGES & CHIPS
   ========================================= */

.status-badge {
    font-size: 9px;
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 2px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: 1px solid;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-idea {
    color: #ffaa00;
    border-color: #ffaa00;
    background: rgba(255, 170, 0, 0.12);
}

.status-planned {
    color: #00ccff;
    border-color: #00ccff;
    background: rgba(0, 204, 255, 0.12);
}

.status-draft {
    color: #cc66ff;
    border-color: #cc66ff;
    background: rgba(204, 102, 255, 0.12);
}

.status-revise {
    color: #ff5555;
    border-color: #ff5555;
    background: rgba(255, 85, 85, 0.12);
}

.status-done {
    color: #00ff66;
    border-color: #00ff66;
    background: rgba(0, 255, 102, 0.12);
}

/* =========================================
   CORKBOARD & CARD GRID VIEW
   ========================================= */

.world-corkboard-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 8px;
    padding-right: 2px;
}

.corkboard-cat-section {
    margin-bottom: 16px;
    background: rgba(127, 127, 127, 0.06);
    border: 1px solid var(--main-color);
    border-radius: 4px;
    padding: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.corkboard-cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(127, 127, 127, 0.22);
    font-weight: bold;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: var(--panel-text, var(--main-color));
}

.corkboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.corkboard-card {
    background: var(--bg-color);
    border: 1px solid var(--main-color);
    border-radius: 3px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    min-height: 90px;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    color: var(--panel-text, var(--main-color));
}

.corkboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    border-color: var(--main-color);
    filter: brightness(1.05);
}

.corkboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 4px;
}

.corkboard-card-title {
    font-weight: bold;
    font-size: 12px;
    color: var(--main-color);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.corkboard-card-thumb {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 2px;
    border: 1px solid rgba(127, 127, 127, 0.25);
    margin-top: 2px;
}

.corkboard-card-excerpt {
    font-size: 10px;
    opacity: 0.85;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    flex: 1;
    color: inherit;
}

/* =========================================
   NOTE EDIT VIEW
   ========================================= */

.note-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    flex-wrap: wrap;
}

.note-edit-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.note-category-chip {
    font-size: 11px;
    font-weight: bold;
    background: rgba(127, 127, 127, 0.15);
    border: 1px solid var(--main-color);
    padding: 2px 6px;
    border-radius: 2px;
    color: var(--main-color);
    text-transform: uppercase;
}

.note-edit-actions-top {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.btn-save {
    background: var(--main-color) !important;
    color: var(--bg-color, #000) !important;
    font-weight: bold !important;
}

.btn-del {
    color: var(--warning-color, #ff4444) !important;
    border-color: var(--warning-color, #ff4444) !important;
}

.note-templates-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    padding: 4px 8px;
    background: rgba(127, 127, 127, 0.08);
    border: 1px dashed rgba(127, 127, 127, 0.3);
    border-radius: 3px;
}

.tpl-label {
    font-size: 10px;
    font-weight: bold;
    opacity: 0.8;
    white-space: nowrap;
    color: var(--panel-text, var(--main-color));
}

.note-template-select {
    flex: 1 1 auto;
    max-width: none;
    font-size: 10px;
    padding: 3px 6px;
}

.note-inputs-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

#note-title {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-color);
    border: 1px solid rgba(127, 127, 127, 0.25);
    border-bottom: 2px solid var(--main-color);
    color: var(--main-color);
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    padding: 6px 10px;
    outline: none;
    border-radius: 3px 3px 0 0;
    transition: border-color 0.2s ease, background 0.2s ease;
}

#note-title:focus {
    background: var(--bg-color);
    border-bottom-color: var(--main-color);
    box-shadow: 0 1px 0 0 var(--main-color);
}

.note-img-url-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#note-url {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-color);
    border: 1px solid rgba(127, 127, 127, 0.25);
    border-bottom: 1px dashed var(--main-color);
    color: var(--main-color);
    font-family: inherit;
    font-size: 11px;
    padding: 4px 8px;
    outline: none;
    border-radius: 2px;
}

#note-url:focus {
    border-bottom-color: var(--main-color);
    border-bottom-style: solid;
}

#note-img-preview-wrap {
    margin: 4px 0;
    max-height: 120px;
    overflow: hidden;
    border-radius: 3px;
    border: 1px solid rgba(127, 127, 127, 0.25);
}

#note-img-preview {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    display: block;
}

.note-editor-wrapper {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 160px;
    margin-bottom: 0;
}

#note-content {
    flex: 1 1 auto;
    width: 100%;
    box-sizing: border-box;
    resize: none;
    background: var(--bg-color);
    border: 1px solid var(--main-color);
    color: var(--main-color);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.55;
    padding: 10px 12px;
    outline: none;
    border-radius: 3px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

#note-content:focus {
    border-color: var(--main-color);
    box-shadow: 0 0 0 1px var(--main-color), inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.note-char-counter {
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 9px;
    opacity: 0.6;
    font-family: monospace;
    pointer-events: none;
}

.note-edit-footer {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.note-edit-footer button {
    flex: 1 1 auto;
    font-size: 10px !important;
    padding: 5px 8px !important;
    white-space: nowrap;
}

/* =========================================
   SIDEBAR POP-OUT LAUNCHER CARD
   ========================================= */

.world-launcher-card {
    background: var(--bg-color);
    border: 1px solid var(--main-color);
    border-radius: 4px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.world-launcher-btn {
    width: 100%;
    font-size: 11px !important;
    font-weight: bold !important;
    padding: 8px !important;
    background: var(--main-color) !important;
    color: var(--bg-color, #000) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.world-launcher-btn:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.world-dock-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.world-stats-pill-row {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    opacity: 0.8;
    font-family: monospace;
    padding: 3px 0;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

/* =========================================
   SMART LORE PEEK & AUTO-UNDERLINE
   ========================================= */

.lore-entity-mark {
    border-bottom: 1.5px dotted var(--main-color, #ffff00);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    border-radius: 2px;
    padding: 0 1px;
}

.lore-entity-mark.lore-entity-character {
    border-bottom-color: #00ddff;
}

.lore-entity-mark.lore-entity-location {
    border-bottom-color: #00ff88;
}

.lore-entity-mark.lore-entity-faction {
    border-bottom-color: #ffaa00;
}

.lore-entity-mark.lore-entity-item {
    border-bottom-color: #ff55ff;
}

.lore-entity-mark.lore-entity-lore,
.lore-entity-mark.lore-entity-general {
    border-bottom-color: var(--main-color, #ffff00);
}

.lore-entity-mark:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.25);
}

.lore-entity-mark.lore-entity-character:hover {
    background: rgba(0, 221, 255, 0.15);
    box-shadow: 0 0 6px rgba(0, 221, 255, 0.35);
}

.lore-entity-mark.lore-entity-location:hover {
    background: rgba(0, 255, 136, 0.15);
    box-shadow: 0 0 6px rgba(0, 255, 136, 0.35);
}

.lore-entity-mark.lore-entity-faction:hover {
    background: rgba(255, 170, 0, 0.15);
    box-shadow: 0 0 6px rgba(255, 170, 0, 0.35);
}

.lore-entity-mark.lore-entity-item:hover {
    background: rgba(255, 85, 255, 0.15);
    box-shadow: 0 0 6px rgba(255, 85, 255, 0.35);
}

/* Occurrence Active Focus Pulse */
.lore-active-focus,
.lint-active-target {
    outline: 2px solid var(--main-color, #ffff00) !important;
    background: rgba(255, 255, 255, 0.22) !important;
    box-shadow: 0 0 14px var(--main-color, #ffff00) !important;
    border-radius: 2px;
    animation: loreFocusPulse 1.6s ease-out;
}

@keyframes loreFocusPulse {
    0% {
        outline-color: #ffffff;
        background: rgba(255, 255, 255, 0.4);
        box-shadow: 0 0 20px #ffffff;
    }

    50% {
        outline-color: var(--main-color, #ffff00);
        background: rgba(255, 255, 255, 0.22);
        box-shadow: 0 0 14px var(--main-color, #ffff00);
    }

    100% {
        outline-color: var(--main-color, #ffff00);
        background: rgba(255, 255, 255, 0.1);
        box-shadow: 0 0 6px var(--main-color, #ffff00);
    }
}

/* =========================================
   LORE DOSSIER SUMMARY CARD (PEEK POPUP)
   ========================================= */

.lore-dossier-card {
    position: fixed;
    z-index: 28000;
    width: 320px;
    max-width: 90vw;
    background: var(--panel-bg, #111111);
    border: 2px solid var(--main-color, #ffff00);
    border-radius: 4px;
    padding: 10px 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85), 0 0 15px rgba(0, 0, 0, 0.5);
    font-family: inherit;
    color: var(--panel-text, var(--main-color, #ffff00));
    box-sizing: border-box;
    pointer-events: auto;
    animation: loreDossierFadeIn 0.15s ease-out;
}

@keyframes loreDossierFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.lore-dossier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.lore-dossier-meta-left {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.lore-dossier-cat-badge {
    font-size: 9px;
    font-weight: bold;
    padding: 1px 5px;
    border: 1px solid var(--main-color, #ffff00);
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.08);
}

.lore-dossier-close-btn {
    background: transparent;
    border: none;
    color: var(--main-color, #ffff00);
    font-size: 11px;
    cursor: pointer;
    padding: 0 2px;
    opacity: 0.7;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.lore-dossier-close-btn:hover {
    opacity: 1;
    transform: scale(1.15);
}

.lore-dossier-title-row {
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.lore-dossier-title {
    margin: 0;
    font-size: 13px;
    font-weight: bold;
    color: var(--main-color, #ffff00);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.25;
    word-break: break-word;
}

.lore-dossier-thumb-wrap {
    margin-bottom: 8px;
    max-height: 110px;
    overflow: hidden;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.lore-dossier-thumb {
    width: 100%;
    max-height: 110px;
    object-fit: cover;
    display: block;
}

.lore-dossier-body {
    max-height: 170px;
    overflow-y: auto;
    font-size: 10.5px;
    line-height: 1.45;
    opacity: 0.9;
    padding-right: 2px;
    word-break: break-word;
}

.lore-dossier-field {
    margin-bottom: 5px;
}

.lore-dossier-field-label {
    font-weight: bold;
    color: var(--main-color, #ffff00);
    opacity: 0.9;
}

.lore-dossier-field-val {
    opacity: 0.85;
}

.lore-dossier-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.lore-dossier-occ-stepper {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lore-dossier-occ-btn,
.note-occ-btn {
    background: transparent;
    border: 1px solid var(--main-color, #ffff00);
    color: var(--main-color, #ffff00);
    font-size: 9px;
    padding: 2px 6px;
    cursor: pointer;
    border-radius: 2px;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

.lore-dossier-occ-btn:hover,
.note-occ-btn:hover {
    background: var(--main-color, #ffff00);
    color: var(--bg-color, #000);
}

.lore-dossier-occ-counter,
.note-occ-counter {
    font-size: 10px;
    font-family: monospace;
    opacity: 0.85;
    white-space: nowrap;
}

.lore-dossier-actions {
    display: flex;
    gap: 4px;
}

.lore-dossier-action-btn {
    font-size: 9.5px !important;
    font-weight: bold !important;
    padding: 3px 8px !important;
    background: var(--main-color, #ffff00) !important;
    color: var(--bg-color, #000) !important;
    cursor: pointer;
}

/* =========================================
   NOTE EDITOR OCCURRENCE STEPPER BAR
   ========================================= */

.note-occurrence-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    margin: 8px 0;
    background: rgba(127, 127, 127, 0.08);
    border: 1px solid rgba(127, 127, 127, 0.25);
    border-radius: 3px;
    color: var(--panel-text, var(--main-color));
}

.note-occ-label {
    font-size: 9.5px;
    font-weight: bold;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.note-occ-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}