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

:root {
    --primary: #1e1e1e;
    --secondary: #2e2e2e;
    --accent: #3b82f6;
    --red: #ef4444;
    --orange: #f97316;
    --yellow: #eab308;
    --gray: #6b7280;
    --light: #f3f4f6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--primary);
    color: #e5e7eb;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--primary);
}

.navbar {
    background: var(--secondary);
    border-bottom: 1px solid #404040;
    padding: 12px 20px;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.workspace {
    display: flex;
    flex: 1;
    gap: 0;
    overflow: hidden;
}

.main-board {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--primary);
    border-right: 1px solid #404040;
}

.board-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

#board {
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.board-info {
    font-size: 14px;
    color: #9ca3af;
    text-align: center;
    min-height: 20px;
}

.analysis-sidebar {
    width: 300px;
    background: var(--secondary);
    border-left: 1px solid #404040;
    padding: 16px;
    overflow-y: auto;
}

.analysis-panel {
    background: var(--primary);
    border: 1px solid #404040;
    border-radius: 4px;
    padding: 16px;
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #404040;
}

.analysis-move {
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.analysis-eval {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
}

.analysis-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 6px 0;
}

.label {
    color: #9ca3af;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-row span:last-child {
    color: white;
    font-weight: 500;
}

.explanation {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #404040;
    font-size: 13px;
    line-height: 1.5;
    color: #d1d5db;
    font-style: italic;
}

#detailEvalChange {
    font-weight: 700;
}

#detailEvalChange.blunder {
    color: #fca5a5;
}

#detailEvalChange.mistake {
    color: #fed7aa;
}

#detailEvalChange.inaccuracy {
    color: #fef08a;
}

@media (max-width: 1200px) {
    .workspace {
        flex-direction: column;
    }

    .sidebar, .analysis-sidebar {
        width: 100%;
        max-height: 200px;
        border: none;
        border-bottom: 1px solid #404040;
    }

    .main-board {
        border-right: none;
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #404040;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.sidebar {
    width: 280px;
    background: var(--secondary);
    border-right: 1px solid #404040;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.input-section {
    padding: 16px;
    border-bottom: 1px solid #404040;
}

.pgn-input {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    border: 1px solid #404040;
    border-radius: 4px;
    color: #e5e7eb;
    font-size: 12px;
    font-family: monospace;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 10px;
}

.pgn-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.btn-load {
    width: 100%;
    padding: 8px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-load:hover {
    background: #2563eb;
}

.btn-load:active {
    background: #1d4ed8;
}

.status-msg {
    margin-top: 8px;
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
}

.status-msg.info {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
}

.status-msg.error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.moves-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 12px;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: #9ca3af;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.moves-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
}

.move-item {
    padding: 6px 10px;
    background: var(--primary);
    border: 1px solid #404040;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.move-item:hover {
    background: #3a3a3a;
    border-color: #555;
}

.move-item.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.move-item.blunder {
    background: rgba(239, 68, 68, 0.15);
    border-left: 3px solid var(--red);
    border-color: #404040;
    color: #fca5a5;
}

.move-item.mistake {
    background: rgba(249, 115, 22, 0.15);
    border-left: 3px solid var(--orange);
    border-color: #404040;
    color: #fed7aa;
}

.move-item.inaccuracy {
    background: rgba(234, 179, 8, 0.15);
    border-left: 3px solid var(--yellow);
    border-color: #404040;
    color: #fef08a;
}

.move-num {
    color: #9ca3af;
    font-size: 12px;
    margin-right: 3px;
}

#board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 500px;
    height: 500px;
    background: #8b6914;
    border: 2px solid #5a4a0a;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.square {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    user-select: none;
    cursor: default;
    font-weight: bold;
    line-height: 1;
}
