/* ============================================
   ENARGEIA — Dream Diary
   Magenta-red on black. Yume Nikki save menu.
   Spotlight grimoire on lectern.
   ============================================ */

/* --- Page Colors --- */

:root {
    --dd-black: #000000;
    --dd-void: #050102;
    --dd-crimson: #8b0a1a;
    --dd-red: #c41230;
    --dd-magenta: #d4145a;
    --dd-hot: #e81855;
    --dd-soft: #f0406a;
    --dd-blush: #f27a93;
    --dd-pale: #f5a0b0;
    --dd-ghost: #fce4ea;
    --dd-dust: #8a4050;
    --dd-page-bg: #0c0406;
    --dd-gold: #b8860b;
    --dd-gold-light: #d4a830;
}

/* --- .mingo border --- */

.mingo {
    border-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAYAAAAcaxDBAAACz0lEQVR4Xu2dS27DMAwFnfv2OL1viuwSCfBgQEqug9dVW+o7fKIo2U0fz+Pnebx9PY7fx/vPV39/u/HdbsD/3eEBWluDE78AXQy01vxxVGMwOZjsdvxje7b+WP7R3mAxxhEwslsg7fNvbzBAP9Mm6+FJ8gF6DtTGRLskbfnRgba+LU/96RgaoJ/IKETiphSgAXp6dF6+5ClGjAqlAZH92/ubvElAqvYAHdKgAD2/nYtCmwWjgVLiTwq2S/5u/QWoPNmRYAI0QM8TbTqIkMKqIQafH9FRiwZgL09owmSnGG3Ha8cfoJIwrYAADVD32Ht3yEKFSgceNAFaMhQDq/VtTLTzD1CZNhHgAA1Q96pQdwjarlDq8Nvt7Uv+24HR/AKUCEl7gEpgVByBUlBfndfRBKr27vkF6PDCMTmIDhYBGqCkIWdfvuTtfWP32dvh8KW75zfvIcNvujukmOOR1Gp0zy9Ai3/1QiHi8od0Nb352ssVajtYXd4jOq+xerxT+9s7bL4uIwdsn9/2DgP0UwOrHUCKs/bV453bX5w2XX3W5125dmE9poXLd/kAXZ6nOUXYJU4nt6qDKYREoXKT1ECth6seryqwWp9irJ1fru9yfVfV5HkaSK3TZU8Uuluh5LHYPwmgQgPMEQhQxwtLBygicgXagVJeR7sk5cHV+javdDhfn7nS/BWgAdoqqtbGXr6JQkGhBMgKnGIgXT6QnWKwHa+NuajQAB0T9/PrxwCVkqUVFqCrgdoYRTGLPPpt/S2/sQ/Q5mdKARqgp1GVQpRe8tQg2W3MpfbIvru/AL36U3FIEWTfrZjd/UWh3QqloyXt0lYB1fLV+nYFUX/TWT9A3atByAsLNL+qQh6/24qIQpvzbA1U3h3kc+xpyQeoI4Cfweyay39aCFD5bhMJbAJqd1nqoGqv5o3V/qn+NL7bDVimcQSkag/QKsGhfoAuBvoHGvsN0bEHDbwAAAAASUVORK5CYII=') 28 / 28px / 0 round;
    border-width: 28px;
    border-style: solid;
}

.entry-sprite.mingo-sm {
    border-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAYAAAAcaxDBAAACz0lEQVR4Xu2dS27DMAwFnfv2OL1viuwSCfBgQEqug9dVW+o7fKIo2U0fz+Pnebx9PY7fx/vPV39/u/HdbsD/3eEBWluDE78AXQy01vxxVGMwOZjsdvxje7b+WP7R3mAxxhEwslsg7fNvbzBAP9Mm6+FJ8gF6DtTGRLskbfnRgba+LU/96RgaoJ/IKETiphSgAXp6dF6+5ClGjAqlAZH92/ubvElAqvYAHdKgAD2/nYtCmwWjgVLiTwq2S/5u/QWoPNmRYAI0QM8TbTqIkMKqIQafH9FRiwZgL09owmSnGG3Ha8cfoJIwrYAADVD32Ht3yEKFSgceNAFaMhQDq/VtTLTzD1CZNhHgAA1Q96pQdwjarlDq8Nvt7Uv+24HR/AKUCEl7gEpgVByBUlBfndfRBKr27vkF6PDCMTmIDhYBGqCkIWdfvuTtfWP32dvh8KW75zfvIcNvujukmOOR1Gp0zy9Ai3/1QiHi8od0Nb352ssVajtYXd4jOq+xerxT+9s7bL4uIwdsn9/2DgP0UwOrHUCKs/bV453bX5w2XX3W5125dmE9poXLd/kAXZ6nOUXYJU4nt6qDKYREoXKT1ECth6seryqwWp9irJ1fru9yfVfV5HkaSK3TZU8Uuluh5LHYPwmgQgPMEQhQxwtLBygicgXagVJeR7sk5cHV+javdDhfn7nS/BWgAdoqqtbGXr6JQkGhBMgKnGIgXT6QnWKwHa+NuajQAB0T9/PrxwCVkqUVFqCrgdoYRTGLPPpt/S2/sQ/Q5mdKARqgp1GVQpRe8tQg2W3MpfbIvru/AL36U3FIEWTfrZjd/UWh3QqloyXt0lYB1fLV+nYFUX/TWT9A3atByAsLNL+qQh6/24qIQpvzbA1U3h3kc+xpyQeoI4Cfweyay39aCFD5bhMJbAJqd1nqoGqv5o3V/qn+NL7bDVimcQSkag/QKsGhfoAuBvoHGvsN0bEHDbwAAAAASUVORK5CYII=') 28 / 12px / 0 round;
    border-width: 12px;
    border-style: solid;
}
/* --- Layout --- */

.dream-diary-page {
    background: var(--dd-black);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.diary-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* --- Left Panel --- */

.diary-panel {
    width: 560px;
    min-width: 500px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 22px;
    gap: 10px;
    z-index: 10;
    position: relative;
}

.diary-header {
    text-align: center;
    padding: 10px 24px;
    background: rgba(5, 1, 2, 0.95);
    font-family: 'Sweet Dreams', cursive;
    font-size: 1.4rem;
    color: var(--dd-hot);
    letter-spacing: 0.05em;
    text-shadow: 0 0 10px rgba(228, 24, 85, 0.35);
    white-space: nowrap;
}

/* Entry list area */
.entry-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;            /* Firefox */
    -ms-overflow-style: none;         /* IE/Edge */
}

.entry-list::-webkit-scrollbar {
    display: none;                    /* Chrome/Safari */
}
/* --- Individual Entry Slot --- */

.entry-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px;
    background: rgba(5, 1, 2, 0.95);
    cursor: pointer;
    transition: background 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: visible;
}

.entry-slot:hover {
    background: rgba(196, 18, 48, 0.1);
    box-shadow: inset 0 0 24px rgba(196, 18, 48, 0.08);
}

.entry-slot.active {
    background: rgba(196, 18, 48, 0.18);
    box-shadow: inset 0 0 30px rgba(196, 18, 48, 0.14);
}

.entry-slot.focused {
    background: rgba(196, 18, 48, 0.1);
    box-shadow: inset 0 0 24px rgba(196, 18, 48, 0.08);
}

.entry-slot.focused .entry-title {
    color: var(--dd-hot);
}

.entry-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    overflow: visible;
}

.entry-title {
    font-family: 'Little-Monster', 'MedievalSharp', cursive;
    color: var(--dd-soft);
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-date {
    font-family: 'Cavalhatriz', cursive;
    font-size: 1.05rem;
    color: var(--dd-dust);
    display: block;
    line-height: 1.6;
    padding: 2px 0;
}

.entry-tags {
    font-family: 'kuchibue', 'Courier New', monospace;
    color: var(--dd-magenta);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entry-date {
    font-family: 'Cavalhatriz', 'Courier New', monospace;
    color: var(--dd-dust);
    font-size: 1rem;
    letter-spacing: 0.04em;
    line-height: 1.6;
    padding: 2px 0;
}

/* Sprite box — gets .mingo border via JS */
.entry-sprite {
    width: 66px;
    height: 88px;
    flex-shrink: 0;
    background: rgba(5, 1, 2, 0.95);
    border: 2px solid var(--dd-crimson);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    image-rendering: pixelated;
    overflow: visible;
}

.entry-sprite img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    image-rendering: pixelated;
}

/* --- Pixel Art Navigation Arrows --- */


.back-link {
    display: block;
    text-align: center;
    font-family: 'Little-Monster', 'MedievalSharp', cursive;
    font-size: 1rem;
    color: var(--dd-dust);
    text-decoration: none;
    padding: 6px 0;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--dd-soft);
}

/* --- Right Stage --- */

.diary-stage {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* --- Spotlight Scene --- */

.spotlight-scene {
    position: absolute;
    inset: 0;
    transition: opacity 0.6s;
}

.spotlight-scene.dimmed {
    opacity: 0.2;
}

.spotlight-beam {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    height: 70%;
    background: linear-gradient(
        180deg,
        rgba(252, 228, 234, 0.07) 0%,
        rgba(228, 24, 85, 0.035) 35%,
        rgba(196, 18, 48, 0.015) 65%,
        transparent 100%
    );
    clip-path: polygon(38% 0%, 62% 0%, 82% 100%, 18% 100%);
    pointer-events: none;
}

.spotlight-beam-inner {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    height: 65%;
    background: linear-gradient(
        180deg,
        rgba(252, 228, 234, 0.12) 0%,
        rgba(242, 122, 147, 0.05) 45%,
        transparent 100%
    );
    clip-path: polygon(40% 0%, 60% 0%, 74% 100%, 26% 100%);
    pointer-events: none;
}

.spotlight-pool {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    height: 60px;
    background: radial-gradient(
        ellipse at center,
        rgba(228, 24, 85, 0.07) 0%,
        rgba(196, 18, 48, 0.03) 45%,
        transparent 70%
    );
    border-radius: 50%;
    pointer-events: none;
}

/* --- Lectern + Grimoire --- */

.lectern-group {
    position: absolute;
    top: 42%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
}

/* Angled reading surface */
.lectern-top-surface {
    width: 140px;
    height: 90px;
    background: linear-gradient(
        180deg,
        #1a0a0e 0%,
        #120608 60%,
        #0a0304 100%
    );
    border: 1px solid rgba(196, 18, 48, 0.2);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    position: relative;
    transform: perspective(300px) rotateX(15deg);
    transform-origin: bottom center;
}

.lectern-top-surface::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(196, 18, 48, 0.08);
    pointer-events: none;
}

/* Grimoire sitting on the lectern */
.grimoire {
    width: 100px;
    height: 68px;
    position: relative;
}

.grimoire-cover {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        145deg,
        #1a0508 0%,
        #2a0a12 20%,
        #1a0508 50%,
        #120406 80%,
        #0a0204 100%
    );
    border: 2px solid var(--dd-crimson);
    border-radius: 3px 6px 6px 3px;
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.7),
        0 2px 8px rgba(139, 10, 26, 0.25),
        inset 0 0 16px rgba(139, 10, 26, 0.1);
}

.grimoire-border-outer {
    position: absolute;
    inset: 5px;
    border: 1px solid rgba(196, 18, 48, 0.2);
    border-radius: 2px;
}

.grimoire-border-inner {
    position: absolute;
    inset: 9px;
    border: 1px solid rgba(196, 18, 48, 0.1);
    border-radius: 1px;
}

.grimoire-symbol {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.3rem;
    color: var(--dd-red);
    opacity: 0.4;
    text-shadow: 0 0 8px rgba(196, 18, 48, 0.5);
    animation: symbolPulse 4s ease-in-out infinite;
}

@keyframes symbolPulse {
    0%, 100% { opacity: 0.25; text-shadow: 0 0 6px rgba(196, 18, 48, 0.3); }
    50% { opacity: 0.6; text-shadow: 0 0 14px rgba(196, 18, 48, 0.7); }
}

.grimoire-corner {
    position: absolute;
    width: 8px;
    height: 8px;
    border-color: rgba(184, 134, 11, 0.25);
    border-style: solid;
}

.grimoire-corner-tl { top: 3px; left: 3px; border-width: 1px 0 0 1px; }
.grimoire-corner-tr { top: 3px; right: 3px; border-width: 1px 1px 0 0; }
.grimoire-corner-bl { bottom: 3px; left: 3px; border-width: 0 0 1px 1px; }
.grimoire-corner-br { bottom: 3px; right: 3px; border-width: 0 1px 1px 0; }

.grimoire-spine {
    position: absolute;
    left: -3px;
    top: 3px;
    bottom: 3px;
    width: 6px;
    background: linear-gradient(90deg, #0a0204, #1a0508 40%, #0a0204);
    border-radius: 2px 0 0 2px;
    border-left: 1px solid rgba(139, 10, 26, 0.15);
}

.grimoire-pages-edge {
    position: absolute;
    left: -1px;
    top: 6px;
    bottom: 6px;
    width: 4px;
    background: repeating-linear-gradient(
        to bottom,
        #c8a88c 0px, #c8a88c 1.5px,
        #a8907a 1.5px, #a8907a 2.5px
    );
    border-radius: 1px 0 0 1px;
    opacity: 0.4;
}

.grimoire-clasp {
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 9px;
    height: 16px;
    background: linear-gradient(135deg, var(--dd-gold-light), var(--dd-gold));
    border-radius: 0 3px 3px 0;
    opacity: 0.45;
    box-shadow: 0 0 6px rgba(184, 134, 11, 0.2);
}

/* Lip/ledge */
.lectern-lip {
    width: 150px;
    height: 8px;
    background: linear-gradient(
        90deg,
        #050102,
        #1a0a0e 15%,
        #200c10 50%,
        #1a0a0e 85%,
        #050102
    );
    border-top: 1px solid rgba(196, 18, 48, 0.15);
    border-left: 1px solid rgba(139, 10, 26, 0.08);
    border-right: 1px solid rgba(139, 10, 26, 0.08);
}

/* Narrow piece connecting lip to stem */
.lectern-neck {
    width: 80px;
    height: 20px;
    background: linear-gradient(
        90deg,
        #050102 0%,
        #0a0304 20%,
        #120608 50%,
        #0a0304 80%,
        #050102 100%
    );
    border-left: 1px solid rgba(139, 10, 26, 0.06);
    border-right: 1px solid rgba(139, 10, 26, 0.06);
    clip-path: polygon(10% 0%, 90% 0%, 100% 100%, 0% 100%);
}

/* Stem that extends off the bottom forever */
.lectern-stem {
    width: 50px;
    height: 120vh;
    background: linear-gradient(
        90deg,
        #050102 0%,
        #0a0304 15%,
        #120608 30%,
        #1a0a0e 50%,
        #120608 70%,
        #0a0304 85%,
        #050102 100%
    );
    border-left: 1px solid rgba(139, 10, 26, 0.05);
    border-right: 1px solid rgba(139, 10, 26, 0.05);
    position: relative;
}

.lectern-stem::before {
    content: '';
    position: absolute;
    top: 0;
    left: -6px;
    right: -6px;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(139, 10, 26, 0.12) 25%,
        rgba(139, 10, 26, 0.18) 50%,
        rgba(139, 10, 26, 0.12) 75%,
        transparent
    );
}

/* --- Dust Motes --- */

.dust-mote {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(252, 228, 234, 0.3);
    pointer-events: none;
    animation: dustFloat linear infinite;
    box-shadow: 0 0 4px rgba(228, 24, 85, 0.15);
}

@keyframes dustFloat {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0;
    }
    10% { opacity: 0.5; }
    90% { opacity: 0.15; }
    100% {
        transform: translate(var(--dust-dx), var(--dust-dy)) scale(0.4);
        opacity: 0;
    }
}

/* ==============================
   OPEN BOOK — diary entry view
   Uses .mingo border
   ============================== */

.dream-book {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s;
    pointer-events: none;
}

.dream-book.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.book-inner {
    background: var(--dd-page-bg);
    width: 94%;
    max-width: 800px;
    height: 88%;
    max-height: 560px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.book-spread {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.book-page {
    flex: 1;
    padding: 24px 22px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

/* Scrollbar */
.book-page::-webkit-scrollbar { width: 5px; }
.book-page::-webkit-scrollbar-track { background: rgba(5, 1, 2, 0.4); }
.book-page::-webkit-scrollbar-thumb { background: var(--dd-crimson); border-radius: 3px; }
.book-page::-webkit-scrollbar-thumb:hover { background: var(--dd-red); }

.book-left {
    border-right: 1px solid rgba(196, 18, 48, 0.1);
}

.book-spine-center {
    width: 4px;
    flex-shrink: 0;
    background: linear-gradient(
        90deg,
        rgba(5, 1, 2, 0.5),
        rgba(26, 5, 8, 0.7) 50%,
        rgba(5, 1, 2, 0.5)
    );
}

/* Book typography */

.book-title {
    font-family: 'Sweet Dreams';
    font-size: 1.5rem;
    color: var(--dd-hot);
    margin-bottom: 8px;
    line-height: 1.3;
    text-shadow: 0 0 8px rgba(228, 24, 85, 0.2);
}

.book-meta {
    margin-bottom: 10px;
    overflow: visible;
}

.book-date {
    font-family: 'Cavalhatriz', 'Courier New', cursive;
    font-size: 0.95rem;
    color: var(--dd-dust);
    display: block;
    line-height: 2.4;
    min-height: 2em;
    padding: 6px 0;
    overflow: visible;
}

.book-symbols {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

.book-symbol-tag {
    font-family: 'kuchibue', 'Courier New', monospace;
    font-size: 0.95rem;
    color: var(--dd-gold-light);
    background: rgba(184, 134, 11, 0.08);
    border: 1px solid rgba(184, 134, 11, 0.15);
    padding: 3px 10px;
    border-radius: 2px;
}

.book-body {
    font-family: 'Little-Monster';
    font-size: 1.25rem;
    color: var(--dd-blush);
    line-height: 1.8;
}

.book-body p {
    margin-bottom: 1em;
}

.book-notes-label {
    font-family: 'Sweet Dreams';
    font-size: 1.30rem;
    color: var(--dd-magenta);
    margin-bottom: 14px;
    opacity: 0.85;
    text-shadow: 0 0 6px rgba(212, 20, 90, 0.2);
}

.book-notes {
    font-family: 'kuchibue', 'Courier New', monospace;
    font-size: 1.10rem;
    color: var(--dd-dust);
    line-height: 1.75;
}

.book-notes p {
    margin-bottom: 0.9rem;
}

.book-close {
    position: absolute;
    bottom: 6px;
    right: 14px;
    background: none;
    border: none;
    font-family: 'Little-Monster';
    font-size: 1rem;
    color: var(--dd-dust);
    cursor: pointer;
    padding: 8px 14px;
    transition: color 0.3s, text-shadow 0.3s;
}

.book-close:hover {
    color: var(--dd-hot);
    text-shadow: 0 0 8px rgba(228, 24, 85, 0.35);
}

/* --- Responsive --- */

@media (max-width: 900px) {
    .diary-layout {
        flex-direction: column;
    }

    .diary-panel {
        width: 100%;
        min-width: unset;
        max-height: 45vh;
    }

    .diary-stage {
        min-height: 55vh;
    }

    .book-spread {
        flex-direction: column;
    }

    .book-left {
        border-right: none;
        border-bottom: 1px solid rgba(196, 18, 48, 0.1);
    }

    .book-spine-center {
        width: 100%;
        height: 4px;
    }

    .book-inner {
        max-height: 92%;
    }
}