:root {
    --gs-primary: #7c3aed;
    --gs-dark: #1a1a2e;
    --gs-accent: #f59e0b;
    --gs-primary-light: #8b5cf6;
    --gs-primary-dark: #5b21b6;
}

/* Global */
body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: #212529;
    background: #f8f9fa;
}

/* Navbar */
.navbar {
    background: var(--gs-dark) !important;
    border-bottom: 2px solid var(--gs-primary);
}
.navbar-brand {
    color: var(--gs-accent) !important;
    font-size: 1.2rem;
}
.brand-icon {
    font-size: 1.3em;
}
.nav-link.active {
    color: var(--gs-accent) !important;
    font-weight: 600;
}
.dropdown-menu-dark {
    background: #16213e;
    border: 1px solid var(--gs-primary);
}
.dropdown-item:hover {
    background: var(--gs-primary);
}

/* Mega-menu */
.mega-menu-dropdown {
    position: static;
}
.mega-menu-dropdown .mega-menu {
    width: 100%;
    max-width: none;
    left: 0;
    right: 0;
}
.mega-menu .dropdown-header {
    color: var(--gs-accent);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    padding-bottom: 0.25rem;
}
.mega-menu .dropdown-item {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mega-menu .dropdown-item .badge-count {
    opacity: 0.5;
    font-weight: normal;
}
.mega-menu .dropdown-divider {
    border-color: rgba(255,255,255,0.1);
}
#gameSearchResults .dropdown-item {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 991px) {
    .mega-menu-dropdown .mega-menu {
        width: auto;
    }
    .mega-menu .row > div {
        margin-bottom: 0.5rem;
    }
}

/* Demo iframe (template) */
.demo-container {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.demo-iframe {
    width: 100%;
    height: 700px;
    border: none;
    display: block;
}
@media (max-width: 768px) {
    .demo-iframe {
        height: 500px;
    }
}
.demo-placeholder-inner {
    background: linear-gradient(135deg, var(--gs-dark) 0%, #16213e 100%);
    border-radius: 1rem;
    color: #fff;
    min-height: 300px;
}

/* Breadcrumbs */
.breadcrumb {
    background: transparent;
    padding: 0.5rem 0;
    font-size: 0.875rem;
}
.breadcrumb-item a {
    color: var(--gs-primary);
    text-decoration: none;
}
.breadcrumb-item a:hover {
    text-decoration: underline;
}

/* Article */
article {
    max-width: 800px;
    font-size: 1.05rem;
    line-height: 1.7;
}
article h1 {
    color: var(--gs-primary-dark);
    font-weight: 700;
    margin-bottom: 1.5rem;
}
article h2 {
    color: var(--gs-dark);
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid var(--gs-primary);
}
article h3 {
    color: var(--gs-dark);
    font-weight: 600;
    margin-top: 1.5rem;
}

/* TL;DR */
.tldr-box {
    background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);
    border: none;
    border-left: 4px solid var(--gs-primary);
    border-radius: 0.5rem;
    color: #1e1b4b;
    font-size: 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.tldr-box strong {
    color: var(--gs-primary-dark);
}

/* TOC */
#toc {
    border-left: 3px solid var(--gs-primary);
    padding-left: 1rem;
    background: #fafafa;
    padding: 1rem 1rem 1rem 1.25rem;
    border-radius: 0 0.5rem 0.5rem 0;
}
#toc h2 {
    border: none;
    margin: 0 0 0.5rem 0;
    padding: 0;
    font-size: 0.75rem;
}
#toc a {
    color: var(--gs-primary);
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    padding: 0.15rem 0;
    transition: color 0.15s;
}
#toc a:hover {
    color: var(--gs-primary-dark);
    text-decoration: underline;
}

/* FAQ */
.faq-item {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
}
.faq-item summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    background: #f8f9fa;
    list-style: none;
    position: relative;
    padding-right: 2.5rem;
}
.faq-item summary::-webkit-details-marker {
    display: none;
}
.faq-item summary::after {
    content: '+';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gs-primary);
    transition: transform 0.2s;
}
.faq-item[open] summary::after {
    content: '−';
}
.faq-item[open] summary {
    border-bottom: 1px solid #dee2e6;
    background: #ede9fe;
}
.faq-answer {
    font-size: 0.95rem;
    color: #374151;
}

/* Stars */
.stars .text-warning {
    color: var(--gs-accent) !important;
    font-size: 1.1em;
}

/* Blockquote */
article blockquote, blockquote.expert-quote {
    background: #f3f0ff;
    border-left: 4px solid var(--gs-primary);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    border-radius: 0 0.5rem 0.5rem 0;
    font-style: italic;
    color: #374151;
}
blockquote cite {
    display: block;
    margin-top: 0.5rem;
    font-style: normal;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gs-primary-dark);
}

/* Demo placeholder */
.demo-placeholder {
    background: linear-gradient(135deg, var(--gs-dark) 0%, #16213e 100%);
    border-radius: 1rem;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    padding: 2rem;
}
.demo-placeholder .demo-icon {
    font-size: 4rem;
    animation: pulse 2s infinite;
    margin-bottom: 1rem;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}
.demo-placeholder .btn-play-demo {
    background: var(--gs-accent);
    color: var(--gs-dark);
    border: none;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.75rem 2rem;
    border-radius: 2rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.demo-placeholder .btn-play-demo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
}

/* Demo iframe */
.demo-wrap iframe {
    width: 100%;
    height: 700px;
    border: none;
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
@media (max-width: 768px) {
    .demo-wrap iframe {
        height: 500px;
    }
}
.demo-wrap:fullscreen iframe,
.demo-wrap:-webkit-full-screen iframe {
    height: 100vh;
    border-radius: 0;
}

.btn-fullscreen {
    background: var(--gs-primary);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    margin-top: 0.75rem;
}
.btn-fullscreen:hover {
    background: var(--gs-primary-dark);
}

/* Glossary */
.glossary-nav a {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    line-height: 2rem;
    text-align: center;
    border-radius: 0.25rem;
    color: var(--gs-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
}
.glossary-nav a:hover {
    background: var(--gs-primary);
    color: #fff;
}
dl.glossary-list dt {
    color: var(--gs-primary-dark);
    font-size: 1.1rem;
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
}
dl.glossary-list dd {
    color: #374151;
    margin-bottom: 0.75rem;
    padding-left: 1rem;
    border-left: 2px solid #e5e7eb;
}

/* Game cards (catalog) */
.game-card {
    border: none;
    border-radius: 1rem;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.game-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(124, 58, 237, 0.2);
}
.game-card .card-header {
    color: #fff;
    font-weight: 700;
    padding: 1.25rem 1.25rem 1rem;
    font-size: 1.15rem;
    position: relative;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: flex-end;
}
.game-card .card-header .card-header-icon {
    font-size: 5rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    opacity: 0.25;
}
.game-card .card-body {
    padding: 1rem 1.25rem 1.25rem;
}
.game-card .stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #9ca3af;
    letter-spacing: 0.06em;
    margin-bottom: 0.1rem;
}
.game-card .stat-value {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--gs-dark);
}
.game-card .btn-primary {
    background: var(--gs-primary);
    border-color: var(--gs-primary);
    border-radius: 0.75rem;
    font-weight: 600;
    padding: 0.5rem;
    transition: background 0.2s, transform 0.15s;
}
.game-card .btn-primary:hover {
    background: var(--gs-primary-dark);
    border-color: var(--gs-primary-dark);
    transform: scale(1.02);
}

/* Game card preview */
.card-preview-wrap {
    position: relative;
    overflow: hidden;
}
.card-preview {
    width: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.4s ease;
}
.game-card:hover .card-preview {
    transform: scale(1.06);
}
.card-preview-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2.5rem 1.1rem 0.7rem;
    background: linear-gradient(to top, rgba(26,26,46,0.85) 0%, rgba(26,26,46,0.4) 50%, transparent 100%);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* VS / Image compare */
.img-compare {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.img-compare figure {
    flex: 1;
    min-width: 250px;
    text-align: center;
}

/* Game screenshots */
.game-screenshot {
    margin: 1.5rem auto;
    max-width: 720px;
}
.game-screenshot img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.game-screenshot figcaption {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    font-style: italic;
    color: #0047BB;
    text-align: center;
    line-height: 1.4;
    opacity: 0.75;
}

/* Comparison winner badges */
.badge-winner {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Calculator */
.calculator-form {
    background: #f3f0ff;
    border: 1px solid #ddd6fe;
    border-radius: 1rem;
    padding: 1.5rem;
}
.calculator-results {
    background: #fff;
    border: 2px solid var(--gs-primary);
    border-radius: 1rem;
    padding: 1.5rem;
}

/* Tables */
article table {
    width: 100%;
}
.table thead th {
    background: var(--gs-dark);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
}
.table-hover tbody tr:hover {
    background: #ede9fe;
}

/* Review cards */
.review-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.25rem;
    background: #fff;
    margin-bottom: 1rem;
}
.review-card .review-author {
    font-weight: 600;
    color: var(--gs-dark);
}
.review-card .review-date {
    font-size: 0.8rem;
    color: #6b7280;
}
.review-card .review-game {
    font-size: 0.8rem;
    color: var(--gs-primary);
    font-weight: 600;
}

/* Buttons */
.btn-primary {
    background: var(--gs-primary);
    border-color: var(--gs-primary);
}
.btn-primary:hover {
    background: var(--gs-primary-dark);
    border-color: var(--gs-primary-dark);
}
.btn-accent {
    background: var(--gs-accent);
    color: var(--gs-dark);
    border: none;
    font-weight: 600;
}
.btn-accent:hover {
    background: #d97706;
    color: #fff;
}

/* Responsive fixes */
@media (max-width: 768px) {
    article {
        font-size: 1rem;
    }
    .navbar-brand {
        font-size: 1rem;
    }
}

/* ================================
   Comparison Builder
   ================================ */
.builder-article {
    max-width: 1100px;
}

/* Search dropdown */
.builder-search-wrap {
    position: relative;
    max-width: 500px;
}
.builder-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    max-height: 280px;
    overflow-y: auto;
}
.builder-dd-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
}
.builder-dd-item:hover {
    background: #ede9fe;
}
.builder-dd-icon {
    font-size: 1.1em;
}
.builder-dd-empty {
    padding: 0.75rem;
    color: #6b7280;
    font-size: 0.9rem;
}

/* Pills */
.builder-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border: 2px solid var(--gs-primary);
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: #fff;
    margin: 0.25rem 0.25rem 0.25rem 0;
}
.builder-pill-icon {
    font-size: 1.1em;
}
.builder-pill-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    color: #9ca3af;
    padding: 0 0.15rem;
}
.builder-pill-remove:hover {
    color: #dc2626;
}

/* Category compact guide cards */
.cat-guide-card {
    display: block;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left: 4px solid var(--gs-primary);
    border-radius: 0.5rem;
    text-decoration: none;
    transition: box-shadow 0.15s, transform 0.15s;
    height: 100%;
}
.cat-guide-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.cat-guide-name {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--gs-dark);
    margin-bottom: 0.2rem;
}
.cat-guide-card:hover .cat-guide-name {
    color: var(--gs-primary);
}
.cat-guide-meta {
    display: block;
    font-size: 0.78rem;
    color: #6b7280;
}

/* Quick-pick game grid */
.builder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.6rem;
}
.builder-game-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.6rem 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
    overflow: hidden;
}
.builder-game-btn:hover {
    border-color: var(--gs-primary-light);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.12);
}
.builder-game-btn.is-selected {
    border-color: var(--gs-primary);
    background: #f5f3ff;
    box-shadow: 0 0 0 2px var(--gs-primary-light);
}
.builder-game-btn.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}
.builder-game-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 0.4rem;
    margin-bottom: 0.4rem;
}
.builder-game-icon {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    border-radius: 0.4rem;
    margin-bottom: 0.4rem;
}
.builder-game-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
    margin-bottom: 0.15rem;
}
.builder-game-meta {
    font-size: 0.7rem;
    color: #6b7280;
}
.builder-game-check {
    position: absolute;
    top: 0.35rem;
    right: 0.4rem;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--gs-primary);
    color: #fff;
    font-size: 0.75rem;
    line-height: 22px;
    text-align: center;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.15s, transform 0.15s;
}
.builder-game-btn.is-selected .builder-game-check {
    opacity: 1;
    transform: scale(1);
}

/* Spec table */
.builder-table {
    font-size: 0.9rem;
}
.builder-table th, .builder-table td {
    white-space: nowrap;
    vertical-align: middle;
}
.builder-table thead th {
    font-size: 0.85rem;
    padding: 0.5rem 0.6rem;
}
.builder-table tbody td:first-child {
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
}
.cat-feature-col {
    min-width: 90px;
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--gs-dark) !important;
}
.builder-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
}

/* Column header with hide button */
.cat-th-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}
.cat-th-name {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cat-col-hide {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,0.5);
    width: 22px;
    height: 22px;
    padding: 0;
    flex-shrink: 0;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
}
.cat-col-hide:hover {
    color: #fff;
    background: rgba(255,255,255,0.3);
}
.cat-col-hide svg {
    display: block;
}

/* Hidden games restore bar */
.cat-hidden-bar {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.cat-hidden-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #92400e;
}
.cat-restore-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border: 2px solid #d1d5db;
    border-radius: 2rem;
    background: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s;
}
.cat-restore-pill:hover {
    background: #f0fdf4;
}
.cat-restore-plus {
    color: #16a34a;
    font-weight: 700;
}

/* Winner highlight */
.builder-winner {
    background: #dcfce7 !important;
    font-weight: 700;
}
.builder-check {
    color: #16a34a;
    font-weight: 700;
    margin-left: 0.25rem;
}

/* Visual bars */
.builder-bar-group h3 {
    margin-bottom: 0.75rem;
}
.builder-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.builder-bar-label {
    min-width: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
    flex-shrink: 0;
}
.builder-bar-track {
    flex: 1;
    height: 24px;
    background: #f3f4f6;
    border-radius: 0.5rem;
    overflow: hidden;
}
.builder-bar-fill {
    height: 100%;
    border-radius: 0.5rem;
    transition: width 0.4s ease;
    min-width: 4px;
}
.builder-bar-value {
    min-width: 70px;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Verdict cards */
.builder-verdict-card .card-header {
    font-size: 0.95rem;
}
.builder-verdict-card .card-body {
    font-size: 0.9rem;
}
.builder-verdict-card ul {
    padding-left: 1.25rem;
}
.builder-verdict-card li {
    margin-bottom: 0.35rem;
}

/* Mobile */
@media (max-width: 768px) {
    .builder-article {
        max-width: 100%;
    }
    .builder-search-wrap {
        max-width: 100%;
    }
    .builder-bar-row {
        flex-wrap: wrap;
    }
    .builder-bar-label {
        min-width: auto;
        text-align: left;
        width: 100%;
    }
    .builder-bar-track {
        min-width: 0;
    }
    .builder-bar-value {
        min-width: auto;
    }
    .builder-table th, .builder-table td {
        font-size: 0.78rem;
        padding: 0.35rem 0.4rem;
    }
    .cat-col-hide {
        font-size: 0.9rem;
    }
    .cat-hidden-bar {
        font-size: 0.8rem;
    }
}

/* Print styles */
@media print {
    nav, footer, #toc, .breadcrumb, .demo-placeholder, .demo-wrap, .btn-fullscreen, .js-only {
        display: none !important;
    }
    article {
        max-width: 100%;
    }
    main {
        padding: 0 !important;
    }
    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }
}
