
/* ==========================================
   World Book Styles
   ========================================== */
.world-book-popup-overlay {
    justify-content: flex-end;
}

.world-book-popup-sheet {
    position: relative;
    border-top-left-radius: 26px !important;
    border-top-right-radius: 26px !important;
    background: #fff !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.12);
}

.world-book-popup-header {
    background: #fff !important;
    border-bottom: 1px solid #f2f2f7;
}

.world-book-popup-content {
    background: #fff !important;
}

.world-book-popup-tabs {
    pointer-events: auto;
}

.world-book-popup-sheet .settings-content,
.world-book-popup-sheet .wb-tab-content,
.world-book-popup-sheet #wb-all-list,
.world-book-popup-sheet #wb-global-list,
.world-book-popup-sheet #wb-local-list {
    background: #fff;
}

.wb-centered-modal-overlay {
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.wb-centered-modal-overlay .bottom-sheet {
    transform: none;
}

.wb-centered-modal-card {
    width: min(100%, 420px);
    max-height: min(88vh, 760px);
    background: rgba(255, 255, 255, 0.98);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(17, 17, 17, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wb-group-modal-card {
    width: min(100%, 360px);
}

.wb-book-modal-card {
    width: min(100%, 440px);
    height: min(85vh, 760px);
}

.wb-centered-modal-header {
    padding: 20px 20px 14px;
    background: #fff;
    flex-shrink: 0;
}

.wb-book-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.wb-centered-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #111;
}

.wb-centered-modal-body {
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.wb-book-modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wb-book-modal-body #wb-entries-list-container {
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 600px) {
    .wb-centered-modal-overlay {
        padding:
            max(20px, env(safe-area-inset-top, 0px))
            16px
            20px;
    }

    .wb-centered-modal-card {
        max-height: calc(100% - max(40px, env(safe-area-inset-top, 0px) + 0px));
    }
}

.bubble-btn:active {
    background-color: #e5e5ea !important;
    transform: scale(0.98);
    transition: transform 0.1s;
}

.wb-segment-btn {
    transition: all 0.2s;
    font-weight: 500;
}

.wb-segment-btn.active {
    background-color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    font-weight: 600;
}

.wb-tab-content {
    display: none;
    height: 100%;
}

.wb-tab-content.active {
    display: block;
}

/* Group & Book Items - Pure Folder Style */
#wb-all-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px 20px;
    align-items: start;
}

.wb-group-container {
    margin: 0;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    grid-column: span 1;
}

.wb-group-container.is-open {
    grid-column: span 2;
}

.wb-group-header {
    position: relative;
    background-color: transparent;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; /* Center everything like an app icon */
    cursor: pointer;
    margin-bottom: 0;
    box-shadow: none;
    border: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.wb-group-header:active {
    transform: scale(0.92);
    opacity: 0.7;
}

.wb-group-container.is-open .wb-group-header:active {
    transform: scale(0.96);
    opacity: 0.9;
}

.wb-group-folder-icon {
    font-size: 56px; /* Massive minimalist folder icon */
    color: #111; /* Pure black */
    margin-bottom: 12px;
    transition: color 0.3s ease, transform 0.3s ease;
    text-shadow: 0 4px 12px rgba(0,0,0,0.05); /* Slight depth */
}

/* Open state styles */
.wb-group-container.is-open .wb-group-header {
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 16px;
    background: #111;
    border-radius: 16px; /* Pill shape when open */
    margin-bottom: 4px;
}

.wb-group-container.is-open .wb-group-folder-icon {
    color: #fff; /* Flip to white */
    font-size: 24px; /* Shrink to row icon */
    margin-bottom: 0;
    margin-right: 12px;
}

.wb-group-title {
    width: 100%;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #111;
    line-height: 1.2;
    transition: color 0.3s ease, text-align 0.3s ease;
}

.wb-group-container.is-open .wb-group-title {
    color: #fff;
    text-align: left;
}

.wb-group-title span {
    color: #8e8e93 !important;
    font-weight: 500 !important;
    font-size: 12px !important;
    margin-left: 4px !important;
    display: inline-block;
    transition: color 0.3s ease;
}

.wb-group-container.is-open .wb-group-title span {
    color: #a1a1aa !important;
}

/* Hide chevron in pure folder view */
.wb-group-header .toggle-icon {
    display: none; 
}

/* Only show chevron when open, to indicate collapsibility */
.wb-group-container.is-open .wb-group-header .toggle-icon {
    display: block;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%) rotate(180deg);
    color: #fff !important;
    opacity: 0.6;
}

.wb-group-content {
    display: none;
    flex-direction: column;
    background-color: transparent;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    border: none;
    margin-top: 12px;
    gap: 8px;
}

.wb-group-content.open {
    display: flex;
    animation: fadeInSlideDown 0.3s ease forwards;
}

@keyframes fadeInSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wb-book-item {
    background-color: #fff;
    border-radius: 18px;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: none;
    border: 1px solid #ececf1;
    cursor: pointer;
    transition: transform 0.1s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease, height 0.3s ease, background-color 0.2s ease;
    transform-origin: top;
}

.wb-group-content .wb-book-item {
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border-radius: 16px;
    border: 1px solid #f2f2f7;
    margin-bottom: 0;
    background: #fff;
}

.wb-group-content .wb-book-item:last-child {
    border-bottom: 1px solid #f2f2f7;
}

.wb-book-item:active {
    transform: scale(0.98);
    background-color: #f2f2f7;
}

.wb-book-item.removing {
    opacity: 0;
    transform: scale(0.9) translateY(-10px);
    margin-bottom: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
    height: 0;
    overflow: hidden;
}

.wb-book-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wb-book-icon {
    width: 32px;
    height: 32px;
    background-color: #ff9500;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 14px;
}

.wb-book-name {
    font-size: 16px;
    font-weight: 500;
    color: #000;
}

.wb-book-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wb-token-count {
    font-size: 12px;
    color: #8e8e93;
}

.wb-char-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #e5e5ea;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    color: #aeaeb2;
    font-size: 14px;
}

.wb-char-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Menu Item Hover */
.wb-menu-item:active {
    background-color: #f2f2f7;
}

/* Collapsible Entries in Add Book */
.wb-entry-item {
    background-color: #fff;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    border: none;
    border-bottom: 1px solid #ececf1;
    transition: none;
}

.wb-entry-item:last-child {
    border-bottom: none;
}

.wb-entry-item.expanded {
    background-color: #f9f9fb;
}

.wb-entry-header {
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background-color: transparent;
}

.wb-entry-header:active {
    background-color: #f2f2f7;
}

.wb-entry-title {
    font-size: 16px;
    font-weight: 500;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.wb-entry-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #a1a1aa;
}

.wb-entry-delete-btn {
    color: #ff3b30;
    padding: 4px;
    cursor: pointer;
    font-size: 16px;
}

.wb-entry-toggle-icon {
    transition: transform 0.2s;
    font-size: 14px;
}

.wb-entry-item.expanded .wb-entry-toggle-icon {
    transform: rotate(180deg);
}

.wb-entry-body {
    display: none;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid #f2f2f7;
    background-color: transparent;
    padding: 16px;
}

.wb-entry-item.expanded .wb-entry-body {
    display: flex;
}

.wb-entry-meta-grid {
    display: grid;
    gap: 10px;
}

.wb-entry-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.wb-entry-field-label {
    font-size: 12px;
    color: #8e8e93;
    font-weight: 500;
}

.wb-entry-bubble-input,
.wb-entry-select,
.wb-entry-number-input {
    width: 100%;
    min-width: 0;
    height: 40px;
    border: none;
    border-bottom: 1px solid #e5e5ea;
    border-radius: 0;
    padding: 0 4px;
    background: transparent;
    color: #111;
    font-size: 15px;
    outline: none;
    box-shadow: none;
}

.wb-entry-bubble-input:focus,
.wb-entry-select:focus,
.wb-entry-number-input:focus,
.wb-entry-body-textarea:focus {
    border-color: #000;
}

.wb-entry-system-depth-fields,
.wb-entry-trigger-keyword-field {
    display: block;
}

.wb-entry-body-textarea {
    width: 100%;
    background: #fff;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    outline: none;
    font-size: 15px;
    color: #111;
    resize: none;
    min-height: 100px;
    font-family: inherit;
    line-height: 1.5;
    padding: 12px;
}

.wb-entry-body-textarea::placeholder {
    color: #8e8e93;
}

.wb-inline-confirm-body {
    gap: 18px;
}

.wb-inline-confirm-message {
    font-size: 14px;
    line-height: 1.6;
    color: #3a3a3c;
    text-align: center;
    padding-top: 4px;
}

.wb-inline-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.wb-inline-confirm-btn {
    height: 42px;
    border: none;
    border-radius: 16px;
    background: #f2f2f7;
    color: #111;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.wb-inline-confirm-btn:active {
    transform: scale(0.98);
}

.wb-inline-confirm-confirm {
    background: #111;
    color: #fff;
}

.wb-inline-confirm-danger {
    background: #ff3b30;
    color: #fff;
}

/* Final override: keep world book folders flat and low-motion. */
#wb-all-list .wb-group-container,
#wb-all-list .wb-group-header,
#wb-all-list .wb-folder-visual,
#wb-all-list .wb-folder-tab,
#wb-all-list .wb-folder-body,
#wb-all-list .wb-group-title,
#wb-all-list .wb-group-title span,
#wb-all-list .wb-group-content,
#wb-all-list .wb-book-item,
#wb-all-list .wb-group-header .toggle-icon {
    transition: none !important;
    animation: none !important;
}

#wb-all-list .wb-group-header {
    padding: 10px 8px 12px !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transform: none !important;
}

#wb-all-list .wb-group-header:active {
    background: rgba(0, 0, 0, 0.04) !important;
    opacity: 1 !important;
    transform: none !important;
}

#wb-all-list .wb-folder-visual {
    width: 86px !important;
    height: 58px !important;
    margin: 2px auto 8px !important;
}

#wb-all-list .wb-folder-tab,
#wb-all-list .wb-folder-body {
    background: #e6e6e9 !important;
    border: 1px solid #d1d1d6 !important;
    box-shadow: none !important;
}

#wb-all-list .wb-folder-tab {
    left: 7px !important;
    top: 1px !important;
    width: 34px !important;
    height: 13px !important;
    border-bottom: 0 !important;
    border-radius: 7px 7px 0 0 !important;
}

#wb-all-list .wb-folder-body {
    inset: 11px 0 0 !important;
    border-radius: 11px !important;
}

#wb-all-list .wb-folder-body::before {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    top: 0;
    height: 13px;
    background: #f2f2f4;
    border: 1px solid #d7d7dc;
    border-top: 0;
    border-radius: 0 0 9px 9px;
    pointer-events: none;
}

#wb-all-list .wb-group-folder-icon {
    display: none !important;
}

#wb-all-list .wb-group-container.is-open .wb-group-header {
    min-height: 54px !important;
    background: #242426 !important;
    border-radius: 15px !important;
    box-shadow: none !important;
    transform: none !important;
}

#wb-all-list .wb-group-container.is-open .wb-group-header:active {
    background: #2f2f31 !important;
    transform: none !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-visual {
    width: 40px !important;
    height: 29px !important;
    margin: 0 !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-tab,
#wb-all-list .wb-group-container.is-open .wb-folder-body {
    background: #ededf0 !important;
    border-color: #cfcfd4 !important;
    box-shadow: none !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-tab {
    left: 3px !important;
    top: 0 !important;
    width: 16px !important;
    height: 7px !important;
    border-radius: 4px 4px 0 0 !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-body {
    inset: 6px 0 0 !important;
    border-radius: 7px !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-body::before {
    height: 6px;
    border-radius: 0 0 5px 5px;
    background: #f7f7f8;
}

#wb-all-list .wb-group-content.open {
    display: flex !important;
    animation: none !important;
}

#wb-all-list .wb-group-content {
    overflow: visible !important;
    gap: 7px !important;
    margin-top: 9px !important;
}

#wb-all-list .wb-book-item,
#wb-all-list .wb-group-content .wb-book-item {
    background: #fff !important;
    border: 1px solid #dedee3 !important;
    box-shadow: none !important;
    transform: none !important;
}

#wb-all-list .wb-book-item:active {
    background: #f0f0f2 !important;
    transform: none !important;
}

#wb-all-list .wb-book-item.removing {
    opacity: 0 !important;
    transform: none !important;
}

@media (max-width: 420px) {
    #wb-all-list .wb-folder-visual {
        width: 78px !important;
        height: 54px !important;
    }
}

/* Shared world book binding selector */
.wb-selector-panel {
    height: min(76%, 620px);
    display: flex;
    flex-direction: column;
    background: #fff;
}

.wb-selector-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
}

.wb-selector-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.wb-selector-field label,
.wb-selector-preview-head {
    font-size: 13px;
    font-weight: 600;
    color: #6b6b73;
}

.wb-native-select {
    width: 100%;
    height: 46px;
    border: 1px solid #e2e2e7;
    border-radius: 12px;
    background: #f7f7f9;
    color: #111;
    font-size: 15px;
    padding: 0 12px;
    outline: none;
}

.wb-native-select:focus {
    border-color: #111;
    background: #fff;
}

.wb-native-select:disabled {
    color: #8e8e93;
    background: #f2f2f4;
}

.wb-selector-empty {
    min-height: 18px;
    font-size: 12px;
    color: #8e8e93;
}

.wb-selector-preview-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2px 0 10px;
}

.wb-selector-mounted-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wb-selector-mounted-empty {
    padding: 22px 14px;
    border: 1px dashed #d7d7dd;
    border-radius: 14px;
    color: #8e8e93;
    text-align: center;
    font-size: 14px;
    background: #fafafa;
}

.wb-selector-mounted-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 10px 12px;
    border: 1px solid #ececf1;
    border-radius: 14px;
    background: #fff;
}

.wb-selector-mounted-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 9px;
    background: #1c1c1e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.wb-selector-mounted-info {
    flex: 1;
    min-width: 0;
}

.wb-selector-mounted-name {
    color: #111;
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wb-selector-mounted-meta {
    margin-top: 3px;
    color: #8e8e93;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wb-selector-remove-btn {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border: none;
    border-radius: 50%;
    background: #f2f2f4;
    color: #8e8e93;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.wb-selector-remove-btn:active {
    background: #e5e5ea;
    color: #111;
}

.wb-selector-actions {
    display: flex;
    gap: 10px;
    padding: 0 16px 20px;
    flex-shrink: 0;
}

.wb-selector-action-btn {
    flex: 1;
    margin: 0;
    border: none;
    font: inherit;
}

#wb-selector-confirm-btn {
    background-color: #1c1c1e;
    color: #fff;
}

@media (max-width: 420px) {
    .wb-selector-panel {
        height: 80%;
    }
}

/* ==========================================
   Flat macOS-style Folder Refinement
   ========================================== */
#wb-all-list .wb-group-container,
#wb-all-list .wb-group-header,
#wb-all-list .wb-folder-visual,
#wb-all-list .wb-folder-tab,
#wb-all-list .wb-folder-body,
#wb-all-list .wb-group-title,
#wb-all-list .wb-group-title span,
#wb-all-list .wb-group-content,
#wb-all-list .wb-book-item,
#wb-all-list .wb-group-header .toggle-icon {
    transition: none !important;
    animation: none !important;
}

#wb-all-list .wb-group-header {
    padding: 10px 8px 12px !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transform: none !important;
}

#wb-all-list .wb-group-header:active {
    background: rgba(0, 0, 0, 0.04) !important;
    opacity: 1 !important;
    transform: none !important;
}

#wb-all-list .wb-folder-visual {
    width: 86px !important;
    height: 58px !important;
    margin: 2px auto 8px !important;
}

#wb-all-list .wb-folder-tab,
#wb-all-list .wb-folder-body {
    background: #e6e6e9 !important;
    border: 1px solid #d1d1d6 !important;
    box-shadow: none !important;
}

#wb-all-list .wb-folder-tab {
    left: 7px !important;
    top: 1px !important;
    width: 34px !important;
    height: 13px !important;
    border-bottom: 0 !important;
    border-radius: 7px 7px 0 0 !important;
}

#wb-all-list .wb-folder-body {
    inset: 11px 0 0 !important;
    border-radius: 11px !important;
}

#wb-all-list .wb-folder-body::before {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    top: 0;
    height: 13px;
    background: #f2f2f4;
    border: 1px solid #d7d7dc;
    border-top: 0;
    border-radius: 0 0 9px 9px;
    pointer-events: none;
}

#wb-all-list .wb-group-folder-icon {
    display: none !important;
}

#wb-all-list .wb-group-container.is-open .wb-group-header {
    min-height: 54px !important;
    background: #242426 !important;
    border-radius: 15px !important;
    box-shadow: none !important;
    transform: none !important;
}

#wb-all-list .wb-group-container.is-open .wb-group-header:active {
    background: #2f2f31 !important;
    transform: none !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-visual {
    width: 40px !important;
    height: 29px !important;
    margin: 0 !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-tab,
#wb-all-list .wb-group-container.is-open .wb-folder-body {
    background: #ededf0 !important;
    border-color: #cfcfd4 !important;
    box-shadow: none !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-tab {
    left: 3px !important;
    top: 0 !important;
    width: 16px !important;
    height: 7px !important;
    border-radius: 4px 4px 0 0 !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-body {
    inset: 6px 0 0 !important;
    border-radius: 7px !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-body::before {
    height: 6px;
    border-radius: 0 0 5px 5px;
    background: #f7f7f8;
}

#wb-all-list .wb-group-content.open {
    display: flex !important;
    animation: none !important;
}

#wb-all-list .wb-group-content {
    overflow: visible !important;
    gap: 7px !important;
    margin-top: 9px !important;
}

#wb-all-list .wb-book-item,
#wb-all-list .wb-group-content .wb-book-item {
    background: #fff !important;
    border: 1px solid #dedee3 !important;
    box-shadow: none !important;
    transform: none !important;
}

#wb-all-list .wb-book-item:active {
    background: #f0f0f2 !important;
    transform: none !important;
}

#wb-all-list .wb-book-item.removing {
    opacity: 0 !important;
    transform: none !important;
}

@media (max-width: 420px) {
    #wb-all-list .wb-folder-visual {
        width: 78px !important;
        height: 54px !important;
    }
}

/* ==========================================
   World Book Premium Monochrome Refresh
   ========================================== */
.world-book-popup-sheet {
    background: #f7f7f8 !important;
    box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.18) !important;
}

.world-book-popup-header {
    background: rgba(247, 247, 248, 0.96) !important;
    border-bottom: 1px solid rgba(17, 17, 17, 0.08) !important;
    backdrop-filter: blur(18px);
}

.world-book-popup-content,
.world-book-popup-sheet .settings-content,
.world-book-popup-sheet .wb-tab-content,
.world-book-popup-sheet #wb-all-list,
.world-book-popup-sheet #wb-global-list,
.world-book-popup-sheet #wb-local-list {
    background: #f7f7f8 !important;
}

#wb-add-menu {
    width: 154px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    border: 1px solid rgba(17, 17, 17, 0.08);
    border-radius: 16px !important;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18) !important;
    backdrop-filter: blur(18px);
}

.wb-menu-item {
    color: #111;
}

.wb-menu-item i {
    color: #111 !important;
}

.wb-menu-item:active {
    background: #f0f0f1 !important;
}

.world-book-popup-tabs .wb-segment-control {
    background: rgba(238, 238, 240, 0.94) !important;
    border: 1px solid rgba(17, 17, 17, 0.08);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12) !important;
    backdrop-filter: blur(18px);
}

.wb-segment-btn {
    color: #52525b !important;
}

.wb-segment-btn.active {
    background: #111 !important;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(17, 17, 17, 0.22) !important;
}

#wb-all-list {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px !important;
    padding: 18px 18px 110px !important;
}

.wb-group-container {
    min-width: 0;
}

.wb-group-container.is-open {
    grid-column: 1 / -1 !important;
}

.wb-group-header {
    gap: 10px;
    padding: 10px 8px 12px !important;
    border-radius: 18px;
    outline: none;
}

.wb-group-header:focus-visible {
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.14);
}

.wb-folder-visual {
    position: relative;
    width: 84px;
    height: 62px;
    margin: 2px auto 8px;
}

.wb-folder-tab,
.wb-folder-body {
    position: absolute;
    display: block;
    border: 1px solid rgba(17, 17, 17, 0.12);
    background: linear-gradient(180deg, #fff 0%, #e9e9ec 100%);
}

.wb-folder-tab {
    left: 8px;
    top: 0;
    width: 32px;
    height: 15px;
    border-bottom: 0;
    border-radius: 9px 9px 0 0;
}

.wb-folder-body {
    inset: 11px 0 0;
    border-radius: 14px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 10px 22px rgba(0, 0, 0, 0.09);
}

.wb-group-folder-icon {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    color: rgba(17, 17, 17, 0.18) !important;
    font-size: 26px !important;
    text-shadow: none !important;
}

.wb-group-title {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #111 !important;
}

.wb-group-title span {
    color: #73737a !important;
    font-size: 12px !important;
}

.wb-group-container.is-open .wb-group-header {
    min-height: 56px;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px;
    padding: 10px 16px !important;
    background: #111 !important;
    border-radius: 18px !important;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.wb-group-container.is-open .wb-folder-visual {
    width: 38px;
    height: 30px;
    margin: 0;
    flex: 0 0 auto;
}

.wb-group-container.is-open .wb-folder-tab,
.wb-group-container.is-open .wb-folder-body {
    background: #f4f4f5;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

.wb-group-container.is-open .wb-folder-tab {
    left: 4px;
    width: 16px;
    height: 8px;
    border-radius: 5px 5px 0 0;
}

.wb-group-container.is-open .wb-folder-body {
    inset: 6px 0 0;
    border-radius: 8px;
}

.wb-group-container.is-open .wb-group-folder-icon {
    display: none !important;
}

.wb-group-container.is-open .wb-group-title {
    color: #fff !important;
    text-align: left !important;
}

.wb-group-container.is-open .wb-group-title span {
    color: rgba(255, 255, 255, 0.58) !important;
}

.wb-group-container.is-open .wb-group-header .toggle-icon {
    display: block !important;
    color: rgba(255, 255, 255, 0.72) !important;
}

.wb-group-content {
    gap: 8px !important;
    margin-top: 10px !important;
}

.wb-book-item {
    min-height: 58px;
    padding: 12px 14px !important;
    background: #fff !important;
    border: 1px solid rgba(17, 17, 17, 0.08) !important;
    border-radius: 14px !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.045) !important;
}

.wb-book-info {
    min-width: 0;
    gap: 10px !important;
}

.wb-book-icon {
    width: 34px !important;
    height: 34px !important;
    background: #111 !important;
    border-radius: 9px !important;
    color: #fff !important;
}

.wb-book-name {
    min-width: 0;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #111 !important;
    font-size: 15px !important;
    font-weight: 650 !important;
}

.wb-token-count {
    color: #71717a !important;
    font-size: 11px !important;
    white-space: nowrap;
}

.world-book-popup-sheet .toggle-switch input:checked + .slider {
    background: #111 !important;
}

.world-book-popup-sheet .toggle-switch input:focus + .slider {
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.12) !important;
}

.wb-flat-book-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px 110px;
}

.wb-empty-state,
.wb-empty-folder-note {
    padding: 34px 16px;
    text-align: center;
    color: #8a8a90;
    font-size: 14px;
}

.wb-empty-folder-note {
    padding: 18px 14px;
    background: #fff;
    border: 1px dashed rgba(17, 17, 17, 0.16);
    border-radius: 14px;
}

.wb-centered-modal-overlay {
    background: rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(10px);
}

.wb-centered-modal-card {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(17, 17, 17, 0.08) !important;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.26) !important;
}

.wb-centered-modal-header {
    background: rgba(255, 255, 255, 0.98) !important;
}

.wb-centered-modal-title {
    color: #111 !important;
    font-weight: 750 !important;
}

.wb-modal-form {
    background: #f4f4f5 !important;
    border: 1px solid rgba(17, 17, 17, 0.08);
    border-radius: 18px !important;
    overflow: hidden;
}

.wb-modal-form .form-item {
    min-height: 48px;
    background: transparent !important;
}

.wb-modal-form .form-item label {
    color: #52525b !important;
    font-size: 13px !important;
    font-weight: 650 !important;
}

.wb-modal-form .form-item input {
    color: #111 !important;
    font-weight: 600;
}

.wb-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.wb-primary-action,
.wb-secondary-action,
.wb-danger-action {
    margin: 0;
    border-radius: 16px !important;
    box-shadow: none !important;
}

.wb-primary-action {
    background: #111 !important;
    color: #fff !important;
}

.wb-secondary-action {
    background: #eeeeef !important;
    color: #111 !important;
}

.wb-danger-action {
    background: #fff !important;
    color: #ff3b30 !important;
    border: 1px solid rgba(255, 59, 48, 0.45) !important;
}

#add-book-entry-btn {
    background: #111 !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2) !important;
}

.wb-entry-toolbar span {
    color: #52525b !important;
}

.wb-entry-item {
    background: #fff !important;
    border: 1px solid rgba(17, 17, 17, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
}

.wb-entry-item.expanded {
    background: #fbfbfc !important;
}

.wb-entry-header {
    min-height: 58px;
    padding: 12px 14px !important;
}

.wb-entry-title-wrap {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.wb-entry-subtitle {
    color: #7a7a82;
    font-size: 12px;
    font-weight: 500;
}

.wb-entry-actions {
    color: #71717a !important;
}

.wb-entry-delete-btn {
    color: #ff3b30 !important;
}

.wb-entry-body {
    gap: 14px !important;
    padding: 14px !important;
    border-top: 1px solid rgba(17, 17, 17, 0.08) !important;
}

.wb-entry-bubble-input,
.wb-entry-select,
.wb-entry-number-input {
    height: 42px !important;
    padding: 0 12px !important;
    background: #fff !important;
    border: 1px solid rgba(17, 17, 17, 0.12) !important;
    border-radius: 12px !important;
}

.wb-entry-body-textarea {
    min-height: 112px !important;
    max-height: 35vh !important;
    overflow-y: auto !important;
    border: 1px solid rgba(17, 17, 17, 0.12) !important;
    border-radius: 14px !important;
}

.wb-entry-bubble-input:focus,
.wb-entry-select:focus,
.wb-entry-number-input:focus,
.wb-entry-body-textarea:focus {
    border-color: #111 !important;
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.wb-group-picker-item {
    background: #fff;
    border: 1px solid rgba(17, 17, 17, 0.08);
    border-radius: 14px;
    margin-bottom: 8px;
    overflow: hidden;
}

.wb-group-picker-item.selected {
    border-color: #111;
}

.wb-group-picker-content {
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    cursor: pointer;
    color: #111;
}

.wb-group-picker-name {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 650;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 420px) {
    #wb-all-list {
        gap: 14px !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .wb-folder-visual {
        width: 76px;
        height: 58px;
    }

    .wb-book-name {
        max-width: 128px;
    }
}

@media (max-width: 420px) {
    .wb-entry-meta-grid {
        grid-template-columns: 1fr;
    }
}

.wb-inline-confirm-body {
    gap: 18px;
}

.wb-inline-confirm-message {
    font-size: 14px;
    line-height: 1.6;
    color: #3a3a3c;
    text-align: center;
    padding-top: 4px;
}

.wb-inline-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.wb-inline-confirm-btn {
    height: 42px;
    border: none;
    border-radius: 16px;
    background: #f2f2f7;
    color: #111;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.wb-inline-confirm-btn:active {
    transform: scale(0.98);
}

.wb-inline-confirm-confirm {
    background: #111;
    color: #fff;
}

.wb-inline-confirm-danger {
    background: #ff3b30;
    color: #fff;
}

/* Final override: keep world book folders flat and low-motion. */
#wb-all-list .wb-group-container,
#wb-all-list .wb-group-header,
#wb-all-list .wb-folder-visual,
#wb-all-list .wb-folder-tab,
#wb-all-list .wb-folder-body,
#wb-all-list .wb-group-title,
#wb-all-list .wb-group-title span,
#wb-all-list .wb-group-content,
#wb-all-list .wb-book-item,
#wb-all-list .wb-group-header .toggle-icon {
    transition: none !important;
    animation: none !important;
}

#wb-all-list .wb-group-header {
    padding: 10px 8px 12px !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transform: none !important;
}

#wb-all-list .wb-group-header:active {
    background: rgba(0, 0, 0, 0.04) !important;
    opacity: 1 !important;
    transform: none !important;
}

#wb-all-list .wb-folder-visual {
    width: 86px !important;
    height: 58px !important;
    margin: 2px auto 8px !important;
}

#wb-all-list .wb-folder-tab,
#wb-all-list .wb-folder-body {
    background: #e6e6e9 !important;
    border: 1px solid #d1d1d6 !important;
    box-shadow: none !important;
}

#wb-all-list .wb-folder-tab {
    left: 7px !important;
    top: 1px !important;
    width: 34px !important;
    height: 13px !important;
    border-bottom: 0 !important;
    border-radius: 7px 7px 0 0 !important;
}

#wb-all-list .wb-folder-body {
    inset: 11px 0 0 !important;
    border-radius: 11px !important;
}

#wb-all-list .wb-folder-body::before {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    top: 0;
    height: 13px;
    background: #f2f2f4;
    border: 1px solid #d7d7dc;
    border-top: 0;
    border-radius: 0 0 9px 9px;
    pointer-events: none;
}

#wb-all-list .wb-group-folder-icon {
    display: none !important;
}

#wb-all-list .wb-group-container.is-open .wb-group-header {
    min-height: 54px !important;
    background: #242426 !important;
    border-radius: 15px !important;
    box-shadow: none !important;
    transform: none !important;
}

#wb-all-list .wb-group-container.is-open .wb-group-header:active {
    background: #2f2f31 !important;
    transform: none !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-visual {
    width: 40px !important;
    height: 29px !important;
    margin: 0 !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-tab,
#wb-all-list .wb-group-container.is-open .wb-folder-body {
    background: #ededf0 !important;
    border-color: #cfcfd4 !important;
    box-shadow: none !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-tab {
    left: 3px !important;
    top: 0 !important;
    width: 16px !important;
    height: 7px !important;
    border-radius: 4px 4px 0 0 !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-body {
    inset: 6px 0 0 !important;
    border-radius: 7px !important;
}

#wb-all-list .wb-group-container.is-open .wb-folder-body::before {
    height: 6px;
    border-radius: 0 0 5px 5px;
    background: #f7f7f8;
}

#wb-all-list .wb-group-content.open {
    display: flex !important;
    animation: none !important;
}

#wb-all-list .wb-group-content {
    overflow: visible !important;
    gap: 7px !important;
    margin-top: 9px !important;
}

#wb-all-list .wb-book-item,
#wb-all-list .wb-group-content .wb-book-item {
    background: #fff !important;
    border: 1px solid #dedee3 !important;
    box-shadow: none !important;
    transform: none !important;
}

#wb-all-list .wb-book-item:active {
    background: #f0f0f2 !important;
    transform: none !important;
}

#wb-all-list .wb-book-item.removing {
    opacity: 0 !important;
    transform: none !important;
}

@media (max-width: 420px) {
    #wb-all-list .wb-folder-visual {
        width: 78px !important;
        height: 54px !important;
    }
}
