/* styles.css */
:root {
    --accent-color: #ff4500;
    --accent-text-color: #ffffff;
    --trending-glow: linear-gradient(135deg, #ff416c, #ff4b2b);
    --trending-color: #ff416c;
    --new-glow: linear-gradient(135deg, #a855f7, #7c3aed);
    --new-color: #a855f7;
    --continue-glow: linear-gradient(135deg, #38bdf8, #2563eb);
    --continue-color: #3b82f6;
}

[data-bs-theme="light"] {
    --accent-color: #ff4500;
    --accent-text-color: #ffffff;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body[data-bs-theme="dark"] {
    background-color: #0f0f11;
    color: #f0f0f2;
}

body[data-bs-theme="light"] {
    background-color: #f4f5f6;
    color: #1f2026;
}

a,
button,
.thing-card,
.category-link {
    touch-action: manipulation;
}

.navbar {
    min-height: 64px;
    z-index: 1030;
}

body[data-bs-theme="dark"] .navbar {
    background-color: #16161a !important;
    border-bottom: 1px solid #232329 !important;
}

body[data-bs-theme="light"] .navbar {
    background-color: #ffffff !important;
    border-bottom: 1px solid #e5e7eb !important;
}

.navbar-logo {
    height: 30px;
    width: auto;
    object-fit: contain;
    margin-left: 20px;
}

.search-wrapper {
    position: relative;
    max-width: 380px;
    width: 100%;
    margin: 0 auto;
}

.search-icon-left {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    pointer-events: none;
    opacity: 0.65;
    display: inline-flex;
    align-items: center;
}

.nav-search-bar {
    font-size: 0.9rem;
    border-radius: 8px;
    padding-left: 38px;
    padding-right: 36px;
    transition: border 0.15s ease, background-color 0.15s ease;
}

body[data-bs-theme="dark"] .nav-search-bar {
    background-color: #1f2026 !important;
    border: 1px solid #2d2d35 !important;
    color: #ffffff !important;
}

body[data-bs-theme="light"] .nav-search-bar {
    background-color: #f3f4f6 !important;
    border: 1px solid #d1d5db !important;
    color: #1f2026 !important;
}

html body .nav-search-bar:focus {
    border: 2px solid var(--accent-color) !important;
    box-shadow: none !important;
    outline: none !important;
}

.nav-search-bar::placeholder {
    color: #6c727f;
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c727f;
    font-size: 1rem;
    padding: 2px 6px;
    cursor: pointer;
    display: none;
    border-radius: 4px;
    align-items: center;
    justify-content: center;
}

.search-clear-btn:hover {
    color: #ef4444;
}

.app-main-frame {
    display: flex;
    width: 100%;
    height: calc(100dvh - 64px);
    overflow: hidden;
}

.sidebar-pane {
    width: 208px;
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
    border-right: 1px solid #232329;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

body[data-bs-theme="dark"] .sidebar-pane {
    background-color: #141417;
    border-right-color: #232329;
}

body[data-bs-theme="light"] .sidebar-pane {
    background-color: #ffffff;
    border-right-color: #e5e7eb;
}

.theme-toggle-btn {
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle-btn:hover {
    border-color: var(--accent-color) !important;
    color: var(--accent-color) !important;
    background-color: transparent !important;
}

.content-pane {
    flex-grow: 1;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    -webkit-overflow-scrolling: touch;
}

.category-link,
.pseudo-category-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0 12px;
    height: 40px;
    color: #9da3ae;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.92rem;
    transition: background-color 0.15s, color 0.15s;
    margin-bottom: 3px;
    line-height: 1;
    text-decoration: none;
}

.category-link i,
.pseudo-category-link i {
    font-size: 1.1rem;
}

body[data-bs-theme="light"] .category-link,
body[data-bs-theme="light"] .pseudo-category-link {
    color: #4b5563;
}

.category-link:hover,
.pseudo-category-link:hover {
    background-color: rgba(120, 120, 120, 0.15);
}

body[data-bs-theme="dark"] .category-link:hover,
body[data-bs-theme="dark"] .pseudo-category-link:hover {
    color: #ffffff;
}

body[data-bs-theme="light"] .category-link:hover,
body[data-bs-theme="light"] .pseudo-category-link:hover {
    color: #000000;
}

.category-activated {
    background-color: var(--accent-color) !important;
    color: var(--accent-text-color) !important;
    font-weight: 600;
}

.category-link.cat-btn-trending-tab {
    background: linear-gradient(90deg, rgba(255, 75, 43, 0.08), transparent);
    border-left: 3px solid #ff4b2b;
    color: #ff6b6b;
}

.category-link.cat-btn-trending-tab.category-activated {
    background: var(--trending-glow) !important;
    color: #ffffff !important;
    border-left: 3px solid transparent;
}

.category-link.cat-btn-new-tab {
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.08), transparent);
    border-left: 3px solid var(--new-color);
    color: var(--new-color);
}

.category-link.cat-btn-new-tab.category-activated {
    background: var(--new-glow) !important;
    color: #ffffff !important;
    border-left: 3px solid transparent;
}

.category-link.cat-btn-continue-tab {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.08), transparent);
    border-left: 3px solid var(--continue-color);
    color: var(--continue-color);
}

.category-link.cat-btn-continue-tab.category-activated {
    background: var(--continue-glow) !important;
    color: #ffffff !important;
    border-left: 3px solid transparent;
}

.menu-divider {
    height: 1px;
    margin: 12px 8px;
}

body[data-bs-theme="dark"] .menu-divider {
    background-color: #232329;
}

body[data-bs-theme="light"] .menu-divider {
    background-color: #e5e7eb;
}

/* Card grid. Density is driven purely by these breakpoints - the game cards are
   ~2/3 of their old size at every width (the old grid was 2 / 4 / 6 columns):
   phones 3, tablets 6 (the iPad case: it used to fit 4), desktop 8, and 10 only on
   genuinely wide displays so a normal 1920 PC does not end up with small cards. */
.game-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
}

@media (min-width: 768px) {
    .game-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .game-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }
}

@media (min-width: 2000px) {
    .game-grid {
        grid-template-columns: repeat(10, minmax(0, 1fr));
    }
}

.game-card-cell {
    min-width: 0;
}

.game-card-cell[hidden] {
    display: none;
}

.shelf-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.shelf-title i {
    font-size: 1.4rem;
}

/* Heading row: title on the left, "See all" on the right. */
.shelf-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.see-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid #2d2d35;
    background: transparent;
    color: #9da3ae;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.see-all-btn i {
    font-size: 0.85rem;
}

.see-all-btn:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
    background-color: rgba(255, 69, 0, 0.08);
}

body[data-bs-theme="light"] .see-all-btn {
    border-color: #d1d5db;
    color: #4b5563;
}

html body .thing-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid transparent !important;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.1s ease, border-width 0.1s ease;
}

body[data-bs-theme="dark"] .thing-card {
    background-color: #16161a !important;
    border-color: #232329 !important;
}

body[data-bs-theme="light"] .thing-card {
    background-color: #ffffff !important;
    border-color: #e5e7eb !important;
}

@media (hover: hover) {
    html body .thing-card:hover {
        transform: translateY(-4px);
        border: 3px solid var(--accent-color) !important;
    }
}

.thing-card:active {
    transform: scale(0.98);
}

body[data-bs-theme="dark"] .thing-card:active {
    background-color: #1f2026 !important;
}

body[data-bs-theme="light"] .thing-card:active {
    background-color: #f3f4f6 !important;
}

.thing-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

body[data-bs-theme="dark"] .thing-card img {
    border-bottom: 1px solid #232329;
}

body[data-bs-theme="light"] .thing-card img {
    border-bottom: 1px solid #e5e7eb;
}

.card-title-custom {
    /* Cards run 6-across from tablet size up, so the title has to be compact
       enough that two-word names still fit on one or two lines. */
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    line-height: 1.2;
    /* Always reserve two lines: a one-line name and a three-line name used to give
       the cards different amounts of text padding, so the images no longer lined up
       across a row. Two lines are clamped with an ellipsis instead. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* Fixed caption strip so every card in a row is the same shape. */
.thing-card .card-body {
    height: 46px;
    overflow: hidden;
}

.game-badges {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.game-badge {
    padding: 3px 6px;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    line-height: 1;
    white-space: nowrap;
}

.badge-new {
    background-color: #10b981;
    color: #ffffff;
}

.badge-desktop-only {
    background-color: #ef4444;
    color: #ffffff;
}

.site-footer {
    border-top: 1px solid #232329;
    padding: 20px;
    margin-top: auto;
}

body[data-bs-theme="dark"] .site-footer {
    background-color: #141417;
    border-top-color: #232329;
}

body[data-bs-theme="light"] .site-footer {
    background-color: #ffffff;
    border-top-color: #e5e7eb;
}

.mirror-link {
    font-size: 0.85rem;
    color: #8a8d98;
    text-decoration: none;
    padding: 6px 12px;
    transition: color 0.2s ease, background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
}

.mirror-link::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    opacity: 0.7;
}

.mirror-link:hover {
    color: var(--accent-text-color);
    background-color: rgba(120, 120, 120, 0.15);
}

.about-section {
    padding: 28px 20px;
}

body[data-bs-theme="dark"] .about-section {
    background-color: #141417;
    border-top: 1px solid #232329;
}

body[data-bs-theme="light"] .about-section {
    background-color: #ffffff;
    border-top: 1px solid #e5e7eb;
}

.about-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.seo-slop {
    font-size: 0.85rem;
    line-height: 1.7;
    color: #8a8d98;
    margin: 0;
    max-width: 900px;
}

body[data-bs-theme="light"] .seo-slop {
    color: #6b7280;
}

#trending-games {
    color: var(--trending-color);
}

#new-games {
    color: var(--new-color);
}

#continue-games {
    color: var(--continue-color);
}

.quick-exit-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.15s ease;
    white-space: nowrap;
    margin-right: 10px;
}

body[data-bs-theme="dark"] .quick-exit-btn {
    background-color: #1f2026;
    border: 1px solid #2d2d35;
    color: #ef4444;
}

body[data-bs-theme="light"] .quick-exit-btn {
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #dc2626;
}

.quick-exit-btn:hover {
    background-color: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
}

.quick-exit-btn i {
    font-size: 1.1rem;
}

.clear-continue-btn {
    background: none;
    border: none;
    color: #6c727f;
    font-size: 1.2rem;
    padding: 0;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.2s ease, transform 0.2s ease;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.clear-continue-btn:hover {
    color: #ef4444;
    transform: scale(1.1);
}

@media (max-width: 767.98px) {
    .navbar {
        padding: 0.5rem 0.5rem !important;
    }
    .navbar-brand img {
        height: 24px;
    }
    .search-wrapper {
        max-width: 150px;
    }
    .nav-search-bar {
        font-size: 0.8rem;
        padding-left: 28px;
        padding-right: 20px;
    }
    .search-icon-left {
        left: 6px;
        font-size: 0.85rem;
    }
    .search-clear-btn {
        right: 2px;
        font-size: 0.85rem;
    }
    .quick-exit-btn {
        padding: 0.25rem 0.75rem;
        font-size: 0.8rem;
        margin-right: 5px;
    }
}

.changelog-entry {
    padding: 12px 0;
    border-bottom: 1px solid rgba(120, 120, 120, 0.2);
}

.changelog-entry:last-child {
    border-bottom: none;
}

.changelog-date {
    color: #8a8d98;
    margin-bottom: 2px;
}

.changelog-title {
    margin-bottom: 6px;
}

.changelog-notes {
    margin: 0;
    padding-left: 20px;
    font-size: 0.9rem;
}

.changelog-notes li {
    margin-bottom: 2px;
}

/* The changelog entry is a <button> (it opens a modal) rather than an <a>, but it
   sits in the same list and must not look different: no colour override here, so
   .pseudo-category-link's grey applies like every other sidebar row. */
button.changelog-link {
    cursor: pointer;
}

.sidebar-pane::-webkit-scrollbar,
.content-pane::-webkit-scrollbar {
    width: 4px;
}

.sidebar-pane::-webkit-scrollbar-track,
.content-pane::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-pane::-webkit-scrollbar-thumb,
.content-pane::-webkit-scrollbar-thumb {
    background: #2d2d35;
    border-radius: 4px;
}