/* ============================================================
   Synopsys Badminton Club - Styles
   ============================================================ */

:root {
    --primary: #6c3ce0;
    --primary-light: #8b5cf6;
    --primary-dark: #5521c4;
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #273548;
    --bg-input: #334155;
    --border: #334155;
    --border-light: #475569;

    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================
   Header
   ============================================================ */
.app-header {
    padding: 30px 0 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-section i {
    font-size: 40px;
    color: var(--accent);
}

.logo-section h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.header-stats {
    display: flex;
    gap: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    text-align: center;
    min-width: 90px;
}

.stat-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-light);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   Tabs
   ============================================================ */
.tab-nav {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text);
    background: var(--bg-card-hover);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Section Header
   ============================================================ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h2 {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i {
    color: var(--accent);
}

.filter-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.search-box input {
    padding: 10px 14px 10px 36px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    width: 220px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-light);
}

.filter-select {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-light);
}

/* ============================================================
   Top 3 Players Podium
   ============================================================ */
.top-players {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 32px;
    padding: 20px 0;
}

.top-player {
    text-align: center;
    padding: 24px 20px 20px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    min-width: 180px;
    position: relative;
    transition: transform 0.2s;
}

.top-player:hover {
    transform: translateY(-4px);
}

.top-player .crown {
    font-size: 28px;
    margin-bottom: 8px;
}

.top-player.gold {
    border-color: #fbbf24;
    background: linear-gradient(135deg, #1e293b, #2d2006);
    order: 2;
    transform: scale(1.05);
}

.top-player.gold:hover {
    transform: scale(1.05) translateY(-4px);
}

.top-player.gold .crown { color: #fbbf24; }

.top-player.silver {
    border-color: #94a3b8;
    background: linear-gradient(135deg, #1e293b, #1e2530);
    order: 1;
}

.top-player.silver .crown { color: #94a3b8; }

.top-player.bronze {
    border-color: #d97706;
    background: linear-gradient(135deg, #1e293b, #2a1f0e);
    order: 3;
}

.top-player.bronze .crown { color: #d97706; }

.top-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    margin: 0 auto 12px;
    color: white;
}

.gold .top-avatar { background: linear-gradient(135deg, #f59e0b, #d97706); }
.silver .top-avatar { background: linear-gradient(135deg, #94a3b8, #64748b); }
.bronze .top-avatar { background: linear-gradient(135deg, #d97706, #b45309); }

.top-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.top-rating {
    color: var(--accent);
    font-weight: 700;
    font-size: 18px;
}

/* ============================================================
   Ranking Table
   ============================================================ */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-x: auto;
    box-shadow: var(--shadow);
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
}

.ranking-table thead {
    background: rgba(108, 60, 224, 0.1);
    border-bottom: 2px solid var(--border);
}

.ranking-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.ranking-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.ranking-table th.sortable:hover {
    color: var(--primary-light);
}

.ranking-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}

.ranking-table tbody tr {
    transition: background 0.15s;
}

.ranking-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.ranking-table tbody tr:last-child td {
    border-bottom: none;
}

.ranking-table tr.top-rank td {
    background: rgba(108, 60, 224, 0.05);
}

.ranking-table tr.rank-1 td:first-child {
    border-left: 3px solid #fbbf24;
}

.ranking-table tr.rank-2 td:first-child {
    border-left: 3px solid #94a3b8;
}

.ranking-table tr.rank-3 td:first-child {
    border-left: 3px solid #d97706;
}

.rank-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
    background: var(--bg-input);
    color: var(--text-secondary);
}

.rank-1 .rank-number {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #1e293b;
}

.rank-2 .rank-number {
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    color: #1e293b;
}

.rank-3 .rank-number {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: white;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.player-name-text {
    font-weight: 600;
}
.player-clickable {
    cursor: pointer;
    transition: color 0.2s;
}
.player-clickable:hover {
    color: var(--primary-light);
    text-decoration: underline;
}
.player-linked-user {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.3;
    opacity: 0.75;
}

/* Group Badges */
.group-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-field { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-pv    { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.badge-pd    { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.badge-ssg   { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-ae    { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-ipg   { background: rgba(239, 68, 68, 0.15);  color: #f87171; }
.badge-csg   { background: rgba(6, 182, 212, 0.15);  color: #22d3ee; }
.badge-tpg   { background: rgba(99, 102, 241, 0.15); color: #818cf8; }

.col-email {
    color: var(--text-muted);
    font-size: 13px;
}

/* Rating */
.rating-display {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rating-value {
    font-weight: 700;
    font-size: 16px;
    color: var(--accent);
}

.rating-delta {
    font-size: 12px;
    font-weight: 500;
}

.rating-delta.positive { color: var(--success); }
.rating-delta.negative { color: var(--danger); }
.rating-delta.neutral  { color: var(--text-muted); }

/* Form / Phong Độ */
.form-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-dots {
    display: flex;
    gap: 3px;
}

.form-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
}

.dot-win  { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.dot-loss { background: rgba(239, 68, 68, 0.2);  color: #f87171; }

.form-label {
    font-size: 12px;
    font-weight: 500;
}

.form-excellent { color: #fbbf24; }
.form-good      { color: #34d399; }
.form-ok        { color: #94a3b8; }
.form-bad       { color: #fb923c; }
.form-terrible  { color: #f87171; }
.form-none      { color: var(--text-muted); }

.no-data {
    color: var(--text-muted);
}

/* Record */
.record-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.win-rate-bar {
    width: 60px;
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
}

.win-rate-fill {
    height: 100%;
    background: var(--success);
    border-radius: 2px;
    transition: width 0.3s;
}

/* Streak */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.streak-win  { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.streak-loss { background: rgba(239, 68, 68, 0.15);  color: #f87171; }

/* ============================================================
   Match Form
   ============================================================ */
.match-form-container {
    max-width: 700px;
    margin: 0 auto;
}

.match-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.match-players {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 28px;
}

.player-side {
    flex: 1;
}

.player-side label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.player-select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
}

.player-select:focus {
    outline: none;
    border-color: var(--primary-light);
}

.vs-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 28px;
    box-shadow: 0 0 20px rgba(108, 60, 224, 0.3);
}

.preview-card {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.preview-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.preview-details {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
}

.preview-rating {
    font-weight: 700;
    color: var(--accent);
    font-size: 14px;
}

.preview-group {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
}

.preview-record {
    font-size: 13px;
    color: var(--text-secondary);
}

.form-indicator {
    font-weight: 700;
    margin-left: 4px;
}

.form-indicator.good    { color: var(--success); }
.form-indicator.neutral { color: var(--text-muted); }
.form-indicator.bad     { color: var(--danger); }

/* Score Input */
.score-input-section {
    margin-bottom: 24px;
}

.score-input-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.sets-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.set-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.set-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    min-width: 50px;
}

.sets-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.btn-set-action {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
    font-family: inherit;
}

.btn-set-action:hover:not(:disabled) {
    background: rgba(108, 60, 224, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-set-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-set-remove:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.sets-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
    font-weight: 600;
}

.score-input {
    width: 70px;
    padding: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    font-family: inherit;
}

.score-input:focus {
    outline: none;
    border-color: var(--primary-light);
}

.score-dash {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-muted);
}

/* Match Date */
.match-date-section {
    margin-bottom: 24px;
}

.match-date-section label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.date-input {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

.date-input:focus {
    outline: none;
    border-color: var(--primary-light);
}

/* Match Summary */
.match-summary {
    margin-bottom: 24px;
    padding: 20px;
    background: rgba(108, 60, 224, 0.08);
    border: 1px solid rgba(108, 60, 224, 0.2);
    border-radius: var(--radius-sm);
}

.match-summary h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-row {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
}

.summary-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-sm);
}

.summary-player.winner {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.summary-player.loser {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.1);
}

.summary-name {
    font-weight: 600;
    font-size: 15px;
}

.summary-sets {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
}

.summary-delta {
    font-size: 14px;
    font-weight: 600;
}

.summary-delta.positive { color: var(--success); }
.summary-delta.negative { color: var(--danger); }

.summary-new {
    font-size: 12px;
    color: var(--text-muted);
}

.summary-vs {
    font-weight: 800;
    font-size: 16px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 0 20px rgba(108, 60, 224, 0.3);
    transform: translateY(-1px);
}

.btn-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================================
   History
   ============================================================ */
.btn-clear-history {
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-clear-history:hover {
    background: rgba(239, 68, 68, 0.2);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    transition: all 0.2s;
}

.history-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow);
}

.history-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-match {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.history-player {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-player:last-child {
    justify-content: flex-end;
}

.h-name {
    font-weight: 600;
    font-size: 15px;
}

.h-sets {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-muted);
    min-width: 30px;
    text-align: center;
}

.h-winner .h-name { color: var(--success); }
.h-winner .h-sets { color: var(--success); }
.h-loser .h-name  { color: var(--text-secondary); }

.history-score {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

.history-rating-changes {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.history-rating-changes .positive { color: var(--success); }
.history-rating-changes .negative { color: var(--danger); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 15px;
}

/* ============================================================
   Guide Page
   ============================================================ */
.guide-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.guide-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s;
}

.guide-card:hover {
    border-color: var(--border-light);
}

.guide-card-full {
    grid-column: 1 / -1;
}

.guide-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: rgba(108, 60, 224, 0.06);
    border-bottom: 1px solid var(--border);
}

.guide-card-header i {
    font-size: 22px;
    color: var(--accent);
}

.guide-card-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.guide-card-header.collapsible {
    cursor: pointer;
    user-select: none;
    justify-content: space-between;
    transition: background .2s;
}

.guide-card-header.collapsible:hover {
    background: rgba(108, 60, 224, 0.1);
}

.guide-card-header.collapsible .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-collapse {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: transform .3s, background .2s;
}

.btn-collapse:hover {
    background: rgba(108, 60, 224, 0.12);
    color: var(--accent);
}

.guide-card-header.collapsible.open .btn-collapse {
    transform: rotate(180deg);
}

.collapsible-body {
    animation: slideDown .3s ease;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 2000px; }
}

.guide-card-body {
    padding: 24px;
}

.guide-card-body > p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.7;
}

.guide-formula {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.formula-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.guide-formula code {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-light);
    font-family: 'Courier New', monospace;
}

.guide-list {
    list-style: none;
    margin-bottom: 20px;
}

.guide-list li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    color: var(--text-secondary);
}

.guide-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-light);
    font-weight: 700;
}

.guide-examples {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    border: 1px solid var(--border);
}

.guide-example-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
}

.example-scenario {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.example-scenario:last-child {
    border-bottom: none;
}

.scenario-label {
    color: var(--text-secondary);
    font-size: 13px;
}

.scenario-result {
    font-weight: 700;
    font-size: 14px;
    padding: 2px 10px;
    border-radius: 12px;
    background: rgba(108, 60, 224, 0.1);
    color: var(--primary-light);
}

.scenario-result.positive {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.scenario-note {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* ELO Steps */
.elo-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.elo-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.elo-step-number {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: #fff;
    margin-top: 2px;
}

.elo-step-content {
    flex: 1;
}

.elo-step-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.elo-step-content .guide-formula {
    margin-bottom: 12px;
}

.formula-explain {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    line-height: 1.6;
}

/* ELO Example Box */
.elo-example-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.elo-example-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.elo-ex-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
}

.elo-ex-label {
    font-weight: 700;
    font-size: 14px;
    color: var(--accent);
    margin-bottom: 10px;
}

.elo-ex-calc {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: var(--text-primary);
    padding: 6px 0;
    line-height: 1.8;
}

.elo-ex-calc strong.positive {
    color: var(--success);
}

.elo-ex-calc strong.negative {
    color: var(--error);
}

.elo-delta {
    font-size: 13px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
}

.elo-delta.positive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.elo-delta.negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.elo-ex-meaning {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    font-style: italic;
    line-height: 1.5;
}

/* ELO Summary Table */
.elo-summary-table {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.elo-quick-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.elo-quick-table thead th {
    background: var(--bg-card);
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

.elo-quick-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.elo-quick-table tbody td.positive {
    color: var(--success);
    font-weight: 700;
}

.elo-quick-table tbody tr:hover {
    background: rgba(108, 60, 224, 0.05);
}

@media (max-width: 600px) {
    .elo-step {
        flex-direction: column;
        gap: 8px;
    }

    .elo-ex-calc {
        font-size: 12px;
        overflow-x: auto;
    }

    .elo-quick-table {
        font-size: 12px;
    }

    .elo-quick-table thead th,
    .elo-quick-table tbody td {
        padding: 8px 10px;
    }
}

/* Form Ratings in Guide */
.form-rating-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-rating-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.form-rating-badge {
    font-weight: 600;
    font-size: 14px;
    min-width: 120px;
}

.form-rating-badge.excellent { color: #fbbf24; }
.form-rating-badge.good      { color: #34d399; }
.form-rating-badge.ok        { color: #94a3b8; }
.form-rating-badge.bad       { color: #fb923c; }
.form-rating-badge.terrible  { color: #f87171; }

.form-rating-desc {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Handicap Table */
.handicap-table-container {
    overflow-x: auto;
    margin-bottom: 16px;
}

.handicap-table {
    width: 100%;
    border-collapse: collapse;
}

.handicap-table thead {
    background: rgba(108, 60, 224, 0.08);
}

.handicap-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

.handicap-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.handicap-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.handicap-table tbody tr:last-child td {
    border-bottom: none;
}

.diff-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.diff-0 { background: rgba(16, 185, 129, 0.12); color: #34d399; }
.diff-1 { background: rgba(59, 130, 246, 0.12); color: #60a5fa; }
.diff-2 { background: rgba(99, 102, 241, 0.12); color: #818cf8; }
.diff-3 { background: rgba(168, 85, 247, 0.12); color: #c084fc; }
.diff-4 { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.diff-5 { background: rgba(249, 115, 22, 0.12); color: #fb923c; }
.diff-6 { background: rgba(239, 68, 68, 0.12);  color: #f87171; }
.diff-7 { background: rgba(220, 38, 38, 0.15);  color: #ef4444; }

.handicap-value {
    font-weight: 800;
    font-size: 16px;
    color: var(--accent);
    letter-spacing: 1px;
}

.example-col {
    color: var(--text-muted);
    font-size: 13px;
}

.handicap-note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px 18px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.handicap-note i {
    color: var(--info);
    margin-top: 3px;
    flex-shrink: 0;
}

/* Handicap Calculator */
.handicap-calc {
    max-width: 700px;
}

.handicap-calc-inputs {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.handicap-calc-inputs .player-select {
    flex: 1;
}

.vs-badge-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
}

.handicap-result-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.hrc-players {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.hrc-player {
    flex: 1;
    text-align: center;
    padding: 16px;
    border-radius: var(--radius-sm);
}

.hrc-stronger {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.15);
}

.hrc-weaker {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.hrc-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.hrc-name {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 2px;
}

.hrc-rating {
    color: var(--accent);
    font-weight: 600;
    font-size: 14px;
}

.hrc-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.hrc-arrow i {
    font-size: 20px;
}

.hrc-diff {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-light);
    white-space: nowrap;
}

.hrc-handicap {
    background: rgba(108, 60, 224, 0.06);
    border: 1px solid rgba(108, 60, 224, 0.15);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
}

.hrc-handicap-label {
    font-weight: 700;
    font-size: 16px;
    color: var(--primary-light);
    margin-bottom: 12px;
}

.hrc-sets {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 12px;
}

.hrc-set {
    font-size: 14px;
    color: var(--text-secondary);
}

.hrc-set strong {
    color: var(--accent);
    font-size: 18px;
}

.hrc-note {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.hrc-fun {
    padding: 16px;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.12);
    border-radius: var(--radius-sm);
}

.hrc-fun-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--success);
    margin-bottom: 8px;
}

.hrc-fun-tag {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 16px;
    font-size: 13px;
    margin: 3px 4px;
    color: var(--text);
}

/* Fun Handicaps */
.fun-handicaps {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.fun-item {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.fun-item:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.fun-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.fun-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.fun-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

@media (max-width: 900px) {
    .guide-layout {
        grid-template-columns: 1fr;
    }

    .guide-card-full {
        grid-column: auto;
    }

    .handicap-calc-inputs {
        flex-direction: column;
    }

    .handicap-calc-inputs .player-select {
        width: 100%;
    }

    .hrc-players {
        flex-direction: column;
    }

    .hrc-arrow {
        transform: rotate(90deg);
    }

    .hrc-sets {
        flex-direction: column;
        gap: 8px;
    }

    .fun-handicaps {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Footer
   ============================================================ */
.app-footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}

/* ============================================================
   Toast Notifications
   ============================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    min-width: 280px;
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    background: var(--success);
    color: white;
}

.toast-error {
    background: var(--danger);
    color: white;
}

.toast-info {
    background: var(--info);
    color: white;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .top-players {
        flex-direction: column;
        align-items: center;
    }

    .top-player { order: unset !important; }
    .top-player.gold { transform: none; }
    .top-player.gold:hover { transform: translateY(-4px); }

    .match-players {
        flex-direction: column;
        align-items: stretch;
    }

    .vs-badge {
        align-self: center;
        margin-top: 0;
    }

    .ranking-table .col-email {
        display: none;
    }

    .filter-controls {
        flex-direction: column;
        width: 100%;
    }

    .search-box input {
        width: 100%;
    }

    .filter-select {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .app-container {
        padding: 0 12px;
    }

    .match-form {
        padding: 20px;
    }

    .ranking-table th,
    .ranking-table td {
        padding: 8px 10px;
    }

    .ranking-table .col-form,
    .ranking-table .col-record,
    .ranking-table .col-streak {
        display: none;
    }
}

/* ============================================================
   Auth Modal
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.3s ease;
}

.modal-logo {
    text-align: center;
    margin-bottom: 28px;
}

.modal-logo i {
    font-size: 48px;
    color: var(--accent);
    margin-bottom: 12px;
}

.modal-logo h2 {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    font-family: inherit;
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--primary);
    color: white;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group label i {
    margin-right: 6px;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-light);
}

.auth-error {
    color: var(--danger);
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 8px;
}

.btn-auth {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-auth:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 0 20px rgba(108, 60, 224, 0.3);
}

.btn-guest {
    background: linear-gradient(135deg, #10b981, #059669);
}

.btn-guest:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.guest-info {
    text-align: center;
    padding: 20px 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.guest-info i {
    font-size: 36px;
    color: #10b981;
    margin-bottom: 12px;
    display: block;
}

.guest-info p {
    font-size: 14px;
}

/* User Menu */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.user-badge i {
    color: var(--primary-light);
}

.admin-tag {
    padding: 4px 10px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.btn-logout {
    padding: 8px 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: var(--danger);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* ============================================================
   Match Handicap Banner
   ============================================================ */
.match-handicap-banner {
    margin-bottom: 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(108, 60, 224, 0.08));
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-sm);
    text-align: center;
}

.hb-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    margin-bottom: 8px;
}

.hb-title i {
    margin-right: 6px;
}

.hb-body {
    font-size: 14px;
    color: var(--text-secondary);
}

.hb-sets {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    margin: 8px 0;
    letter-spacing: 2px;
}

.hb-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* Fun Handicap Checkboxes */
.fun-handicap-select {
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.fun-handicap-select h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.fun-handicap-select h3 i {
    margin-right: 6px;
    color: var(--accent);
}

.fun-check-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fun-check {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.fun-check:hover {
    border-color: var(--primary-light);
}

.fun-check:has(input:checked) {
    background: rgba(108, 60, 224, 0.15);
    border-color: var(--primary-light);
    color: var(--primary-light);
}

.fun-check input {
    accent-color: var(--primary-light);
    cursor: pointer;
}

.btn-announce {
    margin-top: 16px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent), #d97706);
    border: none;
    border-radius: var(--radius-sm);
    color: #1e293b;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-announce:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* ============================================================
   Announcement Modal
   ============================================================ */
.announce-card {
    max-width: 560px;
    position: relative;
    text-align: center;
    padding: 0;
    overflow: hidden;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.5);
}

.announce-header {
    padding: 28px 24px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.announce-header i {
    font-size: 32px;
    color: var(--accent);
    margin-bottom: 8px;
}

.announce-header h2 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 2px;
    color: white;
}

.announce-players {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    justify-content: center;
}

.announce-p {
    flex: 1;
}

.announce-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.announce-rating {
    font-size: 14px;
    color: var(--accent);
    font-weight: 600;
}

.announce-vs {
    font-size: 28px;
    font-weight: 900;
    color: var(--primary-light);
    text-shadow: 0 0 20px rgba(108, 60, 224, 0.3);
}

.announce-handicap {
    padding: 20px 24px;
    background: rgba(245, 158, 11, 0.06);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.announce-h-label {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 10px;
}

.announce-h-sets {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.announce-h-sets strong {
    font-size: 20px;
    color: var(--accent);
}

.announce-handicap p {
    font-size: 13px;
    color: var(--text-muted);
}

.announce-fun {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.announce-fun-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--success);
    margin-bottom: 10px;
}

.announce-fun-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.announce-fun-tag {
    padding: 6px 14px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.announce-action {
    padding: 16px 24px;
}
.btn-enter-score {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--info), #2563eb);
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-enter-score:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn-enter-score i { margin-right: 8px; }

.announce-score-input { padding: 16px 24px; }
.asi-sets { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.asi-set {
    display: flex; align-items: center; gap: 8px; justify-content: center;
    background: var(--bg); padding: 8px 12px; border-radius: var(--radius-sm);
}
.asi-label { font-size: 12px; font-weight: 600; color: var(--text-muted); width: 45px; text-align: left; }
.asi-a, .asi-b {
    width: 56px; text-align: center; padding: 8px 4px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-input); color: var(--text); font-size: 16px; font-weight: 700;
}
.asi-a:focus, .asi-b:focus { border-color: var(--primary); outline: none; }
.asi-dash { font-weight: 700; color: var(--text-muted); }
.asi-remove {
    background: none; border: none; color: var(--danger); cursor: pointer;
    font-size: 14px; padding: 4px; opacity: 0.6;
}
.asi-remove:hover { opacity: 1; }
.asi-actions { display: flex; gap: 8px; justify-content: center; }
.btn-submit-result {
    padding: 10px 24px; border: none; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--success), #059669);
    color: white; font-size: 14px; font-weight: 700; cursor: pointer;
    transition: all 0.2s;
}
.btn-submit-result:hover { filter: brightness(1.15); }
.btn-submit-result i { margin-right: 6px; }

.result-header { background: linear-gradient(135deg, #f59e0b, #d97706) !important; }
.result-winner { padding: 20px 24px 12px; text-align: center; }
.result-crown { font-size: 36px; color: var(--accent); margin-bottom: 4px; }
.result-winner-name { font-size: 24px; font-weight: 800; color: var(--text); }
.result-winner-badge {
    display: inline-block; margin-top: 6px;
    padding: 4px 18px; border-radius: 20px;
    background: linear-gradient(135deg, var(--accent), #d97706);
    color: #000; font-size: 13px; font-weight: 800; letter-spacing: 1px;
}
.result-score-big {
    display: flex; align-items: center; justify-content: center;
    gap: 16px; padding: 16px 24px;
}
.result-player { flex: 1; text-align: center; }
.result-pname { font-size: 16px; font-weight: 700; }
.result-prating { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.result-win .result-pname { color: var(--success); }
.result-lose .result-pname { color: var(--text-secondary); }
.result-sets-display { text-align: center; }
.result-sets-num { font-size: 36px; font-weight: 900; color: var(--accent); letter-spacing: 4px; }
.result-sets-label { font-size: 10px; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; }

.result-detail-sets {
    padding: 12px 24px; display: flex; flex-direction: column; gap: 4px;
    border-top: 1px solid var(--border);
}
.result-set-row {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    font-size: 14px; padding: 4px 0;
}
.rsr-label { font-size: 11px; color: var(--text-muted); width: 40px; text-align: right; }
.rsr-score { font-weight: 700; width: 28px; text-align: center; color: var(--text-secondary); }
.rsr-score.rsr-win { color: var(--success); font-size: 16px; }
.rsr-dash { color: var(--text-muted); }

.result-elo-change {
    padding: 14px 24px; display: flex; gap: 16px; justify-content: center;
    border-top: 1px solid var(--border);
}
.result-elo-item {
    display: flex; gap: 8px; align-items: center;
    font-size: 13px; font-weight: 600;
}
.elo-delta { padding: 3px 10px; border-radius: 12px; font-weight: 700; font-size: 13px; }
.elo-plus { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.elo-minus { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.result-pending-note {
    padding: 10px 24px; font-size: 12px; color: var(--warning);
    background: rgba(245, 158, 11, 0.08); text-align: center;
    border-top: 1px solid var(--border);
}
.result-pending-note i { margin-right: 6px; }

.announce-footer {
    padding: 16px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================================
   Profile Dashboard
   ============================================================ */
.profile-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.profile-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
}
.profile-card h3 { margin: 0 0 14px; font-size: 15px; color: var(--text); }
.profile-card h3 i { color: var(--primary-light); margin-right: 8px; }
.profile-card-full { grid-column: 1 / -1; }

.profile-info-card {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, var(--bg-card) 60%, rgba(108, 60, 224, 0.08));
}
.profile-avatar { font-size: 52px; color: var(--primary-light); opacity: 0.8; }
.profile-details { flex: 1; }
.profile-details h3 { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-secondary); }
.profile-meta i { width: 14px; margin-right: 4px; color: var(--text-muted); }
.profile-linked {
    margin-top: 8px; font-size: 13px; color: var(--accent);
    padding: 6px 12px; background: rgba(245, 158, 11, 0.08);
    border-radius: var(--radius-sm); display: inline-block;
}
.profile-linked i { margin-right: 6px; }

.profile-form { display: flex; gap: 10px; align-items: center; }
.profile-form-col { flex-direction: column; align-items: stretch; }
.btn-profile-save {
    padding: 10px 18px; border: none; border-radius: var(--radius-sm);
    background: var(--primary); color: white;
    font-size: 13px; font-weight: 700; cursor: pointer;
    transition: all 0.2s; white-space: nowrap;
}
.btn-profile-save:hover { background: var(--primary-light); }
.btn-profile-save i { margin-right: 6px; }

.pstat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px; margin-bottom: 12px;
}
.pstat-item {
    background: var(--bg); padding: 14px; border-radius: var(--radius-sm);
    text-align: center; border: 1px solid var(--border);
}
.pstat-num { font-size: 24px; font-weight: 800; color: var(--text); }
.pstat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.pstat-win .pstat-num { color: var(--success); }
.pstat-lose .pstat-num { color: var(--danger); }
.pstat-highlight {
    padding: 10px 14px; background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.15); border-radius: var(--radius-sm);
    font-size: 13px; color: var(--text-secondary);
}
.pstat-highlight i { color: var(--accent); margin-right: 8px; }

.profile-history { display: flex; flex-direction: column; gap: 4px; max-height: 450px; overflow-y: auto; }
.ph-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: var(--radius-sm);
    background: var(--bg); border-left: 3px solid transparent;
    transition: background 0.15s;
}
.ph-item:hover { background: var(--bg-card-hover); }
.ph-win { border-left-color: var(--success); }
.ph-lose { border-left-color: var(--danger); }
.ph-result {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.ph-win .ph-result { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.ph-lose .ph-result { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.ph-details { flex: 1; min-width: 0; }
.ph-opponent { font-size: 13px; font-weight: 600; }
.ph-score { font-size: 12px; color: var(--text-secondary); }
.ph-sets { color: var(--text-muted); font-size: 11px; }
.ph-change {
    font-size: 14px; font-weight: 700; flex-shrink: 0;
    padding: 2px 8px; border-radius: 8px;
}
.ph-plus { color: var(--success); background: rgba(16, 185, 129, 0.1); }
.ph-minus { color: var(--danger); background: rgba(239, 68, 68, 0.1); }
.ph-date { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.text-muted { color: var(--text-muted); font-size: 13px; }

@media (max-width: 768px) {
    .profile-layout { grid-template-columns: 1fr; }
    .profile-info-card { flex-direction: column; text-align: center; }
    .profile-form { flex-direction: column; }
    .pstat-grid { grid-template-columns: repeat(3, 1fr); }
    .ph-date { display: none; }
}

/* ============================================================
   Admin Panel
   ============================================================ */
.admin-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.admin-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-card h3 i {
    color: var(--accent);
}

.admin-adjust .player-select {
    margin-bottom: 16px;
}

.adjust-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.adjust-row label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.btn-adjust {
    padding: 10px 20px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-adjust:hover {
    background: var(--primary-light);
}

.admin-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-danger {
    padding: 12px 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.admin-note {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.admin-card-full {
    grid-column: 1 / -1;
}

/* Add Player Form */
.admin-add-player .form-group {
    margin-bottom: 12px;
}

.admin-add-player .form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.admin-add-player .form-group input,
.admin-add-player .form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

.admin-add-player .form-group input:focus,
.admin-add-player .form-group select:focus {
    outline: none;
    border-color: var(--primary-light);
}

.custom-group-input {
    margin-top: 8px;
    animation: fadeIn .2s ease;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    align-items: end;
}

.form-group-btn {
    display: flex;
    align-items: flex-end;
}

.edit-player-fields {
    animation: fadeIn .2s ease;
}

.edit-player-fields .form-group {
    margin-bottom: 12px;
}

.edit-player-fields .form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
}

.edit-player-fields .form-group input,
.edit-player-fields .form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.edit-player-fields .form-group input:focus,
.edit-player-fields .form-group select:focus {
    border-color: var(--accent);
    outline: none;
}

/* Remove Player */
.admin-remove {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Admin History Management */
.admin-history-mgmt {
    max-height: 400px;
    overflow-y: auto;
}

.admin-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.admin-history-item:hover {
    border-color: var(--border-light);
}

.ahi-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.ahi-date {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.ahi-match {
    font-weight: 500;
    white-space: nowrap;
}

.ahi-match strong {
    color: var(--accent);
    margin: 0 4px;
}

.ahi-score {
    color: var(--text-muted);
    font-size: 12px;
}

.btn-delete-match {
    width: 28px;
    height: 28px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 50%;
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.btn-delete-match:hover {
    background: rgba(239, 68, 68, 0.25);
    transform: scale(1.1);
}

/* Admin Users Table */
.admin-users-mgmt {
    max-height: 400px;
    overflow-y: auto;
}

.admin-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-users-table thead th {
    background: var(--bg);
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
}

.admin-users-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.admin-users-table tbody td code {
    background: rgba(108, 60, 224, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--accent);
}

.admin-users-table tbody td.date-col {
    color: var(--text-muted);
    font-size: 12px;
}

.admin-users-table tbody tr:hover {
    background: rgba(108, 60, 224, 0.03);
}

.role-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.role-admin {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.role-user {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.btn-delete-user {
    width: 28px;
    height: 28px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 50%;
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.2s;
}

.btn-delete-user:hover {
    background: rgba(239, 68, 68, 0.25);
    transform: scale(1.1);
}

/* History Fun Tags */
.history-fun {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.history-fun-tag {
    padding: 3px 10px;
    background: rgba(108, 60, 224, 0.1);
    border-radius: 12px;
    font-size: 11px;
    color: var(--primary-light);
}

@media (max-width: 900px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .header-right {
        flex-direction: column;
        align-items: flex-start;
    }

    .adjust-row {
        flex-wrap: wrap;
    }

    .form-row-3 {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Sync Button */
.viewer-count {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.viewer-count i {
    font-size: 11px;
    opacity: 0.9;
}
.btn-sync {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
}
.btn-sync:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}
.btn-sync .syncing {
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Leaderboard Grid */
.leaderboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 32px;
}
.leaderboard-card {
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.leaderboard-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}
.leaderboard-header h3 {
    margin: 0;
    font-size: 16px;
}
.leaderboard-header h3 span {
    font-weight: 400;
    opacity: 0.7;
    font-size: 14px;
}
.leaderboard-header.monthly {
    background: linear-gradient(135deg, rgba(34,197,94,0.15), rgba(34,197,94,0.05));
    color: #22c55e;
    border-bottom: 1px solid rgba(34,197,94,0.2);
}
.leaderboard-header.monthly i { color: #22c55e; }
.leaderboard-header.yearly {
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(99,102,241,0.05));
    color: var(--primary);
    border-bottom: 1px solid rgba(99,102,241,0.2);
}
.leaderboard-header.yearly i { color: var(--primary); }

.leaderboard-body {
    padding: 0;
}
.lb-empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}
.lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.lb-table thead th {
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
}
.lb-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.lb-table tbody tr:last-child { border-bottom: none; }
.lb-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.lb-table tbody tr.lb-top { background: rgba(255,255,255,0.02); }
.lb-table td {
    padding: 10px 12px;
    white-space: nowrap;
}
.lb-rank {
    font-weight: 700;
    width: 50px;
    color: var(--text-secondary);
}
.lb-top .lb-rank { color: var(--accent); }
.lb-name { font-weight: 600; color: var(--text); }
.lb-group {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 6px;
}
.lb-matches, .lb-wl {
    color: var(--text-secondary);
    text-align: center;
}
.lb-pts {
    font-weight: 700;
    font-size: 15px;
    text-align: right;
    padding-right: 16px;
}
.lb-pts.positive { color: #22c55e; }
.lb-pts.negative { color: #ef4444; }
.lb-pts.neutral { color: var(--text-muted); }

@media (max-width: 768px) {
    .leaderboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-top: 20px;
    }
    .lb-table { font-size: 13px; }
    .lb-table td, .lb-table thead th { padding: 8px 8px; }
}

/* Chat / Challenge */
.challenge-chat-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}
@media (max-width: 900px) {
    .challenge-chat-layout { grid-template-columns: 1fr; }
}

.challenge-panel {
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.challenge-panel h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text);
}
.challenge-panel h3 i { color: var(--accent); margin-right: 8px; }
.direct-match-section {
    background: var(--bg);
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 12px;
}
.direct-match-section h3 { margin: 0 0 12px; font-size: 15px; color: var(--text); }
.direct-match-section h3 i { color: var(--info); margin-right: 8px; }
.direct-match-form { display: flex; flex-direction: column; gap: 10px; }
.dm-players { display: flex; gap: 8px; align-items: center; }
.dm-players select { flex: 1; }
.dm-vs { font-weight: 700; color: var(--accent); font-size: 13px; }
.dm-actions { display: flex; gap: 8px; justify-content: flex-end; }
.badge-direct {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.challenge-form {
    display: flex;
    gap: 10px;
    align-items: center;
}
.challenge-form select { flex: 1; }
.challenge-form .btn-primary {
    white-space: nowrap;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    background: var(--accent);
    border: none;
    color: #000;
    cursor: pointer;
    transition: all 0.2s;
}
.challenge-form .btn-primary:hover { filter: brightness(1.15); }
.challenge-list { display: flex; flex-direction: column; gap: 10px; max-height: 500px; overflow-y: auto; }
.challenge-list h4 { margin: 8px 0 4px; font-size: 13px; color: var(--text-muted); }
.challenge-list h4 i { margin-right: 6px; }
.challenge-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
}
.challenge-card.challenge-incoming { border-left: 3px solid var(--info); }
.challenge-card.challenge-outgoing { border-left: 3px solid var(--text-muted); }
.challenge-card.challenge-accepted { border-left: 3px solid var(--success); }
.challenge-info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.challenge-rating { color: var(--accent); font-weight: 600; }
.challenge-time { color: var(--text-muted); font-size: 11px; }
.badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 700; }
.badge-pending { background: rgba(107, 114, 128, 0.2); color: var(--text-muted); }
.badge-accepted { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.challenge-actions { display: flex; gap: 6px; margin-top: 8px; }
.challenge-actions button {
    padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 600;
    cursor: pointer; border: none; transition: all 0.2s;
}
.challenge-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}
.challenge-submitted-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.btn-challenge-user-cancel {
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    transition: all 0.2s;
}
.btn-challenge-user-cancel:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.5);
}
.btn-challenge-user-cancel i { margin-right: 4px; }
.btn-accept { background: var(--success); color: #fff; }
.btn-accept:hover { filter: brightness(1.15); }
.btn-decline { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-decline:hover { background: rgba(239, 68, 68, 0.3); }
.challenge-empty {
    display: flex; flex-direction: column; align-items: center;
    color: var(--text-muted); gap: 8px; padding: 30px 0; font-size: 14px;
}
.challenge-empty i { font-size: 32px; opacity: 0.3; }
.challenge-login-prompt {
    display: flex; align-items: center; gap: 8px; padding: 30px; justify-content: center;
    color: var(--text-muted); font-size: 14px;
}

.user-rep { margin-left: 6px; }
.stars { display: inline-flex; gap: 1px; }
.stars i { font-size: 11px; }
.stars .fa-star { color: var(--accent); }
.stars .fa-star-half-alt { color: var(--accent); }
.stars .far.fa-star { color: var(--text-muted); opacity: 0.4; }

.reg-player-section {
    margin-top: 4px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.reg-player-section label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.reg-player-section label i { color: var(--accent); margin-right: 6px; }
.reg-select {
    width: 100%; padding: 10px 12px; border-radius: 10px;
    background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
    font-size: 13px; outline: none; margin-bottom: 8px;
}
.reg-new-player {
    display: flex; flex-direction: column; gap: 8px; padding: 10px;
    background: rgba(99, 102, 241, 0.05); border-radius: 10px; border: 1px dashed var(--border);
}
.reg-new-player input, .reg-new-player select {
    padding: 9px 12px; border-radius: 8px;
    background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
    font-size: 13px; outline: none;
}

.admin-challenge-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 10px; margin-bottom: 8px; border-left: 3px solid var(--accent);
}
.achi-players { font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.achi-players small { color: var(--text-muted); font-size: 12px; }
.achi-players .vs { color: var(--accent); font-weight: 700; margin: 0 4px; }
.achi-meta { display: flex; align-items: center; gap: 10px; }
.achi-time { font-size: 11px; color: var(--text-muted); }
.btn-complete-challenge {
    padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 600;
    background: var(--success); color: #fff; border: none; cursor: pointer;
    transition: all 0.2s;
}
.btn-complete-challenge:hover { filter: brightness(1.15); }

/* Challenge Score Form */
.challenge-score-form {
    margin-top: 12px;
    padding: 12px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px dashed rgba(99, 102, 241, 0.25);
    border-radius: 10px;
}
.csf-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
}
.csf-vs { color: var(--accent); font-size: 12px; }
.csf-label { color: var(--text); }
.csf-sets { display: flex; flex-direction: column; gap: 6px; }
.csf-set {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
.csf-set-label {
    width: 44px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    flex-shrink: 0;
}
.csf-set input[type="number"] {
    width: 50px;
    padding: 6px 8px;
    border-radius: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    outline: none;
}
.csf-set input:focus { border-color: var(--primary); }
.csf-set span { color: var(--text-muted); font-weight: 700; }
.csf-remove-set {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 12px;
    opacity: 0.6;
    transition: all 0.2s;
}
.csf-remove-set:hover { color: var(--danger); opacity: 1; }
.csf-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}
.btn-add-set {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-add-set:hover { background: rgba(99, 102, 241, 0.2); }
.btn-submit-score {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    background: var(--primary);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-submit-score:hover { background: var(--primary-dark); }
.csf-result {
    font-size: 16px;
    font-weight: 800;
    color: var(--accent);
    margin: 0 6px;
}
.csf-detail {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.challenge-card.challenge-submitted {
    border-left: 3px solid var(--warning);
}
.badge-submitted {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}
.badge-submitted i { margin-right: 4px; }

/* Admin Challenge Review */
.admin-section-label {
    font-size: 14px;
    color: var(--text-muted);
    margin: 12px 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.admin-section-label i { margin-right: 6px; }
.achi-review {
    border-left-color: var(--warning) !important;
    background: rgba(245, 158, 11, 0.03);
}
.achi-score-big {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
    margin: 0 8px;
}
.achi-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}
.achi-submitter strong { color: var(--primary); }
.achi-review-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.btn-approve-score {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    background: var(--success);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-approve-score:hover { filter: brightness(1.15); }
.btn-reject-score {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-reject-score:hover { background: rgba(239, 68, 68, 0.25); }
.btn-delete-challenge {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(100, 116, 139, 0.1);
    border: 1px solid rgba(100, 116, 139, 0.3);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-delete-challenge:hover { background: rgba(239, 68, 68, 0.15); color: var(--danger); border-color: rgba(239, 68, 68, 0.3); }

@media (max-width: 768px) {
    .csf-set input[type="number"] { width: 42px; padding: 5px 4px; }
    .achi-review-actions { flex-direction: column; }
    .achi-score-big { font-size: 16px; }
}

.admin-users-table th:nth-child(3), .admin-users-table td:nth-child(3) { min-width: 120px; }
.admin-users-table .stars-col { white-space: nowrap; }
.admin-users-table .actions-col { white-space: nowrap; display: flex; gap: 4px; }
.btn-edit-user {
    background: rgba(99, 102, 241, 0.15); border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--primary); padding: 4px 8px; border-radius: 6px; cursor: pointer;
    transition: all 0.2s; font-size: 12px;
}
.btn-edit-user:hover { background: rgba(99, 102, 241, 0.3); }
.text-muted { color: var(--text-muted); }
.form-input {
    width: 100%; padding: 10px 12px; border-radius: 10px;
    background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
    font-size: 14px; outline: none; box-sizing: border-box;
}
.form-input:focus { border-color: var(--primary); }
.btn-secondary {
    padding: 8px 16px; border-radius: 8px; font-size: 13px;
    background: var(--bg); border: 1px solid var(--border); color: var(--text);
    cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--primary); }

.chat-container {
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.chat-container h3 {
    padding: 16px 16px 0;
    margin: 0;
    font-size: 16px;
    color: var(--text);
}
.chat-container h3 i { color: var(--primary); margin-right: 8px; }
.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}
.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
    font-size: 14px;
}
.chat-empty i { font-size: 40px; opacity: 0.3; }

.chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    align-self: flex-start;
}
.chat-msg.chat-mine {
    align-self: flex-end;
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.3);
}
.chat-msg.chat-challenge {
    border-left: 3px solid var(--accent);
}
.chat-msg.chat-challenge.chat-mine {
    border-left: none;
    border-right: 3px solid var(--accent);
}
.chat-msg.chat-result {
    border-left: 3px solid var(--success);
    background: rgba(16, 185, 129, 0.08);
    align-self: center;
    max-width: 95%;
    text-align: center;
}
.chat-msg.chat-result .chat-sender { color: var(--success); }
.chat-msg.chat-result .chat-msg-body i { color: var(--accent); }
.chat-msg.chat-system {
    border-left: 3px solid var(--info);
    background: rgba(59, 130, 246, 0.08);
    align-self: center;
    max-width: 95%;
    text-align: center;
}
.chat-msg.chat-system .chat-sender { color: var(--info); }
.chat-msg.chat-system .chat-msg-body i { color: var(--info); margin-right: 4px; }
.chat-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}
.chat-sender {
    font-weight: 700;
    font-size: 13px;
    color: var(--primary);
}
.chat-mine .chat-sender { color: var(--accent); }
.chat-time {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}
.chat-msg-body {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    word-wrap: break-word;
}
.chat-msg-body i {
    color: var(--accent);
    margin-right: 4px;
}

.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.chat-quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.chat-quick-btn {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.chat-quick-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}
.chat-quick-btn i { margin-right: 4px; }

.chat-input-row {
    display: flex;
    gap: 8px;
}
.chat-input {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 10px 18px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.chat-input:focus {
    border-color: var(--primary);
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--primary-dark); transform: scale(1.05); }

.chat-login-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    color: var(--text-muted);
    font-size: 13px;
}
.chat-login-prompt i { color: var(--text-muted); }

.btn-clear-chat {
    margin: 12px auto;
    display: block;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-clear-chat:hover { color: #ef4444; border-color: #ef4444; }

@media (max-width: 768px) {
    .chat-messages { height: 380px; padding: 10px; }
    .chat-msg { max-width: 90%; }
    .chat-quick-btn { font-size: 11px; padding: 5px 10px; }
}

/* ============================================================
   Player Stats Modal
   ============================================================ */
.player-stats-card {
    max-width: 560px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 0;
}
.ps-header {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 28px 28px 20px;
    background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(168,85,247,0.08));
    border-bottom: 1px solid var(--border);
}
.ps-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 800; color: #fff;
    flex-shrink: 0;
}
.ps-info { flex: 1; }
.ps-name { margin: 0 0 6px; font-size: 22px; color: var(--text); }
.ps-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ps-rank { font-size: 13px; color: var(--accent); font-weight: 600; }
.ps-linked { font-size: 12px; color: var(--text-muted); }
.ps-rating-big { font-size: 32px; font-weight: 800; color: var(--primary-light); line-height: 1; }
.ps-rating-big small { font-size: 14px; font-weight: 500; color: var(--text-muted); }

.ps-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    margin: 0;
}
.ps-stats-grid .pstat-item {
    background: var(--bg-card);
    padding: 16px 12px;
    text-align: center;
}

.ps-highlights {
    padding: 12px 24px;
    display: flex; flex-direction: column; gap: 6px;
}
.ps-hl-item {
    font-size: 13px; padding: 8px 12px;
    border-radius: 8px; display: flex; align-items: center; gap: 8px;
}
.ps-hl-item i { width: 18px; text-align: center; }
.ps-hl-good { background: rgba(34,197,94,0.08); color: var(--success); }
.ps-hl-bad { background: rgba(239,68,68,0.08); color: var(--danger); }

.ps-form-section, .ps-h2h-section, .ps-history-section {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}
.ps-form-section h3, .ps-h2h-section h3, .ps-history-section h3 {
    font-size: 14px; margin: 0 0 12px; color: var(--text-muted);
}
.ps-form-section h3 i, .ps-h2h-section h3 i, .ps-history-section h3 i {
    color: var(--primary-light); margin-right: 6px;
}
.ps-form-display { display: flex; align-items: center; gap: 10px; }

.ps-h2h-list { display: flex; flex-direction: column; gap: 8px; }
.ps-h2h-item {
    display: grid;
    grid-template-columns: 1fr auto 80px auto;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.ps-h2h-name { font-weight: 600; color: var(--text); }
.ps-h2h-record { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.ps-h2h-bar {
    height: 6px; border-radius: 3px;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
}
.ps-h2h-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.ps-h2h-good { background: var(--success); }
.ps-h2h-bad { background: var(--danger); }
.ps-h2h-pct { font-size: 12px; font-weight: 700; color: var(--text-muted); text-align: right; min-width: 32px; }

.ps-history-section .ph-item:last-child { border-bottom: none; }

@media (max-width: 480px) {
    .ps-header { flex-direction: column; text-align: center; padding: 20px 16px; }
    .ps-meta { justify-content: center; }
    .ps-stats-grid { grid-template-columns: repeat(3, 1fr); }
    .ps-h2h-item { grid-template-columns: 1fr auto 60px auto; gap: 6px; font-size: 12px; }
    .ps-highlights, .ps-form-section, .ps-h2h-section, .ps-history-section { padding: 12px 16px; }
}
