#adventurebook_page {
    margin: 0;
    padding: 0;
    border: none;
    width: 100%;
    min-height: 400px;
    position: relative;
    text-align: left;
}

.adventurebook_character_overview {
    text-align: left;
}

.adventurebook_character_overview_name {
    font-weight: bold;
    font-size: medium;
}

.adventurebook_character_actions {
    margin: 4px;
}


#adventurebook_content {
    container-type: inline-size;
}


#adventurebook_character {
    display: block;
    float: right;
    border: 1px solid #444444;
    border-radius: 8px;
    min-width: 200px;
    max-width: 200px;
    margin-left: 4px;
}

#adventurebook_character_topbar {
    display: none;
}

/* Ab 400px oder weniger: Container weg, Top-Bar fixiert sichtbar */
@container (max-width: 700px) {
    #adventurebook_character {
        display: none;
    }

    #adventurebook_character_topbar {
        display: block;
        bottom: 100%; /* oberhalb des Elements */
        left: 0;
        width: 100%;
        background: #eee;
        color: #000;
        padding: 0;
        font-size: 14px;
        text-align: center;
        cursor: pointer;
    }
}

#adventurebook_character_details {
    background: #eee;
    overflow: auto;
    padding: 4px;
}

/* Gutenberg-Galerie (Block) */
#adventurebook_content .wp-block-gallery .blocks-gallery-grid,
#adventurebook_content .wp-block-gallery.is-layout-flex {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: var(--wp--style--block-gap, .5rem);
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Klassische Shortcode-Galerie */
#adventurebook_content .gallery {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

#adventurebook_content .gallery .gallery-item {
    /* Fallback: 3 Spalten, wird vom class "gallery-columns-N" normalerweise gesetzt */
    width: calc(33.333% - .5rem);
}

#adventurebook_content .gallery.gallery-columns-2 .gallery-item {
    width: calc(50% - .5rem);
}

#adventurebook_content .gallery.gallery-columns-3 .gallery-item {
    width: calc(33.333% - .5rem);
}

#adventurebook_content .gallery.gallery-columns-4 .gallery-item {
    width: calc(25% - .5rem);
}

#adventurebook_content .gallery .gallery-item img {
    display: block;
    width: 100%;
    height: auto;
}


#adventurebook_content ul {
    margin: 0px;
}

.adventurebook-inner-content {
    overflow: hidden;
}

.adventurebook-inner-content p {
    padding: 0;
    margin: 0;
}


.adventurebook-shop-content {
    clear: both;
    overflow: auto;
}

.adventurebook_hidden {
    display: none;
}

.adventurebook_noliststyle {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

/* class for <ul> item lists */
.adventurebook_items {
    list-style-type: none;
    margin: 0;
    padding-bottom: 4px;
    padding-top: 4px;
    clear: both;
    overflow: auto;
    text-align: left;
}

.adventurebook_items li {
    margin-left: 0;
    padding-bottom: 2px;
}

.adventurebook_shop_items li {
    padding-bottom: 2px;
    border-bottom: 1px solid #cccccc;
    margin-left: 0;
}

.adventurebook_equipped_slotname {
    font-weight: bold;
    margin-left: 8px;
    cursor: pointer;
}

.adventurebook_equipped_itemname {
    cursor: pointer;
}

.adventurebook_float_right {
    float: right;
    margin-right: 8px;
}

.adventurebook-decisions {
    list-style-type: none;
    margin: 0;
    padding: 0;
    clear: both;
    overflow: auto;
}

.adventurebook-decisions ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.adventurebook-decisions li {
    margin-bottom: 4px;
    padding: 0;
}

.adventurebook-decision-option {
    margin: 2px;
    padding: 2px;
}

.adventurebook-decision-option td {
    vertical-align: top;
}

#adventurebook-decision-options-container {
    margin: 0;
    padding: 0;
}

#adventurebook-decision-options-container tr {
    margin: 0;
    padding: 0;
}

#adventurebook-decision-options-container td {
    margin: 0;
    padding: 0;
}

.adventurebook_decision-options-container-single {
    border: 1px solid #999999;
    width: 100%;

}

.adventurebook_small {
    clear: both;
    display: block;
    font-size: small;
    line-height: 1.0em;
    vertical-align: top;
}

.adventurebook_small_info {
    font-size: small;
}

.adventurebook_inner_content {
    margin: 0;
    padding: 0;
}

.adventurebook_inner_content p {
    margin-bottom: 4px;
}


.adventurebook_inner_content p::first-letter {
    font-size: 3em;
    float: left;
    line-height: 1;
    margin-right: 0.1em;
    font-weight: bold;
}

.adventurebook_enemies {
    clear: both;
    overflow: auto;
}

.adventurebook_enemy {
    font-weight: bold;
}

.adventurebook_enemy_image {
    float: left;
}

.adventurebook_enemy_name {
    font-weight: bold;
    font-size: large;
    text-align: left;
    overflow: hidden;
    cursor: pointer;
}


.adventurebook_enemy_description {
    font-size: small;
    color: #555555;
    margin-left: 34px;
    text-align: left;
}

.adventurebook_item_list_small {
    width: 50%;
    float: left;
    text-align: left;
}

.adventurebook_item_list_small li {
    list-style-type: none;
}

.adventurebook_item_actions {
    text-align: left;
    margin-left: 34px;
}

.adventurebook_item {
    clear: both;
}

.adventurebook_item_info {
    margin-left: 4px;
    border-left: 1px solid #444444;
    padding-left: 4px;
}

.adventurebook_item_image {
    float: left;
    margin-top: 8px;
}

.adventurebook_item_image img {
    width: 32px;
    height: 32px;
    vertical-align: middle;
    margin-right: 4px;
}

.adventurebook_item_name {
    font-size: medium;
    text-align: left;
    font-weight: bold;
    overflow: hidden;
    cursor: pointer;
}

.adventurebook_item_toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    line-height: 1;
    margin-left: 6px;
    padding: 0;
}

.adventurebook_combat_stats {
    margin: 0;
    padding: 0;
}

/* the toggle needs to be at the right side of the item name */
#adventurebook_toggle_character_details {
    float: right;
    margin-right: 4px;
    margin-top: 4px;
    font-size: small;
}

.adventurebook_item_stats {
    font-size: small;
    color: #333333;
    margin-left: 34px;
    text-align: left;
}

.adventurebook_item_description {
    font-size: small;
    color: #555555;
    margin-left: 34px;
    text-align: left;
}

#adventurebook_character_title {
    margin-top: 8px;
    margin-bottom: 8px;
}

#adventurebook_character_title_topbar {
    margin: 0;
}

.adventurebook_items {
    font-size: small;
}

.adventurebook_items_list {
    width: 100%;
}

.adventurebook_items_list ul {
    margin: 0;
    padding: 0;
}

.adventurebook_items_list_title {
    border-top: 1px solid #444444;
    border-bottom: 1px solid #444444;
    font-weight: bold;
    font-size: medium;
}

#adventurebook_combat_log {
    margin-top: 8px;
    clear: both;
}

.adventurebook_combat_log_important {
    color: red;
}

.button {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
}

.adventurebook_action_button_small {
    cursor: pointer;
    border: 1px solid #AAAAAA;
    background-color: #EEEEEE;
    color: black;
    border-radius: 4px;
    padding: 2px;
    text-decoration: none !important;
    font-size: 12px;
    margin-right: 2px;
}

.adventurebook_action_button {
    cursor: pointer;
    border: 1px solid #AAAAAA;
    background-color: #EEEEEE;
    color: black;
    border-radius: 4px;
    padding: 4px;
    text-decoration: none !important;
    font-size: small;
    margin-right: 2px;
}


.adventurebook_script_action_button {
    cursor: pointer;
    border: 1px solid #AAAAAA;
    background-color: #EEEEEE;
    color: black;
    border-radius: 4px;
    padding: 4px;
    margin-top: 4px;
    text-decoration: none !important;
    font-size: small;
}

.adventurebook_action_button:hover {
    color: red;
}

.adventurebook_error {
    color: red;
    font-weight: bold;
    text-align: center;
}

.adventurebook_message {
    color: green;
    font-weight: bold;
    text-align: center;
}

.adventurebook_script_output {
    margin: 0;
    color: #555555;
}

.adventurebook_script_output_line {

}

#adventurebook_fixed_height_container {
    overflow-y: scroll;
}

#adventurebook_container {
    position: relative;
    border: 0;

    /* Scrollbars ausblenden */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge Legacy */
}

#adventurebook_container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

#adventurebook_scroll_indicator {
    position: absolute;
    text-align: center;
    font-size: 14px;
    color: #000066;
    display: none; /* standardmäßig versteckt */
    animation: adventurebook_bounce 1s infinite;
}

/* kleine Animation */
@keyframes adventurebook_bounce {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}


@media (max-width: 600px) {
    #adventurebook_container {
        flex-direction: column;
    }
}

#adventurebook_container img {
    width: 200px;
    max-width: 200px;
    height: 200px;
    float: left;
    object-fit: cover; /* skaliert proportional, schneidet überstehende Ränder ab */
    object-position: center; /* zentriert den Ausschnitt */
    margin-right: 8px;
    margin-bottom: 16px;
    margin-top: 4px;
}

/* ab hier die Überschreibung für schmale Screens */
@container (max-width: 600px) {
    #adventurebook_container img {
        width: 100px;
        max-width: 100px;
        height: 100px;
    }
}

#adventurebook_container div {
    margin: 0;
}

.adventurebook_footer {
    clear: both;
    text-align: center;
    border-top: 1px solid #444444;
    font-size: small;
}

#adventurebook_page_title {
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
}

#adventurebook_play_audio {
    min-width: 130px;
    min-height: 32px;
    display: inline-block;
    vertical-align: middle;
    padding: 5px 12px;
    font-size: 15px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #f4f4f4;
    color: #222;
    cursor: pointer;
}

#adventurebook_play_audio.playing {
    background: #357a38;
    color: #fff;
    border-color: #2e6930;
}

#adventurebook_content .adventurebook_decision_button {
    /* display: block;*/
    margin: 0;
    padding: 6px 10px;
    cursor: pointer;
}

#adventurebook_content .decision_number {
    font-weight: bold;
    color: #888;
    margin-right: 4px;
}

.script-command > * {
    margin-right: 6px; /* oder gap: 6px, falls du Flex nutzt */
}

.script-command {
    display: flex;
    align-items: center;
    gap: 6px; /* moderner, ersetzt margin-right */
    margin-bottom: 4px;
}


.script-command input:nth-of-type(1) {
    width: 100px;
}

.script-command select {
    width: 200px;
}

.script-command input:nth-of-type(2) {
    width: 300px;
}

.script-command input:nth-of-type(3) {
    width: 400px;
}

#script_commands_textarea {
    /* text is not wrapped but a scrollbar appears */
    white-space: pre;
    overflow-x: auto;
    resize: vertical;
    display: block;
    width: 100%;
    height: 200px;
    font-family: monospace;
    font-size: 14px;
    margin-top: 8px;
    margin-bottom: 8px;
}



.adventurebook_list_compact {
    margin: 0 0 0 8px;
    padding: 0;
    list-style-type: disc;
}

.adventurebook_list_compact li {
    margin: 0;
    padding: 0;
}

.post-type-adventurebook_page .column-page_id {
    width: 80px;
}

.adventurebook_inline_editing {
    text-align: center;
}

/* --- Adventurebook Inline Edit Modal --- */

#ab-inline-style-helper {
}

/* dummy for sorting in WP minifiers */

/* Overlay */
.ab-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 10px;
    animation: abFadeIn 0.2s ease-in-out;
}

/* Modal box */
.ab-modal-content {
    background: #1e1e1e;
    color: #ddd;
    border-radius: 16px;
    width: 90%;
    max-width: 640px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    padding: 20px;
    position: relative;
    animation: abSlideIn 0.25s ease-out;
    max-height: 85vh;
    overflow-y: auto;
    font-size: 15px;
}

/* Close button */
.ab-modal-close {
    position: absolute;
    top: 12px;
    right: 18px;
    color: #bbb;
    font-size: 22px;
    cursor: pointer;
    transition: color 0.2s;
}

.ab-modal-close:hover {
    color: #fff;
}

/* Headings */
.ab-modal-content h3 {
    color: #ffd27f;
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 18px;
}

/* Inputs */
.ab-modal-content input,
.ab-modal-content textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #555;
    background: #2c2c2c;
    color: #eee;
    margin-bottom: 12px;
    font-family: inherit;
    font-size: 14px;
}

.ab-modal-content textarea {
    min-height: 180px;
    resize: vertical;
}

/* Buttons */
.ab-modal-content button,
.adventurebook_inline_edit_tools .ab-inline-edit {
    background: linear-gradient(180deg, #444, #2a2a2a);
    color: #fff;
    border: 1px solid #666;
    border-radius: 10px;
    padding: 4px 7px;
    margin: 3px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-weight: 500;
    font-size: small;
}

.ab-modal-content button:hover,
.adventurebook_inline_edit_tools .ab-inline-edit:hover {
    background: linear-gradient(180deg, #666, #333);
}

.ab-modal-content button:active,
.adventurebook_inline_edit_tools .ab-inline-edit:active {
    transform: scale(0.97);
}

/* Inline edit toolbar */
.adventurebook_inline_edit_tools {
    text-align: center;
    margin-top: 25px;
    border-top: 1px solid #444;
    padding-top: 15px;
}

.adventurebook_inline_edit_tools h4 {
    color: #ccc;
    margin-bottom: 10px;
    font-size: 15px;
}

/* Messages */
#ab-modal-body .success {
    color: #8f8;
    text-align: center;
}

#ab-modal-body .error {
    color: #f88;
    text-align: center;
}

/* Animations */
@keyframes abFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes abSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- Mobile optimization --- */
@media (max-width: 600px) {
    .ab-modal-content {
        width: 100%;
        height: auto;
        max-height: 90vh;
        border-radius: 10px;
        padding: 15px;
        font-size: 14px;
    }

    .ab-modal-close {
        top: 10px;
        right: 12px;
        font-size: 20px;
    }

    .ab-modal-content h3 {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .ab-modal-content textarea {
        min-height: 140px;
    }

    .adventurebook_inline_edit_tools h4 {
        font-size: 14px;
    }

}

.ab-jump-container select {
    background: #2b2b2b;
    border: 1px solid #555;
    color: #eee;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 14px;
}

.ab-jump-container select:focus {
    outline: none;
    border-color: #888;
}

.ab-jump-container label {
    color: #ccc;
    font-size: 14px;
}


.codemirror-wrapper {
    resize: both;
    overflow: auto;
    border: 1px solid #ccc;
    padding: 0 0 12px 0;   /* 👈 Abstand unten für das Resize-Eck */
    width: 60vw;
    min-height: 200px;
    max-height: 600px;
    display: inline-block;
    box-sizing: border-box;
    position: relative;
}

.codemirror-wrapper .CodeMirror {
    width: 100% !important;
    height: 100% !important;
}


/* verhindert, dass CodeMirror breiter als der Container wird */
.CodeMirror-scroll {
    overflow-x: auto !important; /* horizontales Scrollen erlauben */
    overflow-y: auto !important;
    max-width: 100% !important;
}


/* noop gets grey text */
.CodeMirror .ab-noop-line {
    background-color: rgba(128, 128, 128, 0.2);
}
/* jump gets a light blue background */
.CodeMirror .ab-jump-line { background-color: rgba(0, 128, 255, 0.12); }
/*  stop gets a bottom-border */
.CodeMirror .ab-stop-line {
    border-bottom: 2px solid rgba(255, 0, 0, 0.5);
    margin-bottom: -1px;
}
/* output gets a light green background */
.CodeMirror .ab-output-line { background-color: rgba(0, 255, 0, 0.12); }





:root {
    --ab-fg: #3b2b14;
    --ab-muted: #6d5c38;
    --ab-bg: #f5eed6;
    --ab-border: rgba(0,0,0,0.15);
}

/* Grid */
.ab-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(320px,1fr));
    gap: 16px;
    align-items: start;
}

/* Karten */
.adventurebook-character-card {
    position: relative;
    border: 1px solid var(--ab-border);
    border-radius: 14px;
    padding: 8px;
    color: var(--ab-fg);
    background: linear-gradient(180deg,var(--ab-bg),#e8dec2 80%);
    box-shadow: 0 2px 5px rgba(0,0,0,.15);
    transition: box-shadow .2s,transform .2s;
    align-self: start;
}
.adventurebook-character-card:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,.2);
    transform: translateY(-1px);
}

/* Header */
.ab-char-name{margin:0;font-size:1.2rem;font-weight:700}
.ab-book-title{font-size:.9rem;color:var(--ab-muted)}

/* Badge */
.ab-current-badge{
    position:absolute;top:8px;right:10px;
    background:linear-gradient(180deg,#b5cda3,#97b783);
    color:#1e3614;font-size:.7rem;font-weight:700;
    padding:2px 6px;border-radius:6px;text-transform:uppercase;
    letter-spacing:.5px;box-shadow:0 1px 2px rgba(0,0,0,.2);
    pointer-events:none
}

/* Info & Health */
.ab-info-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:6px}
.ab-info{font-size:.9rem;color:var(--ab-fg)}
.ab-health{margin-top:6px}
.ab-health-bar{height:10px;border:1px solid var(--ab-border);border-radius:6px;overflow:hidden;background:#dfd8be}
.ab-health-fill{height:100%;background:linear-gradient(90deg,#aa2222,#ff0000);transition:width .3s}
.ab-health-text{margin-top:3px;font-size:.85rem;color:#5b4b2d}

/* Chips */
.ab-chip-row{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.ab-chip{background:#e9e2ca;border:1px solid rgba(0,0,0,.1);border-radius:10px;padding:2px 8px;font-size:.8rem;color:#4b3d26}

/* Sections */
.ab-section>summary{
    position:relative;cursor:pointer;
    padding:6px 10px 6px 28px;
    background:#ede6cf;border-radius:8px;font-weight:600;color:var(--ab-fg);
    list-style:none;user-select:none
}
.ab-section>summary::-webkit-details-marker,
.ab-section>summary::marker{display:none}
.ab-section>summary::before{
    content:"▶";position:absolute;left:10px;top:50%;
    transform:translateY(-50%);font-size:.8em;width:12px;text-align:center;
    transition:transform .2s;color:var(--ab-muted)
}
.ab-section[open]>summary::before{transform:translateY(-50%) rotate(90deg)}
.ab-stats-dl,.ab-skill-list,.ab-slots ul,.ab-inventory ul{
    padding:8px 10px;color:var(--ab-fg);list-style:none
}
.ab-stats-dl{display:grid;grid-template-columns:1fr 1fr;gap:4px 10px}
.ab-stat-row>dt{font-weight:600;color:#5b4b2d}
.ab-stat-row>dd{margin:0}

/* Skills, Inventory, Slots */
.ab-skill-item,
.ab-slots li,
.ab-inventory li{
    display:flex;justify-content:space-between;
    background:#f4efdc;border:1px solid rgba(0,0,0,.05);
    border-radius:6px;padding:4px 8px
}
.ab-slots img,.ab-inventory img{width:24px;height:24px;image-rendering:pixelated}

/* Buttons */
.ab-card-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.ab-btn{
    display:inline-flex;align-items:center;justify-content:center;
    font-size:.85rem;font-weight:600;line-height:1;padding:4px 8px;
    white-space:nowrap;border-radius:5px;border:1px solid rgba(0,0,0,.1);
    text-decoration:none;color:var(--ab-fg);
    background:#eee6c7;transition:background .15s,transform .1s
}
.ab-btn:hover{background:#f4edcf;transform:translateY(-1px)}
.ab-btn.ab-play{background:#d5e6f2;border-color:#b6cce0}
.ab-btn.ab-set{background:#dcefd8;border-color:#b8d6b2}
.ab-btn.ab-rename{background:#f8efc2;border-color:#e3d795}
.ab-btn.ab-delete{background:#f6d6d6;border-color:#e0b2b2}

/* Gruppierung */
.ab-adventurebook-group{
    margin-bottom:40px;padding:10px;
    background:rgba(250,248,240,.7);
    border:1px solid rgba(0,0,0,.05);border-radius:12px
}
.ab-group-title{
    font-family:"Cinzel Decorative",serif;
    font-size:1.4rem;font-weight:700;color:#4a3b21;
    margin:0 0 12px;padding:4px 10px;
    border-bottom:1px solid rgba(0,0,0,.1);
    background:linear-gradient(180deg,#f3edd8,#eae0bc);
    border-radius:8px
}

/* ==== bündige Sections ====
   Alle Unterbereiche (Stats, Skills, Inventory usw.)
   sollen sich an den normalen Inhalt ausrichten. */

.ab-section > summary {
    padding: 6px 8px 6px 20px; /* vorher 6px 10px 6px 28px */
}

.ab-stats-dl,
.ab-skill-list,
.ab-slots ul,
.ab-inventory ul {
    padding: 6px 8px; /* vorher 8px 10px */
}

.ab-skill-list {
    margin: 0;
}

.ab-skill-item,
.ab-slots li,
.ab-inventory li {
    padding: 4px 6px; /* etwas schmaler, bündig mit Text */
}

/* optional: kleine Anpassung für das Dreieck-Icon,
   damit es trotz geringeren Paddings sauber sitzt */
.ab-section > summary::before {
    left: 6px;  /* vorher 10px */
}

