:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-light: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.7);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: rgba(0, 0, 0, 0.05);

    --brand-font: 'Outfit', sans-serif;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    padding: 2rem;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

.orb {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    z-index: -1;
    filter: blur(120px);
    opacity: 0.1;
}

.orb-1 { background: var(--primary-color); top: -20%; left: -10%; }
.orb-2 { background: #ec4899; bottom: -20%; right: -10%; }
.orb-3 { background: #22c55e; top: 40%; left: 80%; opacity: 0.05; }

.dashboard {
    width: 95%;
    max-width: 1550px;
}

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

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #2563eb, #9333ea);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.game-container {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: start;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 300px;
    flex-shrink: 0;
}

.logs {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 450px;
    height: calc(var(--board-size) + 40px);
    flex-shrink: 0;
}

.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    padding: 1.5rem;
    min-height: 200px;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.glass-panel h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.form-select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
    margin-top: 0.3rem;
}

.form-select:focus {
    border-color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.form-select option {
    background-color: #1e293b;
    color: white;
}

/* Mode Toggle */
.mode-btn {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    transition: all 0.2s;
    font-family: inherit;
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.mode-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.form-input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    margin-top: 0.3rem;
}

.form-input:focus {
    border-color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* XP Ranking Display */
.xp-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.xp-row.rank-1 { background: linear-gradient(135deg, #fef9c3, #fde68a); border-color: #f59e0b; }
.xp-row.rank-2 { background: linear-gradient(135deg, #f1f5f9, #e2e8f0); border-color: #94a3b8; }
.xp-row.rank-3 { background: linear-gradient(135deg, #fed7aa, #fdba74); border-color: #f97316; }

.xp-badge {
    font-weight: 700;
    font-size: 0.85rem;
    color: #059669;
}

/* 🌟 CUSTOM SEARCHABLE DROPDOWN 🌟 */
.custom-dropdown {
    position: relative;
    width: 100%;
    margin-top: 0.3rem;
    font-family: inherit;
}

.dropdown-trigger {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    transition: all 0.2s;
    user-select: none;
}

.dropdown-trigger:hover {
    border-color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: #ffffff;
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideDown 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-dropdown.open .dropdown-panel {
    display: flex;
}

.search-container {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.02);
}

.dropdown-search {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: white;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s;
}

.dropdown-search:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
}

.options-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 4px 0;
}

.options-list::-webkit-scrollbar {
    width: 6px;
}

.options-list::-webkit-scrollbar-track {
    background: transparent;
}

.options-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.options-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.option-item {
    padding: 8px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.1s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.option-item:hover {
    background-color: #eff6ff;
    color: #1d4ed8;
}

.option-item.selected {
    background-color: #3b82f6;
    color: white;
    font-weight: 600;
}

.no-results {
    padding: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

.btn {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn.primary {
    background: linear-gradient(to right, #3b82f6, #8b5cf6);
    color: white;
}

.btn.primary:hover:not(:disabled) {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
    transform: translateY(-2px);
}

.btn.secondary {
    background: #e2e8f0;
    color: #0f172a;
    border: 1px solid #cbd5e1;
}

.btn.btn-pause {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    width: auto;
    border-radius: 6px;
    background: var(--glass-border, rgba(255, 255, 255, 0.5));
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-main);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn.btn-pause.active {
    background: #10b981;
    color: #fff;
    border-color: #059669;
}

.btn.btn-pause:hover {
    filter: brightness(0.95);
}

.btn.secondary:hover:not(:disabled) {
    background: #cbd5e1;
}

.status-box {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
    color: #059669;
    font-weight: 600;
}

/* --- Quick Stats Enhancements --- */
#quickStats {
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%) !important;
    backdrop-filter: blur(8px);
    box-shadow: inset 0 0 20px rgba(255,255,255,0.02);
}

#playerScores {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
}

.score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.3s;
}

.score-row.active {
    background: rgba(79, 70, 229, 0.15);
    border: 1px solid rgba(79, 70, 229, 0.3);
    transform: scale(1.02);
}

.score-val {
    font-weight: 700;
    color: var(--primary-color);
}

.dice-container {
    width: 80px;
    height: 80px;
    background: white;
    color: black;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 auto 1rem auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

.hint {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

/* Turn Timer Bar */
.turn-timer-container {
    width: 100%;
    margin-top: 5px;
    display: flex;
    flex-direction: column;
}

.timer-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.timer-bar-fill {
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
    transition: width 0.1s linear, background-color 0.3s;
}

.dice-btn-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.dice-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    color: #0f172a;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.dice-btn:hover:not(:disabled) {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.dice-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.dice-btn-r {
    background: linear-gradient(to right, #3b82f6, #8b5cf6);
    color: white;
    border-color: transparent;
    font-weight: 800;
}

.dice-btn-r:hover:not(:disabled) {
    background: linear-gradient(to right, #2563eb, #7c3aed);
    border-color: transparent;
}

.log-box {
    height: 150px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.8rem;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    border-radius: 6px;
}

.log-box p {
    margin-bottom: 0.2rem;
}

/* 🌟 BOARD STYLES MOVED TO shared-board.css 🌟 */
/* Analysis Table */
.analysis-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    color: var(--text-main);
    min-width: 1000px;
}

.analysis-table th {
    text-align: left;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02rem;
    border-bottom: 2px solid var(--border-color);
}

.analysis-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

.analysis-table tr:hover {
    background: rgba(16, 185, 129, 0.05);
}

.analysis-table tr.best-move {
    background: rgba(16, 185, 129, 0.1);
}

.analysis-table tr.best-move td:first-child::before {
    content: '★ ';
    color: #10b981;
}

.score-positive { color: #059669; font-weight: 600; }
.score-negative { color: #dc2626; }
.score-neutral { opacity: 0.4; }
