.book-bottom-button {
	margin-top: 15px;
    margin-left: 5px;
    margin-right: 5px;
}
.book-char-profile-button {
	font-weight: bold;
	font-size: xx-large;
	color: #fda636;
    text-shadow: 0px 0px 5px #000000;
	width: 150px;
	height: 50px;
	display: flex;
	justify-content: center; /* Horizontally center */
	align-items: center;    /* Vertically center */
	background-image: url("../assets/img/buttons/Char-profile-button.webp");
	background-size: 100% 100%; 
	background-repeat: no-repeat;
	position: relative;
	filter: drop-shadow(10px 10px 10px rgba(0, 0, 0, 0.5));
}
.book-char-profile-button:hover {
    transform: translateY(-1px);

    transition:
        transform 0.12s ease,
        filter 0.12s ease;
}
.book-char-profile-button:active {
    transform: translateY(1px);
}
.book-delete-button{
	filter: hue-rotate(325deg);
}
.book-page-curent-page {
	font-weight: bold;
	font-size: xx-large;
	width: 50px;
	height: 50px;
	display: flex;
	justify-content: center; /* Horizontally center */
	align-items: center;    /* Vertically center */
	background-image: url("../assets/img/background/charSelection/Book-page-box.webp");
	background-size: 100% 100%; 
	background-repeat: no-repeat;
}
.book-page-nav-button {
	width: 80px;
	height: 50px;
	display: flex;
	justify-content: center; /* Horizontally center */
	align-items: center;    /* Vertically center */
	margin-right: 10px;
	margin-left: 10px;
}
.book-page-next-button {
	background-image: url("../assets/img/buttons/Navigate-Button-Right.webp");
	background-size: 100% 100%; 
	background-repeat: no-repeat;
}
.book-page-previous-button {
	background-image: url("../assets/img/buttons/Navigate-Button-Left.webp");
	background-size: 100% 100%; 
	background-repeat: no-repeat;
}
.book-play-button {
	filter: hue-rotate(65deg);
}
.char-box-parent {
	/*display: inline-table;*/
	display: flex;
	align-content: center;
    justify-content: center;
    flex-wrap: wrap;
    width: 250px;
    height: 130px;
    background-image: url("../assets/img/background/charSelection/Book-page-box.webp");
    background-size: 100% 100%;
    background-repeat: no-repeat;
	padding: 15px 15px 15px 20px;
}
.char-box-parent:hover {
    transform: translateY(-1px);
    filter:
        brightness(1.08)
        saturate(1.08)
        drop-shadow(12px 12px 12px rgba(0, 0, 0, 0.55));

    transition:
        transform 0.12s ease,
        filter 0.12s ease;
}
.char-box-parent:active {
    transform: translateY(1px);
    filter: brightness(0.85) drop-shadow(6px 6px 6px rgba(0,0,0,.45));
}
.char-profile-buttons {
	width: 100%;
    display: flex;
    justify-content: center;
}
.char-profile-picture-container {
	display: flex;
    justify-content: center;
    background-image: url("../assets/img/background/Char-portrait-frame.webp");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    aspect-ratio: 1 / 1;
	margin-top: 10px;
	margin-bottom: 10px;
	width: 80%;
	border-radius: 10px;
}
.char-profile-poster {
	display: flex;
    justify-content: center;
    background-image: url("../assets/img/background/charSelection/Char-profile-background.webp");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    height: 100%;
    border-radius: 10px;
}
.char-profile-poster-container {
	width: 300px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: space-evenly;
}
.char-profile-poster-name {
	display: flex;
    justify-content: center;
    background-image: url("../assets/img/background/charCreation/Char-class-name-box.webp");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    height: 40px;
    border: 2px solid #000000;
    border-radius: 15px;
    align-items: center;
    color: #ff9d20;
    font-weight: bold;
    font-size: x-large;
    text-shadow: 0px 0px 1px white;
    padding-left: 5px;
    padding-right: 5px;
	width: 100%;
	/*margin-bottom: 5px;*/
}
.char-profile-poster-stats {
	/*border: 1px solid black;
	width: 100%;*/
	background-image: url("../assets/img/background/charCreation/CharDescriptionBox.webp");
    background-size: 100% 100%;
    background-repeat: no-repeat;
	padding: 15px;
}
.char-profile-quote {
    padding: 10px;
    width: 100%;
    /* height: 100px; */
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    color: black;
    font-weight: bold;
    /*margin-bottom: 5px;*/
	font-style: italic;
}
.char-selection-container {
    position: relative;
    width: 350px;
    height: 100%;
    perspective: 1200px; /* Gives the 3D effect */
}
.char-selection-container-module {
	display: flex;
    align-content: flex-start;
    width: 100%;
    height: 100%;
    flex-wrap: wrap;
    justify-content: center;
}
.char-selection-nav-container {
	height: 50px;
	display: flex;
	justify-content: center; /* Horizontally center */
	align-items: center;    /* Vertically center */
	position: absolute;
    bottom: 15px;
}
.deleteCharDialogBox {
	background-image: url("../assets/img/background/charCreation/CharDescriptionBox.webp");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    padding: 10px;
    /* width: 100%; */
    height: 100px;
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
	color: black;
    font-weight: bold;
    font-size: large;
}
.deleteCharMessage {
	color: black;
    font-weight: bold;
    font-size: large;
}
.exchangeCharMessageContainer {
	height: 100%;
	display: flex;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
}
.exchangeCharMessageText {
	width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
	margin-bottom: 10px;
}
.item-icon-accept { background-image: url("../assets/img/icons/checkV2.webp"); }
.manageCharContainer {
	z-index: 9999;
    display: flex;
    position: fixed;
    background-color: #000000d4;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    text-align: center;
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-size: 14px;
	font-weight: bold;
    color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    animation: scaleUp 0.5s ease-in;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
}
.shadow {
	filter: drop-shadow(10px 10px 10px rgba(0, 0, 0, 0.5));
}
.volumeIcon {
	z-index: 101;
    border-radius: 10px;
    background-color: rgb(255 255 255 / 40%);
    width: 40px;
    height: 40px;
    position: absolute;
    right: 20px;
    top: 20px;
	background-size: 100% 100%; 
	background-repeat: no-repeat;
	/*visibility: hidden;*/
	background-image: url("../assets/img/icons/ui/VolumeIcon-Med.webp");
}

/* ========================================================================== */
/* V6 - Responsive character selection / profile / modal UX                  */
/* ========================================================================== */

.char-selection-container-module {
    box-sizing: border-box;
    min-width: 0;
    padding-inline: max(4px, env(safe-area-inset-left)) max(4px, env(safe-area-inset-right));
}

.char-selection-container {
    width: min(calc(100% - 8px), var(--char-selection-server-width, 720px), 720px);
    min-width: min(300px, calc(100% - 8px));
    max-width: 720px;
    min-height: 0;
}

.char-selection-container .book-page {
    min-width: 0;
}

.char-selection-list-page {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-content: stretch;
    justify-content: flex-start;
    padding: clamp(14px, 4.5%, 32px);
    padding-bottom: max(82px, calc(70px + env(safe-area-inset-bottom)));
    overflow: hidden;
}

.char-selection-card-grid {
    width: 100%;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 285px));
    grid-auto-rows: 160px;
    justify-content: center;
    align-content: start;
    gap: 5px 8px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px 2px 8px;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(92, 49, 17, .55) transparent;
    overscroll-behavior: contain;
}

.char-box-parent {
    box-sizing: border-box;
    width: 285px;
    max-width: 100%;
    height: 160px;
    min-width: 0;
    flex: none;
    padding: 15px 15px 15px 20px;
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    outline: none;
}

.char-box-parent:focus-visible,
.book-char-profile-button:focus-visible,
.book-page-nav-button:focus-visible {
    outline: 2px solid #f0bd58;
    outline-offset: -4px;
    filter: brightness(1.08) saturate(1.08) drop-shadow(0 0 7px rgba(240, 189, 88, .65));
}

.char-box-parent table {
    table-layout: fixed;
}

.char-box-parent .char-card-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.char-box-new {
    flex-direction: column;
    gap: 6px;
    color: #6e3c13;
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 1px rgba(255,255,255,.55);
}

.char-box-new-mark {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(99, 55, 18, .62);
    border-radius: 50%;
    background: rgba(255, 231, 167, .28);
    box-shadow: inset 0 0 10px rgba(91, 48, 13, .18), 0 2px 5px rgba(52, 25, 4, .2);
    color: #9a5b18;
    font-size: 37px;
    font-weight: 400;
    line-height: 1;
}

.char-box-new-label {
    line-height: 1.1;
}

.char-selection-empty {
    align-self: center;
    color: #6f4725;
    font-size: 15px;
}

.char-selection-nav-container {
    width: min(100%, 340px);
    height: 56px;
    left: 50%;
    bottom: max(13px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    gap: 7px;
}

.book-page-nav-button,
.book-page-curent-page {
    box-sizing: border-box;
    min-height: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.book-page-nav-button {
    width: 72px;
    height: 52px;
    margin: 0;
    cursor: pointer;
}

.book-page-nav-placeholder {
    visibility: hidden;
    pointer-events: none;
}

.book-page-curent-page {
    width: 50px;
    height: 52px;
    font-size: 25px;
}

.char-selection-detail-page {
    box-sizing: border-box;
    padding: clamp(12px, 4.5%, 30px);
    overflow: hidden auto;
    scrollbar-width: none;
}

.char-selection-detail-page::-webkit-scrollbar {
    display: none;
}

.char-profile-poster {
    box-sizing: border-box;
    width: 100%;
    min-height: 100%;
    height: auto;
    padding: 3px;
    align-items: center;
}

.char-profile-poster-container {
    box-sizing: border-box;
    width: min(100%, 430px);
    min-width: 0;
    max-height: 100%;
    padding: 4px;
    gap: 2px;
}

.char-profile-picture-container {
    width: min(80%, 270px);
    max-width: 100%;
    margin: 7px auto;
}

.char-profile-poster-name {
    box-sizing: border-box;
    min-height: 42px;
    height: auto;
    padding: 5px 10px;
    overflow-wrap: anywhere;
}

.char-profile-quote {
    box-sizing: border-box;
    padding: 7px 10px;
    line-height: 1.2;
}

.char-profile-poster-stats {
    box-sizing: border-box;
    max-width: 100%;
    padding: 12px;
}

.char-profile-buttons {
    box-sizing: border-box;
    gap: 5px;
    flex-wrap: wrap;
}

.book-char-profile-button {
    box-sizing: border-box;
    min-width: 124px;
    width: auto;
    height: 50px;
    min-height: 48px;
    padding: 6px 15px;
    margin: 4px;
    font-size: clamp(20px, 3vw, 29px);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.book-play-button {
    width: min(210px, 78%);
    height: clamp(64px, 9vh, 86px);
    min-height: 60px;
}

/* Character deletion modal */
.manageCharContainer {
    box-sizing: border-box;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: max(14px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border-radius: 0;
    overflow: hidden auto;
    flex-direction: column;
    flex-wrap: nowrap;
    align-content: center;
    align-items: center;
    justify-content: center;
}

.manageCharDialog {
    box-sizing: border-box;
    width: min(92vw, 500px);
    max-width: 100%;
    max-height: min(92%, 640px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
}

.manageCharDialogTitle {
    width: 100%;
    flex: 0 0 auto;
    font-size: clamp(20px, 5vw, 27px);
}

.deleteCharDialogBox {
    box-sizing: border-box;
    width: 100%;
    min-height: 118px;
    height: auto;
    padding: 26px clamp(18px, 5vw, 32px);
    line-height: 1.28;
    font-size: clamp(16px, 4vw, 19px);
}

.manageCharDialogActions {
    width: 100%;
    justify-content: center;
}

.manageCharDialogActions .book-char-profile-button {
    flex: 1 1 150px;
    max-width: 210px;
    min-height: 52px;
}

.deleteCharMessage {
    width: 100%;
    box-sizing: border-box;
    padding: 18px 12px;
    font-size: clamp(16px, 4vw, 19px);
    text-align: center;
}

/* Desktop/tablet: use the page width instead of preserving a phone-sized strip. */
@media (min-width: 760px) {
    .char-selection-container {
        width: min(calc(100% - 48px), var(--char-selection-server-width, 720px), 720px);
    }

    .char-selection-list-page {
        padding-inline: 34px;
    }

    .char-selection-card-grid {
        grid-template-columns: repeat(2, 285px);
        gap: 9px 16px;
    }

    .char-profile-poster-container {
        width: min(100%, 630px);
        display: grid;
        grid-template-columns: minmax(235px, 46%) minmax(240px, 1fr);
        grid-template-areas:
            "picture name"
            "picture quote"
            "picture stats"
            "picture primary"
            "picture secondary";
        align-items: center;
        align-content: center;
        column-gap: 16px;
        row-gap: 4px;
    }

    .char-profile-picture-container {
        grid-area: picture;
        width: 100%;
        max-width: 285px;
        margin: 0 auto;
    }

    .char-profile-poster-name { grid-area: name; }
    .char-profile-quote { grid-area: quote; }
    .char-profile-poster-stats { grid-area: stats; }
    .char-profile-poster-container > .char-profile-buttons:nth-of-type(1) { grid-area: primary; }
    .char-profile-poster-container > .char-profile-buttons:nth-of-type(2) { grid-area: secondary; }

    .book-play-button {
        width: min(190px, 90%);
        height: 74px;
    }
}

@media (max-width: 559px) {
    .char-selection-list-page {
        padding-inline: clamp(13px, 5%, 19px);
    }

    .char-selection-card-grid {
        grid-template-columns: minmax(0, 285px);
        gap: 4px;
    }

    .char-box-parent {
        width: min(285px, 100%);
    }

    .char-profile-poster-container {
        width: 100%;
    }

    .char-profile-picture-container {
        width: min(76%, 235px);
    }

    .char-profile-poster-name {
        font-size: clamp(20px, 6.5vw, 25px);
    }

    .char-profile-quote {
        font-size: 13px;
    }

    .char-profile-poster-stats {
        padding: 10px;
    }

    .book-char-profile-button {
        min-width: 116px;
        min-height: 50px;
        padding-inline: 11px;
        font-size: clamp(20px, 7vw, 27px);
    }

    .book-play-button {
        width: min(190px, 74%);
        height: 70px;
    }

    .manageCharDialog {
        width: min(100%, 390px);
    }

    .manageCharDialogActions {
        gap: 2px;
    }

    .manageCharDialogActions .book-char-profile-button {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
        margin-inline: 2px;
    }
}

/* Short landscape phones/tablets: favor a compact horizontal detail layout. */
@media (max-height: 560px) and (min-width: 600px) {
    .char-selection-list-page {
        padding-top: 13px;
        padding-bottom: 68px;
    }

    .char-selection-card-grid {
        grid-auto-rows: 150px;
    }

    .char-box-parent {
        height: 150px;
        padding-block: 10px;
    }

    .char-profile-poster-container {
        width: min(100%, 650px);
        transform: scale(.94);
        transform-origin: center;
    }

    .char-profile-picture-container {
        max-width: 220px;
    }

    .char-profile-quote {
        padding-block: 3px;
        font-size: 12px;
    }

    .book-play-button {
        height: 58px;
        min-height: 54px;
    }
}

@media (hover: hover) and (pointer: fine) {
    .char-box-parent:hover,
    .book-char-profile-button:hover,
    .book-page-nav-button:hover {
        cursor: pointer;
    }
}

@media (prefers-reduced-motion: reduce) {
    .char-box-parent,
    .book-char-profile-button,
    .manageCharContainer {
        animation: none !important;
        transition: none !important;
    }
}

@media (hover: none), (pointer: coarse) {
    .char-box-parent:hover,
    .book-char-profile-button:hover {
        transform: none;
        filter: drop-shadow(6px 6px 7px rgba(0,0,0,.38));
    }

    .char-box-parent:active,
    .book-char-profile-button:active {
        transform: scale(.985);
        filter: brightness(.9) drop-shadow(4px 4px 5px rgba(0,0,0,.35));
    }
}

/* ========================================================================== */
/* V7 - Card containment and selected-character presentation                  */
/* ========================================================================== */

.char-box-parent {
    overflow: hidden;
    padding: 11px 14px 12px 16px;
}

.char-card-layout {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    color: #271609;
}

.char-card-title {
    flex: 0 0 27px;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 4px 2px;
    box-sizing: border-box;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
}

.char-card-class {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 43%;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #704117;
    font-size: 11px;
    font-weight: 700;
}

.char-card-class::after {
    content: "•";
    margin-left: 5px;
    color: #a36a28;
}

.char-card-name {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #211308;
    font-size: 16px;
    font-weight: 800;
    text-shadow: 0 1px rgba(255,255,255,.7);
}

.char-card-body {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.char-card-portrait {
    width: 94px;
    height: 94px;
    max-width: 100%;
    justify-self: center;
    align-self: center;
    background-size: 100% 100%, contain, 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 7px;
    filter: drop-shadow(0 3px 3px rgba(49, 24, 5, .28));
}

.char-card-data {
    min-width: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    overflow: hidden;
}

.char-card-progress,
.char-profile-progress-row {
    min-width: 0;
    display: grid;
    grid-template-columns: 17px minmax(0, 1fr);
    align-items: center;
    gap: 3px;
}

.char-card-progress .char-status-icon,
.char-profile-progress-row .char-status-icon,
.char-card-stat .char-status-icon {
    float: none;
    margin: 0;
    width: 15px;
    height: 15px;
}

.char-card-progress .char-status-text,
.char-profile-progress-row .char-status-text {
    min-width: 0;
    width: 100%;
    height: 17px;
    float: none;
}

.char-card-progress .barra-container,
.char-card-progress .barra-externa,
.char-profile-progress-row .barra-container,
.char-profile-progress-row .barra-externa {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.char-card-progress .barra-container-text,
.char-profile-progress-row .barra-container-text {
    color: #211308;
    font-size: 10px;
    font-weight: 800;
    text-shadow: -1px 0 rgba(255,246,215,.88), 0 1px rgba(255,246,215,.88), 1px 0 rgba(255,246,215,.88), 0 -1px rgba(255,246,215,.88);
}

.char-card-stats,
.char-profile-stat-grid {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 5px;
}

.char-card-stat {
    min-width: 0;
    height: 17px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 3px;
    box-sizing: border-box;
    border-radius: 4px;
    background: rgba(255, 239, 195, .34);
    color: #2c190b;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    overflow: hidden;
}

.char-card-stat span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.char-profile-resume-heading {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 3px 10px 7px;
    text-align: center;
}

.char-profile-resume-kicker {
    color: #936122;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .8px;
    text-transform: uppercase;
}

.char-profile-resume-title {
    color: #56300f;
    font-size: clamp(20px, 4vw, 27px);
    font-weight: 800;
    line-height: 1.05;
    text-shadow: 0 1px rgba(255,255,255,.65);
}

.char-profile-identity {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.char-profile-classBadge {
    max-width: 100%;
    box-sizing: border-box;
    padding: 4px 10px;
    border: 1px solid rgba(99, 55, 17, .38);
    border-radius: 999px;
    background: rgba(255, 235, 177, .38);
    color: #654018;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.char-profile-poster-stats {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid rgba(106, 63, 23, .24);
    border-radius: 8px;
    box-shadow: inset 0 0 14px rgba(255, 244, 209, .33), 0 3px 7px rgba(69, 35, 7, .12);
}

.char-profile-stat-panel {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.char-profile-progress-grid {
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}

.char-profile-stat-grid {
    gap: 4px 7px;
}

.char-profile-stat-grid .char-card-stat {
    height: 22px;
    padding-inline: 6px;
    background: rgba(255, 239, 195, .48);
    font-size: 12px;
}

.char-profile-quote {
    max-width: 100%;
    box-sizing: border-box;
    color: #4a2d14;
    font-size: 12px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

@media (min-width: 760px) {
    .char-profile-poster-container {
        grid-template-areas:
            "heading heading"
            "picture identity"
            "picture quote"
            "picture stats"
            "picture primary"
            "picture secondary";
        grid-template-rows: auto auto auto auto auto auto;
        max-width: 650px;
        padding: 14px 18px 18px;
        column-gap: 20px;
        row-gap: 6px;
    }

    .char-profile-resume-heading { grid-area: heading; }
    .char-profile-identity { grid-area: identity; }
    .char-profile-picture-container { grid-area: picture; }
    .char-profile-quote { grid-area: quote; }
    .char-profile-poster-stats { grid-area: stats; }
    .char-profile-poster-container > .char-profile-buttons:nth-of-type(1) { grid-area: primary; }
    .char-profile-poster-container > .char-profile-buttons:nth-of-type(2) { grid-area: secondary; }

    .char-profile-picture-container {
        width: min(100%, 275px);
        margin: 0 auto;
    }

    .char-profile-poster-name {
        width: min(100%, 300px);
        font-size: 26px;
    }
}

@media (max-width: 559px) {
    .char-box-parent {
        padding: 11px 13px 12px 16px;
    }

    .char-card-body {
        grid-template-columns: 102px minmax(0, 1fr);
        gap: 6px;
    }

    .char-card-portrait {
        width: 100px;
        height: 100px;
    }

    .char-card-title {
        flex-basis: 25px;
    }

    .char-card-class {
        font-size: 10px;
    }

    .char-card-name {
        font-size: 15px;
    }

    .char-profile-poster-container {
        padding: 10px 12px 14px;
        gap: 4px;
    }

    .char-profile-resume-heading {
        padding-top: 1px;
        padding-bottom: 4px;
    }

    .char-profile-resume-kicker {
        font-size: 10px;
    }

    .char-profile-resume-title {
        font-size: 22px;
    }

    .char-profile-picture-container {
        width: min(72%, 225px);
        margin-block: 4px;
    }

    .char-profile-poster-stats {
        width: min(100%, 300px);
        margin-inline: auto;
        padding: 10px 12px;
    }

    .char-profile-identity {
        margin-top: 2px;
    }

    .char-profile-poster-name {
        width: min(100%, 300px);
    }
}

/* V7 explicit action placement (avoids nth-of-type dependence after heading insertion). */
@media (min-width: 760px) {
    .char-profile-primaryAction { grid-area: primary; }
    .char-profile-secondaryActions { grid-area: secondary; }
}

/* ========================================================================== */
/* V8 - More breathing room inside character cards                            */
/* ========================================================================== */

/* The source artwork has a pronounced decorative frame. Keep all live UI
   comfortably inside that frame instead of letting it sit on the painted edge. */
.char-box-parent {
    padding: 16px 18px 15px 21px;
}

.char-card-title {
    flex-basis: 24px;
    padding-inline: 2px;
}

.char-card-body {
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 7px;
}

.char-card-portrait {
    width: 88px;
    height: 88px;
}

.char-card-data {
    padding-right: 1px;
}

.char-card-stats {
    gap: 2px 4px;
}

.char-card-stat {
    padding-inline: 2px;
}

.char-box-new {
    padding: 19px 22px 18px;
}

@media (max-width: 559px) {
    .char-box-parent {
        padding: 16px 17px 15px 20px;
    }

    .char-card-body {
        grid-template-columns: 94px minmax(0, 1fr);
        gap: 6px;
    }

    .char-card-portrait {
        width: 92px;
        height: 92px;
    }

    .char-card-title {
        flex-basis: 23px;
    }
}

@media (max-height: 560px) and (min-width: 600px) {
    .char-box-parent {
        padding: 13px 18px 13px 21px;
    }

    .char-card-portrait {
        width: 84px;
        height: 84px;
    }
}

/* V18 - last-played metadata stays visible inside each character card. */
.char-card-last-used {
    flex: 0 0 14px;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    margin: 0 2px;
    color: #77532d;
    font: 700 8px/1 Arial, sans-serif;
    white-space: nowrap;
    overflow: hidden;
}
.char-card-last-used span { color: #8a6338; }
.char-card-last-used b { color: #4d2b12; overflow: hidden; text-overflow: ellipsis; }
.char-card-body { min-height: 0; }

/* V19 - guarantee all character-card metadata fits inside the painted frame. */
.char-card-layout {
    position: relative;
    padding-bottom: 14px;
}
.char-card-title {
    flex-basis: 21px;
    min-height: 21px;
}
.char-card-body {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 5px;
    padding-bottom: 1px;
}
.char-card-portrait {
    width: 80px;
    height: 80px;
}
.char-card-data {
    gap: 1px;
}
.char-card-progress,
.char-profile-progress-row {
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 2px;
}
.char-card-progress .char-status-icon,
.char-card-stat .char-status-icon {
    width: 13px;
    height: 13px;
}
.char-card-progress .char-status-text {
    height: 14px;
}
.char-card-progress .barra-container-text {
    font-size: 9px;
}
.char-card-stats {
    gap: 1px 3px;
}
.char-card-stat {
    height: 14px;
    gap: 2px;
    padding-inline: 1px;
    font-size: 9.5px;
}
.char-card-last-used {
    position: absolute;
    right: 3px;
    bottom: 1px;
    left: 3px;
    height: 12px;
    margin: 0;
    justify-content: flex-end;
    font-size: 8px;
    line-height: 12px;
    pointer-events: none;
}
@media (max-width: 559px) {
    .char-card-body { grid-template-columns: 84px minmax(0, 1fr); }
    .char-card-portrait { width: 82px; height: 82px; }
}

/* V20 - compact character-card internals so no stat row is clipped. */
.char-card-title{flex-basis:19px;min-height:19px;padding-bottom:1px}
.char-card-class{font-size:10px}
.char-card-name{font-size:15px}
.char-card-body{grid-template-columns:76px minmax(0,1fr);gap:4px}
.char-card-portrait{width:74px;height:74px}
.char-card-data{gap:0;justify-content:flex-start}
.char-card-progress,.char-profile-progress-row{grid-template-columns:12px minmax(0,1fr);gap:2px;min-height:12px}
.char-card-progress .char-status-icon,.char-card-stat .char-status-icon{width:11px;height:11px}
.char-card-progress .char-status-text{height:12px}
.char-card-progress .barra-container-text{font-size:8.5px;line-height:12px}
.char-card-stats{gap:0 2px}
.char-card-stat{height:12px;gap:2px;padding-inline:1px;font-size:8.5px;line-height:12px}
.char-card-last-used{height:10px;line-height:10px;font-size:7.5px;bottom:1px}
@media (max-width:559px){.char-card-body{grid-template-columns:78px minmax(0,1fr)}.char-card-portrait{width:76px;height:76px}}

/* V21 - restore breathing room now that the card is taller. */
.char-selection-card-grid {
    grid-auto-rows: 176px;
    gap: 9px 16px;
}
.char-box-parent {
    height: 176px;
    padding: 17px 18px 17px 21px;
}
.char-card-layout {
    padding-bottom: 15px;
}
.char-card-title {
    flex-basis: 22px;
    min-height: 22px;
    padding: 0 3px 2px;
}
.char-card-class { font-size: 10.5px; }
.char-card-name { font-size: 15.5px; }
.char-card-body {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 7px;
    padding-bottom: 2px;
    align-items: center;
}
.char-card-portrait {
    width: 80px;
    height: 80px;
}
.char-card-data {
    gap: 2px;
    justify-content: center;
    padding-right: 2px;
}
.char-card-progress,
.char-profile-progress-row {
    grid-template-columns: 13px minmax(0, 1fr);
    gap: 3px;
    min-height: 14px;
}
.char-card-progress .char-status-icon,
.char-card-stat .char-status-icon {
    width: 12px;
    height: 12px;
}
.char-card-progress .char-status-text { height: 14px; }
.char-card-progress .barra-container-text {
    font-size: 9px;
    line-height: 14px;
}
.char-card-stats { gap: 2px 4px; }
.char-card-stat {
    height: 14px;
    gap: 3px;
    padding-inline: 2px;
    font-size: 9px;
    line-height: 14px;
}
.char-card-last-used {
    height: 12px;
    line-height: 12px;
    font-size: 8px;
    right: 4px;
    left: 4px;
    bottom: 2px;
}
@media (max-width: 559px) {
    .char-selection-card-grid { grid-auto-rows: 176px; gap: 7px; }
    .char-box-parent { height: 176px; padding: 17px 17px 17px 20px; }
    .char-card-body { grid-template-columns: 80px minmax(0, 1fr); gap: 6px; }
    .char-card-portrait { width: 80px; height: 80px; }
}
@media (max-height: 560px) and (min-width: 600px) {
    .char-selection-card-grid { grid-auto-rows: 160px; }
    .char-box-parent { height: 160px; padding-block: 12px; }
    .char-card-title { flex-basis: 20px; min-height: 20px; }
    .char-card-body { grid-template-columns: 74px minmax(0, 1fr); gap: 5px; }
    .char-card-portrait { width: 72px; height: 72px; }
    .char-card-data { gap: 0; }
    .char-card-stats { gap: 0 2px; }
    .char-card-stat { height: 12px; line-height: 12px; font-size: 8.5px; }
    .char-card-progress, .char-profile-progress-row { min-height: 12px; }
    .char-card-progress .char-status-text { height: 12px; }
    .char-card-last-used { height: 10px; line-height: 10px; font-size: 7.5px; bottom: 1px; }
}

