body.app-body {
    overflow: auto !important;
    height: auto !important;
    min-height: 100vh;
}

.app-shell {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.app-shell.lore-collapsed,
.app-shell.split-choice {
    grid-template-columns: 1fr;
}

.app-shell.split-choice .lore-panel,
.app-shell.split-choice .lore-toggle {
    display: none;
}

.app-shell.sheet-lore {
    grid-template-columns: 60% 40%;
}

.app-shell.sheet-lore .lore-toggle {
    display: none;
}

.app-shell.sheet-lore .lore-panel {
    display: flex;
    position: sticky;
    top: 0;
    height: 100vh;
}

.app-shell.sheet-lore .character-container {
    max-width: none;
    width: 100%;
}

.app-main {
    padding: 1.25rem 1.5rem 5rem;
    min-width: 0;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.app-brand {
    color: #bba06f;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-shadow: 0 0 8px rgba(187, 160, 111, 0.35);
}

.stepper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1.5rem;
}

.stepper-item {
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(74, 158, 255, 0.2);
    background: rgba(10, 10, 26, 0.55);
    color: #9aa0b3;
    font-size: 0.78rem;
    font-weight: 600;
}

.stepper-item.is-current {
    color: #fff;
    border-color: rgba(187, 160, 111, 0.65);
    background: rgba(187, 160, 111, 0.18);
}

.stepper-item.is-done {
    color: #bba06f;
    border-color: rgba(187, 160, 111, 0.35);
}

.step-panel h1,
.lore-doc h1,
.admin-editor-title {
    color: #bba06f;
    font-size: 1.8rem;
    margin-bottom: 0.4rem;
    text-shadow: 0 0 10px rgba(187, 160, 111, 0.4);
}

.step-lead {
    color: #b8b8b8;
    margin-bottom: 1.4rem;
    line-height: 1.5;
}

.choice-picker {
    display: grid;
    grid-template-columns: 25% 75%;
    gap: 1.15rem;
    align-items: start;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    min-width: 0;
}

.choice-card {
    position: relative;
    min-height: 0;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(74, 158, 255, 0.2);
    background: rgba(10, 10, 26, 0.65);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.choice-card:hover,
.choice-card.is-selected {
    transform: translateY(-3px);
    border-color: rgba(187, 160, 111, 0.65);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.choice-card img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    display: block;
}

.choice-lore {
    min-height: calc(100vh - 10rem);
    background: rgba(6, 8, 18, 0.78);
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 16px;
    overflow: hidden;
}

.choice-lore .lore-doc {
    max-height: calc(100vh - 10rem);
    overflow: auto;
    padding: 1.4rem 1.6rem 2rem;
}

.lore-highlight {
    outline: 1px solid rgba(187, 160, 111, 0.7);
    background: rgba(187, 160, 111, 0.12);
    border-radius: 4px;
}

.choice-card-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.9rem 1rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
}

.choice-card-name {
    color: #bba06f;
    font-weight: 700;
    font-size: 1.05rem;
}

.choice-detail {
    position: sticky;
    top: 1rem;
    margin-top: 0;
    padding: 1.15rem 1.25rem;
    background: rgba(10, 10, 26, 0.78);
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 14px;
    color: #e6e6e6;
    line-height: 1.65;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
}

.choice-detail h3 {
    color: #bba06f;
    margin-bottom: 0.55rem;
    font-size: 1.2rem;
}

.choice-detail p {
    white-space: pre-wrap;
    word-break: break-word;
}

.choice-detail-empty {
    color: #9aa0b3;
    margin: 0;
}

.gender-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    max-width: 640px;
}

.gender-card {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    border-radius: 16px;
    border: 1px solid rgba(74, 158, 255, 0.25);
    background: rgba(10, 10, 26, 0.65);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.gender-card:hover {
    transform: translateY(-3px);
    border-color: rgba(187, 160, 111, 0.65);
}

.gender-card-icon {
    font-size: 4.5rem;
    color: #bba06f;
}

.form-card {
    max-width: 620px;
    background: rgba(10, 10, 26, 0.7);
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 18px;
    padding: 1.5rem;
}

.form-card label {
    display: block;
    color: rgba(187, 160, 111, 0.9);
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.form-card input,
.form-card textarea,
.form-card select {
    width: 100%;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(74, 158, 255, 0.25);
    border-radius: 10px;
    color: #fff;
    font: inherit;
}

.recap-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.recap-item {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(74, 158, 255, 0.15);
    border-radius: 10px;
    padding: 0.75rem;
}

.recap-item span {
    display: block;
    color: #8d93a6;
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
}

.image-drop {
    border: 1px dashed rgba(187, 160, 111, 0.45);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    color: #b8b8b8;
    margin-bottom: 1rem;
    cursor: pointer;
}

.image-drop img {
    max-width: 100%;
    max-height: 220px;
    border-radius: 8px;
    margin-top: 0.6rem;
}

.app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 1.2rem;
    border-radius: 10px;
    border: 1px solid rgba(74, 158, 255, 0.4);
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.22), rgba(74, 158, 255, 0.06));
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

.app-btn.gold {
    border-color: rgba(187, 160, 111, 0.55);
    background: linear-gradient(135deg, rgba(187, 160, 111, 0.28), rgba(187, 160, 111, 0.08));
    color: #f3e6c4;
}

.lore-panel {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: rgba(6, 8, 18, 0.88);
    border-left: 1px solid rgba(74, 158, 255, 0.2);
    backdrop-filter: blur(14px);
}

.app-shell.lore-collapsed .lore-panel {
    display: none;
}

.lore-panel-head {
    padding: 1rem 1rem 0.7rem;
    border-bottom: 1px solid rgba(74, 158, 255, 0.15);
    flex-shrink: 0;
}

.lore-panel-head h2 {
    color: #bba06f;
    font-size: 1.1rem;
    margin-bottom: 0.7rem;
}

.lore-panel-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.lore-menu-scroll {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.lore-menu-arrow {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    border: 1px solid rgba(187, 160, 111, 0.5);
    background: linear-gradient(180deg, rgba(187, 160, 111, 0.22), rgba(74, 158, 255, 0.12));
    color: #bba06f;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 0 0.1rem;
    box-shadow: 0 0 10px rgba(187, 160, 111, 0.15);
}

.lore-menu-scroll.is-overflow .lore-menu-arrow {
    display: inline-flex;
}

.lore-menu-arrow:hover:not(.is-disabled) {
    color: #fff;
    border-color: rgba(74, 158, 255, 0.7);
    background: linear-gradient(180deg, rgba(187, 160, 111, 0.38), rgba(74, 158, 255, 0.28));
}

.lore-menu-arrow.is-disabled {
    opacity: 0.28;
    cursor: default;
    box-shadow: none;
}

.lore-menu-scroll .lore-menu {
    flex: 1;
    min-width: 0;
}

.lore-nav,
.lore-menu {
    scrollbar-width: none;
}

.lore-nav::-webkit-scrollbar,
.lore-menu::-webkit-scrollbar {
    display: none;
    height: 0;
}

.lore-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.3rem;
    overflow-x: auto;
    overflow-y: hidden;
    min-width: 0;
    flex: 1;
    padding: 0.15rem 0;
}

.lore-nav a,
.lore-nav button {
    display: inline-flex;
    width: auto;
    text-align: left;
    background: none;
    border: 1px solid transparent;
    color: #d5d5d5;
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.lore-nav a:hover,
.lore-nav button:hover,
.lore-nav .is-active {
    background: rgba(187, 160, 111, 0.16);
    color: #bba06f;
}

.lore-doc,
.lore-content-area {
    scrollbar-width: thin;
    scrollbar-color: rgba(187, 160, 111, 0.85) rgba(8, 10, 20, 0.95);
}

.lore-doc::-webkit-scrollbar,
.lore-content-area::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.lore-doc::-webkit-scrollbar-track,
.lore-content-area::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(74, 158, 255, 0.16);
}

.lore-doc::-webkit-scrollbar-thumb,
.lore-content-area::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #bba06f, #4a9eff);
    border-radius: 999px;
    border: 1px solid rgba(10, 10, 26, 0.45);
}

.lore-doc::-webkit-scrollbar-thumb:hover,
.lore-content-area::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #d4bc88, #6eb3ff);
}

.lore-doc::-webkit-scrollbar-corner,
.lore-content-area::-webkit-scrollbar-corner {
    background: transparent;
}

.lore-doc {
    overflow: auto;
    padding: 1rem 1.1rem 2rem;
    color: #e8e8e8;
    line-height: 1.65;
}

.lore-doc h1,
.lore-doc h2,
.lore-doc h3,
.lore-doc h4 {
    color: #bba06f;
    margin: 1.1rem 0 0.5rem;
}

.lore-doc img,
.lore-body img {
    max-width: 100%;
    border-radius: 10px;
    margin: 0.8rem 0;
    border: 1px solid rgba(74, 158, 255, 0.2);
}

.lore-doc img.is-zoomable,
.lore-body img.is-zoomable {
    cursor: zoom-in;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.lore-doc img.is-zoomable:hover,
.lore-body img.is-zoomable:hover {
    border-color: rgba(187, 160, 111, 0.65);
    box-shadow: 0 0 18px rgba(187, 160, 111, 0.25);
}

.lore-lightbox {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
}

.lore-lightbox[hidden] {
    display: none;
}

.lore-lightbox img {
    max-width: min(96vw, 1600px);
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid rgba(187, 160, 111, 0.35);
    box-shadow: 0 0 40px rgba(74, 158, 255, 0.18);
    cursor: zoom-in;
    transform-origin: center center;
    transition: transform 0.2s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.lore-lightbox img.is-zoomed {
    cursor: grab;
    transition: none;
}

.lore-lightbox img.is-dragging {
    cursor: grabbing;
}

.lore-lightbox-hint {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    margin: 0;
    color: rgba(187, 160, 111, 0.85);
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    pointer-events: none;
}

.lore-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    border: 1px solid rgba(187, 160, 111, 0.55);
    background: rgba(10, 10, 26, 0.85);
    color: #bba06f;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.lore-lightbox-close:hover {
    color: #fff;
    border-color: #4a9eff;
    background: rgba(74, 158, 255, 0.25);
}

body.lore-lightbox-open {
    overflow: hidden;
}

.lore-doc p {
    margin-bottom: 0.8rem;
}

.admin-lore-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1rem;
    min-height: 70vh;
}

.admin-page-list {
    background: rgba(10, 10, 26, 0.55);
    border: 1px solid rgba(74, 158, 255, 0.15);
    border-radius: 14px;
    padding: 0.75rem;
}

.admin-page-list button {
    width: 100%;
    text-align: left;
    margin-bottom: 0.4rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    cursor: pointer;
}

.admin-page-list button.is-active {
    border-color: rgba(187, 160, 111, 0.5);
    background: rgba(187, 160, 111, 0.14);
    color: #bba06f;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.editor-toolbar button {
    padding: 0.4rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(74, 158, 255, 0.3);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    cursor: pointer;
    font-size: 0.8rem;
}

.lore-editor {
    min-height: 420px;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(74, 158, 255, 0.25);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    outline: none;
}

.lore-editor:focus {
    border-color: rgba(187, 160, 111, 0.5);
}

@media (max-width: 980px) {
    .app-shell,
    .app-shell.lore-collapsed {
        grid-template-columns: 1fr;
    }

    .lore-panel {
        position: fixed;
        inset: 0;
        z-index: 11000;
        height: 100vh;
        display: none;
    }

    .app-shell.lore-open .lore-panel,
    .app-shell.sheet-lore .lore-panel {
        display: flex;
        position: relative;
        height: auto;
        min-height: 70vh;
    }

    .lore-panel-body {
        display: flex;
        flex-direction: column;
    }

    .admin-lore-layout,
    .gender-grid,
    .recap-grid,
    .choice-picker,
    .app-shell.sheet-lore {
        grid-template-columns: 1fr;
    }

    .choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .choice-lore .lore-panel-body {
        grid-template-columns: 1fr;
    }

    .choice-detail {
        position: static;
        max-height: 240px;
    }
}
