
/* ==========================================
   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;
    
}

.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;
    
    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;
    
    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;
    
    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;
    
    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;
    
    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 {
    
    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;
    
    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;
    
}

.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;
    
    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;
    
}

#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;
    
    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;
    
}

#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;
    
    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;
    
    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;
    
}

#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;
    
    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;
    
}

#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;
    
    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;
    
}

.world-book-popup-header {
    background: rgba(247, 247, 248, 0.96) !important;
    border-bottom: 1px solid rgba(17, 17, 17, 0.08) !important;
    
}

.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;
    
    
}

.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);
    
    
}

.wb-segment-btn {
    color: #52525b !important;
}

.wb-segment-btn.active {
    background: #111 !important;
    color: #fff !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 {
    
}

.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;
    
}

.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;
    
}

.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);
    
}

.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;
    
}

.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 {
    
}

.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.4);
    
}

.wb-centered-modal-card {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(17, 17, 17, 0.08) !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;
    
}

.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;
    
}

.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;
    
    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;
    
}

.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;
    
    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;
    
}

#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;
    
    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;
    
}

#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;
    
    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;
    }
}


/* ==========================================
   Fullscreen iOS Files-style World Book
   ========================================== */
.world-book-files-view {
    background: #f2f2f7 !important;
    padding-top: 0 !important;
    overflow: hidden;
}

.world-book-files-view.active {
    display: flex;
    transform: translateX(0);
}

.wb-files-page {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    min-height: 0;
    background: #f2f2f7;
    padding-top: max(var(--safe-top, 0px), env(safe-area-inset-top, 0px));
}

.wb-files-page.active {
    display: flex;
}

.wb-files-nav {
    height: 50px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: rgba(242, 242, 247, 0.92);
    position: relative;
    z-index: 5;
}

.wb-files-nav-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    max-width: 52%;
    color: #111;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wb-files-nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.wb-nav-btn {
    min-width: 34px;
    height: 34px;
    border: 0;
    border-radius: 17px;
    background: transparent;
    color: #007aff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font: inherit;
    font-size: 17px;
    cursor: pointer;
    padding: 0 8px;
    -webkit-tap-highlight-color: transparent;
}

.wb-nav-btn:active {
    background: rgba(0, 122, 255, 0.12);
}

.wb-group-delete-nav-btn {
    color: #ff3b30;
}

.wb-files-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 18px max(28px, env(safe-area-inset-bottom, 0px));
}

.wb-files-large-title {
    margin: 8px 0 14px;
    font-size: 34px;
    line-height: 1.1;
    font-weight: 800;
    color: #111;
    letter-spacing: -0.6px;
}

.world-book-files-view .world-book-popup-tabs {
    position: static !important;
    width: 100% !important;
    transform: none !important;
    margin: 0 0 18px;
    z-index: auto !important;
}

.world-book-files-view .wb-segment-control {
    display: flex;
    width: 100%;
    background: #e5e5ea;
    border-radius: 12px;
    padding: 3px;
    box-sizing: border-box;
}

.world-book-files-view .wb-segment-btn {
    flex: 1;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    color: #3a3a3c;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.world-book-files-view .wb-segment-btn.active {
    background: #ffffff;
    color: #111;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.world-book-files-view .wb-tab-content {
    height: auto;
}

.wb-files-folder-grid,
#wb-all-list.wb-files-folder-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 14px;
    padding: 0 0 18px !important;
    align-items: start;
}

.world-book-files-view .wb-group-container {
    position: relative;
    min-width: 0;
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.world-book-files-view .wb-group-header {
    position: relative;
    min-height: 122px;
    padding: 8px 6px 10px !important;
    background: transparent !important;
    border: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.world-book-files-view .wb-group-container:active .wb-folder-visual {
    transform: scale(0.96);
    opacity: 0.75;
}

.world-book-files-view .wb-folder-visual {
    position: relative;
    width: 104px !important;
    height: 74px !important;
    margin: 0 auto 9px !important;
    transition: transform 0.12s ease, opacity 0.12s ease;
}

.world-book-files-view .wb-folder-tab,
.world-book-files-view .wb-folder-body {
    position: absolute;
    display: block;
    background: #dcdce1 !important;
    border: 1px solid #c7c7cc !important;
    box-shadow: none !important;
}

.world-book-files-view .wb-folder-tab {
    left: 8px !important;
    top: 2px !important;
    width: 42px !important;
    height: 15px !important;
    border-bottom: 0 !important;
    border-radius: 8px 8px 0 0 !important;
}

.world-book-files-view .wb-folder-body {
    inset: 15px 0 0 !important;
    border-radius: 14px !important;
}

.world-book-files-view .wb-folder-body::before {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    top: 0;
    height: 15px;
    background: #efeff3;
    border: 1px solid #d1d1d6;
    border-top: 0;
    border-radius: 0 0 11px 11px;
}

.world-book-files-view .wb-group-folder-icon {
    display: none !important;
}

.world-book-files-view .wb-group-title {
    width: 100%;
    color: #111 !important;
    text-align: center !important;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.world-book-files-view .wb-group-count {
    margin-top: 3px;
    color: #8e8e93;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
}

.world-book-files-view .wb-group-delete-btn {
    position: absolute;
    top: 0;
    right: 2px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 14px;
    background: rgba(255, 59, 48, 0.12);
    color: #ff3b30;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    cursor: pointer;
}

.wb-add-menu {
    position: absolute;
    top: calc(max(var(--safe-top, 0px), env(safe-area-inset-top, 0px)) + 48px);
    right: 14px;
    width: 178px;
    overflow: hidden;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
    z-index: 30;
}

.wb-add-menu .wb-menu-item {
    min-height: 48px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 11px;
    color: #111;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
}

.wb-add-menu .wb-menu-item:not(:last-child) {
    border-bottom: 0.5px solid #d1d1d6;
}

.wb-add-menu .wb-menu-item i {
    width: 22px;
    text-align: center;
    color: #007aff;
}

.wb-files-list .wb-flat-book-list,
.wb-group-book-list,
#wb-global-list,
#wb-local-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.world-book-files-view .wb-book-item,
.world-book-files-view .wb-group-content .wb-book-item {
    min-height: 62px;
    background: #fff !important;
    border: 0 !important;
    border-radius: 16px !important;
    padding: 12px 14px !important;
    box-shadow: none !important;
    transform: none !important;
}

.world-book-files-view .wb-book-info {
    min-width: 0;
    flex: 1;
}

.world-book-files-view .wb-book-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.world-book-files-view .wb-book-icon {
    background: #ff9500;
}

.wb-files-empty-state,
.world-book-files-view .wb-empty-state {
    min-height: 180px;
    border-radius: 20px;
    color: #8e8e93;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.wb-files-empty-state i,
.world-book-files-view .wb-empty-state i {
    font-size: 30px;
    color: #c7c7cc;
}

@media (min-width: 520px) {
    .wb-files-folder-grid,
    #wb-all-list.wb-files-folder-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ==========================================
   World Book final overrides: bottom sheet editor + iOS Files folders
   ========================================== */

/* Add/Edit world book as a real bottom sheet */
.wb-book-sheet-overlay {
    justify-content: flex-end !important;
    align-items: stretch !important;
    padding: 0 !important;
}

.wb-book-sheet-overlay .wb-book-bottom-sheet,
.wb-book-sheet-overlay .wb-book-modal-card {
    width: 100% !important;
    max-width: 100% !important;
    height: min(90%, 820px) !important;
    max-height: min(90%, 820px) !important;
    min-height: 58% !important;
    margin: 0 !important;
    border-radius: 24px 24px 0 0 !important;
    background: #f7f7f9 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border: 0 !important;
    box-shadow: 0 -18px 42px rgba(0, 0, 0, 0.18) !important;
}

.wb-book-sheet-overlay .wb-book-sheet-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 20px 12px;
    background: transparent;
}

.wb-book-sheet-overlay .sheet-title,
.wb-book-sheet-overlay .wb-centered-modal-title {
    margin: 0;
    padding: 0;
    color: #111;
    font-size: 17px;
    font-weight: 700;
    text-align: center;
}

.wb-book-sheet-overlay .wb-book-sheet-content,
.wb-book-sheet-overlay .wb-book-modal-body {
    flex: 1 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 0 16px max(18px, env(safe-area-inset-bottom, 0px) + 12px) !important;
    display: flex !important;
    flex-direction: column !important;
    background: transparent !important;
}

.wb-book-sheet-overlay .wb-modal-form {
    background: #fff;
    border-radius: 16px !important;
    overflow: hidden;
    box-shadow: none;
}

.wb-book-sheet-overlay .wb-modal-form .form-item {
    min-height: 50px;
}

.wb-book-sheet-overlay #wb-entries-list-container {
    background: #fff;
    border-radius: 16px;
    padding: 0 !important;
    margin: 8px 0 10px !important;
    gap: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

.wb-book-sheet-overlay .wb-entry-item {
    border-radius: 0 !important;
}

.wb-book-sheet-overlay .wb-primary-action,
.wb-book-sheet-overlay .wb-danger-action {
    border-radius: 16px !important;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

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

.wb-book-sheet-overlay .wb-danger-action {
    background: #fff1f0 !important;
    color: #ff3b30 !important;
}

.wb-book-sheet-overlay #add-book-entry-btn {
    background: #111 !important;
}

/* iOS Files-like folder grid */
.world-book-files-view .wb-files-folder-grid,
.world-book-files-view #wb-all-list.wb-files-folder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 22px 16px !important;
    padding: 2px 2px 24px !important;
}

.world-book-files-view .wb-group-container {
    border-radius: 18px;
    outline: none;
}

.world-book-files-view .wb-group-header {
    min-height: 132px !important;
    padding: 8px 6px 10px !important;
    border-radius: 18px !important;
    transition: transform 0.14s ease, background-color 0.14s ease !important;
}

.world-book-files-view .wb-group-container:active .wb-group-header {
    background: rgba(0, 0, 0, 0.035) !important;
}

.world-book-files-view .wb-group-container:active .wb-folder-visual {
    transform: scale(0.955) translateY(1px) !important;
    opacity: 0.92 !important;
}

.world-book-files-view .wb-folder-visual {
    position: relative !important;
    width: 112px !important;
    height: 82px !important;
    margin: 0 auto 10px !important;
    filter: none !important;
    transition: transform 0.14s ease, opacity 0.14s ease !important;
}

.world-book-files-view .wb-folder-tab,
.world-book-files-view .wb-folder-body {
    position: absolute !important;
    display: block !important;
    border: 0 !important;
    box-shadow: none !important;
}

.world-book-files-view .wb-folder-tab {
    left: 8px !important;
    top: 2px !important;
    width: 48px !important;
    height: 19px !important;
    border-radius: 10px 10px 0 0 !important;
    background: linear-gradient(180deg, #78bdff 0%, #5caeff 100%) !important;
    z-index: 1;
}

.world-book-files-view .wb-folder-body {
    left: 0 !important;
    right: 0 !important;
    top: 17px !important;
    bottom: 0 !important;
    border-radius: 14px 14px 16px 16px !important;
    background: linear-gradient(180deg, #66b7ff 0%, #1687f7 100%) !important;
    overflow: hidden;
    z-index: 2;
}

.world-book-files-view .wb-folder-body::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 18px;
    border: 0;
    border-radius: 0 0 13px 13px;
    background: linear-gradient(180deg, rgba(255,255,255,0.36) 0%, rgba(255,255,255,0.08) 100%);
    pointer-events: none;
}

.world-book-files-view .wb-folder-body::after {
    content: "";
    position: absolute;
    inset: 1px 1px auto 1px;
    height: 36px;
    border-radius: 13px 13px 12px 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.24), rgba(255,255,255,0));
    pointer-events: none;
}

.world-book-files-view .wb-group-folder-icon {
    display: none !important;
}

.world-book-files-view .wb-group-title {
    max-width: 138px;
    margin: 0 auto;
    color: #111 !important;
    font-size: 15px !important;
    font-weight: 650 !important;
    letter-spacing: -0.2px;
}

.world-book-files-view .wb-group-count {
    margin-top: 4px !important;
    color: #8e8e93 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
}

.world-book-files-view .wb-group-delete-btn {
    top: 2px !important;
    right: 6px !important;
    width: 26px !important;
    height: 26px !important;
    border-radius: 50% !important;
    background: rgba(255, 59, 48, 0.14) !important;
    color: #ff3b30 !important;
}

.world-book-files-view .wb-group-delete-btn:active {
    background: rgba(255, 59, 48, 0.24) !important;
    transform: scale(0.94);
}

@media (min-width: 520px) {
    .world-book-files-view .wb-files-folder-grid,
    .world-book-files-view #wb-all-list.wb-files-folder-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 380px) {
    .world-book-files-view .wb-folder-visual {
        width: 100px !important;
        height: 74px !important;
    }

    .world-book-files-view .wb-folder-tab {
        width: 42px !important;
        height: 17px !important;
    }

    .world-book-files-view .wb-folder-body {
        top: 15px !important;
    }
}

/* Flat iOS-blue folder polish */
.world-book-files-view .wb-folder-visual {
    width: 112px !important;
    height: 80px !important;
    margin: 0 auto 10px !important;
    filter: none !important;
    box-shadow: none !important;
}

.world-book-files-view .wb-folder-tab,
.world-book-files-view .wb-folder-body,
.world-book-files-view .wb-folder-body::before,
.world-book-files-view .wb-folder-body::after {
    box-shadow: none !important;
}

.world-book-files-view .wb-folder-tab {
    left: 8px !important;
    top: 3px !important;
    width: 50px !important;
    height: 18px !important;
    border: 0 !important;
    border-radius: 10px 10px 0 0 !important;
    background: #64b5ff !important;
    z-index: 1 !important;
}

.world-book-files-view .wb-folder-body {
    left: 0 !important;
    right: 0 !important;
    top: 17px !important;
    bottom: 0 !important;
    border: 0 !important;
    border-radius: 14px 14px 16px 16px !important;
    background: #0a84ff !important;
    overflow: hidden !important;
    z-index: 2 !important;
}

.world-book-files-view .wb-folder-body::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 18px;
    border: 0 !important;
    border-radius: 0 0 13px 13px;
    background: #47a8ff;
    pointer-events: none;
}

.world-book-files-view .wb-folder-body::after {
    content: "";
    position: absolute;
    left: 9px;
    right: 9px;
    bottom: 8px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    pointer-events: none;
}

.world-book-files-view .wb-group-container:active .wb-folder-visual {
    transform: scale(0.96) translateY(1px) !important;
    opacity: 0.9 !important;
}

/* ==========================================
   iOS 26 Notes-style World Book (20260812)
   ========================================== */
.world-book-files-view.wb-notes-view,
.world-book-files-view.wb-notes-view .wb-files-page {
    background: #f2f2f7 !important;
}

.world-book-files-view.wb-notes-view {
    isolation: isolate;
}

.wb-notes-view .wb-files-page {
    padding-top: max(var(--safe-top, 0px), env(safe-area-inset-top, 0px));
}

.wb-notes-view .wb-notes-nav {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px 4px;
    flex-shrink: 0;
}

.wb-notes-view .wb-notes-nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.wb-notes-view .wb-nav-btn,
.wb-notes-view .wb-nav-text-btn,
.wb-notes-view .wb-nav-round-btn {
    border: 0;
    font: inherit;
    color: #c89300;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.wb-notes-view .wb-nav-btn {
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    background: transparent;
    font-size: 21px;
}

.wb-notes-view .wb-nav-labeled {
    width: auto;
    gap: 4px;
    justify-content: flex-start;
    font-size: 16px;
}

.wb-notes-view .wb-nav-labeled i {
    font-size: 18px;
}

.wb-notes-view #wb-folder-add-btn {
    color: #c89300 !important;
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", sans-serif !important;
    font-weight: 900 !important;
}

.wb-notes-view #wb-folder-add-btn::before {
    content: "\f65e";
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", sans-serif;
    font-weight: 900;
    font-size: 20px;
    line-height: 1;
}

.wb-notes-view #wb-folder-add-btn > i {
    display: none !important;
}

.wb-notes-view .wb-nav-text-btn {
    background: transparent;
    padding: 8px 2px;
    font-size: 17px;
    font-weight: 600;
}

.wb-notes-view .wb-nav-round-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 21px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(68, 70, 90, 0.09);
    font-size: 18px;
}

.wb-notes-view .wb-nav-btn:active,
.wb-notes-view .wb-nav-text-btn:active,
.wb-notes-view .wb-nav-round-btn:active,
.wb-notes-view .wb-notes-compose-btn:active {
    transform: scale(0.94);
    opacity: 0.72;
}

.wb-notes-view .wb-notes-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 18px calc(102px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
}

.wb-notes-view .wb-notes-title {
    margin: 13px 2px 31px;
    color: #060607;
    font-size: 38px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -1.3px;
}

.wb-notes-view .wb-notes-section-title {
    margin: 0 2px 11px;
    font-size: 18px;
    font-weight: 750;
    color: #1d1d20;
}

.wb-notes-view .wb-notes-list {
    overflow: hidden;
    border-radius: 23px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.025);
}

.wb-notes-view .wb-notes-row {
    position: relative;
    width: 100%;
    min-height: 69px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 0;
    background: #fff;
    color: #111114;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.wb-notes-view .wb-notes-row + .wb-notes-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 62px;
    right: 14px;
    height: 1px;
    background: #e8e8ed;
}

.wb-notes-view .wb-notes-row:active {
    background: #f0f0f4;
}

.wb-notes-view .wb-row-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    font-size: 19px;
}

.wb-notes-view .wb-folder-icon {
    color: #e3ac00;
    background: #fff8dd;
}

.wb-notes-view .wb-book-icon {
    color: #ff9f0a;
    background: #fff0d9;
}

.wb-notes-view .wb-row-main {
    min-width: 0;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
}

.wb-notes-view .wb-row-main strong {
    overflow: hidden;
    color: #17171a;
    font-size: 17px;
    line-height: 1.25;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wb-notes-view .wb-row-main small,
.wb-notes-view .wb-group-count-line {
    overflow: hidden;
    color: #8b8b92;
    font-size: 13px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wb-notes-view .wb-row-count {
    color: #8b8b92;
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.wb-notes-view .wb-row-chevron {
    width: 13px;
    color: #c6c6cc;
    font-size: 15px;
    text-align: right;
}

.wb-notes-view .wb-row-edit-actions {
    display: none;
    align-items: center;
    gap: 14px;
    padding-left: 8px;
    color: #c89300;
    font-size: 15px;
}

.wb-notes-view .wb-folder-row.is-editing .wb-row-chevron,
.wb-notes-view .wb-folder-row.is-editing .wb-row-count {
    display: none;
}

.wb-notes-view .wb-folder-row.is-editing .wb-row-edit-actions {
    display: inline-flex;
}

.wb-notes-view .wb-notes-bottom-bar {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 18px max(13px, calc(12px + env(safe-area-inset-bottom, 0px)));
    background: linear-gradient(180deg, rgba(242,242,247,0.01), rgba(242,242,247,0.95) 26%, #f2f2f7 55%);
}

.wb-notes-view .wb-notes-search {
    min-width: 0;
    height: 48px;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 17px;
    border-radius: 24px;
    background: #fff;
    color: #202026;
    box-shadow: none;
}

.wb-notes-view .wb-notes-search i {
    font-size: 18px;
}

.wb-notes-view .wb-notes-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #111;
    font: inherit;
    font-size: 16px;
}

.wb-notes-view .wb-notes-search input::placeholder {
    color: #8e8e93;
}

.wb-notes-view .wb-notes-compose-btn {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #c89300;
    font-size: 21px;
    cursor: pointer;
    box-shadow: none;
}

.wb-notes-view .wb-group-count-line {
    margin: -23px 2px 19px;
    font-size: 16px;
}

.wb-notes-view .wb-group-bottom-bar {
    justify-content: space-between;
}

.wb-notes-view .wb-context-menu {
    position: absolute;
    top: calc(max(var(--safe-top, 0px), env(safe-area-inset-top, 0px)) + 57px);
    right: 18px;
    z-index: 20;
    min-width: 196px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.17);
}

.wb-notes-view .wb-context-menu button {
    width: 100%;
    min-height: 47px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 15px;
    border: 0;
    border-bottom: 1px solid #ececf0;
    background: transparent;
    color: #202024;
    font: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
}

.wb-notes-view .wb-context-menu button:last-child {
    border-bottom: 0;
}

.wb-notes-view .wb-context-menu button.is-danger {
    color: #ff3b30;
}

.wb-notes-view .wb-search-results {
    position: absolute;
    inset: auto 18px max(75px, calc(65px + env(safe-area-inset-bottom, 0px))) 18px;
    z-index: 12;
    max-height: min(62vh, 540px);
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    background: rgba(255,255,255,0.98);
    box-shadow: 0 17px 42px rgba(39, 40, 55, 0.16);
}

.wb-notes-view .wb-search-result {
    width: 100%;
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border: 0;
    border-bottom: 1px solid #ececf0;
    background: transparent;
    color: #17171a;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.wb-notes-view .wb-search-result:last-child { border-bottom: 0; }
.wb-notes-view .wb-search-result > span:not(.wb-row-icon) { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.wb-notes-view .wb-search-result strong, .wb-notes-view .wb-search-result small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-notes-view .wb-search-result strong { font-size: 15px; }
.wb-notes-view .wb-search-result small { color: #8e8e93; font-size: 12px; }
.wb-notes-view .wb-search-result > i { color: #c6c6cc; font-size: 14px; }
.wb-notes-view .wb-search-empty { padding: 28px 18px; color: #8e8e93; font-size: 14px; text-align: center; }

.wb-notes-view .wb-files-empty-state {
    min-height: 190px;
    border-radius: 23px;
    background: #fff;
    color: #8e8e93;
}

.wb-notes-view .wb-files-empty-state i { color: #e3ac00; }

.wb-notes-view .wb-editor-nav {
    padding-right: 21px;
}

.wb-notes-view .wb-editor-done-btn {
    color: #c89300;
}

.wb-notes-view .wb-editor-scroll {
    padding-top: 12px;
    padding-bottom: max(38px, calc(28px + env(safe-area-inset-bottom, 0px)));
}

.wb-notes-view .wb-editor-title-input {
    width: 100%;
    margin: 0 0 21px;
    padding: 0 1px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #08080a;
    font: inherit;
    font-size: 36px;
    line-height: 1.13;
    font-weight: 800;
    letter-spacing: -1px;
}

.wb-notes-view .wb-editor-title-input::placeholder { color: #b6b6be; }

.wb-notes-view .wb-editor-group-row,
.wb-notes-view .wb-book-setting-row {
    min-height: 55px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 15px;
    border-radius: 16px;
    background: #fff;
    color: #1d1d20;
    font-size: 16px;
}

.wb-notes-view .wb-editor-group-row > span { font-weight: 600; }
.wb-notes-view .wb-editor-group-row select { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: #8e8e93; font: inherit; font-size: 15px; text-align-last: right; }
.wb-notes-view .wb-editor-group-row > i { color: #c6c6cc; font-size: 13px; }

.wb-notes-view .wb-editor-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 31px 2px 11px;
}

.wb-notes-view .wb-editor-section-head > span,
.wb-notes-view .wb-book-settings-title {
    color: #1d1d20;
    font-size: 17px;
    font-weight: 750;
}

.wb-notes-view .wb-editor-section-head button {
    border: 0;
    background: transparent !important;
    color: #c89300 !important;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.wb-notes-view .wb-editor-entry-list {
    overflow: hidden;
    border-radius: 20px;
    background: #fff;
}

.wb-notes-view #add-book-entry-btn {
    min-height: 34px;
    padding: 0 8px;
    border-radius: 8px;
    background: transparent !important;
    color: #c89300 !important;
    box-shadow: none !important;
}

.wb-notes-view .wb-entry-note + .wb-entry-note { border-top: 1px solid #e8e8ed; }

.wb-notes-view .wb-entry-note-head {
    min-height: 66px;
    display: flex;
    align-items: stretch;
}

.wb-notes-view .wb-entry-expand-btn {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px 11px 16px;
    border: 0;
    background: #fff;
    color: #1c1c20;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.wb-notes-view .wb-entry-expand-btn > span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wb-notes-view .wb-entry-expand-btn strong, .wb-notes-view .wb-entry-expand-btn small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-notes-view .wb-entry-expand-btn strong { font-size: 16px; font-weight: 650; }
.wb-notes-view .wb-entry-expand-btn small { color: #8e8e93; font-size: 12px; }
.wb-notes-view .wb-entry-expand-btn > i { color: #b6b6bd; font-size: 14px; transition: transform .18s ease; }
.wb-notes-view .wb-entry-note.expanded .wb-entry-expand-btn > i { transform: rotate(90deg); }

.wb-notes-view .wb-entry-delete-btn {
    width: 47px;
    border: 0;
    background: #fff;
    color: #ff3b30;
    font-size: 16px;
    cursor: pointer;
}

.wb-notes-view .wb-entry-note-body {
    padding: 0 16px 20px;
}

.wb-notes-view .wb-entry-title-input {
    width: 100%;
    height: 40px;
    margin: 2px 0 10px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid #e5e5ea;
    outline: 0;
    background: transparent;
    color: #16161a;
    font: inherit;
    font-size: 18px;
    font-weight: 650;
}

.wb-notes-view .wb-entry-body-textarea {
    width: 100%;
    height: clamp(390px, 68vh, 720px) !important;
    min-height: 390px !important;
    max-height: 720px !important;
    display: block;
    box-sizing: border-box;
    padding: 9px 0 15px;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0;
    background: transparent;
    color: #29292d;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    resize: none;
    font: inherit;
    font-size: 16px;
    line-height: 1.55;
}

.wb-notes-view .wb-entry-body-textarea::placeholder { color: #b4b4bc; }

.wb-notes-view .wb-entry-settings {
    overflow: hidden;
    border-radius: 14px;
    background: #f4f4f7;
}

.wb-notes-view .wb-entry-settings summary {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 13px;
    color: #52525a;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.wb-notes-view .wb-entry-settings summary::-webkit-details-marker { display: none; }
.wb-notes-view .wb-entry-settings summary i { font-size: 12px; transition: transform .18s ease; }
.wb-notes-view .wb-entry-settings[open] summary i { transform: rotate(90deg); }

.wb-notes-view .wb-entry-settings-content {
    display: grid;
    gap: 10px;
    padding: 0 13px 13px;
}

.wb-notes-view .wb-entry-field { display: flex; flex-direction: column; gap: 5px; color: #797981; font-size: 12px; font-weight: 600; }
.wb-notes-view .wb-entry-field input, .wb-notes-view .wb-entry-field select { min-height: 39px; padding: 0 10px; border: 1px solid #e0e0e5; border-radius: 10px; outline: 0; background: #fff; color: #242429; font: inherit; font-size: 14px; }

.wb-notes-view .wb-book-settings-section { margin-top: 31px; }
.wb-notes-view .wb-book-settings-title { margin: 0 2px 11px; }

.wb-notes-view .wb-book-setting-row {
    position: relative;
    justify-content: space-between;
    min-height: 71px;
}

.wb-notes-view .wb-book-setting-row > span { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 4px; padding-right: 11px; }
.wb-notes-view .wb-book-setting-row strong { font-size: 16px; font-weight: 600; }
.wb-notes-view .wb-book-setting-row small { color: #8e8e93; font-size: 12px; line-height: 1.35; }
.wb-notes-view .wb-book-setting-row input { position: absolute; width: 46px; height: 28px; margin: 0; opacity: 0; cursor: pointer; }
.wb-notes-view .wb-ios-switch { width: 46px; height: 28px; flex: 0 0 46px; position: relative; border-radius: 15px; background: #d1d1d6; transition: background .18s ease; }
.wb-notes-view .wb-ios-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.22); transition: transform .18s ease; }
.wb-notes-view .wb-book-setting-row input:checked + .wb-ios-switch { background: #34c759; }
.wb-notes-view .wb-book-setting-row input:checked + .wb-ios-switch::after { transform: translateX(18px); }

.wb-notes-view .wb-delete-book-btn {
    width: 100%;
    min-height: 52px;
    margin-top: 14px;
    border: 0;
    border-radius: 16px;
    background: #fff;
    color: #ff3b30;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.wb-notes-view .wb-delete-book-btn[hidden] { display: none; }

@media (max-width: 380px) {
    .wb-notes-view .wb-notes-title { font-size: 34px; }
    .wb-notes-view .wb-notes-scroll { padding-right: 14px; padding-left: 14px; }
    .wb-notes-view .wb-notes-bottom-bar { padding-right: 14px; padding-left: 14px; gap: 11px; }
    .wb-notes-view .wb-nav-labeled span { display: none; }
}

@media (max-width: 380px) {
    .world-book-files-view .wb-folder-visual {
        width: 100px !important;
        height: 72px !important;
    }

    .world-book-files-view .wb-folder-tab {
        width: 44px !important;
        height: 16px !important;
    }

    .world-book-files-view .wb-folder-body {
        top: 15px !important;
    }
}
