:root {
    --app-bg: #eef8fc;
    --app-bg-2: #f8fcff;
    --app-surface: #ffffff;
    --app-surface-soft: #f2f8fc;
    --app-surface-strong: #101724;
    --app-border: #d5e7f0;
    --app-border-strong: #a9cfdf;
    --app-ink: #111827;
    --app-ink-rgb: 17, 24, 39;
    --app-muted: #667085;
    --app-primary: #168fd8;
    --app-primary-rgb: 22, 143, 216;
    --app-primary-dark: #0c6fa8;
    --app-accent: #c060a8;
    --app-accent-rgb: 192, 96, 168;
    --app-accent-dark: #963a7e;
    --app-success: #19a974;
    --app-warning: #b7791f;
    --app-danger: #d92d20;
    --app-radius: 8px;
    --app-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --app-shadow-soft: 0 8px 22px rgba(15, 23, 42, 0.06);
    --app-font: "Segoe UI", "Aptos", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    letter-spacing: 0;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    background: var(--app-bg);
    background-image: none;
    color: var(--app-ink);
    font-family: var(--app-font) !important;
    font-size: 15px;
    line-height: 1.45;
}

button,
input,
optgroup,
select,
textarea,
.btn,
.form-control,
.form-select,
.table,
.dataTables_wrapper,
.dropdown-menu {
    font-family: var(--app-font) !important;
}

a {
    color: var(--app-accent-dark);
}

a:hover {
    color: var(--app-primary);
}

.app-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: 64px;
    background: var(--app-surface-strong) !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18) !important;
    backdrop-filter: blur(14px);
}

.app-nav-container {
    max-width: 1240px;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: #fff !important;
    font-weight: 800;
    text-decoration: none;
}

.app-brand-logo {
    height: 34px;
    width: auto;
}

.app-main-nav {
    align-items: center;
    gap: 0.25rem;
    margin-left: 1.25rem;
}

.app-user-nav {
    margin-left: auto;
}

.app-navbar .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    min-height: 38px;
    padding: 0.45rem 0.72rem !important;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.76) !important;
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.active,
.app-navbar .nav-link.show {
    background: rgba(255, 255, 255, 0.11);
    color: #fff !important;
}

.app-navbar .nav-link.active {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.user-pill {
    background: rgba(var(--app-primary-rgb), 0.24);
    color: #fff !important;
}

.app-nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: 999px !important;
    padding: 0 !important;
    color: #fff !important;
}

.app-nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 4px auto;
    border-radius: 999px;
    background: #fff;
}

.dropdown-menu {
    padding: 0.45rem !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow) !important;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.58rem;
    min-height: 2.2rem;
    border-radius: 6px;
    color: var(--app-ink) !important;
    font-weight: 650;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: #e7f5fc !important;
    color: var(--app-primary-dark) !important;
}

.navbar .dropdown-menu {
    background: #ffffff !important;
}

.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 1040;
    display: none;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(3px);
}

.mobile-nav-dropdown {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1050;
    width: min(360px, 92vw);
    height: 100vh;
    padding: 1rem;
    background: var(--app-surface-strong);
    box-shadow: -18px 0 45px rgba(15, 23, 42, 0.28);
    transform: translateX(100%);
    transition: transform 0.22s ease;
}

.mobile-nav-dropdown.show {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.mobile-nav-user {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: #fff;
    font-weight: 800;
}

.mobile-nav-close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.mobile-nav-menu {
    padding: 0;
    margin: 0;
    list-style: none;
}

.mobile-nav-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.82rem 0.75rem;
    border-radius: var(--app-radius);
    color: rgba(255, 255, 255, 0.82);
    font-weight: 750;
    text-decoration: none;
}

.mobile-nav-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.mobile-nav-menu i {
    width: 1.2rem;
    text-align: center;
}

.page-shell {
    max-width: 1240px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-title-wrap {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 0.75rem;
}

.page-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: var(--app-radius);
    background: var(--app-primary);
    background-image: none;
    color: #fff;
    box-shadow: var(--app-shadow-soft);
}

.page-header h1 {
    margin: 0;
    color: var(--app-ink);
    font-size: clamp(1.75rem, 3vw, 2.45rem);
    font-weight: 850;
    line-height: 1.05;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.app-card,
.detail-card,
.form-container,
.form-section,
.bulk-enrich-container,
.import-container,
.chart-container,
.summary-card,
.card,
.collection-toolbar {
    background: var(--app-surface) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow-soft) !important;
}

.detail-card,
.form-container,
.bulk-enrich-container,
.import-container,
.chart-container {
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-section,
.controls-section,
.progress-section {
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--app-surface-soft) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: none !important;
}

.form-section h4,
.detail-card h3,
.detail-card h4,
.chart-title,
.card-title {
    color: var(--app-ink);
    font-size: 1.04rem;
    font-weight: 850;
}

.form-label {
    color: #344054;
    font-size: 0.86rem;
    font-weight: 750;
}

.form-control,
.form-select {
    min-height: 42px;
    border: 1px solid var(--app-border-strong) !important;
    border-radius: var(--app-radius) !important;
    background-color: #fff !important;
    color: var(--app-ink) !important;
    box-shadow: none !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 0.22rem rgba(var(--app-accent-rgb), 0.16) !important;
}

.form-check-input:checked {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
}

.form-error-message,
.is-invalid-custom {
    border-color: var(--app-danger) !important;
}

.info-field {
    background: #f2f7fb !important;
    color: #344054 !important;
    font-weight: 800 !important;
}

.info-field::before {
    content: none !important;
}

.btn {
    min-height: 40px;
    border-radius: var(--app-radius) !important;
    font-weight: 800 !important;
    letter-spacing: 0;
    box-shadow: none !important;
}

.btn-sm {
    min-height: 32px;
    font-size: 0.82rem;
}

.btn-primary {
    background: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--app-primary-dark) !important;
    border-color: var(--app-primary-dark) !important;
}

.btn-secondary,
.btn-outline-secondary:hover {
    background: #243041 !important;
    border-color: #243041 !important;
    color: #fff !important;
}

.btn-outline-primary {
    border-color: var(--app-primary) !important;
    color: var(--app-primary) !important;
}

.btn-outline-primary:hover,
.btn-check:checked + .btn-outline-primary,
.btn-outline-primary.active {
    background: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
    color: #fff !important;
}

.btn-outline-danger {
    border-color: rgba(217, 45, 32, 0.55) !important;
    color: var(--app-danger) !important;
}

.btn-outline-danger:hover {
    background: var(--app-danger) !important;
    color: #fff !important;
}

.btn-info,
.btn-outline-info:hover {
    background: #0891b2 !important;
    border-color: #0891b2 !important;
    color: #fff !important;
}

.btn-outline-info {
    border-color: #0891b2 !important;
    color: #087f99 !important;
}

.btn-success,
.btn-outline-success:hover {
    background: var(--app-success) !important;
    border-color: var(--app-success) !important;
}

.bg-primary,
.bg-info {
    background-color: var(--app-primary) !important;
}

.text-primary {
    color: var(--app-primary) !important;
}

.summary-card {
    position: relative;
    height: 100%;
    padding: 1.1rem;
    overflow: hidden;
    text-align: left;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.summary-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--app-primary);
}

.summary-card.clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--app-shadow) !important;
}

.summary-card h3 {
    margin: 0 0 0.15rem;
    font-size: clamp(1.6rem, 3vw, 2.15rem);
    font-weight: 900;
}

.summary-card p {
    margin: 0;
    color: var(--app-muted);
    font-weight: 800;
}

.metric-card h3 {
    font-size: clamp(1.35rem, 2.5vw, 1.9rem);
}

.summary-card-link {
    display: block;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.summary-card-link:hover {
    color: inherit;
}

.status-badge,
.lifecycle-badge,
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.28rem 0.65rem;
    font-size: 0.76rem;
    font-weight: 850;
    line-height: 1.1;
    white-space: nowrap;
}

.status-owned,
.status-received,
.status-played,
.status-completed,
.lifecycle-completed {
    background: rgba(25, 169, 116, 0.14);
    color: #087443;
}

.status-not-owned,
.status-not-received,
.status-not-played,
.status-not-completed,
.lifecycle-wishlist {
    background: rgba(102, 112, 133, 0.14);
    color: #475467;
}

.lifecycle-ordered {
    background: rgba(245, 165, 36, 0.17);
    color: #8a5a00;
}

.lifecycle-backlog {
    background: rgba(var(--app-primary-rgb), 0.14);
    color: var(--app-primary-dark);
}

.lifecycle-playing {
    background: rgba(var(--app-accent-rgb), 0.14);
    color: var(--app-accent-dark);
}

.filter-chip {
    background: #e7f5fc;
    color: var(--app-ink);
    border: 1px solid #c5e3f1;
}

.filter-chip button {
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0;
}

.collection-toolbar {
    padding: 1rem;
    margin-bottom: 1rem;
}

.collection-toolbar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.collection-filter-toggle {
    min-height: 3.05rem;
    border-radius: var(--app-radius);
    font-weight: 850;
}

.collection-filter-toggle.active,
.collection-filter-toggle.has-active-filters {
    color: #fff !important;
    background: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
}

.collection-filter-toggle.active:hover,
.collection-filter-toggle.has-active-filters:hover {
    color: #fff !important;
    background: var(--app-primary-dark) !important;
    border-color: var(--app-primary-dark) !important;
}

.filter-count-badge {
    display: inline-grid;
    min-width: 1.35rem;
    height: 1.35rem;
    place-items: center;
    padding: 0 0.35rem;
    color: var(--app-primary);
    font-size: 0.72rem;
    line-height: 1;
    background: #fff;
    border-radius: 999px;
}

.filter-chevron {
    transition: transform 0.16s ease;
}

.collection-filter-toggle[aria-expanded="true"] .filter-chevron {
    transform: rotate(180deg);
}

.collection-filters {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--app-border);
}

.collection-filter-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.85rem;
}

.filter-field {
    grid-column: span 2;
    min-width: 0;
}

.filter-field-search,
.filter-field-wide {
    grid-column: span 3;
}

#activeFilters {
    margin-top: 0.75rem;
}

#activeFilters:empty {
    display: none !important;
}

.collection-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.collection-sort-panel {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem;
    background: var(--app-surface-soft);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
}

.collection-sort-field {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.control-eyebrow {
    color: var(--app-muted);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

.collection-sort-field .form-select {
    width: auto;
    min-width: 168px;
    height: 2.55rem;
    border-radius: 0.75rem;
}

.collection-direction-toggle {
    height: 2.55rem;
    padding: 0.18rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.85rem;
}

.collection-direction-toggle .btn {
    min-width: 4.45rem;
    border: 0;
    border-radius: 0.65rem !important;
    color: var(--app-muted);
    font-weight: 850;
}

.collection-direction-toggle .btn.active {
    color: #fff;
    background: var(--app-primary) !important;
    border-color: transparent !important;
    box-shadow: 0 8px 16px rgba(var(--app-primary-rgb), 0.22);
}

.collection-view-toggle .btn {
    height: 3.05rem;
    min-width: 7.3rem;
    font-weight: 850;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1rem;
}

.game-card {
    display: flex;
    min-height: 100%;
    overflow: hidden;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-soft);
    transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.game-card:hover {
    color: inherit;
    transform: translateY(-2px);
    border-color: rgba(var(--app-primary-rgb), 0.36);
    box-shadow: var(--app-shadow);
}

.game-cover,
.game-cover-large,
.game-cover-small,
.game-card-cover {
    background: #dcecf5;
    object-fit: cover;
}

.cover-placeholder {
    color: #536273;
}

.cover-placeholder i {
    opacity: 0.72;
}

.game-cover {
    width: 48px;
    height: 64px;
    border-radius: 6px;
}

.game-cover-small {
    width: 42px;
    height: 56px;
    border-radius: 5px;
}

.game-cover-large {
    max-width: 275px;
    width: 100%;
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

.game-card-cover {
    width: 100%;
    height: auto; /* the img width/height attributes only reserve the 3:4 shape */
    aspect-ratio: 3 / 4;
}

.game-card-body {
    display: grid;
    gap: 0.55rem;
    padding: 0.85rem;
}

.game-card-title {
    min-height: 2.35em;
    font-weight: 900;
    line-height: 1.18;
}

.game-meta {
    color: var(--app-muted);
    font-size: 0.86rem;
}

.quick-actions,
.action-button-group {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.35rem;
}

.quick-actions {
    justify-content: flex-start;
}

.action-button-group {
    justify-content: flex-end;
    white-space: nowrap;
}

.action-button-group .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    min-height: 2rem;
    padding: 0 !important;
    flex: 0 0 auto;
    line-height: 1;
}

.actions-cell {
    width: 86px;
    min-width: 86px;
    text-align: right !important;
    white-space: nowrap;
}

.action-menu {
    min-width: 11rem;
}

.action-menu .dropdown-item i {
    width: 1rem;
    text-align: center;
}

.table-responsive {
    overflow-x: auto;
    overflow-y: visible;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-soft);
}

.dataTables_wrapper {
    color: var(--app-ink);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    padding: 0.65rem 0;
    color: var(--app-muted) !important;
    font-size: 0.88rem;
    font-weight: 750;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    margin: 0 0.35rem;
}

.collection-table,
.app-data-table,
.dataTable {
    width: 100% !important;
    table-layout: fixed;
    border-collapse: separate !important;
    border-spacing: 0;
    font-family: var(--app-font) !important;
}

.collection-table th,
.collection-table td,
.app-data-table th,
.app-data-table td,
.dataTable th,
.dataTable td {
    box-sizing: border-box;
}

.collection-table.table > :not(caption) > * > *,
.app-data-table.table > :not(caption) > * > *,
.dataTable.table > :not(caption) > * > * {
    padding: 0.56rem 0.75rem !important;
    vertical-align: middle;
    border-color: var(--app-border) !important;
    border-bottom-width: 1px !important;
    box-shadow: none !important;
}

.collection-table thead th,
.app-data-table thead th,
.dataTable thead th {
    background: var(--app-surface-strong) !important;
    color: #fff !important;
    border-color: #263345 !important;
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.collection-table tbody tr:hover td,
.app-data-table tbody tr:hover td,
.dataTable tbody tr:hover td {
    background: #f4fbfe !important;
}

.collection-table.table-striped > tbody > tr:nth-of-type(odd) > *,
.app-data-table.table-striped > tbody > tr:nth-of-type(odd) > *,
.dataTable.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: #fff;
}

.collection-table.table-striped > tbody > tr:nth-of-type(even) > *,
.app-data-table.table-striped > tbody > tr:nth-of-type(even) > *,
.dataTable.table-striped > tbody > tr:nth-of-type(even) > * {
    --bs-table-accent-bg: #fbfdff;
}

.collection-table th:nth-child(1),
.collection-table td:nth-child(1) {
    width: 72px;
}

.collection-table th:nth-child(2),
.collection-table td:nth-child(2) {
    width: 250px;
}

.collection-table th:nth-child(3),
.collection-table td:nth-child(3) {
    width: 170px;
}

.collection-table th:nth-child(4),
.collection-table td:nth-child(4),
.collection-table th:nth-child(5),
.collection-table td:nth-child(5),
.collection-table th:nth-child(6),
.collection-table td:nth-child(6),
.collection-table th:nth-child(7),
.collection-table td:nth-child(7) {
    width: 104px;
}

.collection-table th:nth-child(8),
.collection-table td:nth-child(8) {
    width: 76px;
}

.game-table-title {
    display: -webkit-box;
    max-height: 2.45em;
    overflow: hidden;
    line-height: 1.22;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.step-indicator {
    counter-reset: steps;
}

.step {
    padding: 0.75rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    color: var(--app-muted);
    text-align: center;
    font-weight: 850;
}

.step.active {
    background: var(--app-primary);
    background-image: none;
    border-color: var(--app-primary);
    color: #fff;
}

.step.completed {
    background: rgba(25, 169, 116, 0.13);
    color: #087443;
}

.mapping-row {
    padding: 0.85rem;
    margin-bottom: 0.65rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface-soft);
}

.progress-section {
    display: none;
}

.progress-section.active {
    display: block;
}

.progress {
    overflow: hidden;
    border-radius: 999px;
    background: #e6edf5;
}

.progress-bar {
    background: var(--app-primary);
    background-image: none;
}

.ai-field {
    min-width: 0;
    max-width: none;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
}

.ai-field-description {
    min-width: 0;
}

.enrich-table {
    min-width: 980px;
}

.enrich-table .checkbox-cell {
    width: 56px;
}

.enrich-table .cover-cell {
    width: 72px;
}

.enrich-table .title-cell {
    width: 190px;
}

.enrich-table .ai-field-description {
    width: 300px;
}

.enrich-table .rating-cell {
    width: 104px;
}

.enrich-table .playtime-cell {
    width: 118px;
}

.enrich-table .trailer-cell {
    width: 120px;
}

.enrich-table .actions-cell {
    width: 96px;
    min-width: 96px;
}

.diff-cell {
    display: grid;
    gap: 0.2rem;
}

.diff-text {
    display: -webkit-box;
    max-height: 4.35em;
    overflow: hidden;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.enriching {
    background-color: #fff8e7 !important;
}

.enriched {
    background-color: #eaf8f1 !important;
}

.enrich-error {
    background-color: #fff0ef !important;
}

.checkbox-cell,
.cover-cell {
    width: 1%;
}

.app-toast-container {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1080;
    display: grid;
    gap: 0.75rem;
    max-width: min(380px, calc(100vw - 2rem));
}

.app-toast {
    padding: 0.85rem 1rem;
    border-left: 4px solid var(--app-accent);
    border-radius: var(--app-radius);
    background: #111827;
    color: #fff;
    box-shadow: var(--app-shadow);
}

.app-toast.success {
    border-left-color: var(--app-success);
}

.app-toast.error {
    border-left-color: var(--app-danger);
}

.app-toast.warning {
    border-left-color: var(--app-warning);
}

.empty-state,
.loading-state {
    padding: 2rem;
    border: 1px dashed var(--app-border-strong);
    border-radius: var(--app-radius);
    background: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.detail-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 0.65rem 1rem;
    margin: 0 0 1rem;
}

.detail-field {
    min-width: 0;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--app-border);
}

.detail-field-label {
    margin: 0 0 0.15rem;
    color: var(--app-muted);
    font-size: 0.75rem;
    font-weight: 850;
    text-transform: uppercase;
}

.detail-field-value {
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 800;
}

.image-upload-area {
    position: relative;
    border: 2px dashed var(--app-border-strong);
    border-radius: var(--app-radius);
    background: linear-gradient(180deg, #ffffff 0%, #f8fcff 100%);
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.image-upload-area:hover {
    border-color: var(--app-accent);
    background: #f5fbfd;
    box-shadow: inset 0 0 0 1px rgba(var(--app-accent-rgb), 0.08);
}

.upload-placeholder-desktop i {
    color: var(--app-primary);
}

.upload-native-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    clip: rect(0, 0, 0, 0);
}

.mobile-upload-actions {
    display: none;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}

.mobile-upload-action {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    gap: 0.85rem;
    margin: 0;
    padding: 0.95rem;
    color: var(--app-ink);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: 0 8px 18px rgba(var(--app-ink-rgb), 0.04);
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.mobile-upload-action-primary {
    color: #073f62;
    background: #e8f6fd;
    border-color: rgba(var(--app-primary-rgb), 0.28);
}

.mobile-upload-action-secondary {
    color: #682455;
    background: #fff5fb;
    border-color: rgba(var(--app-accent-rgb), 0.24);
}

.mobile-upload-icon {
    display: inline-grid;
    width: 2.8rem;
    height: 2.8rem;
    flex: 0 0 auto;
    place-items: center;
    color: #fff;
    font-size: 1.15rem;
    background: var(--app-primary);
    border-radius: var(--app-radius);
    box-shadow: 0 8px 18px rgba(var(--app-primary-rgb), 0.22);
}

.mobile-upload-action-secondary .mobile-upload-icon {
    background: var(--app-accent);
    box-shadow: 0 8px 18px rgba(var(--app-accent-rgb), 0.18);
}

.mobile-upload-copy {
    display: grid;
    min-width: 0;
    gap: 0.1rem;
}

.mobile-upload-action:hover,
.mobile-upload-action:focus {
    color: var(--app-ink);
    border-color: var(--app-accent);
    box-shadow: 0 12px 24px rgba(var(--app-ink-rgb), 0.08);
    outline: none;
}

.mobile-upload-action:active,
.mobile-upload-action.is-pressing {
    transform: scale(0.98);
}

.mobile-upload-title {
    font-weight: 850;
}

.mobile-upload-subtitle {
    color: var(--app-muted);
    font-size: 0.85rem;
}

.image-upload-area.mobile-upload-mode .upload-placeholder-desktop {
    display: none !important;
}

.image-upload-area.mobile-upload-mode .mobile-upload-actions {
    display: grid;
}

.is-saving,
.changed-field {
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--app-accent-rgb), 0.16) !important;
}

.chart-shell .position-relative {
    min-height: 240px;
}

.chart-shell canvas {
    max-width: 100%;
}

.acquisition-chart-frame {
    height: 430px;
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.trailer-card .video-container {
    max-width: 860px;
    margin: 0 auto;
}

.video-container iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: var(--app-radius);
}

.modal-content {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

.modal-header,
.modal-footer {
    border-color: var(--app-border);
}

.btn-close,
button[aria-label] {
    touch-action: manipulation;
}

@media (max-width: 991.98px) {
    .app-nav-toggle {
        display: block;
    }

    .app-nav-collapse {
        display: none !important;
    }
}

@media (min-width: 992px) {
    .app-nav-collapse {
        display: flex !important;
    }
}

@media (max-width: 767.98px) {
    body {
        font-size: 14px;
    }

    .page-shell {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .page-actions {
        justify-content: flex-start;
    }

    .collection-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.7rem;
    }

    .filter-field,
    .filter-field-wide {
        grid-column: span 1;
    }

    .filter-field-search {
        grid-column: 1 / -1;
    }

    .collection-toolbar {
        padding: 0.9rem;
    }

    .collection-toolbar-head {
        align-items: stretch;
        flex-direction: column;
    }

    .collection-filter-toggle {
        width: 100%;
        justify-content: center;
    }

    .collection-toolbar-actions {
        width: 100%;
        justify-content: stretch;
        gap: 0.65rem;
    }

    .collection-sort-panel {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .collection-sort-field .form-select {
        width: 100%;
        min-width: 0;
    }

    .collection-sort-field {
        width: 100%;
    }

    .collection-direction-toggle {
        width: 100%;
    }

    .collection-direction-toggle .btn {
        flex: 1 1 0;
    }

    #clearFilters,
    .collection-view-toggle {
        flex: 1 1 auto;
    }

    .collection-view-toggle .btn {
        flex: 1 1 0;
    }

    .collection-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .game-card-title {
        font-size: 0.95rem;
    }

    .table-responsive {
        overflow-x: auto;
    }

    .acquisition-chart-frame {
        height: 320px;
    }

    .summary-card {
        padding: 0.95rem;
    }

    .app-toast-container {
        right: 0.75rem;
        bottom: 0.75rem;
    }
}

/* Library refresh: keep results visible but dimmed while new filter results load. */
#gamesTableWrap.is-refreshing,
#gamesGrid.is-refreshing {
    opacity: 0.55;
    transition: opacity 0.15s ease;
}

/* ---- Theme toggle ---- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.85) !important;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.1); }
.theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-light { display: inline; }
[data-theme="dark"] .theme-icon-dark { display: none; }
.mobile-theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.85rem 1.25rem;
    border: 0;
    background: transparent;
    color: inherit;
    font-weight: 600;
    text-align: left;
}

/* ---- Dark theme ---- */
[data-theme="dark"] {
    --app-bg: #0b1120;
    --app-bg-2: #0f172a;
    --app-surface: #131c2e;
    --app-surface-soft: #18233a;
    --app-surface-strong: #060a14;
    --app-border: #24324d;
    --app-border-strong: #33456a;
    --app-ink: #e5ecf6;
    --app-ink-rgb: 229, 236, 246;
    --app-muted: #98a6bd;
    --app-primary: #3aa8ef;
    --app-primary-rgb: 58, 168, 239;
    --app-primary-dark: #7cc4f5;
    --app-accent: #e07cc6;
    --app-accent-rgb: 224, 124, 198;
    --app-accent-dark: #ef9fd9;
    --app-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
    --app-shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.35);
    --bs-body-bg: #0b1120;
    --bs-body-color: #e5ecf6;
    --bs-border-color: #24324d;
    --bs-secondary-color: #98a6bd;
    --bs-tertiary-bg: #18233a;
    color-scheme: dark;
}
[data-theme="dark"] body { background: var(--app-bg); color: var(--app-ink); }
[data-theme="dark"] .text-muted { color: var(--app-muted) !important; }
[data-theme="dark"] .navbar .dropdown-menu,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .mobile-nav-dropdown {
    background: var(--app-surface) !important;
    color: var(--app-ink);
    border-color: var(--app-border) !important;
}
[data-theme="dark"] .dropdown-item { color: var(--app-ink); }
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus { background: var(--app-surface-soft); color: var(--app-ink); }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .dataTables_wrapper .form-control,
[data-theme="dark"] .dataTables_wrapper .form-select,
[data-theme="dark"] .info-field {
    background-color: var(--app-surface-soft) !important;
    color: var(--app-ink) !important;
    border-color: var(--app-border-strong) !important;
}
[data-theme="dark"] .form-control::placeholder { color: #7b8aa3; }
[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-select:disabled { background-color: #101827 !important; color: var(--app-muted) !important; }
[data-theme="dark"] .table,
[data-theme="dark"] .collection-table,
[data-theme="dark"] .dataTable {
    --bs-table-bg: var(--app-surface);
    --bs-table-color: var(--app-ink);
    --bs-table-striped-bg: #162036;
    --bs-table-striped-color: var(--app-ink);
    --bs-table-hover-bg: #1b2842;
    --bs-table-hover-color: var(--app-ink);
    --bs-table-border-color: var(--app-border);
    color: var(--app-ink);
}
[data-theme="dark"] .collection-table tbody tr:hover td,
[data-theme="dark"] .app-data-table tbody tr:hover td,
[data-theme="dark"] .dataTable tbody tr:hover td { background: #1b2842 !important; }
[data-theme="dark"] .collection-direction-toggle,
[data-theme="dark"] .image-upload-area { background: var(--app-surface-soft) !important; }
[data-theme="dark"] .mobile-upload-action-secondary { background: #2a1a2a; color: #f1c6e6; }
[data-theme="dark"] .enriching { background-color: #2b2412 !important; }
[data-theme="dark"] .enrich-error { background-color: #2e1414 !important; }
[data-theme="dark"] .btn-outline-secondary { color: #c8d3e3; border-color: var(--app-border-strong); }
[data-theme="dark"] .btn-outline-secondary:hover,
[data-theme="dark"] .btn-outline-secondary.active { background: var(--app-surface-soft); color: #fff; }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }
[data-theme="dark"] .page-link { background: var(--app-surface); border-color: var(--app-border); color: var(--app-ink); }
[data-theme="dark"] .page-item.active .page-link { background: var(--app-primary); border-color: var(--app-primary); }
[data-theme="dark"] .alert-info { background: #10263a; color: #bfe3fb; border-color: #1d4566; }
[data-theme="dark"] .list-group-item { background: transparent; color: var(--app-ink); border-color: var(--app-border); }
[data-theme="dark"] .cover-placeholder { background: var(--app-surface-soft) !important; color: var(--app-muted); }
[data-theme="dark"] hr { border-color: var(--app-border); opacity: 1; }
[data-theme="dark"] .lifecycle-completed { background: rgba(52, 211, 153, 0.16); color: #6ee7b7; }
[data-theme="dark"] .lifecycle-wishlist { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
[data-theme="dark"] .lifecycle-ordered { background: rgba(251, 191, 36, 0.16); color: #fcd34d; }

/* ---- Status switcher on the details page ---- */
.lifecycle-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.lifecycle-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--app-border-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--app-muted);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.lifecycle-chip:hover:not(.is-current):not(:disabled) {
    border-color: var(--app-primary);
    color: var(--app-ink);
}
.lifecycle-chip.is-current {
    border-color: transparent;
    cursor: default;
}
.lifecycle-chip:not(.is-current) {
    background: transparent !important;
}
.lifecycle-chip:not(.is-current) { color: var(--app-muted) !important; }

/* ---- Library: selection, bulk bar, costs, skeleton ---- */
.select-cover { position: relative; display: inline-block; width: 100%; }
td .select-cover { width: auto; }
.select-box {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 2;
    display: inline-flex;
    padding: 3px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.select-box input { width: 16px; height: 16px; margin: 0; cursor: pointer; }
.game-row:hover .select-box,
.game-card:hover .select-box,
.select-box:focus-within,
.select-box:has(input:checked),
body.has-bulk-bar .select-box { opacity: 1; }
@media (hover: none) { .select-box { opacity: 1; } }
.cost-original { display: block; color: var(--app-muted); font-size: 0.78rem; font-weight: 500; }
.bulk-bar {
    position: fixed;
    left: 50%;
    bottom: 16px;
    z-index: 1040;
    transform: translateX(-50%);
    width: min(980px, calc(100% - 24px));
    border: 1px solid var(--app-border-strong);
    border-radius: 14px;
    background: var(--app-surface);
    box-shadow: var(--app-shadow);
}
.bulk-bar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.65rem 0.9rem; }
.bulk-bar-inner .form-select { width: auto; min-width: 130px; }
body.has-bulk-bar .page-shell { padding-bottom: 96px !important; }
.shortcut-hint { margin: 1rem 0 0; color: var(--app-muted); font-size: 0.8rem; }
.shortcut-hint kbd { padding: 0.1rem 0.35rem; border-radius: 4px; background: var(--app-surface-soft); color: var(--app-ink); border: 1px solid var(--app-border); font-size: 0.75rem; }
.skeleton-list { display: grid; gap: 0.6rem; margin-top: 0.5rem; }
.skeleton-row { display: grid; grid-template-columns: 48px 1fr 120px 90px; align-items: center; gap: 1rem; padding: 0.75rem; border-radius: var(--app-radius); background: var(--app-surface); border: 1px solid var(--app-border); }
.skeleton-lines { display: grid; gap: 0.45rem; }
.skeleton { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--app-surface-soft) 25%, var(--app-border) 50%, var(--app-surface-soft) 75%); background-size: 200% 100%; animation: skeleton-shimmer 1.2s ease-in-out infinite; }
.skeleton-cover { width: 48px; height: 64px; }
.skeleton-line { height: 12px; width: 70%; }
.skeleton-line.short { width: 35%; }
.skeleton-cell { height: 12px; }
@keyframes skeleton-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
@media (max-width: 767.98px) {
    .skeleton-row { grid-template-columns: 48px 1fr; }
    .skeleton-cell { display: none; }
    .bulk-bar { bottom: 8px; }
}

.app-toast-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.app-toast-actions span { flex: 1 1 auto; }

/* Save/Cancel stay reachable on phones while scrolling through the long form. */
@media (max-width: 767.98px) {
    .form-actions-sticky {
        position: sticky;
        bottom: 0;
        z-index: 20;
        margin: 1rem -1rem -1rem;
        padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
        background: var(--app-surface);
        border-top: 1px solid var(--app-border);
        box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.08);
    }
    .form-actions-sticky .btn { flex: 1 1 0; }
}
.playtime-input .form-control { min-width: 0; }
.lifecycle-chip.is-current { background: var(--app-primary) !important; color: #fff !important; box-shadow: 0 4px 12px rgba(var(--app-primary-rgb), 0.3); }
.lifecycle-chip.is-current.lifecycle-completed { background: var(--app-success) !important; box-shadow: 0 4px 12px rgba(25, 169, 116, 0.3); }
.lifecycle-chip.is-current.lifecycle-playing { background: var(--app-accent) !important; box-shadow: 0 4px 12px rgba(var(--app-accent-rgb), 0.3); }
.lifecycle-chip.is-current.lifecycle-ordered { background: #d08a12 !important; }
.lifecycle-chip.is-current.lifecycle-wishlist { background: #667085 !important; }

[data-theme="dark"] .form-label,
[data-theme="dark"] .form-check-label,
[data-theme="dark"] .control-eyebrow { color: #c9d4e5; }
[data-theme="dark"] .filter-chip { background: #16304a; color: #dcebfa; border-color: #2a4d70; }
[data-theme="dark"] .filter-chip button { color: #dcebfa; }
[data-theme="dark"] .empty-state,
[data-theme="dark"] .loading-state { background: var(--app-surface); color: var(--app-ink); }
[data-theme="dark"] .mobile-upload-action { background: var(--app-surface-soft); color: var(--app-ink); }
/* Filled blue controls in dark mode use a deeper blue so white text stays readable (>= 4.5:1). */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-outline-primary.active,
[data-theme="dark"] .btn-outline-secondary.active,
[data-theme="dark"] .badge.bg-primary,
[data-theme="dark"] .bg-primary,
[data-theme="dark"] .collection-filter-toggle.active,
[data-theme="dark"] .page-item.active .page-link {
    background-color: #1668a8 !important;
    border-color: #1668a8 !important;
    color: #fff !important;
}
[data-theme="dark"] .btn-primary:hover { background-color: #1b78c0 !important; border-color: #1b78c0 !important; }
[data-theme="dark"] .filter-count-badge { background: #fff; color: #0c4f84; }

/* ---- Accessible action colours (WCAG AA 4.5:1 for text, both themes) ---- */
.btn-primary,
.btn-outline-primary.active,
.btn-outline-primary:hover,
.btn-outline-secondary.active,
.badge.bg-primary,
.bg-primary,
.collection-filter-toggle.has-active-filters,
.page-item.active .page-link,
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-outline-primary.active,
[data-theme="dark"] .btn-outline-primary:hover,
[data-theme="dark"] .btn-outline-secondary.active,
[data-theme="dark"] .badge.bg-primary,
[data-theme="dark"] .bg-primary,
[data-theme="dark"] .collection-filter-toggle.has-active-filters,
[data-theme="dark"] .page-item.active .page-link {
    background-color: #0f6aa8 !important;
    border-color: #0f6aa8 !important;
    color: #fff !important;
}
.btn-primary:hover,
.collection-filter-toggle.has-active-filters:hover,
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .collection-filter-toggle.has-active-filters:hover {
    background-color: #0b5689 !important;
    border-color: #0b5689 !important;
    color: #fff !important;
}
.btn-outline-primary { color: #0f6aa8 !important; border-color: #0f6aa8 !important; }
.btn-outline-secondary { color: #475467 !important; }
.btn-outline-danger { color: #b42318 !important; border-color: #b42318 !important; }
.btn-outline-info { color: #0e6a80 !important; border-color: #0e6a80 !important; }
.btn-outline-danger:hover, [data-theme="dark"] .btn-outline-danger:hover { background-color: #b42318 !important; border-color: #b42318 !important; color: #fff !important; }
.btn-outline-info:hover, [data-theme="dark"] .btn-outline-info:hover { background-color: #0e6a80 !important; border-color: #0e6a80 !important; color: #fff !important; }
.btn-success, [data-theme="dark"] .btn-success { background-color: #0f7a52 !important; border-color: #0f7a52 !important; color: #fff !important; }
.btn-success:hover, [data-theme="dark"] .btn-success:hover { background-color: #0b6343 !important; border-color: #0b6343 !important; color: #fff !important; }
.filter-count-badge { color: #0f6aa8 !important; }
[data-theme="dark"] .btn-outline-primary:not(.active):not(:hover) { color: #8ccdf7 !important; border-color: #4b9bd6 !important; }
[data-theme="dark"] .btn-outline-secondary:not(.active):not(.has-active-filters) { color: #c8d3e3 !important; }
[data-theme="dark"] .btn-outline-danger:not(:hover) { color: #ff9a90 !important; border-color: #e0605a !important; }
[data-theme="dark"] .btn-outline-info:not(:hover) { color: #7fd8ee !important; border-color: #3fb3cf !important; }
/* Selected status chips: one dark shade per status, unchanged on hover. */
.lifecycle-chip.is-current, .lifecycle-chip.is-current:hover { color: #fff !important; }
.lifecycle-chip.is-current.lifecycle-backlog, .lifecycle-chip.is-current.lifecycle-backlog:hover { background: #0f6aa8 !important; }
.lifecycle-chip.is-current.lifecycle-playing, .lifecycle-chip.is-current.lifecycle-playing:hover { background: #8f3277 !important; }
.lifecycle-chip.is-current.lifecycle-completed, .lifecycle-chip.is-current.lifecycle-completed:hover { background: #0f7a52 !important; }
.lifecycle-chip.is-current.lifecycle-ordered, .lifecycle-chip.is-current.lifecycle-ordered:hover { background: #8a5a00 !important; }
.lifecycle-chip.is-current.lifecycle-wishlist, .lifecycle-chip.is-current.lifecycle-wishlist:hover { background: #556070 !important; }
.mobile-theme-toggle { color: rgba(255, 255, 255, 0.82); }
.collection-direction-toggle .btn.active,
[data-theme="dark"] .collection-direction-toggle .btn.active { background: #0f6aa8 !important; color: #fff !important; }
/* ---- Dashboard widgets ---- */
.mini-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.6rem; }
.mini-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; border-radius: var(--app-radius); color: inherit; text-decoration: none; border: 1px solid var(--app-border); background: var(--app-surface-soft); }
.mini-item:hover { border-color: var(--app-primary); color: inherit; }
.mini-item img, .mini-cover-placeholder { width: 48px; height: 64px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.mini-cover-placeholder { display: inline-flex; align-items: center; justify-content: center; background: var(--app-border); color: var(--app-muted); }
.mini-text { display: grid; gap: 0.15rem; min-width: 0; }
.mini-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coming-soon-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; padding: 0.45rem 0; border-bottom: 1px solid var(--app-border); }
.coming-soon-list li:last-child { border-bottom: 0; }
.due-date { min-width: 3.5rem; font-weight: 800; color: var(--app-primary); }
.value-gain.is-up { color: var(--app-success); font-weight: 600; }
.value-gain.is-down { color: var(--app-danger); font-weight: 600; }
.detail-notes { padding: 0.75rem; border-radius: var(--app-radius); background: var(--app-surface-soft); border: 1px solid var(--app-border); }
.collector-details > summary { cursor: pointer; list-style: none; padding: 0.25rem 0; }
.collector-details > summary::-webkit-details-marker { display: none; }
.collector-details > summary::before { content: "\25B8"; display: inline-block; margin-right: 0.5rem; transition: transform 0.15s ease; color: var(--app-muted); }
.collector-details[open] > summary::before { transform: rotate(90deg); }
.form-subheading { margin: 0.75rem 0 0; font-size: 0.95rem; font-weight: 700; color: var(--app-muted); }

/* ---- Barcode scanner ---- */
.barcode-camera { position: relative; overflow: hidden; border-radius: var(--app-radius); background: #000; }
.barcode-camera video { display: block; width: 100%; max-height: 50vh; object-fit: cover; }
.barcode-guide { position: absolute; left: 12%; right: 12%; top: 38%; height: 24%; border: 2px solid rgba(255, 255, 255, 0.85); border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35); pointer-events: none; }
.online-results { position: relative; z-index: 5; margin-top: 0.35rem; max-height: 280px; overflow-y: auto; }
.btn-link { color: #0f6aa8; }
[data-theme="dark"] .btn-link { color: #8ccdf7; }

/* ---- Unfinished status (started, not being played right now) ---- */
.lifecycle-unfinished { background: rgba(99, 102, 241, 0.14); color: #4338ca; }
[data-theme="dark"] .lifecycle-unfinished { background: rgba(129, 140, 248, 0.18); color: #c7d2fe; }
.lifecycle-chip.is-current.lifecycle-unfinished, .lifecycle-chip.is-current.lifecycle-unfinished:hover { background: #4f46e5 !important; }

/* ---- My rating (personal) vs critic score (public, AI-sourced) ---- */
.my-rating { font-weight: 700; white-space: nowrap; }
.my-rating .fa-star { color: #b7791f; }
[data-theme="dark"] .my-rating .fa-star { color: #fbbf24; }
.critic-score { color: var(--app-muted); font-size: 0.85em; white-space: nowrap; }
.rating-cell { line-height: 1.25; }

/* ---- Dashboard: one-time "playing right now" checklist ---- */
.now-playing-setup-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.5rem; max-height: 360px; overflow-y: auto; padding-right: 0.25rem; }
.now-playing-setup-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.6rem; border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-surface-soft); cursor: pointer; }
.now-playing-setup-item:has(input:checked) { border-color: var(--app-primary); box-shadow: 0 0 0 2px rgba(var(--app-primary-rgb), 0.25); }
.now-playing-setup-item .form-check-input { margin: 0; flex: 0 0 auto; }
.now-playing-setup-item img, .now-playing-setup-item .mini-cover-placeholder { width: 36px; height: 48px; object-fit: cover; border-radius: 4px; flex: 0 0 auto; }

/* ---- Game panel (Library side panel and the game page) ---- */
.game-open-button { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.game-open-button:hover { color: var(--app-primary-dark); text-decoration: underline; }
.game-row.is-open > td { background: rgba(var(--app-primary-rgb), 0.12) !important; }
.game-card.is-open { outline: 3px solid var(--app-primary); outline-offset: 2px; }
.game-sheet-panel.offcanvas-end { width: min(560px, 100vw); border-left: 1px solid var(--app-border); background: var(--app-bg); color: var(--app-ink); }
.game-sheet-panel .offcanvas-header { border-bottom: 1px solid var(--app-border); background: var(--app-surface); padding: 0.6rem 1rem; }
.game-sheet-panel .offcanvas-body { padding: 1rem; }
@media (max-width: 575.98px) { .game-sheet-panel.offcanvas-end { width: 100vw; border-left: 0; } }

.game-sheet { display: flex; flex-direction: column; gap: 0.85rem; }
.game-sheet[data-mode="page"] { max-width: 980px; }
.sheet-header { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 1rem; align-items: start; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); padding: 1rem; }
.game-sheet[data-mode="page"] .sheet-header { grid-template-columns: 220px minmax(0, 1fr); }
@media (max-width: 575.98px) { .sheet-header, .game-sheet[data-mode="page"] .sheet-header { grid-template-columns: 96px minmax(0, 1fr); gap: 0.75rem; padding: 0.75rem; } }
.sheet-cover { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem; width: 100%; aspect-ratio: 3 / 4; border-radius: 6px; overflow: hidden; background: var(--app-surface-soft); border: 1px solid var(--app-border); color: var(--app-muted); text-decoration: none; }
.sheet-cover img { width: 100%; height: 100%; object-fit: cover; }
.sheet-cover-empty { border-style: dashed; font-size: 0.85rem; }
.sheet-cover-empty .fa-image { font-size: 1.6rem; }
.sheet-heading { min-width: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.sheet-title { font-size: 1.25rem; font-weight: 800; margin: 0; line-height: 1.25; }
.game-sheet[data-mode="page"] .sheet-title { font-size: 1.6rem; }
.sheet-inline-edit { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 4px; }
.sheet-inline-edit .fa-pen { font-size: 0.7em; margin-left: 0.45rem; color: var(--app-muted); opacity: 0; transition: opacity 0.15s ease; }
.sheet-inline-edit:hover .fa-pen, .sheet-inline-edit:focus-visible .fa-pen { opacity: 1; }
.sheet-inline-edit:hover { background: rgba(var(--app-primary-rgb), 0.08); }
.sheet-subtitle { color: var(--app-muted); font-size: 0.92rem; }
.sheet-publisher { color: var(--app-muted); }
.sheet-parent { font-size: 0.9rem; }
.sheet-status { gap: 0.3rem; }
.sheet-status .lifecycle-chip { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.sheet-rating { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; }
.sheet-row-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--app-muted); }
.star-rating { display: inline-flex; gap: 0.05rem; }
.star-rating .star { border: 0; background: none; padding: 0.1rem; font-size: 1.05rem; line-height: 1; color: var(--app-border-strong); cursor: pointer; border-radius: 4px; }
.star-rating .star.is-on { color: #b7791f; }
[data-theme="dark"] .star-rating .star.is-on { color: #fbbf24; }
.star-rating.is-previewing .star { color: var(--app-border-strong); }
.star-rating.is-previewing .star.is-preview { color: #d69e2e; }
.star-rating .star:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 1px; }
.sheet-rating-value { font-weight: 700; }
.sheet-rating .sheet-editor { width: 120px; }
.sheet-play-summary { line-height: 1.4; }
.sheet-statusline { min-height: 1.4rem; font-size: 0.88rem; color: var(--app-muted); }
.sheet-statusline.is-saved { color: #087443; }
[data-theme="dark"] .sheet-statusline.is-saved { color: #6ee7b7; }
.sheet-group { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); padding: 0.85rem 1rem; }
.sheet-group-title { font-size: 0.82rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--app-muted); margin: 0 0 0.5rem; }
.sheet-group-note { font-size: 0.82rem; color: var(--app-muted); margin: -0.25rem 0 0.5rem; }
.sheet-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.15rem 1rem; margin: 0; }
.game-sheet[data-mode="page"] .sheet-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 575.98px) { .sheet-fields, .game-sheet[data-mode="page"] .sheet-fields { grid-template-columns: minmax(0, 1fr); } }
.sheet-field { min-width: 0; padding: 0.3rem 0; }
.sheet-field.is-wide, .sheet-field.is-editing.is-wide { grid-column: 1 / -1; }
.sheet-field dt { font-size: 0.75rem; font-weight: 600; color: var(--app-muted); margin-bottom: 0.1rem; }
.sheet-field dd { margin: 0; display: flex; align-items: baseline; gap: 0.35rem; min-width: 0; }
.sheet-value { display: block; width: 100%; min-height: 1.8rem; border: 1px solid transparent; border-radius: 6px; background: none; padding: 0.15rem 0.4rem; margin-left: -0.4rem; color: var(--app-ink); font: inherit; text-align: left; cursor: text; overflow-wrap: anywhere; white-space: pre-line; }
.sheet-value:hover { border-color: var(--app-border-strong); background: var(--app-surface-soft); }
.sheet-value:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 1px; }
.sheet-field.is-empty .sheet-value { color: var(--app-muted); font-style: italic; }
.sheet-field.is-readonly dd { padding: 0.15rem 0; }
.sheet-field-link { color: var(--app-primary-dark); flex: 0 0 auto; }
.sheet-field[data-field="description"] .sheet-value { max-height: 12rem; overflow-y: auto; }
.sheet-editor { width: 100%; }
.sheet-editor-hint { font-size: 0.75rem; color: var(--app-muted); margin-top: 0.2rem; }
.sheet-proposal { background: var(--app-surface); border: 2px solid var(--app-primary); border-radius: var(--app-radius); padding: 0.85rem 1rem; }
.sheet-proposal-item { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.35rem 0; border-top: 1px solid var(--app-border); cursor: pointer; }
.sheet-proposal-item:first-of-type { border-top: 0; }
.sheet-proposal-item .form-check-input { margin-top: 0.2rem; flex: 0 0 auto; }
.sheet-menu .dropdown-item { display: flex; align-items: center; gap: 0.5rem; }
.sheet-menu .dropdown-item i { width: 1rem; text-align: center; }
.min-w-0 { min-width: 0; }
.game-table-title.game-open-button { display: -webkit-box; font-weight: 700; }
.game-card-title.game-open-button { font-weight: 900; }
.sheet-value.is-url { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Wide screens: the list moves over so the panel sits beside it instead of on top of it. */
@media (min-width: 1500px) {
    body.game-sheet-open .page-shell { margin-right: 560px; max-width: calc(100vw - 580px); }
}
/* Game page: cover and status on the left (kept in view), details on the right. */
@media (min-width: 992px) {
    .game-sheet[data-mode="page"] { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 1rem; max-width: none; align-items: start; }
    .game-sheet[data-mode="page"] > * { grid-column: 2; }
    .game-sheet[data-mode="page"] > .sheet-header { grid-column: 1; grid-row: 1 / span 30; position: sticky; top: 1rem; grid-template-columns: minmax(0, 1fr); }
    .game-sheet[data-mode="page"] .sheet-cover { max-width: 260px; margin: 0 auto; }
    .game-sheet[data-mode="page"] .sheet-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1400px) {
    .game-sheet[data-mode="page"] .sheet-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.sheet-statusline-slot:empty { display: none; }
.sheet-field-action { flex: 0 0 auto; padding: 0.1rem 0.4rem; }

/* ---- Dashboard: needs attention ---- */
.attention-pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.75rem; border-radius: 999px; border: 1px solid var(--app-border-strong); background: var(--app-surface-soft); color: var(--app-ink); text-decoration: none; font-size: 0.88rem; }
.attention-pill:hover { border-color: var(--app-primary); color: var(--app-ink); background: rgba(var(--app-primary-rgb), 0.08); }
.attention-pill strong { color: var(--app-primary-dark); }
.attention-card kbd { font-size: 0.75rem; }
.sheet-followup { background: var(--app-surface); border: 2px solid var(--app-success); border-radius: var(--app-radius); padding: 0.85rem 1rem; }

/* ---- Add game: find box and status chips ---- */
.quick-find { border: 2px solid rgba(var(--app-primary-rgb), 0.35); }
.btn-check + .lifecycle-chip { cursor: pointer; }
.btn-check:focus-visible + .lifecycle-chip { outline: 2px solid var(--app-primary); outline-offset: 2px; }
.btn-check:checked + .lifecycle-chip { color: #fff !important; border-color: transparent; }
.btn-check:checked + .lifecycle-chip.lifecycle-wishlist { background: #556070 !important; }
.btn-check:checked + .lifecycle-chip.lifecycle-ordered { background: #8a5a00 !important; }
.btn-check:checked + .lifecycle-chip.lifecycle-backlog { background: #0f6aa8 !important; }
.btn-check:checked + .lifecycle-chip.lifecycle-playing { background: #8f3277 !important; }
.btn-check:checked + .lifecycle-chip.lifecycle-unfinished { background: #4f46e5 !important; }
.btn-check:checked + .lifecycle-chip.lifecycle-completed { background: #0f7a52 !important; }
.more-details > summary { cursor: pointer; }
