/* ============================================================
   Game Library - lista gier
   ============================================================ */
.game-library {
    max-width: var(--app-page-max-width, 1200px);
    margin: 0 auto;
    padding: var(--app-page-padding-y, 1.5rem) var(--app-page-padding-x, 1.5rem);
}

/* Authenticated theme overrides (kept at end to win cascade) */
.page.theme-dark .game-library,
.page.theme-dark .pricing-page,
.page.theme-dark .account-security-page,
.page.theme-dark .upload-page,
.page.theme-dark .viewer-wrapper {
    background: transparent;
}

.page.theme-dark .game-library-header,
.page.theme-dark .account-security-card,
.page.theme-dark .pricing-card,
.page.theme-dark .upload-card,
.page.theme-dark .upload-card-header,
.page.theme-dark .chat-warning-card,
.page.theme-dark .game-card,
.page.theme-dark .pdf-details,
.page.theme-dark .pdf-tab,
.page.theme-dark .chat-panel,
.page.theme-dark .msg-row.bot-row .msg-bubble,
.page.theme-dark .chat-input-area {
    background: linear-gradient(150deg, rgba(13, 25, 48, 0.9), rgba(30, 42, 69, 0.78)) !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
    color: #e5e7eb !important;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.28) !important;
}

.page.theme-dark .pdf-tabs,
.page.theme-dark .chat-warning-wrap,
.page.theme-dark .chat-panel.fullscreen {
    background: rgba(2, 6, 23, 0.62) !important;
}

.page.theme-dark .game-library-header h2,
.page.theme-dark .game-card-title,
.page.theme-dark .pdf-details-title,
.page.theme-dark .chat-warning-title,
.page.theme-dark .pricing-plan-top h3,
.page.theme-dark .pricing-price,
.page.theme-dark .upload-card-title,
.page.theme-dark .upload-label,
.page.theme-dark .upload-file-name,
.page.theme-dark .chat-header-name {
    color: #f8fafc !important;
}

.page.theme-dark .game-library-header p,
.page.theme-dark .game-search-meta,
.page.theme-dark .game-pager-info,
.page.theme-dark .chat-warning-card p,
.page.theme-dark .pricing-feature-list,
.page.theme-dark .upload-card-subtitle,
.page.theme-dark .upload-files-title,
.page.theme-dark .upload-hint,
.page.theme-dark .game-card-meta,
.page.theme-dark .chat-header-status,
.page.theme-dark .chat-empty,
.page.theme-dark .chat-input-area {
    color: #cbd5e1 !important;
}

.page.theme-dark .upload-card-header {
    border-bottom-color: rgba(148, 163, 184, 0.25) !important;
}

.page.theme-dark .bgg-panel {
    background: transparent !important;
    border-color: transparent !important;
}

.page.theme-dark .game-search-input,
.page.theme-dark .upload-input,
.page.theme-dark .upload-input-file,
.page.theme-dark .game-pager-btn,
.page.theme-dark .chat-restore-btn,
.page.theme-dark .upload-file-action-btn,
.page.theme-dark .upload-file-item,
.page.theme-dark .upload-dropzone,
.page.theme-dark .pdf-note-open-btn,
.page.theme-dark .pdf-note-page-btn,
.page.theme-dark .pdf-note-delete-btn,
.page.theme-dark .chat-textarea {
    background: rgba(15, 23, 42, 0.68) !important;
    border-color: rgba(148, 163, 184, 0.35) !important;
    color: #e5e7eb !important;
}

.page.theme-dark .pdf-notes-panel,
.page.theme-dark .pdf-notes-list li,
.page.theme-dark .pdf-note-modal {
    background: linear-gradient(150deg, rgba(13, 25, 48, 0.9), rgba(30, 42, 69, 0.78)) !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
    color: #e5e7eb !important;
}

.page.theme-dark .pdf-note-title,
.page.theme-dark .pdf-note-modal h4,
.page.theme-dark .pdf-notes-header h4 {
    color: #f8fafc !important;
}

.page.theme-dark .pdf-note-content,
.page.theme-dark .pdf-notes-empty,
.page.theme-dark .pdf-note-form-row label {
    color: #cbd5e1 !important;
}

.page.theme-dark .upload-file-item-new {
    background: rgba(154, 52, 18, 0.22) !important;
}

.page.theme-dark .upload-file-item-marked {
    background: rgba(127, 29, 29, 0.3) !important;
    border-color: rgba(248, 113, 113, 0.55) !important;
}

.page.theme-dark .upload-limit-note {
    background: rgba(120, 53, 15, 0.28) !important;
    border-color: rgba(251, 191, 36, 0.55) !important;
    color: #fcd34d !important;
}

/* Authenticated theme overrides */
.page.theme-dark .game-library-header,
.page.theme-dark .account-security-card,
.page.theme-dark .pricing-card,
.page.theme-dark .upload-card,
.page.theme-dark .chat-warning-card,
.page.theme-dark .game-card,
.page.theme-dark .pdf-details,
.page.theme-dark .pdf-tab,
.page.theme-dark .chat-panel,
.page.theme-dark .msg-row.bot-row .msg-bubble {
    background: linear-gradient(150deg, rgba(13, 25, 48, 0.9), rgba(30, 42, 69, 0.78));
    border-color: rgba(148, 163, 184, 0.25) !important;
    color: #e5e7eb;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.28);
}

.page.theme-dark .game-library-header h2,
.page.theme-dark .game-card-title,
.page.theme-dark .pdf-details-title,
.page.theme-dark .chat-warning-title,
.page.theme-dark .pricing-plan-top h3,
.page.theme-dark .pricing-price,
.page.theme-dark .upload-label,
.page.theme-dark .upload-file-name {
    color: #f8fafc !important;
}

.page.theme-dark .game-library-header p,
.page.theme-dark .game-search-meta,
.page.theme-dark .game-pager-info,
.page.theme-dark .chat-warning-card p,
.page.theme-dark .pricing-feature-list,
.page.theme-dark .upload-files-title,
.page.theme-dark .upload-hint,
.page.theme-dark .game-card-meta {
    color: #cbd5e1 !important;
}

/* Dark-theme game-card badges / chips */
.page.theme-dark .game-card-badge {
    background: rgba(251, 146, 60, 0.18);
    color: #fed7aa;
    border-color: rgba(251, 146, 60, 0.4);
}

.page.theme-dark .game-card-badge-empty {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.3);
}

.page.theme-dark .game-card-badge-bgg {
    background: rgba(249, 115, 22, 0.18);
    color: #fdba74;
    border-color: rgba(249, 115, 22, 0.4);
}

.page.theme-dark .game-card-badge-bgg:hover {
    background: rgba(249, 115, 22, 0.28);
    color: #fed7aa;
}

.game-card-badge-warning {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #be123c;
}

.page.theme-dark .game-card-badge-warning {
    background: rgba(190, 24, 93, 0.2);
    border-color: rgba(244, 114, 182, 0.4);
    color: #fda4af;
}

.page.theme-dark .game-card-chip {
    background: rgba(15, 23, 42, 0.75);
    border-color: rgba(255, 255, 255, 0.2);
    color: #f1f5f9;
}

.page.theme-dark .game-edit-mini-btn {
    border-color: rgba(148, 163, 184, 0.6);
    background: rgba(2, 6, 23, 0.78);
    color: #e2e8f0;
}


.page.theme-dark .game-search-input,
.page.theme-dark .upload-input,
.page.theme-dark .upload-input-file,
.page.theme-dark .game-pager-btn,
.page.theme-dark .chat-restore-btn,
.page.theme-dark .pdf-tabs,
.page.theme-dark .upload-file-action-btn,
.page.theme-dark .upload-file-item,
.page.theme-dark .upload-dropzone {
    background: rgba(15, 23, 42, 0.68) !important;
    border-color: rgba(148, 163, 184, 0.35) !important;
    color: #e5e7eb !important;
}

.page.theme-dark .upload-file-item-new {
    background: rgba(154, 52, 18, 0.22) !important;
}

.page.theme-dark .upload-file-item-marked {
    background: rgba(127, 29, 29, 0.3) !important;
    border-color: rgba(248, 113, 113, 0.55) !important;
}

.page.theme-dark .upload-limit-note {
    background: rgba(120, 53, 15, 0.28) !important;
    border-color: rgba(251, 191, 36, 0.55) !important;
    color: #fcd34d !important;
}

.page.theme-dark .chat-warning-wrap,
.page.theme-dark .chat-panel.fullscreen {
    background: rgba(2, 6, 23, 0.62) !important;
}

.page.theme-dark .pdf-tabs,
.page.theme-dark .pdf-details {
    border-bottom-color: rgba(148, 163, 184, 0.22) !important;
}

.game-card-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
    margin: 0 1rem 1rem 1rem;
}

.game-card-actions .game-card-btn {
    margin: 0;
    width: 100%;
    min-height: 38px;
    padding: 0.52rem 0.65rem;
    font-size: 0.84rem;
    line-height: 1.2;
}

.game-card-actions .game-card-btn:first-child {
    font-size: 0.88rem;
}

.game-card-btn-secondary {
    background: #fffaf0;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.game-card-btn-secondary:hover {
    background: #fff7ed;
}

.game-card-disabled {
    cursor: default;
}

.game-card-disabled:hover {
    transform: none;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.page.theme-dark .game-card-btn-secondary {
    background: rgba(30, 41, 59, 0.75);
    border-color: rgba(251, 146, 60, 0.45);
    color: #fed7aa;
}

.page.theme-dark .game-library-actions .game-pager-btn {
    background: linear-gradient(135deg, #e07a5f 0%, #f2a65a 100%) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 4px 12px rgba(224, 122, 95, 0.3) !important;
}

.game-library-header {
    margin-top: .5rem;
    margin-bottom: 1.5rem;
    margin-left: 1rem;
    margin-right: 1rem;
    padding: 1rem 1.15rem;
    border: 1px solid #f0e3cb;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffffff 0%, #fffaf0 52%, #fff7ed 100%);
    box-shadow: 0 6px 16px rgba(59, 130, 246, .08);
}

.game-library-header h2 {
    font-size: 1.45rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.game-library-header p {
    font-size: .9rem;
    color: #64748b;
    margin: .25rem 0 0;
    line-height: 1.35;
}

.game-library-toolbar {
    margin-top: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.game-library-filters {
    margin-top: 0.75rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
    align-items: end;
    padding: 0.8rem;
    border: 1px solid #f0e3cb;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #fffaf0 52%, #fff7ed 100%);
    overflow: visible;
}

.game-filters-toggle-btn {
    display: none;
}

.game-filter-group {
    display: grid;
    grid-template-rows: auto auto;
    gap: 0.35rem;
    min-width: 0;
}

.game-filter-group-compact {
    min-width: 0;
}

.game-filter-label {
    display: flex;
    align-items: flex-end;
    min-height: 2.05rem;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.game-filter-actions {
    display: flex;
    align-items: flex-end;
    min-width: 0;
}

.game-filter-actions .game-pager-btn {
    width: 100%;
    min-height: 38px;
    white-space: nowrap;
}

.game-filter-select,
.game-filter-input {
    width: 100%;
    min-width: 0;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    padding: 0.52rem 0.68rem;
    font-size: 0.86rem;
    outline: none;
    background-color: #fff;
    color: #334155;
    min-height: 38px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.game-filter-select {
    color-scheme: light;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2364758b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: right 0.75rem center;
    background-size: 12px 8px;
    background-repeat: no-repeat;
}

.game-filter-input::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.game-filter-select:focus,
.game-filter-input:focus {
    border-color: #e07a5f;
    box-shadow: 0 0 0 3px rgba(224,122,95,0.12);
}

.game-library-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.game-search-input {
    width: min(420px, 100%);
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    font-size: 0.92rem;
    outline: none;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.game-sort-select {
    width: min(250px, 100%);
}

.game-search-input:focus {
    border-color: #e07a5f;
    box-shadow: 0 0 0 3px rgba(224,122,95,0.12);
}

.game-search-meta {
    color: #6b7280;
    font-size: 0.86rem;
    font-weight: 600;
}

.game-filter-select option {
    color: #0f172a;
    background: #ffffff;
    font-weight: 500;
    padding: 0.45rem 0.6rem;
}

.game-filter-select option:checked {
    color: #431407;
    background: linear-gradient(135deg, #fff3e6 0%, #fed7aa 100%);
}

.game-filter-select option:hover {
    background: #fff7ed;
}

.account-security-page {
    max-width: 1100px;
    margin: 0 auto;
}

.account-security-page .game-library-header {
    max-width: 680px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.upload-page .game-library-header {
    max-width: 680px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.account-security-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    max-width: 680px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 1.2rem;
}

.upload-page .upload-card {
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

.pricing-page {
    max-width: 1100px;
    margin: 0 auto;
}

.pricing-page .game-library-header {
    max-width: 680px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1rem;
    padding: 0 1rem;
}

.pricing-page .pricing-grid {
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
}

.pricing-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.pricing-card-current {
    border-color: #fdba74;
    box-shadow: 0 0 0 2px rgba(224, 122, 95, .15);
}

.pricing-plan-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.pricing-plan-top h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1.6rem;
    font-weight: 700;
}

.pricing-current-badge {
    font-size: .73rem;
    color: #fff;
    border-radius: 999px;
    background: #c2410c;
    padding: .2rem .5rem;
    font-weight: 700;
}

.pricing-price {
    font-size: 2.25rem;
    color: #0f172a;
    font-weight: 700;
}

.pricing-price span {
    font-size: 1.1rem;
    color: #334155;
    font-weight: 500;
    margin-left: .2rem;
}

.pricing-subscription-status {
    border: 1px solid #fed7aa;
    border-radius: 12px;
    background: #fff7ed;
    color: #7c2d12;
    padding: .65rem .75rem;
    font-size: .86rem;
    line-height: 1.35;
}

.pricing-renewal-canceled {
    color: #065f46;
    font-weight: 600;
}

.pricing-feature-list {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    padding: 0;
    margin: 0;
    list-style: none;
    color: #1f2937;
    font-size: .9rem;
}

.pricing-disabled {
    color: #9ca3af;
}

.pricing-btn {
    margin-top: auto;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #e07a5f 0%, #f2a65a 100%);
    color: #fff;
    font-weight: 600;
    font-size: .94rem;
    padding: .58rem .78rem;
}

.pricing-btn:disabled {
    opacity: .55;
}

.pricing-btn-secondary {
    background: #e5e7eb;
    color: #6b7280;
}

/* ============================================================
   Upload PDF page
   ============================================================ */
.upload-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

.app-busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 2500;
    background: rgba(15, 23, 42, 0.46);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.app-busy-card {
    width: min(460px, 100%);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #dbeafe;
    box-shadow: 0 18px 45px rgba(30, 41, 59, 0.28);
    padding: 1.2rem 1.15rem;
    text-align: center;
}

.app-busy-pages {
    position: relative;
    width: 66px;
    height: 48px;
    margin: 0 auto 0.8rem;
    perspective: 120px;
}

.app-busy-page {
    position: absolute;
    inset: 0;
    border-radius: 8px;
    border: 1px solid #fed7aa;
    background: linear-gradient(135deg, #fff7ed 0%, #fff3e6 100%);
    transform-origin: left center;
    animation: appBusyFlip 1.2s ease-in-out infinite;
}

.app-busy-page-1 { animation-delay: 0s; }
.app-busy-page-2 { animation-delay: 0.18s; }
.app-busy-page-3 { animation-delay: 0.36s; }

.app-busy-title {
    font-size: 1rem;
    font-weight: 800;
    color: #1f2937;
}

.app-busy-text {
    margin-top: 0.35rem;
    font-size: 0.9rem;
    color: #4b5563;
}

@keyframes appBusyFlip {
    0%, 100% { transform: rotateY(0deg); opacity: 0.85; }
    40% { transform: rotateY(-45deg); opacity: 1; }
    70% { transform: rotateY(-8deg); opacity: 0.92; }
}

.upload-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    width: 100%;
    max-width: 920px;
    overflow: hidden;
}

.game-edit-mini-btn {
    position: absolute;
    top: 0.45rem;
    right: 2.8rem;
    z-index: 3;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    background: rgba(15, 23, 42, 0.68);
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.game-edit-mini-btn:hover {
    background: rgba(154, 52, 18, 0.85);
}

.chat-panel.minimized {
    flex: 0 0 56px;
    width: 56px;
    min-width: 56px;
    max-width: 56px;
    min-height: 56px;
    height: 56px;
    align-items: center;
    justify-content: flex-start;
    padding-top: 0.5rem;
}

.add-rulebook-modal {
    width: min(560px, calc(100% - 2rem));
}

.add-rulebook-modal .upload-input {
    width: 100%;
}

.chat-restore-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #c2410c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.upload-card-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.15rem;
    background: linear-gradient(135deg, #ffffff 0%, #fffaf0 52%, #fff7ed 100%);
    border-bottom: 1px solid #f0e3cb;
    color: #0f172a;
}

.upload-header-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.upload-card-title {
    margin: 0 0 0.2rem 0;
    font-size: 1.45rem;
    font-weight: 700;
    color: #0f172a;
}

.upload-card-subtitle {
    margin: 0;
    font-size: .9rem;
    color: #64748b;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.15rem;
}

.bgg-panel {
    border: none;
    border-radius: 0;
    padding: 0;
}

.bgg-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: .75rem;
}

.bgg-actions .game-card-btn {
    margin: 0;
    width: auto;
    min-width: 0;
    flex: 1 1 0;
    padding: .55rem .85rem;
}

.bgg-panel .upload-alert {
    margin-top: .75rem;
}

.bgg-fields-title {
    margin-top: .75rem;
}

.bgg-fields-list {
    margin: .25rem 0 0 1rem;
    padding: 0;
}

.upload-lang-tabs {
    display: inline-flex;
    gap: 0.4rem;
    background: #fff7ed;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    padding: 0.25rem;
    width: fit-content;
}

.upload-lang-tab {
    border: none;
    background: transparent;
    color: #475569;
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.upload-limit-note {
    margin-top: .35rem;
    border: 1px solid #fcd34d;
    background: #fffbeb;
    color: #92400e;
    border-radius: 9px;
    font-size: .78rem;
    padding: .45rem .55rem;
    display: flex;
    justify-content: space-between;
    gap: .6rem;
}

.upload-limit-note a {
    color: #92400e;
    font-weight: 700;
}

.upload-lang-tab.active {
    background: #fff;
    color: #9a3412;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.upload-language-panel {
    padding-top: 0.25rem;
}

.page.theme-dark .upload-lang-tabs {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.35);
}

.page.theme-dark .upload-lang-tab {
    color: #cbd5e1;
}

.page.theme-dark .upload-lang-tab.active {
    background: rgba(30, 41, 59, 0.95);
    color: #f8fafc;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
}

.upload-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.upload-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.upload-input {
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #f9fafb;
    font-family: inherit;
}

.upload-input:focus {
    border-color: #e07a5f;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(224,122,95,0.1);
}

.upload-input-file {
    width: 100%;
    border: 1.5px dashed #fed7aa;
    border-radius: 12px;
    padding: 0.7rem 0.8rem;
    background: linear-gradient(135deg, #fffaf0 0%, #fffaf0 100%);
    color: #334155;
    font-size: 0.92rem;
    font-weight: 500;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.16s ease, background 0.2s ease;
}

.upload-input-file::file-selector-button {
    border: none;
    border-radius: 10px;
    padding: 0.5rem 0.9rem;
    margin-right: 0.75rem;
    background: linear-gradient(135deg, #e07a5f 0%, #f2a65a 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(224, 122, 95, 0.28);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.upload-input-file::-webkit-file-upload-button {
    border: none;
    border-radius: 10px;
    padding: 0.5rem 0.9rem;
    margin-right: 0.75rem;
    background: linear-gradient(135deg, #e07a5f 0%, #f2a65a 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(224, 122, 95, 0.28);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.upload-input-file:hover {
    border-color: #fdba74;
    background: linear-gradient(135deg, #f5f8ff 0%, #edf2ff 100%);
    box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.1);
}

.upload-input-file:hover::file-selector-button,
.upload-input-file:hover::-webkit-file-upload-button {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(224, 122, 95, 0.36);
    filter: brightness(1.04);
}

.upload-input-file:focus,
.upload-input-file:focus-visible {
    outline: none;
    border-color: #fb923c;
    box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.16);
}

.upload-input-file-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1.5px dashed #fed7aa;
    border-radius: 12px;
    padding: 0.7rem 0.8rem;
    background: linear-gradient(135deg, #fffaf0 0%, #fffaf0 100%);
}

.upload-input-file-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.upload-input-file-btn {
    border: none;
    border-radius: 10px;
    padding: 0.5rem 0.9rem;
    background: linear-gradient(135deg, #e07a5f 0%, #f2a65a 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(224, 122, 95, 0.28);
    white-space: nowrap;
}

.upload-input-file-name-display {
    color: #334155;
    font-size: 0.92rem;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-input-file-btn:hover {
    filter: brightness(1.04);
}

.page.theme-dark .upload-input-file-row {
    border-color: rgba(251, 146, 60, 0.45) !important;
    background: rgba(15, 23, 42, 0.78) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.page.theme-dark .upload-input-file-name-display {
    color: #e2e8f0 !important;
}

.page.theme-dark .upload-input-file-btn {
    box-shadow: 0 4px 14px rgba(224, 122, 95, 0.35) !important;
}

.page.theme-dark .upload-input-file-btn:hover {
    filter: brightness(1.08);
}

.upload-cover-preview {
    max-width: 120px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.upload-files-title {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.upload-files-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.upload-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.5rem 0.6rem;
}

.upload-file-item-new {
    border-color: #fed7aa;
    background: #fff7ed;
}

.upload-file-item-marked {
    border-color: #fecaca;
    background: #fef2f2;
}

.upload-file-name {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-file-rag-status,
.upload-file-rag-message {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-file-rag-status {
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 700;
    color: #92400e;
}

.upload-file-rag-status-error {
    color: #b91c1c;
}

.upload-file-rag-message {
    color: #64748b;
    font-size: 0.82rem;
}

.upload-file-action-btn {
    border: 1px solid #fed7aa;
    background: #fff;
    color: #c2410c;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.28rem 0.6rem;
    cursor: pointer;
    flex-shrink: 0;
}

.upload-file-action-btn:hover {
    background: #fff7ed;
}

.upload-hint {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* Drop zone */
.upload-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    background: #f9fafb;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}

.chat-warning-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: #f3f4f6;
}

.chat-warning-card {
    max-width: 520px;
    width: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    padding: 1rem 1.1rem;
    color: #1f2937;
}

.chat-warning-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #111827;
}

.chat-warning-card p {
    margin: 0.45rem 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: #374151;
}

.chat-warning-btn {
    margin-top: 0.75rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #e07a5f 0%, #f2a65a 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.55rem 0.85rem;
    cursor: pointer;
}

.chat-warning-btn:hover {
    opacity: 0.9;
}

.upload-dropzone:hover {
    border-color: #e07a5f;
    background: #fffbf2;
}

.upload-dropzone.has-file {
    border-color: #e07a5f;
    background: #fffbf2;
}

.upload-dropzone-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.upload-dropzone-filename {
    color: #e07a5f;
    word-break: break-all;
}

.upload-dropzone-hint {
    font-size: 0.78rem;
    color: #9ca3af;
}

.upload-input-hidden {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

/* Alerts */
.upload-alert {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

.upload-alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.upload-alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Upload button */
.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem;
    background: linear-gradient(135deg, #e07a5f 0%, #f2a65a 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
}

.upload-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.upload-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.upload-spinner {
    animation: spin 1s linear infinite;
}

@@keyframes spin {
    to { transform: rotate(360deg); }
}


.game-library-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
}

.game-library-header p {
    color: #6b7280;
    margin: 0;
    font-size: 0.95rem;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    padding: 0 1rem;
}

.page.theme-dark .account-security-page .game-library-header p,
.page.theme-dark .account-security-card .form-label,
.page.theme-dark .account-security-card .form-hint,
.page.theme-dark .account-security-card .auth-subtitle {
    color: #e2e8f0 !important;
}

.page.theme-dark .account-security-card .form-input {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: rgba(148, 163, 184, 0.4) !important;
    color: #e5e7eb !important;
}

.page.theme-dark .game-library-filters {
    border-color: rgba(148, 163, 184, 0.3);
    background: linear-gradient(150deg, rgba(13, 25, 48, 0.9), rgba(30, 42, 69, 0.78));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.page.theme-dark .game-filter-label {
    color: #cbd5e1;
}

.page.theme-dark .game-filter-select,
.page.theme-dark .game-filter-input {
    background-color: rgba(15, 23, 42, 0.82) !important;
    border-color: rgba(148, 163, 184, 0.46) !important;
    color: #e5e7eb !important;
}

.page.theme-dark .game-filter-select {
    color-scheme: dark;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23cbd5e1' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

.page.theme-dark .game-filter-select:focus,
.page.theme-dark .game-filter-input:focus {
    border-color: rgba(251, 146, 60, 0.85);
    box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.24);
}

.page.theme-dark .game-filter-input::placeholder {
    color: #94a3b8;
}

.page.theme-dark .game-filter-select option {
    color: #e5e7eb;
    background: #0f172a;
    font-weight: 500;
}

.page.theme-dark .game-filter-select option:checked {
    color: #f8fafc;
    background: linear-gradient(135deg, rgba(224, 122, 95, 0.55) 0%, rgba(194, 65, 12, 0.48) 100%);
}

.page.theme-dark .game-filter-select option:hover {
    background: rgba(51, 65, 85, 0.9);
}

.page.theme-dark .account-security-card .form-input:focus {
    background: rgba(15, 23, 42, 0.9) !important;
    border-color: rgba(251, 146, 60, 0.75) !important;
    box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.2) !important;
}

.game-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    border: 1px solid rgba(224, 122, 95, 0.14);
    display: flex;
    flex-direction: column;
    position: relative;
}

.game-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, #e07a5f, #fbbf80);
    opacity: 0.9;
    pointer-events: none;
    z-index: 2;
}

.game-card.game-card-fav::before {
    background: linear-gradient(90deg, #ec4899, #f97316);
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(224, 122, 95, 0.22);
    border-color: #fdba74;
}

.game-card-thumb {
    position: relative;
    height: 140px;
    background: linear-gradient(135deg, #e07a5f 0%, #f2a65a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.game-card-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.35) 100%);
    pointer-events: none;
}

.game-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-card-thumb svg {
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.game-card-thumb-chips {
    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.45rem;
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
    z-index: 2;
    pointer-events: none;
}

.game-card-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: rgba(15, 23, 42, 0.65);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

.game-card-chip-lang {
    text-transform: uppercase;
}

.game-card-body {
    padding: 0.85rem 1rem 0.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.game-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.game-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.game-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
    text-decoration: none;
}

.game-card-badge-empty {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #e5e7eb;
}

.game-card-badge-bgg {
    background: #fff7ed;
    color: #9a3412;
    border-color: #fed7aa;
}

.game-card-badge-bgg:hover {
    background: #ffedd5;
    color: #7c2d12;
}

.game-card-meta {
    font-size: 0.8rem;
    color: #9ca3af;
}

.game-card-btn {
    margin: 0 1rem 1rem 1rem;
    padding: 0.55rem 0;
    background: linear-gradient(135deg, #e07a5f 0%, #f2a65a 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    width: calc(100% - 2rem);
}

.game-card-btn:hover {
    opacity: 0.88;
}

.game-loading, .game-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem 1rem;
    color: #6b7280;
    font-size: 1rem;
}

.game-empty svg {
    opacity: 0.35;
}

.game-pager {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.game-pager-btn {
    border: 1px solid #fed7aa;
    background: #fff;
    color: #c2410c;
    border-radius: 8px;
    padding: 0.38rem 0.72rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.game-pager-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.game-pager-info {
    font-size: 0.88rem;
    color: #374151;
    font-weight: 600;
}

/* ============================================================
   PDF + Chat Viewer Layout
   ============================================================ */
.viewer-wrapper {
    display: flex;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    gap: 0;
}

/* PDF panel */
.pdf-panel {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: flex 0.35s ease, opacity 0.35s ease;
    overflow: hidden;
}

.pdf-panel.hidden {
    flex: 0 0 0;
    opacity: 0;
    pointer-events: none;
}

.pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.pdf-tabs {
    display: flex;
    gap: 0.4rem;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    overflow-x: auto;
}

.pdf-tab {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 8px;
    padding: 0.38rem 0.78rem;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.pdf-tab:hover {
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

.pdf-tab-active {
    background: linear-gradient(180deg, #fff7ed 0%, #fff3e6 100%);
    border-color: #e07a5f;
    color: #9a3412;
    box-shadow: 0 1px 2px rgba(154, 52, 18, 0.12);
}

.pdf-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    font-size: 0.85rem;
}

.pdf-details-main {
    flex: 1 1 auto;
    min-width: 0;
}

.pdf-details-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pdf-details-title {
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.pdf-bgg-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid #fed7aa;
    background: linear-gradient(135deg, #fff7ed 0%, #fff3e6 100%);
    color: #9a3412;
    font-weight: 700;
    font-size: 0.78rem;
    text-decoration: none;
    padding: 0.32rem 0.62rem;
    border-radius: 999px;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.pdf-bgg-btn:hover {
    border-color: #fdba74;
    background: linear-gradient(135deg, #fff3e6 0%, #fed7aa 100%);
    color: #7c2d12;
}

.pdf-note-open-btn {
    border: 1px solid #fed7aa;
    background: #fff;
    color: #c2410c;
    border-radius: 999px;
    padding: 0.32rem 0.62rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.pdf-content-split {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

.pdf-content-split.notes-hidden {
    min-height: 0;
}

.pdf-content-split .pdf-iframe,
.pdf-content-split .pdf-loading-state {
    flex: 1 1 auto;
    min-height: 0;
}

.pdf-content-split.resizing .pdf-iframe {
    pointer-events: none;
}

.pdf-notes-resizer {
    height: 14px;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #f8fafc 0%, #fff7ed 100%);
    cursor: row-resize;
    flex-shrink: 0;
    touch-action: none;
    position: relative;
}

.pdf-notes-resizer::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 54px;
    height: 3px;
    border-radius: 999px;
    background: #94a3b8;
}

.pdf-resize-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    cursor: row-resize;
    touch-action: none;
}

.pdf-notes-panel {
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
    padding: .6rem .7rem;
    height: clamp(150px, 28vh, 420px);
    min-height: 120px;
    max-height: 70%;
    overflow: auto;
    flex: 0 0 auto;
}

.pdf-notes-header h4 {
    margin: 0;
    font-size: .85rem;
    color: #334155;
}

.pdf-notes-empty {
    margin-top: .45rem;
    font-size: .8rem;
    color: #64748b;
}

.pdf-notes-list {
    list-style: none;
    margin: .55rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .45rem;
}

.pdf-notes-list li {
    border: 1px solid #dbeafe;
    background: #fff;
    border-radius: 10px;
    padding: .5rem;
}

.pdf-note-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4rem;
}

.pdf-note-page-btn,
.pdf-note-delete-btn {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    border-radius: 6px;
    font-size: .72rem;
    font-weight: 600;
    padding: .16rem .4rem;
}

.pdf-note-delete-btn {
    border-color: #fecaca;
    color: #b91c1c;
}

.pdf-note-title {
    margin-top: .35rem;
    font-size: .82rem;
    font-weight: 700;
    color: #1f2937;
}

.pdf-note-content {
    margin-top: .2rem;
    font-size: .78rem;
    color: #4b5563;
    white-space: pre-wrap;
}

.pdf-note-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, .45);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.pdf-note-modal {
    width: min(560px, 100%);
    max-width: 100%;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.2);
    padding: 1rem;
}

.pdf-note-form-row > * {
    min-width: 0;
}

.add-rulebook-modal h4 {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.add-rulebook-processing {
    margin-top: .65rem;
}

.pdf-note-modal h4 {
    margin: 0 0 .75rem;
    color: #0f172a;
}

.pdf-note-form-row {
    display: grid;
    grid-template-columns: 130px 1fr auto;
    gap: .5rem;
    align-items: center;
    margin-bottom: .55rem;
}

.pdf-note-current-page-btn {
    margin: 0;
    width: auto;
    min-height: 40px;
    padding: .5rem .8rem;
    white-space: nowrap;
}

.pdf-note-form-row label {
    font-size: .83rem;
    color: #334155;
    font-weight: 600;
}

.pdf-note-form-row textarea.upload-input {
    grid-column: 2 / 4;
}

.pdf-note-modal .game-card-btn-secondary {
    background: #fff3e6;
    color: #7c2d12;
    border-color: #fdba74;
}

.pdf-note-modal .game-card-btn-secondary:hover {
    background: #fed7aa;
    color: #431407;
}

.pdf-note-actions {
    margin-top: .65rem;
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

@media (max-width: 768px) {
    .pdf-note-modal {
        width: calc(100% - 1rem);
        padding: .85rem;
    }

    .pdf-note-form-row {
        grid-template-columns: 1fr;
        gap: .4rem;
    }

    .pdf-note-current-page-btn {
        width: 100%;
    }

    .pdf-note-form-row textarea.upload-input {
        grid-column: auto;
    }

    .pdf-note-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .pdf-note-actions .game-card-btn,
    .pdf-note-actions .game-card-btn-secondary {
        width: 100%;
        min-width: 0;
        margin: 0;
    }

    .upload-input-file-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: .45rem;
    }

    .upload-input-file-btn,
    .upload-input-file-name-display {
        width: 100%;
        text-align: center;
    }
}

.pdf-loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    font-size: 1rem;
}

.page.theme-dark .pdf-notes-resizer {
    border-top-color: rgba(148, 163, 184, 0.25);
    border-bottom-color: rgba(148, 163, 184, 0.25);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.75) 0%, rgba(30, 41, 59, 0.9) 100%);
}

.page.theme-dark .pdf-notes-resizer::before {
    background: #cbd5e1;
}

.page.theme-dark .pdf-note-modal .game-card-btn-secondary {
    background: rgba(154, 52, 18, 0.45);
    color: #fff3e6;
    border-color: rgba(251, 146, 60, 0.7);
}

.page.theme-dark .pdf-note-modal .game-card-btn-secondary:hover {
    background: rgba(224, 122, 95, 0.6);
    color: #f8fafc;
}

/* Chat panel */
.chat-panel {
    display: flex;
    flex-direction: column;
    width: 380px;
    min-width: 320px;
    max-width: 380px;
    border-left: 1px solid #e5e7eb;
    background: #f9fafb;
    transition: width 0.35s ease, max-width 0.35s ease, min-width 0.35s ease;
    overflow: hidden;
}

.chat-panel-pending {
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.chat-panel.fullscreen {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border-left: none;
    background: #f0f2f5;
}

/* Chat header */
.chat-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #e07a5f 0%, #f2a65a 100%);
    color: #fff;
    gap: 0.75rem;
    flex-shrink: 0;
}

.chat-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-header-info {
    flex: 1;
    min-width: 0;
}

.chat-header-name {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-status {
    font-size: 0.75rem;
    opacity: 0.85;
}

.chat-header-actions {
    display: flex;
    gap: 0.35rem;
}

.chat-icon-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chat-icon-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Messages area */
.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

/* Message rows */
.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.msg-row.user-row {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
}

.msg-avatar.bot-avatar {
    background: linear-gradient(135deg, #e07a5f, #f2a65a);
}

.msg-avatar.user-avatar {
    background: #10b981;
}

.msg-bubble {
    max-width: 72%;
    padding: 0.6rem 0.85rem;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-line;
}

.msg-row.user-row .msg-bubble {
    background: #e07a5f;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg-row.bot-row .msg-bubble {
    background: #fff;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.bot-message-content .chat-highlight {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
    font-weight: 600;
    color: #7c2d12;
}

.bot-message-content a.chat-highlight {
    cursor: pointer;
}

.bot-message-content a.chat-highlight:hover {
    color: #9a3412;
}

.bot-message-content button.chat-highlight {
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    font: inherit;
}

.bot-message-content button.chat-highlight:hover {
    color: #9a3412;
}

.bot-message-content .chat-ref-line {
    display: block;
    margin-bottom: 0.25rem;
}

.bot-message-content .chat-ref-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid #fed7aa;
    background: linear-gradient(180deg, #fff7ed 0%, #fff3e6 100%);
    color: #7c2d12;
    border-radius: 999px;
    padding: 0.18rem 0.55rem;
    margin: 0.06rem 0;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(154, 52, 18, 0.08);
}

.bot-message-content .chat-ref-btn:hover {
    background: linear-gradient(180deg, #fff3e6 0%, #fed7aa 100%);
    border-color: #fdba74;
    color: #431407;
    transform: translateY(-1px);
}

.bot-message-content .chat-citation-title {
    margin-top: 0.35rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
    color: #c2410c;
}

.bot-message-content .chat-quote {
    margin: 0.25rem 0;
    padding: 0.45rem 0.6rem;
    border-left: 3px solid #fdba74;
    background: #fff7ed;
    border-radius: 8px;
    font-style: italic;
    color: #7c2d12;
}

/* Typing indicator */
.typing-bubble {
    background: #fff;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    padding: 0.6rem 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

.page.theme-dark .typing-bubble,
.theme-dark .typing-bubble {
    background: linear-gradient(150deg, rgba(13, 25, 48, 0.9), rgba(30, 42, 69, 0.78));
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.28);
}

.page.theme-dark .typing-dot,
.theme-dark .typing-dot {
    background: #cbd5e1;
}

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* Empty state */
.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 1;
    color: #9ca3af;
    font-size: 0.9rem;
    padding: 2rem;
    text-align: center;
}

/* Chat input area */
.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.chat-textarea {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    resize: none;
    border: 1.5px solid #e5e7eb;
    border-radius: 20px;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    outline: none;
    font-family: inherit;
    line-height: 1.4;
    transition: border-color 0.2s;
    overflow-y: auto;
    background: #f9fafb;
}

.chat-textarea:focus {
    border-color: #e07a5f;
    background: #fff;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e07a5f 0%, #f2a65a 100%);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.15s;
    color: #fff;
}

.chat-send-btn:hover:not(:disabled) {
    opacity: 0.88;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ============================================================
   Favourite button on game card
   ============================================================ */
.game-card-thumb {
    position: relative;
}

.fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s, transform 0.18s;
    z-index: 2;
    backdrop-filter: blur(2px);
}

.fav-btn:hover {
    background: rgba(0,0,0,0.45);
    transform: scale(1.15);
}

.fav-btn-active {
    background: rgba(255,255,255,0.25);
}

.fav-btn-active:hover {
    background: rgba(255,255,255,0.4);
}

.game-card-fav {
    border-color: #fca5a5 !important;
    box-shadow: 0 4px 18px rgba(229,62,62,0.15) !important;
}

.game-card-fav .game-card-thumb {
    background: linear-gradient(135deg, #f2a65a 0%, #e53e3e 100%);
}



/* ============================================================
   NavMenu - favourites section
   ============================================================ */
.nav-favorites-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255,255,255,0.5);
}

.nav-favorite-link {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.3rem !important;
    padding-bottom: 0.3rem !important;
}

.nav-fav-thumb {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
}

.nav-fav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e53e3e;
    flex-shrink: 0;
}

.nav-fav-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.88rem;
    max-width: 140px;
}

@media (max-width: 1024px) {
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    }

    .chat-panel {
        width: 340px;
        min-width: 280px;
        max-width: 340px;
    }
}

@media (max-width: 768px) {
    .game-library {
        padding: 1rem 0.75rem;
    }

    .game-library .game-library-header {
        margin: .2rem .2rem .7rem;
        padding: .72rem .78rem;
        border-radius: 12px;
    }

    .account-security-page .game-library-header,
    .pricing-page .game-library-header {
        margin-left: 0;
        margin-right: 0;
    }

    .game-library .game-library-header h2 {
        font-size: 1.06rem;
        line-height: 1.2;
    }

    .game-library .game-library-header p {
        margin-top: .2rem;
        font-size: .8rem;
        line-height: 1.32;
    }

    .game-library-actions {
        margin-top: .6rem;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .45rem;
    }

    .game-library-actions .game-pager-btn {
        width: 100%;
        min-height: 32px;
        font-size: .78rem;
        padding: .32rem .5rem;
        margin: 0;
    }

    .game-library-toolbar {
        margin-top: .6rem;
        gap: .5rem;
    }

    .game-filters-toggle-btn {
        display: inline-flex;
        width: 100%;
        justify-content: center;
        margin-top: .35rem;
    }

    .game-library-filters {
        display: grid;
        grid-template-columns: 1fr;
        gap: .45rem;
        padding: .6rem;
        overflow-x: visible;
    }

    .game-filter-group {
        flex: initial;
    }

    .game-library-filters.is-collapsed-mobile {
        display: none;
    }

    .game-library-filters.is-open {
        display: grid;
    }

    .game-filter-select,
    .game-filter-input {
        width: 100%;
        min-width: 0;
        font-size: 16px;
    }

    .game-search-input {
        font-size: 16px;
    }

    .game-filter-actions .game-pager-btn {
        width: 100%;
    }

    .game-search-meta {
        font-size: .78rem;
    }

    .game-sort-select {
        width: 100%;
    }

    .game-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .upload-page {
        padding: 1rem 0.5rem;
    }

    .upload-card {
        max-width: 100%;
        border-radius: 14px;
    }

    .upload-card-header {
        padding: 1rem 1rem;
    }

    .upload-form {
        padding: 1rem;
    }

    .viewer-wrapper {
        flex-direction: column;
        height: calc(100dvh - 3.5rem);
        min-height: calc(100dvh - 3.5rem);
        max-height: calc(100dvh - 3.5rem);
    }

    .page:has(.viewer-wrapper) main,
    .page:has(.viewer-wrapper) article.content {
        overflow: hidden;
    }

    .page:has(.viewer-wrapper) article.content {
        padding: 0 !important;
    }

    .pdf-panel {
        flex: 0 0 auto;
        height: 48dvh;
        min-height: 48dvh;
    }

    .viewer-wrapper.no-chat .pdf-panel {
        flex: 1 1 auto;
        height: calc(100dvh - 3.5rem);
        min-height: calc(100dvh - 3.5rem);
    }

    .pdf-panel.hidden {
        display: none;
    }

    .chat-panel {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        border-left: none;
        border-top: 1px solid #e5e7eb;
        min-height: 0;
        height: auto;
    }

    .chat-panel.minimized {
        flex: 0 0 52px;
        width: auto;
        min-width: 0;
        max-width: none;
        min-height: 52px;
        height: 52px;
        max-height: 52px;
        border-top: 1px solid #e5e7eb;
        padding: 0.35rem 0.6rem;
        justify-content: center;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1200;
        background: #f9fafb;
        box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
        padding-bottom: calc(0.35rem + env(safe-area-inset-bottom));
    }

    .viewer-wrapper.chat-minimized .pdf-panel {
        flex: 1 1 auto !important;
        height: calc(100dvh - 3.5rem - 56px) !important;
        min-height: calc(100dvh - 3.5rem - 56px) !important;
    }

    .viewer-wrapper.chat-minimized {
        padding-bottom: calc(52px + env(safe-area-inset-bottom));
    }

    .chat-panel.fullscreen {
        min-height: calc(100dvh - 3.5rem);
        height: calc(100dvh - 3.5rem);
    }

    .pdf-details {
        gap: .45rem;
        padding: .45rem .55rem;
    }

    .pdf-details-actions {
        flex-wrap: nowrap;
        gap: .35rem;
    }

    .pdf-note-open-btn,
    .pdf-bgg-btn {
        padding: .28rem .48rem;
        font-size: .72rem;
    }

    .pdf-tabs {
        padding: 0.35rem;
    }

    .pdf-tab {
        font-size: 0.78rem;
        padding: 0.3rem 0.55rem;
    }

    .chat-header {
        padding: 0.65rem 0.75rem;
    }

    .chat-messages {
        flex: 1 1 auto;
        min-height: 0;
        padding: 0.75rem;
    }

    .chat-input-area {
        position: sticky;
        bottom: 0;
        z-index: 2;
        background: #fff;
        padding: 0.65rem;
        padding-bottom: calc(0.65rem + env(safe-area-inset-bottom));
    }
}

.nav-fav-expand-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.55);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0;
    transition: color 0.18s;
}

.nav-fav-expand-btn:hover {
    color: rgba(255,255,255,0.9);
}

.nav-fav-count {
    background: rgba(229,62,62,0.75);
    color: #fff;
    border-radius: 8px;
    padding: 0 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
}

.game-card-btn,
.game-card-btn-secondary,
.pricing-btn,
.pricing-btn-secondary,
.upload-btn,
.chat-warning-btn,
.upload-file-action-btn,
.game-pager-btn,
.chat-restore-btn,
.pdf-note-open-btn,
.pdf-note-page-btn,
.pdf-note-delete-btn {
    background: linear-gradient(135deg, #e07a5f 0%, #f2a65a 100%) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 4px 12px rgba(224, 122, 95, 0.3) !important;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.game-card-btn:hover:not(:disabled),
.game-card-btn-secondary:hover:not(:disabled),
.pricing-btn:hover:not(:disabled),
.pricing-btn-secondary:hover:not(:disabled),
.upload-btn:hover:not(:disabled),
.chat-warning-btn:hover:not(:disabled),
.upload-file-action-btn:hover:not(:disabled),
.game-pager-btn:hover:not(:disabled),
.chat-restore-btn:hover:not(:disabled),
.pdf-note-open-btn:hover:not(:disabled),
.pdf-note-page-btn:hover:not(:disabled),
.pdf-note-delete-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(224, 122, 95, 0.4) !important;
    filter: brightness(1.04);
}

.game-card-btn:disabled,
.game-card-btn-secondary:disabled,
.pricing-btn:disabled,
.pricing-btn-secondary:disabled,
.upload-btn:disabled,
.chat-warning-btn:disabled,
.upload-file-action-btn:disabled,
.game-pager-btn:disabled,
.chat-restore-btn:disabled,
.pdf-note-open-btn:disabled,
.pdf-note-page-btn:disabled,
.pdf-note-delete-btn:disabled {
    opacity: 0.55;
    transform: none;
    box-shadow: none;
}

