/* ============================================
   Thematic Bitcoin Brand Styling
   Deep Charcoal Background, Orange Accents
   ============================================ */

:root {
    --bg-deep-charcoal: #0D0D0D;        /* Deep charcoal/black background */
    --btc-orange: #F7931A;              /* Bitcoin Orange accents */
    --text-muted-silver: #A0A0A0;       /* Muted silver for descriptions */
    --text-white: #E0E0E0;               /* Primary text color */
    --border-orange-glow: rgba(247, 147, 26, 0.2);  /* Orange glow at 20% opacity */
    --card-bg-dark: rgba(26, 26, 26, 0.8);  /* Semi-transparent dark for glassmorphism */
    --card-bg-gradient: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #000;
    background-image: url('assets/background.png');
    background-attachment: fixed;
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    color: var(--text-white);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    padding: 0;
    margin: 0;
    min-height: 100vh;
    position: relative;
}

/* Overlay: Add a semi-transparent dark overlay to the background image (around 40-50% black) */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45); /* 45% black overlay for better text contrast */
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Main Container - Unified width consistency across all pages */
.main-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    margin-top: 0; /* No top margin - nav handles spacing */
}

/* ============================================
   Typography
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    color: var(--btc-orange);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(247, 147, 26, 0.5);
}

h1 {
    font-size: 2.5em;
    text-align: center;
    margin-bottom: 30px;
}

h2 {
    font-size: 2em;
    margin-bottom: 20px;
}

h3 {
    font-size: 1.5em;
    margin-bottom: 15px;
}

label {
    color: var(--btc-orange);
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

/* Rank Titles - Serif font for legendary feel (base style, overridden in .lore-card section) */
.rank-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: bold;
    color: var(--btc-orange);
    font-size: 1.3em;
}

/* ============================================
   Cards & Containers
   ============================================ */

/* Unified Glass Card Style - Site-wide consistency */
.card,
.glass-card {
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

/* Premium Glass Panel Utility - For intro sections and content panels */
.glass-panel {
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    color: #f0f0f0;
    margin-bottom: 2rem;
}

.glass-panel h1,
.glass-panel h2,
.glass-panel h3 {
    color: var(--btc-orange);
}

.glass-panel p {
    color: #e0e0e0;
    line-height: 1.8;
}

.card:hover {
    border-color: rgba(247, 147, 26, 0.3);
    box-shadow: 0 0 30px rgba(247, 147, 26, 0.2);
    transform: translateY(-2px);
}

/* Lore Preview Card - Dark background with orange top border */
.lore-preview-card {
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.lore-preview-card:hover {
    box-shadow: 0 0 20px rgba(247, 147, 26, 0.4);
    transform: translateY(-2px);
}

.lore-preview-rank {
    color: var(--btc-orange);
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 10px;
    text-shadow: 0 0 5px rgba(247, 147, 26, 0.5);
}

.lore-preview-text {
    color: var(--text-muted-silver);
    line-height: 1.8;
    font-size: 0.95em;
}

/* ============================================
   Buttons
   ============================================ */

.btn-primary {
    background-color: var(--btc-orange);
    color: #000000;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(247, 147, 26, 0.3);
}

.btn-primary:hover {
    background-color: #e88300;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(247, 147, 26, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Tables (Leaderboard)
   ============================================ */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    color: var(--text-white);
    background: transparent;
}

th {
    color: var(--btc-orange);
    text-align: left;
    padding: 15px;
    border-bottom: 2px solid var(--btc-orange);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9em;
}

td {
    padding: 15px;
    border-bottom: 1px solid rgba(247, 147, 26, 0.1);
}

/* Top 3 user highlights */
tr.top-1 {
    background: rgba(247, 147, 26, 0.15);
    border-left: 4px solid var(--btc-orange);
}

tr.top-2 {
    background: rgba(247, 147, 26, 0.1);
    border-left: 3px solid rgba(247, 147, 26, 0.7);
}

tr.top-3 {
    background: rgba(247, 147, 26, 0.08);
    border-left: 3px solid rgba(247, 147, 26, 0.5);
}

tr.top-1:hover,
tr.top-2:hover,
tr.top-3:hover {
    background: rgba(247, 147, 26, 0.2);
    box-shadow: 0 0 15px rgba(247, 147, 26, 0.3);
}

/* ============================================
   Input Fields
   ============================================ */

input, textarea {
    background: rgba(13, 13, 13, 0.8);
    border: 1px solid rgba(247, 147, 26, 0.3);
    color: var(--text-white);
    padding: 12px;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 10px;
    transition: all 0.3s ease;
    font-family: inherit;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--btc-orange);
    box-shadow: 0 0 10px rgba(247, 147, 26, 0.3);
    background: rgba(13, 13, 13, 0.9);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted-silver);
}

/* ============================================
   Navigation
   ============================================ */

nav {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
    border-bottom: 1px solid rgba(247, 147, 26, 0.2);
}

nav a {
    color: var(--btc-orange);
    text-decoration: none;
    margin: 0 15px;
    font-weight: bold;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 6px;
}

nav a:hover {
    background: rgba(247, 147, 26, 0.1);
    text-decoration: underline;
}

/* ============================================
   Special Effects
   ============================================ */

/* Genesis Architect special styling */
.genesis-architect {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    font-weight: bold;
}

/* Progress Bar */
.progress-section {
    background: var(--card-bg-gradient);
    border: 2px solid var(--btc-orange);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 40px;
    box-shadow: 0 0 20px rgba(247, 147, 26, 0.3);
}

.progress-title {
    color: var(--btc-orange);
    font-size: 1.5em;
    margin-bottom: 15px;
    text-align: center;
}

.progress-bar-container {
    background-color: rgba(13, 13, 13, 0.8);
    border: 1px solid rgba(247, 147, 26, 0.3);
    border-radius: 25px;
    height: 40px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    background: linear-gradient(90deg, var(--btc-orange) 0%, #FFA64D 100%);
    height: 100%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: bold;
    font-size: 0.9em;
}

.progress-text {
    text-align: center;
    margin-top: 10px;
    color: var(--text-muted-silver);
    font-size: 1.1em;
}

/* Legend Cards (for lore_viewer) - Legacy styles removed, see .lore-card section below */

.era-section {
    margin-bottom: 50px;
}

.era-intro {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    color: #e0e0e0;
    line-height: 1.8;
    font-style: italic;
}

.era-intro h2 {
    color: var(--btc-orange);
    margin-bottom: 1rem;
}

.era-section-header {
    grid-column: 1 / -1 !important; /* Forces it to span all columns */
    width: 100%;
    text-align: left; /* Keep text left-aligned to match card start */
    padding: 30px 25px;
    padding-left: 25px; /* Consistent padding */
    margin-top: 40px;
    margin-bottom: 30px; /* Clear spacing before lore entries */
    background: rgba(30, 30, 30, 0.85); /* Unified charcoal glass background */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1); /* Subtle border */
    border-left: 4px solid #F7931A; /* Bitcoin Orange accent border */
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); /* Consistent shadow */
}

.era-section-header h2 {
    color: var(--btc-orange);
    font-size: 2rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 15px rgba(247, 147, 26, 0.6), 0 0 25px rgba(247, 147, 26, 0.3); /* Orange glow */
}

.era-section-header p {
    color: #e0e0e0; /* Clean off-white for readability */
    max-width: 1200px !important; /* Match the natural width of 3 or 4 cards */
    width: 100%;
    margin-left: 0; /* Ensures it starts at the left edge */
    font-size: 1.1rem;
    line-height: 1.8; /* Improved line height for readability */
}

.era-header {
    color: var(--btc-orange);
    font-size: 2em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--btc-orange);
    text-shadow: 0 0 10px rgba(247, 147, 26, 0.5);
}

.empty-era {
    color: var(--text-muted-silver);
    font-style: italic;
    padding: 20px;
    text-align: center;
    background: rgba(26, 26, 26, 0.5);
    border: 1px dashed rgba(247, 147, 26, 0.3);
    border-radius: 10px;
}

/* ============================================
   Utility Classes
   ============================================ */

.text-muted {
    color: var(--text-muted-silver);
}

.text-orange {
    color: var(--btc-orange);
}

.text-center {
    text-align: center;
}

.mb-12 {
    margin-bottom: 48px;
}

.mt-8 {
    margin-top: 32px;
}

.mt-12 {
    margin-top: 48px;
}

.mt-16 {
    margin-top: 64px;
}

.mt-20 {
    margin-top: 80px;
}

.pt-8 {
    padding-top: 32px;
}

.border-t {
    border-top: 1px solid rgba(247, 147, 26, 0.2);
}

/* ============================================
   Badge System
   ============================================ */

.badge-icon {
    display: inline-block;
    font-size: 20px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    background: rgba(247, 147, 26, 0.1);
    box-shadow: 0 0 8px rgba(247, 147, 26, 0.5),
                0 0 12px rgba(247, 147, 26, 0.3),
                inset 0 0 4px rgba(247, 147, 26, 0.2);
    transition: all 0.3s ease;
    cursor: help;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}

.badge-icon:hover {
    box-shadow: 0 0 12px rgba(247, 147, 26, 0.8),
                0 0 18px rgba(247, 147, 26, 0.5),
                inset 0 0 6px rgba(247, 147, 26, 0.3);
    transform: scale(1.15);
}

/* Badge glow effect for top 3 users */
tr.top-1 .badge-icon,
tr.top-2 .badge-icon,
tr.top-3 .badge-icon {
    box-shadow: 0 0 10px rgba(247, 147, 26, 0.7),
                0 0 15px rgba(247, 147, 26, 0.4),
                inset 0 0 5px rgba(247, 147, 26, 0.3);
}

tr.top-1 .badge-icon:hover,
tr.top-2 .badge-icon:hover,
tr.top-3 .badge-icon:hover {
    box-shadow: 0 0 15px rgba(247, 147, 26, 1),
                0 0 25px rgba(247, 147, 26, 0.6),
                inset 0 0 8px rgba(247, 147, 26, 0.4);
    transform: scale(1.2);
}

/* Inner FontAwesome icon styling */
.badge-icon i {
    font-size: 12px;
    line-height: 20px;
    color: var(--btc-orange);
}

/* New badge pulse / shine animation */
.badge-new {
    animation: badge-pulse 1.4s ease-out 0s 2;
}

@keyframes badge-pulse {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 8px rgba(247, 147, 26, 0.6),
                    0 0 14px rgba(247, 147, 26, 0.4),
                    inset 0 0 4px rgba(247, 147, 26, 0.3);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 16px rgba(247, 147, 26, 1),
                    0 0 24px rgba(247, 147, 26, 0.7),
                    inset 0 0 8px rgba(247, 147, 26, 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(247, 147, 26, 0.5),
                    0 0 12px rgba(247, 147, 26, 0.3),
                    inset 0 0 4px rgba(247, 147, 26, 0.2);
    }
}

/* Custom tooltip for badges */
.badge-tooltip {
    position: absolute;
    left: 50%;
    top: -8px;
    transform: translate(-50%, -100%);
    background: rgba(5, 5, 5, 0.95);
    color: var(--text-white);
    border: 1px solid var(--btc-orange);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    box-shadow: 0 0 12px rgba(247, 147, 26, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 20;
}

.badge-tooltip strong {
    display: block;
    margin-bottom: 2px;
    color: var(--btc-orange);
}

.badge-tooltip span {
    color: var(--text-muted-silver);
}

.badge-icon:hover .badge-tooltip {
    opacity: 1;
    transform: translate(-50%, -110%);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .legends-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2em;
    }

    h2, .era-header {
        font-size: 1.5em;
    }

    .container {
        padding: 10px;
    }

    .main-container {
        padding: 10px;
    }

    table {
        font-size: 0.85em;
    }

    th, td {
        padding: 10px 8px;
    }
}
/* Container for badges in the Leaderboard/Profile */
.badge-container {
    display: inline-flex;
    gap: 8px;
}

/* Individual Badge Styling */
.badge-icon {
    width: 20px;
    height: 20px;
    color: #F7931A; /* Bitcoin Orange */
    text-shadow: 0 0 8px rgba(247, 147, 26, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
}

.badge-icon:hover {
    transform: scale(1.3);
    text-shadow: 0 0 15px rgba(247, 147, 26, 1);
}

/* Grayscale for locked badges (for the Collection Page) */
.badge-locked {
    filter: grayscale(100%);
    opacity: 0.3;
    color: #555;
    text-shadow: none;
}
/* Make the locked badges look like "hidden treasure" */
.badge-card-locked .badge-icon {
    filter: grayscale(100%) blur(1px); /* Adds a slight mystery blur */
    transition: filter 0.3s ease;
}

.badge-card-locked:hover .badge-icon {
    filter: grayscale(50%) blur(0px); /* Reveals slightly more on hover */
}

/* ============================================
   Badge Grid Layout (from test_engine.php)
   ============================================ */

.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.badge-item {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 16px;
    height: 100%;
    background: rgba(247, 147, 26, 0.1);
    border-left: 3px solid var(--btc-orange);
    border-radius: 6px;
}

.badge-item-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.badge-item i {
    font-size: 2em;
    color: var(--btc-orange);
}

.badge-item-name {
    color: var(--text-white);
    font-weight: bold;
    font-size: 1em;
}

.badge-lore {
    font-style: italic;
    font-size: 0.85rem;
    color: #999;
    line-height: 1.5;
    margin-top: 4px;
    text-align: center;
    flex: 1;
}

/* ============================================
   Share Button (from test_engine.php)
   ============================================ */

.share-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: #000000;
    border: 2px solid var(--btc-orange);
    border-radius: 8px;
    color: var(--btc-orange);
    font-weight: bold;
    font-size: 1em;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(247, 147, 26, 0.3);
}

.share-button:hover {
    background: rgba(247, 147, 26, 0.1);
    box-shadow: 0 0 25px rgba(247, 147, 26, 0.5);
    transform: translateY(-2px);
}

.share-button i {
    font-size: 1.2em;
}

/* Lore Card Glassmorphism */
/* ============================================
   Glassmorphism Legend Gallery Styles
   ============================================ */

.legends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.legends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

/* ============================================
   Glassmorphism Legend Gallery Styles
   Consolidated Base Styles
   ============================================ */

.legends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

/* Base lore card - Lore Viewer (clean version) */
.lore-card {
    width: 100%; /* Fits the grid */
    max-width: 400px;
    height: auto;
    min-height: 250px;
    overflow: hidden; /* Prevents scrollbars */
    position: relative;
    background: rgba(30, 30, 30, 0.85); /* Unified charcoal glass background */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 0 !important; /* Remove padding from the outer card */
    border-radius: 8px; /* Unified border radius */
    border: 1px solid rgba(255, 255, 255, 0.1); /* Unified border */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out, background 0.2s ease-in-out;
}
/* Hide scrollbars specifically */
.lore-card::-webkit-scrollbar { display: none; }
.lore-card { -ms-overflow-style: none; scrollbar-width: none; }

/* Forge Page (special version) */
.forge-card-container .lore-card {
    width: 450px; /* Fixed width for the Forge card */
    min-height: 600px; /* Minimum height, but can grow */
    height: auto; /* Flexible height based on content */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 40px;
    padding-bottom: 60px; /* Extra bottom padding to prevent text cutoff */
    margin: 0 auto;
    overflow: hidden; /* Prevent scrollbars - card grows to fit content */
}

/* Shared background logic */
.card-bg-image {
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    object-fit: cover;
    z-index: 0;
    opacity: 0.4; /* Shows on all pages now */
}

/* Forge card background image - stretches to cover dynamic height */
.forge-card-container .card-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* Forge-specific text sizing for better fit */
.forge-card-container .lore-text {
    font-size: 0.95rem;
    line-height: 1.5;
}
.card-content {
    position: relative;
    z-index: 1; /* Stays above image */
    padding: 15px; /* Consistent padding so pill isn't touching the edge */
}

/* Content alignment - ensure proper padding for lore cards */
.lore-card .card-content {
    padding: 15px !important; /* Standard padding for lore viewer cards */
}

/* Lore text styling for lore viewer cards (direct .lore-text, not .lore-card-inner) */
.lore-card .lore-text {
    color: #e0e0e0; /* Light gray for readability on charcoal */
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Forge Page Padding (The Exception) - More breathing room */
.forge-card-container .lore-card .card-content {
    padding: 40px 20px !important; /* 40px top/bottom for the Era Pill, 20px sides */
}

/* Unify heading fonts for Forge page - match Lore Viewer branding */
.forge-container h1,
.forge-card-container h1,
.forge-card-container h3,
.forge-card-container .rank-title,
.forge-card-container .lore-section-title,
.forge-card-container .chronicle-title {
    font-family: 'Orbitron', sans-serif !important;
    color: #ffffff !important;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Rank name typography - consistent with site branding */
.lore-card h3,
.lore-card .rank-title,
.rank-name {
    font-family: 'Orbitron', sans-serif; /* Ensure this matches your site's header font */
    color: var(--btc-orange); /* Orange accent for titles */
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

/* Fix rank name overflow - prevent wrapping */
.lore-card h3 {
    font-size: 1rem !important; /* Adjusted for reduced space */
    letter-spacing: 0.5px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Adds ... if it still somehow overflows */
    margin-top: 5px;
}

/* Ensure era pill/badge in Forge stays above background */
.forge-card-container .era-pill,
.forge-card-container .era-badge {
    position: relative;
    z-index: 3;
}

/* Remove the old ::before overlay - we're using .lore-card-inner now */

/* Stats Bar at bottom of card - inside glass box */
.lore-card .lore-card-inner .stats-bar {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding-top: 12px;
    margin-top: auto; /* Push to bottom */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0; /* Don't shrink - keep at bottom */
}

.lore-card .lore-card-inner .stats-bar .stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #FFFFFF;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.lore-card .lore-card-inner .stats-bar .stat-item.left {
    justify-content: flex-start;
}

.lore-card .lore-card-inner .stats-bar .stat-item.right {
    justify-content: flex-end;
    margin-left: auto;
    flex: 0 0 auto; /* Don't shrink, allow natural width */
    min-width: 180px; /* Ensure enough space for "RECORD ID:" label + 12-char hash */
}

.lore-card .lore-card-inner .stats-bar .stat-label {
    color: #CCCCCC;
    font-weight: normal;
}

.lore-card .lore-card-inner .stats-bar .stat-value {
    color: #FFD700;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.lore-card .lore-card-inner .stats-bar .hash-value {
    color: #CCCCCC;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    word-break: break-all; /* Allow breaking if needed, but 12 chars should fit */
    min-width: 120px; /* Ensure enough space for 12 characters */
}

/* Hover effect - lighter charcoal instead of orange */
.lore-card:hover {
    transform: translateY(-4px);
    background: rgba(50, 50, 50, 0.9); /* Lighter charcoal on hover */
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.85);
    border-color: rgba(255, 255, 255, 0.15); /* Slightly brighter border */
}

/* Era pill styling - Base styles without color (era-specific classes will override) */
.era-pill {
    display: inline-block !important;
    padding: 4px 14px !important;
    border-radius: 50px !important;
    box-shadow: 0 0 10px rgba(247, 147, 26, 0.2);
    white-space: nowrap;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    position: relative;
    z-index: 2;
}

/* Targeting specifically within lore-card to increase priority */
.lore-card .card-content .era-pill {
    display: inline-block !important;
    padding: 4px 12px !important;
    border-radius: 50px !important;
    font-size: 0.7rem !important;
    font-weight: 800 !important;
    margin-bottom: 12px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Era-specific pill colors */
.lore-card.era-satoshi .era-pill {
    background: rgba(255, 153, 0, 0.2) !important;
    border: 1px solid #f7931a !important;
    color: #f7931a !important;
}

.lore-card.era-asic .era-pill {
    background: rgba(192, 192, 192, 0.15) !important; /* Soft Silver tint */
    border: 1px solid #a8a8a8 !important; /* Steel Grey */
    color: #e0e0e0 !important; /* Off-white / Silver text */
    box-shadow: 0 0 10px rgba(168, 168, 168, 0.2);
}

.lore-card.era-gpu .era-pill {
    background: rgba(0, 255, 255, 0.2) !important;
    border: 1px solid #00ffff !important;
    color: #00ffff !important;
}

.lore-card.era-segwit .era-pill {
    background: rgba(0, 200, 255, 0.2) !important;
    border: 1px solid #00c8ff !important;
    color: #00c8ff !important;
}

.lore-card.era-taproot .era-pill {
    background: rgba(160, 50, 255, 0.2) !important;
    border: 1px solid #a032ff !important;
    color: #a032ff !important;
}

/* Era-specific badge colors for Forge card (since it uses era-badge instead of era-pill) */
.forge-card-container .lore-card.era-satoshi .era-badge {
    background: rgba(255, 153, 0, 0.2) !important;
    border: 1px solid #f7931a !important;
    color: #f7931a !important;
}

.forge-card-container .lore-card.era-asic .era-badge {
    background: rgba(192, 192, 192, 0.15) !important; /* Soft Silver tint */
    border: 1px solid #a8a8a8 !important; /* Steel Grey */
    color: #e0e0e0 !important; /* Off-white / Silver text */
    box-shadow: 0 0 10px rgba(168, 168, 168, 0.2);
}

.forge-card-container .lore-card.era-gpu .era-badge {
    background: rgba(0, 255, 255, 0.2) !important;
    border: 1px solid #00ffff !important;
    color: #00ffff !important;
}

.forge-card-container .lore-card.era-segwit .era-badge {
    background: rgba(0, 200, 255, 0.2) !important;
    border: 1px solid #00c8ff !important;
    color: #00c8ff !important;
}

.forge-card-container .lore-card.era-taproot .era-badge {
    background: rgba(160, 50, 255, 0.2) !important;
    border: 1px solid #a032ff !important;
    color: #a032ff !important;
}

/* Base era badge - positioned at top of inner container */
.lore-card .lore-card-inner .era-badge {
    position: relative;
    z-index: 2; /* Above glassmorphism overlay */
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 12px;
    color: var(--text-white);
    flex-shrink: 0; /* Don't shrink - keep at top */
}

/* Base rank title inside lore cards */
.lore-card .lore-card-inner .rank-title {
    position: relative;
    z-index: 2; /* Above glassmorphism overlay */
    margin: 0 0 10px;
    font-size: 1.5rem; /* Increased for better hierarchy */
    font-weight: 700;
    color: var(--btc-orange); /* Orange accent for titles */
    letter-spacing: 0.05em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    flex-shrink: 0; /* Don't shrink - keep at top */
}

/* Lore Section */
.lore-card .lore-card-inner .lore-section {
    position: relative;
    z-index: 2;
    margin: 0 0 15px;
}

.lore-card .lore-card-inner .lore-section .lore-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #FFD700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Lore Section */
.lore-card .lore-card-inner .lore-section {
    position: relative;
    z-index: 2;
    margin: 0 0 15px;
}

.lore-card .lore-card-inner .lore-section .lore-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #FFD700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Base lore text - Slightly reduced for 1080x1080 optimization */
.lore-card .lore-card-inner .lore-text {
    position: relative;
    z-index: 2; /* Above glassmorphism overlay */
    margin: 0 0 15px; /* Add bottom margin before stats bar */
    font-size: 0.95rem; /* Slightly reduced for better fit */
    line-height: 1.5;
    color: #e0e0e0; /* Light gray for readability on charcoal */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
}

/* Remove scrollbars from forge card - let it grow to fit content */
.forge-card-container .lore-card .lore-card-inner,
.forge-card-container .lore-card .card-content {
    overflow: visible !important; /* Remove any scrollbars */
}

.forge-card-container .lore-card .lore-text {
    max-height: none !important; /* Remove height restriction */
    overflow-y: visible !important; /* Remove scrollbar */
}

/* Gold Divider between Lore and Chronicle */
.lore-card .lore-card-inner .lore-chronicle-divider {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 215, 0, 0.3) 20%, 
        rgba(255, 215, 0, 0.6) 50%, 
        rgba(255, 215, 0, 0.3) 80%, 
        transparent 100%
    );
    margin: 20px 0;
    padding: 0;
    z-index: 2;
    position: relative;
}

/* The Chronicle Section - Distinct visual box for historical events */
.lore-card .lore-card-inner .chronicle-section {
    position: relative;
    z-index: 2;
    margin: 15px 0 12px;
    padding: 12px 15px;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: 8px;
    border-top: 2px solid rgba(255, 215, 0, 0.3);
}

.lore-card .lore-card-inner .chronicle-section .chronicle-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #FFD700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.lore-card .lore-card-inner .chronicle-section .chronicle-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #FFFFFF;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    margin: 0;
    padding: 0;
    text-align: left;
    font-style: italic;
}

/* Card Watermark - Bottom-left corner */
.lore-card .lore-card-inner .card-watermark {
    position: absolute;
    bottom: 15px;
    left: 20px;
    z-index: 10;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* Card Watermark - Bottom-left corner */
.lore-card .lore-card-inner .card-watermark {
    position: absolute;
    bottom: 15px;
    left: 20px;
    z-index: 10;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* Card Branding - Bottom-right corner */
.lore-card .lore-card-inner .card-branding {
    position: absolute;
    bottom: 15px;
    right: 20px;
    z-index: 10;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* Era-Specific Styles - Using CSS background-image */
.lore-card.era-satoshi {
    border-color: rgba(247, 147, 26, 0.3);
    background-image: url('assets/era-bg/satoshi-bg.jpg');
    position: relative;
    overflow: hidden;
}

/* Era-specific ::before overlay is handled by base .lore-card::before */

.lore-card.era-satoshi:hover {
    /* Hover no longer affects visibility, only border/shadow */
    border-color: rgba(247, 147, 26, 0.5);
    box-shadow: 0 22px 50px rgba(247, 147, 26, 0.45), 0 0 30px rgba(247, 147, 26, 0.3);
}

.lore-card.era-satoshi .lore-card-inner .era-badge {
    color: #F7931A;
    border-color: rgba(247, 147, 26, 0.5);
    background: linear-gradient(135deg, rgba(247, 147, 26, 0.18), rgba(247, 147, 26, 0.02));
    box-shadow: 0 0 18px rgba(247, 147, 26, 0.35);
}

.lore-card.era-gpu {
    border-color: rgba(0, 210, 255, 0.3);
    position: relative;
    overflow: hidden;
}

/* Era-specific ::before overlay is handled by base .lore-card::before */

.lore-card.era-gpu:hover {
    border-color: rgba(0, 210, 255, 0.5);
    box-shadow: 0 22px 50px rgba(0, 210, 255, 0.45), 0 0 30px rgba(0, 210, 255, 0.3);
}

.lore-card.era-gpu .lore-card-inner .era-badge {
    color: #00D2FF;
    border-color: rgba(0, 210, 255, 0.5);
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.18), rgba(0, 210, 255, 0.02));
    box-shadow: 0 0 18px rgba(0, 210, 255, 0.35);
}

.lore-card.era-asic {
    border-color: rgba(224, 224, 224, 0.3);
    position: relative;
    overflow: hidden;
}

/* Era-specific ::before overlay is handled by base .lore-card::before */

.lore-card.era-asic:hover {
    border-color: rgba(224, 224, 224, 0.5);
    box-shadow: 0 22px 50px rgba(224, 224, 224, 0.45), 0 0 30px rgba(224, 224, 224, 0.3);
}

.lore-card.era-asic .lore-card-inner .era-badge {
    color: #E0E0E0;
    border-color: rgba(224, 224, 224, 0.5);
    background: linear-gradient(135deg, rgba(224, 224, 224, 0.18), rgba(224, 224, 224, 0.02));
    box-shadow: 0 0 18px rgba(224, 224, 224, 0.35);
}

.lore-card.era-segwit {
    border: 1px solid #00c8ff !important; /* Blue */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 200, 255, 0.2); /* Lower opacity than hover */
    position: relative;
    overflow: hidden;
}

/* Era-specific ::before overlay is handled by base .lore-card::before */

.lore-card.era-segwit:hover {
    border-color: #00c8ff !important; /* Bright Blue */
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.4) !important;
}

.lore-card.era-segwit .lore-card-inner .era-badge {
    color: #8F5AFF;
    border-color: rgba(143, 90, 255, 0.5);
    background: linear-gradient(135deg, rgba(143, 90, 255, 0.18), rgba(143, 90, 255, 0.02));
    box-shadow: 0 0 18px rgba(143, 90, 255, 0.35);
}

.lore-card.era-taproot {
    border: 1px solid #a032ff !important; /* Purple */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 20px rgba(160, 50, 255, 0.2); /* Lower opacity than hover */
    position: relative;
    overflow: hidden;
}

/* Era-specific ::before overlay is handled by base .lore-card::before */

.lore-card.era-taproot:hover {
    border-color: #a032ff !important; /* Deep Purple */
    box-shadow: 0 0 20px rgba(160, 50, 255, 0.4) !important;
}

.lore-card.era-taproot .lore-card-inner .era-badge {
    color: #00FFA3;
    border-color: rgba(0, 255, 163, 0.5);
    background: linear-gradient(135deg, rgba(0, 255, 163, 0.18), rgba(0, 255, 163, 0.02));
    box-shadow: 0 0 18px rgba(0, 255, 163, 0.35);
}

/* ============================================
   Forge Modal Styles
   ============================================ */

.forge-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: #0f0f0f;
    backdrop-filter: blur(5px);
    overflow-y: auto; /* Enable page scrolling */
    margin: 0;
    padding: 0;
}

.forge-modal:not([style*="display: none"]),
.forge-modal.show {
    display: flex !important;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.forge-modal-content {
    background: transparent; /* Transparent to show modal background */
    border: none;
    border-radius: 0;
    margin: 0;
    padding: 0;
    max-width: none;
    max-height: none;
    position: relative;
    box-shadow: none;
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 40px 0;
    overflow-y: auto; /* Allow scrolling for download button */
    width: 100%;
}

.forge-modal-close {
    color: #c5a059;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    position: absolute;
    right: 15px;
    top: 15px;
}

.forge-modal-close:hover {
    color: #d4b068;
}

.forge-modal-content h1,
.forge-modal-content h2,
.forge-modal-content h3 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--btc-orange);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(247, 147, 26, 0.5);
}

.forge-modal-content .rank-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: bold;
}

.forge-modal-content .lore-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Achievement card in modal */
#achievementCard {
    position: relative;
    background: var(--card-bg-gradient);
    border: 2px solid rgba(247, 147, 26, 0.3);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 600px;
    margin: 0 auto 20px;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .lore-card {
        padding: 0 !important; /* Remove padding in mobile too */
        border-radius: 14px;
    }

    .lore-card .rank-title {
        font-size: 1.0rem;
    }

    .lore-card .lore-text {
        font-size: 0.92rem;
    }
}