/* 1. Global Styles & Variables */
:root {
    --bg-color: #0D1117;
    --primary-surface: #161B22;
    --border-color: #30363d;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --accent-blue: #58a6ff;
    --accent-green: #3fb950;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-family); background-color: var(--bg-color); color: var(--text-primary); line-height: 1.6; }
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent-blue); text-decoration: none; transition: color 0.2s ease; }
a:hover { text-decoration: underline; color: #79c0ff; }

/* 2. Header */
.main-header { background: rgba(22, 27, 34, 0.75); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-color); padding: 1rem 0; position: sticky; top: 0; z-index: 10; }
.main-header .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); letter-spacing: -1px; }
.logo:hover { text-decoration: none; color: #fff; }
.main-nav ul { list-style: none; display: flex; gap: 25px; }
.main-nav a { color: var(--text-secondary); font-weight: 500; }
.main-nav a:hover { color: var(--text-primary); text-decoration: none; }

/* 3. Main Tool Section */
.tool-section { padding: 80px 0; text-align: center; }
h1 { font-size: 3.5rem; font-weight: 800; margin-bottom: 1rem; color: #fff; line-height: 1.1; }
.gradient-text { background: linear-gradient(45deg, var(--accent-blue), var(--accent-green)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.subtitle { font-size: 1.2rem; max-width: 650px; margin: 0 auto 50px; color: var(--text-secondary); }
.backlog-burner { background: var(--primary-surface); padding: 35px; border-radius: 16px; border: 1px solid var(--border-color); max-width: 700px; margin: 0 auto; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); }
.tool-input-area { display: flex; gap: 10px; margin-bottom: 20px; }
#game-search-input { flex-grow: 1; padding: 14px; font-size: 1rem; border: 1px solid var(--border-color); border-radius: 8px; background-color: var(--bg-color); color: var(--text-primary); transition: border-color 0.2s, box-shadow 0.2s; }
#game-search-input:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2); }
#add-game-btn, .primary-btn, .secondary-btn { padding: 14px 24px; font-size: 1rem; font-weight: 700; border: none; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; }
#add-game-btn, .primary-btn { color: #fff; background-color: var(--accent-green); }
#add-game-btn:hover, .primary-btn:hover { background-color: #48d161; }
.secondary-btn { background-color: transparent; border: 1px solid var(--border-color); color: var(--accent-blue); }
.secondary-btn:hover { background-color: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }
.backlog-summary { margin: 30px 0 20px; font-size: 1.2rem; }
#total-time { font-weight: bold; color: var(--accent-blue); }
.tool-actions { margin-top: 30px; display: flex; justify-content: center; gap: 15px; }

/* 4. Articles Section */
.articles-section { padding: 60px 0 80px; background-color: var(--bg-color); border-top: 1px solid var(--border-color); }
.articles-section h2 { text-align: center; font-size: 2.5rem; font-weight: 700; margin-bottom: 50px; }
.article-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; }
.article-card { background-color: var(--primary-surface); border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.article-card:hover { transform: translateY(-8px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.article-card img { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; }
.card-content { padding: 20px; }
.card-content h3 { font-size: 1.4rem; margin-bottom: 10px; color: var(--text-primary); }
.card-content p { color: var(--text-secondary); margin-bottom: 15px; }
.read-more { font-weight: bold; }

/* 5. Footer */
.main-footer { text-align: center; padding: 3rem 0; margin-top: 40px; border-top: 1px solid var(--border-color); color: var(--text-secondary); }
.footer-nav ul { list-style: none; display: flex; justify-content: center; gap: 20px; margin-top: 10px; }
.footer-nav a { color: var(--text-secondary); }

/* 6. Search & Backlog List Styles */
#search-results-area { margin-bottom: 20px; text-align: left; }
.loading-text, .no-results-text { color: var(--text-secondary); padding: 10px; }
.search-results-list { list-style: none; max-height: 350px; overflow-y: auto; }
.search-result-item { display: flex; align-items: center; padding: 10px; border-radius: 6px; cursor: pointer; transition: background-color 0.2s ease; }
.search-result-item:hover { background-color: rgba(139, 148, 158, 0.1); }
.result-img { width: 90px; height: 60px; object-fit: cover; border-radius: 4px; margin-right: 15px; }
.result-info { display: flex; flex-direction: column; }
.result-title { font-weight: 500; color: var(--text-primary); }
.result-year { font-size: 0.9em; color: var(--text-secondary); }
.backlog-list { list-style: none; display: flex; flex-direction: column; gap: 15px; text-align: left; }
.backlog-list .placeholder { color: var(--text-secondary); text-align: center; padding: 20px; border: 2px dashed var(--border-color); border-radius: 8px; }
.backlog-item { display: flex; align-items: center; background-color: var(--bg-color); padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; animation: fadeIn 0.4s ease-out; }
.backlog-img { width: 60px; height: 40px; object-fit: cover; border-radius: 4px; margin-right: 15px; }
.backlog-info { flex-grow: 1; }
.backlog-title { display: block; font-weight: 500; }
.backlog-hours { font-size: 0.9em; color: var(--text-secondary); }
.remove-btn { background: none; border: none; color: var(--text-secondary); font-size: 1.5rem; font-weight: bold; cursor: pointer; padding: 0 10px; transition: color 0.2s ease; }
.remove-btn:hover { color: #ff7b72; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* 7. Game Plan Sorting Styles */
.sort-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: 100%; }
.sort-btn, .cancel-btn { padding: 10px 18px; font-size: 0.9rem; font-weight: 500; border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; background-color: var(--primary-surface); color: var(--text-secondary); transition: all 0.2s ease; }
.sort-btn:hover { color: var(--text-primary); border-color: var(--accent-green); background-color: rgba(63, 185, 80, 0.1); }
.cancel-btn { border-color: #f85149; color: #f85149; }
.cancel-btn:hover { background-color: #f85149; color: #fff; }

/* 8. Share Modal & Card Styles */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); display: flex; justify-content: center; align-items: center; z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content { background: var(--primary-surface); padding: 30px; border-radius: 12px; border: 1px solid var(--border-color); width: 90%; max-width: 500px; text-align: center; position: relative; transform: scale(0.9); transition: transform 0.3s ease; }
.modal-overlay.active .modal-content { transform: scale(1); }
.close-btn { position: absolute; top: 10px; right: 15px; background: none; border: none; color: var(--text-secondary); font-size: 2rem; cursor: pointer; }
#image-output-area { margin: 20px 0; }
#image-output-area img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border-color); }
#download-link { display: inline-block; margin-top: 10px; text-decoration: none; }
.share-card-template { position: absolute; left: -9999px; width: 1200px; height: 630px; background: linear-gradient(45deg, #161B22, #0D1117); color: #fff; font-family: var(--font-family); padding: 40px; display: flex; flex-direction: column; }
.share-card-header { display: flex; justify-content: space-between; align-items: center; }
.share-card-logo { font-size: 2.5rem; font-weight: 800; }
.share-card-header h2 { font-size: 2.5rem; font-weight: 500; color: var(--text-secondary); }
.share-card-body { flex-grow: 1; display: flex; gap: 40px; margin-top: 30px; }
.share-card-games-grid { flex-grow: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 20px; }
.share-card-games-grid img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 2px solid var(--border-color); }
.share-card-stats { display: flex; flex-direction: column; justify-content: center; align-items: center; background-color: var(--primary-surface); border-radius: 12px; padding: 40px; width: 300px; text-align: center; }
.share-card-hours-text { font-size: 7rem; font-weight: 800; line-height: 1; color: var(--accent-blue); }
.share-card-stats span:last-child { font-size: 1.8rem; color: var(--text-secondary); }
.share-card-footer { text-align: center; font-size: 1.5rem; color: var(--text-secondary); margin-top: 20px; }

/* 9. Static Content Page Styles */
.page-content { padding-top: 60px; padding-bottom: 60px; max-width: 720px; }
.page-content h1 { font-size: 3rem; margin-bottom: 20px; text-align: left; }
.page-content h2 { font-size: 1.8rem; margin-top: 40px; margin-bottom: 15px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.page-content p { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.7; }
.page-content strong { color: var(--text-primary); font-weight: 600; }
.page-content a { font-weight: 500; }
.contact-email { font-size: 1.5rem; font-weight: 500; text-align: center; margin: 40px 0; }

/* 10. Robust Action Button Styles */
#sort-actions { display: none; }
#sort-actions.active { display: flex; }
#default-actions.hidden { display: none; }
/* 11. NEW STYLES for Article Pages */

.article-container {
    padding-top: 60px;
    padding-bottom: 60px;
    max-width: 720px; /* Ideal width for reading */
}

.article-content h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    line-height: 1.2;
}

.article-meta {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.article-hero-image {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 30px;
    aspect-ratio: 16 / 8;
    object-fit: cover;
}

.article-content h2 {
    font-size: 1.8rem;
    margin-top: 40px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.article-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.8;
}

.article-content ul {
    list-style-position: inside;
    color: var(--text-secondary);
    margin-bottom: 20px;
    padding-left: 10px;
}

.article-content li {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 10px;
}

.article-content strong {
    color: var(--text-primary);
    font-weight: 600;
}
/* ADD THESE NEW STYLES AT THE END */

/* Makes the download button hidden by default */
#download-link {
    display: none;
}

/* Styles for the new Stats layout on the Share Card */
.share-card-stats {
    justify-content: space-evenly; /* Evenly space the two stat blocks */
    padding: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 6rem; /* Slightly smaller to fit both */
    font-weight: 800;
    line-height: 1;
    color: var(--accent-blue);
}

.stat-label {
    font-size: 1.5rem;
    color: var(--text-secondary);
}
/* ADD THESE NEW STYLES AT THE END */

/* Styles for Game Names on Share Card */
.share-card-game-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow: hidden; /* Prevent content from spilling out */
}

.share-card-game-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    margin-bottom: 8px; /* Space between image and text */
}

.share-card-game-item span {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.2;
    /* Hide text that overflows */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.share-card-games-grid {
    grid-template-rows: repeat(2, 1fr); /* Adjust grid rows */
    align-content: start; /* Align items to the start of the grid */
}

/* Styles for the new Stats layout on the Share Card */
.share-card-stats {
    justify-content: space-evenly;
    padding: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 6rem;
    font-weight: 800;
    line-height: 1;
    color: var(--accent-blue);
}

.stat-label {
    font-size: 1.5rem;
    color: var(--text-secondary);
}
