/**
 * Tournament Analyzer Styles
 * Styles for the tournament sheet analyzer feature
 */

/* ===========================
   Section Container
   =========================== */
.tournoi-analyzer-section {
    margin-top: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.8), rgba(20, 20, 30, 0.9));
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

body.light-mode .tournoi-analyzer-section {
    background: linear-gradient(135deg, #ffffff, #f5f7fb);
    border: 1px solid rgba(15, 23, 42, 0.12);
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.08);
}

.tournoi-analyzer-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tournoi-analyzer-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #a855f7, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tournoi-analyzer-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
}

/* Login Required Message */
#tournoi-analyzer-login-required {
    text-align: center;
    padding: 3rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
}

#tournoi-analyzer-login-required i {
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 1rem;
}

#tournoi-analyzer-login-required h3 {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

#tournoi-analyzer-login-required p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

/* Action Buttons */
.tournoi-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.tournoi-action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.tournoi-action-btn.primary {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.tournoi-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(59, 130, 246, 0.4);
}

.tournoi-action-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tournoi-action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(168, 85, 247, 0.5);
}

.tournoi-action-btn i {
    font-size: 1.2rem;
}

/* Rate Limit Info */
#tournoi-rate-limit-info {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

#tournoi-rate-limit-info span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#tournoi-rate-limit-info .cooldown-active {
    color: #f59e0b;
    font-weight: 600;
}

/* ===========================
   Scanner Modal
   =========================== */
#tournoi-scanner-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#tournoi-scanner-modal.active {
    display: flex;
}

.tournoi-scanner-container {
    width: 100%;
    max-width: 500px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.5);
}

.tournoi-scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tournoi-scanner-header h2 {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tournoi-scanner-close {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    flex: 0 0 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(148, 163, 184, 0.1) !important;
    border: 1px solid rgba(148, 163, 184, 0.2) !important;
    border-radius: 50% !important;
    color: #94a3b8 !important;
    font-size: 0.9rem !important;
    cursor: pointer !important;
    padding: 0 !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
}

.tournoi-scanner-close:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #ef4444 !important;
    transform: rotate(90deg) !important;
}

/* Preview Area */
.tournoi-preview-area {
    position: relative;
    min-height: 280px;
    background: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
}

#tournoi-scanner-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.3);
}

#tournoi-scanner-placeholder i {
    font-size: 4rem;
    opacity: 0.5;
}

#tournoi-image-preview {
    max-height: 300px;
    max-width: 100%;
    object-fit: contain;
    display: none;
}

/* Processing Overlay */
#tournoi-processing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

#tournoi-processing-overlay .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#tournoi-status-text {
    color: white;
    font-weight: 600;
}

.tournoi-progress-container {
    width: 200px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

#tournoi-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Controls */
.tournoi-scanner-controls {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#tournoi-capture-section {
    display: flex;
    gap: 0.75rem;
}

.tournoi-capture-btn {
    flex: 1;
    padding: 1rem;
    border-radius: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
}

.tournoi-capture-btn.primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.tournoi-capture-btn.primary:hover {
    transform: scale(1.02);
}

.tournoi-capture-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

#tournoi-analyze-btn {
    display: none;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
}

#tournoi-retake-btn {
    display: none;
}

/* ===========================
   Results Section
   =========================== */
#tournoi-result-section {
    display: none;
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

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

.tournoi-result-header h3 {
    color: #10b981;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#tournoi-move-count {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

#tournoi-moves-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

.tournoi-move-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: white;
}

.tournoi-move-item .move-number {
    color: rgba(255, 255, 255, 0.4);
    margin-right: 0.25rem;
}

/* New Results View */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.results-header h3 {
    color: #22c55e;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-rescan {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #bababa;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-rescan:hover {
    background: rgba(255, 255, 255, 0.12);
}

.moves-preview {
    margin-bottom: 1rem;
}

.moves-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.4rem;
    max-height: 180px;
    overflow-y: auto;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

.move-preview-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.move-preview-row .move-num {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    width: 24px;
}

.move-preview-row .move-san {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #fff;
    flex: 1;
}

.move-preview-row .move-san.black {
    color: #bababa;
}

/* ===========================
   History Section
   =========================== */
#tournoi-history-section {
    display: none;
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tournoi-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tournoi-history-header h3 {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tournoi-history-close {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    flex: 0 0 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(148, 163, 184, 0.1) !important;
    border: 1px solid rgba(148, 163, 184, 0.2) !important;
    border-radius: 50% !important;
    color: #94a3b8 !important;
    cursor: pointer !important;
    padding: 0 !important;
    font-size: 0.9rem !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
}

.tournoi-history-close:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #ef4444 !important;
    transform: rotate(90deg) !important;
}

#tournoi-history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.tournoi-history-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tournoi-history-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateX(4px);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.history-date {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-delete-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.history-delete-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.history-card-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-move-count {
    color: white;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-move-count i {
    color: #8b5cf6;
}

.history-preview {
    display: flex;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    font-family: monospace;
}

.history-preview span {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

/* Empty/Loading States */
.tournoi-loading,
.tournoi-empty-history,
.tournoi-error {
    text-align: center;
    padding: 3rem 1rem;
    color: rgba(255, 255, 255, 0.5);
}

.tournoi-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.tournoi-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.tournoi-empty-history i {
    font-size: 3rem;
    opacity: 0.3;
    display: block;
    margin-bottom: 1rem;
}

.tournoi-empty-history p {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

.tournoi-error {
    color: #ef4444;
}

/* ===========================
   Manual Game Database
   =========================== */
#tournoi-games-db-section {
    display: none;
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(3, 7, 18, 0.55);
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.tournoi-games-db-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.tournoi-games-db-header h3 {
    color: #fff;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tournoi-games-db-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

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

.tournoi-db-field label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 600;
}

.tournoi-db-field input,
.tournoi-db-field textarea {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.8);
    color: #f8fafc;
    padding: 0.75rem 0.9rem;
    font-size: 0.92rem;
}

.tournoi-db-field textarea {
    min-height: 120px;
    resize: vertical;
    font-family: 'Fira Code', monospace;
}

.tournoi-db-field small {
    color: rgba(148, 163, 184, 0.8);
    font-size: 0.78rem;
}

.tournoi-db-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    border: none;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 6px 22px rgba(37, 99, 235, 0.35);
}

.tournoi-db-save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 9px 26px rgba(37, 99, 235, 0.42);
}

.tournoi-db-import-row {
    display: flex;
    gap: 0.5rem;
}

.tournoi-db-import-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 11px;
    border: 1px solid rgba(96, 165, 250, 0.35);
    background: rgba(30, 41, 59, 0.82);
    color: #dbeafe;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.65rem 0.9rem;
    cursor: pointer;
}

.tournoi-db-import-btn:hover {
    background: rgba(37, 99, 235, 0.2);
    border-color: rgba(96, 165, 250, 0.55);
}

#tournoi-db-summary {
    margin-bottom: 1.25rem;
}

.tournoi-db-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.tournoi-db-metric {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 0.85rem;
    text-align: center;
}

.tournoi-db-metric .value {
    display: block;
    color: #f8fafc;
    font-size: 1.3rem;
    font-weight: 800;
}

.tournoi-db-metric .label {
    display: block;
    color: rgba(148, 163, 184, 0.9);
    font-size: 0.75rem;
}

.tournoi-db-openings {
    margin-top: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    padding: 0.85rem;
}

.tournoi-db-openings h5 {
    margin: 0 0 0.6rem;
    color: #e2e8f0;
    font-size: 0.85rem;
}

.tournoi-db-opening-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.tournoi-db-opening-list span {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #bfdbfe;
    border-radius: 999px;
    padding: 0.28rem 0.55rem;
    font-size: 0.76rem;
    font-family: 'Fira Code', monospace;
}

.tournoi-db-explorer {
    margin-bottom: 1.25rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    padding: 1rem;
}

.tournoi-db-explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.tournoi-db-explorer-header h4 {
    margin: 0;
    color: #f8fafc;
    font-size: 0.98rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tournoi-db-explorer-controls {
    display: flex;
    gap: 0.5rem;
}

.tournoi-db-control-btn {
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.9);
    color: #e2e8f0;
    font-size: 0.8rem;
    padding: 0.42rem 0.68rem;
    cursor: pointer;
}

.tournoi-db-control-btn:hover {
    background: rgba(30, 41, 59, 0.95);
}

.tournoi-db-explorer-content {
    display: grid;
    grid-template-columns: minmax(230px, 330px) 1fr;
    gap: 1rem;
}

.tournoi-db-board-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

#tournoi-db-explorer-board {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 330px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.95);
}

#tournoi-db-line {
    color: rgba(226, 232, 240, 0.95);
    font-size: 0.78rem;
    line-height: 1.35;
    font-family: 'Fira Code', monospace;
    background: rgba(2, 6, 23, 0.7);
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    padding: 0.55rem 0.65rem;
    min-height: 42px;
}

.tournoi-db-moves-wrap h5 {
    margin: 0 0 0.6rem;
    color: #e2e8f0;
    font-size: 0.86rem;
}

.tournoi-db-move-head {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    color: rgba(148, 163, 184, 0.95);
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.tournoi-db-move-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.tournoi-db-move-row {
    width: 100%;
    border: 1px solid rgba(96, 165, 250, 0.25);
    background: rgba(30, 41, 59, 0.6);
    border-radius: 10px;
    color: #f8fafc;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.6rem;
    align-items: center;
    padding: 0.55rem 0.7rem;
    cursor: pointer;
    text-align: left;
}

.tournoi-db-move-row:hover {
    border-color: rgba(96, 165, 250, 0.48);
    background: rgba(37, 99, 235, 0.18);
}

.tournoi-db-move-row .san {
    font-family: 'Fira Code', monospace;
    font-weight: 700;
}

.tournoi-db-move-row .count,
.tournoi-db-move-row .pct {
    font-size: 0.78rem;
    color: rgba(191, 219, 254, 0.95);
}

.tournoi-db-games h4 {
    margin: 0 0 0.75rem;
    color: #f8fafc;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#tournoi-db-games-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tournoi-db-game-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 0.8rem;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.tournoi-db-game-card:hover {
    border-color: rgba(96, 165, 250, 0.5);
    transform: translateY(-1px);
}

.tournoi-db-game-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.tournoi-db-game-title {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
}

.tournoi-db-game-date {
    color: rgba(148, 163, 184, 0.9);
    font-size: 0.73rem;
    white-space: nowrap;
}

.tournoi-db-game-meta {
    margin-top: 0.35rem;
    color: #cbd5e1;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.tournoi-db-game-preview {
    margin-top: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tournoi-db-game-preview span {
    background: rgba(51, 65, 85, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
    font-size: 0.74rem;
    border-radius: 8px;
    padding: 0.22rem 0.45rem;
    font-family: 'Fira Code', monospace;
}

.tournoi-db-game-actions {
    margin-top: 0.7rem;
    display: flex;
    gap: 0.5rem;
}

.tournoi-db-pagination {
    margin-top: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
}

.tournoi-db-pagination-btn {
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(30, 41, 59, 0.85);
    color: #e2e8f0;
    border-radius: 9px;
    padding: 0.42rem 0.62rem;
    font-size: 0.78rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.tournoi-db-pagination-btn:hover:not(:disabled) {
    background: rgba(51, 65, 85, 0.95);
}

.tournoi-db-pagination-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.tournoi-db-pagination-info {
    color: rgba(203, 213, 225, 0.92);
    font-size: 0.78rem;
    text-align: center;
}

.tournoi-db-action-btn {
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(30, 41, 59, 0.85);
    color: #e2e8f0;
    border-radius: 9px;
    padding: 0.4rem 0.62rem;
    font-size: 0.78rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.tournoi-db-action-btn:hover {
    background: rgba(51, 65, 85, 0.95);
}

.tournoi-db-action-btn.danger {
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.38);
}

.tournoi-db-empty {
    text-align: center;
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    color: rgba(203, 213, 225, 0.9);
    padding: 1.1rem;
}

.tournoi-db-empty i {
    font-size: 1.2rem;
    display: block;
    margin-bottom: 0.4rem;
    opacity: 0.8;
}

.tournoi-db-empty.small {
    padding: 0.8rem;
    font-size: 0.82rem;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 640px) {
    .tournoi-analyzer-section {
        padding: 1.25rem;
        margin-top: 2rem;
    }

    .tournoi-actions {
        flex-direction: column;
    }

    .tournoi-action-btn {
        width: 100%;
        justify-content: center;
    }

    #tournoi-rate-limit-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tournoi-scanner-container {
        border-radius: 20px;
    }

    .tournoi-preview-area {
        min-height: 220px;
    }

    .tournoi-db-summary-grid {
        grid-template-columns: 1fr;
    }

    .tournoi-db-explorer-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tournoi-db-explorer-controls {
        width: 100%;
    }

    .tournoi-db-control-btn {
        flex: 1;
        text-align: center;
    }

    .tournoi-db-explorer-content {
        grid-template-columns: 1fr;
    }

    #tournoi-db-explorer-board {
        max-width: 100%;
    }

    .tournoi-db-game-header {
        flex-direction: column;
        gap: 0.25rem;
    }

    .tournoi-db-game-actions {
        flex-direction: column;
    }

    .tournoi-db-import-row {
        flex-direction: column;
    }

    .tournoi-db-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .tournoi-db-pagination-btn {
        justify-content: center;
    }
}

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

/* ===========================
   Deep Analysis Section
   =========================== */
#tournoi-deep-analysis-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tournoi-deep-analyze-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.tournoi-deep-analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(16, 185, 129, 0.4);
}

.deep-analyze-hint {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    margin-top: 0.75rem;
}

/* Progress Bar for Deep Analysis */
.deep-analysis-progress {
    text-align: center;
    padding: 2rem;
}

.deep-analysis-progress .progress-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: white;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.deep-analysis-progress .progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.deep-analysis-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #3b82f6);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.deep-analysis-progress .progress-status {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

/* Deep Analysis Results */
.deep-analysis-results {
    animation: fadeIn 0.3s ease;
}

.deep-analysis-results h3 {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.deep-analysis-results h3 i {
    color: #8b5cf6;
}

/* Quality Summary */
.quality-summary {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.quality-item {
    text-align: center;
    padding: 0.75rem 0.5rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.quality-item .count {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.quality-item .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    opacity: 0.7;
}

.quality-item.brilliant {
    background: rgba(26, 188, 156, 0.2);
    color: #1abc9c;
}

.quality-item.good {
    background: rgba(52, 211, 153, 0.2);
    color: #34d399;
}

.quality-item.inaccuracy {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.quality-item.mistake {
    background: rgba(251, 146, 60, 0.2);
    color: #fb923c;
}

.quality-item.blunder {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Weaknesses Section */
.weaknesses-section {
    margin-bottom: 1.5rem;
}

.weaknesses-section h4 {
    color: #f59e0b;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.weaknesses-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.weakness-item {
    display: grid;
    grid-template-columns: 1fr auto 100px;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 12px;
    border-left: 3px solid #f59e0b;
}

.weakness-name {
    color: white;
    font-weight: 600;
}

.weakness-rate {
    color: #f59e0b;
    font-weight: 700;
    font-size: 0.85rem;
}

.weakness-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.weakness-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    border-radius: 3px;
}

.no-weaknesses {
    text-align: center;
    padding: 1.5rem;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 12px;
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-weight: 600;
}

/* Worst Moves Section */
.worst-moves-section {
    margin-bottom: 1.5rem;
}

.worst-moves-section h4 {
    color: #ef4444;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.worst-moves-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.worst-move-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-family: 'Fira Code', monospace;
    font-weight: 600;
}

.worst-move-item.mistake {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
}

.worst-move-item.blunder {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.worst-move-item .move-num {
    opacity: 0.6;
}

.worst-move-item .move-icon {
    font-size: 0.85rem;
}

/* Coach Recommendations */
.coach-recommendations {
    margin-bottom: 1.5rem;
}

.coach-recommendations h4 {
    color: #8b5cf6;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recommended-coaches-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.recommended-coach-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.recommended-coach-card:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateX(4px);
}

.recommended-coach-card .coach-thumb {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    object-fit: cover;
}

.recommended-coach-card .coach-info {
    flex: 1;
}

.recommended-coach-card .coach-name {
    color: white;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.recommended-coach-card .coach-specialty {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    text-transform: capitalize;
}

.recommended-coach-card .coach-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.recommended-coach-card .coach-rating {
    color: #fbbf24;
    font-size: 0.85rem;
    font-weight: 600;
}

.recommended-coach-card .coach-price {
    color: #10b981;
    font-size: 0.85rem;
    font-weight: 600;
}

.no-coaches {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 1rem;
}

/* Finish Button */
.btn-new-analysis {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    transition: all 0.2s ease;
}

.btn-new-analysis:hover {
    transform: scale(1.02);
}

/* Error State */
.deep-analysis-error {
    text-align: center;
    padding: 2rem;
    color: #ef4444;
}

.deep-analysis-error i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.deep-analysis-error span {
    display: block;
    margin-bottom: 1rem;
}

.deep-analysis-error button {
    padding: 0.75rem 1.5rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive for Deep Analysis */
@media (max-width: 640px) {
    .quality-summary {
        grid-template-columns: repeat(3, 1fr);
    }

    .quality-item .count {
        font-size: 1.25rem;
    }

    .weakness-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .weakness-bar {
        width: 100%;
    }
}

/* ===========================
   Fullscreen Modal Base
   =========================== */
.tournoi-fullscreen-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #121212;
    z-index: 10000;
    overflow-y: auto;
    overflow-x: hidden;
}

.tournoi-fullscreen-modal.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    #tournoi-scanner-modal.active,
    .tournoi-fullscreen-modal.active {
        align-items: flex-start !important;
        justify-content: center !important;
        padding-top: calc(var(--mobile-navbar-visual-bottom, var(--mobile-navbar-height, 58px)) + env(safe-area-inset-top) + 0.35rem) !important;
        padding-bottom: calc(env(safe-area-inset-bottom) + var(--mobile-vv-bottom-offset, 0px) + 0.35rem) !important;
        box-sizing: border-box !important;
        z-index: 11980 !important;
    }

    #tournoi-scanner-modal.active .tournoi-scanner-container,
    .tournoi-fullscreen-modal.active .move-editor-content,
    .tournoi-fullscreen-modal.active .analysis-dashboard {
        max-height: calc(var(--mobile-vv-height, 100dvh) - var(--mobile-navbar-visual-bottom, var(--mobile-navbar-height, 58px)) - env(safe-area-inset-bottom) - var(--mobile-vv-bottom-offset, 0px) - 0.7rem) !important;
    }
}

/* ===========================
   Move Editor Styles
   =========================== */
.move-editor-content {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 1rem;
    height: 100%;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.move-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.move-editor-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.move-editor-header p {
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.move-editor-header p.error {
    color: #ef4444;
}

.move-editor-header p.success {
    color: #22c55e;
}

.move-editor-header .close-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    flex: 0 0 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(148, 163, 184, 0.1) !important;
    border: 1px solid rgba(148, 163, 184, 0.2) !important;
    color: #94a3b8 !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    font-size: 0.9rem !important;
    padding: 0 !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
}

.move-editor-header .close-btn:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #ef4444 !important;
    transform: rotate(90deg) !important;
}

.move-editor-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
    max-height: 40vh;
    min-height: 100px;
}

.moves-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.move-row {
    display: grid;
    grid-template-columns: 40px 1fr 1fr;
    gap: 0.5rem;
    align-items: center;
}

.move-number {
    color: rgba(255, 255, 255, 0.5);
    font-family: monospace;
    font-size: 0.9rem;
    text-align: right;
}

.move-input-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.move-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9rem;
}

.move-input-container.invalid .move-input {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.error-icon {
    position: absolute;
    right: 40px;
    color: #ef4444;
}

.delete-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.move-input-container:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    color: #ef4444;
}

.move-editor-add {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.move-editor-add input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 12px;
}

.move-editor-add button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 48px;
    border-radius: 12px;
    cursor: pointer;
}

.move-editor-actions {
    display: flex;
    gap: 0.75rem;
}

.move-editor-actions .btn-secondary {
    flex: 1;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 16px;
    font-weight: 600;
    cursor: pointer;
}

.move-editor-actions .btn-primary {
    flex: 1.5;
    padding: 1rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    color: #fff;
    border-radius: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.move-editor-actions .btn-primary.warning {
    background: linear-gradient(135deg, #f97316, #ef4444);
}

/* ===========================
   Analysis Dashboard Styles
   =========================== */
.analysis-dashboard {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    padding: 0.75rem;
    background: #161512;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.dashboard-header h2 {
    color: #bababa;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.move-count-badge {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-weight: 500;
    color: #888;
}

.back-btn {
    background: #262421;
    border: none;
    color: #bababa;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.analyze-btn {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.analyze-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    overflow: hidden;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 768px) {
    .dashboard-content {
        flex-direction: row;
        max-width: 1100px;
        justify-content: center;
        align-items: flex-start;
    }
}

/* Board Section */
.board-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.board-with-eval {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: stretch;
}

.eval-bar {
    width: 16px;
    background: #fff;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.eval-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #333;
    transition: height 0.3s;
}

.board-container {
    width: 100%;
    max-width: 300px;
    aspect-ratio: 1;
    background: #262421;
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .board-container {
        max-width: 500px;
        max-height: 500px;
    }
}

/* Chessground styles */
.board-container .cg-wrap {
    width: 100%;
    height: 100%;
}

/* Custom Brushes for Chessground Arrows */
.cg-wrap svg defs marker#arrowhead-green path {
    fill: #22c55e;
}

.cg-wrap svg g[data-brush="green"] line {
    stroke: rgba(34, 197, 94, 0.7);
    stroke-width: 0.15;
}

/* Quality Markers on Squares */
.quality-marker {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #1a1a2e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.quality-marker.blunder {
    color: #ef4444;
    border-color: #ef4444;
}

.quality-marker.mistake {
    color: #f97316;
    border-color: #f97316;
}

.quality-marker.inaccuracy {
    color: #f4bf44;
    border-color: #f4bf44;
}

.quality-marker.brilliant {
    color: #3b82f6;
    border-color: #3b82f6;
}

.quality-marker.excellent {
    color: #22c55e;
    border-color: #22c55e;
}

.board-container cg-container {
    width: 100% !important;
    height: 100% !important;
}

/* Navigation Controls */
.analysis-dashboard .nav-controls {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.4rem;
    background: #262421;
    border-radius: 10px;
}

.nav-controls button {
    background: #3e3c39;
    border: none;
    color: #bababa;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.nav-controls button:hover {
    background: #4e4c49;
}

#play-btn {
    background: #81b64c;
    color: #000;
}

/* Moves Section */
.moves-section {
    background: #262421;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    max-height: 200px;
    overflow: hidden;
}

@media (min-width: 768px) {
    .moves-section {
        max-height: none;
        width: 320px;
        flex: 0 0 320px;
        height: 100%;
    }
}

.moves-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.moves-header h3 {
    color: #888;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.analyzing {
    color: #3b82f6;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.moves-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.move-pair {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.25rem;
}

.move-num {
    width: 24px;
    color: #666;
    font-size: 0.7rem;
    text-align: right;
    padding-right: 0.15rem;
}

.move-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #bababa;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.move-btn:hover {
    background: #2e2c29;
}

.move-btn.active {
    background: #3e3c39;
    color: #fff;
}

.move-btn .quality-icon {
    font-size: 0.7rem;
    margin-left: 0.25rem;
}

/* Move quality colors */
.move-btn.brilliant {
    color: #12b6ad;
}

.move-btn.excellent {
    color: #96bc4b;
}

.move-btn.good {
    color: #96bc4b;
}

.move-btn.book {
    color: #a88865;
}

.move-btn.inaccuracy {
    color: #f4bf44;
}

.move-btn.mistake {
    color: #e58f2a;
}

.move-btn.blunder {
    color: #ca3431;
}

.move-btn.invalid-move {
    border: 1px dashed #ef4444;
    background: rgba(239, 68, 68, 0.05);
    color: #ef4444 !important;
}

.invalid-marker {
    font-size: 0.75rem;
    margin-left: 0.25rem;
    filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.5));
}

/* Analysis Summary */
.analysis-summary {
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.analysis-summary .quality-summary {
    display: flex;
    justify-content: space-around;
    margin-bottom: 0.5rem;
}

.analysis-summary .quality-item {
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
}

.analysis-summary .quality-item span {
    display: block;
    font-size: 0.65rem;
    opacity: 0.7;
}

.weaknesses-mini {
    font-size: 0.8rem;
    text-align: center;
    padding: 0.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.weaknesses-mini.warning {
    color: #f97316;
    background: rgba(249, 115, 22, 0.1);
}

.weaknesses-mini.info {
    color: #f4bf44;
    background: rgba(244, 191, 68, 0.1);
}

.no-weakness {
    font-size: 0.8rem;
    color: #22c55e;
    text-align: center;
}

/* Coach Suggestion Teaser */
.coach-suggestion-teaser {
    margin-top: 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px dashed rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    text-align: center;
}

.coach-suggestion-teaser p {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.coach-suggestion-teaser p i {
    color: #f4bf44;
}

.btn-suggest-coach {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-suggest-coach:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* Recommendation Modal & Card */
.recommendation-container {
    background: #1a1a2e;
    width: 95%;
    max-width: 500px;
    padding: 2rem;
    border-radius: 24px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: tournoi-modal-slide 0.3s ease-out;
    margin: 2rem auto;
}

.recommendation-header {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.recommendation-header .close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    flex: 0 0 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(148, 163, 184, 0.1) !important;
    border: 1px solid rgba(148, 163, 184, 0.2) !important;
    border-radius: 50% !important;
    color: #94a3b8 !important;
    font-size: 0.9rem !important;
    cursor: pointer !important;
    padding: 0 !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
}

.recommendation-header .close-btn:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #ef4444 !important;
    transform: rotate(90deg) !important;
}

.recommendation-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: #fff;
    box-shadow: 0 8px 16px rgba(139, 92, 246, 0.3);
}

.recommendation-content {
    text-align: center;
}

.recommendation-content h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.recommendation-content p {
    color: #bababa;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.coaches-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Custom scrollbar for multi coaches */
.coaches-list::-webkit-scrollbar {
    width: 4px;
}

.coaches-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.suggested-coach-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 16px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s;
}

.suggested-coach-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateX(4px);
}

.coach-avatar {
    position: relative;
    width: 70px;
    height: 70px;
}

.coach-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.coach-avatar .badge-top {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #f4bf44;
    color: #000;
    font-size: 0.7rem;
    padding: 0.2rem;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coach-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: #fff;
}

.coach-tags {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.coach-tags span {
    font-size: 0.75rem;
    color: #bababa;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.coach-help-explanation {
    font-size: 0.75rem;
    color: #92b474;
    margin: 0.4rem 0 0 0;
    line-height: 1.3;
    background: rgba(129, 182, 76, 0.05);
    padding: 0.4rem;
    border-radius: 4px;
    border-left: 2px solid #81b64c;
}

.coach-help-explanation strong {
    color: #f4bf44;
}

.recommendation-reason {
    font-style: italic;
    font-size: 0.85rem !important;
}

.btn-contact-coach {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    border-radius: 14px;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-contact-coach:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.3);
}

@keyframes tournoi-modal-slide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Progress bar in header */
.analysis-status .progress-bar {
    width: 100px;
    height: 4px;
    background: #3e3c39;
    border-radius: 2px;
    overflow: hidden;
}

.analysis-status .progress-fill {
    height: 100%;
    background: #3b82f6;
    transition: width 0.3s;
}

/* Results Actions Buttons */
.results-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.tournoi-edit-btn {
    flex: 1;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.tournoi-edit-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}
