@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,400;0,700;1,300&family=JetBrains+Mono:wght@300;400;700&display=swap');

:root {
    --bg: #0f1724;
    /* dark navy */
    --card: #0f1724;
    /* same as bg for seamless look */
    --muted: #9aa4b2;
    --text: #e6eef6;
    --accent: #7dd3fc;
    /* cyan-ish */
    --accent-2: #60a5fa;
    /* blue */
    --glass: rgba(255, 255, 255, 0.04);
}

/* Elegant serif + monospaced 'geeky' fonts */
/* Base */
* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: 'Merriweather', Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 32px;
    /* leave room at bottom for the fixed input */
    padding-bottom: 200px;
}

/* App layout */
.container#previous {
    max-width: 900px;
    margin: 0 auto 18px auto;
    display: flex;
    flex-direction: column;
    /* newest at bottom (just above the form) */
    gap: 12px;
    /* leave extra padding so items aren't covered by fixed form */
    padding-bottom: 120px;
}

.question,
.response,
.response .previoustext {
    max-width: 900px;
}

.question {
    /* Keep your existing visual styles (background, border, etc.) */
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.06), rgba(96, 165, 250, 0.04));
    border: 1px solid rgba(125, 211, 252, 0.08);
    padding: 16px 20px;
    border-radius: 12px;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.45;
    box-shadow: 0 6px 20px rgba(2, 6, 23, 0.6);
    margin-bottom: 6px;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.2px;
    overflow-wrap: break-word;
    word-wrap: break-word;

    /* --- NEW ALIGNMENT CODE --- */
    align-self: flex-start;
    /* Aligns the box to the left flex start */
    margin-left: 0;
    /* Ensures it sticks to the left */
    margin-right: auto;
    /* Pushes against the right */
    max-width: 85%;
    /* Reduces width so you can see the alignment */
    border-top-left-radius: 2px;
    /* Optional: adds a "chat bubble" corner */
    margin-bottom: 20px;
    /* Equalized spacing */
}

.response {
    /* Keep your existing visual styles */
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--accent-2);
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.03);

    /* --- NEW ALIGNMENT CODE --- */
    align-self: flex-end;
    /* Aligns the box to the right flex end */
    margin-left: auto;
    /* Pushes against the left */
    margin-right: 0;
    /* Ensures it sticks to the right */
    max-width: 85%;
    /* Reduces width so you can see the alignment */
    overflow-wrap: break-word;
    word-wrap: break-word;
    text-align: right;
    /* Aligns the text inside to the right */
    border-bottom-right-radius: 2px;
    /* Optional: adds a "chat bubble" corner */
    margin-bottom: 20px;
    /* Equalized spacing */
}

.response div {
    color: var(--muted);
    font-weight: 500
}

/* form area */
form#responseform {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 18px;
    z-index: 1200;
    width: calc(100% - 64px);
    max-width: 900px;
    height: 42px;
    margin: 0 auto;
    display: flex;
    gap: 0;
    align-items: center;
    padding: 4px 4px 4px 4px;
    box-sizing: border-box;
    overflow: hidden;
    background: linear-gradient(180deg, rgb(20, 40, 62), rgba(10, 30, 52, 1));
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-shadow: 0 8px 30px rgba(2, 6, 23, 0.6);
    transition: width 0.5s ease, left 0.5s ease, transform 0.5s ease;
}

form#responseform.shifted-form {
    width: calc(50% - 64px);
    left: 25%;
    transform: translateX(-50%);
}

input#response {
    flex: 1;
    height: 100%;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--text);
    padding: 6px 8px;
    font-size: 1rem;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, 'Courier New', monospace;
}

input#response::placeholder {
    color: var(--muted)
}

button[type=submit] {
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    color: #03203a;
    border: none;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
}

button[type=submit]:active {
    transform: translateY(1px)
}

/* spacing helper */
.spacer {
    height: 1em
}

/* Outline buttons (match app look) */
.outline {
    -webkit-appearance: none;
    appearance: none;
    display: inline;
    text-align: left;
    padding: 0 4px;
    margin: 2px 4px;
    background: transparent;
    border: none;
    color: var(--muted);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.98rem;
    cursor: pointer;
    text-decoration: none;
}

.outline:hover {
    color: var(--accent);
    text-decoration: underline;
}

.outline:active {
    opacity: 0.9
}

.outline:focus {
    outline: 2px solid rgba(125, 211, 252, 0.12);
    outline-offset: 2px;
}

:link {
    color: rgb(99, 99, 255)
}

:visited {
    color: rgb(208, 15, 208)
}

.lab {
    background-color: rgb(0, 57, 119);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(2, 6, 23, 0.4);
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.2px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    margin-left: 0;
    margin-right: auto;
    max-width: 85%;
    color: #ffffff;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 8px;
}

/* small screens */
@media (max-width:600px) {
    body {
        padding: 18px
    }

    .question,
    .response,
    form#responseform {
        padding: 12px
    }

    /* --- MOBILE LAB LAYOUT (VERTICAL STACK) --- */

    /* Override default transition to animate height instead of width */
    .lab-container {
        width: 100% !important;
        height: 0 !important;
        top: 0;
        left: 0;
        right: auto;
        bottom: auto;
        transition: height 0.5s ease, padding 0.5s ease !important;
        overflow-y: hidden;
        padding: 0 !important;
        /* Hide padding when closed */
        border-bottom: none;
        z-index: 1000;
        /* Ensure it sits on top of chat */
    }

    .lab-container.visible {
        height: 50vh !important;
        padding: 15px !important;
        /* Restore padding */
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 5px 25px rgba(0, 0, 0, 0.4);
        overflow-y: auto;
    }

    /* Chat container slides down */
    .chat-container {
        transition: margin-top 0.5s ease !important;
    }

    .chat-container.shifted {
        width: 100% !important;
        margin-top: 50vh;
        /* Ensure we still have full height available roughly, 
           or allow body scroll to handle it. 
           With margin-top, it pushes content down. */
    }

    /* Ensure form stays centered and full width at bottom */
    form#responseform.shifted-form {
        width: calc(100% - 36px) !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}

/* accessibility focus */
button:focus,
input:focus {
    box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.12);
    border-radius: 8px
}

/* utility to ensure scrolled-to element isn't obscured */
[id] {
    scroll-margin-bottom: 140px
}

/* Print styles: remove app styling but preserve previous-user-input color */
@media print {

    /* Reset our custom layout and visual styles to defaults */
    body,
    .container#previous,
    .question,
    .response,
    form#responseform,
    input#response,
    button,
    .spacer,
    .outline,
    .lab {
        all: initial !important;
        display: block !important;
    }

    /* Ensure a white page background and readable text color */
    body {
        background: #fff !important;
        color: #000 !important;
    }

    /* Hide interactive form controls, but allow buttons to be visible as text */
    form#responseform,
    input,
    button[type=submit] {
        display: none !important;
    }

    /* Style buttons to appear as plain text */
    .lab,
    .outline,
    button {
        background: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        color: #000 !important;
        text-decoration: none !important;
        font-size: inherit !important;
        font-family: inherit !important;
        font-weight: normal !important;
        display: inline !important;
        /* Display them inline with text */
    }

    /* Preserve the color styling for previous user inputs only */
    .response {
        color: red !important;
        font-weight: 600 !important;
    }

    .response div {
        color: red !important;
        font-weight: 500 !important;
    }

    /* Make questions and responses plain blocks with default font sizing */
    .question,
    .response {
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 0 8px 0 !important;
        font-size: 12pt !important;
        color: inherit !important;
    }

    /* Avoid breaking individual items across pages */
    .question,
    .response {
        page-break-inside: avoid;
    }
}

.chat-container {
    width: 100%;
    transition: width 0.5s ease;
}

.chat-container.shifted {
    width: 50%;
}

.lab-container {
    position: fixed;
    top: 0;
    right: 0;
    width: 0;
    height: 100%;
    background-color: var(--bg);
    transition: width 0.5s ease;
    padding: 30px;
    box-sizing: border-box;
    overflow-y: auto;
    display: none;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.4);
}

.lab-container.visible {
    width: 50%;
    display: block;
}

.lab-table {
    width: 100%;
    min-height: 55%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    margin-bottom: 30px;
    padding: 30px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    position: relative;
}

@media (max-width: 1200px) {
    .lab-table {
        flex-direction: column;
        align-items: center;
        overflow-x: hidden;
    }

    .lab-item.flask {
        margin-right: 0;
        margin-bottom: 30px;
    }

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

.lab-item.flask {
    flex: 0 0 auto;
}

/* Container for beakers to keep them grouped */
.beakers-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    /* Center beakers in their group */
    gap: 30px;
    flex: 1;
}

.lab-item.beaker {
    flex: 0 1 auto;
}

/* Subtle reflection on the bench */
.lab-table::after {
    content: "";
    position: absolute;
    top: 5%;
    left: 5%;
    width: 90%;
    height: 20%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent);
    pointer-events: none;
    border-radius: 10px;
}

.toolbox {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 30px;
    /* Equalized */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
    /* Equalized */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.lab-item {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 18px;
    border-radius: 8px;
    background: #1e293b;
    /* Medium dark blue */
    cursor: pointer;
    text-align: center;
    color: #ffffff;
    /* White text */
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    flex: 0 1 auto;
}

.lab-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    background-color: #2d3748;
    border-color: var(--accent);
}

.lab-item:active {
    transform: translateY(0);
}

.lab-item img {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 110px;
    margin-bottom: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.lab-item.beaker,
.lab-item.flask {
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 120px;
    /* Fixed width */
    max-width: 120px;
    color: #ffffff;
    /* Ensure white text */
    word-wrap: break-word;
    /* Wrap long text */
}

.lab-item.flask {
    cursor: default;
    /* Not clickable */
    width: 240px;
    /* Fixed width */
    max-width: 240px;
    min-width: 240px;
    /* Doubled from 120px */
    margin-top: 50px;
}

.lab-item.flask img {
    max-height: 220px;
    /* Doubled from 110px */
}

.lab-item.beaker:hover {
    transform: scale(1.05);
    background: transparent;
}

.lab-item.flask:hover {
    transform: none;
    /* No scaling on hover for flask */
}

/* Solid Block Styling in Toolbox */
.lab-item.solid-block {
    width: 100px;
    height: 60px;
    /* Shorter for a pile */
    display: inline-block;
    border: none;
    /* Powders don't include containers usually */
    border-radius: 0;
    clip-path: polygon(5% 100%,
            10% 85%, 18% 80%, 25% 70%, 32% 65%,
            40% 55%, 50% 50%, 60% 55%, 68% 65%,
            75% 70%, 82% 80%, 90% 85%,
            95% 100%);
    margin-top: 50px;
    /* Push down to align bottom with beakers roughly */
    margin-bottom: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.lab-item.solid-block:hover {
    transform: scale(1.05);
    border-color: var(--accent);
}


.lab-item.beaker img,
.lab-item.flask img {
    opacity: 0.4;
    pointer-events: none;
    filter: invert(1) brightness(2);
    transition: filter 0s, opacity 0.3s ease;
    /* Ensure filter doesn't lag or change */
}

/* Glass glow effect for active reactions */
@keyframes glass-glow {
    0% {
        filter: invert(1) brightness(2) drop-shadow(0 0 5px rgba(125, 211, 252, 0.2));
    }

    50% {
        filter: invert(1) brightness(2) drop-shadow(0 0 15px rgba(125, 211, 252, 0.5));
    }

    100% {
        filter: invert(1) brightness(2) drop-shadow(0 0 5px rgba(125, 211, 252, 0.2));
    }
}

.flask-active img {
    animation: glass-glow 2s infinite;
}

.beaker-label {
    font-weight: bold;
    color: var(--text);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-top: 5px;
}


#reaction-info-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 30px;
    /* Equalized */
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-top: 30px;
    /* Equalized */
    display: flex;
    flex-direction: column;
    align-items: center;
}

#temp-display,
#ph-display,
#reaction-name-display {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    display: inline-block;
    margin: 5px;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#temp-display:empty,
#ph-display:empty,
#reaction-name-display:empty {
    display: none;
}

/* HP Stat Block */
#ui-top-left {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 2000;
    display: flex;
    gap: 15px;
    align-items: center;
}

#hp-container {
    position: static;
    background: rgba(15, 23, 36, 0.85);
    /* Matches --bg with opacity */
    border: 1px solid rgba(125, 211, 252, 0.2);
    /* Matches --accent with low opacity */
    padding: 10px 16px;
    border-radius: 8px;
    color: #e6eef6;
    /* Matches --text */
    font-family: 'JetBrains Mono', monospace;
    font-weight: bold;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

#hp-container:hover {
    border-color: rgba(125, 211, 252, 0.5);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.falling-heart {
    position: fixed;
    pointer-events: none;
    z-index: 2001;
    font-size: 1.2rem;
    animation: fall-and-fade 1.5s ease-out forwards;
}

@keyframes fall-and-fade {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(100px) scale(0.5);
        opacity: 0;
    }
}

/* Inventory System Styles */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

#inventory-sidebar {
    position: fixed;
    top: 80px;
    left: 20px;
    width: 200px;
    background: rgba(15, 23, 36, 0.85);
    border: 1px solid rgba(125, 211, 252, 0.2);
    border-radius: 8px;
    padding: 15px;
    color: var(--text);
    z-index: 100;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#inventory-sidebar h3,
#inventory-modal h3 {
    margin-top: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    margin-bottom: 10px;
    color: var(--accent);
}

.inventory-item-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.inventory-item-btn:hover {
    background: rgba(125, 211, 252, 0.1);
    border-color: var(--accent);
}

/* Dice Roll Notification */
.dice-roll-notification {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 36, 0.95));
    border: 1px solid var(--accent);
    color: var(--text);
    padding: 15px 20px;
    border-radius: 8px;
    margin: 10px 0;
    font-family: 'JetBrains Mono', monospace;
    box-shadow: 0 0 15px rgba(125, 211, 252, 0.15);
    animation: fadeIn 0.3s ease-out;
    max-width: 900px;
    /* Match question width */
    width: fit-content;
}

.dice-result {
    font-weight: bold;
    color: var(--accent);
    font-size: 1.2em;
}

.dice-detail {
    font-size: 0.9em;
    color: var(--muted);
    margin-top: 4px;
}

.dice-success {
    color: #4ade80;
    /* Green */
}

.dice-failure {
    color: #f87171;
    /* Red */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Specifics */
@media (max-width: 800px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }

    #inventory-trigger {
        position: static;
        z-index: 3001;
        background: rgba(15, 23, 36, 0.85);
        border: 1px solid rgba(125, 211, 252, 0.2);
        padding: 8px 14px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
        cursor: pointer;
        backdrop-filter: blur(5px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        color: #e6eef6;
        font-family: 'JetBrains Mono', monospace;
        font-weight: bold;
        gap: 8px;
    }

    #inventory-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        z-index: 3000;
        justify-content: center;
        align-items: center;
    }

    #inventory-modal.hidden {
        display: none !important;
    }

    .modal-content {
        background: var(--bg);
        border: 1px solid var(--accent);
        padding: 20px;
        border-radius: 12px;
        width: 90%;
        max-width: 400px;
        position: relative;
    }

    .close-modal {
        position: absolute;
        top: 10px;
        right: 15px;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--muted);
    }
}

/* Bubbles for Gas in Flask */
.bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.6);
    pointer-events: none;
    z-index: 2;
    animation: bubble-rise 4s infinite ease-in-out;
}

@keyframes bubble-rise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
        transform: translateY(-50px) scale(1.2);
    }

    100% {
        transform: translateY(-60px) scale(1.4);
        opacity: 0;
    }
}

@keyframes float-away {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 0.9;
    }

    100% {
        transform: translateY(-250px) scale(1.5);
        opacity: 0;
    }
}

@keyframes float-and-stay {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }

    20% {
        opacity: 0.9;
    }

    100% {
        transform: translateY(-20px) scale(1.2);
        opacity: 0.9;
    }
}

/* Measurement Bar Styles */
#measurement-container {
    transition: all 0.3s ease;
}

.measure-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text);
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

.measure-label {
    width: 100px;
    /* Fixed width for alignment */
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.measure-bar-bg {
    flex-grow: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.measure-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 4px;
    position: absolute;
    left: 0;
    top: 0;
    /* Transition controlled via JS for custom kinetics, but base smooth fallback */
    /* transition: width 0.1s linear; */
    box-shadow: 0 0 8px rgba(125, 211, 252, 0.4);
}

.measure-value {
    width: 180px;
    text-align: left;
    font-size: 0.8rem;
    color: var(--muted);
    flex-shrink: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reference Book Buttons */
.book-btn {
    background: #0a0f18; /* Slightly darker than --bg (#0f1724) */
    color: var(--accent);
    border: 1px solid rgba(125, 211, 252, 0.2);
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s ease;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
}

.book-btn:hover {
    background: #0f1724;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.book-btn:active {
    transform: translateY(1px);
}