/* thesecond.quest - RPG Bento Inventory */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --dark-earth: #1A1810;
    --warm-charcoal: #2A2820;
    --lit-charcoal: #3A3830;
    --treasure-gold: #C8A860;
    --nature-green: #68A848;
    --damage-red: #C84840;
    --text-primary: #E8E0D0;
    --text-body: #C0B8A8;
    --text-muted: #8A8278;
    --text-stat: #90A880;
}
body {
    background: var(--dark-earth);
    color: var(--text-primary);
    font-family: 'Saira', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.7;
    font-weight: 400;
    overflow-x: hidden;
}

/* Bento Grid */
.bento-grid {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

/* Bento Cells */
.bento-cell {
    background: var(--warm-charcoal);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    cursor: default;
}
.bento-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    background: var(--lit-charcoal);
}
.bento-cell[data-expandable] {
    cursor: pointer;
}

/* Cell Sizes */
.cell-title { grid-column: span 2; }
.cell-lg { grid-column: span 2; grid-row: span 2; }
.cell-md { grid-column: span 2; }
.cell-sm { grid-column: span 1; }

/* Grain Overlay */
.grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Status Dots */
.status-dot {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.status-dot.gold { background: var(--treasure-gold); }
.status-dot.green { background: var(--nature-green); }
.status-dot.red { background: var(--damage-red); }

/* Quest Title */
.quest-title {
    font-family: 'Saira', sans-serif;
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: 600;
    color: var(--treasure-gold);
    margin-bottom: 0.5rem;
}
.quest-meta {
    font-family: 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

/* Cell Content */
.cell-title-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}
h2.cell-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}
.cell-body {
    font-size: 0.9375rem;
    color: var(--text-body);
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

/* Log Entries */
.log-entry {
    border-top: 1px solid rgba(200,168,96,0.15);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}
.entry-num {
    font-family: 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    color: var(--treasure-gold);
    display: block;
    margin-bottom: 0.25rem;
}
.entry-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Stats */
.stat-label {
    font-family: 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}
.stat-value {
    font-family: 'Saira', sans-serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}
.stat-value.active { color: var(--treasure-gold); }
.stat-value.danger { color: var(--damage-red); }

/* Expanded Cell Overlay */
.cell-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,24,16,0.9);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.cell-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.cell-expanded {
    background: var(--warm-charcoal);
    max-width: 80vw;
    max-height: 80vh;
    padding: 3rem;
    overflow-y: auto;
    position: relative;
}
.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    font-family: 'Saira', sans-serif;
}

/* Section Animation */
.section {
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Footer */
#footer {
    text-align: center;
    padding: 2rem;
}
.footer-text {
    font-family: 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

/* Responsive */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 1rem;
    }
    .cell-lg { grid-column: span 2; grid-row: span 1; }
}
@media (max-width: 400px) {
    .bento-grid { grid-template-columns: 1fr; }
    .cell-title, .cell-lg, .cell-md { grid-column: span 1; }
}
