/* Selected paper scroll window: artwork left, level/class facts right, description and effects below. */
.scroll-book {
    padding: 16px;
    font-family: Arial, sans-serif;
    font-size: 13px;
    line-height: 1.55;
}
.scroll-book .scroll-book-heading {
    position: relative;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 0;
    padding-right: 0;
}
.scroll-book-heading::after {
    position: absolute;
    bottom: 0;
    left: 12%;
    width: 76%;
    height: 3px;
    background: var(--line);
    clip-path: polygon(0 50%, 50% 0, 100% 50%, 50% 100%);
    content: '';
}
.scroll-book .item-book-body,
.scroll-book .item-book-actions {
    position: relative;
    padding-top: 14px;
    border-top: 0;
}
.scroll-book-heading h2 {
    padding-right: 76px;
}
.item-book-action-menu {
    position: absolute;
    top: -7px;
    right: 37px;
    z-index: 2;
}
.item-book-action-menu summary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: inherit;
    font-size: 26px;
    cursor: pointer;
    list-style: none;
}
.item-book-action-menu summary::-webkit-details-marker {
    display: none;
}
.item-book-action-options {
    position: absolute;
    top: 34px;
    right: 0;
    display: grid;
    gap: 6px;
    width: 200px;
    max-width: 65vw;
    max-height: 65vh;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel, #f6f7f2);
    box-shadow: 0 5px 18px #0003;
}
.item-book-action-options button {
    width: 100%;
}
.item-book-budget-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.item-book-budget-row .item-book-budget {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    overflow: visible;
}
.item-book-budget-row .item-book-budget > i {
    border-radius: 3px;
    pointer-events: none;
}
.item-book-budget-help {
    position: relative;
}
.item-book-budget-help summary {
    display: grid;
    place-items: center;
    font-size: 24px;
    cursor: pointer;
    list-style: none;
}
.item-book-budget-help .game-info-icon {
    -webkit-text-stroke: 0.2px currentColor;
}
.item-book-budget-help summary::-webkit-details-marker {
    display: none;
}
.item-book-budget-help p {
    position: absolute;
    bottom: 100%;
    right: 0;
    z-index: 3;
    width: min(240px, 65vw);
    margin: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel, #f6f7f2);
    box-shadow: 0 5px 18px #0003;
}
.scroll-book .item-book-body::before,
.scroll-book .item-book-actions::before {
    position: absolute;
    top: 0;
    left: 12%;
    width: 76%;
    height: 3px;
    background: var(--line);
    clip-path: polygon(0 50%, 50% 0, 100% 50%, 50% 100%);
    content: '';
}
.equipment-book .item-set-pending {
    position: relative;
    border-top: 0;
}
.equipment-book .item-set-active ~ .item-set-pending::before {
    position: absolute;
    top: 0;
    left: 12%;
    width: 76%;
    height: 3px;
    background: var(--line);
    clip-path: polygon(0 50%, 50% 0, 100% 50%, 50% 100%);
    content: '';
}
.scroll-book-heading .chat-item-origin {
    margin: 0 0 14px;
    font-size: 11px;
}
.scroll-book-heading .scroll-book-kind {
    margin: 0 0 4px;
    color: var(--gold);
    font-size: 11px;
}
.scroll-book-heading h2 {
    font-family: Georgia, serif;
    font-size: clamp(22px, 5vw, 26px);
    font-weight: 400;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}
.scroll-effect-divider {
    color: var(--gold);
    font-size: 11px;
}
.scroll-book .item-book-stats > div {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: start;
}
.scroll-book .item-book-stats dd {
    min-width: 0;
    overflow-wrap: anywhere;
}
.scroll-book .item-book-stats .item-book-stat-text dd {
    text-align: left;
}
.scroll-book .item-book-close {
    top: -7px;
    right: -7px;
    width: 44px;
    height: 44px;
    font-size: 26px;
}
.scroll-future-effect,
.scroll-effect-rank {
    color: var(--muted);
    font-size: 12px;
}
.scroll-book-effects-list .scroll-future-effect {
    display: inline;
}
.scroll-book .scroll-book-spread {
    grid-template-columns: 128px minmax(0, 1fr);
    gap: 14px;
    padding-block: 0 14px;
    border: 0;
}
.scroll-book-art img {
    width: 100%;
    height: auto;
    object-fit: contain;
}
.scroll-book .item-book-art .potion-icon {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
}
.scroll-book .item-book-stats dd {
    max-width: 100%;
    font-weight: 400;
    text-align: right;
}
.scroll-book-description h3,
.scroll-book-effects h3 {
    margin: 0 0 8px;
    color: inherit;
    font-size: 15px;
    font-weight: 700;
}
.scroll-book-description p {
    margin: 0 0 14px;
    font-size: inherit;
    line-height: inherit;
}
.scroll-book-description-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    flex-wrap: wrap;
}
.scroll-book-origin {
    color: #c34b47;
    font-size: 14px;
    overflow-wrap: anywhere;
}
.item-book-shared-origin {
    margin-top: 10px;
    text-align: right;
    overflow-wrap: anywhere;
}
.scroll-book-effects {
    position: relative;
    margin-top: 0;
    padding-block: 8px 14px;
    border-top: 0;
}
.scroll-book-effects::before {
    position: absolute;
    top: 0;
    left: 12%;
    width: 76%;
    height: 3px;
    background: var(--line);
    clip-path: polygon(0 50%, 50% 0, 100% 50%, 50% 100%);
    content: '';
}
.scroll-book-effects h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    margin: 0;
}
.scroll-book-effects-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 14px;
}
.scroll-book-effects-list {
    display: grid;
    gap: 12px;
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
}
.scroll-book-effects-list li {
    position: relative;
    margin: 0;
    padding-left: 20px;
    font-size: inherit;
    line-height: inherit;
}
.scroll-book-effects-list li::before {
    position: absolute;
    left: 0;
    content: '◈';
    color: var(--gold);
}
.scroll-book-effects-list .chest-reward {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 0;
}
.scroll-book-effects-list .chest-reward::before {
    position: static;
    flex: 0 0 auto;
}
.chest-reward button {
    display: inline;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.equipment-book .item-book-set h3,
.equipment-book .item-book-set h4 {
    font-family: Arial, sans-serif;
    font-size: 15px;
    font-weight: 700;
}
.equipment-book .item-book-set ul {
    display: grid;
    gap: 12px;
    padding: 0;
    list-style: none;
}
.equipment-book .item-book-set li {
    position: relative;
    margin: 0;
    padding-left: 20px;
    font-family: Arial, sans-serif;
    font-size: 13px;
    line-height: 1.55;
}
.equipment-book .item-book-set li::before {
    position: absolute;
    left: 0;
    color: var(--gold);
    content: '◈';
}
body[data-description-density='compact'] .item-book {
    font-size: 12px;
    line-height: 1.35;
}
body[data-description-density='compact'] .scroll-book-effects-list,
body[data-description-density='compact'] .equipment-book .item-book-set ul {
    gap: 5px;
}
body[data-description-density='compact'] .equipment-book .item-book-set li,
body[data-description-density='compact'] .scroll-future-effect {
    font-size: 12px;
    line-height: 1.35;
}
body[data-description-density='compact'] .scroll-book-description p {
    margin-bottom: 8px;
}
.scroll-book-recipe {
    color: var(--muted);
    font-size: 12px;
}
.scroll-book .scroll-book-actions {
    align-items: center;
    justify-content: flex-end;
    margin-top: 10px;
}
.scroll-book-actions > span {
    flex: 1 1 120px;
    font-size: 11px;
}
.scroll-book-actions button {
    flex: 0 1 auto;
}
@media (max-width: 360px) {
    .scroll-book .scroll-book-spread {
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 10px;
    }
}

.item-rune-label {
    position: relative;
    display: inline-block;
    cursor: help;
}
.item-rune-tooltip {
    position: absolute;
    bottom: 100%;
    left: 0;
    z-index: 5;
    display: none;
    width: 112px;
    padding: 8px;
    border-radius: 12px;
    background: var(--paper);
    box-shadow: 0 3px 16px #0004;
    pointer-events: none;
}
.item-rune-tooltip img {
    display: block;
    width: 96px;
    height: 96px;
    object-fit: contain;
}
.item-rune-label:hover .item-rune-tooltip,
.item-rune-label:focus .item-rune-tooltip {
    display: block;
}

/* Shared preview title and controls use the same 44px header row. */
.item-book .item-book-heading h2 {
    display: flex;
    align-items: center;
    min-height: 44px;
}
.item-book .item-book-heading .item-book-close,
.item-book .item-book-heading .item-book-action-menu {
    top: 0;
}
.item-book .item-book-heading .item-book-close {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

/* Short class names sit right; wrapped names fill the cell and read from the left. */
.scroll-book .item-book-stats .item-book-stat-text dd {
    justify-self: end;
    width: max-content;
    max-width: 100%;
    text-align: left;
}

/* Preserve the same divider height when a mythic item has no budget meter. */
.item-book-budget-space {
    height: 44px;
    margin-bottom: 14px;
}
.equipment-detail-art {
    position: relative;
}
.equipment-rune-socket {
    position: absolute;
    right: 4px;
    bottom: 4px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 2px;
    border: 1px solid var(--gold);
    border-radius: 50%;
    background: var(--panel);
    box-sizing: border-box;
    pointer-events: auto;
}
.equipment-rune-socket img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
