/* Field Notebook */
.notebook-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notebook-badge[hidden] { display: none; }

.notebook-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--entropy);
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.notebook-panel {
    position: fixed;
    top: 56px;
    right: 0;
    width: 340px;
    max-width: 90vw;
    /* the first case's card, docked on a phone, sets --first-case-dock-h so the notebook stops above it */
    height: calc(100vh - 56px - var(--first-case-dock-h, 0px));
    background: rgba(21, 25, 32, 0.96);
    border-left: 1px solid var(--border);
    backdrop-filter: blur(10px);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
    z-index: 90;
    transform: translateX(100%);
    transition: transform 0.35s ease;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
}

.notebook-panel.open {
    transform: translateX(0);
}

.notebook-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.notebook-header h4 {
    margin: 0;
    color: var(--accent);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.notebook-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.notebook-close:hover {
    color: var(--text);
    border-color: var(--accent);
}

.notebook-intro {
    font-size: 0.8rem;
    color: var(--muted);
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.notebook-entries {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.notebook-empty {
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
    margin-top: 2rem;
}

.notebook-entry {
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 0 8px 8px 0;
    padding: 0.75rem;
    font-size: 0.85rem;
    animation: slideIn 0.3s ease;
}

.notebook-entry.success {
    border-left-color: var(--success);
    background: rgba(105, 240, 174, 0.05);
}

.notebook-entry.warning {
    border-left-color: var(--warning);
    background: rgba(255, 179, 0, 0.05);
}

.notebook-entry.neutral {
    border-left-color: var(--muted);
}

.notebook-entry p {
    margin: 0;
    line-height: 1.5;
    color: var(--text);
}

.notebook-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.notebook-source {
    color: var(--accent);
    font-weight: 700;
}

.notebook-time {
    color: var(--muted);
}


/* Story intro modal */
.story-modal-root {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.story-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
}

.story-modal {
    position: relative;
    width: 100%;
    max-width: 720px;
    max-height: 92vh;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    animation: modalIn 0.35s ease;
    z-index: 1;
}

.story-scene {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: 0 0 30px rgba(0, 212, 240, 0.1);
}

.story-scene img {
    width: 100%;
    height: auto;
    display: block;
    image-rendering: pixelated;
}

.story-scene-glow {
    position: absolute;
    top: 28%;
    right: 17%;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 152, 0, 0.45) 0%, transparent 70%);
    animation: entropyAura 3s ease-in-out infinite;
    pointer-events: none;
}

.story-modal h2 {
    margin-top: 0;
    color: var(--accent);
    font-size: 1.5rem;
}

.story-modal .tagline {
    color: var(--muted);
    margin-bottom: 1rem;
    line-height: 1.45;
    font-size: 0.95rem;
}

.story-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.story-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}

.story-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}

.story-card .icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    image-rendering: pixelated;
    background-color: rgba(0, 212, 240, 0.12);
}

.story-card.entropy .icon { background-color: rgba(255, 152, 0, 0.12); }
.story-card.ray .icon { background-color: rgba(105, 240, 174, 0.12); }
.story-card.frame .icon { background-color: rgba(255, 82, 82, 0.12); }

.story-card h4 {
    margin: 0 0 0.35rem 0;
    color: var(--text);
    font-size: 0.95rem;
}

.story-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.story-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.start-here-ribbon {
    position: absolute;
    top: 12px;
    right: 12px;
    border-radius: 4px;
    text-align: center;
    background: var(--accent);
    color: #000;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.6rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 1;
    animation: badgePulse 2s infinite;
}

.scenario-card.start-here {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 212, 240, 0.25), var(--shadow);
    animation: cardGlow 2.5s infinite;
}

@keyframes cardGlow {
    0%, 100% { box-shadow: 0 0 0 2px rgba(0, 212, 240, 0.2), var(--shadow); }
    50% { box-shadow: 0 0 0 4px rgba(0, 212, 240, 0.4), var(--shadow); }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}


/* Lore unlock modal and gallery */
.lore-modal-root {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.lore-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
}

.lore-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: linear-gradient(145deg, #1a1f27, #13161c);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow), 0 0 40px rgba(0, 212, 240, 0.15);
    animation: cardPop 0.4s ease;
    z-index: 1;
    overflow: hidden;
}

.lore-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--entropy));
}

.lore-card .stamp {
    display: inline-block;
    background: rgba(0, 212, 240, 0.12);
    color: var(--accent);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.lore-card h3 {
    margin: 0 0 0.75rem 0;
    color: var(--accent);
    font-size: 1.35rem;
}

.lore-card p {
    color: var(--text);
    line-height: 1.55;
    margin: 0 0 1.25rem 0;
}

.lore-card .actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 2rem 1.5rem;
    background: linear-gradient(145deg, #1a1f27, #13161c);
    border-top: 1px dashed var(--border);
}

.lore-folder-tab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    background: linear-gradient(90deg, #232a36, #1a2029);
    border-bottom: 1px solid var(--border);
}

.lore-folder-tab .stamp {
    margin: 0;
    background: rgba(255, 152, 0, 0.15);
    color: var(--entropy);
}

.lore-id {
    font-size: 0.7rem;
    color: var(--muted);
    font-family: monospace;
    letter-spacing: 0.05em;
}

.lore-paper {
    position: relative;
    background: linear-gradient(135deg, #f4f1ea 0%, #e8e4db 100%);
    color: #1a1a1a;
    margin: 1.5rem 2rem;
    padding: 1.5rem;
    border-radius: 2px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.06);
    min-height: 160px;
}

.lore-paper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 28px;
    bottom: 0;
    width: 2px;
    background: rgba(255, 0, 0, 0.08);
}

.lore-paper h3 {
    color: #1a1a1a;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.3rem;
    margin: 0 0 0.75rem 0;
    position: relative;
    z-index: 1;
}

.lore-paper p {
    color: #2d2d2d;
    line-height: 1.6;
    margin: 0;
    position: relative;
    z-index: 1;
}

.lore-watermark {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    font-size: 2rem;
    font-weight: 900;
    color: rgba(139, 0, 0, 0.08);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transform: rotate(-12deg);
    pointer-events: none;
    user-select: none;
}

.lore-gallery {
    margin-top: 2rem;
}

.lore-gallery h2 {
    color: var(--accent);
    margin-bottom: 1rem;
}

.lore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

/* Hint modal */
.hint-modal-root {
    position: fixed;
    inset: 0;
    z-index: 2050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.hint-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.hint-modal {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--panel);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow), 0 0 24px rgba(0, 212, 240, 0.15);
    animation: cardPop 0.25s ease;
    z-index: 1;
}

.hint-modal h3 {
    margin-top: 0;
    color: var(--accent);
}

.hint-modal p {
    color: var(--text);
    line-height: 1.55;
    margin: 0 0 1.25rem 0;
}

.hint-actions {
    display: flex;
    justify-content: flex-end;
}


